@cardenelabs/dragon 0.42.2 → 0.43.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.
@@ -1,2 +1,3 @@
1
- "use strict";var DragonPlayer=(()=>{var wn=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var ts=Object.getOwnPropertyNames;var ns=Object.prototype.hasOwnProperty;var rs=(t,n)=>{for(var a in n)wn(t,a,{get:n[a],enumerable:!0})},ss=(t,n,a,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ts(n))!ns.call(t,l)&&l!==a&&wn(t,l,{get:()=>n[l],enumerable:!(c=es(n,l))||c.enumerable});return t};var is=t=>ss(wn({},"__esModule",{value:!0}),t);var Ci={};rs(Ci,{mountDiagram:()=>Zr});var $n=t=>/[0-9A-Za-z]$/u.test(t)?`${t} `:t,os=t=>t.charAt(0).toUpperCase()+t.slice(1),ze={ja:{cannotDraw:t=>`\u56F3\u3092\u63CF\u3051\u306A\u3044: ${t}`,unknownColor:t=>`colors \u306E ${t} \u306F\u8272\u5473\u306B\u7121\u3044\u8272\u306E\u540D\u524D`,unreadableColor:t=>`colors \u306E ${t} \u306E\u5024\u3092\u8272\u3068\u3057\u3066\u8AAD\u3081\u306A\u3044`,overview:"\u5168\u4F53\u56F3",prev:"\u524D\u306E\u6BB5",pause:"\u6B62\u3081\u308B",play:"\u52D5\u304B\u3059",next:"\u6B21\u306E\u6BB5",steps:t=>`${t} \u306E\u6BB5`,side:"\u8107\u9053",sideNote:"\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044",sideFrom:t=>`${t} \u3064\u306E\u72B6\u614B\u304B\u3089\u5165\u308C\u308B`,trail:"\u901A\u3063\u305F\u72B6\u614B",start:"\u59CB\u307E\u308A",end:"\u7D42\u308F\u308A",badgeName:t=>`\u6BB5\u306E\u756A\u53F7 ${t}`,quoted:t=>`\u300C${t}\u300D`,iconOf:t=>`\u300C${t} \u306E\u7D75\u67C4\u300D`,coin:"\u300C\u786C\u8CA8\u300D",envelope:"\u300C\u5C01\u7B52\u300D",textsOverlap:(t,n)=>`${$n(t)}\u3068${$n(n)}\u304C\u91CD\u306A\u308B`,lineCrosses:(t,n,a)=>`\u7DDA ${t} \u2192 ${n} \u304C${$n(a)}\u3092\u6A2A\u5207\u308B`,timeUnits:{ms:"\u30DF\u30EA\u79D2",s:"\u79D2",min:"\u5206",h:"\u6642\u9593",d:"\u65E5"},zoom:"\u62E1\u5927",range:(t,n)=>`${t}\u301C${n}`,headJoin:" \u30FB ",empty:"\u7A7A\u304D"},en:{cannotDraw:t=>`Cannot draw the diagram: ${t}`,unknownColor:t=>`colors.${t} is not a color name of the palette`,unreadableColor:t=>`colors.${t} cannot be read as a color`,overview:"Overview",prev:"Previous step",pause:"Pause",play:"Play",next:"Next step",steps:t=>`Steps of ${t}`,side:"Side path",sideNote:"Not taken this time",sideFrom:t=>`Enterable from ${t} ${t===1?"state":"states"}`,trail:"States passed",start:"Start",end:"End",badgeName:t=>`step number ${t}`,quoted:t=>`"${t}"`,iconOf:t=>`the icon of "${t}"`,coin:"the coin",envelope:"the envelope",textsOverlap:(t,n)=>os(`${t} and ${n} overlap`),lineCrosses:(t,n,a)=>`The line ${t} \u2192 ${n} crosses ${a}`,timeUnits:{ms:"ms",s:"s",min:"min",h:"h",d:"d"},zoom:"Zoom",range:(t,n)=>`${t}\u2013${n}`,headJoin:" \xB7 ",empty:"Empty"}};var Gn={clear:{name:"\u6F84\u3093\u3060\u8272",note:"\u767D\u3044\u5730\u306B\u3001\u4E2D\u304F\u3089\u3044\u306E\u660E\u308B\u3055\u306E\u9BAE\u3084\u304B\u306A 6 \u8272\u3002\u4ECA\u306E\u898B\u672C\u5E33\u306E\u8272",light:{page:"#f3f4f7",bg:"#ffffff",surf:"#ffffff",sunk:"#f5f6f8",ink:"#12141a",ink2:"#3f4451",mute:"#6b7180",hair:"#12141a1c",line:"#12141a40",sh:"#101828","on-c":"#ffffff","c-blue":"#467deb","t-blue":"#2e62ce","c-amber":"#d28008","t-amber":"#975b04","c-green":"#0ea886","t-green":"#07775e","c-violet":"#6c3bb2","t-violet":"#6c3bb2","c-rose":"#ba3e40","t-rose":"#b83c3f","c-slate":"#5d6677","t-slate":"#5d6677",coin:"#e9b114",coint:"#856300",coinin:"#a8740c",tint:"5%",edge:"20%",shA:".05",shB:".08",carry:"#65686f"},dark:{page:"#08090c",bg:"#0d0e12",surf:"#17191f",sunk:"#121419",ink:"#eceef3",ink2:"#c4c8d2",mute:"#9198a6",hair:"#eceef31f",line:"#eceef340",sh:"#000000","on-c":"#0d0e12","c-blue":"#7e7ef6","t-blue":"#989cfd","c-amber":"#c78135","t-amber":"#dd954b","c-green":"#20ac7a","t-green":"#35b986","c-violet":"#695b9f","t-violet":"#a79ae3","c-rose":"#bc434b","t-rose":"#fd7d81","c-slate":"#9ba3b2","t-slate":"#9da5b4",coin:"#f0c040",coint:"#f0c040",coinin:"#9a6a0c",tint:"6%",edge:"19%",shA:".45",shB:".35"}},paper:{name:"\u7D19\u3068\u58A8",note:"\u751F\u6210\u308A\u306E\u7D19\u306E\u5730\u306B\u3001\u85CD / \u9EC4\u571F / \u82D4 / \u8461\u8404 / \u6731 / \u920D\u306E\u304F\u3059\u3093\u3060 6 \u8272",light:{page:"#ece7dd",bg:"#f9f6f0",surf:"#fffcf6",sunk:"#f2ede4",ink:"#221e18",ink2:"#4b453b",mute:"#7b7366",hair:"#221e181f",line:"#221e1847",sh:"#3a2a10","on-c":"#fffcf6","c-blue":"#487dd5","t-blue":"#2d60b5","c-amber":"#c38405","t-amber":"#885a01","c-green":"#57a271","t-green":"#237143","c-violet":"#904698","t-violet":"#904698","c-rose":"#a9513e","t-rose":"#9f4836","c-slate":"#6a645a","t-slate":"#696359",coin:"#d4a52a",coint:"#7d5e05",coinin:"#9a7016",tint:"6%",edge:"22%",shA:".06",shB:".07",carry:"#68635c"},dark:{page:"#0e0d0b",bg:"#15130f",surf:"#1e1b17",sunk:"#191612",ink:"#ede6d8",ink2:"#cbc2b1",mute:"#9c9283",hair:"#ede6d81f",line:"#ede6d842",sh:"#000000","on-c":"#15130f","c-blue":"#5785d5","t-blue":"#76a6f9","c-amber":"#be8802","t-amber":"#d59e2f","c-green":"#52aa71","t-green":"#61b87e","c-violet":"#90529b","t-violet":"#d08edb","c-rose":"#bb4e3d","t-rose":"#f98672","c-slate":"#a9a295","t-slate":"#aca598",coin:"#dcb24e",coint:"#dcb24e",coinin:"#8a6a14",tint:"6%",edge:"19%",shA:".45",shB:".35"}},night:{name:"\u591C\u306E\u8A08\u5668",note:"\u9752\u307F\u306E\u9ED2\u306E\u5730\u306B\u3001\u5149\u308B\u6C34\u8272 / \u7425\u73C0 / \u82E5\u7DD1 / \u83EB / \u6843 \u306E 6 \u8272\u3002\u660E\u308B\u3044\u5074\u306F\u9752\u7070\u306E\u5730",light:{page:"#e9eef5",bg:"#f6f9fc",surf:"#ffffff",sunk:"#eef3f8",ink:"#0b1424",ink2:"#34425a",mute:"#64748b",hair:"#0b14241c",line:"#0b142440",sh:"#0b1424","on-c":"#ffffff","c-blue":"#0385cd","t-blue":"#086aa3","c-amber":"#ba8e0f","t-amber":"#7f5f04","c-green":"#0a8857","t-green":"#027449","c-violet":"#5839ba","t-violet":"#5839ba","c-rose":"#dd4a94","t-rose":"#b82375","c-slate":"#64748b","t-slate":"#56667c",coin:"#eab308",coint:"#7e6005",coinin:"#a16207",tint:"5%",edge:"22%",shA:".06",shB:".09",carry:"#596579"},dark:{page:"#060a12",bg:"#0a101c",surf:"#111a2a",sunk:"#0d1522",ink:"#e6edf7",ink2:"#b8c4d6",mute:"#8090a8",hair:"#e6edf71c",line:"#9fb3d145",sh:"#000000","on-c":"#0a101c","c-blue":"#3884b6","t-blue":"#62ace1","c-amber":"#be8533","t-amber":"#d59b4b","c-green":"#3ba774","t-green":"#4fb884","c-violet":"#7d4ecd","t-violet":"#b494fd","c-rose":"#bc3a74","t-rose":"#ff77ad","c-slate":"#96a3b5","t-slate":"#99a6b8",coin:"#facc15",coint:"#facc15",coinin:"#a16207",tint:"6%",edge:"19%",shA:".5",shB:".4"}}};var Et={sans:"Noto Sans JP Variable",mono:"JetBrains Mono Variable"},ls={0:590,1:590,2:590,3:590,4:590,5:590,6:590,7:590,8:590,9:590," ":228,"!":371,'"':575,"#":590,$:590,"%":963,"&":740,"'":325,"(":378,")":378,"*":507,"+":590,",":325,"-":371,".":325,"/":390,":":325,";":325,"<":590,"=":590,">":590,"?":514,"@":1007,A:642,B:682,C:657,D:715,E:616,F:586,G:718,H:758,I:330,J:568,K:686,L:579,M:854,N:750,O:771,P:668,Q:771,R:682,S:624,T:626,U:748,V:619,W:915,X:627,Y:581,Z:614,"[":378,"\\":390,"]":378,"^":590,_:568,"`":626,a:591,b:644,c:528,d:645,e:581,f:372,g:598,h:640,i:305,j:306,k:605,l:315,m:964,n:641,o:626,p:645,q:645,r:437,s:495,t:421,u:638,v:576,w:863,x:562,y:575,z:512,"{":378,"|":297,"}":378,"~":590,"\u2026":1e3,"\u2212":590,"\xD7":1e3,"\u2192":1e3,"\u2190":1e3,"\u2191":1e3,"\u2193":1e3,"\u2013":545,"\u2014":908,"\u2018":325,"\u2019":325,"\u201C":575,"\u201D":575,"\xB0":404,"\xB1":1e3,"\xB7":593,"\u2022":379},cs=600,ps=11904,jt=1e3;function _n(t,n){return(t.codePointAt(0)??0)>=ps?jt:n==="mono"?cs:ls[t]??jt}var ms="paper",kn=Object.fromEntries(Object.entries(Gn).map(([t,n])=>[t,{id:t,...n}]));function Yn(t){return(t!==void 0&&Object.hasOwn(kn,t)?kn[t]:void 0)??kn[ms]}var ds=["page","bg","surf","sunk","ink","ink2","mute","hair","line","sh","on-c","c-blue","t-blue","c-amber","t-amber","c-green","t-green","c-violet","t-violet","c-rose","t-rose","c-slate","t-slate","coin","coint","coinin","tint","edge","shA","shB","carry"],fs=new Set(ds),Vn=t=>fs.has(t);function Wn(t){if(typeof t!="string"||!/^[\w\s#%.,()/+-]+$/u.test(t)||/url\(/iu.test(t))return!1;let n=0;for(let a of t)if(n+=a==="("?1:a===")"?-1:0,n<0)return!1;return n===0}function Dt(t,n){return Object.entries(t[n]).map(([a,c])=>`--${a}:${c}`).join(";")}var Ct=`--sans:"${Et.sans}";--mono:"${Et.mono}"`,ct=["blue","amber","green","violet","rose"],$e=(t,n,a="sans")=>({size:t,weight:n,family:a}),O={boxName:$e(13,650),boxSub:$e(11,500),boxSubStrong:$e(11,700),regionName:$e(12.5,700),regionNote:$e(11,500),label:$e(11,600,"mono"),labelJa:$e(11,650),action:$e(11,650),badge:$e(10.5,700,"mono"),carrier:$e(10.5,700,"mono"),carrierJa:$e(10.5,700),stripTitle:$e(12.5,700),fieldName:$e(10.5,600),fieldValue:$e(12,600,"mono"),fieldValueJa:$e(12,600),tag:$e(10.5,700),miniTitle:$e(10.5,700),stepTitle:$e(15,700),stepBody:$e(13.5,500),stepNo:$e(13,700,"mono"),button:$e(14,700),gitId:$e(11,700),gitHash:$e(10.5,600,"mono"),gitNote:$e(10.5,650),timeHead:$e(11,650,"mono"),timeRow:$e(11,600),timeTick:$e(10.5,600,"mono"),timePeriod:$e(11.5,650),timeRange:$e(10.5,500,"mono"),pointName:$e(11,700,"mono"),pointState:$e(11.5,700),spanText:$e(11,650),emptyText:$e(11,700),meterLine:$e(10.5,700,"mono")},w={gap:10,margin:14,box:{h:72,minW:92,padX:12,radius:12,icon:24,iconRadius:7,iconY:-16,iconScale:.74,nameY:12,subY:27},region:{pad:18,gap:10,radius:14,inset:14,icon:24,iconRadius:7,iconScale:.68,nameY:58,line:16,minH:108},architecture:{columns:4,columnGap:56,maxColumnGap:160,rowGap:44,labelRoom:16},sequence:{columnGap:40,labelRoom:16,labelOffset:16,firstRow:10,rowGap:6,stepGap:6,minPitch:32,tail:10,selfW:34,selfH:18},state:{columns:4,columnGap:64,rowGap:108,labelRoom:16,start:7,end:{r:9,inner:5},drop:56,below:64,beside:38,text:16,loop:{w:24,h:34,samples:12,badgeAt:.6},side:{pad:16,gap:76,lane:30,entry:28},ghost:{h:52,pad:12,gap:10,nameY:-2,subY:14},done:{r:6.5,inset:13},pastLabel:.85},git:{x0:120,pitch:90,textGap:12,r:12,orphan:13.5,topLine:120,line:90,topBelow:30,below:82,bare:62,above:18,under:27,lineStep:13,tagTop:58,tag:30,row:22,turn:60,samples:12,boxGap:24,labelUnder:50,colors:["blue","violet","green","amber","rose"]},time:{width:728,axisX:118,right:16,gutterGap:12,head:22,boxTop:34,boxGap:36,zoomBottom:14,sep:12,zoomGap:12,rowsTop:24,row:20,rowGap:6,markRatio:.5,markMin:1.5,markMax:18,markRadius:1.5,shade:8,frame:2.5,emptyR:1.7,point:{drop:40,r:9,text:15,nameY:-2,stateY:12,link:10,end:6,room:30,plain:12,glyph:.62},bracket:{gap:12,tick:6,text:16,lane:34},box:{pad:6,tagX:12,tagH:16,tagPadX:7},axisGap:18,major:12,minor:6,minorPx:40,tickY:18,rangeY:14,nameGap:8,ticks:6,bottom:12,needle:{over:8,head:6,dot:3.5},meter:{w:150,h:6,y:36,mark:5,textY:59,color:"amber"}},edge:{inset:3,arrow:6,arrowHalf:3.5,parallel:5,ghostDash:5,flowDash:9,bend:12},label:{h:20,padX:9,radius:10,offset:22,side:14,search:4,searchMax:400,soft:6,touch:2},action:{h:22,padX:10,radius:11},badge:{r:9.5,ring:9,inset:4,along:14,short:44},carrier:{envW:24,envH:17,coinR:6.5,coinIn:3.8,tagH:18,tagPadX:8,samples:16},slot:{gap:6,pad:3,spread:4,h:24,radius:7,clear:2,lifeline:5,mark:4},mark:{pad:3,radius:5,dash:4,gap:3},strip:{h:72,line:44,pad:12,icon:24,titleX:44,fieldGap:22,sepInset:14,tagGap:6,tagH:15,tagPadX:7,nameY:22,valueY:43,trail:{r:5.4,step:16},now:{r:3,gap:7}},stroke:{git:2.25,gitOrphan:1.5,mark:1.6,slot:1.2,hair:1,edge:1.7,edgeOn:2.25,arrow:1.5,flow:1.3,halo:7,on:1.75,glyph:2,lifeline:1.2,envelope:1.5,badgeRing:1.5,path:1.6,end:1.6,done:1.2,trail:1.2,timeSlot:.6,timeFrame:1.25,timeAxis:1,timeSpan:1.5,timeDrop:1.4,timePoint:1.75,timeFlag:1.8,timeNeedle:1.25,timeMeter:1.25},shadow:{near:.8,far:4,nearY:1,farY:3},mini:{w:168,pad:8,title:14,inset:12,radius:10},follow:{aspect:.75,minH:320,fitMinH:160,ease:.6,narrow:440,badgeRoom:8,headRoom:10,head:{pad:8,h:40,nameY:17,subY:31}},mix:{slot:45,icon:14,regionIcon:16,regionIconEdge:34,cap:12,capEdge:42,badgePast:14,badgePastEdge:70,mini:62,miniBand:16,miniBandEdge:36,view:6,side:4,sideEdge:36,ghostEdge:60,path:55,past:72,timeShade:3.5,timeSpan:6,timeEmpty:8,timeGuide:50},baseline:{label:3.8,badge:3.5,carrier:3.7,stripTitle:4.5,tag:3.6,action:3.8,mark:4},rise:5,popFrom:.4,player:{gap:10,radius:12,button:36,touch:44,hidden:1,focus:2,narrow:440}},oe={intro:1.4,outro:4.6,tail:.6,stepBase:1.2,perChar:.025,stepMin:2.2,stepMax:5,dwell:1.2,edgeAt:.1,stagger:.5,draw:.55,drawCarry:.9,action:.9,change:.12,minShow:.8,labelDelay:.15,fade:.3,popFade:.4,untilFade:.2,still:.45,done:.3,time:{axis:11.5,unitMin:.12,unitMax:.4,wait:.15,after:.15,reset:.05}},Hn=10.5,be={inOut:"cubic-bezier(.65,0,.35,1)",out:"cubic-bezier(.22,1,.36,1)",pop:"cubic-bezier(.34,1.56,.64,1)"};var De=t=>[...t].some(n=>(n.codePointAt(0)??0)>=11904);function us(t,n){return n==="mono"&&De(t)?"sans":n}function le(t,n){let a=us(t,n.family),c=0;for(let l of t)c+=_n(l,a);return c*n.size/jt}function _e(t,n,a,c,l="start"){let e=le(t,c);return{x:l==="middle"?n-e/2:n,y:a-c.size*.8,w:e,h:c.size}}function xt(t){return t.steps.flatMap((n,a)=>n.events.flatMap((c,l)=>c.type==="edge"?[{step:a,event:l,edge:c}]:[]))}function Xe(t){let n=Pn(t),a=new Map;return t.boxes.forEach((c,l)=>{let e=c.region===void 0?void 0:n.get(c.region);a.set(c.id,c.color??e??ct[l%ct.length])}),a}function Pn(t){let n=new Map;return(t.regions??[]).forEach((a,c)=>n.set(a.id,a.color??ct[c%ct.length])),n}var pt=(t,n)=>t.carry.kind==="coin"?"coin":n.get(t.from)??"slate";function Ue(t,n,a){let c=t.boxes.find(e=>e.id===n);if(!c)return w.box.minW;let l=[le(c.name,O.boxName),le(c.sub??"",O.boxSub)];for(let e of t.steps)for(let r of e.events)r.type==="swap"&&r.box===n&&l.push(le(r.text,O.boxSubStrong)),a&&r.type==="action"&&r.box===n&&l.push(le(r.label,O.boxSubStrong));return Math.max(w.box.minW,Math.max(...l)+w.box.padX*2)}function mt(t){let n=w.carrier;return t.kind==="tag"?[(le(t.text,De(t.text)?O.carrierJa:O.carrier)+n.tagPadX*2)/2,n.tagH/2]:t.kind==="coin"?[n.coinR,n.coinR]:[n.envW/2,n.envH/2]}var zn=t=>t.main+t.coin+(t.main>0&&t.coin>0?w.slot.spread:0);function wt(t){let n=new Map,a=new Set(t.boxes.map(c=>c.id));for(let c of t.steps)for(let l of c.events){if(l.type!=="edge"||l.carry.kind==="none")continue;let e=l.carry.kind==="coin"?"coin":"main",r=mt(l.carry)[0]*2;for(let s of[l.from,l.to]){if(!a.has(s))continue;let i=n.get(s)??{main:0,coin:0};i[e]=Math.max(i[e],r),n.set(s,i)}}return n}function $t(t,n,a){return t?(n?w.box.icon+w.slot.gap:0)+zn(t)+w.slot.pad*2+w.box.padX+a:0}function kt(t,n,a=w.box.padX){if(!n)return;let c=w.box,l=w.slot,e=zn(n)+l.pad*2,r=t.icon?c.icon+l.gap:0,s=Math.max(t.x+c.padX,Math.min(t.cx-(r+e)/2,t.x+t.w-a-(r+e)));t.icon&&(t.iconX=s+c.icon/2),t.slot={x:s+r,y:t.cy+c.iconY-l.h/2,w:e,h:l.h}}function gt(t,n,a){let c=w.slot,l=(e,r)=>{let s=n.get(e),i=a.get(e);if(!s?.slot||!i)return;let o=s.slot.x+c.pad,p=s.slot.y+s.slot.h/2;return i.main>0&&i.coin>0?r.kind==="coin"?[o+i.main+c.spread+i.coin/2,p]:[o+i.main/2,p]:[s.slot.x+s.slot.w/2,p]};for(let e of t){if(e.carry.kind==="none")continue;let r=l(e.to,e.carry),s=l(e.from,e.carry);r&&(e.settle=r),s&&(e.wait=s)}}function bt(t,n){let a=Math.max(n.x-(t.x+t.w),t.x-(n.x+n.w)),c=Math.max(n.y-(t.y+t.h),t.y-(n.y+n.h));return Math.max(a,c)}function It(t,n,a=0){let c=n.x+a,l=n.y+a,e=n.x+n.w-a,r=n.y+n.h-a;if(e<=c||r<=l)return!1;for(let s=1;s<t.length;s++){let[i,o]=t[s-1],[p,f]=t[s],b=p-i,m=f-o,d=0,$=1,S=(u,h)=>{if(u===0)return h>0;let P=h/u;return u<0?d=Math.max(d,P):$=Math.min($,P),d<$};if(S(-b,i-c)&&S(b,e-i)&&S(-m,o-l)&&S(m,r-o))return!0}return!1}function hs(t){let n={a:t[0],b:t[1]??t[0],length:-1};for(let a=1;a<t.length;a++){let c=t[a-1],l=t[a],e=Math.hypot(l[0]-c[0],l[1]-c[1]);e>n.length&&(n={a:c,b:l,length:e})}return{a:n.a,b:n.b,vertical:Math.abs(n.b[0]-n.a[0])<Math.abs(n.b[1]-n.a[1])}}function st(t,n){let a=n;for(let c=1;c<t.length;c++){let l=t[c-1],e=t[c],r=Math.hypot(e[0]-l[0],e[1]-l[1]);if(a<=r&&r>0)return[l[0]+(e[0]-l[0])*a/r,l[1]+(e[1]-l[1])*a/r];a-=r}return t[t.length-1]}function vt(t){let n=0;for(let a=1;a<t.length;a++){let c=t[a-1],l=t[a];n+=Math.hypot(l[0]-c[0],l[1]-c[1])}return n}function Ft(t){let{w:n,h:a,samples:c}=w.state.loop,l=t.y+t.h,e=[t.cx+n/2,l],r=[t.cx+n*3/4,l+a*4/3],s=[t.cx-n*3/4,l+a*4/3],i=[t.cx-n/2,l+w.edge.inset];return Array.from({length:c+1},(o,p)=>{let f=p/c,b=1-f,m=d=>b*b*b*e[d]+3*b*b*f*r[d]+3*b*f*f*s[d]+f*f*f*i[d];return[m(0),m(1)]})}function Bt(t){let n=Math.max(...t.map(([l])=>l)),a=t[0][1],c=Math.max(...t.map(([,l])=>l));return[n+w.badge.r+w.badge.inset,a+(c-a)*w.state.loop.badgeAt]}function Gt(t,n){return{x:(t[0]?.[0]??0)-w.state.loop.w/2-n/2,y:Math.max(...t.map(([,a])=>a))+w.label.soft}}var Sn=w.state.loop.h+w.label.soft*2+w.label.h;function it(t,n=[],a=[]){let c=vt(t),l=c<w.badge.short?Math.min(w.badge.r+1,c/2):w.badge.along,e=w.badge.r*2+w.badge.inset;for(let r=l;r<=c;r+=1){let s=st(t,r);if(n.every(([i,o])=>Math.hypot(s[0]-i,s[1]-o)>=e))return s}return gs(t,l,n,a)??st(t,l)}function gs(t,n,a,c){let l=vt(t),[e,r]=st(t,n),[s,i]=st(t,Math.max(0,n-1)),[o,p]=st(t,Math.min(l,n+1)),f=Math.hypot(o-s,p-i);if(f===0)return;let[b,m]=[-(p-i)/f,(o-s)/f],d=w.badge.r*2;for(let $ of[w.edge.arrowHalf,0])for(let S=1;S<=d+w.badge.inset;S++)for(let u of[1,-1]){let h=[e+b*S*u,r+m*S*u];if(a.every(([I,G])=>Math.max(Math.abs(h[0]-I),Math.abs(h[1]-G))>=d+1)&&c.every(I=>!It(I,Ye(h),-$)))return h}}var qt=t=>t.points.map(([n,a])=>`${Math.round(n*10)},${Math.round(a*10)}`).join(" ");function ot(t,n,a=(c,l,e)=>it(c.points,l,e)){let c=new Map,l=[],e=new Map;for(let r=0;r<n;r++){let s=t.find(b=>b.step===r&&b.points.length>0);if(!s)continue;let i=qt(s),o=e.get(i);if(o){c.set(r,{point:o,edge:s});continue}let p=t.filter(b=>b.points.length>1&&qt(b)!==i).map(b=>b.points),f=a(s,l,p);l.push(f),e.set(i,f),c.set(r,{point:f,edge:s})}return c}function Je(t){let n=(a,c)=>Math.hypot(a.x-c.x,a.y-c.y)<=.5;return t.map(a=>{let c=t.filter(l=>l.step>a.step&&n(l,a)).sort((l,e)=>l.step-e.step)[0];return c?{...a,until:c.step}:a})}var Ye=([t,n])=>({x:t-w.badge.r,y:n-w.badge.r,w:w.badge.r*2,h:w.badge.r*2}),_t=t=>[t.x+w.state.text,t.y+w.baseline.mark],He=t=>De(t)?O.labelJa:O.label,ys={above:"below",below:"above",left:"right",right:"left"};function Ke(t,n){let a=le(t.text,He(t.text))+w.label.padX*2,c=w.label.h,l=hs(t.points),e=(l.a[0]+l.b[0])/2,r=(l.a[1]+l.b[1])/2,s=t.side??(l.vertical?"right":"above"),{side:i}=w.label,o=t.offset??w.label.offset,p=S=>S==="above"?{x:e-a/2,y:r-o-c/2,w:a,h:c}:S==="below"?{x:e-a/2,y:r+o-c/2,w:a,h:c}:S==="left"?{x:e-i-a,y:r-c/2,w:a,h:c}:{x:e+i,y:r-c/2,w:a,h:c},f=t.base?{...t.base,w:a,h:c}:p(s),b=t.flip?[s,ys[s]]:[s],m=S=>n.hard.every(u=>bt(S,u)>=w.gap)&&n.soft.every(u=>bt(S,u)>=w.label.soft)&&(n.touch??[]).every(u=>bt(S,u)>=w.label.touch)&&(n.lines??[]).every(u=>!It(u,S,-w.label.touch)),{search:d,searchMax:$}=w.label;for(let S=0;S<=$;S+=d)for(let u of b){let h=u===s?f:p(u),P=u==="above"?[0,-1]:u==="below"?[0,1]:u==="left"?[-1,0]:[1,0],I=[Math.abs(P[1]),Math.abs(P[0])],G=t.slide??(u==="above"||u==="below"?a:c*4);for(let ne=0;ne<=G;ne+=d)for(let U of ne===0?[1]:[1,-1]){let j={x:h.x+P[0]*S+I[0]*ne*U,y:h.y+P[1]*S+I[1]*ne*U,w:a,h:c};if(m(j))return{...j,step:t.step,event:t.event,text:t.text,family:He(t.text).family,color:t.color}}}return{...f,step:t.step,event:t.event,text:t.text,family:He(t.text).family,color:t.color}}function Mn(t){let n=/^([0-9]+(?:\.[0-9]+)?)%$/u.exec(t.trim());if(n)return Math.min(1,Math.max(0,Number(n[1])/100));let a=/^([0-9]+)\/([0-9]+)$/u.exec(t.trim());if(a&&Number(a[2])>0)return Math.min(1,Math.max(0,Number(a[1])/Number(a[2])))}var Kn=(t,n)=>t.strip?.meters?.find(a=>a.field===n);function Xn(t,n){if(Kn(t,n))return Math.max(le(n,O.fieldName),w.time.meter.w);let a=0,c=0;for(let e of t.steps)for(let r of e.events)r.type!=="strip"||r.field!==n||(r.value!==void 0&&(a=Math.max(a,le(r.value,De(r.value)?O.fieldValueJa:O.fieldValue))),r.tag!==void 0&&(c=Math.max(c,le(r.tag,O.tag)+w.strip.tagPadX*2)));let l=a+(c>0?(a>0?w.strip.tagGap:0)+c:0);return Math.max(le(n,O.fieldName),l)}var vn=t=>Math.max(le(t.title,O.fieldName),t.states.length*w.strip.trail.step);function Ze(t,n){if(!t.strip)return 0;let{titleX:a,fieldGap:c,pad:l}=w.strip,e=a+le(t.strip.title,O.stripTitle)+c,r=[...t.strip.fields.map(s=>Xn(t,s)),...n?[vn(n)]:[]];return e+r.reduce((s,i)=>s+i+c,0)-c+l}function Qe(t,n,a,c,l){if(!t.strip)return;let{titleX:e,fieldGap:r,pad:s,line:i,h:o}=w.strip,p=e+le(t.strip.title,O.stripTitle)+r,f=[],b=p,m=0,d=S=>{b>p&&b+S>c-s&&(b=p,m++);let u={x:n+b,y:a+m*i};return b+=S+r,u};for(let S of t.strip.fields){let u=Xn(t,S),h=d(u),P=Kn(t,S),I=P?Mn(P.line):void 0;f.push({name:S,...h,w:u,...P&&I!==void 0?{meter:{line:I,text:P.line,x:h.x,w:w.time.meter.w}}:{}})}let $=l?{...l,...d(vn(l)),w:vn(l)}:void 0;return{x:n,y:a,w:c,h:o+m*i,title:t.strip.title,fields:f,...$?{trail:$}:{}}}function Pt(t,n,a){let c=l=>{l.x+=n,l.y+=a};for(let l of t.boxes)c(l),l.cx+=n,l.cy+=a,l.slot&&c(l.slot),l.iconX!==void 0&&(l.iconX+=n);for(let l of t.regions)l.y+=a,c(l.header);for(let l of t.lifelines)l.x+=n,l.y1+=a,l.y2+=a;for(let l of t.edges)l.points=l.points.map(([e,r])=>[e+n,r+a]),l.settle&&(l.settle=[l.settle[0]+n,l.settle[1]+a]),l.wait&&(l.wait=[l.wait[0]+n,l.wait[1]+a]);for(let l of t.labels)c(l);for(let l of t.paths)l.points=l.points.map(([e,r])=>[e+n,r+a]),l.label&&c(l.label);for(let l of t.ends)l.x+=n,l.y+=a;t.side&&c(t.side);for(let l of t.actions)c(l);for(let l of t.badges)l.x+=n,l.y+=a;if(t.strip){t.strip.y+=a;for(let l of t.strip.fields)l.x+=n,l.y+=a,l.meter&&(l.meter.x+=n);t.strip.trail&&(t.strip.trail.x+=n,t.strip.trail.y+=a)}}function St(t,n,a){let{inset:c}=w.badge;for(let e of t){let r=e.type==="swap"||e.type==="action"?e.box:void 0,s=a.boxes.find(i=>i.id===r);if(s)return{step:n,x:s.x,y:s.y,color:s.color}}if(a.strip&&t.some(e=>e.type==="strip"))return{step:n,x:a.strip.x+c,y:a.strip.y+c,color:"slate"};let l=a.boxes[0];return{step:n,x:l.x,y:l.y,color:l.color}}function Jn(t){let n=bs(t),a=xs(t,n),c=n.map(()=>({top:0,bottom:0})),l=Un(t,n,a,c);for(let e=0;e<3&&ks(l,n,a,c);e++)l=Un(t,n,a,c);return l}function bs(t){let n=t.regions??[],a=new Set(n.map(e=>e.id)),c=n.map(e=>({region:e,members:t.boxes.filter(r=>r.region===e.id).map(r=>r.id)})),l=t.boxes.filter(e=>e.region===void 0||!a.has(e.region)).map(e=>e.id);return l.length>0&&c.push({members:l}),c}var Zn=t=>t==="left"||t==="right";function xs(t,n){let a=w.architecture.columns,c=xt(t).map(r=>r.edge),l=new Map;n.forEach((r,s)=>{let i=new Set(r.members),o=new Set,p=(u,h)=>u>=0&&u<a&&!o.has(`${u},${h}`),f=(u,h)=>{let P=Math.min(a-1,Math.max(0,u));for(let I=h;;I++)for(let G=0;G<a;G++)for(let ne of[P+G,P-G])if(p(ne,I))return[ne,I]},b=(u,h,P)=>{l.set(u,{group:s,col:h,row:P}),o.add(`${h},${P}`)},m=1,d=u=>{for(let h of c){let P=h.from===u?h.to:h.to===u?h.from:void 0;if(P===void 0||!i.has(P)||l.has(P))continue;let I=l.get(u),[G,ne]=Zn(h.labelSide)?f(I.col,I.row+1):p(I.col+m,I.row)?[I.col+m,I.row]:f(I.col+m,I.row);b(P,G,ne),d(P)}},$=u=>{for(let h=0;h<c.length;h++){let P=c[h],I=P?.from===u?P.to:P?.to===u?P.from:void 0,G=I===void 0?void 0:l.get(I);if(G&&G.group<s)return{order:h,col:G.col}}},S=0;for(;;){let u=r.members.filter(U=>!l.has(U));if(u.length===0)break;let h=u.map(U=>({id:U,anchor:$(U)})).filter(U=>U.anchor!==void 0);h.sort((U,j)=>(U.anchor?.order??0)-(j.anchor?.order??0));let P=h[0]??{id:u[0],anchor:void 0},I=P.anchor?.col??0;S===0&&(m=I>=(a-1)/2?-1:1);let[G,ne]=p(I,0)?[I,0]:f(I,0);b(P.id,G,ne),d(P.id),S++}});let e=[...new Set([...l.values()].map(r=>r.col))].sort((r,s)=>r-s);for(let r of l.values())r.col=e.indexOf(r.col);return l}function ws(t){let n=[...t.matchAll(/ /g)].map(c=>c.index);if(n.length===0)return[t];let a=n.reduce((c,l)=>Math.abs(l-t.length/2)<Math.abs(c-t.length/2)?l:c);return[t.slice(0,a),t.slice(a+1)]}function $s(t){let{icon:n,nameY:a,line:c,inset:l}=w.region,e=ws(t.name),r=Math.max(n,...e.map(i=>le(i,O.regionName)),le(t.note??"",O.regionNote)),s=a-l+(e.length-1)*c+(t.note?c:0)+w.gap/2;return{w:r,h:s,lines:e}}function Un(t,n,a,c){let{box:l,region:e,architecture:r,margin:s,gap:i}=w,o=Xe(t),p=Pn(t),f=xt(t),b=Math.max(1,...[...a.values()].map(y=>y.col+1)),m=wt(t),d=new Map(t.boxes.map(y=>[y.id,Math.max(Ue(t,y.id,!0),$t(m.get(y.id),y.icon!==void 0,l.padX))])),$=Array.from({length:b},(y,L)=>Math.max(l.minW,...[...a].filter(([,M])=>M.col===L).map(([M])=>d.get(M)??l.minW))),S=Array.from({length:Math.max(0,b-1)},()=>r.columnGap);for(let{edge:y}of f){let L=a.get(y.from),M=a.get(y.to);if(!L||!M||y.label===void 0||L.group!==M.group||L.row!==M.row||Math.abs(L.col-M.col)!==1||Zn(y.labelSide))continue;let F=le(y.label,He(y.label))+w.label.padX*2+r.labelRoom*2,te=Math.min(L.col,M.col);F<=r.maxColumnGap&&(S[te]=Math.max(S[te]??0,F))}let u=n.map(y=>y.region?$s(y.region):void 0),h=Math.max(0,...u.map(y=>y?y.w+e.inset*2:0)),P=[];for(let y=0;y<b;y++)P.push(y===0?s+(h>0?h:e.pad):P[y-1]+$[y-1]+S[y-1]);let I=y=>P[y]+$[y]/2,G=new Set(f.filter(({edge:y})=>y.from===y.to).map(({edge:y})=>y.from)),ne=new Set([...G].flatMap(y=>{let L=a.get(y);return L?[`${L.group}:${L.row}`]:[]})),U=(y,L)=>ne.has(`${y}:${L}`)?Sn:0,j=[],A=[],C=s;n.forEach((y,L)=>{let M=Math.max(1,...y.members.map(xe=>(a.get(xe)?.row??0)+1)),F=c[L],te=C+e.pad+F.top,B=[0];for(let xe=1;xe<M;xe++)B.push(B[xe-1]+l.h+r.rowGap+U(L,xe-1));for(let xe of y.members){let qe=a.get(xe),Ae=t.boxes.find(Be=>Be.id===xe),Se=d.get(xe)??l.minW,je=I(qe.col),Fe=te+B[qe.row];j.push({id:xe,name:Ae?.name??xe,...Ae?.sub!==void 0?{sub:Ae.sub}:{},...Ae?.icon!==void 0?{icon:Ae.icon}:{},color:o.get(xe)??"slate",x:je-Se/2,y:Fe,w:Se,h:l.h,cx:je,cy:Fe+l.h/2})}let _=te+B[M-1]+l.h+U(L,M-1),Z=u[L],ae=Math.max(_+e.pad+F.bottom-C,Z?Z.h+e.inset*2:0,y.region?e.minH:0);A.push({group:L,y:C,h:ae,rows:M}),C+=ae+e.gap});let K=C-e.gap;for(let y of j)kt(y,m.get(y.id));let X=new Map(j.map(y=>[y.id,y])),Q=y=>A[a.get(y)?.group??0],ie=(y,L,M)=>{for(let F=1;F<y.length;F++){let[te,B]=y[F-1],[_,Z]=y[F];if(Math.min(te,_)<=L.x+L.w+M&&Math.max(te,_)>=L.x-M&&Math.min(B,Z)<=L.y+L.h+M&&Math.max(B,Z)>=L.y-M)return!0}return!1},re=[...G].flatMap(y=>{let L=X.get(y);return L?[{x:L.x,y:L.y+L.h,w:L.w,h:Sn}]:[]}),D=y=>re.some(L=>ie(y,L,0)),x=(y,L,M)=>j.some(F=>F.id!==L&&F.id!==M&&ie(y,F,w.label.search))||D(y),N=y=>{let L=X.get(y),M=Q(y),F=a.get(y),te=L.y+L.h+(F?U(F.group,F.row):0);return(F?.row??0)<M.rows-1?te+r.rowGap/2:Math.min(te+e.pad/2,M.y+M.h-w.edge.inset)},E=y=>{let L=X.get(y),M=Q(y);return(a.get(y)?.row??0)>0?L.y-r.rowGap/2:Math.max(L.y-e.pad/2,M.y+w.edge.inset)},v=w.edge.inset,q=(y,L)=>L?P[y]+$[y]+(S[y]??r.columnGap)/2:P[y]-(S[y-1]??r.columnGap)/2,z=(y,L)=>{let M=X.get(y),F=X.get(L);if(y===L)return Ft(M);let te=a.get(y),B=a.get(L);if(te.group===B.group&&te.row===B.row){let Se=F.cx>M.cx,je=[[Se?M.x+M.w:M.x,M.cy],[Se?F.x-v:F.x+F.w+v,F.cy]];if(!x(je,y,L))return je;let Fe=N(y),Be=[[M.cx,M.y+M.h],[M.cx,Fe],[F.cx,Fe],[F.cx,F.y+F.h+v]];if(!D(Be))return Be;let at=E(y),nt=[[M.cx,M.y],[M.cx,at],[F.cx,at],[F.cx,F.y-v]];return D(nt)?Be:nt}let _=F.cy>M.cy,Z=[M.cx,_?M.y+M.h:M.y],ae=[F.cx,_?F.y-v:F.y+F.h+v];if(te.col===B.col){let Se=[Z,ae];if(!x(Se,y,L))return Se;let je=q(te.col,!0);return[[M.x+M.w,M.cy],[je,M.cy],[je,F.cy],[F.x+F.w+v,F.cy]]}let xe=F.cx>M.cx,qe=_?N(y):E(y),Ae=[[Z,[M.cx,F.cy],[xe?F.x-v:F.x+F.w+v,F.cy]],[[xe?M.x+M.w:M.x,M.cy],[F.cx,M.cy],ae],[Z,[M.cx,qe],[F.cx,qe],ae]];if(G.has(y)||G.has(L)){let Se=q(te.col,xe),je=q(B.col,!xe),Fe=[[xe?M.x+M.w:M.x,M.cy],[Se,M.cy]],Be=[xe?F.x-v:F.x+F.w+v,F.cy];Ae.push([...Fe,[Se,F.cy],Be],[...Fe,[Se,qe],[F.cx,qe],ae],[Z,[M.cx,qe],[je,qe],[je,F.cy],Be],[...Fe,[Se,qe],[je,qe],[je,F.cy],Be])}return Ae.find(Se=>!x(Se,y,L))??Ae[2]},ee=f.map(({step:y,event:L,edge:M})=>({step:y,event:L,from:M.from,to:M.to,points:z(M.from,M.to),color:pt(M,o),carry:M.carry}));gt(ee,X,m);let de=new Map;for(let y of ee){if(y.points.length!==2||!ee.some(_=>_.from===y.to&&_.to===y.from&&_.points.length===2))continue;let[M,F]=y.points,te=Math.abs(F[1]-M[1])<Math.abs(F[0]-M[0]),B=(y.from<y.to?1:-1)*w.edge.parallel;y.points=y.points.map(([_,Z])=>te?[_,Z+B]:[_+B,Z]),de.set(y,te?B>0?"below":"above":B>0?"right":"left")}let ce=[];n.forEach((y,L)=>{let M=A[L],F=u[L];!y.region||!F||ce.push({id:y.region.id,lines:F.lines,...y.region.note!==void 0?{note:y.region.note}:{},...y.region.icon!==void 0?{icon:y.region.icon}:{},color:p.get(y.region.id)??"slate",x:s,y:M.y,w:0,h:M.h,header:{x:s+e.inset,y:M.y+e.inset,w:F.w,h:F.h}})});let pe=(y,L,M)=>y.from===y.to?Bt(y.points):it(y.points,L,M),ve=ot(ee,t.steps.length,pe),we=[];for(let y of ee){let L=t.steps[y.step]?.events[y.event];if(L?.type!=="edge"||L.label===void 0)continue;let M=[...ve].filter(([_])=>_<=y.step).map(([,_])=>Ye(_.point)),F=[...ce.map(_=>_.header),...we.filter(_=>_.step===y.step)],te=L.labelSide??de.get(y),B=y.from===y.to?{side:"below",base:Gt(y.points,le(L.label,He(L.label))+w.label.padX*2)}:void 0;we.push(Ke({step:y.step,event:y.event,text:L.label,points:y.points,color:y.color,...B??(te?{side:te}:{flip:!0})},{hard:j,soft:F,touch:M}))}let ye={kind:"architecture",width:0,height:0,regions:ce,boxes:j,lifelines:[],edges:ee,labels:we,actions:[],badges:[],paths:[],ends:[]},Pe=we.length>0?Math.max(0,s+w.label.soft-Math.min(...we.map(y=>y.x))):0;Pe>0&&Pt(ye,Pe,0);let k=Math.max(...j.map(y=>y.x+y.w+e.pad),...we.map(y=>y.x+y.w+w.label.soft),...ee.flatMap(y=>y.points.map(L=>L[0]+e.pad))),V=Math.max(k+s,Ze(t)+s*2);for(let y of ce)y.w=V-s*2;let J=Math.max(K,...we.map(y=>y.y+y.h)),T=Qe(t,s,J+i,V-s*2);ye.width=V,ye.height=(T?T.y+T.h:J)+s,T&&(ye.strip=T);let H=ot(ee,t.steps.length,pe);return ye.badges=Je(t.steps.map((y,L)=>{let M=H.get(L);return M?{step:L,x:M.point[0],y:M.point[1],color:M.edge.color}:St(y.events,L,ye)})),ye}function ks(t,n,a,c){let l=!1,e=w.label.soft;for(let r of t.labels){let s=t.edges.find(d=>d.step===r.step&&d.event===r.event),i=s&&a.get(s.from),o=s&&a.get(s.to);if(!i||!o||i.group!==o.group||!n[i.group]?.region)continue;let p=t.regions.find(d=>d.id===n[i.group]?.region?.id),f=c[i.group];if(!p||!f)continue;let b=p.y+e-r.y,m=r.y+r.h-(p.y+p.h-e);b>0&&(f.top+=b,l=!0),m>0&&(f.bottom+=m,l=!0)}return l}var Yt=t=>Object.keys(t),eo=Yt({sequence:!0,architecture:!0,state:!0,git:!0,time:!0}),Mt=["start","finish"],vs=["scale","period","row","point","zoom","mark","span"];var to=["group","end","box","strip","step","say","code","source","act","note","set","branch","commit",...vs];var dt="HEAD";var no=Yt({coin:!0,none:!0}),ro=Yt({fixed:!0,follow:!0}),so=Yt({above:!0,below:!0,left:!0,right:!0});var nr=t=>t.kind==="git";function Ps(t){let n=(t.git?.branches??[]).map(j=>j.id),a=j=>{n.includes(j)||n.push(j)};for(let j of t.steps)for(let A of j.events)(A.type==="commit"||A.type==="branch")&&a(A.branch);let c=new Map(n.map(j=>[j,null])),l=null,e=null,r=[],s=new Map,i=[],o=[],p=[],f=new Map,b=new Map,m=new Map,d=[...n,dt],$=new Map(d.map(j=>[j,[]])),S=[],u=j=>j===dt?e===null?l:null:c.get(j)??null,h=j=>{let A=f.get(j)??[],C=A.indexOf(null);return C<0?A.length:C},P=(j,A,C,K)=>{let X=new Map(d.map(D=>[D,u(D)])),Q=l;C();let re=d.filter(D=>X.get(D)!==u(D)).map(D=>{let x=m.get(D);return x&&(f.get(x.commit)[x.row]=null,m.delete(D)),{ref:D,slot:x}});for(let{ref:D,slot:x}of re){let N=x??(D===dt&&Q!==null?{commit:Q,row:h(Q)}:void 0),E=u(D),v;if(E!==null){v={commit:E,row:h(E)};let q=f.get(E)??[];q[v.row]=D,f.set(E,q),b.set(E,Math.max(b.get(E)??0,q.filter(z=>z!==null).length)),m.set(D,v)}o.push({ref:D,step:j,event:A,...N?{from:N}:{},...v?{to:v}:{},line:D===K})}},I=(j,A)=>{let C=new Set,K=[...c.values(),l].filter(X=>X!==null);for(;K.length>0;){let X=K.pop();C.has(X)||(C.add(X),K.push(...s.get(X)?.parents??[]))}for(let X of r)!C.has(X.id)&&X.orphan===void 0&&(X.orphan={step:j,event:A})};t.steps.forEach((j,A)=>{j.events.forEach((C,K)=>{if(C.type==="commit")ne(C,A,K);else if(C.type==="branch"){if(!s.has(C.from))return;G(C.from)!==C.branch&&i.push({kind:"branch",from:C.from,to:C.branch,step:A,event:K}),P(A,K,()=>{c.set(C.branch,C.from),e=C.branch,l=C.from})}else if(C.type==="edge"){let X=C.from;if(X!==dt&&!c.has(X)||!s.has(C.to))return;P(A,K,()=>{if(X===dt){e=null,l=C.to;return}c.set(X,C.to),e===X?l=C.to:e===null&&l===C.to&&(e=X)},X)}else return;I(A,K)});for(let C of d)$.get(C)?.push(C===dt?l:c.get(C)??null);S.push(e);for(let C of d){let K=m.get(C);K&&p.push({ref:C,step:A,slot:K})}});function G(j){return s.get(j)?.branch}function ne(j,A,C){if(s.has(j.id))return;let K=j.copy!==void 0&&s.has(j.copy)?j.copy:void 0,X=K!==void 0&&e===null&&l!==null?l:c.get(j.branch)??null,Q=j.merge!==void 0&&j.merge!==j.branch?c.get(j.merge)??void 0:void 0,ie=[...new Set([X,Q].filter(x=>x!=null))],re={id:j.id,branch:j.branch,parents:ie,...Q!==void 0&&Q!==X?{joined:Q}:{},...K!==void 0?{copy:K}:{},...j.hash!==void 0?{hash:j.hash}:{},...j.note!==void 0?{note:j.note}:{},step:A,event:C};r.push(re),s.set(re.id,re);for(let x of ie)i.push({kind:"parent",from:x,to:re.id,step:A,event:C});K!==void 0&&i.push({kind:"copy",from:K,to:re.id,step:A,event:C});let D=e===null&&l===null;P(A,C,()=>{K===void 0?(c.set(j.branch,re.id),e===j.branch&&(l=re.id)):e===null&&(l=re.id),D&&(e=j.branch,l=re.id)})}let U=d.map(j=>({name:j,at:$.get(j)??[],...j===dt?{attached:S}:{}}));return{branches:n,made:r,links:i,moves:o,refs:U,tags:p,rows:b}}function Vt(t,n,a,c){let l=w.git.samples;return Array.from({length:l},(e,r)=>{let s=(r+1)/l,i=1-s,o=p=>i*i*i*t[p]+3*i*i*s*n[p]+3*i*s*s*a[p]+s*s*s*c[p];return[o(0),o(1)]})}function Ss(t,n){return Math.abs(t[1]-n[1])<.5?[t,n]:t[1]>n[1]?[t,[t[0],n[1]],n]:[t,[n[0],t[1]],n]}function Qn(t,n,a){let c=a>t.cy?1:-1,l=[t.cx,t.cy+c*t.r],e=Math.max(0,Math.min(w.git.turn,n-t.cx)),r=[t.cx+e,a],s=Vt(l,[l[0],l[1]+(a-l[1])*.7],[t.cx+e*.2,a],r);return[l,...s,...n>r[0]?[[n,a]]:[]]}function Ms(t,n){let a=n.cy<t.cy?1:-1,c=[t.cx+t.r,t.cy],l=[n.cx,n.cy+a*n.r],e=Math.max(0,Math.min(w.git.turn,n.cx-c[0])),r=[n.cx-e,t.cy],s=Vt(r,[n.cx-e*.2,t.cy],[n.cx,l[1]+(t.cy-l[1])*.7],l);return[c,...r[0]>c[0]?[r]:[],...s]}function Ts(t,n){if(Math.abs(t.cy-n.cy)<.5){let r=t.cy-t.r,s=w.git.turn*.7;return[[t.cx,r],...Vt([t.cx,r],[t.cx,r-s],[n.cx,r-s],[n.cx,r])]}let a=n.cy<t.cy?-1:1,c=[t.cx,t.cy+a*t.r],l=[n.cx,n.cy-a*n.r],e=(l[1]-c[1])*.5;return[c,...Vt(c,[c[0],c[1]+e],[l[0],l[1]-e],l)]}function rr(t){let{margin:n,gap:a,box:c,region:l,git:e,carrier:r}=w,s=Ps(t),i=new Map((t.git?.branches??[]).map(k=>[k.id,k.note])),o=new Map(s.branches.map((k,V)=>[k,V])),p=k=>e.colors[(o.get(k)??0)%e.colors.length],f=new Map,b=new Map;for(let k of s.made){let V=Math.max(0,...k.parents.map(J=>(f.get(J)??-1)+1),(b.get(k.branch)??-1)+1);f.set(k.id,V),b.set(k.branch,V)}let m=k=>[...k.hash!==void 0?[{text:k.hash,style:O.gitHash}]:[],...k.note!==void 0?[{text:k.note,style:O.gitNote}]:[]],d=k=>Math.max(0,...m(k).map(V=>le(V.text,V.style))),$=k=>le(k,De(k)?O.carrierJa:O.carrier)+r.tagPadX*2,S=Math.max(0,...s.refs.map(k=>$(k.name))),u=Math.max(e.pitch,...s.made.map(k=>d(k)+e.textGap),S+e.textGap),h=s.branches.map(k=>({w:Math.max(l.icon,le(k,O.regionName),le(i.get(k)??"",O.regionNote))})),P=n+l.inset+Math.max(0,...h.map(k=>k.w)),I=Math.max(e.r,...s.made.filter(k=>f.get(k.id)===0&&o.get(k.branch)===0).map(k=>d(k)/2),S/2),G=Math.max(e.x0,P+a+I),ne=new Set(s.moves.flatMap(k=>{let V=t.steps[k.step]?.events[k.event];return k.line&&k.to&&V?.type==="edge"&&V.label!==void 0?[s.made.find(J=>J.id===k.to?.commit)?.branch??""]:[]})),U=k=>Math.max(0,...s.made.filter(V=>V.branch===k).map(V=>(s.rows.get(V.id)??0)-2))*e.row,j=s.made.some(k=>o.get(k.branch)===0&&m(k).length>0),A=[],C=n;s.branches.forEach((k,V)=>{let J=V===0,T=J&&j?e.tagTop:e.tag,H=C+(J?e.topLine-(e.tagTop-T):e.line)+U(k),y=H-C+(J?e.topBelow:ne.has(k)?e.below:e.bare);A.push({id:k,x:n,y:C,w:0,h:y,line:H,color:p(k),tagBase:T}),C+=y+l.gap});let K=C-l.gap,X=new Map(A.map(k=>[k.id,k])),Q=s.made.map(k=>{let V=X.get(k.branch),J=o.get(k.branch)===0,T=G+u*(f.get(k.id)??0)+(J?0:u/2),H=V.line,y=m(k),L=y.map((B,_)=>J?H-e.above-(y.length-1-_)*e.lineStep:H+e.under+_*e.lineStep),M=y.map((B,_)=>_e(B.text,T,L[_],B.style,"middle")),F=M.length===0?void 0:{...Os(M),lines:y.map(B=>B.text),baselines:L},te=k.copy!==void 0?p(s.made.find(B=>B.id===k.copy)?.branch??k.branch):p(k.branch);return{id:k.id,branch:k.branch,color:te,cx:T,cy:H,r:e.r,step:k.step,event:k.event,parents:k.parents,...k.copy!==void 0?{copy:k.copy}:{},...k.hash!==void 0?{hash:k.hash}:{},...k.note!==void 0?{note:k.note}:{},...F?{text:F}:{},...k.orphan?{orphan:k.orphan.step,orphanEvent:k.orphan.event}:{}}}),ie=new Map(Q.map(k=>[k.id,k])),re=s.links.flatMap(k=>{let V=ie.get(k.from);if(!V)return[];if(k.kind==="branch"){if(!s.made.some(L=>L.branch===k.to))return[];let y=X.get(k.to);return[{...k,points:Qn(V,V.cx+e.turn,y.line),color:p(k.to)}]}let J=ie.get(k.to),T=s.made.find(y=>y.id===k.to),H;return k.kind==="copy"?H=Ts(V,J):Math.abs(V.cy-J.cy)<.5?H=[[V.cx+V.r,V.cy],[J.cx-J.r,J.cy]]:T?.joined===k.from?H=Ms(V,J):H=Qn(V,J.cx-J.r,J.cy),[{...k,points:H,color:J.color}]}),D=(k,V)=>{let J=ie.get(V.commit),T=X.get(J.branch)?.tagBase??e.tag,H=$(k);return{x:J.cx-H/2,y:J.cy-T-V.row*e.row-r.tagH/2,w:H,h:r.tagH}},x=k=>[k.x+k.w/2,k.y+k.h/2],N=s.moves.map(k=>{let V=k.from?D(k.ref,k.from):void 0,J=k.to?D(k.ref,k.to):void 0,T=t.steps[k.step]?.events[k.event],H=k.line&&T?.type==="edge"&&T.carry.kind!=="none"&&!(T.carry.kind==="tag"&&T.carry.text===T.from);return{ref:k.ref,step:k.step,event:k.event,...V?{from:V}:{},...J?{to:J}:{},...k.to?{target:k.to.commit}:{},...H?{carried:!0}:{},...k.line&&V&&J?{line:Ss(x(V),x(J))}:{},color:"slate"}}),E=s.tags.map(k=>({...D(k.ref,k.slot),ref:k.ref,step:k.step})),v=Xe(t),q=Math.max(G,...Q.flatMap(k=>[k.cx+k.r,...k.text?[k.text.x+k.text.w]:[]]),...E.map(k=>k.x+k.w),...N.flatMap(k=>[k.from,k.to].flatMap(V=>V?[V.x+V.w]:[]))),z=q+e.boxGap,ee=(A[1]??A[0])?.line??n+c.h/2,de=t.boxes.map((k,V)=>{let J=Ue(t,k.id,!0),T=ee+V*(c.h+a);return{id:k.id,name:k.name,...k.sub!==void 0?{sub:k.sub}:{},...k.icon!==void 0?{icon:k.icon}:{},color:v.get(k.id)??"slate",x:z,y:T-c.h/2,w:J,h:c.h,cx:z+J/2,cy:T}}),ce=A.map((k,V)=>{let J=i.get(k.id);return{id:k.id,lines:[k.id],...J!==void 0?{note:J}:{},icon:"branch",color:k.color,x:k.x,y:k.y,w:0,h:k.h,header:{x:k.x+l.inset,y:k.y+l.inset,w:h[V]?.w??0,h:l.nameY-l.inset+(J!==void 0?l.line:0)+a/2}}}),pe={kind:"git",width:0,height:0,regions:ce,boxes:de,lifelines:[],edges:[],labels:[],actions:[],badges:[],paths:[],ends:[],lanes:A,commits:Q,links:re,tags:E,refs:s.refs,moves:N};pe.badges=tr(t,pe),pe.labels=qs(t,pe);let ve=Math.max(q,...de.map(k=>k.x+k.w),...pe.labels.map(k=>k.x+k.w))+l.pad,we=Math.max(ve+n,Ze(t)+n*2);for(let k of ce)k.w=we-n*2;for(let k of A)k.w=we-n*2;let ye=Math.max(K,...de.map(k=>k.y+k.h),...pe.labels.map(k=>k.y+k.h)),Pe=Qe(t,n,ye+a,we-n*2);return pe.width=we,pe.height=(Pe?Pe.y+Pe.h:ye)+n,Pe&&(pe.strip=Pe),pe.badges=tr(t,pe),pe}function Os(t){let n=Math.min(...t.map(c=>c.x)),a=Math.min(...t.map(c=>c.y));return{x:n,y:a,w:Math.max(...t.map(c=>c.x+c.w))-n,h:Math.max(...t.map(c=>c.y+c.h))-a}}function Ns(t,n){return[...t.links.filter(c=>c.step===n&&c.kind!=="copy").map(c=>({event:c.event,points:c.points,color:c.color})),...t.moves.flatMap(c=>{let l=t.commits.find(e=>e.id===c.target);return c.step===n&&c.line&&l?[{event:c.event,target:l,color:l.color}]:[]})].sort((c,l)=>c.event-l.event)[0]}function er(t,n,a){let{r:c,inset:l}=w.badge,e=t.r+l+c,r=c*2+l;return[[t.cx+e,t.cy],[t.cx,t.cy+e],[t.cx-e,t.cy],[t.cx,t.cy-e]].find(i=>n.every(([o,p])=>Math.hypot(i[0]-o,i[1]-p)>=r)&&a.every(o=>bt(Ye(i),o)>=w.label.touch))}function Es(t,n,a){let{r:c,inset:l,along:e,short:r}=w.badge,s=vt(t),i=s<r?Math.min(c+1,s/2):e,o=c*2+l;for(let p=i;p<=s;p+=1){let f=st(t,p),b=Ye(f);if(n.every(([m,d])=>Math.hypot(f[0]-m,f[1]-d)>=o)&&a.every(m=>bt(b,m)>=w.label.touch))return f}}function tr(t,n){let{inset:a}=w.badge,c=[],l=[...n.links.map(s=>s.points),...n.moves.flatMap(s=>s.line?[s.line]:[])],e=[],r=[...n.tags,...n.commits.flatMap(s=>[{x:s.cx-s.r,y:s.cy-s.r,w:s.r*2,h:s.r*2},...s.text?[s.text]:[]])];return t.steps.forEach((s,i)=>{let o=Ns(n,i),p=o?.target?er(o.target,c,r):void 0;if(o&&(o.points||p)){let S=o.points,u=p??(S?Es(S,c,r)??it(S,c,l.filter(h=>h!==S)):[0,0]);c.push(u),e.push({step:i,x:u[0],y:u[1],color:o.color});return}let f=s.events.flatMap(S=>S.type==="swap"||S.type==="action"?[S.box]:[]).map(S=>n.boxes.find(u=>u.id===S))[0];if(f){e.push({step:i,x:f.x,y:f.y,color:f.color});return}if(n.strip&&s.events.some(S=>S.type==="strip")){e.push({step:i,x:n.strip.x+a,y:n.strip.y+a,color:"slate"});return}let b=n.commits.find(S=>S.id===n.refs[0]?.at[i]),m=b?er(b,c,r):void 0;if(b&&m){c.push(m),e.push({step:i,x:m[0],y:m[1],color:b.color});return}let d=e[e.length-1],$=n.lanes[0];e.push(d?{...d,step:i}:{step:i,x:($?.x??0)+($?.w??0)-a-w.badge.r,y:($?.y??0)+a+w.badge.r,color:$?.color??"slate"})}),Je(e)}function qs(t,n){let a=w.git,c=[],l=n.commits.map(s=>({x:s.cx-s.r,y:s.cy-s.r,w:s.r*2,h:s.r*2})),e=n.commits.flatMap(s=>s.text?[s.text]:[]),r=n.regions.map(s=>s.header);for(let s of n.moves){let i=t.steps[s.step]?.events[s.event];if(i?.type!=="edge"||i.label===void 0||!s.line)continue;let o=n.commits.find(h=>h.id===i.to);if(!o)continue;let p=n.lanes[0]?.id===o.branch,f=le(i.label,De(i.label)?O.labelJa:O.label)+w.label.padX*2,[b]=s.line.reduce((h,P)=>[h[0]+P[0]/s.line.length,0],[0,0]),m=Math.max(0,...n.tags.filter(h=>h.step===s.step&&Math.abs(h.x+h.w/2-o.cx)<.5).map(h=>o.cy-h.y)),d=i.labelSide??(p?"above":"below"),$=i.labelSide!==void 0?void 0:p?{x:b-f/2,y:o.cy-Math.max(m,(n.lanes[0]?.tagBase??a.tag)+w.carrier.tagH/2)-w.label.soft-w.label.h}:{x:b-f/2,y:o.cy+a.labelUnder},S=n.badges.filter(h=>h.step<=s.step).map(h=>Ye([h.x,h.y])),u=n.tags.filter(h=>h.step===s.step);c.push(Ke({step:s.step,event:s.event,text:i.label,points:s.line,color:s.color,side:d,...$?{base:$}:{}},{hard:[...l,...n.boxes],soft:[...e,...u,...r,...c.filter(h=>h.step===s.step)],touch:S}))}return c}function sr(t){let{box:n,sequence:a,label:c,margin:l,gap:e}=w,r=Xe(t),s=t.sequence?.lifelines??[],i=[...s,...t.boxes.map(D=>D.id).filter(D=>!s.includes(D))],o=new Map(i.map((D,x)=>[D,x])),p=i.map(D=>Ue(t,D,!1)),f=p.slice(1).map((D,x)=>p[x]/2+D/2+a.columnGap),b=[];for(let D of t.steps)for(let x of D.events){if(x.type!=="edge"||x.label===void 0)continue;let N=o.get(x.from)??0,E=o.get(x.to)??0,v=le(x.label,He(x.label))+c.padX*2;N===E?N<f.length&&b.push({from:N,to:N+1,need:a.selfW+c.side+v+a.labelRoom}):b.push({from:Math.min(N,E),to:Math.max(N,E),need:v+a.labelRoom*2})}b.sort((D,x)=>D.to-D.from-(x.to-x.from));for(let{from:D,to:x,need:N}of b){let E=0;for(let q=D;q<x;q++)E+=f[q]??0;if(E>=N)continue;let v=(N-E)/(x-D);for(let q=D;q<x;q++)f[q]=(f[q]??0)+v}let m=[];i.forEach((D,x)=>m.push(x===0?l+p[0]/2:m[x-1]+f[x-1]));let d=i.map((D,x)=>{let N=t.boxes.find(q=>q.id===D),E=p[x],v=m[x];return{id:D,name:N?.name??D,...N?.sub!==void 0?{sub:N.sub}:{},...N?.icon!==void 0?{icon:N.icon}:{},color:r.get(D)??"slate",x:v-E/2,y:l,w:E,h:n.h,cx:v,cy:l+n.h/2}}),$=l+n.h,S=[],u=[],h=[],P=$+a.firstRow,I=0,G=!0;t.steps.forEach((D,x)=>{D.events.forEach((N,E)=>{if(N.type!=="edge"&&N.type!=="action")return;let v,q;if(N.type==="edge"){let z=N.labelSide??"above",ee=N.from===N.to,de=N.label!==void 0;v=de&&z==="above"?a.labelOffset+c.h/2:e,q=ee?a.selfH+e:de&&z==="below"?a.labelOffset+c.h/2:e}else v=w.action.h/2,q=w.action.h/2;if(P=G?P+v:P+Math.max(a.minPitch,I+a.rowGap+v)+(E===0&&x>0?a.stepGap:0),G=!1,I=q,N.type==="edge"){let z=m[o.get(N.from)??0],ee=m[o.get(N.to)??0],de=Math.sign(ee-z)||1,ce=z===ee?[[z,P],[z+a.selfW,P],[z+a.selfW,P+a.selfH],[z+w.edge.inset,P+a.selfH]]:[[z,P],[ee-de*w.edge.inset,P]],pe=pt(N,r),ve={};if(N.carry.kind!=="none"){let we=w.slot.lifeline+mt(N.carry)[0],[ye,Pe]=ce,[k,V]=ce.slice(-2),J=Math.sign(Pe[0]-ye[0])||1,T=Math.sign(V[0]-k[0])||-1;ve.wait=[z-J*we,ye[1]],ve.settle=[ee+T*we,V[1]]}S.push({step:x,event:E,from:N.from,to:N.to,points:ce,color:pe,carry:N.carry,...ve}),N.label!==void 0&&h.push({step:x,event:E,text:N.label,points:ce,color:pe,...N.labelSide?{side:N.labelSide}:z===ee?{side:"right"}:{},offset:a.labelOffset})}else{let z=m[o.get(N.box)??0],ee=le(N.label,O.action)+w.action.padX*2;u.push({step:x,event:E,box:N.box,text:N.label,color:r.get(N.box)??"slate",x:z+w.badge.r+4,y:P-w.action.h/2,w:ee,h:w.action.h})}})});let ne=(G?$:P+I)+a.tail,U=i.map((D,x)=>({id:D,x:m[x],y1:$,y2:ne})),j=ot(S,t.steps.length),A=[];for(let D of h){let x=[...j].filter(([E])=>E<=D.step).map(([,E])=>Ye(E.point)),N=[...A.filter(E=>E.step===D.step),...u];A.push(Ke(D,{hard:d,soft:N,touch:x}))}let C={kind:"sequence",width:0,height:0,regions:[],boxes:d,lifelines:U,edges:S,labels:A,actions:u,badges:[],paths:[],ends:[]},K=[...d.map(D=>D.x),...A.map(D=>D.x),...u.map(D=>D.x)],X=Math.max(0,l-Math.min(...K));X>0&&Pt(C,X,0);let Q=[...d.map(D=>D.x+D.w),...A.map(D=>D.x+D.w),...u.map(D=>D.x+D.w),...S.flatMap(D=>D.points.map(x=>x[0]))],ie=Math.max(Math.max(...Q)+l,Ze(t)+l*2),re=Qe(t,l,ne+e,ie-l*2);return C.width=ie,C.height=(re?re.y+re.h:ne)+l,re&&(C.strip=re),C.badges=Ls(t,C),C}function Ls(t,n){let a=ot(n.edges,t.steps.length),c=t.steps.map((l,e)=>{let r=a.get(e);if(r)return{step:e,x:r.point[0],y:r.point[1],color:r.edge.color};let s=n.actions.find(o=>o.step===e),i=s&&n.lifelines.find(o=>o.id===s.box);return s&&i?{step:e,x:i.x,y:s.y+s.h/2,color:s.color}:St(l.events,e,n)});return Je(c)}var ir=t=>Mt.includes(t);function Rs(t){let n=[],a=c=>{!ir(c)&&!n.includes(c)&&n.push(c)};for(let{edge:c}of xt(t))a(c.from),a(c.to);return n}var As=(t,n)=>t.from===n.from&&t.to===n.to;function or(t,n){let{box:a,state:c,margin:l,gap:e}=w,r=w.edge.inset,s=ze[n],i=Xe(t),o=xt(t),p=Rs(t),f=t.boxes.map(g=>g.id).filter(g=>!p.includes(g)),b=(t.state?.paths??[]).filter(g=>!o.some(({edge:R})=>As(R,g))),m=[...o.map(({edge:g})=>g),...b],d=c.ghost,$=g=>{let R=t.boxes.find(Y=>Y.id===g);return d.pad*2+a.icon+d.gap+Math.max(le(R?.name??g,O.boxName),le(R?.sub??"",O.boxSub))},S=wt(t),u=Math.max(a.padX,c.done.inset+c.done.r+w.slot.clear),h=new Map(t.boxes.map(g=>[g.id,f.includes(g.id)?$(g.id):Math.max(Ue(t,g.id,!0),$t(S.get(g.id),g.icon!==void 0,u))])),P=Math.max(1,Math.min(c.columns,p.length)),I=Math.max(1,Math.ceil(p.length/c.columns)),G=new Map(p.map((g,R)=>{let Y=Math.floor(R/c.columns),fe=R%c.columns;return[g,{row:Y,col:Y%2===0?fe:P-1-fe}]})),ne=Array.from({length:P},(g,R)=>Math.max(a.minW,...p.filter(Y=>G.get(Y)?.col===R).map(Y=>h.get(Y)??a.minW))),U=Array.from({length:Math.max(0,P-1)},()=>c.columnGap);for(let g of m){let R=G.get(g.from),Y=G.get(g.to);if(!R||!Y||g.label===void 0||R.row!==Y.row||Math.abs(R.col-Y.col)!==1)continue;let fe=Math.min(R.col,Y.col);U[fe]=Math.max(U[fe]??0,le(g.label,He(g.label))+w.label.padX*2+c.labelRoom*2)}let j=[];for(let g=0;g<P;g++)j.push(g===0?l:j[g-1]+ne[g-1]+U[g-1]);let A=g=>j[g]+ne[g]/2,C=g=>f.includes(g),K=new Set(b.filter(g=>C(g.to)&&!C(g.from)&&!ir(g.from)).map(g=>g.from)),X=[s.sideNote,...K.size>0?[s.sideFrom(K.size)]:[]],Q=Math.max(le(s.side,O.regionName),...X.map(g=>le(g,O.regionNote))),ie=c.side.pad*2+Math.max(d.h,O.regionName.size+w.region.line*X.length+c.side.pad/4),re=m.some(g=>g.from==="start"),D=l+(f.length>0?ie+c.side.gap:re?c.start+c.drop:0),x=g=>D+g*(a.h+c.rowGap),N=(g,R,Y,fe)=>{let me=t.boxes.find(Ne=>Ne.id===g),ge=h.get(g)??a.minW,Ge=fe?d.h:a.h;return{id:g,name:me?.name??g,...me?.sub!==void 0?{sub:me.sub}:{},...me?.icon!==void 0?{icon:me.icon}:{},color:i.get(g)??"slate",x:R-ge/2,y:Y,w:ge,h:Ge,cx:R,cy:Y+Ge/2,...fe?{ghost:!0}:{}}},E=p.map(g=>{let R=G.get(g);return N(g,A(R.col),x(R.row),!1)});for(let g of E)kt(g,S.get(g.id),u);let v=new Map(E.map(g=>[g.id,g])),q=g=>E.some(R=>R!==g&&Math.abs(R.cx-g.cx)<.5&&R.y>g.y),z=[],ee=E[0],de=Math.max(...E.map(g=>g.x+g.w)),ce,pe=l+ie+c.side.lane;if(f.length>0){let g=Ne=>b.filter(Ie=>Ie.to===Ne).flatMap(Ie=>v.get(Ie.from)??[]),R=f.flatMap(g),Y=Math.max(l,Math.min(...R.length>0?R.map(Ne=>Ne.x):[l+c.side.pad])-c.side.pad),fe=Y+c.side.pad+Q+e*2,me=f.map(Ne=>{let Ie=g(Ne);return{id:Ne,cx:Ie.length>0?Ie.reduce((lt,ht)=>lt+ht.cx,0)/Ie.length:fe}});me.sort((Ne,Ie)=>Ne.cx-Ie.cx);let ge=Y;for(let{id:Ne,cx:Ie}of me){let lt=h.get(Ne)??a.minW,ht=Math.max(Ie-lt/2,fe),rt=N(Ne,ht+lt/2,l+(ie-d.h)/2,!0);E.push(rt),v.set(Ne,rt);let Fn=b.some(Bn=>Bn.from===Ne&&Bn.to==="finish");Fn&&z.push({kind:"finish",x:rt.x+rt.w+c.beside,y:rt.cy,r:c.end.r,ghost:!0,text:"",box:Ne}),ge=Fn?rt.x+rt.w+c.beside+c.end.r:rt.x+rt.w,fe=ge+e*2}let Ge=Math.max(ge+c.side.pad,de);ce={x:Y,y:l,w:Ge-Y,h:ie,title:s.side,notes:X}}if(ee&&re){let g=ee.cx+c.start+c.text+le(s.start,O.regionNote)+e,R=ce&&g<ce.x?ce.y+c.side.pad+c.start:ee.y-c.drop;z.unshift({kind:"start",x:ee.cx,y:R,r:c.start,ghost:!1,text:s.start})}for(let g of E.filter(R=>!R.ghost&&m.some(Y=>Y.from===R.id&&Y.to==="finish")))z.push(q(g)?{kind:"finish",x:g.x+g.w+c.beside,y:g.cy,r:c.end.r,ghost:!1,text:s.end,box:g.id}:{kind:"finish",x:g.cx,y:g.y+g.h+c.below,r:c.end.r,ghost:!1,text:s.end,box:g.id});let ve=(g,R)=>{let Y=G.get(g.id),fe=G.get(R.id);if(!Y||!fe)return[[g.cx,g.y+g.h],[R.cx,R.y-r]];if(Y.row===fe.row&&Math.abs(Y.col-fe.col)===1)return R.cx>g.cx?[[g.x+g.w,g.cy],[R.x-r,R.cy]]:[[g.x,g.cy],[R.x+R.w+r,R.cy]];if(Y.row===fe.row){let ge=g.y+g.h+c.rowGap/4;return[[g.cx,g.y+g.h],[g.cx,ge],[R.cx,ge],[R.cx,R.y+R.h+r]]}if(fe.row>Y.row){if(Math.abs(g.cx-R.cx)<.5)return[[g.cx,g.y+g.h],[R.cx,R.y-r]];let ge=g.y+g.h+c.rowGap/2;return[[g.cx,g.y+g.h],[g.cx,ge],[R.cx,ge],[R.cx,R.y-r]]}if(Math.abs(g.cx-R.cx)<.5)return[[g.cx,g.y],[R.cx,R.y+R.h+r]];let me=R.y+R.h+c.rowGap/2;return[[g.cx,g.y],[g.cx,me],[R.cx,me],[R.cx,R.y+R.h+r]]},we=(g,R)=>{let Y=b.filter(me=>me.to===R.id).flatMap(me=>v.get(me.from)??[]).sort((me,ge)=>me.cx-ge.cx),fe=Y.findIndex(me=>me.id===g);return Y.length<=1?Math.min(Math.max(Y[0]?.cx??R.cx,R.x+c.side.entry),R.x+R.w-c.side.entry):R.x+c.side.entry+(R.w-c.side.entry*2)*Math.max(0,fe)/(Y.length-1)},ye=g=>re&&g===ee?g.cx+c.side.entry:g.cx,Pe=g=>z.find(R=>R.kind==="finish"&&R.box===g),k=(g,R)=>{if(g==="start"){let me=z.find(Ge=>Ge.kind==="start"),ge=v.get(R);return!me||!ge?[]:[[me.x,me.y+me.r],[ge.cx,ge.y-r]]}let Y=v.get(g);if(!Y)return[];if(R==="finish"){let me=Pe(g);return me?Math.abs(me.x-Y.cx)<.5?[[Y.cx,Y.y+Y.h],[Y.cx,me.y-me.r-r]]:[[Y.x+Y.w,Y.cy],[me.x-me.r-r,Y.cy]]:[]}let fe=v.get(R);if(!fe)return[];if(g===R)return Ft(Y);if(fe.ghost&&!Y.ghost){let me=ye(Y),ge=we(g,fe);return Math.abs(me-ge)<.5?[[me,Y.y],[ge,fe.y+fe.h+r]]:[[me,Y.y],[me,pe],[ge,pe],[ge,fe.y+fe.h+r]]}return Y.ghost&&fe.ghost?[[Y.x+Y.w,Y.cy],[fe.x-r,fe.cy]]:Y.ghost?[[Y.cx,Y.y+Y.h],[Y.cx,pe],[fe.cx,pe],[fe.cx,fe.y-r]]:ve(Y,fe)},V=g=>{let R=g.to==="finish"?Pe(g.from):void 0;if(!R)return;let Y=v.get(g.from);return Y&&Math.abs(R.x-Y.cx)<.5?[R.x-R.r-e-mt(g.carry)[0],R.y]:[R.x,R.y+R.r+e+w.carrier.tagH/2]},J=g=>{let R=g.from==="start"?z.find(Y=>Y.kind==="start"):void 0;return R?[R.x-R.r-w.slot.mark-mt(g.carry)[0],R.y]:void 0},T=o.map(({step:g,event:R,edge:Y})=>{let fe=V(Y),me=Y.carry.kind==="none"?void 0:J(Y);return{step:g,event:R,from:Y.from,to:Y.to,points:k(Y.from,Y.to),color:js(Y,i),carry:Y.carry,...fe?{settle:fe}:{},...me?{wait:me}:{}}});gt(T,v,S);let H=new Map;for(let g of T){if(g.points.length!==2||!T.some(ge=>ge.from===g.to&&ge.to===g.from&&ge.points.length===2))continue;let[R,Y]=g.points,fe=Math.abs(Y[1]-R[1])<Math.abs(Y[0]-R[0]),me=(g.from<g.to?1:-1)*w.edge.parallel;g.points=g.points.map(([ge,Ge])=>fe?[ge,Ge+me]:[ge+me,Ge]),H.set(g,fe?me>0?"below":"above":me>0?"right":"left")}let y=b.map(g=>({from:g.from,to:g.to,points:k(g.from,g.to)})),L=(g,R,Y)=>g.from===g.to?Bt(g.points):it(g.points,R,Y),M=[],F=z.flatMap(g=>g.text===""?[]:[_e(g.text,..._t(g),O.regionNote)]),te=[...ot(T,t.steps.length,L).values()].map(g=>Ye(g.point)),B=[...ce?[{x:ce.x,y:ce.y,w:c.side.pad+Q,h:ce.h}]:[],...F],_=g=>[...T.map(R=>R.points),...y.map(R=>R.points)].filter(R=>R!==g);for(let g of T){let R=t.steps[g.step]?.events[g.event];if(R?.type!=="edge"||R.label===void 0)continue;let Y=g.from===g.to,fe=qt(g),me=M.filter(lt=>lt.text===R.label&&T.some(ht=>ht.step===lt.step&&ht.event===lt.event&&qt(ht)===fe)),ge=me[me.length-1];if(ge){ge.until=g.step,M.push({x:ge.x,y:ge.y,w:ge.w,h:ge.h,step:g.step,event:g.event,text:ge.text,family:ge.family,color:g.color});continue}let Ge=le(R.label,He(R.label))+w.label.padX*2,Ne=Y?{side:"below",base:Gt(g.points,Ge)}:{},Ie=R.labelSide??(g.to==="finish"?"left":H.get(g));M.push(Ke({step:g.step,event:g.event,text:R.label,points:g.points,color:g.color,...Ie?{side:Ie}:Y?{}:{flip:!0},...Ne},{hard:E,soft:[...B,...M],touch:te,lines:_(g.points)}))}let Z=[];b.forEach((g,R)=>{let Y=y[R];if(g.label===void 0||Y.points.length===0)return;let fe=He(g.label),me=v.get(g.to)?.ghost===!0&&v.get(g.from)?.ghost!==!0,ge=Y.points[0][0],Ge=me?{side:"below",base:{x:ge+w.label.soft,y:pe+w.label.soft},slide:Math.max(...Y.points.map(([Ie])=>Math.abs(Ie-ge)))}:{},Ne=Ke({step:-1,event:R,text:g.label,points:Y.points,color:"slate",...Ge},{hard:E,soft:[...B,...M,...Z],touch:te,lines:_(Y.points)});Z.push(Ne),Y.label={x:Ne.x,y:Ne.y,w:Ne.w,h:Ne.h,text:g.label,family:fe.family}});let ae={kind:"state",width:0,height:0,regions:[],boxes:E,lifelines:[],edges:T,labels:M,actions:[],badges:[],paths:y,ends:z,...ce?{side:ce}:{}},xe=[...E.map(g=>g.x),...M.map(g=>g.x),...y.flatMap(g=>g.label?[g.label.x]:[])],qe=[...M.map(g=>g.y),...y.flatMap(g=>g.label?[g.label.y]:[])],Ae=Math.max(0,l-Math.min(...xe)),Se=qe.length>0?Math.max(0,l-Math.min(...qe)):0;(Ae>0||Se>0)&&Pt(ae,Ae,Se);let je=g=>g.x+(g.text===""?g.r:c.text+le(g.text,O.regionNote)),Fe=[...E.map(g=>g.x+g.w),...M.map(g=>g.x+g.w),...z.map(je),...T.flatMap(g=>g.points.map(R=>R[0])),...y.flatMap(g=>[...g.points.map(R=>R[0]),...g.label?[g.label.x+g.label.w]:[]]),...ce?[ce.x+ce.w]:[]],Be=[...E.map(g=>g.y+g.h),...M.map(g=>g.y+g.h),...z.map(g=>g.y+g.r),...T.flatMap(g=>g.points.map(R=>R[1]))],at={title:s.trail,states:p.map(g=>({box:g,color:i.get(g)??"slate"}))},nt=Math.max(Math.max(...Fe)+l,Ze(t,at)+l*2),Ot=Math.max(...Be,x(I-1)+a.h),Nt=Qe(t,l,Ot+e,nt-l*2,at);ae.width=nt,ae.height=(Nt?Nt.y+Nt.h:Ot)+l,Nt&&(ae.strip=Nt);let Qr=ot(T,t.steps.length,L);return ae.badges=Je(t.steps.map((g,R)=>{let Y=Qr.get(R);return Y?{step:R,x:Y.point[0],y:Y.point[1],color:Y.edge.color}:St(g.events,R,ae)})),ae}function js(t,n){return t.carry.kind==="coin"?pt(t,n):n.get(t.to==="finish"?t.from:t.to)??"slate"}var Tn=t=>t.kind==="time",Wt={d:86400,h:3600,min:60,s:1,ms:.001},Ds=Object.keys(Wt);function Cs(t){let n=/^([0-9]+(?:\.[0-9]+)?)(ms|s|min|h|d)$/u.exec(t);if(!n)return{seconds:1,unit:"s"};let a=n[2];return{seconds:Number(n[1])*Wt[a],unit:a}}var ar=(t,n)=>Ds.find(a=>t/Wt[a]>=2-1e-9)??n,lr=(t,n,a)=>`${Number((t/Wt[n]).toFixed(2))} ${ze[a].timeUnits[n]}`;function Is(t,n,a){let c=1;if(n)c=n*Math.max(1,Math.ceil(t/n/8));else for(let r=1;;r*=10){let s=[r,r*2,r*5].find(i=>t/i<=w.time.ticks);if(s!==void 0){c=s;break}}let l=[];for(let r=0;r<=t;r+=c)l.push(r);let e=l[l.length-1];return e!==t&&(t-e)*a>=w.time.minorPx&&l.push(t),{at:l,step:c}}function Fs(t,n,a,c){let l=Array.from({length:n-1},(r,s)=>s+1).find(r=>n%r===0&&r*a>=w.time.minorPx);if(l===void 0)return[];let e=[];for(let r=l;r<t;r+=l)c.includes(r)||e.push(r);return e}function cr(t){let n=0;return t.steps.map(a=>{let c=n;for(let l of a.events)l.type==="now"&&(n=Math.max(n,l.to+1));return[c,n]})}function mr(t,n="ja"){let a=w.time,{margin:c,gap:l}=w,e=w.region,r=ze[n],s=t.time??{scale:{unit:"",length:"1s",count:1},rows:[]},{scale:i}=s,o=Math.max(1,i.count),p=Cs(i.length),f=Math.max(a.width,Ze(t)+c*2),b=Math.max(0,...s.rows.map(T=>le(T.name,O.timeRow))),m=Math.max(a.axisX,c+e.inset+b+a.gutterGap),d=f-a.right-m,$=d/o,S=Xe(t),u=wt(t),h=[],P=[],I=[],G=[],ne=new Map(s.rows.map(T=>[T.id,T])),U,j=c;if(s.zoom){let{from:T,to:H}=s.zoom,y=H-T+1,L=d/y,M=c,F=ar(H*p.seconds,p.unit),te=[];for(let Z=0;Z<y;Z++){let ae=T+Z,xe=m+Z*L,qe=t.boxes.map((Se,je)=>{let Fe=u.get(Se.id),Be=Math.max(Ue(t,Se.id,!1),$t(Fe,Se.icon!==void 0,w.box.padX)),at=M+a.boxTop+je*(w.box.h+a.boxGap),nt=ne.get(Se.id),Ot={id:Se.id,name:Se.name,...Se.sub!==void 0?{sub:Se.sub}:{},...Se.icon!==void 0?{icon:Se.icon}:{},color:S.get(Se.id)??"slate",x:xe+L/2-Be/2,y:at,w:Be,h:w.box.h,cx:xe+L/2,cy:at+w.box.h/2,...nt?{row:nt.id}:{},...nt?.empty?.includes(ae)?{empty:!0}:{}};return kt(Ot,Fe),Ot});P.push(...qe);let Ae=`${i.unit} ${(i.from??0)+ae}${r.headJoin}${lr(ae*p.seconds,F,n)}`;te.push({unit:ae,head:Ae,boxes:qe,x:xe,y:M,w:L,h:0})}let _=Math.max(M+a.boxTop,...P.map(Z=>Z.y+Z.h))+a.zoomBottom;for(let Z of te)Z.h=_-M;h.push({id:"zoom",lines:[r.zoom],note:`${y} ${i.unit}`,icon:"clock",color:"blue",x:c,y:M,w:f-c*2,h:_-M,header:{x:c+e.inset,y:M+e.inset,w:Math.max(e.icon,le(r.zoom,O.regionName)),h:e.nameY-e.inset+e.line}}),U={from:T,to:H,frame:{x:0,y:0,w:0,h:0},guides:[],columns:te,empty:r.empty,headY:M+a.head},j=_+a.zoomGap}let A=j+a.rowsTop,C=s.rows.map((T,H)=>({id:T.id,name:T.name,color:T.color??S.get(T.id)??ct[H%ct.length],x:m,y:A+H*(a.row+a.rowGap),w:d,h:a.row})),K=C.length>0?Math.max(...C.map(T=>T.y+T.h)):A,X=Math.min(a.markMax,Math.max(a.markMin,$*a.markRatio)),Q=C.flatMap((T,H)=>Array.from({length:o},(y,L)=>({row:T.id,unit:L,empty:s.rows[H]?.empty?.includes(L)===!0,color:T.color,colors:[],x:m+(L+.5)*$-X/2,y:T.y,w:X,h:T.h})));if(t.steps.forEach((T,H)=>T.events.forEach((y,L)=>{if(y.type==="mark")for(let M of Q)M.row===y.row&&M.unit>=y.from&&M.unit<=y.to&&!M.empty&&M.colors.push({step:H,event:L,color:y.color})})),U){let T={x:m+U.from*$-a.frame,y:A-a.frame,w:(U.to-U.from+1)*$+a.frame*2,h:K-A+a.frame*2},H=Math.max(...U.columns.map(y=>y.y+y.h));U.frame=T,U.guides=[[[T.x,T.y],[m,H]],[[T.x+T.w,T.y],[m+d,H]]]}let ie=K+a.point.drop,re=(s.points??[]).map(T=>{let H=[];t.steps.forEach((B,_)=>B.events.forEach((Z,ae)=>{Z.type==="swap"&&Z.box===T.id&&H.push({step:_,event:ae,text:Z.text,...Z.color?{color:Z.color}:{}})}));let y=m+(T.at+.5)*$,L=y+a.point.text,M=Math.max(le(T.id,O.pointName),...H.map(B=>le(B.text,O.pointState))),F=ie+a.point.nameY-O.pointName.size*.8,te=ie+a.point.stateY+O.pointState.size*.2;return{id:T.id,unit:T.at,cx:y,cy:ie,r:a.point.r,text:{x:L,y:F,w:M,h:te-F},changes:H}}),D=new Map(re.map(T=>[T.id,T])),x=(T,H)=>D.get(T)?.changes.filter(L=>L.step<=H&&L.color).at(-1)?.color;t.steps.forEach((T,H)=>T.events.forEach((y,L)=>{if(y.type!=="edge")return;if(y.at===void 0){let te=D.get(y.from),B=D.get(y.to);if(!te||!B||te===B)return;let _=B.cx>te.cx,Z=_?Math.max(te.cx+te.r,te.text.x+te.text.w+a.point.link):te.cx-te.r-a.point.end,ae=_?B.cx-B.r-a.point.end:Math.min(B.cx-B.r,B.text.x+B.text.w+a.point.link),xe={step:H,event:L,from:y.from,to:y.to,points:[[Z,te.cy],[ae,B.cy]],color:y.carry.kind==="coin"?"coin":x(y.to,H)??"slate",carry:y.carry};y.carry.kind!=="none"&&(xe.settle=[ae-(_?1:-1)*(w.carrier.coinR+w.edge.arrow),B.cy]),I.push(xe);return}let M=Bs(y,U);if(!M)return;let F={step:H,event:L,from:y.from,to:y.to,points:M.points,color:pt(y,S),carry:y.carry};Gs(F,M.from,M.to,u),I.push(F),G.push({step:H,event:L,from:M.from,to:M.to,column:y.at,into:y.into??y.at})}));let N={kind:"time",width:f,height:0,regions:h,boxes:P,lifelines:[],edges:I,labels:[],actions:[],badges:[],paths:[],ends:[],axis:{x:m,w:d,unit:$,count:o,line:0},rows:C,marks:Q,ticks:[],minor:[],periods:[],points:re,...U?{zoom:U}:{},spans:[],wires:G,needle:{y1:A-a.needle.over,y2:K+a.needle.over}},E=K,v=t.steps.some(T=>T.events.some(H=>H.type==="edge"&&H.at===void 0&&H.label!==void 0)),{r:q,inset:z}=w.badge,ee=re.length>0?ie+a.point.r+(v?a.point.room:a.point.plain):E+(q+z)*2,de=[],ce=t.steps.flatMap((T,H)=>T.events.flatMap((y,L)=>y.type==="span"?[{s:H,e:L,event:y}]:[]));for(let{s:T,e:H,event:y}of ce){let L=y.shape==="box"?"box":"bracket",M=ce.find(Z=>Z.s>T&&(Z.event.shape==="box"?"box":"bracket")===L&&Z.event.from<=y.to&&y.from<=Z.event.to),F=y.color??"slate",te=m+y.from*$,B=m+(y.to+1)*$,_={step:T,event:H,kind:L,from:y.from,to:y.to,text:y.text,color:F,...M?{until:M.s}:{}};if(L==="box"){let Z=a.box,ae={x:te-Z.pad,y:A-Z.pad,w:B-te+Z.pad*2,h:K-A+Z.pad*2},xe=le(y.text,O.tag)+Z.tagPadX*2,qe={x:ae.x+Z.tagX,y:ae.y-Z.tagH/2,w:xe,h:Z.tagH};de.push({..._,...ae,textRect:qe,textY:ae.y+w.baseline.tag})}else de.push({..._,x:te,y:0,w:B-te,h:a.bracket.tick,textRect:{x:0,y:0,w:0,h:0},textY:0})}N.spans=de,N.badges=pr(t,N,cr(t)),N.labels=Ys(t,N),ee=Math.max(ee,...N.labels.map(T=>T.y+T.h+w.label.soft));let pe=[];for(let T of de.filter(H=>H.kind==="bracket")){let H=le(T.text,O.spanText),y=Math.min(m+d-H/2,Math.max(m+H/2,T.x+T.w/2)),L={x:Math.min(T.x,y-H/2),w:Math.max(T.x+T.w,y+H/2)-Math.min(T.x,y-H/2)},M=te=>{let B=te.until===void 0||te.until>T.step,_=Math.min(te.x,te.textRect.x),Z=Math.max(te.x+te.w,te.textRect.x+te.textRect.w)-_;return B&&L.x<_+Z&&_<L.x+L.w},F=pe.findIndex(te=>!te.some(M));F<0&&(pe.push([]),F=pe.length-1),pe[F].push(T),T.y=ee+a.bracket.gap+F*a.bracket.lane,T.textY=T.y+a.bracket.tick+a.bracket.text,T.textRect=_e(T.text,y,T.textY,O.spanText,"middle")}pe.length>0&&(ee=Math.max(...de.filter(T=>T.kind==="bracket").map(T=>T.textRect.y+T.textRect.h)));let ve=ee+a.axisGap;N.axis.line=ve;let we=Is(o,s.period?.length,$),ye=ve+a.tickY,Pe=ar(o*p.seconds,p.unit);N.ticks=we.at.map(T=>{let H=lr(T*p.seconds,Pe,n),y=le(H,O.timeTick),L=m+T*$,M=T===0?L:T===o?L-y:Math.min(m+d-y,Math.max(m,L-y/2));return{at:T,x:L,text:H,left:M,y:ye}}),N.minor=Fs(o,we.step,$,we.at);let k=ye+O.timeTick.size*.2;if(s.period){let T=s.period,H=[];for(let M=0,F=0;F<o;M++,F+=T.length){let te=Math.min(o,F+T.length)-1,B=`${T.name} ${(T.from??0)+M}`,_=(i.from??0)+F,Z=`${i.unit} ${r.range(String(_),String((i.from??0)+te))}`;H.push({index:M,from:F,to:te,name:B,range:Z,x:m+F*$,y:ve,w:(te-F+1)*$,h:0,nameY:ye,rangeY:ye+a.rangeY})}let y=N.ticks.map(M=>_e(M.text,M.left,M.y,O.timeTick)),L=H.some(M=>{let F=_e(M.name,M.x+M.w/2,M.nameY,O.timePeriod,"middle");return y.some(te=>F.x<te.x+te.w+a.nameGap&&te.x<F.x+F.w+a.nameGap)});for(let M of H)L&&(M.nameY=ye+a.rangeY+2,M.rangeY=M.nameY+a.rangeY),M.h=M.rangeY+O.timeRange.size*.2-ve;N.periods=H,k=Math.max(k,...H.map(M=>M.rangeY+O.timeRange.size*.2))}let V=k+a.bottom;h.push({id:"axis",lines:[],color:"slate",x:c,y:j,w:f-c*2,h:V-j,header:{x:c+e.inset,y:j+e.inset,w:0,h:0}});let J=Qe(t,c,V+l,f-c*2);return J&&(N.strip=J),N.height=(J?J.y+J.h:V)+c,N.badges=pr(t,N,cr(t)),N}function Bs(t,n){if(!n||t.at===void 0)return;let a=t.into??t.at,c=n.columns.find(m=>m.unit===t.at),l=n.columns.find(m=>m.unit===a),e=c?.boxes.find(m=>m.id===t.from),r=l?.boxes.find(m=>m.id===t.to);if(!c||!l||!e||!r||e===r)return;let s=c.boxes.indexOf(e),i=l.boxes.indexOf(r),o=i>s;if(c===l){if(Math.abs(i-s)===1)return{from:e,to:r,points:[[e.cx,o?e.y+e.h+1:e.y-1],[r.cx,o?r.y-1:r.y+r.h+1]]};let m=Math.min(c.x+c.w-w.gap,Math.max(e.x+e.w,r.x+r.w)+w.gap);return{from:e,to:r,points:[[e.x+e.w+1,e.cy],[m,e.cy],[m,r.cy],[r.x+r.w+1,r.cy]]}}let p=l.x>c.x;if(s===i)return{from:e,to:r,points:[[p?e.x+e.w+1:e.x-1,e.cy],[p?r.x-1:r.x+r.w+1,r.cy]]};let f=e.cx+(p?1:-1)*e.w/4,b=r.cx-(p?1:-1)*r.w/4;return{from:e,to:r,points:[[f,o?e.y+e.h+1:e.y-1],[b,o?r.y-1:r.y+r.h+1]]}}function Gs(t,n,a,c){let l={...t};gt([l],new Map([[t.to,a]]),c);let e={...t};gt([e],new Map([[t.from,n]]),c),l.settle&&(t.settle=l.settle),e.wait&&(t.wait=e.wait)}function pr(t,n,a){let{r:c,inset:l}=w.badge,{axis:e}=n,r=[],s=[],i=Math.min(...n.rows.map(f=>f.y),n.needle.y1+w.time.needle.over),o=Math.max(...n.rows.map(f=>f.y+f.h),i),p=n.points[0]?(o+n.points[0].cy-n.points[0].r)/2:o+c+l;return t.steps.forEach((f,b)=>{let m=(h,P)=>{r.push(h),s.push({step:b,x:h[0],y:h[1],color:P})},d=n.edges.filter(h=>h.step===b).sort((h,P)=>h.event-P.event)[0];if(d){let h=d.carry.kind!=="none"&&!d.wait?[d.points[0]]:[],P=n.edges.filter(I=>I!==d).map(I=>I.points);m(it(d.points,[...r,...h],P),d.color);return}let[$,S]=a[b]??[0,0];if(S>$){let h=e.x+($+S)/2*e.unit,P=n.points.find(I=>Math.abs(I.cx-h)<c+l);P&&(h=P.cx+c+l*2),m([h,p],"slate");return}for(let h of f.events){let P=_s(h,b,n);if(P){m(P.at,P.color);return}}if(n.strip&&f.events.some(h=>h.type==="strip")){s.push({step:b,x:n.strip.x+l,y:n.strip.y+l,color:"slate"});return}let u=s[s.length-1];s.push(u?{...u,step:b}:{step:b,x:e.x-c-l,y:i,color:"slate"})}),Je(s)}function _s(t,n,a){let{r:c,inset:l}=w.badge;if(t.type==="span"){let e=a.spans.find(r=>r.step===n&&r.from===t.from&&r.to===t.to&&r.text===t.text);return e?e.kind==="box"?{at:[e.x,e.y],color:e.color}:{at:[e.x-c-l,e.y+e.h/2],color:e.color}:void 0}if(t.type==="swap"){let e=a.points.find(r=>r.id===t.box);if(e)return{at:[e.cx-e.r-l-c,e.cy],color:t.color??"slate"}}if(t.type==="mark"){let e=a.rows.find(s=>s.id===t.row),r=Math.min(...a.rows.map(s=>s.y));if(e)return{at:[a.axis.x+(t.from+t.to+1)/2*a.axis.unit,r-c-l],color:t.color}}}function Ys(t,n){let a=[],c=n.points.map(r=>({x:r.cx-r.r,y:r.cy-r.r,w:r.r*2,h:r.r*2})),l=n.points.map(r=>r.text),e=(n.zoom?.columns??[]).map(r=>_e(r.head,r.x+r.w/2,n.zoom?.headY??0,O.timeHead,"middle"));for(let r of n.edges){let s=t.steps[r.step]?.events[r.event];if(s?.type!=="edge"||s.label===void 0)continue;let i=n.badges.filter(p=>p.step<=r.step).map(p=>Ye([p.x,p.y])),o=s.labelSide??(s.at===void 0?"below":void 0);a.push(Ke({step:r.step,event:r.event,text:s.label,points:r.points,color:r.color,...o?{side:o}:{},flip:s.at!==void 0},{hard:[...c,...n.boxes],soft:[...l,...e,...a.filter(p=>p.step===r.step)],touch:i}))}return a}var Vs={string:"\u6587\u5B57\u5217\u306B\u3059\u308B",integer:"\u6574\u6570\u306B\u3059\u308B",number:"\u6570\u306B\u3059\u308B",object:"\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B\u3059\u308B",array:"\u914D\u5217\u306B\u3059\u308B",boolean:"true \u304B false \u306B\u3059\u308B",null:"null \u306B\u3059\u308B"},Ws={string:"Use a string",integer:"Use an integer",number:"Use a number",object:"Use an object",array:"Use an array",boolean:"Use true or false",null:"Use null"},dr=(t,n)=>`${t} ${n}${t===1?"":"s"}`,Hs={additionalProperties:t=>`${t} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,required:t=>`${t} \u306E\u6B04\u304C\u8981\u308B`,enum:t=>`${t.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,type:t=>Vs[t]??`${t} \u306B\u3059\u308B`,minLength:t=>`${t} \u5B57\u4EE5\u4E0A\u66F8\u304F`,pattern:t=>t?`${t.space?"\u7A7A\u767D\u3068 ":""}${t.chars.join(" ")} \u306F\u4F7F\u3048\u306A\u3044`:"\u4F7F\u3048\u306A\u3044\u5B57\u304C\u5165\u3063\u3066\u3044\u308B",minItems:t=>`${t} \u3064\u4EE5\u4E0A\u66F8\u304F`,minimum:t=>`${t} \u4EE5\u4E0A\u306B\u3059\u308B`,const:t=>`${t} \u306B\u3059\u308B`,not:t=>t?`${t.field} \u306E\u6B04\u306F kind \u304C ${t.kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`:"\u3053\u306E\u6B04\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u66F8\u3051\u306A\u3044",reserved:t=>`${t.join(" \u3068 ")} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,kindOnly:(t,n)=>`${t.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${n} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,hex:(t,n)=>`0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${t} \u304B\u3089 ${n} \u5B57\u306B\u3059\u308B`,duration:t=>`\u6570\u3068\u5358\u4F4D (${t.join(" / ")}) \u306E\u7D44\u3067\u66F8\u304F (12s \u306A\u3069)`,ratio:"\u5206\u6570 (2/3) \u304B\u767E\u5206\u7387 (97%) \u3067\u66F8\u304F",url:"/ \u3067\u59CB\u307E\u308B path \u304B\u3001http:// \u304B https:// \u3067\u59CB\u307E\u308B URL \u306B\u3059\u308B",anyOf:t=>t.length>0?`${t.join(" \u304B ")} \u306E${t.length===2?"\u3069\u3061\u3089\u304B":"\u3069\u308C\u304B"}\u306E\u6B04\u304C\u8981\u308B`:"\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u306B\u3082\u5408\u308F\u306A\u3044",oneOf:"\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",discriminator:(t,n)=>`${t} \u306F ${n.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,newer:(t,n)=>`\u7248 ${t} \u306E\u56F3\u306F\u3001\u3053\u306E\u9053\u5177 (\u7248 ${n}) \u3088\u308A\u65B0\u3057\u3044\u306E\u3067\u8AAD\u3081\u306A\u3044\u3002\u9053\u5177\u3092\u65B0\u3057\u304F\u3059\u308B`},zs={additionalProperties:t=>`The ${t} field is not allowed`,required:t=>`The ${t} field is required`,enum:t=>`Use one of ${t.join(" / ")}`,type:t=>Ws[t]??`Use ${t}`,minLength:t=>`Write at least ${dr(t,"character")}`,pattern:t=>t?`Cannot contain ${t.space?"spaces or ":""}${t.chars.join(" ")}`:"Contains characters that are not allowed",minItems:t=>`Write at least ${dr(t,"item")}`,minimum:t=>`Use ${t} or greater`,const:t=>`Use ${t}`,not:t=>t?`The ${t.field} field is allowed only when kind is ${t.kind}`:"This combination of fields is not allowed",reserved:t=>`${t.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,kindOnly:(t,n)=>`${t.join(" and ")} events are allowed only when kind is ${n}`,hex:(t,n)=>`Use ${t} to ${n} characters of 0-9 and a-f`,duration:t=>`Write a number and a unit (${t.join(" / ")}), such as 12s`,ratio:"Write a fraction (2/3) or a percentage (97%)",url:"Use a path that starts with / or a URL that starts with http:// or https://",anyOf:t=>t.length>0?`Write one of the ${t.join(" or ")} fields`:"Does not match any of the allowed shapes",oneOf:"Match exactly one of the allowed shapes",discriminator:(t,n)=>`${t} is one of ${n.join(" / ")}`,newer:(t,n)=>`Version ${t} diagrams are newer than this tool (version ${n}) and cannot be read. Update the tool`},Ht={ja:Hs,en:zs};function Ks(t){let n=0;for(let a of t)n++;return n}var Nn=hr,On={title:"dragon \u306E\u56F3\u306E\u539F\u672C",description:"\u533A\u753B\u3001\u7BB1\u3001\u7DDA\u3001\u904B\u3076\u7269\u3001\u6BB5\u3001\u4E2D\u8EAB\u306E\u5E2F\u306E 6 \u90E8\u54C1\u3092\u5171\u901A\u306E\u9AA8\u7D44\u307F\u306B\u7F6E\u304D\u3001\u56F3\u306E\u7A2E\u985E\u3060\u3051\u306E\u7269\u306F\u7A2E\u985E\u306E\u6B04\u306B\u7F6E\u304F\u3002\u5EA7\u6A19\u306F\u6301\u305F\u306A\u3044\u3002\u7BB1\u306F\u679D\u5206\u304B\u308C\u306E\u56F3\u3068\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u6301\u305F\u306A\u304F\u3066\u3088\u3044\u3002",type:"object",additionalProperties:!1,required:["version","kind","title","boxes","steps"],properties:{version:{description:"\u5F62\u5F0F\u306E\u7248",type:"integer",minimum:1},kind:{description:"\u56F3\u306E\u7A2E\u985E",enum:["sequence","architecture","state","git","time"]},title:{$ref:"#/definitions/text"},view:{description:"\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059",enum:["fixed","follow"]},regions:{type:"array",items:{$ref:"#/definitions/region"}},boxes:{type:"array",items:{$ref:"#/definitions/box"}},strip:{$ref:"#/definitions/strip"},steps:{type:"array",minItems:1,items:{$ref:"#/definitions/step"}},sequence:{$ref:"#/definitions/sequence"},state:{$ref:"#/definitions/state"},git:{$ref:"#/definitions/git"},time:{$ref:"#/definitions/time"}},if:{required:["kind"],properties:{kind:{const:"sequence"}}},then:{required:["sequence"],properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{properties:{sequence:{$ref:"#/definitions/absent"}},if:{required:["kind"],properties:{kind:{const:"state"}}},then:{properties:{boxes:{minItems:1,items:{properties:{id:{description:"\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u306F\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044",not:{enum:["start","finish"]}}}}},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"git"}}},then:{required:["git"],properties:{steps:{$ref:"#/definitions/gitSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"time"}}},then:{required:["time"],properties:{steps:{$ref:"#/definitions/timeSteps"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"}}},else:{properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}}}}},definitions:{text:{type:"string",minLength:1},absent:{description:"\u3053\u306E\u56F3\u306E\u7A2E\u985E\u3067\u306F\u66F8\u3051\u306A\u3044\u6B04",not:{}},plainSteps:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u3067\u3082\u6642\u9593\u8EF8\u306E\u56F3\u3067\u3082\u306A\u3044\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3068\u3001\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (now \u3068 mark \u3068 span) \u3068\u6B04 (at \u3068 into \u3068 color) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{not:{$ref:"#/definitions/timeEvent"},properties:{type:{not:{enum:["commit","branch"]}},at:{$ref:"#/definitions/absent"},into:{$ref:"#/definitions/absent"},color:{$ref:"#/definitions/absent"}}}}}}},gitSteps:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u306E\u6BB5\u3002\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (now \u3068 mark \u3068 span) \u3068\u6B04 (at \u3068 into \u3068 color) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{not:{$ref:"#/definitions/timeEvent"},properties:{at:{$ref:"#/definitions/absent"},into:{$ref:"#/definitions/absent"},color:{$ref:"#/definitions/absent"}}}}}}},timeSteps:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{properties:{type:{not:{enum:["commit","branch"]}}}}}}}},timeEvent:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u51FA\u6765\u4E8B",required:["type"],properties:{type:{enum:["now","mark","span"]}}},plainStrip:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u3067\u306A\u3044\u56F3\u306E\u4E2D\u8EAB\u306E\u5E2F\u3002\u7269\u5DEE\u3057\u3092\u66F8\u3051\u306A\u3044",properties:{meters:{$ref:"#/definitions/absent"}}},id:{type:"string",pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},color:{enum:["blue","amber","green","violet","rose","slate","coin"]},region:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},note:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"}}},box:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},sub:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"},region:{$ref:"#/definitions/id"},link:{description:"\u98DB\u3073\u5148\u3002\u63CF\u3044\u305F\u56F3\u3067\u306F\u3053\u306E\u7BB1\u304C\u3053\u3053\u3078\u306E link \u306B\u306A\u308B",$ref:"#/definitions/url"}}},strip:{type:"object",additionalProperties:!1,required:["title","fields"],properties:{title:{$ref:"#/definitions/text"},fields:{type:"array",minItems:1,items:{$ref:"#/definitions/text"}},meters:{description:"\u7269\u5DEE\u3057\u306B\u3059\u308B\u6B04\u3002\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B",type:"array",minItems:1,items:{$ref:"#/definitions/meter"}}}},meter:{description:"\u7269\u5DEE\u3057\u306E\u6B04\u3002line \u306E\u5272\u5408\u306E\u6240\u306B\u7DDA\u3092\u5F15\u304D\u3001set \u306E\u5024\u307E\u3067\u91DD\u3068\u4E00\u7DD2\u306B\u6E80\u3061\u308B",type:"object",additionalProperties:!1,required:["field","line"],properties:{field:{$ref:"#/definitions/text"},line:{$ref:"#/definitions/ratio"}}},ratio:{description:"\u5272\u5408\u3002\u5206\u6570 (2/3) \u304B\u767E\u5206\u7387 (97%)",type:"string",pattern:"^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"},step:{type:"object",additionalProperties:!1,required:["title","body","events"],properties:{title:{$ref:"#/definitions/text"},body:{$ref:"#/definitions/text"},code:{$ref:"#/definitions/text"},sources:{description:"\u6BB5\u306E\u51FA\u5178\u3002\u8AAD\u307F\u4E0A\u3052\u306E\u6BB5\u306E\u4E00\u89A7\u306B\u3001\u540D\u524D\u3092 URL \u3078\u306E link \u306B\u3057\u3066\u66F8\u3044\u305F\u9806\u306B\u51FA\u3059",type:"array",minItems:1,items:{$ref:"#/definitions/source"}},events:{type:"array",items:{$ref:"#/definitions/event"}}}},source:{type:"object",additionalProperties:!1,required:["name","url"],properties:{name:{$ref:"#/definitions/text"},url:{$ref:"#/definitions/url"}}},url:{description:"\u9801\u3092\u79FB\u308B\u5F62\u3002/ \u3067\u59CB\u307E\u308B path \u304B\u3001http:// \u304B https:// \u3067\u59CB\u307E\u308B URL",type:"string",pattern:"^(/|https?://)"},event:{description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},oneOf:[{description:"\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B",type:"object",additionalProperties:!1,required:["type","from","to","carry"],properties:{type:{const:"edge"},from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"},carry:{$ref:"#/definitions/carry"},labelSide:{description:"\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)",enum:["above","below","left","right"]},at:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u7DDA\u3092\u5F15\u304F\u5217\u306E\u76EE\u76DB\u308A",$ref:"#/definitions/unit"},into:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u53D7\u3051\u308B\u7BB1\u3092\u9078\u3076\u5217\u306E\u76EE\u76DB\u308A\u3002\u66F8\u304B\u306A\u3051\u308C\u3070 at \u306E\u5217",$ref:"#/definitions/unit"}}},{description:"\u7BB1\u306E\u4E2D\u306E\u51E6\u7406",type:"object",additionalProperties:!1,required:["type","box","label"],properties:{type:{const:"action"},box:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}},{description:"\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048",type:"object",additionalProperties:!1,required:["type","box","text"],properties:{type:{const:"swap"},box:{$ref:"#/definitions/id"},text:{$ref:"#/definitions/text"},color:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7BC0\u76EE\u306E\u4E38\u306E\u8272",$ref:"#/definitions/color"}}},{description:"commit \u3092\u7A4D\u3080\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u7A4D\u3093\u3060\u679D\u306E\u672D\u3068\u3001\u305D\u306E\u679D\u3092\u6307\u3059 HEAD \u304C\u9032\u3080\u3002\u5F53\u3066\u76F4\u3057 (copy) \u306F\u679D\u306E\u672D\u3092\u52D5\u304B\u3055\u305A\u3001merge commit (merge) \u306F\u53D6\u308A\u8FBC\u3080\u679D\u306E\u5148\u7AEF\u3082\u89AA\u306B\u6301\u3064",type:"object",additionalProperties:!1,required:["type","id","branch"],properties:{type:{const:"commit"},id:{$ref:"#/definitions/id"},branch:{$ref:"#/definitions/id"},copy:{$ref:"#/definitions/id"},merge:{$ref:"#/definitions/id"},hash:{$ref:"#/definitions/hash"},note:{$ref:"#/definitions/text"}}},{description:"\u679D\u3092\u5207\u308B\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u679D\u306E\u672D\u3092 from \u306E commit \u3078\u7F6E\u304D\u3001HEAD \u3092\u305D\u306E\u679D\u3078\u79FB\u3059",type:"object",additionalProperties:!1,required:["type","branch","from"],properties:{type:{const:"branch"},branch:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/id"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u4ECA\u306E\u6642\u523B\u306E\u91DD\u3092\u3001to \u306E\u76EE\u76DB\u308A\u306E\u7D42\u308F\u308A\u307E\u3067\u9032\u3081\u308B",type:"object",additionalProperties:!1,required:["type","to"],properties:{type:{const:"now"},to:{$ref:"#/definitions/unit"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u5370\u306E\u5217 row \u306E\u3001from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u8272\u3092\u5909\u3048\u308B",type:"object",additionalProperties:!1,required:["type","row","from","to","color"],properties:{type:{const:"mark"},row:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},color:{$ref:"#/definitions/color"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306B\u3001\u62EC\u5F27\u3068\u5B57\u3092\u51FA\u3059\u3002shape \u304C box \u306A\u3089\u5370\u306E\u5217\u3092\u56F2\u307F\u3001\u5B57\u3092\u7E01\u306E\u672D\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["type","from","to","text"],properties:{type:{const:"span"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},text:{$ref:"#/definitions/text"},shape:{enum:["box"]},color:{$ref:"#/definitions/color"}}},{description:"\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D",type:"object",additionalProperties:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]},carry:{description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}},sequence:{description:"\u6642\u7CFB\u5217\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u751F\u5B58\u7DDA\u3092\u5DE6\u304B\u3089\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["lifelines"],properties:{lifelines:{type:"array",minItems:1,items:{$ref:"#/definitions/id"}}}},state:{description:"\u72B6\u614B\u9077\u79FB\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u6700\u521D\u306E\u6BB5\u3088\u308A\u524D\u306B\u66F8\u3044\u305F\u3001\u79FB\u308C\u308B\u304C\u6BB5\u3067\u901A\u308B\u3068\u306F\u9650\u3089\u306A\u3044\u7DDA",type:"object",additionalProperties:!1,required:["paths"],properties:{paths:{type:"array",minItems:1,items:{$ref:"#/definitions/path"}}}},git:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u679D\u3092\u4E0A\u304B\u3089\u5E2F\u306B\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["branches"],properties:{branches:{type:"array",minItems:1,items:{$ref:"#/definitions/branch"}}}},branch:{description:"\u679D\u3002\u5E2F\u306E\u5DE6\u306B\u540D\u672D\u3068\u6DFB\u3048\u66F8\u304D\u3092\u7F6E\u304F",type:"object",additionalProperties:!1,required:["id"],properties:{id:{$ref:"#/definitions/id"},note:{$ref:"#/definitions/text"}}},hash:{description:"commit \u306E hash\u300216 \u9032\u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57",type:"string",pattern:"^[0-9a-f]{4,40}$"},time:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u76EE\u76DB\u308A\u3001\u533A\u5207\u308A\u3001\u5370\u306E\u5217\u3001\u7BC0\u76EE\u3001\u62E1\u5927\u306E\u7BC4\u56F2",type:"object",additionalProperties:!1,required:["scale","rows"],properties:{scale:{$ref:"#/definitions/scale"},period:{$ref:"#/definitions/period"},rows:{type:"array",minItems:1,items:{$ref:"#/definitions/row"}},points:{type:"array",items:{$ref:"#/definitions/point"}},zoom:{$ref:"#/definitions/zoom"}}},scale:{description:"\u76EE\u76DB\u308A\u3002unit \u306E\u540D\u524D\u306E\u76EE\u76DB\u308A\u3092 length \u306E\u9577\u3055\u3067 count \u500B\u4E26\u3079\u3001\u6700\u521D\u306E\u76EE\u76DB\u308A\u306E\u756A\u53F7\u3092 from \u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["unit","length","count"],properties:{unit:{$ref:"#/definitions/text"},length:{$ref:"#/definitions/duration"},count:{type:"integer",minimum:1},from:{type:"integer",minimum:0}}},duration:{description:"\u9577\u3055\u3002\u6570\u3068\u5358\u4F4D (ms\u3001s\u3001min\u3001h\u3001d) \u306E\u7D44",type:"string",pattern:"^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"},unit:{description:"\u76EE\u76DB\u308A\u306E\u4F4D\u7F6E\u30020 \u304B\u3089\u6570\u3048\u308B",type:"integer",minimum:0},period:{description:"\u533A\u5207\u308A\u3002\u76EE\u76DB\u308A length \u500B\u3054\u3068\u306B name \u306E\u533A\u5207\u308A\u3092\u7F6E\u304D\u3001\u6700\u521D\u306E\u533A\u5207\u308A\u306E\u756A\u53F7\u3092 from \u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["name","length"],properties:{name:{$ref:"#/definitions/text"},length:{type:"integer",minimum:1},from:{type:"integer",minimum:0}}},row:{description:"\u5370\u306E\u5217\u3002\u76EE\u76DB\u308A\u3054\u3068\u306B\u5370\u3092 1 \u3064\u7F6E\u304D\u3001empty \u306E\u76EE\u76DB\u308A\u306F\u7A7A\u304D\u306E\u5370\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},empty:{type:"array",items:{$ref:"#/definitions/unit"}}}},point:{description:"\u7BC0\u76EE\u3002at \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u4E0B\u306B\u65D7\u306E\u4E38\u3068\u540D\u672D\u3092\u7F6E\u304F",type:"object",additionalProperties:!1,required:["id","at"],properties:{id:{$ref:"#/definitions/id"},at:{$ref:"#/definitions/unit"}}},zoom:{description:"\u62E1\u5927\u306E\u7BC4\u56F2\u3002from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u3054\u3068\u306B\u62E1\u5927\u306E\u5E2F\u306B\u5217\u3092\u4F5C\u308B",type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"}}},path:{description:"\u79FB\u308C\u308B\u9053\u3002\u9001\u308B\u5074\u306B\u59CB\u307E\u308A\u306E\u5370 start\u3001\u53D7\u3051\u308B\u5074\u306B\u7D42\u308F\u308A\u306E\u5370 finish \u3092\u66F8\u3051\u308B\u3002\u3069\u306E\u6BB5\u306B\u3082\u51FA\u306A\u3044\u9053\u306F\u70B9\u7DDA\u3067\u63CF\u304D\u3001\u904B\u3076\u7269\u3092\u8D70\u3089\u305B\u306A\u3044",type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}}}};function et(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(Array.isArray(t)){let o=t.length;for(let p=0;p<o;p++){let f=t[p];if(f&&typeof f=="object"&&!Array.isArray(f)&&f.events!==void 0){let b=f.events;if(Array.isArray(b)){let m=b.length;for(let d=0;d<m;d++){let $=b[d],S=r,u=r;if($&&typeof $=="object"&&!Array.isArray($)){let h;if($.type===void 0&&(h="type")){let P={};e===null?e=[P]:e.push(P),r++}else if($.type!==void 0){let P=$.type;if(!(P==="now"||P==="mark"||P==="span")){let I={};e===null?e=[I]:e.push(I),r++}}}var s=u===r;if(s){let h={instancePath:n+"/"+p+"/events/"+d,schemaPath:"#/items/properties/events/items/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}else r=S,e!==null&&(S?e.length=S:e=null);if($&&typeof $=="object"&&!Array.isArray($)){if($.type!==void 0){let h=$.type,P=r,I=r;if(!(h==="commit"||h==="branch")){let G={};e===null?e=[G]:e.push(G),r++}var i=I===r;if(i){let G={instancePath:n+"/"+p+"/events/"+d+"/type",schemaPath:"#/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[G]:e.push(G),r++}else r=P,e!==null&&(P?e.length=P:e=null)}if($.at!==void 0){let h={instancePath:n+"/"+p+"/events/"+d+"/at",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}if($.into!==void 0){let h={instancePath:n+"/"+p+"/events/"+d+"/into",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}if($.color!==void 0){let h={instancePath:n+"/"+p+"/events/"+d+"/color",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}}}}}}}return et.errors=e,r===0}function Ve(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.meters!==void 0){let s={instancePath:n+"/meters",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[s]:e.push(s),r++}return Ve.errors=e,r===0}function zt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(Array.isArray(t)){let i=t.length;for(let o=0;o<i;o++){let p=t[o];if(p&&typeof p=="object"&&!Array.isArray(p)&&p.events!==void 0){let f=p.events;if(Array.isArray(f)){let b=f.length;for(let m=0;m<b;m++){let d=f[m],$=r,S=r;if(d&&typeof d=="object"&&!Array.isArray(d)){let u;if(d.type===void 0&&(u="type")){let h={};e===null?e=[h]:e.push(h),r++}else if(d.type!==void 0){let h=d.type;if(!(h==="now"||h==="mark"||h==="span")){let P={};e===null?e=[P]:e.push(P),r++}}}var s=S===r;if(s){let u={instancePath:n+"/"+o+"/events/"+m,schemaPath:"#/items/properties/events/items/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}else r=$,e!==null&&($?e.length=$:e=null);if(d&&typeof d=="object"&&!Array.isArray(d)){if(d.at!==void 0){let u={instancePath:n+"/"+o+"/events/"+m+"/at",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}if(d.into!==void 0){let u={instancePath:n+"/"+o+"/events/"+m+"/into",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}if(d.color!==void 0){let u={instancePath:n+"/"+o+"/events/"+m+"/color",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}}}}}}}return zt.errors=e,r===0}var Tt={enum:["blue","amber","green","violet","rose","slate","coin"]},Re=new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$","u"),Me=Ks;function Kt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="name"||s==="note"||s==="color"||s==="icon")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.note!==void 0){let s=t.note;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.color!==void 0){let s=t.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let i={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[i]:e.push(i),r++}}if(t.icon!==void 0){let s=t.icon;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Kt.errors=e,r===0}var ur=new RegExp("^(/|https?://)","u");function Xt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="name"||s==="sub"||s==="color"||s==="icon"||s==="region"||s==="link")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.sub!==void 0){let s=t.sub;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/sub",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/sub",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.color!==void 0){let s=t.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let i={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[i]:e.push(i),r++}}if(t.icon!==void 0){let s=t.icon;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.region!==void 0){let s=t.region;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/region",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/region",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.link!==void 0){let s=t.link;if(typeof s=="string"){if(!ur.test(s)){let i={instancePath:n+"/link",schemaPath:"#/definitions/url/pattern",keyword:"pattern",params:{pattern:"^(/|https?://)"},message:'must match pattern "^(/|https?://)"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/link",schemaPath:"#/definitions/url/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Xt.errors=e,r===0}var Xs=new RegExp("^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$","u");function Ut(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.field===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};e===null?e=[s]:e.push(s),r++}if(t.line===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"line"},message:"must have required property 'line'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="field"||s==="line")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.field!==void 0){let s=t.field;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.line!==void 0){let s=t.line;if(typeof s=="string"){if(!Xs.test(s)){let i={instancePath:n+"/line",schemaPath:"#/definitions/ratio/pattern",keyword:"pattern",params:{pattern:"^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"},message:'must match pattern "^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/line",schemaPath:"#/definitions/ratio/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Ut.errors=e,r===0}function Jt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.title===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[s]:e.push(s),r++}if(t.fields===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"fields"},message:"must have required property 'fields'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="title"||s==="fields"||s==="meters")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.title!==void 0){let s=t.title;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.fields!==void 0){let s=t.fields;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/fields",schemaPath:"#/properties/fields/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++){let p=s[o];if(typeof p=="string"){if(Me(p)<1){let f={instancePath:n+"/fields/"+o,schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[f]:e.push(f),r++}}else{let f={instancePath:n+"/fields/"+o,schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[f]:e.push(f),r++}}}else{let i={instancePath:n+"/fields",schemaPath:"#/properties/fields/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}if(t.meters!==void 0){let s=t.meters;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/meters",schemaPath:"#/properties/meters/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)Ut(s[o],{instancePath:n+"/meters/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?Ut.errors:e.concat(Ut.errors),r=e.length)}else{let i={instancePath:n+"/meters",schemaPath:"#/properties/meters/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Jt.errors=e,r===0}function Zt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}if(t.url===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"url"},message:"must have required property 'url'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="name"||s==="url")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.url!==void 0){let s=t.url;if(typeof s=="string"){if(!ur.test(s)){let i={instancePath:n+"/url",schemaPath:"#/definitions/url/pattern",keyword:"pattern",params:{pattern:"^(/|https?://)"},message:'must match pattern "^(/|https?://)"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/url",schemaPath:"#/definitions/url/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Zt.errors=e,r===0}var fr={description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},oneOf:[{description:"\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B",type:"object",additionalProperties:!1,required:["type","from","to","carry"],properties:{type:{const:"edge"},from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"},carry:{$ref:"#/definitions/carry"},labelSide:{description:"\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)",enum:["above","below","left","right"]},at:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u7DDA\u3092\u5F15\u304F\u5217\u306E\u76EE\u76DB\u308A",$ref:"#/definitions/unit"},into:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u53D7\u3051\u308B\u7BB1\u3092\u9078\u3076\u5217\u306E\u76EE\u76DB\u308A\u3002\u66F8\u304B\u306A\u3051\u308C\u3070 at \u306E\u5217",$ref:"#/definitions/unit"}}},{description:"\u7BB1\u306E\u4E2D\u306E\u51E6\u7406",type:"object",additionalProperties:!1,required:["type","box","label"],properties:{type:{const:"action"},box:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}},{description:"\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048",type:"object",additionalProperties:!1,required:["type","box","text"],properties:{type:{const:"swap"},box:{$ref:"#/definitions/id"},text:{$ref:"#/definitions/text"},color:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7BC0\u76EE\u306E\u4E38\u306E\u8272",$ref:"#/definitions/color"}}},{description:"commit \u3092\u7A4D\u3080\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u7A4D\u3093\u3060\u679D\u306E\u672D\u3068\u3001\u305D\u306E\u679D\u3092\u6307\u3059 HEAD \u304C\u9032\u3080\u3002\u5F53\u3066\u76F4\u3057 (copy) \u306F\u679D\u306E\u672D\u3092\u52D5\u304B\u3055\u305A\u3001merge commit (merge) \u306F\u53D6\u308A\u8FBC\u3080\u679D\u306E\u5148\u7AEF\u3082\u89AA\u306B\u6301\u3064",type:"object",additionalProperties:!1,required:["type","id","branch"],properties:{type:{const:"commit"},id:{$ref:"#/definitions/id"},branch:{$ref:"#/definitions/id"},copy:{$ref:"#/definitions/id"},merge:{$ref:"#/definitions/id"},hash:{$ref:"#/definitions/hash"},note:{$ref:"#/definitions/text"}}},{description:"\u679D\u3092\u5207\u308B\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u679D\u306E\u672D\u3092 from \u306E commit \u3078\u7F6E\u304D\u3001HEAD \u3092\u305D\u306E\u679D\u3078\u79FB\u3059",type:"object",additionalProperties:!1,required:["type","branch","from"],properties:{type:{const:"branch"},branch:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/id"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u4ECA\u306E\u6642\u523B\u306E\u91DD\u3092\u3001to \u306E\u76EE\u76DB\u308A\u306E\u7D42\u308F\u308A\u307E\u3067\u9032\u3081\u308B",type:"object",additionalProperties:!1,required:["type","to"],properties:{type:{const:"now"},to:{$ref:"#/definitions/unit"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u5370\u306E\u5217 row \u306E\u3001from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u8272\u3092\u5909\u3048\u308B",type:"object",additionalProperties:!1,required:["type","row","from","to","color"],properties:{type:{const:"mark"},row:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},color:{$ref:"#/definitions/color"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306B\u3001\u62EC\u5F27\u3068\u5B57\u3092\u51FA\u3059\u3002shape \u304C box \u306A\u3089\u5370\u306E\u5217\u3092\u56F2\u307F\u3001\u5B57\u3092\u7E01\u306E\u672D\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["type","from","to","text"],properties:{type:{const:"span"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},text:{$ref:"#/definitions/text"},shape:{enum:["box"]},color:{$ref:"#/definitions/color"}}},{description:"\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D",type:"object",additionalProperties:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]};var Us=new RegExp("^[0-9a-f]{4,40}$","u"),Js={description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}};function Qt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0,s=r,i=!0,o=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let m;if(t.kind===void 0&&(m="kind")){let d={};e===null?e=[d]:e.push(d),r++}else if(t.kind!==void 0&&t.kind!=="tag"){let d={};e===null?e=[d]:e.push(d),r++}}var p=o===r;r=s,e!==null&&(s?e.length=s:e=null);let f;if(p){let m=r;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.text===void 0){let $={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[$]:e.push($),r++}var p=m===r;i=p,f="then"}else{let m=r,d=r,$=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let u;if(t.text===void 0&&(u="text")){let h={};e===null?e=[h]:e.push(h),r++}}var b=$===r;if(b){let u={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}else r=d,e!==null&&(d?e.length=d:e=null);var p=m===r;i=p,f="else"}if(!i){let m={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:f},message:'must match "'+f+'" schema'};e===null?e=[m]:e.push(m),r++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kind===void 0){let m={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};e===null?e=[m]:e.push(m),r++}for(let m in t)if(!(m==="kind"||m==="text")){let d={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties"};e===null?e=[d]:e.push(d),r++}if(t.kind!==void 0){let m=t.kind;if(!(m==="envelope"||m==="tag"||m==="coin"||m==="none")){let d={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Js.properties.kind.enum},message:"must be equal to one of the allowed values"};e===null?e=[d]:e.push(d),r++}}if(t.text!==void 0){let m=t.text;if(typeof m=="string"){if(Me(m)<1){let d={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[d]:e.push(d),r++}}else{let d={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[d]:e.push(d),r++}}}else{let m={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[m]:e.push(m),r++}return Qt.errors=e,r===0}function en(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}let i=t.type;if(typeof i=="string")if(i==="edge")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}if(t.carry===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"carry"},message:"must have required property 'carry'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="from"||o==="to"||o==="label"||o==="carry"||o==="labelSide"||o==="at"||o==="into")){let p={instancePath:n,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="edge"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue:"edge"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.from!==void 0){let o=t.from;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.to!==void 0){let o=t.to;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.label!==void 0){let o=t.label;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.carry!==void 0&&(Qt(t.carry,{instancePath:n+"/carry",parentData:t,parentDataProperty:"carry",rootData:l})||(e=e===null?Qt.errors:e.concat(Qt.errors),r=e.length)),t.labelSide!==void 0){let o=t.labelSide;if(!(o==="above"||o==="below"||o==="left"||o==="right")){let p={instancePath:n+"/labelSide",schemaPath:"#/oneOf/0/properties/labelSide/enum",keyword:"enum",params:{allowedValues:fr.oneOf[0].properties.labelSide.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}if(t.at!==void 0){let o=t.at;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/at",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/at",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.into!==void 0){let o=t.into;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/into",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/into",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="action")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.box===void 0){let o={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};e===null?e=[o]:e.push(o),r++}if(t.label===void 0){let o={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"label"},message:"must have required property 'label'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="box"||o==="label")){let p={instancePath:n,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="action"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue:"action"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.box!==void 0){let o=t.box;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.label!==void 0){let o=t.label;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="swap")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.box===void 0){let o={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};e===null?e=[o]:e.push(o),r++}if(t.text===void 0){let o={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="box"||o==="text"||o==="color")){let p={instancePath:n,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="swap"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue:"swap"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.box!==void 0){let o=t.box;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.text!==void 0){let o=t.text;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.color!==void 0){let o=t.color;if(!(o==="blue"||o==="amber"||o==="green"||o==="violet"||o==="rose"||o==="slate"||o==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/2/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="commit")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.id===void 0){let o={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[o]:e.push(o),r++}if(t.branch===void 0){let o={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="id"||o==="branch"||o==="copy"||o==="merge"||o==="hash"||o==="note")){let p={instancePath:n,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="commit"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue:"commit"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.id!==void 0){let o=t.id;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.branch!==void 0){let o=t.branch;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.copy!==void 0){let o=t.copy;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.merge!==void 0){let o=t.merge;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.hash!==void 0){let o=t.hash;if(typeof o=="string"){if(!Us.test(o)){let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/pattern",keyword:"pattern",params:{pattern:"^[0-9a-f]{4,40}$"},message:'must match pattern "^[0-9a-f]{4,40}$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.note!==void 0){let o=t.note;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="branch")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.branch===void 0){let o={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="branch"||o==="from")){let p={instancePath:n,schemaPath:"#/oneOf/4/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="branch"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/4/properties/type/const",keyword:"const",params:{allowedValue:"branch"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.branch!==void 0){let o=t.branch;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.from!==void 0){let o=t.from;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/4/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="now")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="to")){let p={instancePath:n,schemaPath:"#/oneOf/5/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="now"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/5/properties/type/const",keyword:"const",params:{allowedValue:"now"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.to!==void 0){let o=t.to;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/5/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="mark")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.row===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"row"},message:"must have required property 'row'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}if(t.color===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"color"},message:"must have required property 'color'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="row"||o==="from"||o==="to"||o==="color")){let p={instancePath:n,schemaPath:"#/oneOf/6/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="mark"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/6/properties/type/const",keyword:"const",params:{allowedValue:"mark"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.row!==void 0){let o=t.row;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/row",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/row",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.from!==void 0){let o=t.from;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.to!==void 0){let o=t.to;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.color!==void 0){let o=t.color;if(!(o==="blue"||o==="amber"||o==="green"||o==="violet"||o==="rose"||o==="slate"||o==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/6/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="span")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}if(t.text===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="from"||o==="to"||o==="text"||o==="shape"||o==="color")){let p={instancePath:n,schemaPath:"#/oneOf/7/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="span"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/7/properties/type/const",keyword:"const",params:{allowedValue:"span"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.from!==void 0){let o=t.from;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.to!==void 0){let o=t.to;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.text!==void 0){let o=t.text;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.shape!==void 0&&t.shape!=="box"){let o={instancePath:n+"/shape",schemaPath:"#/oneOf/7/properties/shape/enum",keyword:"enum",params:{allowedValues:fr.oneOf[7].properties.shape.enum},message:"must be equal to one of the allowed values"};e===null?e=[o]:e.push(o),r++}if(t.color!==void 0){let o=t.color;if(!(o==="blue"||o==="amber"||o==="green"||o==="violet"||o==="rose"||o==="slate"||o==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/7/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="strip"){let o=r,p=!1,f=r;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.value===void 0){let b={instancePath:n,schemaPath:"#/oneOf/8/anyOf/0/required",keyword:"required",params:{missingProperty:"value"},message:"must have required property 'value'"};e===null?e=[b]:e.push(b),r++}var s=f===r;if(p=p||s,!p){let b=r;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.tag===void 0){let d={instancePath:n,schemaPath:"#/oneOf/8/anyOf/1/required",keyword:"required",params:{missingProperty:"tag"},message:"must have required property 'tag'"};e===null?e=[d]:e.push(d),r++}var s=b===r;p=p||s}if(p)r=o,e!==null&&(o?e.length=o:e=null);else{let b={instancePath:n,schemaPath:"#/oneOf/8/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};e===null?e=[b]:e.push(b),r++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let b={instancePath:n,schemaPath:"#/oneOf/8/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[b]:e.push(b),r++}if(t.field===void 0){let b={instancePath:n,schemaPath:"#/oneOf/8/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};e===null?e=[b]:e.push(b),r++}for(let b in t)if(!(b==="type"||b==="field"||b==="value"||b==="tag")){let m={instancePath:n,schemaPath:"#/oneOf/8/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:b},message:"must NOT have additional properties"};e===null?e=[m]:e.push(m),r++}if(t.type!==void 0&&t.type!=="strip"){let b={instancePath:n+"/type",schemaPath:"#/oneOf/8/properties/type/const",keyword:"const",params:{allowedValue:"strip"},message:"must be equal to constant"};e===null?e=[b]:e.push(b),r++}if(t.field!==void 0){let b=t.field;if(typeof b=="string"){if(Me(b)<1){let m={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[m]:e.push(m),r++}}else{let m={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),r++}}if(t.value!==void 0){let b=t.value;if(typeof b=="string"){if(Me(b)<1){let m={instancePath:n+"/value",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[m]:e.push(m),r++}}else{let m={instancePath:n+"/value",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),r++}}if(t.tag!==void 0){let b=t.tag;if(typeof b=="string"){if(Me(b)<1){let m={instancePath:n+"/tag",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[m]:e.push(m),r++}}else{let m={instancePath:n+"/tag",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),r++}}}else{let b={instancePath:n,schemaPath:"#/oneOf/8/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[b]:e.push(b),r++}}else{let o={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"mapping",tag:"type",tagValue:i},message:'value of tag "type" must be in oneOf'};e===null?e=[o]:e.push(o),r++}else{let o={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"tag",tag:"type",tagValue:i},message:'tag "type" must be string'};e===null?e=[o]:e.push(o),r++}}else{let i={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),r++}return en.errors=e,r===0}function tn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.title===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[s]:e.push(s),r++}if(t.body===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"body"},message:"must have required property 'body'"};e===null?e=[s]:e.push(s),r++}if(t.events===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"events"},message:"must have required property 'events'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="title"||s==="body"||s==="code"||s==="sources"||s==="events")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.title!==void 0){let s=t.title;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.body!==void 0){let s=t.body;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/body",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/body",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.code!==void 0){let s=t.code;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/code",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/code",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.sources!==void 0){let s=t.sources;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/sources",schemaPath:"#/properties/sources/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)Zt(s[o],{instancePath:n+"/sources/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?Zt.errors:e.concat(Zt.errors),r=e.length)}else{let i={instancePath:n+"/sources",schemaPath:"#/properties/sources/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}if(t.events!==void 0){let s=t.events;if(Array.isArray(s)){let i=s.length;for(let o=0;o<i;o++)en(s[o],{instancePath:n+"/events/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?en.errors:e.concat(en.errors),r=e.length)}else{let i={instancePath:n+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return tn.errors=e,r===0}function nn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.lifelines===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"lifelines"},message:"must have required property 'lifelines'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(s!=="lifelines"){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.lifelines!==void 0){let s=t.lifelines;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++){let p=s[o];if(typeof p=="string"){if(!Re.test(p)){let f={instancePath:n+"/lifelines/"+o,schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[f]:e.push(f),r++}}else{let f={instancePath:n+"/lifelines/"+o,schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[f]:e.push(f),r++}}}else{let i={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return nn.errors=e,r===0}function rn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.from===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[s]:e.push(s),r++}if(t.to===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="from"||s==="to"||s==="label")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.from!==void 0){let s=t.from;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.to!==void 0){let s=t.to;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.label!==void 0){let s=t.label;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return rn.errors=e,r===0}function sn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.paths===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"paths"},message:"must have required property 'paths'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(s!=="paths"){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.paths!==void 0){let s=t.paths;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/paths",schemaPath:"#/properties/paths/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)rn(s[o],{instancePath:n+"/paths/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?rn.errors:e.concat(rn.errors),r=e.length)}else{let i={instancePath:n+"/paths",schemaPath:"#/properties/paths/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return sn.errors=e,r===0}function on(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="note")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.note!==void 0){let s=t.note;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return on.errors=e,r===0}function an(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.branches===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"branches"},message:"must have required property 'branches'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(s!=="branches"){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.branches!==void 0){let s=t.branches;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/branches",schemaPath:"#/properties/branches/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)on(s[o],{instancePath:n+"/branches/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?on.errors:e.concat(on.errors),r=e.length)}else{let i={instancePath:n+"/branches",schemaPath:"#/properties/branches/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return an.errors=e,r===0}var Zs=new RegExp("^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$","u");function ln(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.unit===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"unit"},message:"must have required property 'unit'"};e===null?e=[s]:e.push(s),r++}if(t.length===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"length"},message:"must have required property 'length'"};e===null?e=[s]:e.push(s),r++}if(t.count===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"count"},message:"must have required property 'count'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="unit"||s==="length"||s==="count"||s==="from")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.unit!==void 0){let s=t.unit;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/unit",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/unit",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.length!==void 0){let s=t.length;if(typeof s=="string"){if(!Zs.test(s)){let i={instancePath:n+"/length",schemaPath:"#/definitions/duration/pattern",keyword:"pattern",params:{pattern:"^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"},message:'must match pattern "^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/length",schemaPath:"#/definitions/duration/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.count!==void 0){let s=t.count;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/count",schemaPath:"#/properties/count/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<1||isNaN(s))){let i={instancePath:n+"/count",schemaPath:"#/properties/count/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[i]:e.push(i),r++}}if(t.from!==void 0){let s=t.from;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return ln.errors=e,r===0}function cn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}if(t.length===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"length"},message:"must have required property 'length'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="name"||s==="length"||s==="from")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.length!==void 0){let s=t.length;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/length",schemaPath:"#/properties/length/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<1||isNaN(s))){let i={instancePath:n+"/length",schemaPath:"#/properties/length/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[i]:e.push(i),r++}}if(t.from!==void 0){let s=t.from;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return cn.errors=e,r===0}function pn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="name"||s==="color"||s==="empty")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.color!==void 0){let s=t.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let i={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[i]:e.push(i),r++}}if(t.empty!==void 0){let s=t.empty;if(Array.isArray(s)){let i=s.length;for(let o=0;o<i;o++){let p=s[o];if(!(typeof p=="number"&&!(p%1)&&!isNaN(p)&&isFinite(p))){let f={instancePath:n+"/empty/"+o,schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[f]:e.push(f),r++}if(typeof p=="number"&&isFinite(p)&&(p<0||isNaN(p))){let f={instancePath:n+"/empty/"+o,schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[f]:e.push(f),r++}}}else{let i={instancePath:n+"/empty",schemaPath:"#/properties/empty/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return pn.errors=e,r===0}function mn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.at===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="at")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.at!==void 0){let s=t.at;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/at",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/at",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return mn.errors=e,r===0}function dn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.from===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[s]:e.push(s),r++}if(t.to===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="from"||s==="to")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.from!==void 0){let s=t.from;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}if(t.to!==void 0){let s=t.to;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return dn.errors=e,r===0}function fn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.scale===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scale"},message:"must have required property 'scale'"};e===null?e=[s]:e.push(s),r++}if(t.rows===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"rows"},message:"must have required property 'rows'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="scale"||s==="period"||s==="rows"||s==="points"||s==="zoom")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.scale!==void 0&&(ln(t.scale,{instancePath:n+"/scale",parentData:t,parentDataProperty:"scale",rootData:l})||(e=e===null?ln.errors:e.concat(ln.errors),r=e.length)),t.period!==void 0&&(cn(t.period,{instancePath:n+"/period",parentData:t,parentDataProperty:"period",rootData:l})||(e=e===null?cn.errors:e.concat(cn.errors),r=e.length)),t.rows!==void 0){let s=t.rows;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/rows",schemaPath:"#/properties/rows/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)pn(s[o],{instancePath:n+"/rows/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?pn.errors:e.concat(pn.errors),r=e.length)}else{let i={instancePath:n+"/rows",schemaPath:"#/properties/rows/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}if(t.points!==void 0){let s=t.points;if(Array.isArray(s)){let i=s.length;for(let o=0;o<i;o++)mn(s[o],{instancePath:n+"/points/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?mn.errors:e.concat(mn.errors),r=e.length)}else{let i={instancePath:n+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}t.zoom!==void 0&&(dn(t.zoom,{instancePath:n+"/zoom",parentData:t,parentDataProperty:"zoom",rootData:l})||(e=e===null?dn.errors:e.concat(dn.errors),r=e.length))}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return fn.errors=e,r===0}var Qs=Object.prototype.hasOwnProperty;function hr(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0,s=r,i=!0,o=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let u;if(t.kind===void 0&&(u="kind")){let h={};e===null?e=[h]:e.push(h),r++}else if(t.kind!==void 0&&t.kind!=="sequence"){let h={};e===null?e=[h]:e.push(h),r++}}var p=o===r;r=s,e!==null&&(s?e.length=s:e=null);let f;if(p){let u=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.sequence===void 0){let P={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"sequence"},message:"must have required property 'sequence'"};e===null?e=[P]:e.push(P),r++}if(t.boxes!==void 0){let P=t.boxes;if(Array.isArray(P)&&P.length<1){let I={instancePath:n+"/boxes",schemaPath:"#/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[I]:e.push(I),r++}}if(t.steps!==void 0&&(et(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?et.errors:e.concat(et.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.state!==void 0){let P={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),r++}if(t.git!==void 0){let P={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),r++}if(t.time!==void 0){let P={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),r++}}var p=u===r;i=p,f="then"}else{let u=r,h=r,P=!0,I=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let U;if(t.kind===void 0&&(U="kind")){let j={};e===null?e=[j]:e.push(j),r++}else if(t.kind!==void 0&&t.kind!=="state"){let j={};e===null?e=[j]:e.push(j),r++}}var b=I===r;r=h,e!==null&&(h?e.length=h:e=null);let G;if(b){let U=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.boxes!==void 0){let A=t.boxes;if(Array.isArray(A)){if(A.length<1){let K={instancePath:n+"/boxes",schemaPath:"#/else/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[K]:e.push(K),r++}let C=A.length;for(let K=0;K<C;K++){let X=A[K];if(X&&typeof X=="object"&&!Array.isArray(X)&&X.id!==void 0){let Q=X.id,ie=r,re=r;if(!(Q==="start"||Q==="finish")){let D={};e===null?e=[D]:e.push(D),r++}var m=re===r;if(m){let D={instancePath:n+"/boxes/"+K+"/id",schemaPath:"#/else/then/properties/boxes/items/properties/id/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[D]:e.push(D),r++}else r=ie,e!==null&&(ie?e.length=ie:e=null)}}}}if(t.steps!==void 0&&(et(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?et.errors:e.concat(et.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.git!==void 0){let A={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[A]:e.push(A),r++}if(t.time!==void 0){let A={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[A]:e.push(A),r++}}var b=U===r;P=b,G="then"}else{let U=r,j=r,A=!0,C=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let Q;if(t.kind===void 0&&(Q="kind")){let ie={};e===null?e=[ie]:e.push(ie),r++}else if(t.kind!==void 0&&t.kind!=="git"){let ie={};e===null?e=[ie]:e.push(ie),r++}}var d=C===r;r=j,e!==null&&(j?e.length=j:e=null);let K;if(d){let Q=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.git===void 0){let re={instancePath:n,schemaPath:"#/else/else/then/required",keyword:"required",params:{missingProperty:"git"},message:"must have required property 'git'"};e===null?e=[re]:e.push(re),r++}if(t.steps!==void 0&&(zt(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?zt.errors:e.concat(zt.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.state!==void 0){let re={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[re]:e.push(re),r++}if(t.regions!==void 0){let re={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[re]:e.push(re),r++}if(t.time!==void 0){let re={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[re]:e.push(re),r++}}var d=Q===r;A=d,K="then"}else{let Q=r,ie=r,re=!0,D=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let E;if(t.kind===void 0&&(E="kind")){let v={};e===null?e=[v]:e.push(v),r++}else if(t.kind!==void 0&&t.kind!=="time"){let v={};e===null?e=[v]:e.push(v),r++}}var $=D===r;r=ie,e!==null&&(ie?e.length=ie:e=null);let x;if($){let E=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.time===void 0){let q={instancePath:n,schemaPath:"#/else/else/else/then/required",keyword:"required",params:{missingProperty:"time"},message:"must have required property 'time'"};e===null?e=[q]:e.push(q),r++}if(t.steps!==void 0){let q=t.steps;if(Array.isArray(q)){let z=q.length;for(let ee=0;ee<z;ee++){let de=q[ee];if(de&&typeof de=="object"&&!Array.isArray(de)&&de.events!==void 0){let ce=de.events;if(Array.isArray(ce)){let pe=ce.length;for(let ve=0;ve<pe;ve++){let we=ce[ve];if(we&&typeof we=="object"&&!Array.isArray(we)&&we.type!==void 0){let ye=we.type,Pe=r,k=r;if(!(ye==="commit"||ye==="branch")){let V={};e===null?e=[V]:e.push(V),r++}var S=k===r;if(S){let V={instancePath:n+"/steps/"+ee+"/events/"+ve+"/type",schemaPath:"#/definitions/timeSteps/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[V]:e.push(V),r++}else r=Pe,e!==null&&(Pe?e.length=Pe:e=null)}}}}}}}if(t.state!==void 0){let q={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.git!==void 0){let q={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.regions!==void 0){let q={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}}var $=E===r;re=$,x="then"}else{let E=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.boxes!==void 0){let q=t.boxes;if(Array.isArray(q)&&q.length<1){let z={instancePath:n+"/boxes",schemaPath:"#/else/else/else/else/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[z]:e.push(z),r++}}if(t.steps!==void 0&&(et(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?et.errors:e.concat(et.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.state!==void 0){let q={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.git!==void 0){let q={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.time!==void 0){let q={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}}var $=E===r;re=$,x="else"}if(!re){let E={instancePath:n,schemaPath:"#/else/else/else/if",keyword:"if",params:{failingKeyword:x},message:'must match "'+x+'" schema'};e===null?e=[E]:e.push(E),r++}var d=Q===r;A=d,K="else"}if(!A){let Q={instancePath:n,schemaPath:"#/else/else/if",keyword:"if",params:{failingKeyword:K},message:'must match "'+K+'" schema'};e===null?e=[Q]:e.push(Q),r++}var b=U===r;P=b,G="else"}if(!P){let U={instancePath:n,schemaPath:"#/else/if",keyword:"if",params:{failingKeyword:G},message:'must match "'+G+'" schema'};e===null?e=[U]:e.push(U),r++}if(t&&typeof t=="object"&&!Array.isArray(t)&&t.sequence!==void 0){let U={instancePath:n+"/sequence",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[U]:e.push(U),r++}var p=u===r;i=p,f="else"}if(!i){let u={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:f},message:'must match "'+f+'" schema'};e===null?e=[u]:e.push(u),r++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.version===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"version"},message:"must have required property 'version'"};e===null?e=[u]:e.push(u),r++}if(t.kind===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};e===null?e=[u]:e.push(u),r++}if(t.title===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[u]:e.push(u),r++}if(t.boxes===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"boxes"},message:"must have required property 'boxes'"};e===null?e=[u]:e.push(u),r++}if(t.steps===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"steps"},message:"must have required property 'steps'"};e===null?e=[u]:e.push(u),r++}for(let u in t)if(!Qs.call(On.properties,u)){let h={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"};e===null?e=[h]:e.push(h),r++}if(t.version!==void 0){let u=t.version;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u)&&isFinite(u))){let h={instancePath:n+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[h]:e.push(h),r++}if(typeof u=="number"&&isFinite(u)&&(u<1||isNaN(u))){let h={instancePath:n+"/version",schemaPath:"#/properties/version/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[h]:e.push(h),r++}}if(t.kind!==void 0){let u=t.kind;if(!(u==="sequence"||u==="architecture"||u==="state"||u==="git"||u==="time")){let h={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:On.properties.kind.enum},message:"must be equal to one of the allowed values"};e===null?e=[h]:e.push(h),r++}}if(t.title!==void 0){let u=t.title;if(typeof u=="string"){if(Me(u)<1){let h={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[h]:e.push(h),r++}}else{let h={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[h]:e.push(h),r++}}if(t.view!==void 0){let u=t.view;if(!(u==="fixed"||u==="follow")){let h={instancePath:n+"/view",schemaPath:"#/properties/view/enum",keyword:"enum",params:{allowedValues:On.properties.view.enum},message:"must be equal to one of the allowed values"};e===null?e=[h]:e.push(h),r++}}if(t.regions!==void 0){let u=t.regions;if(Array.isArray(u)){let h=u.length;for(let P=0;P<h;P++)Kt(u[P],{instancePath:n+"/regions/"+P,parentData:u,parentDataProperty:P,rootData:l})||(e=e===null?Kt.errors:e.concat(Kt.errors),r=e.length)}else{let h={instancePath:n+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),r++}}if(t.boxes!==void 0){let u=t.boxes;if(Array.isArray(u)){let h=u.length;for(let P=0;P<h;P++)Xt(u[P],{instancePath:n+"/boxes/"+P,parentData:u,parentDataProperty:P,rootData:l})||(e=e===null?Xt.errors:e.concat(Xt.errors),r=e.length)}else{let h={instancePath:n+"/boxes",schemaPath:"#/properties/boxes/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),r++}}if(t.strip!==void 0&&(Jt(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Jt.errors:e.concat(Jt.errors),r=e.length)),t.steps!==void 0){let u=t.steps;if(Array.isArray(u)){if(u.length<1){let P={instancePath:n+"/steps",schemaPath:"#/properties/steps/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[P]:e.push(P),r++}let h=u.length;for(let P=0;P<h;P++)tn(u[P],{instancePath:n+"/steps/"+P,parentData:u,parentDataProperty:P,rootData:l})||(e=e===null?tn.errors:e.concat(tn.errors),r=e.length)}else{let h={instancePath:n+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),r++}}t.sequence!==void 0&&(nn(t.sequence,{instancePath:n+"/sequence",parentData:t,parentDataProperty:"sequence",rootData:l})||(e=e===null?nn.errors:e.concat(nn.errors),r=e.length)),t.state!==void 0&&(sn(t.state,{instancePath:n+"/state",parentData:t,parentDataProperty:"state",rootData:l})||(e=e===null?sn.errors:e.concat(sn.errors),r=e.length)),t.git!==void 0&&(an(t.git,{instancePath:n+"/git",parentData:t,parentDataProperty:"git",rootData:l})||(e=e===null?an.errors:e.concat(an.errors),r=e.length)),t.time!==void 0&&(fn(t.time,{instancePath:n+"/time",parentData:t,parentDataProperty:"time",rootData:l})||(e=e===null?fn.errors:e.concat(fn.errors),r=e.length))}else{let u={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[u]:e.push(u),r++}return hr.errors=e,r===0}var ei=["edge","action","swap","strip","commit","branch","now","mark","span"],ti="#/definitions/absent/not",ni={regions:"sequence / architecture / state",at:"time",into:"time",color:"time",meters:"time"},ri={carry:{field:"text",kind:"tag"}},si=/\/boxes\/items\/properties\/id\/not$/u,ii=/\/events\/items\/properties\/type\/not$/u,oi=["commit","branch"],ai=/\/events\/items\/not$/u,li=["now","mark","span"],ci=/^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u,pi=/%\)\$$/u,En=t=>t.replaceAll("~","~0").replaceAll("/","~1"),mi="#/definitions/url/pattern",di=/^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;function fi(t){let n=/^\^\[\^(.+)\]\+\$$/u.exec(t)?.[1];if(n===void 0)return;let a=n.match(/\\.|[^\\]/gu)??[];return{space:a.includes("\\s"),chars:a.filter(c=>c!=="\\s").map(c=>c.replace(/^\\/u,""))}}var gr=(t,n)=>n.filter(a=>a!==t&&a.schemaPath.startsWith(`${t.schemaPath}/`)&&(a.instancePath===t.instancePath||a.instancePath.startsWith(`${t.instancePath}/`)));function ui(t,n,a){let c=t.params,l=t.instancePath;switch(t.keyword){case"additionalProperties":{let e=String(c.additionalProperty);return{pointer:`${l}/${En(e)}`,message:a.additionalProperties(e)}}case"required":{let e=String(c.missingProperty);return{pointer:`${l}/${En(e)}`,message:a.required(e)}}case"not":{if(si.test(t.schemaPath))return{pointer:l,message:a.reserved(Mt)};if(ii.test(t.schemaPath))return{pointer:l,message:a.kindOnly(oi,"git")};if(ai.test(t.schemaPath))return{pointer:`${l}/type`,message:a.kindOnly(li,"time")};let e=l.slice(l.lastIndexOf("/")+1);if(t.schemaPath===ti)return{pointer:l,message:a.not({field:e,kind:ni[e]??e})};let r=ri[e];return{pointer:r?`${l}/${r.field}`:l,message:a.not(r)}}case"anyOf":{let e=gr(t,n),r=e.every(s=>s.keyword==="required")?e.map(s=>String(s.params.missingProperty)):[];return{pointer:l,message:a.anyOf(r)}}case"discriminator":{let e=String(c.tag);return{pointer:`${l}/${En(e)}`,message:a.discriminator(e,ei)}}case"enum":return{pointer:l,message:a.enum(c.allowedValues.map(String))};case"type":return{pointer:l,message:a.type(String(c.type))};case"minLength":return{pointer:l,message:a.minLength(Number(c.limit))};case"pattern":{if(t.schemaPath===mi)return{pointer:l,message:a.url};let e=String(c.pattern),r=di.exec(e);if(r)return{pointer:l,message:a.hex(Number(r[1]),Number(r[2]))};let s=ci.exec(e);return s?{pointer:l,message:a.duration((s[1]??"").split("|"))}:pi.test(e)?{pointer:l,message:a.ratio}:{pointer:l,message:a.pattern(fi(e))}}case"minItems":return{pointer:l,message:a.minItems(Number(c.limit))};case"minimum":return{pointer:l,message:a.minimum(Number(c.limit))};case"const":return{pointer:l,message:a.const(String(c.allowedValue))};case"oneOf":return{pointer:l,message:a.oneOf};default:return{pointer:l,message:t.message??t.keyword}}}function yr(t,n={}){if(Nn(t))return{ok:!0};let a=Nn.errors??[],c=new Set(a.filter(r=>r.keyword==="anyOf").flatMap(r=>gr(r,a))),l=Ht[n.lang??"ja"];return{ok:!1,errors:a.filter(r=>r.keyword!=="if"&&!c.has(r)).map(r=>ui(r,a,l))}}var br=1;function hi(t){if(typeof t!="object"||t===null)return;let n=t.version;return typeof n=="number"&&n>br?n:void 0}var gi=(t,n)=>({pointer:"/version",message:Ht[n].newer(t,br)});function xr(t,n={}){let a=hi(t);if(a!==void 0)return{ok:!1,errors:[gi(a,n.lang??"ja")]};let c=yr(t,n);return c.ok?{ok:!0,diagram:t,warnings:[]}:c}function wr(t,n){let a={edges:[],events:[],busy:0},c=oe.edgeAt,l,e=0,r=Number.NEGATIVE_INFINITY,s=(b,m,d)=>{let $=m.carry.kind!=="none",S=d+($?oe.drawCarry:oe.draw);return a.edges.push({event:b,a:d,b:S,carries:$,coin:m.carry.kind==="coin",named:m.label!==void 0}),a.busy=Math.max(a.busy,S),S},i=n?t.events.flatMap((b,m)=>b.type==="now"?[{e:m,to:b.to}]:[]):[],o=n?.from??0,p=Math.max(o,...i.map(b=>b.to+1)),f=b=>b.type==="edge"&&b.at!==void 0&&b.at>=o&&b.at<p;return t.events.forEach((b,m)=>{if(n&&m===i[0]?.e){let d=Math.max(c,r+oe.change),$=[[d,o]],S=[];for(let u=o;u<p;u++){let h=d,P=t.events.flatMap((ne,U)=>f(ne)&&ne.at===u?[{k:U,ev:ne}]:[]),I=P.reduce((ne,U,j)=>Math.max(ne,s(U.k,U.ev,h+oe.stagger*j)),h),G=Math.max(h+n.speed,P.length>0?I+oe.time.wait:h);G-n.speed>h+1e-9&&$.push([G-n.speed,u]),$.push([G,u+1]),S.push({unit:u,at:G}),d=G}a.sweep={keys:$,passed:S},a.busy=Math.max(a.busy,d),c=d+oe.time.after,l=d,e=0;return}if(!(b.type==="now"||n&&f(b)))if(b.type==="commit"||b.type==="branch"){let d=c,$=d+oe.draw;a.edges.push({event:m,a:d,b:$,carries:!1,coin:!1,named:!1}),c=d+oe.stagger,l=$,e=0,a.busy=Math.max(a.busy,$)}else if(b.type==="edge"){let d=c;l=s(m,b,d),c=d+oe.stagger,e=0}else if(b.type==="action")a.events.push({event:m,at:c}),a.busy=Math.max(a.busy,c+oe.action),c+=oe.action,e=0;else{let d=(l??c)+oe.change*e++;a.events.push({event:m,at:d}),a.busy=Math.max(a.busy,d),r=Math.max(r,d)}}),a.edges.sort((b,m)=>b.a-m.a),a}function $r(t,n=!1){let a=t.kind==="time"?t.time:void 0,c=oe.time,l=a?Math.min(c.unitMax,Math.max(c.unitMin,c.axis/Math.max(1,a.scale.count))):0,e=0,r=t.steps.map(A=>{if(!a)return wr(A);let C=wr(A,{from:e,speed:l});return e=C.sweep?.keys[C.sweep.keys.length-1]?.[1]??e,C}),s=[],i=oe.intro;t.steps.forEach((A,C)=>{let K=Math.min(oe.stepMax,Math.max(oe.stepMin,oe.stepBase+[...A.body].length*oe.perChar)),X=Math.max(K,(r[C]?.busy??0)+oe.dwell);s.push({start:i,end:i+X}),i+=X});let p=Math.ceil(i+oe.outro),f=p-oe.tail,b=s[s.length-1],m=n&&b?{start:b.start+(r[r.length-1]?.busy??0),end:f}:void 0,d=m?.start??f,$=[],S=[],u=[],h=[];r.forEach((A,C)=>{let K=s[C],X=[];for(let Q of A.edges){let ie=K.start+Q.a;$.push({step:C,event:Q.event,start:ie,drawn:K.start+Q.b,end:K.end});let re=t.steps[C]?.events[Q.event],D=t.kind==="git"&&re?.type==="edge"&&re.carry.kind==="tag"&&re.carry.text===re.from;Q.carries&&!D&&h.push({step:C,event:Q.event,who:Q.coin?"coin":"main",a:ie,b:K.start+Q.b}),Q.named&&X.push({step:C,event:Q.event,start:ie+oe.labelDelay,end:K.end})}X.forEach((Q,ie)=>{let re=X[ie+2];re&&(Q.end=Math.min(Q.end,re.start))});for(let Q of X)m&&Q.end>m.start?Q.end=m.end:(t.kind==="state"&&Q.end<d&&(Q.after={start:Q.end,end:d}),m&&(Q.again=m));S.push(...X);for(let Q of A.events)u.push({step:C,event:Q.event,at:K.start+Q.at})});let P=s[0]?.start??0,I=h.some(A=>A.who==="main"),G=[];for(let A of["main","coin"]){let C=h.filter(K=>K.who===A);C.forEach((K,X)=>{let Q=C[X+1],ie=X===0&&(A==="main"||!I);G.push({step:K.step,event:K.event,who:A,depart:K.a,arrive:K.b,start:ie?Math.min(P,K.a):K.a,end:Q?Math.max(Q.a,K.b):f})})}G.sort((A,C)=>A.depart-C.depart);let ne=t.kind==="state"?xi(t,$,f):void 0,U=[[0,0]],j=[];return r.forEach((A,C)=>{let K=s[C].start;for(let[X,Q]of A.sweep?.keys??[])U.push([K+X,Q]);for(let X of A.sweep?.passed??[])j.push({unit:X.unit,passed:K+X.at})}),U.push([p,e]),{total:p,last:f,steps:s,edges:$,carriers:G,labels:S,badges:s.map((A,C)=>({step:C,appears:A.start})),events:u,stills:s.map(A=>A.end-oe.still),...m?{whole:m}:{},...ne?{states:ne}:{},...a?{needle:U,units:j,meters:yi(t,r,s)}:{}}}function yi(t,n,a){let c=t.time?.period?.length;return(t.strip?.meters??[]).map(({field:l})=>{let e=[[0,0]],r=0;return n.forEach((s,i)=>{let o=a[i].start,p=(t.steps[i]?.events??[]).flatMap(($,S)=>{let u=$.type==="strip"&&$.field===l&&$.value!==void 0?Mn($.value):void 0;return u===void 0?[]:[{e:S,ratio:u}]}),f=p[p.length-1];if(!f)return;let b=s.sweep?.keys??[],m=b[0],d=b[b.length-1];if(m&&d&&d[1]>m[1]){let[$,S]=[m[1],d[1]],u=r,h=$,P=c?Math.floor((S-1e-9)/c)*c:0;if(P>0&&P>=$){let I=o+(b.find(([,ne])=>ne===P)?.[0]??m[0]),G=e[e.length-1][0];e.push([Math.max(G,I-oe.time.reset),r],[I,0]),u=0,h=P}for(let[I,G]of b)G>=h&&e.push([o+I,u+(f.ratio-u)*(G-h)/(S-h)])}else{let $=o+(s.events.find(S=>S.event===f.e)?.at??0);e.push([$,r],[$+oe.fade,f.ratio])}r=f.ratio}),{field:l,keys:e}})}var bi=t=>Mt.includes(t);function xi(t,n,a){let c=new Map,l=r=>{let s=c.get(r)??{box:r,lit:[]};return c.set(r,s),s},e;for(let r of n){let s=t.steps[r.step]?.events[r.event];if(!(s?.type!=="edge"||s.from===s.to)){if(e){let i=l(e.box);i.lit.push({start:e.since,end:r.start}),e.box===s.from&&i.done===void 0&&(i.done=r.start+oe.done),e=void 0}bi(s.to)||(e={box:s.to,since:r.drawn})}}return e&&l(e.box).lit.push({start:e.since,end:a}),[...c.values()]}var Lt={app:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2 h22",router:"M -9 -4 h16 M 3 -8 l4 4 l-4 4 M 9 5 h-16 M -3 1 l-4 4 l4 4",on:"M -7 7 L 7 -7 M -1 -7 h8 v8",off:"M -7 -7 L 7 7 M 7 -1 v8 h-8",pool:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",db:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",exe:"M -5 -8 L 7 0 L -5 8 Z",idx:"M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",sign:"M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",env:"M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",lock:"M -5.5 -1 h11 v8 h-11 z M -3.5 -1 v-3 a3.5 3.5 0 0 1 7 0 v3",check:"M -5 0 l3.5 3.5 l6.5 -7",flag:"M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",x:"M -5 -5 l10 10 M 5 -5 l-10 10",chain:"M -1.5 4.5 l-2 2 a3.5 3.5 0 0 1 -5 -5 l3 -3 a3.5 3.5 0 0 1 5 0 M 1.5 -4.5 l2 -2 a3.5 3.5 0 0 1 5 5 l-3 3 a3.5 3.5 0 0 1 -5 0 M -2.5 2.5 l5 -5",net:"M -1.3 -4.6 L -5.8 3 M 1.3 -4.6 L 5.8 3 M -4.3 5.5 H 4.3 M -2.2 -7 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M -9.2 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M 4.8 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0",user:"M -4 -4.5 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0 M -8 9 c0 -5 3.6 -7.5 8 -7.5 s8 2.5 8 7.5",server:"M -9 -8 h18 v7 h-18 z M -9 1 h18 v7 h-18 z M -5 -4.5 h0.01 M -5 4.5 h0.01",key:"M -9 0 a3.5 3.5 0 1 0 7 0 a3.5 3.5 0 1 0 -7 0 M -2 0 h10 M 5 0 v3.5 M 8 0 v2.5",shield:"M 0 -9 l8 3 v5 c0 5 -3.5 8 -8 10 c-4.5 -2 -8 -5 -8 -10 v-5 z",globe:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M -9 0 h18 M 0 -9 c-4.5 4 -4.5 14 0 18 M 0 -9 c4.5 4 4.5 14 0 18",bolt:"M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",doc:"M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",box:"M -9 -4.5 l9 -4.5 l9 4.5 v9 l-9 4.5 l-9 -4.5 z M -9 -4.5 l9 4.5 l9 -4.5 M 0 0 v9",truck:"M -10 -6 h11 v10 h-11 z M 1 -2 h5 l3.5 3.5 v2.5 h-8.5 M -7.5 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0 M 3 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0",card:"M -9 -6.5 h18 a2 2 0 0 1 2 2 v9 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-9 a2 2 0 0 1 2 -2 z M -11 -2 h22 M -7 3 h5",cart:"M -10 -8 h3 l3 11 h11 l2.5 -8 h-15.5 M -4.5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M 5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",clock:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M 0 -5 v5 l3.5 2.5",branch:"M -4 -4.5 v9 M 5 0.5 c0 4 -9 3 -9 6.5 M -6.2 -7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M -6.2 7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M 2.8 -2 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0",cloud:"M -7 6 h13 a4.5 4.5 0 0 0 0.5 -9 a6 6 0 0 0 -11.5 -1 a4.5 4.5 0 0 0 -2 10 z",refresh:"M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",undo:"M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",yen:"M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",layers:"M 0 -8 l9 4.5 l-9 4.5 l-9 -4.5 z M -9 2.5 l9 4.5 l9 -4.5",code:"M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",paint:"M -8 8 c 0 -3 2 -5 4.5 -5 l 9 -9 l 3.5 3.5 l -9 9 c 0 2.5 -2 4.5 -5 4.5 z",block:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"};var We=[[0,Number.POSITIVE_INFINITY]],qn=.5,kr=(t,n)=>t.shown.some(([a,c])=>a<=n&&n<c),Ln=t=>({text:t.text,rect:{x:t.rect.x,y:t.rect.y,w:t.rect.w,h:t.rect.h},badge:t.badge===!0,...t.part?{part:t.part}:{}});function vr(t,n,a=[]){let c=[];return n.forEach((l,e)=>{let r=t.filter(i=>kr(i,l));r.forEach((i,o)=>{for(let p of r.slice(o+1)){let f=Math.min(i.rect.x+i.rect.w,p.rect.x+p.rect.w)-Math.max(i.rect.x,p.rect.x),b=Math.min(i.rect.y+i.rect.h,p.rect.y+p.rect.h)-Math.max(i.rect.y,p.rect.y);f>qn&&b>qn&&c.push({kind:"texts",step:e,texts:[i.text,p.text],spots:[Ln(i),Ln(p)]})}});let s=a.filter(i=>kr(i,l));for(let i of r)if(!i.boxed)for(let o of s)It(o.points,i.rect,qn)&&c.push({kind:"line",step:e,text:i.text,line:{from:o.from,to:o.to},spots:[Ln(i)]})}),c}var Te=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),un=(t,n)=>t===void 0?n:`<a href="${Te(t)}">${n}</a>`,W=t=>Math.round(t*100)/100,ke=t=>t==="coin"?"--c:var(--coin);--ct:var(--coint)":`--c:var(--c-${t});--ct:var(--t-${t})`;function ft(t,n,a,c,l="dg-gl"){let e=t===void 0?void 0:Lt[t];return e?`<path class="${l}" transform="translate(${W(n)} ${W(a)}) scale(${c})" d="${e}"/>`:""}function ut(t){let n=t.filter((e,r)=>r===0||e[0]!==t[r-1][0]||e[1]!==t[r-1][1]),[a,c]=n[0],l=`M ${W(a)} ${W(c)}`;for(let e=1;e<n.length-1;e++){let[r,s]=n[e-1],[i,o]=n[e],[p,f]=n[e+1],b=Math.hypot(i-r,o-s),m=Math.hypot(p-i,f-o),d=Math.min(w.edge.bend,b/2,m/2);l+=` L ${W(i-(i-r)/b*d)} ${W(o-(o-s)/b*d)} Q ${W(i)} ${W(o)} ${W(i+(p-i)/m*d)} ${W(o+(f-o)/m*d)}`}if(n.length>1){let[e,r]=n[n.length-1];l+=` L ${W(e)} ${W(r)}`}return l}function hn(t){let[n,a]=t[t.length-1],[c,l]=t[t.length-2],e=Math.hypot(n-c,a-l)||1,r=(n-c)/e,s=(a-l)/e,{arrow:i,arrowHalf:o}=w.edge;return`M ${W(n-r*i-s*o)} ${W(a-s*i+r*o)} L ${W(n)} ${W(a)} L ${W(n-r*i+s*o)} ${W(a-s*i-r*o)}`}function Oe(t,n,a,c,l,e,r=We,s){return t?.push({text:l,rect:_e(l,a,c,e,s),shown:r}),`<text class="${n}" x="${W(a)}" y="${W(c)}"${s?` text-anchor="${s}"`:""}>${Te(l)}</text>`}function Pr(t,n){let a=[[0,{opacity:0}]];for(let[c,l]of n)a.push([c,{opacity:0},be.out],[c+oe.fade,{opacity:1}],[l-.1,{opacity:1},be.inOut],[l+.25,{opacity:0}]);return a.push([t.total,{opacity:0}]),t.kf(a)}function Sr(t,n){let a=[];for(let c=0;c<n.length;){let l=c;for(;l+1<n.length&&n[l+1]===n[l]+1;)l++;a.push([t.t.steps[n[c]].start,t.t.steps[n[l]].end]),c=l+1}return Pr(t.m,a)}function Mr(t,n){let{radius:a,icon:c,iconRadius:l,iconScale:e,nameY:r,line:s}=w.region,{x:i,y:o}=t.header,p=t.lines.map((m,d)=>Oe(n,"dg-bz",i,t.y+r+d*s,m,O.regionName)).join(""),f=t.note?Oe(n,"dg-bx",i,t.y+r+t.lines.length*s+1,t.note,O.regionNote):"",b=t.icon&&Lt[t.icon]?`<rect class="dg-bi" x="${W(i)}" y="${W(o)}" width="${c}" height="${c}" rx="${l}"/>${ft(t.icon,i+c/2,o+c/2,e)}`:"";return`<g style="${ke(t.color)}"><rect class="dg-band" x="${W(t.x+.5)}" y="${W(t.y+.5)}" width="${W(t.w-1)}" height="${W(t.h-1)}" rx="${a}"/>${b}${p}${f}</g>`}function Tr(t,n,a,c,l){let e=[[0,t.sub??"","dg-ss"],...a];return e.map(([r,s,i],o)=>{let p=e[o+1]?.[0],f=o===0?p===void 0?"":n.until(p-oe.untilFade):p===void 0?n.rise(r):n.rise(r,p-oe.untilFade);if(s==="")return"";let b=[[o===0?0:r,p===void 0?Number.POSITIVE_INFINITY:p-oe.untilFade]];return`<g${f?` class="dg-a" style="${f}"`:""}>${Oe(l,i,t.cx,c,s,i==="dg-ss"?O.boxSub:O.boxSubStrong,b,"middle")}</g>`}).join("")}function Or(t,n,a,c,l){let e=(r,s="")=>`<rect class="${r}" x="${W(t.x)}" y="${W(c)}" width="${W(t.w)}" height="${l}" rx="${w.box.radius}"${s}/>`;return`${a?`<g class="dg-a" style="${a}">${e("dg-halo")}</g>`:""}${e("dg-st",` ${n.sh}`)}${a?`<g class="dg-a" style="${a}">${e("dg-on")}</g>`:""}`}function gn(t,n,a,c,l){let{icon:e,iconRadius:r,iconScale:s,iconY:i,nameY:o,subY:p}=w.box,f=Tr(t,n.m,c,t.cy+p,n.ink),b=l?l.length>0?Pr(n.m,l.map(S=>[S.start,S.end])):void 0:a.length>0?Sr(n,a):void 0,m=t.iconX??t.cx,d=t.slot?`<rect class="dg-slot" x="${W(t.slot.x)}" y="${W(t.slot.y)}" width="${W(t.slot.w)}" height="${W(t.slot.h)}" rx="${w.slot.radius}"/>`:"",$="";if(t.icon&&Lt[t.icon]){let S={x:m-e/2,y:t.cy+i-e/2,w:e,h:e};n.ink.push({text:`${t.name} \u306E\u7D75\u67C4`,rect:S,shown:We,boxed:!0,part:{kind:"icon",box:t.name}}),$=`<rect class="dg-ic" x="${W(S.x)}" y="${W(S.y)}" width="${e}" height="${e}" rx="${r}"/>${ft(t.icon,m,t.cy+i,s)}`}return`<g style="${ke(t.color)}">${Or(t,n,b,t.y,t.h)}${d}${$}${Oe(n.ink,"dg-sn",t.cx,t.cy+o,t.name,O.boxName,We,"middle")}${f}</g>`}function Nr(t,n,a,c){let{pad:l,h:e,nameY:r,subY:s}=w.follow.head,i=Tr(t,n.m,c,l+s),o=a.length>0?Sr(n,a):void 0;return`<g style="${ke(t.color)}">${Or(t,n,o,l,e)}<text class="dg-sn" x="${W(t.cx)}" y="${W(l+r)}" text-anchor="middle">${Te(t.name)}</text>${i}</g>`}function Er(t,n){let{icon:a,iconRadius:c,iconScale:l,radius:e}=w.box,r=w.state.ghost,s=t.x+r.pad+a/2,i=t.x+r.pad+a+r.gap,o=t.icon&&Lt[t.icon]?`<rect class="dg-ic" x="${W(s-a/2)}" y="${W(t.cy-a/2)}" width="${a}" height="${a}" rx="${c}"/>${ft(t.icon,s,t.cy,l)}`:"",p=t.sub?r.nameY:w.baseline.mark,f=t.sub?Oe(n,"dg-ss",i,t.cy+r.subY,t.sub,O.boxSub,We,"start"):"";return`<g data-ghost="${Te(t.id)}" style="${ke(t.color)}"><rect class="dg-ghost" x="${W(t.x)}" y="${W(t.y)}" width="${W(t.w)}" height="${t.h}" rx="${e}"/>${o}${Oe(n,"dg-sn",i,t.cy+p,t.name,O.boxName,We,"start")}${f}</g>`}function qr(t,n,a){let{r:c,inset:l}=w.state.done,e=t.x+t.w-l,r=t.y+l;return`<g class="dg-popc dg-a" data-done="${Te(t.id)}" style="${ke(t.color)};${a.m.pop(n)}"><circle class="dg-done" cx="${W(e)}" cy="${W(r)}" r="${c}"/>${ft("check",e,r,.5,"dg-done-ck")}</g>`}function Lr(t,n,a,c){c.push({from:t.from,to:t.to,points:t.points,shown:We});let l=t.label?.family==="sans",e=t.label?Oe(a,`dg-path-t${l?" dg-path-tj":""}`,t.label.x+w.label.padX,t.label.y+t.label.h/2+w.baseline.label,t.label.text,l?O.labelJa:O.label):"";return`<g data-path="${Te(`${t.from}->${t.to}`)}" style="${ke(n)}"><path class="dg-path" d="${ut(t.points)}"/><path class="dg-path-h" d="${hn(t.points)}"/>${e}</g>`}function Rr(t,n,a){let{pad:c}=w.state.side,l=t.y+c+O.regionName.size,e=t.notes.map((r,s)=>Oe(a,"dg-side-n",t.x+c,l+w.region.line*(s+1),r,O.regionNote)).join("");return`<g style="${ke(n)}"><rect class="dg-side" x="${W(t.x+.5)}" y="${W(t.y+.5)}" width="${W(t.w-1)}" height="${W(t.h-1)}" rx="${w.region.radius}"/>${Oe(a,"dg-side-t",t.x+c,l,t.title,O.regionName)}${e}</g>`}function Ar(t,n,a){let{end:c}=w.state,l=_t(t),e=t.text===""?"":Oe(a,"dg-mark",l[0],l[1],t.text,O.regionNote),r=W(t.x),s=W(t.y);return t.kind==="start"?`<g data-end="start"><circle class="dg-start" cx="${r}" cy="${s}" r="${t.r}"/>${e}</g>`:t.ghost?`<g data-end="finish" style="${ke(n)}"><circle class="dg-end-x" cx="${r}" cy="${s}" r="${t.r}"/><circle class="dg-end-xi" cx="${r}" cy="${s}" r="${c.inner}"/>${e}</g>`:`<g data-end="finish"><circle class="dg-end" cx="${r}" cy="${s}" r="${t.r}"/><circle class="dg-end-in" cx="${r}" cy="${s}" r="${c.inner}"/>${e}</g>`}function jr(t,n,a){return`<line class="dg-ll" x1="${W(t)}" y1="${W(n)}" x2="${W(t)}" y2="${W(a)}"/>`}function Dr(t,n,a,c=!1){let{m:l}=a;a.traces.push({from:t.from,to:t.to,points:t.points,shown:We});let e=ut(t.points),r=hn(t.points),{start:s,drawn:i,end:o}=n,p=c?[[o,{opacity:1},be.inOut],[o+.4,{opacity:0}],[l.total,{opacity:0}]]:[[o,{opacity:1},be.inOut],[o+.4,{opacity:.45}],[a.end+.3,{opacity:.45},be.inOut],[a.end+1,{opacity:.95}],[l.last,{opacity:.95},be.inOut],[l.total,{opacity:0}]],f=l.kf([[0,{opacity:0,"stroke-dashoffset":1}],[s,{opacity:0,"stroke-dashoffset":1},be.inOut],[s+.05,{opacity:1}],[i,{"stroke-dashoffset":0}],[l.last,{"stroke-dashoffset":0}],[l.total,{"stroke-dashoffset":1}],...p]),b=l.kf([[0,{opacity:0}],[i-.05,{opacity:0}],[i,{opacity:1}],...p]),m=-(o-i)*26,d=l.kf([[0,{opacity:0,"stroke-dashoffset":0}],[i,{opacity:0,"stroke-dashoffset":0}],[i+.25,{opacity:.9}],[o-.1,{opacity:.9},be.inOut],[o+.2,{opacity:0,"stroke-dashoffset":m}],[l.total,{opacity:0,"stroke-dashoffset":m}]]),$=c?l.kf([[0,{opacity:0}],[o,{opacity:0},be.inOut],[o+.4,{opacity:1}],[l.last,{opacity:1},be.inOut],[l.total,{opacity:0}]]):"";return{base:`<path class="dg-e" d="${e}"/><path class="dg-eh" d="${r}"/>${c?`<path class="dg-e-past dg-a" d="${e}" style="${$}"/><path class="dg-eh-past dg-a" d="${r}" style="${$}"/>`:""}`,lit:`<g style="${ke(t.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${e}" style="${f}"/><path class="dg-eh-on dg-a" d="${r}" style="${b}"/><path class="dg-flow dg-a" d="${e}" style="${d}"/></g>`}}function Cr(t,n,a){let c=t.family==="sans"?" dg-capj":"",{radius:l}=w.label,e=n.again?[[n.start,n.end],[n.again.start,n.again.end]]:[[n.start,n.end]];a.ink.push({text:t.text,rect:t,shown:e,boxed:!0}),n.after&&a.ink.push({text:t.text,rect:_e(t.text,t.x+t.w/2,t.y+t.h/2+w.baseline.label,t.family==="sans"?O.labelJa:O.label,"middle"),shown:[[n.after.start,n.after.end]]});let r=W(t.x+t.w/2),s=W(t.y+t.h/2+w.baseline.label),i=n.after?`<g class="dg-cap-past${t.family==="sans"?" dg-cap-pastj":""} dg-a" style="${a.m.vis(n.after.start,n.after.end)}"><text x="${r}" y="${s}" text-anchor="middle">${Te(t.text)}</text></g>`:"",o=e.map(([p,f])=>`<g class="dg-cap${c} dg-a" style="${ke(t.color)};${a.m.rise(p,f,!0)}"><rect x="${W(t.x)}" y="${W(t.y)}" width="${W(t.w)}" height="${t.h}" rx="${l}"/><text x="${r}" y="${s}" text-anchor="middle">${Te(t.text)}</text></g>`);return`${i}${o.join("")}`}function Rn(t,n,a,c,l){let e=l?[[n,a],[l.start,l.end]]:[[n,a]];return c.ink.push({text:t.text,rect:t,shown:e,boxed:!0}),e.map(([r,s])=>`<g class="dg-act dg-a" style="${ke(t.color)};${c.m.rise(r,s,!0)}"><rect x="${W(t.x)}" y="${W(t.y)}" width="${W(t.w)}" height="${t.h}" rx="${w.action.radius}"/><text x="${W(t.x+t.w/2)}" y="${W(t.y+t.h/2+w.baseline.action)}" text-anchor="middle">${Te(t.text)}</text></g>`).join("")}function wi(t,n){let a=w.carrier;if(t.carry.kind==="coin")return`<circle class="dg-coin" r="${a.coinR}"/><circle class="dg-coin-in" r="${a.coinIn}"/>`;if(t.carry.kind==="tag"){let c=t.carry.text,l=De(c),e=le(c,l?O.carrierJa:O.carrier)+a.tagPadX*2;return`<rect class="dg-car" x="${W(-e/2)}" y="${-a.tagH/2}" width="${W(e)}" height="${a.tagH}" rx="${a.tagH/2}" ${n}/><text class="dg-car-t${l?" dg-car-tj":""}" y="${w.baseline.carrier}" text-anchor="middle">${Te(c)}</text>`}return`<rect class="dg-env" x="${-a.envW/2}" y="${-a.envH/2}" width="${a.envW}" height="${a.envH}" rx="3" ${n}/><path class="dg-env-in" d="M -8 -4.5 L 0 1.5 L 8 -4.5"/>`}var $i=t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2;function yn(t,n,a){let{m:c}=a,l=w.carrier.samples,e=t.wait?[t.wait,...t.points]:t.points,r=vt(e),{depart:s,arrive:i,start:o,end:p}=n,f=[];for(let ne=0;ne<=l;ne++){let[U,j]=st(e,$i(ne/l)*r);f.push([s+(i-s)*ne/l,U,j])}let b=f[0],m=f[f.length-1],d=t.settle??[m[1],m[2]],$=[[0,b[1],b[2]],...f];t.settle&&$.push([Math.min(i+.3,Math.max(p,i+.01)),d[0],d[1]]),$.push([p,d[0],d[1]],[c.total,d[0],d[1]]);let[S,u]=mt(t.carry),h=t.carry.kind==="tag"?t.carry.text:t.carry.kind==="coin"?"\u786C\u8CA8":"\u5C01\u7B52",P=t.carry.kind==="tag"?{}:{part:{kind:t.carry.kind==="coin"?"coin":"envelope"}},I=ne=>({x:ne[0]-S,y:ne[1]-u,w:S*2,h:u*2});s>o&&a.ink.push({text:h,rect:I([b[1],b[2]]),shown:[[o,s]],boxed:!0,...P}),a.ink.push({text:h,rect:I(d),shown:[[i,p]],boxed:!0,...P});let G=p<c.last?.05:.18;return`<g class="dg-a" style="${c.move($,c.blink(o+.02,p,G))}">${wi(t,a.sh)}</g>`}function Ir(t,n,a=!1){let{m:c}=n,l=n.t.steps[t.step],e=l.start,r=l.end,{r:s,ring:i}=w.badge,o={visibility:"visible"},p={visibility:"hidden"},f=t.until===void 0?void 0:n.t.steps[t.until].start,b=f!==void 0&&f<=r+1e-6,m=c.kf([[0,{opacity:0,transform:"scale(.5)",...p}],[e,{opacity:0,transform:"scale(.5)",...p},be.pop],[e+.35,{opacity:1,transform:"scale(1)",...o}],[r,{opacity:1,transform:"scale(1)",...o},be.inOut],[r+(b?oe.untilFade:.4),{opacity:0,transform:"scale(1)",...p}],[c.total,{opacity:0,transform:"scale(.5)",...p}]]),d=f??c.last,$=b?c.kf([[0,{opacity:0,...p}],[c.total,{opacity:0,...p}]]):c.kf([[0,{opacity:0,...p}],[r,{opacity:0,...p},be.inOut],[r+.4,{opacity:1,...o}],[d,{opacity:1,...o},be.inOut],...f===void 0?[]:[[f+oe.untilFade,{opacity:0,...p}]],[c.total,{opacity:0,...p}]]),S=c.kf([[0,{opacity:0,transform:"scale(1)"}],[e+.05,{opacity:0,transform:"scale(1)"}],[e+.1,{opacity:.7,transform:"scale(1)"},be.out],[e+.9,{opacity:0,transform:"scale(2.3)"}],[c.total,{opacity:0,transform:"scale(1)"}]]),u=W(t.x),h=W(t.y),P=W(t.y+w.baseline.badge),I=t.step+1;return n.ink.push({text:String(I),rect:{x:t.x-s,y:t.y-s,w:s*2,h:s*2},shown:[[e,d]],boxed:!0,badge:!0}),`<g class="dg-bd" data-step="${t.step}" style="${ke(t.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${u}" cy="${h}" r="${i}" style="${S}"/><g class="dg-a" style="${$}"><circle class="${a?"dg-bdp-g":"dg-bdp"}" cx="${u}" cy="${h}" r="${i}"/><text class="${a?"dg-bdpt-g":"dg-bdpt"}" x="${u}" y="${P}" text-anchor="middle">${I}</text></g><g class="dg-popc dg-a" style="${m}"><circle class="dg-bdf" cx="${u}" cy="${h}" r="${s}"/><text class="dg-bdft" x="${u}" y="${P}" text-anchor="middle">${I}</text></g></g>`}function Fr(t,n,a,c=!1,l=new Map,e){let{m:r,sh:s}=a,i=w.strip,o=t.y+i.h/2,p=[`<rect class="dg-strip" x="${W(t.x+.5)}" y="${W(t.y+.5)}" width="${W(t.w-1)}" height="${W(t.h-1)}" rx="${w.region.radius}" ${s}/>`,`<g style="${ke("slate")}"><rect class="dg-bi" x="${W(t.x+i.pad)}" y="${W(o-i.icon/2)}" width="${i.icon}" height="${i.icon}" rx="${w.box.iconRadius}"/>${ft("env",t.x+i.pad+i.icon/2,o,.78)}</g>`,Oe(a.ink,"dg-sh",t.x+i.titleX,o+w.baseline.stripTitle,t.title,O.stripTitle)];if(t.fields.forEach((f,b)=>{let m=t.fields[b-1];if(m&&m.y===f.y){let h=f.x-i.fieldGap/2;p.push(`<line class="dg-sep" x1="${W(h)}" y1="${W(f.y+i.sepInset)}" x2="${W(h)}" y2="${W(f.y+i.h-i.sepInset)}"/>`)}p.push(Oe(a.ink,"dg-fl",f.x,f.y+i.nameY,f.name,O.fieldName));let d=e?.(f);if(d!==void 0){p.push(d);return}let $=n.get(f.name)??[],S=$.filter(h=>h.value!==void 0),u=$.filter(h=>h.tag!==void 0);S.forEach((h,P)=>{let I=S[P+1]?.at,G=h.value,ne=De(G)?"dg-fvj":"dg-fv";a.ink.push({text:G,rect:_e(G,f.x,f.y+i.valueY,De(G)?O.fieldValueJa:O.fieldValue),shown:[[h.at,I===void 0?Number.POSITIVE_INFINITY:I-oe.untilFade]]});let U=K=>`<text class="${K}" x="${W(f.x)}" y="${W(f.y+i.valueY)}">${Te(G)}</text>`,j=U(ne);if(!c){let K=I===void 0?r.rise(h.at):r.rise(h.at,I-oe.untilFade);p.push(`<g class="dg-a" style="${K}">${j}</g>`);return}let A=Math.min(h.until,I??h.until),C=`<circle class="dg-fl-now" cx="${W(f.x+le(f.name,O.fieldName)+i.now.gap)}" cy="${W(f.y+i.nameY-O.fieldName.size/3)}" r="${i.now.r}"/>`;p.push(`<g class="dg-fv-now dg-a" data-step="${h.step}" style="${ke(h.color)};${r.rise(h.at,A-oe.untilFade)}">${U(`${ne} dg-fv-c`)}${C}</g>`),(I===void 0||I>A)&&p.push(`<g class="dg-a" style="${r.vis(A-oe.untilFade,I===void 0?r.last:I-oe.untilFade)}">${j}</g>`)}),u.forEach((h,P)=>{let I=u[P+1]?.at,G=h.tag,ne=[...S].reverse().find(C=>C.at<=h.at+1e-9)?.value,U=f.x+(ne?le(ne,De(ne)?O.fieldValueJa:O.fieldValue)+i.tagGap:0),j=le(G,O.tag)+i.tagPadX*2,A=f.y+i.valueY-i.tagH/2-w.baseline.tag;a.ink.push({text:G,rect:{x:U,y:A,w:j,h:i.tagH},shown:[[h.at,I===void 0?Number.POSITIVE_INFINITY:I-oe.untilFade]],boxed:!0}),p.push(`<g class="dg-tg dg-popc dg-a" style="${ke(h.color)};${I===void 0?r.pop(h.at):r.pop(h.at,I-oe.untilFade)}"><rect x="${W(U)}" y="${W(A)}" width="${W(j)}" height="${i.tagH}" rx="${i.tagH/2}"/><text x="${W(U+j/2)}" y="${W(A+i.tagH/2+w.baseline.tag)}" text-anchor="middle">${Te(G)}</text></g>`)})}),t.trail){let f=t.trail,b=t.fields[t.fields.length-1];if(b&&b.y===f.y){let d=f.x-i.fieldGap/2;p.push(`<line class="dg-sep" x1="${W(d)}" y1="${W(f.y+i.sepInset)}" x2="${W(d)}" y2="${W(f.y+i.h-i.sepInset)}"/>`)}p.push(Oe(a.ink,"dg-fl",f.x,f.y+i.nameY,f.title,O.fieldName));let m=f.y+i.valueY-O.fieldValue.size/3;f.states.forEach((d,$)=>{let S=W(f.x+i.trail.r+$*i.trail.step),u=l.get(d.box),h=u===void 0?"":`<circle class="dg-tr-fill dg-a" cx="${S}" cy="${W(m)}" r="${i.trail.r}" style="${r.pop(u)}"/>`;p.push(`<g data-trail="${Te(d.box)}" style="${ke(d.color)}"><circle class="dg-tr-ring" cx="${S}" cy="${W(m)}" r="${i.trail.r}"/>${h}</g>`)})}return p.join("")}var tt=t=>Math.round(t*100)/100,Br=t=>[t.x+t.w/2,t.y+t.h/2];function ki(t,n){let a=w.carrier,c=De(t),l=le(t,c?O.carrierJa:O.carrier)+a.tagPadX*2;return`<rect class="dg-car" x="${tt(-l/2)}" y="${-a.tagH/2}" width="${tt(l)}" height="${a.tagH}" rx="${a.tagH/2}" ${n}/><text class="dg-car-t${c?" dg-car-tj":""}" y="${w.baseline.carrier}" text-anchor="middle">${Te(t)}</text>`}function Gr(t,n,a,c){let{m:l}=c,e=w.git,r=(m,d)=>a.edges.find($=>$.step===m&&$.event===d),s=t.links.map(m=>{let d=r(m.step,m.event);if(!d)return"";c.traces.push({from:m.from,to:m.to,points:m.points,shown:[[d.start,Number.POSITIVE_INFINITY]]});let $=ut(m.points);if(m.kind==="copy")return`<g style="${ke(m.color)}"><path class="dg-git-cp dg-a" d="${$}" style="${l.vis(d.start,l.last)}"/></g>`;let S=l.kf([[0,{opacity:0,"stroke-dashoffset":1}],[d.start,{opacity:0,"stroke-dashoffset":1},be.inOut],[d.start+.05,{opacity:1}],[d.drawn,{"stroke-dashoffset":0}],[l.last,{opacity:1,"stroke-dashoffset":0},be.inOut],[l.total,{opacity:0,"stroke-dashoffset":0}]]);return`<g style="${ke(m.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${$}" style="${S}"/></g>`}).join(""),i=t.commits.map(m=>{let d=r(m.step,m.event)?.drawn??0,$={x:m.cx-m.r,y:m.cy-m.r,w:m.r*2,h:m.r*2};c.ink.push({text:m.id,rect:$,shown:[[d,Number.POSITIVE_INFINITY]],boxed:!0});let S=(m.text?.lines??[]).map((ne,U)=>{let j=U===0&&m.hash!==void 0,A=m.text?.baselines[U]??m.cy;return Oe(c.ink,j?"dg-git-h":"dg-git-n",m.cx,A,ne,j?O.gitHash:O.gitNote,[[d,Number.POSITIVE_INFINITY]],"middle")}).join(""),u=`<text class="dg-git-id" x="${tt(m.cx)}" y="${tt(m.cy+w.baseline.badge)}" text-anchor="middle">${Te(m.id)}</text>`,h=`<g class="dg-popc dg-a" style="${l.pop(d)}"><circle class="dg-git-c" cx="${tt(m.cx)}" cy="${tt(m.cy)}" r="${m.r}" ${c.sh}/>${u}</g>`,P=S===""?"":`<g class="dg-a" style="${l.vis(d)}">${S}</g>`,I=m.orphan===void 0?void 0:r(m.orphan,m.orphanEvent??0)?.drawn,G=I===void 0?"":`<g class="dg-a" data-orphan="${Te(m.id)}" style="${l.vis(I,l.last,{f:.5})}"><circle class="dg-git-old" cx="${tt(m.cx)}" cy="${tt(m.cy)}" r="${e.orphan}"/><text class="dg-git-oldl" x="${tt(m.cx)}" y="${tt(m.cy+w.baseline.badge)}" text-anchor="middle">${Te(m.id)}</text></g>`;return`<g data-commit="${Te(m.id)}" style="${ke(m.color)}">${h}${P}${G}</g>`}).join(""),o=t.moves.flatMap(m=>{let d=r(m.step,m.event);if(!m.line||!d)return[];let $=a.steps[m.step].end;c.traces.push({from:m.ref,to:m.target??m.ref,points:m.line,shown:[[d.start,$+.4]]});let S=l.kf([[0,{opacity:0,"stroke-dashoffset":1}],[d.start,{opacity:0,"stroke-dashoffset":1},be.inOut],[d.start+.05,{opacity:1}],[d.drawn,{"stroke-dashoffset":0}],[$,{opacity:1},be.inOut],[$+.4,{opacity:0}],[l.total,{opacity:0,"stroke-dashoffset":0}]]);return[`<g style="${ke(m.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${ut(m.line)}" style="${S}"/></g>`]}).join(""),p=a.carriers.flatMap(m=>{let d=t.moves.find(u=>u.step===m.step&&u.event===m.event&&u.line),$=n.steps[m.step]?.events[m.event];if(!d?.line||$?.type!=="edge")return[];let S={step:m.step,event:m.event,from:d.ref,to:d.target??d.ref,points:d.line,color:d.color,carry:$.carry};return[yn(S,{...m,start:m.depart,end:m.arrive+oe.fade},c)]}).join(""),b=[...new Set(t.moves.map(m=>m.ref))].map(m=>vi(m,t.moves.filter(d=>d.ref===m),r,c)).join("")+p;return{links:s,lines:o,commits:i,tags:b}}function vi(t,n,a,c){let{m:l}=c,e=[],r=[[0,{opacity:0}]],s=!1,i,o=m=>{i&&c.ink.push({text:t,rect:i.rect,shown:[[i.since,m]],boxed:!0}),i=void 0};for(let m of n){let d=a(m.step,m.event);if(!d)continue;let{start:$,drawn:S}=d,u=m.from?Br(m.from):void 0,h=m.to?Br(m.to):void 0;if(o($),m.carried&&u&&h&&s){e.push([$+oe.fade,u[0],u[1]],[S-oe.fade,h[0],h[1]]),r.push([$,{opacity:1},be.inOut],[$+oe.fade,{opacity:0}],[S-oe.fade,{opacity:0},be.out],[S,{opacity:1}]),i={rect:m.to,since:S};continue}if(u&&e.push([$,u[0],u[1]]),h&&e.push([S,h[0],h[1]]),h&&!s){let P=u?$:S-oe.fade;r.push([P,{opacity:0},be.out],[P+oe.fade,{opacity:1}]),s=!0}else!h&&s&&(r.push([S,{opacity:1},be.inOut],[S+oe.untilFade,{opacity:0}]),s=!1);m.to&&(i={rect:m.to,since:S})}if(o(Number.POSITIVE_INFINITY),e.length===0)return"";let p=e[0],f=e[e.length-1];s?r.push([l.last,{opacity:1},be.inOut],[l.total,{opacity:0}]):r.push([l.total,{opacity:0}]);let b=l.move([[0,p[1],p[2]],...e,[l.total,f[1],f[2]]],r);return`<g class="dg-a" data-ref="${Te(t)}" style="${b}">${ki(t,c.sh)}</g>`}var se=t=>Math.round(t*100)/100,yt=(t,n)=>De(n)?`${t} ${t}j`:t,Rt=t=>({...t,family:"sans"});function _r(t){let n=[];for(let a of t){let c=n[n.length-2],l=n[n.length-1];if(c&&l){let e=l[0]===c[0]?Number.NaN:(l[1]-c[1])/(l[0]-c[0]),r=a[0]===l[0]?Number.NaN:(a[1]-l[1])/(a[0]-l[0]);Number.isFinite(e)&&Number.isFinite(r)&&Math.abs(e-r)<1e-9?n[n.length-1]=a:n.push(a)}else n.push(a)}return n}function Yr(t,n){let a=t[0];if(!a)return 0;if(n<=a[0])return a[1];for(let c=1;c<t.length;c++){let[l,e]=t[c],[r,s]=t[c-1];if(n<=l)return l===r?e:s+(e-s)*(n-r)/(l-r)}return t[t.length-1][1]}function Vr(t,n,a,c,l){let{m:e,ink:r}=c,s=w.time,{axis:i}=t,o=new Map((a.units??[]).map(x=>[x.unit,x.passed])),p=(x,N)=>a.events.find(E=>E.step===x&&E.event===N)?.at,f=(x,N)=>a.edges.find(E=>E.step===x&&E.event===N)?.drawn,b=[],m=[],d=[],$=[],S=Math.min(...t.rows.map(x=>x.y)),u=Math.max(...t.rows.map(x=>x.y+x.h)),h=new Map;for(let x of t.wires){let N=f(x.step,x.event);N!==void 0&&h.set(x.to,Math.min(h.get(x.to)??Number.POSITIVE_INFINITY,N))}let P=(x,N)=>{let E=t.zoom?.columns.find(q=>q.unit===N)?.boxes.find(q=>q.id===x),v=[o.get(N),E?h.get(E):void 0].filter(q=>q!==void 0);return v.length>0?Math.min(...v):void 0};for(let x of t.periods)x.index%2===1&&b.push(`<rect class="dg-tm-ep" x="${se(x.x)}" y="${se(S-s.shade)}" width="${se(x.w)}" height="${se(u-S+s.shade*2)}" rx="4"/>`);if(t.zoom){let x=t.zoom;x.columns.forEach((N,E)=>{E>0&&b.push(`<line class="dg-tm-sep" x1="${se(N.x)}" y1="${se(N.y+s.sep)}" x2="${se(N.x)}" y2="${se(N.y+N.h-s.sep)}"/>`),b.push(Oe(r,yt("dg-tm-hd",N.head),N.x+N.w/2,x.headY,N.head,O.timeHead,We,"middle"));for(let v of N.boxes)d.push(I(v,N.unit))})}function I(x,N){let E=[...new Set(t.wires.filter(ee=>ee.from===x||ee.to===x).map(ee=>ee.step))].sort((ee,de)=>ee-de),v=ee=>`<rect class="${ee}" x="${se(x.x)}" y="${se(x.y)}" width="${se(x.w)}" height="${x.h}" rx="${w.box.radius}"/>`;if(x.empty){let ee=o.get(N),de=t.zoom?.empty??"",ce=ee===void 0?"":`<g class="dg-a" style="${e.vis(ee)}">${v("dg-tm-ex")}${Oe(r,"dg-tm-ext",x.cx,x.cy+w.baseline.mark,de,O.emptyText,[[ee,Number.POSITIVE_INFINITY]],"middle")}</g>`;return`<g data-empty="${Te(x.id)}">${v("dg-tm-ph")}${ce}</g>`}let q=un(n.boxes.find(ee=>ee.id===x.id)?.link,gn(x,c,E,l.get(x.id)??[]));if(!x.row)return q;let z=P(x.row,N);return z===void 0?v("dg-tm-ph"):`<g class="dg-a" style="${e.until(z)}">${v("dg-tm-ph")}</g><g class="dg-popc dg-a" style="${e.pop(z)}">${q}</g>`}for(let x of t.rows){let N=[];for(let E of t.marks.filter(v=>v.row===x.id)){let v=(z,ee="")=>`<rect class="${z}" x="${se(E.x)}" y="${se(E.y)}" width="${se(E.w)}" height="${se(E.h)}" rx="${s.markRadius}"${ee}/>`;if(N.push(v("dg-tm-slot")),E.empty){let z=o.get(E.unit);z!==void 0&&N.push(`<circle class="dg-tm-x dg-a" cx="${se(E.x+E.w/2)}" cy="${se(E.y+E.h/2)}" r="${s.emptyR}" style="${e.vis(z,e.last,{f:.2})}"/>`);continue}let q=P(x.id,E.unit);q!==void 0&&N.push(v("dg-tm-m dg-a",` style="${e.vis(q,e.last,{f:.2})}"`)),E.colors.forEach((z,ee)=>{let de=p(z.step,z.event);if(de===void 0)return;let ce=E.colors[ee+1],pe=ce?p(ce.step,ce.event):void 0;N.push(`<g style="${ke(z.color)}">${v("dg-tm-m dg-a",` style="${e.vis(de,pe??e.last,{f:.35})}"`)}</g>`)})}b.push(`<g data-row="${Te(x.id)}" style="${ke(x.color)}">${N.join("")}</g>`),b.push(Oe(r,"dg-tm-rn",w.margin+w.region.inset,x.y+x.h/2+w.baseline.mark,x.name,O.timeRow))}if(t.zoom){let x=t.zoom,N=t.spans.filter(q=>q.kind==="box"&&q.from<=x.to&&x.from<=q.to).map(q=>p(q.step,q.event)).filter(q=>q!==void 0).sort((q,z)=>q-z)[0],E=x.guides.map(q=>`<path class="dg-tm-gd" d="${ut(q)}"/>`).join(""),v=`<rect class="dg-tm-fr" x="${se(x.frame.x)}" y="${se(x.frame.y)}" width="${se(x.frame.w)}" height="${se(x.frame.h)}" rx="4"/>${E}`;b.push(N===void 0?v:`<g class="dg-a" style="${e.until(N)}">${v}</g>`)}let G=x=>se(i.x+x*i.unit),ne=t.ticks.map(x=>`M ${G(x.at)} ${se(i.line-s.major/2)} V ${se(i.line+s.major/2)}`),U=t.minor.map(x=>`M ${G(x)} ${se(i.line-s.minor/2)} V ${se(i.line+s.minor/2)}`);b.push(`<path class="dg-tm-ax" d="M ${G(0)} ${se(i.line)} H ${G(i.count)} ${[...ne,...U].join(" ")}"/>`);for(let x of t.ticks)b.push(Oe(r,yt("dg-tm-tk",x.text),x.left,x.y,x.text,O.timeTick));for(let x of t.periods)b.push(Oe(r,yt("dg-tm-en",x.name),x.x+x.w/2,x.nameY,x.name,O.timePeriod,We,"middle")),b.push(Oe(r,yt("dg-tm-er",x.range),x.x+x.w/2,x.rangeY,x.range,O.timeRange,We,"middle"));for(let x of t.spans){let N=p(x.step,x.event);if(N===void 0)continue;let E=x.until===void 0?void 0:a.steps[x.until].start,v=[[N,E??Number.POSITIVE_INFINITY]],q=E===void 0?e.vis(N):e.vis(N,E,{within:!0});if(x.kind==="bracket"){let[ee,de,ce,pe]=[se(x.x+1),se(x.x+x.w-1),se(x.y),se(x.y+x.h)],ve=Oe(r,yt("dg-tm-bt",x.text),x.textRect.x+x.textRect.w/2,x.textY,x.text,O.spanText,v,"middle");b.push(`<g class="dg-a" data-span="${x.step}" style="${ke(x.color)};${q}"><path class="dg-tm-br" d="M ${ee} ${ce} L ${ee} ${pe} L ${de} ${pe} L ${de} ${ce}"/>${ve}</g>`);continue}b.push(`<g class="dg-a" data-span="${x.step}" style="${ke(x.color)};${q}"><rect class="dg-tm-bx" x="${se(x.x)}" y="${se(x.y)}" width="${se(x.w)}" height="${se(x.h)}" rx="6"/></g>`);let z=x.textRect;r.push({text:x.text,rect:z,shown:v,boxed:!0}),$.push(`<g class="dg-tg dg-popc dg-a" style="${ke(x.color)};${E===void 0?e.pop(N):e.pop(N,E)}"><rect x="${se(z.x)}" y="${se(z.y)}" width="${se(z.w)}" height="${z.h}" rx="${z.h/2}"/><text x="${se(z.x+z.w/2)}" y="${se(x.textY)}" text-anchor="middle">${Te(x.text)}</text></g>`)}let j=s.point;for(let x of t.points){let{cx:N,cy:E,r:v}=x,q=x.changes.map(ye=>p(ye.step,ye.event)??Number.POSITIVE_INFINITY),z=q[0];b.push(`<path class="dg-tm-con" d="M ${se(N)} ${se(u+3)} L ${se(N)} ${se(E-v-2)}"/>`);let ee=x.text.x,de=Oe(r,yt("dg-tm-pn",x.id),ee,E+j.nameY,x.id,O.pointName),ce=de.replace(/class="([^"]*)"/u,'class="$1 dg-tm-pn-g"'),pe=z===void 0||!Number.isFinite(z)?ce:`<g class="dg-a" style="${e.until(z)}">${ce}</g><g class="dg-a" style="${e.vis(z)}">${de}</g>`,ve=x.changes.map((ye,Pe)=>{let k=q[Pe];if(!Number.isFinite(k))return"";let V=q[Pe+1],J=V!==void 0&&Number.isFinite(V)?V-oe.untilFade:void 0,T=Oe(r,yt("dg-tm-ps",ye.text),ee,E+j.stateY,ye.text,O.pointState,[[k,J??Number.POSITIVE_INFINITY]]);return`<g class="dg-a" style="${ke(ye.color??"slate")};${J===void 0?e.rise(k):e.rise(k,J)}">${T}</g>`}).join(""),we=x.changes.map((ye,Pe)=>{let k=q[Pe];return!ye.color||!Number.isFinite(k)?"":`<g class="dg-popc dg-a" style="${ke(ye.color)};${e.pop(k)}"><circle class="dg-tm-pc" cx="${se(N)}" cy="${se(E)}" r="${v+.5}"/>${ft("flag",N,E,j.glyph,"dg-tm-pcg")}</g>`}).join("");d.push(`<g data-point="${Te(x.id)}"><circle class="dg-tm-pg" cx="${se(N)}" cy="${se(E)}" r="${v}"/>${ft("flag",N,E,j.glyph,"dg-tm-pgl")}${we}${pe}${ve}</g>`)}let A=new Set(t.wires.map(x=>`${x.step}/${x.event}`));for(let x of t.edges){if(A.has(`${x.step}/${x.event}`))continue;let N=a.edges.find(q=>q.step===x.step&&q.event===x.event);if(!N)continue;c.traces.push({from:x.from,to:x.to,points:x.points,shown:[[N.start,Number.POSITIVE_INFINITY]]});let E=e.kf([[0,{opacity:0,"stroke-dashoffset":1}],[N.start,{opacity:0,"stroke-dashoffset":1},be.inOut],[N.start+.05,{opacity:1}],[N.drawn,{"stroke-dashoffset":0}],[e.last,{opacity:1,"stroke-dashoffset":0},be.inOut],[e.total,{opacity:0,"stroke-dashoffset":0}]]),v=e.kf([[0,{opacity:0}],[N.drawn-.05,{opacity:0}],[N.drawn,{opacity:1}],[e.last,{opacity:1},be.inOut],[e.total,{opacity:0}]]);m.push(`<g data-link="${Te(`${x.from}->${x.to}`)}" style="${ke(x.color)}"><path class="dg-tm-ln dg-a" pathLength="1" d="${ut(x.points)}" style="${E}"/><path class="dg-eh-on dg-a" d="${hn(x.points)}" style="${v}"/></g>`)}let C=a.needle??[],K=_r(C.filter(([x])=>x<e.total)),X=K[K.length-1]?.[1]??0,Q=[...K.map(([x,N])=>[x,i.x+N*i.unit,0]),[e.last,i.x+X*i.unit,0],[e.total,i.x,0]],{y1:ie,y2:re}=t.needle,D=s.needle;return $.push(`<g class="dg-a" data-needle="" style="${e.move(Q)}"><line class="dg-tm-nd" x1="0" y1="${se(ie)}" x2="0" y2="${se(re)}"/><path class="dg-tm-nh" d="M ${-D.head*.75} ${se(ie-D.head)} L ${D.head*.75} ${se(ie-D.head)} L 0 ${se(ie)} Z"/><circle class="dg-tm-nh" cy="${se(i.line)}" r="${D.dot}"/></g>`),{base:b.join(""),lit:m.join(""),node:d.join(""),top:$.join("")}}function Wr(t,n,a){let{m:c}=a,l=w.time.meter,{x:e,w:r,line:s,text:i}=t.meter,o=t.y+l.y,p=c.kf([..._r(n).map(([b,m])=>[b,{transform:`scaleX(${se(m*1e3)/1e3})`}]),[c.last,{transform:`scaleX(${se(Yr(n,c.last)*1e3)/1e3})`},be.inOut],[c.total,{transform:"scaleX(0)"}]]),f=e+r*s;return`<rect class="dg-tm-mt" x="${se(e)}" y="${se(o)}" width="${se(r)}" height="${l.h}" rx="${l.h/2}"/><rect class="dg-tm-mf dg-a" x="${se(e)}" y="${se(o)}" width="${se(r)}" height="${l.h}" rx="${l.h/2}" style="${ke(l.color)};${p}"/><line class="dg-tm-mk" x1="${se(f)}" y1="${se(o-l.mark)}" x2="${se(f)}" y2="${se(o+l.h+l.mark)}"/>`+Oe(a.ink,"dg-tm-ml",f,t.y+l.textY,i,O.meterLine,We,"middle")}function Hr(t,n,a,c,l,e){let r=n.steps[a],s=Yr(n.needle??[],r.end-oe.still),i=t.axis.x+s*t.axis.unit,o=Math.min(...t.rows.map($=>$.y)),p=Math.max(...t.rows.map($=>$.y+$.h)),f={x:i-1,y:o,w:2,h:p-o},b=t.badges.find($=>$.step===a),m=$=>Math.hypot(Math.max(0,$.x-i,i-$.x-$.w),Math.max(0,$.y-o,o-$.y-$.h)),d=[...b?[{x:b.x-w.badge.r,y:b.y-w.badge.r,w:w.badge.r*2,h:w.badge.r*2}]:[],...[...c].sort(($,S)=>m($)-m(S))];for(let $ of d){let S=Math.min(f.x,$.x),u=Math.min(f.y,$.y),h={x:S,y:u,w:Math.max(f.x+f.w,$.x+$.w)-S,h:Math.max(f.y+f.h,$.y+$.h)-u};h.w<=l&&h.h<=e&&(f=h)}return f}var zr=t=>Math.round(t*100)/100,bn=class{constructor(n,a,c){this.prefix=n;this.total=a;this.last=c}prefix;total;last;frames=[];count=0;pct(n){return+(Math.min(Math.max(n,0),this.total)/this.total*100).toFixed(3)}kf(n){let a=`${this.prefix}-${this.count++}`,c=new Map;for(let[e,r,s]of[...n].sort((i,o)=>i[0]-o[0])){let i=this.pct(e),o=c.get(i)??{props:{}};Object.assign(o.props,r),s&&(o.ease=s),c.set(i,o)}let l=[...c].map(([e,{props:r,ease:s}])=>{let i=Object.entries(r).map(([o,p])=>`${o}:${p}`);return s&&i.push(`animation-timing-function:${s}`),`${e}%{${i.join(";")}}`}).join("");return this.frames.push(`@keyframes ${a}{${l}}`),`animation-name:${a}`}vis(n,a=this.last,c={}){let l=c.f??oe.fade,e=c.on??{},r=c.off??{},s=c.within?Math.max(n+l,a-l):a;return this.kf([[0,{opacity:0,...r}],[n,{opacity:0,...r},c.ein??be.out],[n+l,{opacity:1,...e}],[s,{opacity:1,...e},be.inOut],[Math.min(s+l,this.total),{opacity:0,...r}],[this.total,{opacity:0,...r}]])}rise(n,a=this.last,c=!1){return this.vis(n,a,{on:{transform:"translateY(0)"},off:{transform:`translateY(${w.rise}px)`},within:c})}pop(n,a=this.last){return this.vis(n,a,{f:oe.popFade,ein:be.pop,on:{transform:"scale(1)"},off:{transform:`scale(${w.popFrom})`}})}until(n){let a=oe.untilFade;return this.kf([[0,{opacity:1}],[n,{opacity:1},be.inOut],[n+a,{opacity:0}],[this.last,{opacity:0}],[this.total,{opacity:1}]])}move(n,a=[]){return this.kf(n.map(([c,l,e,r=1,s])=>[c,{transform:`translate(${zr(l)}px,${zr(e)}px) scale(${r})`},s]).concat(a))}blink(n,a,c){return[[0,{opacity:0}],[n-.01,{opacity:0}],[n,{opacity:1}],[a,{opacity:1}],[a+c,{opacity:0}],[this.total,{opacity:0}]]}};var ue=t=>`font:${t.weight} ${t.size}px var(--${t.family})`,Ce=(t,n="var(--surf)")=>`color-mix(in srgb,var(--c) ${t}%,${n})`,he=w.stroke,Ee=w.mix,An=`color-mix(in srgb,var(--mute) ${Ee.past}%,var(--bg))`,Pi=[".dg{display:block;width:100%;height:auto;overflow:visible}",".dg .dg-a{animation-duration:var(--T);animation-timing-function:linear;animation-iteration-count:infinite;animation-fill-mode:both;animation-delay:calc(var(--at,0) * -1s);animation-play-state:var(--play,running)}",".dg .dg-popc{transform-box:fill-box;transform-origin:center}",".dg-bg{fill:var(--bg)}",".dg-band{fill:color-mix(in srgb,var(--c) var(--tint),var(--bg));stroke:color-mix(in srgb,var(--c) var(--edge),transparent)}",`.dg-bi{fill:${Ce(Ee.regionIcon)};stroke:${Ce(Ee.regionIconEdge,"transparent")}}`,`.dg-bz{${ue(O.regionName)};fill:var(--ct)}`,`.dg-bx{${ue(O.regionNote)};fill:var(--mute)}`,".dg-st{fill:var(--surf);stroke:var(--hair)}",`.dg-halo{fill:none;stroke:var(--c);stroke-width:${he.halo};stroke-opacity:.16}`,`.dg-on{fill:none;stroke:var(--c);stroke-width:${he.on}}`,`.dg-ic{fill:${Ce(Ee.icon)}}`,`.dg-slot{fill:none;stroke:${Ce(Ee.slot,"transparent")};stroke-width:${he.slot};stroke-dasharray:3 3}`,`.dg-gl{fill:none;stroke:var(--c);stroke-width:${he.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-sn{${ue(O.boxName)};fill:var(--ink)}`,`.dg-ss{${ue(O.boxSub)};fill:var(--mute)}`,`.dg-ss-ok{${ue(O.boxSubStrong)};fill:var(--ct)}`,`.dg-ss-act{${ue(O.boxSubStrong)};fill:var(--ink)}`,`.dg-ll{stroke:var(--line);stroke-width:${he.lifeline};stroke-dasharray:3 4}`,`.dg-e{fill:none;stroke:var(--line);stroke-width:${he.edge};stroke-linecap:round;stroke-dasharray:0 ${w.edge.ghostDash}}`,`.dg-eh{fill:none;stroke:var(--line);stroke-width:${he.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-e-on{fill:none;stroke:var(--c);stroke-width:${he.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-eh-on{fill:none;stroke:var(--c);stroke-width:${he.edgeOn};stroke-linecap:round;stroke-linejoin:round}`,`.dg-flow{fill:none;stroke:var(--surf);stroke-width:${he.flow};stroke-linecap:round;stroke-dasharray:1.5 ${w.edge.flowDash}}`,`.dg-e-past{fill:none;stroke:${An};stroke-width:${he.edge};stroke-linecap:round}`,`.dg-eh-past{fill:none;stroke:${An};stroke-width:${he.arrow};stroke-linecap:round;stroke-linejoin:round}`,".dg-bd{cursor:pointer}",".dg-bdf{fill:var(--c)}",`.dg-bdft{${ue(O.badge)};fill:var(--on-c)}`,`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${he.badgeRing};pointer-events:none}`,`.dg-bdp{fill:${Ce(Ee.badgePast)};stroke:${Ce(Ee.badgePastEdge,"transparent")};stroke-width:${he.hair}}`,`.dg-bdpt{${ue(O.badge)};fill:var(--ct)}`,`.dg-bdp-g{fill:var(--surf);stroke:${An};stroke-width:${he.hair}}`,`.dg-bdpt-g{${ue(O.badge)};fill:var(--mute)}`,`.dg-cap rect,.dg-act rect{fill:${Ce(Ee.cap)};stroke:${Ce(Ee.capEdge,"transparent")}}`,`.dg-cap text{${ue(O.label)};fill:var(--ct)}`,`.dg-capj text{${ue(O.labelJa)}}`,`.dg-cap-past text{${ue(O.label)};fill:var(--mute);fill-opacity:${w.state.pastLabel}}`,`.dg-cap-pastj text{${ue(O.labelJa)}}`,`.dg-act text{${ue(O.action)};fill:var(--ct)}`,".dg-car{fill:var(--carry,var(--ink))}",`.dg-car-t{${ue(O.carrier)};fill:var(--bg)}`,`.dg-car-tj{${ue(O.carrierJa)}}`,`.dg-env{fill:var(--carry,var(--ink));stroke:var(--surf);stroke-width:${he.envelope}}`,`.dg-env-in{fill:none;stroke:var(--surf);stroke-width:${he.flow};stroke-linejoin:round;stroke-linecap:round}`,".dg-coin{fill:var(--coin);stroke:var(--surf);stroke-width:1.2}",".dg-coin-in{fill:none;stroke:var(--coinin);stroke-width:1.1}",".dg-strip{fill:var(--surf);stroke:var(--hair)}",`.dg-sep{stroke:var(--hair);stroke-width:${he.hair}}`,`.dg-sh{${ue(O.stripTitle)};fill:var(--ink)}`,`.dg-fl{${ue(O.fieldName)};fill:var(--mute)}`,`.dg-fv{${ue(O.fieldValue)};fill:var(--ink)}`,`.dg-fvj{${ue(O.fieldValueJa)};fill:var(--ink)}`,".dg-fv-c{fill:var(--ct)}",".dg-fl-now{fill:var(--c)}",`.dg-tr-ring{fill:none;stroke:var(--line);stroke-width:${he.trail}}`,".dg-tr-fill{fill:var(--c)}",".dg-tg rect{fill:var(--c)}",`.dg-tg text{${ue(O.tag)};fill:var(--on-c)}`,`.dg-side{fill:color-mix(in srgb,var(--c) ${Ee.side}%,var(--bg));stroke:${Ce(Ee.sideEdge,"transparent")};stroke-dasharray:4 4}`,`.dg-side-t{${ue(O.regionName)};fill:var(--ct)}`,`.dg-side-n{${ue(O.regionNote)};fill:var(--mute)}`,`.dg-ghost{fill:var(--surf);stroke:${Ce(Ee.ghostEdge,"transparent")};stroke-dasharray:4 3}`,`.dg-path{fill:none;stroke:${Ce(Ee.path,"transparent")};stroke-width:${he.path};stroke-linecap:round;stroke-dasharray:0 ${w.edge.ghostDash}}`,`.dg-path-h{fill:none;stroke:${Ce(Ee.path,"transparent")};stroke-width:${he.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-path-t{${ue(O.label)};fill:var(--ct)}`,`.dg-path-tj{${ue(O.labelJa)}}`,".dg-start{fill:var(--ink)}",`.dg-end{fill:var(--bg);stroke:var(--ink);stroke-width:${he.end}}`,".dg-end-in{fill:var(--ink)}",`.dg-end-x{fill:var(--bg);stroke:${Ce(Ee.path,"transparent")};stroke-width:${he.arrow};stroke-dasharray:2 2.5}`,`.dg-end-xi{fill:${Ce(Ee.path,"transparent")}}`,`.dg-mark{${ue(O.regionNote)};fill:var(--mute)}`,`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${he.done}}`,`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${he.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${he.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${he.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${he.git}}`,`.dg-git-id{${ue(O.gitId)};fill:var(--ct)}`,`.dg-git-h{${ue(O.gitHash)};fill:var(--mute)}`,`.dg-git-n{${ue(O.gitNote)};fill:var(--ink2)}`,`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${he.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,`.dg-git-oldl{${ue(O.gitId)};fill:var(--ct);opacity:.55}`,`.dg-tm-ep{fill:color-mix(in srgb,var(--ink) ${Ee.timeShade}%,transparent)}`,`.dg-tm-sep{stroke:var(--hair);stroke-width:${he.hair};stroke-dasharray:2 4}`,`.dg-tm-hd{${ue(O.timeHead)};fill:var(--ink)}`,`.dg-tm-hdj{${ue(Rt(O.timeHead))}}`,`.dg-tm-slot{fill:none;stroke:var(--line);stroke-width:${he.timeSlot};opacity:.55}`,".dg-tm-m{fill:var(--c)}",".dg-tm-x{fill:var(--c-slate)}",`.dg-tm-fr{fill:none;stroke:var(--c-blue);stroke-width:${he.timeFrame};stroke-dasharray:3 2}`,`.dg-tm-gd{fill:none;stroke:color-mix(in srgb,var(--c-blue) ${Ee.timeGuide}%,transparent);stroke-width:${he.hair};stroke-dasharray:2 3}`,`.dg-tm-ax{fill:none;stroke:var(--line);stroke-width:${he.timeAxis}}`,`.dg-tm-tk{${ue(O.timeTick)};fill:var(--mute)}`,`.dg-tm-tkj{${ue(Rt(O.timeTick))}}`,`.dg-tm-en{${ue(O.timePeriod)};fill:var(--ink2)}`,`.dg-tm-er{${ue(O.timeRange)};fill:var(--mute)}`,`.dg-tm-erj{${ue(Rt(O.timeRange))}}`,`.dg-tm-rn{${ue(O.timeRow)};fill:var(--ink2)}`,`.dg-tm-br{fill:none;stroke:var(--c);stroke-width:${he.timeSpan};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-bt{${ue(O.spanText)};fill:var(--ct)}`,`.dg-tm-bx{fill:color-mix(in srgb,var(--c) ${Ee.timeSpan}%,transparent);stroke:var(--c);stroke-width:${he.timeSpan};stroke-dasharray:4 3}`,`.dg-tm-con{fill:none;stroke:var(--line);stroke-width:${he.timeDrop};stroke-linecap:round;stroke-dasharray:0 3.5}`,".dg-tm-pg{fill:var(--surf);stroke:var(--line);stroke-dasharray:2 2.5}",`.dg-tm-pgl{fill:none;stroke:var(--mute);stroke-width:${he.timeFlag};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-pc{fill:var(--surf);stroke:var(--c);stroke-width:${he.timePoint}}`,`.dg-tm-pcg{fill:none;stroke:var(--c);stroke-width:${he.timeFlag};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-pn{${ue(O.pointName)};fill:var(--ink)}`,`.dg-tm-pnj{${ue(Rt(O.pointName))}}`,".dg-tm-pn-g{fill:var(--mute)}",`.dg-tm-ps{${ue(O.pointState)};fill:var(--ct)}`,`.dg-tm-ln{fill:none;stroke:var(--c);stroke-width:${he.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-tm-nd{stroke:var(--ink);stroke-width:${he.timeNeedle};opacity:.55}`,".dg-tm-nh{fill:var(--ink)}",".dg-tm-ph{fill:none;stroke:var(--line);stroke-dasharray:3 3}",`.dg-tm-ex{fill:color-mix(in srgb,var(--c-slate) ${Ee.timeEmpty}%,var(--surf));stroke:var(--c-slate);stroke-width:${he.timeFrame};stroke-dasharray:3 3}`,`.dg-tm-ext{${ue(O.emptyText)};fill:var(--t-slate)}`,".dg-tm-mt{fill:var(--hair)}",".dg-tm-mf{fill:var(--c);transform-box:fill-box;transform-origin:0 50%}",`.dg-tm-mk{stroke:var(--ink2);stroke-width:${he.timeMeter}}`,`.dg-tm-ml{${ue(O.meterLine)};fill:var(--ink2)}`,".dg-vp-bg{fill:var(--bg)}",".dg-vp-frame{fill:none;stroke:var(--hair)}",".dg-hd-bg{fill:var(--bg)}",".dg-mm-bg{fill:var(--surf);stroke:var(--hair)}",`.dg-mm-t{${ue(O.miniTitle)};fill:var(--mute)}`,".dg-mm-world{fill:var(--sunk);stroke:var(--hair)}",`.dg-mm-band{fill:${Ce(Ee.miniBand)};stroke:${Ce(Ee.miniBandEdge,"transparent")};stroke-width:.6}`,`.dg-mm-card{fill:${Ce(Ee.mini)}}`,`.dg-mm-vp{fill:color-mix(in srgb,var(--ink) ${Ee.view}%,transparent);stroke:var(--ink);stroke-width:${he.badgeRing};vector-effect:non-scaling-stroke}`].join("");function Si(t){let n=2166136261;for(let a=0;a<t.length;a++)n^=t.charCodeAt(a),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function Mi(t){let n=new Map,a=(c,l)=>{n.set(c,(n.get(c)??new Set).add(l))};return t.steps.forEach((c,l)=>{for(let e of c.events)e.type==="edge"?(a(e.from,l),a(e.to,l)):(e.type==="action"||e.type==="swap")&&a(e.box,l)}),new Map([...n].map(([c,l])=>[c,[...l].sort((e,r)=>e-r)]))}function Ti(t,n,a){let c=[],{whole:l}=n,e=0;for(let s of n.events){let i=t.steps[s.step]?.events[s.event];if(i?.type==="swap"&&c.push({t:s.at,order:e++,box:i.box,set:i.text}),a&&i?.type==="action"){c.push({t:s.at,order:e++,box:i.box,act:i.label});let o=n.steps[s.step].end;(!l||o<=l.start)&&c.push({t:o,order:e++,box:i.box,act:null})}}c.sort((s,i)=>s.t-i.t||s.order-i.order);let r=new Map;for(let s of t.boxes){let i=[s.sub??"","dg-ss"],o,p=i.join("|"),f=[],b=c.filter($=>$.box===s.id),m=[...b].reverse().find($=>$.set!==void 0||typeof $.act=="string");l&&typeof m?.act=="string"&&b.push({t:l.start,order:e++,box:s.id,act:m.act});for(let $ of b){$.set!==void 0&&(i=[$.set,"dg-ss-ok"],o=void 0),$.act!==void 0&&(o=$.act??void 0);let S=o!==void 0?[o,"dg-ss-act"]:i;S.join("|")!==p&&(p=S.join("|"),f.push([$.t,S[0],S[1]]))}let d=f.filter(($,S)=>{let u=f[S+1];return u===void 0||u[0]-$[0]>=oe.minShow});r.set(s.id,d)}return r}function Oi(t,n,a){let c=new Map;for(let l of n.events){let e=t.steps[l.step]?.events[l.event];if(e?.type!=="strip")continue;let r=a.badges[l.step]?.color??"slate",s=c.get(e.field)??[],i=n.steps[l.step].end;s.push({at:l.at,color:r,step:l.step,until:i,...e.value!==void 0?{value:e.value}:{},...e.tag!==void 0?{tag:e.tag}:{}}),c.set(e.field,s)}return c}function Ni(t,n,a){if(t.until===void 0)return n;let{after:c,again:l,...e}=n;if(!c)return e;let r=a[t.until].start;return r>c.start?{...e,after:{start:c.start,end:Math.min(c.end,r)}}:e}function Dn(t,n,a,c,l,e,r=[],s=[]){let i=Dt(c,l),o=Si(`${JSON.stringify(t)}|${i}|${e?`${e.width}|${e.lang}`:""}`),p=new bn(`dg${o}`,a.total,a.last),f={m:p,t:a,sh:`filter="url(#dg-sh-${o})"`,end:a.steps[a.steps.length-1].end,ink:r,traces:s},b=Mi(t),m=Ti(t,a,n.kind!=="sequence"),d={band:[],base:[],lit:[],node:[],badge:[],top:[]};for(let v of n.regions)d.band.push(Mr(v,r));let $=n.boxes.find(v=>v.ghost)?.color??"slate";n.side&&d.band.push(Rr(n.side,$,r));let S=(v,q)=>n.boxes.find(z=>z.id===v&&(q===void 0||z.ghost===q))?.color;for(let v of n.paths)d.base.push(Lr(v,S(v.to,!0)??S(v.from)??$,r,s));for(let v of n.ends)d.node.push(Ar(v,$,r));let u=n.kind==="state",h=new Map((a.states??[]).flatMap(v=>v.lit[0]?[[v.box,v.lit[0].start]]:[])),P=new Map((a.meters??[]).map(v=>[v.field,v.keys])),I=v=>v.meter?Wr({...v,meter:v.meter},P.get(v.name)??[[0,0]],f):void 0;n.strip&&d.band.push(Fr(n.strip,Oi(t,a,n),f,u,h,I));for(let v of n.lifelines)d.base.push(jr(v.x,v.y1,v.y2));if(nr(n)){let v=Gr(n,t,a,f);d.base.push(v.links),d.lit.push(v.lines),d.node.push(v.commits),d.top.push(v.tags)}let G=Tn(n)?n:void 0;if(G){let v=Vr(G,t,a,f,m);d.base.push(v.base),d.lit.push(v.lit),d.node.push(v.node),d.top.push(v.top)}let ne=new Set((G?.wires??[]).map(v=>`${v.step}/${v.event}`));for(let v of n.edges){let q=a.edges.find(ee=>ee.step===v.step&&ee.event===v.event);if(!q||G&&!ne.has(`${v.step}/${v.event}`))continue;let z=Dr(v,q,f,u);d.base.push(z.base),d.lit.push(z.lit)}let U=new Map((a.states??[]).map(v=>[v.box,v])),j=new Map(t.boxes.flatMap(v=>v.link===void 0?[]:[[v.id,v.link]])),A=(v,q)=>un(j.get(v),q);for(let v of G?[]:n.boxes){if(v.ghost){d.node.push(A(v.id,Er(v,r)));continue}let q=U.get(v.id);d.node.push(A(v.id,gn(v,f,b.get(v.id)??[],m.get(v.id)??[],u?q?.lit??[]:void 0))),q?.done!==void 0&&d.node.push(qr(v,q.done,f))}for(let v of n.badges)d.badge.push(Ir(v,f,u));for(let v of n.labels){let q=a.labels.find(z=>z.step===v.step&&z.event===v.event);q&&d.top.push(Cr(v,Ni(v,q,a.steps),f))}let{whole:C}=a;for(let v of n.actions){let q=a.events.find(ee=>ee.step===v.step&&ee.event===v.event);if(!q)continue;let z=a.steps[v.step].end;d.top.push(C&&z>C.start?Rn(v,q.at,C.end,f):Rn(v,q.at,z,f,C))}for(let v of a.carriers){let q=n.edges.find(z=>z.step===v.step&&z.event===v.event);q&&d.top.push(yn(q,v,f))}let K=Object.values(d).map(v=>v.join("")).join(""),{near:X,far:Q,nearY:ie,farY:re}=w.shadow,D=`<filter id="dg-sh-${o}" x="-20%" y="-30%" width="140%" height="180%"><feDropShadow dx="0" dy="${ie}" stdDeviation="${X}" style="flood-color:var(--sh);flood-opacity:var(--shA)"/><feDropShadow dx="0" dy="${re}" stdDeviation="${Q}" style="flood-color:var(--sh);flood-opacity:var(--shB)"/></filter>`,x=e&&n.kind==="sequence"?n.boxes.map(v=>A(v.id,Nr(v,f,b.get(v.id)??[],m.get(v.id)??[]))).join(""):"",N=e?Li(n,a,t,p,o,K,e,x):{body:`<rect class="dg-bg" width="${n.width}" height="${n.height}" rx="${w.region.radius}"/>${K}`,w:n.width,h:n.height},E=`.dg-${o}{${Ct};--T:${a.total}s;${i}}${Pi}${p.frames.join("")}`;return`<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${o}" viewBox="0 0 ${Math.ceil(N.w)} ${Math.ceil(N.h)}" width="${Math.ceil(N.w)}" height="${Math.ceil(N.h)}" role="img" aria-label="${Te(t.title)}" data-dragon="figure" data-view="${e?"follow":"fixed"}"><style>${E}</style><defs>${D}</defs>${N.body}</svg>`}function Kr(t){let n=Math.min(...t.map(c=>c.x)),a=Math.min(...t.map(c=>c.y));return{x:n,y:a,w:Math.max(...t.map(c=>c.x+c.w))-n,h:Math.max(...t.map(c=>c.y+c.h))-a}}function Ei(t,n,a){let c=jn(t,n,a);return c.length===0?void 0:Kr(c)}function qi(t,n,a,c){let l=w.badge.r+w.follow.badgeRoom,{x:e,y:r}=t,s=o=>Math.hypot(Math.max(0,o.x-e,e-o.x-o.w),Math.max(0,o.y-r,r-o.y-o.h)),i={x:e-l,y:r-l,w:l*2,h:l*2};for(let o of[...n].sort((p,f)=>s(p)-s(f))){let p=Kr([i,o]);p.w<=a&&p.h<=c&&(i=p)}return i}function jn(t,n,a){let c=[];for(let l of t.edges.filter(e=>e.step===a)){let e=l.points.map(s=>s[0]),r=l.points.map(s=>s[1]);c.push({x:Math.min(...e),y:Math.min(...r),w:Math.max(...e)-Math.min(...e),h:Math.max(...r)-Math.min(...r)})}c.push(...t.labels.filter(l=>l.step===a),...t.actions.filter(l=>l.step===a));for(let l of n.steps[a]?.events??[]){let e=l.type==="edge"?[l.from,l.to]:l.type==="action"||l.type==="swap"?[l.box]:[];for(let r of e){let s=t.boxes.find(i=>i.id===r);s&&(t.kind==="architecture"||l.type==="swap")&&c.push(s)}}return c}function Li(t,n,a,c,l,e,r,s){let i=w.follow,o=w.mini,p=Math.max(1,r.width),f=Math.min(t.width,p),b=ze[r.lang].overview,m=V=>{let J=Math.min(o.w,f*.4,V*.4/t.height*t.width),T=J/t.width,H=t.height*T,y=Math.max(J,Math.ceil(le(b,O.miniTitle)));return{vh:V,mw:J,k:T,mh:H,bw:y,bgW:y+o.pad*2,bgH:H+o.pad*2+o.title,beside:H>J}},d=m(Math.min(t.height,Math.max(i.minH,f*i.aspect))),$=d.beside&&p<i.narrow,S=r.height===void 0?Number.POSITIVE_INFINITY:d.beside?r.height:r.height-d.bgH-o.inset,{vh:u,mw:h,k:P,mh:I,bw:G,bgW:ne,bgH:U,beside:j}=S<d.vh?m(Math.max(i.fitMinH,S)):{...d,vh:Number.isFinite(S)?Math.min(t.height,S):d.vh},A=j&&!$?Math.min(t.width,p-ne-o.inset):f,C=V=>Math.min(t.width-A/2,Math.max(A/2,V)),K=s===""?0:Math.max(...t.boxes.map(V=>V.y+V.h))+i.headRoom,X=s===""?0:i.head.pad*2+i.head.h,Q=u-X,ie=V=>Math.min(t.height-Q/2,Math.max(K+Q/2,V)),re=w.badge.r,D=[t.width/2,t.height/2],N=n.steps.map((V,J)=>{if(Tn(t)){let M=Hr(t,n,J,jn(t,a,J),A,Q);return D=[M.x+M.w/2,M.y+M.h/2],[C(D[0]),ie(D[1])]}let T=Ei(t,a,J);D=T?[T.x+T.w/2,T.y+T.h/2]:D;let H=[C(D[0]),ie(D[1])],y=t.badges.find(M=>M.step===J);if(!y||Math.abs(y.x-H[0])<=A/2-re&&Math.abs(y.y-H[1])<=Q/2-re)return H;let L=qi(y,jn(t,a,J),A,Q);return D=[L.x+L.w/2,L.y+L.h/2],[C(D[0]),ie(D[1])]}).map(([V,J])=>[V,J-X/2]),E=N[0],v=[[0,E[0],E[1]],[n.steps[0].start,E[0],E[1]]];N.forEach((V,J)=>{if(J===0)return;let T=N[J-1],H=n.steps[J].start;v.push([H,T[0],T[1],1,be.inOut],[H+i.ease,V[0],V[1]])});let q=N[N.length-1];v.push([n.last,q[0],q[1],1,be.inOut],[n.total,E[0],E[1]]);let z=c.move(v.map(([V,J,T,H,y])=>[V,A/2-J,u/2-T,H,y])),ee=j?A+o.inset:A-ne-o.inset,de=j?0:u+o.inset,ce=ee+o.pad,pe=ce+(G-h)/2,ve=de+o.pad+o.title,ye=$?{clip:"",body:""}:(()=>{let V=[...t.regions.map(T=>`<rect class="dg-mm-band" style="${ke(T.color)}" x="${pe+T.x*P}" y="${ve+T.y*P}" width="${T.w*P}" height="${T.h*P}" rx="3"/>`),...t.boxes.map(T=>`<rect class="dg-mm-card" style="${ke(T.color)}" x="${pe+T.x*P}" y="${ve+T.y*P}" width="${T.w*P}" height="${T.h*P}" rx="1.5"/>`)].join(""),J=c.move(v.map(([T,H,y,,L])=>[T,pe+(H-A/2)*P,ve+(y-u/2)*P,1,L]));return{clip:`<clipPath id="dg-mm-${l}"><rect x="${pe}" y="${ve}" width="${h}" height="${I}" rx="4"/></clipPath>`,body:`<rect class="dg-mm-bg" x="${ee}" y="${de}" width="${ne}" height="${U}" rx="${o.radius}"/><text class="dg-mm-t" x="${ce}" y="${ve-o.pad+2}">${b}</text><g clip-path="url(#dg-mm-${l})"><rect class="dg-mm-world" x="${pe}" y="${ve}" width="${h}" height="${I}"/>${V}<rect class="dg-mm-vp dg-a"${X===0?"":` y="${X*P}"`} width="${A*P}" height="${(u-X)*P}" rx="2" style="${J}"/></g>`}})(),Pe=X===0?"":`<g class="dg-hd"><rect class="dg-hd-bg" width="${A}" height="${X}"/><line class="dg-sep" x1="0" y1="${X}" x2="${A}" y2="${X}"/><g class="dg-a" style="${c.move(v.map(([V,J,,T,H])=>[V,A/2-J,0,T,H]))}">${s}</g></g>`;return{body:`<defs><clipPath id="dg-vp-${l}"><rect width="${A}" height="${u}" rx="${w.region.radius}"/></clipPath>${ye.clip}</defs><g clip-path="url(#dg-vp-${l})"><rect class="dg-vp-bg" width="${A}" height="${u}"/><g class="dg-a" style="${z}">${e}</g>${Pe}</g><rect class="dg-vp-frame" x="0.5" y="0.5" width="${A-1}" height="${u-1}" rx="${w.region.radius}"/>${ye.body}`,w:j&&!$?A+o.inset+ne:f,h:j?u:de+U}}function Cn(t,n){let a=Yn(t.palette);if(!t.colors)return a;let c=ze[t.lang??"ja"],l=Object.entries(t.colors).flatMap(([e,r])=>Vn(e)?Wn(r)?[]:[c.unreadableColor(e)]:[c.unknownColor(e)]);if(l.length>0)throw new Error(c.cannotDraw(l.join(" / ")));return{...a,[n]:{...a[n],...t.colors}}}function Xr(t,n={}){let a=n.lang??"ja",c=xr(t,{lang:a});if(!c.ok)throw new Error(ze[a].cannotDraw(c.errors.map(r=>`${r.pointer} ${r.message}`).join(" / ")));let l=c.diagram,e=l.kind==="sequence"?sr(l):l.kind==="state"?or(l,a):l.kind==="git"?rr(l):l.kind==="time"?mr(l,a):Jn(l);return Ri(l,e,$r(l,n.still===!0),n)}function Ri(t,n,a,c={}){let l=c.theme==="dark"?"dark":"light",e=Cn(c,l),r=[],s=[];return{svg:Dn(t,n,a,e,l,void 0,r,s),palette:e.id,theme:l,...t.view?{view:t.view}:{},fonts:{...Et},layout:n,timeline:a,diagram:t,overlaps:vr(r,a.stills,s)}}function In(t,n,a){let c=Math.max(0,n)/t.layout.width,e=(a===void 0?c:Math.min(c,Math.max(0,a)/t.layout.height))*O.boxName.size;return t.view?{mode:t.view,textPx:e}:{mode:e>=Hn?"fixed":"follow",textPx:e}}var xn=t=>`font:${t.weight} ${t.size}px var(--${t.family})`,Le=t=>`${t}px`;function Ai(){let t=w.player,n=Le(t.hidden);return[`.dg-player{display:flex;flex-direction:column;gap:${Le(t.gap)};color:var(--ink)}`,`.dg-player .dg-frame{border-radius:${Le(t.radius)};overflow:hidden}`,".dg-bar{container:dg-bar/inline-size}",`.dg-row{display:flex;align-items:flex-start;gap:${Le(t.gap)}}`,`.dg-btns{display:flex;gap:${Le(t.gap/2)};flex:none}`,`.dg-btn{width:${Le(t.button)};height:${Le(t.button)};border-radius:${Le(t.radius)};border:${Le(w.stroke.hair)} solid var(--hair);background:var(--surf);color:var(--ink);${xn(O.button)};cursor:pointer}`,`.dg-btn:focus-visible{outline:${Le(t.focus)} solid var(--c-blue);outline-offset:${Le(t.focus)}}`,`.dg-say{display:flex;gap:${Le(t.gap)};min-width:0}`,`.dg-no{${xn(O.stepNo)};color:var(--mute);padding-top:${Le(t.focus)}}`,".dg-txt{display:grid;grid-template-columns:minmax(0,1fr);min-width:0}",".dg-txt>*{grid-area:1/1}",".dg-room{visibility:hidden}",`.dg-tt{${xn(O.stepTitle)};margin:0}`,`.dg-tb{${xn(O.stepBody)};color:var(--ink2);margin:0;white-space:pre-line}`,`.dg-sr{position:absolute;width:${n};height:${n};margin:-${n};padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}`,`@container dg-bar (width < ${Le(t.narrow)}){.dg-row{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:0 ${Le(t.gap)}}.dg-say,.dg-txt,.dg-txt>*{display:contents}.dg-btns{grid-area:1/1;margin-bottom:${Le(t.gap/2)}}.dg-btn{width:${Le(t.touch)};height:${Le(t.touch)}}.dg-no{grid-area:1/2;display:flex;align-items:center;min-height:${Le(t.touch)};padding-top:0}.dg-tt{grid-area:2/1/3/3}.dg-tb{grid-area:3/1/4/3}}`,`@media (pointer: coarse){.dg-btn{width:${Le(t.touch)};height:${Le(t.touch)}}}`,`.dg-spot{fill:none;stroke:var(--t-amber);stroke-width:${Le(w.stroke.mark)};stroke-dasharray:${w.mark.dash} ${w.mark.gap};pointer-events:none}`].join("")}function ji(t){if(t.getElementById("dragon-player-css"))return;let n=t.createElement("style");n.id="dragon-player-css",n.textContent=Ai(),t.head.appendChild(n)}var At={prev:"\u2039",pause:"\u275A\u275A",play:"\u25B6",next:"\u203A"},Ur="http://www.w3.org/2000/svg",Jr=t=>String(t).padStart(2,"0"),Di=(t,n)=>`${Jr(t+1)}/${Jr(n)}`;function Zr(t,n,a={}){let c=t.ownerDocument,l=c.defaultView,e=!!l?.matchMedia?.("(prefers-reduced-motion: reduce)").matches,r=Xr(n,a),s=a.lang??"ja",i=ze[s],o=Cn(a,r.theme),{timeline:p}=r,f=r.diagram.steps,b=f.length;ji(c);let m=c.createElement("div");m.className="dg-player",m.dataset.dragon="player",m.setAttribute("style",`${Ct};${Dt(o,r.theme)}`);let d=c.createElement("div");d.className="dg-frame";let $=(B,_,Z)=>{let ae=c.createElement("button");return ae.type="button",ae.className="dg-btn",ae.dataset.dragon=B,ae.setAttribute("aria-label",_),ae.textContent=Z,ae},S=$("prev",i.prev,At.prev),u=$("toggle",i.pause,At.pause),h=$("next",i.next,At.next),P=c.createElement("div");P.className="dg-btns",P.setAttribute("lang",s),P.append(S,u,h);let I=c.createElement("div");I.className="dg-say",I.setAttribute("aria-hidden","true");let G=c.createElement("div");G.className="dg-no",G.dataset.dragon="step-no";let ne=c.createElement("div");ne.className="dg-txt";let U=c.createElement("p");U.className="dg-tt",U.dataset.dragon="step-title";let j=c.createElement("p");j.className="dg-tb",j.dataset.dragon="step-body";let A=c.createElement("div");A.append(U,j),ne.append(A);for(let B of f){let _=c.createElement("div");_.className="dg-room",_.dataset.dragon="caption-room";let Z=c.createElement("p");Z.className="dg-tt",Z.textContent=B.title;let ae=c.createElement("p");ae.className="dg-tb",ae.textContent=B.body,_.append(Z,ae),ne.append(_)}I.append(G,ne);for(let B of[G,U,j])B.setAttribute("aria-hidden","true");let C=c.createElement("div");C.className="dg-row",C.append(P,I);let K=c.createElement("div");K.className="dg-bar",K.append(C);let X=c.createElement("ol");X.className="dg-sr",X.dataset.dragon="steps",X.setAttribute("aria-label",i.steps(r.diagram.title));for(let B of f){let _=c.createElement("li"),Z=c.createElement("strong");Z.textContent=B.title,_.append(Z);for(let ae of B.body.split(`
2
- `)){let xe=c.createElement("p");xe.textContent=ae,_.append(xe)}if(B.sources){let ae=c.createElement("ul");for(let xe of B.sources){let qe=c.createElement("a");qe.href=xe.url,qe.textContent=xe.name;let Ae=c.createElement("li");Ae.append(qe),ae.append(Ae)}_.append(ae)}X.append(_)}m.append(d,K,X),t.append(m);let Q=()=>d.clientWidth||t.clientWidth||r.layout.width,ie=()=>{if(!a.fitHeight||!l)return;let B=l.getComputedStyle(d),_=d.clientHeight-(Number.parseFloat(B.paddingTop)||0)-(Number.parseFloat(B.paddingBottom)||0);return _>0?_:void 0},re=In(r,Q(),ie()).mode,D=Q(),x=ie(),N=null,E=a.pausedAt===void 0?0:Math.min(b-1,Math.max(0,a.pausedAt)),v=!e&&a.pausedAt===void 0,q=v?0:p.stills[E]??0,z=p.stills[b-1]??0,ee=Date.now(),de=[],ce=()=>{if(!N)return;for(let Z of N.querySelectorAll(".dg-spots"))Z.remove();if(de.length===0)return;let B=w.mark,_=c.createElementNS(Ur,"g");_.setAttribute("class","dg-spots");for(let Z of de){let ae=c.createElementNS(Ur,"rect");ae.setAttribute("class","dg-spot"),ae.setAttribute("x",String(Z.x-B.pad)),ae.setAttribute("y",String(Z.y-B.pad)),ae.setAttribute("width",String(Z.w+B.pad*2)),ae.setAttribute("height",String(Z.h+B.pad*2)),ae.setAttribute("rx",String(B.radius)),_.append(ae)}(N.querySelector('g[clip-path^="url(#dg-vp-"] > g.dg-a')??N).append(_)},pe=B=>{let _;if(B!==void 0){let Z=c.createElement("div");Z.innerHTML=B,_=Z.querySelector("svg")}else _=N?N.cloneNode(!0):null;_&&(_.setAttribute("aria-hidden","true"),_.removeAttribute("role"),_.removeAttribute("aria-label"),_.style.setProperty("--at",String(q)),_.style.setProperty("--play",v?"running":"paused"),_.dataset.motion=v?"play":"still",N?N.replaceWith(_):d.append(_),N=_,ee=Date.now(),ce())},ve=()=>re==="follow"?Dn(r.diagram,r.layout,p,o,r.theme,{width:D,...x===void 0?{}:{height:x},lang:s}):r.svg,we=()=>v?(q+(Date.now()-ee)/1e3)%p.total:q,ye=B=>{let _=0;return p.steps.forEach((Z,ae)=>{Z.start<=B&&(_=ae)}),_},Pe=()=>{let B=f[E];G.textContent=Di(E,b),U.textContent=B?.title??"",j.textContent=B?.body??"",u.setAttribute("aria-label",v?i.pause:i.play),u.textContent=v?At.pause:At.play,a.onStep?.(E)},k=(B,_)=>{q=B,v=_,pe(),Pe()},V=B=>{E=Math.min(b-1,Math.max(0,B));let _=p.steps[E];k(v?_.start:p.stills[E]??_.start,v)},J=()=>{a.playOnce&&q>=z&&(E=0,q=0),k(q,!0)};pe(ve()),Pe();let T=l?.setInterval(()=>{if(!v)return;if(a.playOnce&&q+(Date.now()-ee)/1e3>=z){E=b-1,k(z,!1);return}let B=ye(we());B!==E&&(E=B,Pe())},120),H=()=>V(E-1),y=()=>V(E+1),L=()=>v?k(we(),!1):J(),M=B=>{let _=B.target?.closest?.("[data-step]"),Z=_?Number(_.getAttribute("data-step")):Number.NaN;Number.isInteger(Z)&&V(Z)};S.addEventListener("click",H),h.addEventListener("click",y),u.addEventListener("click",L),d.addEventListener("click",M);let F=l?.ResizeObserver,te=F?new F(()=>{let B=Q(),_=ie(),Z=In(r,B,_).mode;if(Z===re&&(re==="fixed"||B===D&&_===x))return;let ae=we();re=Z,D=B,x=_,q=ae,pe(ve())}):void 0;return te?.observe(d),{get step(){return E},get playing(){return v},next:y,prev:H,play:()=>{v||J()},pause:()=>{v&&k(we(),!1)},goTo:B=>{v=!1,V(B)},mark:B=>{de=B,ce()},destroy:()=>{T!==void 0&&l?.clearInterval(T),te?.disconnect(),S.removeEventListener("click",H),h.removeEventListener("click",y),u.removeEventListener("click",L),d.removeEventListener("click",M),m.remove()}}}return is(Ci);})();
1
+ "use strict";var DragonPlayer=(()=>{var Mn=Object.defineProperty;var lr=Object.getOwnPropertyDescriptor;var cr=Object.getOwnPropertyNames;var pr=Object.prototype.hasOwnProperty;var dr=(t,n)=>{for(var l in n)Mn(t,l,{get:n[l],enumerable:!0})},mr=(t,n,l,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of cr(n))!pr.call(t,a)&&a!==l&&Mn(t,a,{get:()=>n[a],enumerable:!(c=lr(n,a))||c.enumerable});return t};var fr=t=>mr(Mn({},"__esModule",{value:!0}),t);var Qi={};dr(Qi,{mountDiagram:()=>or});var Sn=t=>/[0-9A-Za-z]$/u.test(t)?`${t} `:t,ur=t=>t.charAt(0).toUpperCase()+t.slice(1),et={ja:{cannotDraw:t=>`\u56F3\u3092\u63CF\u3051\u306A\u3044: ${t}`,unknownColor:t=>`colors \u306E ${t} \u306F\u8272\u5473\u306B\u7121\u3044\u8272\u306E\u540D\u524D`,unreadableColor:t=>`colors \u306E ${t} \u306E\u5024\u3092\u8272\u3068\u3057\u3066\u8AAD\u3081\u306A\u3044`,overview:"\u5168\u4F53\u56F3",prev:"\u524D\u306E\u6BB5",pause:"\u6B62\u3081\u308B",play:"\u52D5\u304B\u3059",next:"\u6B21\u306E\u6BB5",steps:t=>`${t} \u306E\u6BB5`,side:"\u8107\u9053",sideNote:"\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044",sideFrom:t=>`${t} \u3064\u306E\u72B6\u614B\u304B\u3089\u5165\u308C\u308B`,trail:"\u901A\u3063\u305F\u72B6\u614B",start:"\u59CB\u307E\u308A",end:"\u7D42\u308F\u308A",badgeName:t=>`\u6BB5\u306E\u756A\u53F7 ${t}`,quoted:t=>`\u300C${t}\u300D`,iconOf:t=>`\u300C${t} \u306E\u7D75\u67C4\u300D`,coin:"\u300C\u786C\u8CA8\u300D",envelope:"\u300C\u5C01\u7B52\u300D",textsOverlap:(t,n)=>`${Sn(t)}\u3068${Sn(n)}\u304C\u91CD\u306A\u308B`,lineCrosses:(t,n,l)=>`\u7DDA ${t} \u2192 ${n} \u304C${Sn(l)}\u3092\u6A2A\u5207\u308B`,timeUnits:{ms:"\u30DF\u30EA\u79D2",s:"\u79D2",min:"\u5206",h:"\u6642\u9593",d:"\u65E5"},zoom:"\u62E1\u5927",range:(t,n)=>`${t}\u301C${n}`,headJoin:" \u30FB ",empty:"\u7A7A\u304D"},en:{cannotDraw:t=>`Cannot draw the diagram: ${t}`,unknownColor:t=>`colors.${t} is not a color name of the palette`,unreadableColor:t=>`colors.${t} cannot be read as a color`,overview:"Overview",prev:"Previous step",pause:"Pause",play:"Play",next:"Next step",steps:t=>`Steps of ${t}`,side:"Side path",sideNote:"Not taken this time",sideFrom:t=>`Enterable from ${t} ${t===1?"state":"states"}`,trail:"States passed",start:"Start",end:"End",badgeName:t=>`step number ${t}`,quoted:t=>`"${t}"`,iconOf:t=>`the icon of "${t}"`,coin:"the coin",envelope:"the envelope",textsOverlap:(t,n)=>ur(`${t} and ${n} overlap`),lineCrosses:(t,n,l)=>`The line ${t} \u2192 ${n} crosses ${l}`,timeUnits:{ms:"ms",s:"s",min:"min",h:"h",d:"d"},zoom:"Zoom",range:(t,n)=>`${t}\u2013${n}`,headJoin:" \xB7 ",empty:"Empty"}};var zn={clear:{name:"\u6F84\u3093\u3060\u8272",note:"\u767D\u3044\u5730\u306B\u3001\u4E2D\u304F\u3089\u3044\u306E\u660E\u308B\u3055\u306E\u9BAE\u3084\u304B\u306A 6 \u8272\u3002\u4ECA\u306E\u898B\u672C\u5E33\u306E\u8272",light:{page:"#f3f4f7",bg:"#ffffff",surf:"#ffffff",sunk:"#f5f6f8",ink:"#12141a",ink2:"#3f4451",mute:"#6b7180",hair:"#12141a1c",line:"#12141a40",sh:"#101828","on-c":"#ffffff","c-blue":"#467deb","t-blue":"#2e62ce","c-amber":"#d28008","t-amber":"#975b04","c-green":"#0ea886","t-green":"#07775e","c-violet":"#6c3bb2","t-violet":"#6c3bb2","c-rose":"#ba3e40","t-rose":"#b83c3f","c-slate":"#5d6677","t-slate":"#5d6677",coin:"#e9b114",coint:"#856300",coinin:"#a8740c",tint:"5%",edge:"20%",shA:".05",shB:".08",carry:"#65686f"},dark:{page:"#08090c",bg:"#0d0e12",surf:"#17191f",sunk:"#121419",ink:"#eceef3",ink2:"#c4c8d2",mute:"#9198a6",hair:"#eceef31f",line:"#eceef340",sh:"#000000","on-c":"#0d0e12","c-blue":"#7e7ef6","t-blue":"#989cfd","c-amber":"#c78135","t-amber":"#dd954b","c-green":"#20ac7a","t-green":"#35b986","c-violet":"#695b9f","t-violet":"#a79ae3","c-rose":"#bc434b","t-rose":"#fd7d81","c-slate":"#9ba3b2","t-slate":"#9da5b4",coin:"#f0c040",coint:"#f0c040",coinin:"#9a6a0c",tint:"6%",edge:"19%",shA:".45",shB:".35"}},paper:{name:"\u7D19\u3068\u58A8",note:"\u751F\u6210\u308A\u306E\u7D19\u306E\u5730\u306B\u3001\u85CD / \u9EC4\u571F / \u82D4 / \u8461\u8404 / \u6731 / \u920D\u306E\u304F\u3059\u3093\u3060 6 \u8272",light:{page:"#ece7dd",bg:"#f9f6f0",surf:"#fffcf6",sunk:"#f2ede4",ink:"#221e18",ink2:"#4b453b",mute:"#7b7366",hair:"#221e181f",line:"#221e1847",sh:"#3a2a10","on-c":"#fffcf6","c-blue":"#487dd5","t-blue":"#2d60b5","c-amber":"#c38405","t-amber":"#885a01","c-green":"#57a271","t-green":"#237143","c-violet":"#904698","t-violet":"#904698","c-rose":"#a9513e","t-rose":"#9f4836","c-slate":"#6a645a","t-slate":"#696359",coin:"#d4a52a",coint:"#7d5e05",coinin:"#9a7016",tint:"6%",edge:"22%",shA:".06",shB:".07",carry:"#68635c"},dark:{page:"#0e0d0b",bg:"#15130f",surf:"#1e1b17",sunk:"#191612",ink:"#ede6d8",ink2:"#cbc2b1",mute:"#9c9283",hair:"#ede6d81f",line:"#ede6d842",sh:"#000000","on-c":"#15130f","c-blue":"#5785d5","t-blue":"#76a6f9","c-amber":"#be8802","t-amber":"#d59e2f","c-green":"#52aa71","t-green":"#61b87e","c-violet":"#90529b","t-violet":"#d08edb","c-rose":"#bb4e3d","t-rose":"#f98672","c-slate":"#a9a295","t-slate":"#aca598",coin:"#dcb24e",coint:"#dcb24e",coinin:"#8a6a14",tint:"6%",edge:"19%",shA:".45",shB:".35"}},night:{name:"\u591C\u306E\u8A08\u5668",note:"\u9752\u307F\u306E\u9ED2\u306E\u5730\u306B\u3001\u5149\u308B\u6C34\u8272 / \u7425\u73C0 / \u82E5\u7DD1 / \u83EB / \u6843 \u306E 6 \u8272\u3002\u660E\u308B\u3044\u5074\u306F\u9752\u7070\u306E\u5730",light:{page:"#e9eef5",bg:"#f6f9fc",surf:"#ffffff",sunk:"#eef3f8",ink:"#0b1424",ink2:"#34425a",mute:"#64748b",hair:"#0b14241c",line:"#0b142440",sh:"#0b1424","on-c":"#ffffff","c-blue":"#0385cd","t-blue":"#086aa3","c-amber":"#ba8e0f","t-amber":"#7f5f04","c-green":"#0a8857","t-green":"#027449","c-violet":"#5839ba","t-violet":"#5839ba","c-rose":"#dd4a94","t-rose":"#b82375","c-slate":"#64748b","t-slate":"#56667c",coin:"#eab308",coint:"#7e6005",coinin:"#a16207",tint:"5%",edge:"22%",shA:".06",shB:".09",carry:"#596579"},dark:{page:"#060a12",bg:"#0a101c",surf:"#111a2a",sunk:"#0d1522",ink:"#e6edf7",ink2:"#b8c4d6",mute:"#8090a8",hair:"#e6edf71c",line:"#9fb3d145",sh:"#000000","on-c":"#0a101c","c-blue":"#3884b6","t-blue":"#62ace1","c-amber":"#be8533","t-amber":"#d59b4b","c-green":"#3ba774","t-green":"#4fb884","c-violet":"#7d4ecd","t-violet":"#b494fd","c-rose":"#bc3a74","t-rose":"#ff77ad","c-slate":"#96a3b5","t-slate":"#99a6b8",coin:"#facc15",coint:"#facc15",coinin:"#a16207",tint:"6%",edge:"19%",shA:".5",shB:".4"}}};var At={sans:"Noto Sans JP Variable",mono:"JetBrains Mono Variable"},gr={0:590,1:590,2:590,3:590,4:590,5:590,6:590,7:590,8:590,9:590," ":228,"!":371,'"':575,"#":590,$:590,"%":963,"&":740,"'":325,"(":378,")":378,"*":507,"+":590,",":325,"-":371,".":325,"/":390,":":325,";":325,"<":590,"=":590,">":590,"?":514,"@":1007,A:642,B:682,C:657,D:715,E:616,F:586,G:718,H:758,I:330,J:568,K:686,L:579,M:854,N:750,O:771,P:668,Q:771,R:682,S:624,T:626,U:748,V:619,W:915,X:627,Y:581,Z:614,"[":378,"\\":390,"]":378,"^":590,_:568,"`":626,a:591,b:644,c:528,d:645,e:581,f:372,g:598,h:640,i:305,j:306,k:605,l:315,m:964,n:641,o:626,p:645,q:645,r:437,s:495,t:421,u:638,v:576,w:863,x:562,y:575,z:512,"{":378,"|":297,"}":378,"~":590,"\u2026":1e3,"\u2212":590,"\xD7":1e3,"\u2192":1e3,"\u2190":1e3,"\u2191":1e3,"\u2193":1e3,"\u2013":545,"\u2014":908,"\u2018":325,"\u2019":325,"\u201C":575,"\u201D":575,"\xB0":404,"\xB1":1e3,"\xB7":593,"\u2022":379},yr=600,br=11904,It=1e3;function Kn(t,n){return(t.codePointAt(0)??0)>=br?It:n==="mono"?yr:gr[t]??It}var xr="paper",Tn=Object.fromEntries(Object.entries(zn).map(([t,n])=>[t,{id:t,...n}]));function Xn(t){return(t!==void 0&&Object.hasOwn(Tn,t)?Tn[t]:void 0)??Tn[xr]}var wr=["page","bg","surf","sunk","ink","ink2","mute","hair","line","sh","on-c","c-blue","t-blue","c-amber","t-amber","c-green","t-green","c-violet","t-violet","c-rose","t-rose","c-slate","t-slate","coin","coint","coinin","tint","edge","shA","shB","carry"],$r=new Set(wr),Un=t=>$r.has(t);function Jn(t){if(typeof t!="string"||!/^[\w\s#%.,()/+-]+$/u.test(t)||/url\(/iu.test(t))return!1;let n=0;for(let l of t)if(n+=l==="("?1:l===")"?-1:0,n<0)return!1;return n===0}function Ft(t,n){return Object.entries(t[n]).map(([l,c])=>`--${l}:${c}`).join(";")}var Bt=`--sans:"${At.sans}";--mono:"${At.mono}"`,gt=["blue","amber","green","violet","rose"],we=(t,n,l="sans")=>({size:t,weight:n,family:l}),O={boxName:we(13,650),boxSub:we(11,500),boxSubStrong:we(11,700),regionName:we(12.5,700),regionNote:we(11,500),label:we(11,600,"mono"),labelJa:we(11,650),action:we(11,650),badge:we(10.5,700,"mono"),carrier:we(10.5,700,"mono"),carrierJa:we(10.5,700),stripTitle:we(12.5,700),fieldName:we(10.5,600),fieldValue:we(12,600,"mono"),fieldValueJa:we(12,600),tag:we(10.5,700),miniTitle:we(10.5,700),stepTitle:we(15,700),stepBody:we(13.5,500),stepNo:we(13,700,"mono"),button:we(14,700),gitId:we(11,700),gitHash:we(10.5,600,"mono"),gitNote:we(10.5,650),treeHash:we(13.5,700,"mono"),treeName:we(10.5,600),rootHash:we(15,700,"mono"),rootName:we(11,700),treeCard:we(11.5,650),timeHead:we(11,650,"mono"),timeRow:we(11,600),timeTick:we(10.5,600,"mono"),timePeriod:we(11.5,650),timeRange:we(10.5,500,"mono"),pointName:we(11,700,"mono"),pointState:we(11.5,700),spanText:we(11,650),emptyText:we(11,700),meterLine:we(10.5,700,"mono")},w={gap:10,margin:14,box:{h:72,minW:92,padX:12,radius:12,icon:24,iconRadius:7,iconY:-16,iconScale:.74,nameY:12,subY:27},region:{pad:18,gap:10,radius:14,inset:14,icon:24,iconRadius:7,iconScale:.68,nameY:58,line:16,minH:108},architecture:{columns:4,columnGap:56,maxColumnGap:160,rowGap:44,labelRoom:16},sequence:{columnGap:40,labelRoom:16,labelOffset:16,firstRow:10,rowGap:6,stepGap:6,minPitch:32,tail:10,selfW:34,selfH:18},state:{columns:4,columnGap:64,rowGap:108,labelRoom:16,start:7,end:{r:9,inner:5},drop:56,below:64,beside:38,text:16,loop:{w:24,h:34,samples:12,badgeAt:.6},side:{pad:16,gap:76,lane:30,entry:28},ghost:{h:52,pad:12,gap:10,nameY:-2,subY:14},done:{r:6.5,inset:13},pastLabel:.85},git:{x0:120,pitch:90,textGap:12,r:12,orphan:13.5,topLine:120,line:90,topBelow:30,below:82,bare:62,above:18,under:27,lineStep:13,tagTop:58,tag:30,row:22,turn:60,samples:12,boxGap:24,labelUnder:50,colors:["blue","violet","green","amber","rose"]},tree:{w:74,h:44,padX:10,radius:10,root:{w:112,h:54,radius:13,iconX:10,textX:46,padR:14,nameY:-4,hashY:14},hashY:-1,nameY:14,oneY:4.5,slotGap:12,top:16,row:102,card:{drop:78,h:30,minW:70,padX:10,icon:12,gap:6,glyph:.62,radius:9},boxGap:24,badgeAlong:22,faint:.42,color:"violet",rootColor:"green"},time:{width:728,axisX:118,right:16,gutterGap:12,head:22,boxTop:34,boxGap:36,zoomBottom:14,sep:12,zoomGap:12,rowsTop:24,row:20,rowGap:6,markRatio:.5,markMin:1.5,markMax:18,markRadius:1.5,shade:8,frame:2.5,emptyR:1.7,point:{drop:40,r:9,text:15,nameY:-2,stateY:12,link:10,end:6,room:30,plain:12,glyph:.62},bracket:{gap:12,tick:6,text:16,lane:34},box:{pad:6,tagX:12,tagH:16,tagPadX:7},axisGap:18,major:12,minor:6,minorPx:40,tickY:18,rangeY:14,nameGap:8,ticks:6,bottom:12,needle:{over:8,head:6,dot:3.5},meter:{w:150,h:6,y:36,mark:5,textY:59,color:"amber"}},edge:{inset:3,arrow:6,arrowHalf:3.5,parallel:5,ghostDash:5,flowDash:9,bend:12},label:{h:20,padX:9,radius:10,offset:22,side:14,search:4,searchMax:400,soft:6,touch:2},action:{h:22,padX:10,radius:11},badge:{r:9.5,ring:9,inset:4,along:14,short:44},carrier:{envW:24,envH:17,coinR:6.5,coinIn:3.8,tagH:18,tagPadX:8,samples:16},slot:{gap:6,pad:3,spread:4,h:24,radius:7,clear:2,lifeline:5,mark:4},mark:{pad:3,radius:5,dash:4,gap:3},strip:{h:72,line:44,pad:12,icon:24,titleX:44,fieldGap:22,sepInset:14,tagGap:6,tagH:15,tagPadX:7,nameY:22,valueY:43,trail:{r:5.4,step:16},now:{r:3,gap:7}},stroke:{git:2.25,gitOrphan:1.5,mark:1.6,slot:1.2,hair:1,edge:1.7,edgeOn:2.25,arrow:1.5,flow:1.3,halo:7,on:1.75,glyph:2,lifeline:1.2,envelope:1.5,badgeRing:1.5,path:1.6,end:1.6,done:1.2,trail:1.2,timeSlot:.6,timeFrame:1.25,timeAxis:1,timeSpan:1.5,timeDrop:1.4,timePoint:1.75,timeFlag:1.8,timeNeedle:1.25,timeMeter:1.25,tree:1.5,treeTrail:2.6,treeCon:1.3},shadow:{near:.8,far:4,nearY:1,farY:3},mini:{w:168,pad:8,title:14,inset:12,radius:10},follow:{aspect:.75,minH:320,fitMinH:160,ease:.6,narrow:440,badgeRoom:8,headRoom:10,head:{pad:8,h:40,nameY:17,subY:31}},mix:{slot:45,icon:14,regionIcon:16,regionIconEdge:34,cap:12,capEdge:42,badgePast:14,badgePastEdge:70,mini:62,miniBand:16,miniBandEdge:36,view:6,side:4,sideEdge:36,ghostEdge:60,path:55,past:72,timeShade:3.5,timeSpan:6,timeEmpty:8,timeGuide:50},baseline:{label:3.8,badge:3.5,carrier:3.7,stripTitle:4.5,tag:3.6,action:3.8,mark:4},rise:5,popFrom:.4,player:{gap:10,radius:12,button:36,touch:44,hidden:1,focus:2,narrow:440}},le={intro:1.4,outro:4.6,tail:.6,stepBase:1.2,perChar:.025,stepMin:2.2,stepMax:5,dwell:1.2,edgeAt:.1,stagger:.5,draw:.55,drawCarry:.9,action:.9,change:.12,minShow:.8,labelDelay:.15,fade:.3,popFade:.4,untilFade:.2,still:.45,done:.3,time:{axis:11.5,unitMin:.12,unitMax:.4,wait:.15,after:.15,reset:.05}},Zn=10.5,ge={inOut:"cubic-bezier(.65,0,.35,1)",out:"cubic-bezier(.22,1,.36,1)",pop:"cubic-bezier(.34,1.56,.64,1)"};var De=t=>[...t].some(n=>(n.codePointAt(0)??0)>=11904);function kr(t,n){return n==="mono"&&De(t)?"sans":n}function pe(t,n){let l=kr(t,n.family),c=0;for(let a of t)c+=Kn(a,l);return c*n.size/It}function He(t,n,l,c,a="start"){let e=pe(t,c);return{x:a==="middle"?n-e/2:n,y:l-c.size*.8,w:e,h:c.size}}function bt(t){return t.steps.flatMap((n,l)=>n.events.flatMap((c,a)=>c.type==="edge"?[{step:l,event:a,edge:c}]:[]))}function Xe(t){let n=Nn(t),l=new Map;return t.boxes.forEach((c,a)=>{let e=c.region===void 0?void 0:n.get(c.region);l.set(c.id,c.color??e??gt[a%gt.length])}),l}function Nn(t){let n=new Map;return(t.regions??[]).forEach((l,c)=>n.set(l.id,l.color??gt[c%gt.length])),n}var it=(t,n)=>t.carry.kind==="coin"?"coin":n.get(t.from)??"slate";function Ue(t,n,l){let c=t.boxes.find(e=>e.id===n);if(!c)return w.box.minW;let a=[pe(c.name,O.boxName),pe(c.sub??"",O.boxSub)];for(let e of t.steps)for(let s of e.events)s.type==="swap"&&s.box===n&&a.push(pe(s.text,O.boxSubStrong)),l&&s.type==="action"&&s.box===n&&a.push(pe(s.label,O.boxSubStrong));return Math.max(w.box.minW,Math.max(...a)+w.box.padX*2)}function ot(t){let n=w.carrier;return t.kind==="tag"?[(pe(t.text,De(t.text)?O.carrierJa:O.carrier)+n.tagPadX*2)/2,n.tagH/2]:t.kind==="coin"?[n.coinR,n.coinR]:[n.envW/2,n.envH/2]}var Qn=t=>t.main+t.coin+(t.main>0&&t.coin>0?w.slot.spread:0);function xt(t){let n=new Map,l=new Set(t.boxes.map(c=>c.id));for(let c of t.steps)for(let a of c.events){if(a.type!=="edge"||a.carry.kind==="none")continue;let e=a.carry.kind==="coin"?"coin":"main",s=ot(a.carry)[0]*2;for(let r of[a.from,a.to]){if(!l.has(r))continue;let o=n.get(r)??{main:0,coin:0};o[e]=Math.max(o[e],s),n.set(r,o)}}return n}function wt(t,n,l){return t?(n?w.box.icon+w.slot.gap:0)+Qn(t)+w.slot.pad*2+w.box.padX+l:0}function $t(t,n,l=w.box.padX){if(!n)return;let c=w.box,a=w.slot,e=Qn(n)+a.pad*2,s=t.icon?c.icon+a.gap:0,r=Math.max(t.x+c.padX,Math.min(t.cx-(s+e)/2,t.x+t.w-l-(s+e)));t.icon&&(t.iconX=r+c.icon/2),t.slot={x:r+s,y:t.cy+c.iconY-a.h/2,w:e,h:a.h}}function dt(t,n,l){let c=w.slot,a=(e,s)=>{let r=n.get(e),o=l.get(e);if(!r?.slot||!o)return;let i=r.slot.x+c.pad,p=r.slot.y+r.slot.h/2;return o.main>0&&o.coin>0?s.kind==="coin"?[i+o.main+c.spread+o.coin/2,p]:[i+o.main/2,p]:[r.slot.x+r.slot.w/2,p]};for(let e of t){if(e.carry.kind==="none")continue;let s=a(e.to,e.carry),r=a(e.from,e.carry);s&&(e.settle=s),r&&(e.wait=r)}}function yt(t,n){let l=Math.max(n.x-(t.x+t.w),t.x-(n.x+n.w)),c=Math.max(n.y-(t.y+t.h),t.y-(n.y+n.h));return Math.max(l,c)}function _t(t,n,l=0){let c=n.x+l,a=n.y+l,e=n.x+n.w-l,s=n.y+n.h-l;if(e<=c||s<=a)return!1;for(let r=1;r<t.length;r++){let[o,i]=t[r-1],[p,m]=t[r],u=p-o,d=m-i,f=0,y=1,k=(b,h)=>{if(b===0)return h>0;let P=h/b;return b<0?f=Math.max(f,P):y=Math.min(y,P),f<y};if(k(-u,o-c)&&k(u,e-o)&&k(-d,i-a)&&k(d,s-i))return!0}return!1}function vr(t){let n={a:t[0],b:t[1]??t[0],length:-1};for(let l=1;l<t.length;l++){let c=t[l-1],a=t[l],e=Math.hypot(a[0]-c[0],a[1]-c[1]);e>n.length&&(n={a:c,b:a,length:e})}return{a:n.a,b:n.b,vertical:Math.abs(n.b[0]-n.a[0])<Math.abs(n.b[1]-n.a[1])}}function Ke(t,n){let l=n;for(let c=1;c<t.length;c++){let a=t[c-1],e=t[c],s=Math.hypot(e[0]-a[0],e[1]-a[1]);if(l<=s&&s>0)return[a[0]+(e[0]-a[0])*l/s,a[1]+(e[1]-a[1])*l/s];l-=s}return t[t.length-1]}function mt(t){let n=0;for(let l=1;l<t.length;l++){let c=t[l-1],a=t[l];n+=Math.hypot(a[0]-c[0],a[1]-c[1])}return n}function Mt(t){let{w:n,h:l,samples:c}=w.state.loop,a=t.y+t.h,e=[t.cx+n/2,a],s=[t.cx+n*3/4,a+l*4/3],r=[t.cx-n*3/4,a+l*4/3],o=[t.cx-n/2,a+w.edge.inset];return Array.from({length:c+1},(i,p)=>{let m=p/c,u=1-m,d=f=>u*u*u*e[f]+3*u*u*m*s[f]+3*u*m*m*r[f]+m*m*m*o[f];return[d(0),d(1)]})}function Gt(t){let n=Math.max(...t.map(([a])=>a)),l=t[0][1],c=Math.max(...t.map(([,a])=>a));return[n+w.badge.r+w.badge.inset,l+(c-l)*w.state.loop.badgeAt]}function Yt(t,n){return{x:(t[0]?.[0]??0)-w.state.loop.w/2-n/2,y:Math.max(...t.map(([,l])=>l))+w.label.soft}}var En=w.state.loop.h+w.label.soft*2+w.label.h;function tt(t,n=[],l=[]){let c=mt(t),a=c<w.badge.short?Math.min(w.badge.r+1,c/2):w.badge.along,e=w.badge.r*2+w.badge.inset;for(let s=a;s<=c;s+=1){let r=Ke(t,s);if(n.every(([o,i])=>Math.hypot(r[0]-o,r[1]-i)>=e))return r}return Pr(t,a,n,l)??Ke(t,a)}function Pr(t,n,l,c){let a=mt(t),[e,s]=Ke(t,n),[r,o]=Ke(t,Math.max(0,n-1)),[i,p]=Ke(t,Math.min(a,n+1)),m=Math.hypot(i-r,p-o);if(m===0)return;let[u,d]=[-(p-o)/m,(i-r)/m],f=w.badge.r*2;for(let y of[w.edge.arrowHalf,0])for(let k=1;k<=f+w.badge.inset;k++)for(let b of[1,-1]){let h=[e+u*k*b,s+d*k*b];if(l.every(([q,R])=>Math.max(Math.abs(h[0]-q),Math.abs(h[1]-R))>=f+1)&&c.every(q=>!_t(q,Fe(h),-y)))return h}}var jt=t=>t.points.map(([n,l])=>`${Math.round(n*10)},${Math.round(l*10)}`).join(" ");function ft(t,n,l=(c,a,e)=>tt(c.points,a,e)){let c=new Map,a=[],e=new Map;for(let s=0;s<n;s++){let r=t.find(u=>u.step===s&&u.points.length>0);if(!r)continue;let o=jt(r),i=e.get(o);if(i){c.set(s,{point:i,edge:r});continue}let p=t.filter(u=>u.points.length>1&&jt(u)!==o).map(u=>u.points),m=l(r,a,p);a.push(m),e.set(o,m),c.set(s,{point:m,edge:r})}return c}function Je(t){let n=(l,c)=>Math.hypot(l.x-c.x,l.y-c.y)<=.5;return t.map(l=>{let c=t.filter(a=>a.step>l.step&&n(a,l)).sort((a,e)=>a.step-e.step)[0];return c?{...l,until:c.step}:l})}var Fe=([t,n])=>({x:t-w.badge.r,y:n-w.badge.r,w:w.badge.r*2,h:w.badge.r*2}),Vt=t=>[t.x+w.state.text,t.y+w.baseline.mark],Ve=t=>De(t)?O.labelJa:O.label,Mr={above:"below",below:"above",left:"right",right:"left"};function ze(t,n){let l=pe(t.text,Ve(t.text))+w.label.padX*2,c=w.label.h,a=vr(t.points),e=(a.a[0]+a.b[0])/2,s=(a.a[1]+a.b[1])/2,r=t.side??(a.vertical?"right":"above"),{side:o}=w.label,i=t.offset??w.label.offset,p=k=>k==="above"?{x:e-l/2,y:s-i-c/2,w:l,h:c}:k==="below"?{x:e-l/2,y:s+i-c/2,w:l,h:c}:k==="left"?{x:e-o-l,y:s-c/2,w:l,h:c}:{x:e+o,y:s-c/2,w:l,h:c},m=t.base?{...t.base,w:l,h:c}:p(r),u=t.flip?[r,Mr[r]]:[r],d=k=>n.hard.every(b=>yt(k,b)>=w.gap)&&n.soft.every(b=>yt(k,b)>=w.label.soft)&&(n.touch??[]).every(b=>yt(k,b)>=w.label.touch)&&(n.lines??[]).every(b=>!_t(b,k,-w.label.touch)),{search:f,searchMax:y}=w.label;for(let k=0;k<=y;k+=f)for(let b of u){let h=b===r?m:p(b),P=b==="above"?[0,-1]:b==="below"?[0,1]:b==="left"?[-1,0]:[1,0],q=[Math.abs(P[1]),Math.abs(P[0])],R=t.slide??(b==="above"||b==="below"?l:c*4);for(let N=0;N<=R;N+=f)for(let D of N===0?[1]:[1,-1]){let L={x:h.x+P[0]*k+q[0]*N*D,y:h.y+P[1]*k+q[1]*N*D,w:l,h:c};if(d(L))return{...L,step:t.step,event:t.event,text:t.text,family:Ve(t.text).family,color:t.color}}}return{...m,step:t.step,event:t.event,text:t.text,family:Ve(t.text).family,color:t.color}}function qn(t){let n=/^([0-9]+(?:\.[0-9]+)?)%$/u.exec(t.trim());if(n)return Math.min(1,Math.max(0,Number(n[1])/100));let l=/^([0-9]+)\/([0-9]+)$/u.exec(t.trim());if(l&&Number(l[2])>0)return Math.min(1,Math.max(0,Number(l[1])/Number(l[2])))}var es=(t,n)=>t.strip?.meters?.find(l=>l.field===n);function ts(t,n){if(es(t,n))return Math.max(pe(n,O.fieldName),w.time.meter.w);let l=0,c=0;for(let e of t.steps)for(let s of e.events)s.type!=="strip"||s.field!==n||(s.value!==void 0&&(l=Math.max(l,pe(s.value,De(s.value)?O.fieldValueJa:O.fieldValue))),s.tag!==void 0&&(c=Math.max(c,pe(s.tag,O.tag)+w.strip.tagPadX*2)));let a=l+(c>0?(l>0?w.strip.tagGap:0)+c:0);return Math.max(pe(n,O.fieldName),a)}var On=t=>Math.max(pe(t.title,O.fieldName),t.states.length*w.strip.trail.step);function Ze(t,n){if(!t.strip)return 0;let{titleX:l,fieldGap:c,pad:a}=w.strip,e=l+pe(t.strip.title,O.stripTitle)+c,s=[...t.strip.fields.map(r=>ts(t,r)),...n?[On(n)]:[]];return e+s.reduce((r,o)=>r+o+c,0)-c+a}function Qe(t,n,l,c,a){if(!t.strip)return;let{titleX:e,fieldGap:s,pad:r,line:o,h:i}=w.strip,p=e+pe(t.strip.title,O.stripTitle)+s,m=[],u=p,d=0,f=k=>{u>p&&u+k>c-r&&(u=p,d++);let b={x:n+u,y:l+d*o};return u+=k+s,b};for(let k of t.strip.fields){let b=ts(t,k),h=f(b),P=es(t,k),q=P?qn(P.line):void 0;m.push({name:k,...h,w:b,...P&&q!==void 0?{meter:{line:q,text:P.line,x:h.x,w:w.time.meter.w}}:{}})}let y=a?{...a,...f(On(a)),w:On(a)}:void 0;return{x:n,y:l,w:c,h:i+d*o,title:t.strip.title,fields:m,...y?{trail:y}:{}}}function St(t,n,l){let c=a=>{a.x+=n,a.y+=l};for(let a of t.boxes)c(a),a.cx+=n,a.cy+=l,a.slot&&c(a.slot),a.iconX!==void 0&&(a.iconX+=n);for(let a of t.regions)a.y+=l,c(a.header);for(let a of t.lifelines)a.x+=n,a.y1+=l,a.y2+=l;for(let a of t.edges)a.points=a.points.map(([e,s])=>[e+n,s+l]),a.settle&&(a.settle=[a.settle[0]+n,a.settle[1]+l]),a.wait&&(a.wait=[a.wait[0]+n,a.wait[1]+l]);for(let a of t.labels)c(a);for(let a of t.paths)a.points=a.points.map(([e,s])=>[e+n,s+l]),a.label&&c(a.label);for(let a of t.ends)a.x+=n,a.y+=l;t.side&&c(t.side);for(let a of t.actions)c(a);for(let a of t.badges)a.x+=n,a.y+=l;if(t.strip){t.strip.y+=l;for(let a of t.strip.fields)a.x+=n,a.y+=l,a.meter&&(a.meter.x+=n);t.strip.trail&&(t.strip.trail.x+=n,t.strip.trail.y+=l)}}function Tt(t,n,l){let{inset:c}=w.badge;for(let e of t){let s=e.type==="swap"||e.type==="action"?e.box:void 0,r=l.boxes.find(o=>o.id===s);if(r)return{step:n,x:r.x,y:r.y,color:r.color}}if(l.strip&&t.some(e=>e.type==="strip"))return{step:n,x:l.strip.x+c,y:l.strip.y+c,color:"slate"};let a=l.boxes[0];return{step:n,x:a.x,y:a.y,color:a.color}}function ss(t){let n=Sr(t),l=Tr(t,n),c=n.map(()=>({top:0,bottom:0})),a=ns(t,n,l,c);for(let e=0;e<3&&Er(a,n,l,c);e++)a=ns(t,n,l,c);return a}function Sr(t){let n=t.regions??[],l=new Set(n.map(e=>e.id)),c=n.map(e=>({region:e,members:t.boxes.filter(s=>s.region===e.id).map(s=>s.id)})),a=t.boxes.filter(e=>e.region===void 0||!l.has(e.region)).map(e=>e.id);return a.length>0&&c.push({members:a}),c}var rs=t=>t==="left"||t==="right";function Tr(t,n){let l=w.architecture.columns,c=bt(t).map(s=>s.edge),a=new Map;n.forEach((s,r)=>{let o=new Set(s.members),i=new Set,p=(b,h)=>b>=0&&b<l&&!i.has(`${b},${h}`),m=(b,h)=>{let P=Math.min(l-1,Math.max(0,b));for(let q=h;;q++)for(let R=0;R<l;R++)for(let N of[P+R,P-R])if(p(N,q))return[N,q]},u=(b,h,P)=>{a.set(b,{group:r,col:h,row:P}),i.add(`${h},${P}`)},d=1,f=b=>{for(let h of c){let P=h.from===b?h.to:h.to===b?h.from:void 0;if(P===void 0||!o.has(P)||a.has(P))continue;let q=a.get(b),[R,N]=rs(h.labelSide)?m(q.col,q.row+1):p(q.col+d,q.row)?[q.col+d,q.row]:m(q.col+d,q.row);u(P,R,N),f(P)}},y=b=>{for(let h=0;h<c.length;h++){let P=c[h],q=P?.from===b?P.to:P?.to===b?P.from:void 0,R=q===void 0?void 0:a.get(q);if(R&&R.group<r)return{order:h,col:R.col}}},k=0;for(;;){let b=s.members.filter(D=>!a.has(D));if(b.length===0)break;let h=b.map(D=>({id:D,anchor:y(D)})).filter(D=>D.anchor!==void 0);h.sort((D,L)=>(D.anchor?.order??0)-(L.anchor?.order??0));let P=h[0]??{id:b[0],anchor:void 0},q=P.anchor?.col??0;k===0&&(d=q>=(l-1)/2?-1:1);let[R,N]=p(q,0)?[q,0]:m(q,0);u(P.id,R,N),f(P.id),k++}});let e=[...new Set([...a.values()].map(s=>s.col))].sort((s,r)=>s-r);for(let s of a.values())s.col=e.indexOf(s.col);return a}function Or(t){let n=[...t.matchAll(/ /g)].map(c=>c.index);if(n.length===0)return[t];let l=n.reduce((c,a)=>Math.abs(a-t.length/2)<Math.abs(c-t.length/2)?a:c);return[t.slice(0,l),t.slice(l+1)]}function Nr(t){let{icon:n,nameY:l,line:c,inset:a}=w.region,e=Or(t.name),s=Math.max(n,...e.map(o=>pe(o,O.regionName)),pe(t.note??"",O.regionNote)),r=l-a+(e.length-1)*c+(t.note?c:0)+w.gap/2;return{w:s,h:r,lines:e}}function ns(t,n,l,c){let{box:a,region:e,architecture:s,margin:r,gap:o}=w,i=Xe(t),p=Nn(t),m=bt(t),u=Math.max(1,...[...l.values()].map(g=>g.col+1)),d=xt(t),f=new Map(t.boxes.map(g=>[g.id,Math.max(Ue(t,g.id,!0),wt(d.get(g.id),g.icon!==void 0,a.padX))])),y=Array.from({length:u},(g,I)=>Math.max(a.minW,...[...l].filter(([,E])=>E.col===I).map(([E])=>f.get(E)??a.minW))),k=Array.from({length:Math.max(0,u-1)},()=>s.columnGap);for(let{edge:g}of m){let I=l.get(g.from),E=l.get(g.to);if(!I||!E||g.label===void 0||I.group!==E.group||I.row!==E.row||Math.abs(I.col-E.col)!==1||rs(g.labelSide))continue;let Y=pe(g.label,Ve(g.label))+w.label.padX*2+s.labelRoom*2,ne=Math.min(I.col,E.col);Y<=s.maxColumnGap&&(k[ne]=Math.max(k[ne]??0,Y))}let b=n.map(g=>g.region?Nr(g.region):void 0),h=Math.max(0,...b.map(g=>g?g.w+e.inset*2:0)),P=[];for(let g=0;g<u;g++)P.push(g===0?r+(h>0?h:e.pad):P[g-1]+y[g-1]+k[g-1]);let q=g=>P[g]+y[g]/2,R=new Set(m.filter(({edge:g})=>g.from===g.to).map(({edge:g})=>g.from)),N=new Set([...R].flatMap(g=>{let I=l.get(g);return I?[`${I.group}:${I.row}`]:[]})),D=(g,I)=>N.has(`${g}:${I}`)?En:0,L=[],j=[],F=r;n.forEach((g,I)=>{let E=Math.max(1,...g.members.map(ke=>(l.get(ke)?.row??0)+1)),Y=c[I],ne=F+e.pad+Y.top,H=[0];for(let ke=1;ke<E;ke++)H.push(H[ke-1]+a.h+s.rowGap+D(I,ke-1));for(let ke of g.members){let qe=l.get(ke),je=t.boxes.find(Ye=>Ye.id===ke),Me=f.get(ke)??a.minW,Re=q(qe.col),Ge=ne+H[qe.row];L.push({id:ke,name:je?.name??ke,...je?.sub!==void 0?{sub:je.sub}:{},...je?.icon!==void 0?{icon:je.icon}:{},color:i.get(ke)??"slate",x:Re-Me/2,y:Ge,w:Me,h:a.h,cx:Re,cy:Ge+a.h/2})}let W=ne+H[E-1]+a.h+D(I,E-1),te=b[I],ce=Math.max(W+e.pad+Y.bottom-F,te?te.h+e.inset*2:0,g.region?e.minH:0);j.push({group:I,y:F,h:ce,rows:E}),F+=ce+e.gap});let X=F-e.gap;for(let g of L)$t(g,d.get(g.id));let U=new Map(L.map(g=>[g.id,g])),ee=g=>j[l.get(g)?.group??0],re=(g,I,E)=>{for(let Y=1;Y<g.length;Y++){let[ne,H]=g[Y-1],[W,te]=g[Y];if(Math.min(ne,W)<=I.x+I.w+E&&Math.max(ne,W)>=I.x-E&&Math.min(H,te)<=I.y+I.h+E&&Math.max(H,te)>=I.y-E)return!0}return!1},se=[...R].flatMap(g=>{let I=U.get(g);return I?[{x:I.x,y:I.y+I.h,w:I.w,h:En}]:[]}),G=g=>se.some(I=>re(g,I,0)),$=(g,I,E)=>L.some(Y=>Y.id!==I&&Y.id!==E&&re(g,Y,w.label.search))||G(g),A=g=>{let I=U.get(g),E=ee(g),Y=l.get(g),ne=I.y+I.h+(Y?D(Y.group,Y.row):0);return(Y?.row??0)<E.rows-1?ne+s.rowGap/2:Math.min(ne+e.pad/2,E.y+E.h-w.edge.inset)},C=g=>{let I=U.get(g),E=ee(g);return(l.get(g)?.row??0)>0?I.y-s.rowGap/2:Math.max(I.y-e.pad/2,E.y+w.edge.inset)},_=w.edge.inset,K=(g,I)=>I?P[g]+y[g]+(k[g]??s.columnGap)/2:P[g]-(k[g-1]??s.columnGap)/2,T=(g,I)=>{let E=U.get(g),Y=U.get(I);if(g===I)return Mt(E);let ne=l.get(g),H=l.get(I);if(ne.group===H.group&&ne.row===H.row){let Me=Y.cx>E.cx,Re=[[Me?E.x+E.w:E.x,E.cy],[Me?Y.x-_:Y.x+Y.w+_,Y.cy]];if(!$(Re,g,I))return Re;let Ge=A(g),Ye=[[E.cx,E.y+E.h],[E.cx,Ge],[Y.cx,Ge],[Y.cx,Y.y+Y.h+_]];if(!G(Ye))return Ye;let ut=C(g),ct=[[E.cx,E.y],[E.cx,ut],[Y.cx,ut],[Y.cx,Y.y-_]];return G(ct)?Ye:ct}let W=Y.cy>E.cy,te=[E.cx,W?E.y+E.h:E.y],ce=[Y.cx,W?Y.y-_:Y.y+Y.h+_];if(ne.col===H.col){let Me=[te,ce];if(!$(Me,g,I))return Me;let Re=K(ne.col,!0);return[[E.x+E.w,E.cy],[Re,E.cy],[Re,Y.cy],[Y.x+Y.w+_,Y.cy]]}let ke=Y.cx>E.cx,qe=W?A(g):C(g),je=[[te,[E.cx,Y.cy],[ke?Y.x-_:Y.x+Y.w+_,Y.cy]],[[ke?E.x+E.w:E.x,E.cy],[Y.cx,E.cy],ce],[te,[E.cx,qe],[Y.cx,qe],ce]];if(R.has(g)||R.has(I)){let Me=K(ne.col,ke),Re=K(H.col,!ke),Ge=[[ke?E.x+E.w:E.x,E.cy],[Me,E.cy]],Ye=[ke?Y.x-_:Y.x+Y.w+_,Y.cy];je.push([...Ge,[Me,Y.cy],Ye],[...Ge,[Me,qe],[Y.cx,qe],ce],[te,[E.cx,qe],[Re,qe],[Re,Y.cy],Ye],[...Ge,[Me,qe],[Re,qe],[Re,Y.cy],Ye])}return je.find(Me=>!$(Me,g,I))??je[2]},Z=m.map(({step:g,event:I,edge:E})=>({step:g,event:I,from:E.from,to:E.to,points:T(E.from,E.to),color:it(E,i),carry:E.carry}));dt(Z,U,d);let ie=new Map;for(let g of Z){if(g.points.length!==2||!Z.some(W=>W.from===g.to&&W.to===g.from&&W.points.length===2))continue;let[E,Y]=g.points,ne=Math.abs(Y[1]-E[1])<Math.abs(Y[0]-E[0]),H=(g.from<g.to?1:-1)*w.edge.parallel;g.points=g.points.map(([W,te])=>ne?[W,te+H]:[W+H,te]),ie.set(g,ne?H>0?"below":"above":H>0?"right":"left")}let ae=[];n.forEach((g,I)=>{let E=j[I],Y=b[I];!g.region||!Y||ae.push({id:g.region.id,lines:Y.lines,...g.region.note!==void 0?{note:g.region.note}:{},...g.region.icon!==void 0?{icon:g.region.icon}:{},color:p.get(g.region.id)??"slate",x:r,y:E.y,w:0,h:E.h,header:{x:r+e.inset,y:E.y+e.inset,w:Y.w,h:Y.h}})});let de=(g,I,E)=>g.from===g.to?Gt(g.points):tt(g.points,I,E),me=ft(Z,t.steps.length,de),ve=[];for(let g of Z){let I=t.steps[g.step]?.events[g.event];if(I?.type!=="edge"||I.label===void 0)continue;let E=[...me].filter(([W])=>W<=g.step).map(([,W])=>Fe(W.point)),Y=[...ae.map(W=>W.header),...ve.filter(W=>W.step===g.step)],ne=I.labelSide??ie.get(g),H=g.from===g.to?{side:"below",base:Yt(g.points,pe(I.label,Ve(I.label))+w.label.padX*2)}:void 0;ve.push(ze({step:g.step,event:g.event,text:I.label,points:g.points,color:g.color,...H??(ne?{side:ne}:{flip:!0})},{hard:L,soft:Y,touch:E}))}let xe={kind:"architecture",width:0,height:0,regions:ae,boxes:L,lifelines:[],edges:Z,labels:ve,actions:[],badges:[],paths:[],ends:[]},Te=ve.length>0?Math.max(0,r+w.label.soft-Math.min(...ve.map(g=>g.x))):0;Te>0&&St(xe,Te,0);let S=Math.max(...L.map(g=>g.x+g.w+e.pad),...ve.map(g=>g.x+g.w+w.label.soft),...Z.flatMap(g=>g.points.map(I=>I[0]+e.pad))),v=Math.max(S+r,Ze(t)+r*2);for(let g of ae)g.w=v-r*2;let z=Math.max(X,...ve.map(g=>g.y+g.h)),M=Qe(t,r,z+o,v-r*2);xe.width=v,xe.height=(M?M.y+M.h:z)+r,M&&(xe.strip=M);let V=ft(Z,t.steps.length,de);return xe.badges=Je(t.steps.map((g,I)=>{let E=V.get(I);return E?{step:I,x:E.point[0],y:E.point[1],color:E.edge.color}:Tt(g.events,I,xe)})),xe}function Er(t,n,l,c){let a=!1,e=w.label.soft;for(let s of t.labels){let r=t.edges.find(f=>f.step===s.step&&f.event===s.event),o=r&&l.get(r.from),i=r&&l.get(r.to);if(!o||!i||o.group!==i.group||!n[o.group]?.region)continue;let p=t.regions.find(f=>f.id===n[o.group]?.region?.id),m=c[o.group];if(!p||!m)continue;let u=p.y+e-s.y,d=s.y+s.h-(p.y+p.h-e);u>0&&(m.top+=u,a=!0),d>0&&(m.bottom+=d,a=!0)}return a}var Wt=t=>Object.keys(t),yo=Wt({sequence:!0,architecture:!0,state:!0,git:!0,time:!0,tree:!0}),Ot=["start","finish"],qr=["scale","period","row","point","zoom","mark","span"];var Lr=["leaf","node"],bo=["group","end","box","strip","step","say","code","source","act","note","set","branch","commit",...qr,...Lr];var kt="HEAD";var xo=Wt({coin:!0,none:!0}),wo=Wt({fixed:!0,follow:!0}),$o=Wt({above:!0,below:!0,left:!0,right:!0});var ls=t=>t.kind==="git";function Ar(t){let n=(t.git?.branches??[]).map(L=>L.id),l=L=>{n.includes(L)||n.push(L)};for(let L of t.steps)for(let j of L.events)(j.type==="commit"||j.type==="branch")&&l(j.branch);let c=new Map(n.map(L=>[L,null])),a=null,e=null,s=[],r=new Map,o=[],i=[],p=[],m=new Map,u=new Map,d=new Map,f=[...n,kt],y=new Map(f.map(L=>[L,[]])),k=[],b=L=>L===kt?e===null?a:null:c.get(L)??null,h=L=>{let j=m.get(L)??[],F=j.indexOf(null);return F<0?j.length:F},P=(L,j,F,X)=>{let U=new Map(f.map(G=>[G,b(G)])),ee=a;F();let se=f.filter(G=>U.get(G)!==b(G)).map(G=>{let $=d.get(G);return $&&(m.get($.commit)[$.row]=null,d.delete(G)),{ref:G,slot:$}});for(let{ref:G,slot:$}of se){let A=$??(G===kt&&ee!==null?{commit:ee,row:h(ee)}:void 0),C=b(G),_;if(C!==null){_={commit:C,row:h(C)};let K=m.get(C)??[];K[_.row]=G,m.set(C,K),u.set(C,Math.max(u.get(C)??0,K.filter(T=>T!==null).length)),d.set(G,_)}i.push({ref:G,step:L,event:j,...A?{from:A}:{},..._?{to:_}:{},line:G===X})}},q=(L,j)=>{let F=new Set,X=[...c.values(),a].filter(U=>U!==null);for(;X.length>0;){let U=X.pop();F.has(U)||(F.add(U),X.push(...r.get(U)?.parents??[]))}for(let U of s)!F.has(U.id)&&U.orphan===void 0&&(U.orphan={step:L,event:j})};t.steps.forEach((L,j)=>{L.events.forEach((F,X)=>{if(F.type==="commit")N(F,j,X);else if(F.type==="branch"){if(!r.has(F.from))return;R(F.from)!==F.branch&&o.push({kind:"branch",from:F.from,to:F.branch,step:j,event:X}),P(j,X,()=>{c.set(F.branch,F.from),e=F.branch,a=F.from})}else if(F.type==="edge"){let U=F.from;if(U!==kt&&!c.has(U)||!r.has(F.to))return;P(j,X,()=>{if(U===kt){e=null,a=F.to;return}c.set(U,F.to),e===U?a=F.to:e===null&&a===F.to&&(e=U)},U)}else return;q(j,X)});for(let F of f)y.get(F)?.push(F===kt?a:c.get(F)??null);k.push(e);for(let F of f){let X=d.get(F);X&&p.push({ref:F,step:j,slot:X})}});function R(L){return r.get(L)?.branch}function N(L,j,F){if(r.has(L.id))return;let X=L.copy!==void 0&&r.has(L.copy)?L.copy:void 0,U=X!==void 0&&e===null&&a!==null?a:c.get(L.branch)??null,ee=L.merge!==void 0&&L.merge!==L.branch?c.get(L.merge)??void 0:void 0,re=[...new Set([U,ee].filter($=>$!=null))],se={id:L.id,branch:L.branch,parents:re,...ee!==void 0&&ee!==U?{joined:ee}:{},...X!==void 0?{copy:X}:{},...L.hash!==void 0?{hash:L.hash}:{},...L.note!==void 0?{note:L.note}:{},step:j,event:F};s.push(se),r.set(se.id,se);for(let $ of re)o.push({kind:"parent",from:$,to:se.id,step:j,event:F});X!==void 0&&o.push({kind:"copy",from:X,to:se.id,step:j,event:F});let G=e===null&&a===null;P(j,F,()=>{X===void 0?(c.set(L.branch,se.id),e===L.branch&&(a=se.id)):e===null&&(a=se.id),G&&(e=L.branch,a=se.id)})}let D=f.map(L=>({name:L,at:y.get(L)??[],...L===kt?{attached:k}:{}}));return{branches:n,made:s,links:o,moves:i,refs:D,tags:p,rows:u}}function Ht(t,n,l,c){let a=w.git.samples;return Array.from({length:a},(e,s)=>{let r=(s+1)/a,o=1-r,i=p=>o*o*o*t[p]+3*o*o*r*n[p]+3*o*r*r*l[p]+r*r*r*c[p];return[i(0),i(1)]})}function jr(t,n){return Math.abs(t[1]-n[1])<.5?[t,n]:t[1]>n[1]?[t,[t[0],n[1]],n]:[t,[n[0],t[1]],n]}function is(t,n,l){let c=l>t.cy?1:-1,a=[t.cx,t.cy+c*t.r],e=Math.max(0,Math.min(w.git.turn,n-t.cx)),s=[t.cx+e,l],r=Ht(a,[a[0],a[1]+(l-a[1])*.7],[t.cx+e*.2,l],s);return[a,...r,...n>s[0]?[[n,l]]:[]]}function Rr(t,n){let l=n.cy<t.cy?1:-1,c=[t.cx+t.r,t.cy],a=[n.cx,n.cy+l*n.r],e=Math.max(0,Math.min(w.git.turn,n.cx-c[0])),s=[n.cx-e,t.cy],r=Ht(s,[n.cx-e*.2,t.cy],[n.cx,a[1]+(t.cy-a[1])*.7],a);return[c,...s[0]>c[0]?[s]:[],...r]}function Dr(t,n){if(Math.abs(t.cy-n.cy)<.5){let s=t.cy-t.r,r=w.git.turn*.7;return[[t.cx,s],...Ht([t.cx,s],[t.cx,s-r],[n.cx,s-r],[n.cx,s])]}let l=n.cy<t.cy?-1:1,c=[t.cx,t.cy+l*t.r],a=[n.cx,n.cy-l*n.r],e=(a[1]-c[1])*.5;return[c,...Ht(c,[c[0],c[1]+e],[a[0],a[1]-e],a)]}function cs(t){let{margin:n,gap:l,box:c,region:a,git:e,carrier:s}=w,r=Ar(t),o=new Map((t.git?.branches??[]).map(S=>[S.id,S.note])),i=new Map(r.branches.map((S,v)=>[S,v])),p=S=>e.colors[(i.get(S)??0)%e.colors.length],m=new Map,u=new Map;for(let S of r.made){let v=Math.max(0,...S.parents.map(z=>(m.get(z)??-1)+1),(u.get(S.branch)??-1)+1);m.set(S.id,v),u.set(S.branch,v)}let d=S=>[...S.hash!==void 0?[{text:S.hash,style:O.gitHash}]:[],...S.note!==void 0?[{text:S.note,style:O.gitNote}]:[]],f=S=>Math.max(0,...d(S).map(v=>pe(v.text,v.style))),y=S=>pe(S,De(S)?O.carrierJa:O.carrier)+s.tagPadX*2,k=Math.max(0,...r.refs.map(S=>y(S.name))),b=Math.max(e.pitch,...r.made.map(S=>f(S)+e.textGap),k+e.textGap),h=r.branches.map(S=>({w:Math.max(a.icon,pe(S,O.regionName),pe(o.get(S)??"",O.regionNote))})),P=n+a.inset+Math.max(0,...h.map(S=>S.w)),q=Math.max(e.r,...r.made.filter(S=>m.get(S.id)===0&&i.get(S.branch)===0).map(S=>f(S)/2),k/2),R=Math.max(e.x0,P+l+q),N=new Set(r.moves.flatMap(S=>{let v=t.steps[S.step]?.events[S.event];return S.line&&S.to&&v?.type==="edge"&&v.label!==void 0?[r.made.find(z=>z.id===S.to?.commit)?.branch??""]:[]})),D=S=>Math.max(0,...r.made.filter(v=>v.branch===S).map(v=>(r.rows.get(v.id)??0)-2))*e.row,L=r.made.some(S=>i.get(S.branch)===0&&d(S).length>0),j=[],F=n;r.branches.forEach((S,v)=>{let z=v===0,M=z&&L?e.tagTop:e.tag,V=F+(z?e.topLine-(e.tagTop-M):e.line)+D(S),g=V-F+(z?e.topBelow:N.has(S)?e.below:e.bare);j.push({id:S,x:n,y:F,w:0,h:g,line:V,color:p(S),tagBase:M}),F+=g+a.gap});let X=F-a.gap,U=new Map(j.map(S=>[S.id,S])),ee=r.made.map(S=>{let v=U.get(S.branch),z=i.get(S.branch)===0,M=R+b*(m.get(S.id)??0)+(z?0:b/2),V=v.line,g=d(S),I=g.map((H,W)=>z?V-e.above-(g.length-1-W)*e.lineStep:V+e.under+W*e.lineStep),E=g.map((H,W)=>He(H.text,M,I[W],H.style,"middle")),Y=E.length===0?void 0:{...Cr(E),lines:g.map(H=>H.text),baselines:I},ne=S.copy!==void 0?p(r.made.find(H=>H.id===S.copy)?.branch??S.branch):p(S.branch);return{id:S.id,branch:S.branch,color:ne,cx:M,cy:V,r:e.r,step:S.step,event:S.event,parents:S.parents,...S.copy!==void 0?{copy:S.copy}:{},...S.hash!==void 0?{hash:S.hash}:{},...S.note!==void 0?{note:S.note}:{},...Y?{text:Y}:{},...S.orphan?{orphan:S.orphan.step,orphanEvent:S.orphan.event}:{}}}),re=new Map(ee.map(S=>[S.id,S])),se=r.links.flatMap(S=>{let v=re.get(S.from);if(!v)return[];if(S.kind==="branch"){if(!r.made.some(I=>I.branch===S.to))return[];let g=U.get(S.to);return[{...S,points:is(v,v.cx+e.turn,g.line),color:p(S.to)}]}let z=re.get(S.to),M=r.made.find(g=>g.id===S.to),V;return S.kind==="copy"?V=Dr(v,z):Math.abs(v.cy-z.cy)<.5?V=[[v.cx+v.r,v.cy],[z.cx-z.r,z.cy]]:M?.joined===S.from?V=Rr(v,z):V=is(v,z.cx-z.r,z.cy),[{...S,points:V,color:z.color}]}),G=(S,v)=>{let z=re.get(v.commit),M=U.get(z.branch)?.tagBase??e.tag,V=y(S);return{x:z.cx-V/2,y:z.cy-M-v.row*e.row-s.tagH/2,w:V,h:s.tagH}},$=S=>[S.x+S.w/2,S.y+S.h/2],A=r.moves.map(S=>{let v=S.from?G(S.ref,S.from):void 0,z=S.to?G(S.ref,S.to):void 0,M=t.steps[S.step]?.events[S.event],V=S.line&&M?.type==="edge"&&M.carry.kind!=="none"&&!(M.carry.kind==="tag"&&M.carry.text===M.from);return{ref:S.ref,step:S.step,event:S.event,...v?{from:v}:{},...z?{to:z}:{},...S.to?{target:S.to.commit}:{},...V?{carried:!0}:{},...S.line&&v&&z?{line:jr($(v),$(z))}:{},color:"slate"}}),C=r.tags.map(S=>({...G(S.ref,S.slot),ref:S.ref,step:S.step})),_=Xe(t),K=Math.max(R,...ee.flatMap(S=>[S.cx+S.r,...S.text?[S.text.x+S.text.w]:[]]),...C.map(S=>S.x+S.w),...A.flatMap(S=>[S.from,S.to].flatMap(v=>v?[v.x+v.w]:[]))),T=K+e.boxGap,Z=(j[1]??j[0])?.line??n+c.h/2,ie=t.boxes.map((S,v)=>{let z=Ue(t,S.id,!0),M=Z+v*(c.h+l);return{id:S.id,name:S.name,...S.sub!==void 0?{sub:S.sub}:{},...S.icon!==void 0?{icon:S.icon}:{},color:_.get(S.id)??"slate",x:T,y:M-c.h/2,w:z,h:c.h,cx:T+z/2,cy:M}}),ae=j.map((S,v)=>{let z=o.get(S.id);return{id:S.id,lines:[S.id],...z!==void 0?{note:z}:{},icon:"branch",color:S.color,x:S.x,y:S.y,w:0,h:S.h,header:{x:S.x+a.inset,y:S.y+a.inset,w:h[v]?.w??0,h:a.nameY-a.inset+(z!==void 0?a.line:0)+l/2}}}),de={kind:"git",width:0,height:0,regions:ae,boxes:ie,lifelines:[],edges:[],labels:[],actions:[],badges:[],paths:[],ends:[],lanes:j,commits:ee,links:se,tags:C,refs:r.refs,moves:A};de.badges=as(t,de),de.labels=Br(t,de);let me=Math.max(K,...ie.map(S=>S.x+S.w),...de.labels.map(S=>S.x+S.w))+a.pad,ve=Math.max(me+n,Ze(t)+n*2);for(let S of ae)S.w=ve-n*2;for(let S of j)S.w=ve-n*2;let xe=Math.max(X,...ie.map(S=>S.y+S.h),...de.labels.map(S=>S.y+S.h)),Te=Qe(t,n,xe+l,ve-n*2);return de.width=ve,de.height=(Te?Te.y+Te.h:xe)+n,Te&&(de.strip=Te),de.badges=as(t,de),de}function Cr(t){let n=Math.min(...t.map(c=>c.x)),l=Math.min(...t.map(c=>c.y));return{x:n,y:l,w:Math.max(...t.map(c=>c.x+c.w))-n,h:Math.max(...t.map(c=>c.y+c.h))-l}}function Ir(t,n){return[...t.links.filter(c=>c.step===n&&c.kind!=="copy").map(c=>({event:c.event,points:c.points,color:c.color})),...t.moves.flatMap(c=>{let a=t.commits.find(e=>e.id===c.target);return c.step===n&&c.line&&a?[{event:c.event,target:a,color:a.color}]:[]})].sort((c,a)=>c.event-a.event)[0]}function os(t,n,l){let{r:c,inset:a}=w.badge,e=t.r+a+c,s=c*2+a;return[[t.cx+e,t.cy],[t.cx,t.cy+e],[t.cx-e,t.cy],[t.cx,t.cy-e]].find(o=>n.every(([i,p])=>Math.hypot(o[0]-i,o[1]-p)>=s)&&l.every(i=>yt(Fe(o),i)>=w.label.touch))}function Fr(t,n,l){let{r:c,inset:a,along:e,short:s}=w.badge,r=mt(t),o=r<s?Math.min(c+1,r/2):e,i=c*2+a;for(let p=o;p<=r;p+=1){let m=Ke(t,p),u=Fe(m);if(n.every(([d,f])=>Math.hypot(m[0]-d,m[1]-f)>=i)&&l.every(d=>yt(u,d)>=w.label.touch))return m}}function as(t,n){let{inset:l}=w.badge,c=[],a=[...n.links.map(r=>r.points),...n.moves.flatMap(r=>r.line?[r.line]:[])],e=[],s=[...n.tags,...n.commits.flatMap(r=>[{x:r.cx-r.r,y:r.cy-r.r,w:r.r*2,h:r.r*2},...r.text?[r.text]:[]])];return t.steps.forEach((r,o)=>{let i=Ir(n,o),p=i?.target?os(i.target,c,s):void 0;if(i&&(i.points||p)){let k=i.points,b=p??(k?Fr(k,c,s)??tt(k,c,a.filter(h=>h!==k)):[0,0]);c.push(b),e.push({step:o,x:b[0],y:b[1],color:i.color});return}let m=r.events.flatMap(k=>k.type==="swap"||k.type==="action"?[k.box]:[]).map(k=>n.boxes.find(b=>b.id===k))[0];if(m){e.push({step:o,x:m.x,y:m.y,color:m.color});return}if(n.strip&&r.events.some(k=>k.type==="strip")){e.push({step:o,x:n.strip.x+l,y:n.strip.y+l,color:"slate"});return}let u=n.commits.find(k=>k.id===n.refs[0]?.at[o]),d=u?os(u,c,s):void 0;if(u&&d){c.push(d),e.push({step:o,x:d[0],y:d[1],color:u.color});return}let f=e[e.length-1],y=n.lanes[0];e.push(f?{...f,step:o}:{step:o,x:(y?.x??0)+(y?.w??0)-l-w.badge.r,y:(y?.y??0)+l+w.badge.r,color:y?.color??"slate"})}),Je(e)}function Br(t,n){let l=w.git,c=[],a=n.commits.map(r=>({x:r.cx-r.r,y:r.cy-r.r,w:r.r*2,h:r.r*2})),e=n.commits.flatMap(r=>r.text?[r.text]:[]),s=n.regions.map(r=>r.header);for(let r of n.moves){let o=t.steps[r.step]?.events[r.event];if(o?.type!=="edge"||o.label===void 0||!r.line)continue;let i=n.commits.find(h=>h.id===o.to);if(!i)continue;let p=n.lanes[0]?.id===i.branch,m=pe(o.label,De(o.label)?O.labelJa:O.label)+w.label.padX*2,[u]=r.line.reduce((h,P)=>[h[0]+P[0]/r.line.length,0],[0,0]),d=Math.max(0,...n.tags.filter(h=>h.step===r.step&&Math.abs(h.x+h.w/2-i.cx)<.5).map(h=>i.cy-h.y)),f=o.labelSide??(p?"above":"below"),y=o.labelSide!==void 0?void 0:p?{x:u-m/2,y:i.cy-Math.max(d,(n.lanes[0]?.tagBase??l.tag)+w.carrier.tagH/2)-w.label.soft-w.label.h}:{x:u-m/2,y:i.cy+l.labelUnder},k=n.badges.filter(h=>h.step<=r.step).map(h=>Fe([h.x,h.y])),b=n.tags.filter(h=>h.step===r.step);c.push(ze({step:r.step,event:r.event,text:o.label,points:r.line,color:r.color,side:f,...y?{base:y}:{}},{hard:[...a,...n.boxes],soft:[...e,...b,...s,...c.filter(h=>h.step===r.step)],touch:k}))}return c}function ps(t){let{box:n,sequence:l,label:c,margin:a,gap:e}=w,s=Xe(t),r=t.sequence?.lifelines??[],o=[...r,...t.boxes.map(G=>G.id).filter(G=>!r.includes(G))],i=new Map(o.map((G,$)=>[G,$])),p=o.map(G=>Ue(t,G,!1)),m=p.slice(1).map((G,$)=>p[$]/2+G/2+l.columnGap),u=[];for(let G of t.steps)for(let $ of G.events){if($.type!=="edge"||$.label===void 0)continue;let A=i.get($.from)??0,C=i.get($.to)??0,_=pe($.label,Ve($.label))+c.padX*2;A===C?A<m.length&&u.push({from:A,to:A+1,need:l.selfW+c.side+_+l.labelRoom}):u.push({from:Math.min(A,C),to:Math.max(A,C),need:_+l.labelRoom*2})}u.sort((G,$)=>G.to-G.from-($.to-$.from));for(let{from:G,to:$,need:A}of u){let C=0;for(let K=G;K<$;K++)C+=m[K]??0;if(C>=A)continue;let _=(A-C)/($-G);for(let K=G;K<$;K++)m[K]=(m[K]??0)+_}let d=[];o.forEach((G,$)=>d.push($===0?a+p[0]/2:d[$-1]+m[$-1]));let f=o.map((G,$)=>{let A=t.boxes.find(K=>K.id===G),C=p[$],_=d[$];return{id:G,name:A?.name??G,...A?.sub!==void 0?{sub:A.sub}:{},...A?.icon!==void 0?{icon:A.icon}:{},color:s.get(G)??"slate",x:_-C/2,y:a,w:C,h:n.h,cx:_,cy:a+n.h/2}}),y=a+n.h,k=[],b=[],h=[],P=y+l.firstRow,q=0,R=!0;t.steps.forEach((G,$)=>{G.events.forEach((A,C)=>{if(A.type!=="edge"&&A.type!=="action")return;let _,K;if(A.type==="edge"){let T=A.labelSide??"above",Z=A.from===A.to,ie=A.label!==void 0;_=ie&&T==="above"?l.labelOffset+c.h/2:e,K=Z?l.selfH+e:ie&&T==="below"?l.labelOffset+c.h/2:e}else _=w.action.h/2,K=w.action.h/2;if(P=R?P+_:P+Math.max(l.minPitch,q+l.rowGap+_)+(C===0&&$>0?l.stepGap:0),R=!1,q=K,A.type==="edge"){let T=d[i.get(A.from)??0],Z=d[i.get(A.to)??0],ie=Math.sign(Z-T)||1,ae=T===Z?[[T,P],[T+l.selfW,P],[T+l.selfW,P+l.selfH],[T+w.edge.inset,P+l.selfH]]:[[T,P],[Z-ie*w.edge.inset,P]],de=it(A,s),me={};if(A.carry.kind!=="none"){let ve=w.slot.lifeline+ot(A.carry)[0],[xe,Te]=ae,[S,v]=ae.slice(-2),z=Math.sign(Te[0]-xe[0])||1,M=Math.sign(v[0]-S[0])||-1;me.wait=[T-z*ve,xe[1]],me.settle=[Z+M*ve,v[1]]}k.push({step:$,event:C,from:A.from,to:A.to,points:ae,color:de,carry:A.carry,...me}),A.label!==void 0&&h.push({step:$,event:C,text:A.label,points:ae,color:de,...A.labelSide?{side:A.labelSide}:T===Z?{side:"right"}:{},offset:l.labelOffset})}else{let T=d[i.get(A.box)??0],Z=pe(A.label,O.action)+w.action.padX*2;b.push({step:$,event:C,box:A.box,text:A.label,color:s.get(A.box)??"slate",x:T+w.badge.r+4,y:P-w.action.h/2,w:Z,h:w.action.h})}})});let N=(R?y:P+q)+l.tail,D=o.map((G,$)=>({id:G,x:d[$],y1:y,y2:N})),L=ft(k,t.steps.length),j=[];for(let G of h){let $=[...L].filter(([C])=>C<=G.step).map(([,C])=>Fe(C.point)),A=[...j.filter(C=>C.step===G.step),...b];j.push(ze(G,{hard:f,soft:A,touch:$}))}let F={kind:"sequence",width:0,height:0,regions:[],boxes:f,lifelines:D,edges:k,labels:j,actions:b,badges:[],paths:[],ends:[]},X=[...f.map(G=>G.x),...j.map(G=>G.x),...b.map(G=>G.x)],U=Math.max(0,a-Math.min(...X));U>0&&St(F,U,0);let ee=[...f.map(G=>G.x+G.w),...j.map(G=>G.x+G.w),...b.map(G=>G.x+G.w),...k.flatMap(G=>G.points.map($=>$[0]))],re=Math.max(Math.max(...ee)+a,Ze(t)+a*2),se=Qe(t,a,N+e,re-a*2);return F.width=re,F.height=(se?se.y+se.h:N)+a,se&&(F.strip=se),F.badges=_r(t,F),F}function _r(t,n){let l=ft(n.edges,t.steps.length),c=t.steps.map((a,e)=>{let s=l.get(e);if(s)return{step:e,x:s.point[0],y:s.point[1],color:s.edge.color};let r=n.actions.find(i=>i.step===e),o=r&&n.lifelines.find(i=>i.id===r.box);return r&&o?{step:e,x:o.x,y:r.y+r.h/2,color:r.color}:Tt(a.events,e,n)});return Je(c)}var ds=t=>Ot.includes(t);function Gr(t){let n=[],l=c=>{!ds(c)&&!n.includes(c)&&n.push(c)};for(let{edge:c}of bt(t))l(c.from),l(c.to);return n}var Yr=(t,n)=>t.from===n.from&&t.to===n.to;function ms(t,n){let{box:l,state:c,margin:a,gap:e}=w,s=w.edge.inset,r=et[n],o=Xe(t),i=bt(t),p=Gr(t),m=t.boxes.map(x=>x.id).filter(x=>!p.includes(x)),u=(t.state?.paths??[]).filter(x=>!i.some(({edge:B})=>Yr(B,x))),d=[...i.map(({edge:x})=>x),...u],f=c.ghost,y=x=>{let B=t.boxes.find(J=>J.id===x);return f.pad*2+l.icon+f.gap+Math.max(pe(B?.name??x,O.boxName),pe(B?.sub??"",O.boxSub))},k=xt(t),b=Math.max(l.padX,c.done.inset+c.done.r+w.slot.clear),h=new Map(t.boxes.map(x=>[x.id,m.includes(x.id)?y(x.id):Math.max(Ue(t,x.id,!0),wt(k.get(x.id),x.icon!==void 0,b))])),P=Math.max(1,Math.min(c.columns,p.length)),q=Math.max(1,Math.ceil(p.length/c.columns)),R=new Map(p.map((x,B)=>{let J=Math.floor(B/c.columns),ye=B%c.columns;return[x,{row:J,col:J%2===0?ye:P-1-ye}]})),N=Array.from({length:P},(x,B)=>Math.max(l.minW,...p.filter(J=>R.get(J)?.col===B).map(J=>h.get(J)??l.minW))),D=Array.from({length:Math.max(0,P-1)},()=>c.columnGap);for(let x of d){let B=R.get(x.from),J=R.get(x.to);if(!B||!J||x.label===void 0||B.row!==J.row||Math.abs(B.col-J.col)!==1)continue;let ye=Math.min(B.col,J.col);D[ye]=Math.max(D[ye]??0,pe(x.label,Ve(x.label))+w.label.padX*2+c.labelRoom*2)}let L=[];for(let x=0;x<P;x++)L.push(x===0?a:L[x-1]+N[x-1]+D[x-1]);let j=x=>L[x]+N[x]/2,F=x=>m.includes(x),X=new Set(u.filter(x=>F(x.to)&&!F(x.from)&&!ds(x.from)).map(x=>x.from)),U=[r.sideNote,...X.size>0?[r.sideFrom(X.size)]:[]],ee=Math.max(pe(r.side,O.regionName),...U.map(x=>pe(x,O.regionNote))),re=c.side.pad*2+Math.max(f.h,O.regionName.size+w.region.line*U.length+c.side.pad/4),se=d.some(x=>x.from==="start"),G=a+(m.length>0?re+c.side.gap:se?c.start+c.drop:0),$=x=>G+x*(l.h+c.rowGap),A=(x,B,J,ye)=>{let he=t.boxes.find(Ne=>Ne.id===x),be=h.get(x)??l.minW,We=ye?f.h:l.h;return{id:x,name:he?.name??x,...he?.sub!==void 0?{sub:he.sub}:{},...he?.icon!==void 0?{icon:he.icon}:{},color:o.get(x)??"slate",x:B-be/2,y:J,w:be,h:We,cx:B,cy:J+We/2,...ye?{ghost:!0}:{}}},C=p.map(x=>{let B=R.get(x);return A(x,j(B.col),$(B.row),!1)});for(let x of C)$t(x,k.get(x.id),b);let _=new Map(C.map(x=>[x.id,x])),K=x=>C.some(B=>B!==x&&Math.abs(B.cx-x.cx)<.5&&B.y>x.y),T=[],Z=C[0],ie=Math.max(...C.map(x=>x.x+x.w)),ae,de=a+re+c.side.lane;if(m.length>0){let x=Ne=>u.filter(Ie=>Ie.to===Ne).flatMap(Ie=>_.get(Ie.from)??[]),B=m.flatMap(x),J=Math.max(a,Math.min(...B.length>0?B.map(Ne=>Ne.x):[a+c.side.pad])-c.side.pad),ye=J+c.side.pad+ee+e*2,he=m.map(Ne=>{let Ie=x(Ne);return{id:Ne,cx:Ie.length>0?Ie.reduce((ht,vt)=>ht+vt.cx,0)/Ie.length:ye}});he.sort((Ne,Ie)=>Ne.cx-Ie.cx);let be=J;for(let{id:Ne,cx:Ie}of he){let ht=h.get(Ne)??l.minW,vt=Math.max(Ie-ht/2,ye),pt=A(Ne,vt+ht/2,a+(re-f.h)/2,!0);C.push(pt),_.set(Ne,pt);let Wn=u.some(Hn=>Hn.from===Ne&&Hn.to==="finish");Wn&&T.push({kind:"finish",x:pt.x+pt.w+c.beside,y:pt.cy,r:c.end.r,ghost:!0,text:"",box:Ne}),be=Wn?pt.x+pt.w+c.beside+c.end.r:pt.x+pt.w,ye=be+e*2}let We=Math.max(be+c.side.pad,ie);ae={x:J,y:a,w:We-J,h:re,title:r.side,notes:U}}if(Z&&se){let x=Z.cx+c.start+c.text+pe(r.start,O.regionNote)+e,B=ae&&x<ae.x?ae.y+c.side.pad+c.start:Z.y-c.drop;T.unshift({kind:"start",x:Z.cx,y:B,r:c.start,ghost:!1,text:r.start})}for(let x of C.filter(B=>!B.ghost&&d.some(J=>J.from===B.id&&J.to==="finish")))T.push(K(x)?{kind:"finish",x:x.x+x.w+c.beside,y:x.cy,r:c.end.r,ghost:!1,text:r.end,box:x.id}:{kind:"finish",x:x.cx,y:x.y+x.h+c.below,r:c.end.r,ghost:!1,text:r.end,box:x.id});let me=(x,B)=>{let J=R.get(x.id),ye=R.get(B.id);if(!J||!ye)return[[x.cx,x.y+x.h],[B.cx,B.y-s]];if(J.row===ye.row&&Math.abs(J.col-ye.col)===1)return B.cx>x.cx?[[x.x+x.w,x.cy],[B.x-s,B.cy]]:[[x.x,x.cy],[B.x+B.w+s,B.cy]];if(J.row===ye.row){let be=x.y+x.h+c.rowGap/4;return[[x.cx,x.y+x.h],[x.cx,be],[B.cx,be],[B.cx,B.y+B.h+s]]}if(ye.row>J.row){if(Math.abs(x.cx-B.cx)<.5)return[[x.cx,x.y+x.h],[B.cx,B.y-s]];let be=x.y+x.h+c.rowGap/2;return[[x.cx,x.y+x.h],[x.cx,be],[B.cx,be],[B.cx,B.y-s]]}if(Math.abs(x.cx-B.cx)<.5)return[[x.cx,x.y],[B.cx,B.y+B.h+s]];let he=B.y+B.h+c.rowGap/2;return[[x.cx,x.y],[x.cx,he],[B.cx,he],[B.cx,B.y+B.h+s]]},ve=(x,B)=>{let J=u.filter(he=>he.to===B.id).flatMap(he=>_.get(he.from)??[]).sort((he,be)=>he.cx-be.cx),ye=J.findIndex(he=>he.id===x);return J.length<=1?Math.min(Math.max(J[0]?.cx??B.cx,B.x+c.side.entry),B.x+B.w-c.side.entry):B.x+c.side.entry+(B.w-c.side.entry*2)*Math.max(0,ye)/(J.length-1)},xe=x=>se&&x===Z?x.cx+c.side.entry:x.cx,Te=x=>T.find(B=>B.kind==="finish"&&B.box===x),S=(x,B)=>{if(x==="start"){let he=T.find(We=>We.kind==="start"),be=_.get(B);return!he||!be?[]:[[he.x,he.y+he.r],[be.cx,be.y-s]]}let J=_.get(x);if(!J)return[];if(B==="finish"){let he=Te(x);return he?Math.abs(he.x-J.cx)<.5?[[J.cx,J.y+J.h],[J.cx,he.y-he.r-s]]:[[J.x+J.w,J.cy],[he.x-he.r-s,J.cy]]:[]}let ye=_.get(B);if(!ye)return[];if(x===B)return Mt(J);if(ye.ghost&&!J.ghost){let he=xe(J),be=ve(x,ye);return Math.abs(he-be)<.5?[[he,J.y],[be,ye.y+ye.h+s]]:[[he,J.y],[he,de],[be,de],[be,ye.y+ye.h+s]]}return J.ghost&&ye.ghost?[[J.x+J.w,J.cy],[ye.x-s,ye.cy]]:J.ghost?[[J.cx,J.y+J.h],[J.cx,de],[ye.cx,de],[ye.cx,ye.y-s]]:me(J,ye)},v=x=>{let B=x.to==="finish"?Te(x.from):void 0;if(!B)return;let J=_.get(x.from);return J&&Math.abs(B.x-J.cx)<.5?[B.x-B.r-e-ot(x.carry)[0],B.y]:[B.x,B.y+B.r+e+w.carrier.tagH/2]},z=x=>{let B=x.from==="start"?T.find(J=>J.kind==="start"):void 0;return B?[B.x-B.r-w.slot.mark-ot(x.carry)[0],B.y]:void 0},M=i.map(({step:x,event:B,edge:J})=>{let ye=v(J),he=J.carry.kind==="none"?void 0:z(J);return{step:x,event:B,from:J.from,to:J.to,points:S(J.from,J.to),color:Vr(J,o),carry:J.carry,...ye?{settle:ye}:{},...he?{wait:he}:{}}});dt(M,_,k);let V=new Map;for(let x of M){if(x.points.length!==2||!M.some(be=>be.from===x.to&&be.to===x.from&&be.points.length===2))continue;let[B,J]=x.points,ye=Math.abs(J[1]-B[1])<Math.abs(J[0]-B[0]),he=(x.from<x.to?1:-1)*w.edge.parallel;x.points=x.points.map(([be,We])=>ye?[be,We+he]:[be+he,We]),V.set(x,ye?he>0?"below":"above":he>0?"right":"left")}let g=u.map(x=>({from:x.from,to:x.to,points:S(x.from,x.to)})),I=(x,B,J)=>x.from===x.to?Gt(x.points):tt(x.points,B,J),E=[],Y=T.flatMap(x=>x.text===""?[]:[He(x.text,...Vt(x),O.regionNote)]),ne=[...ft(M,t.steps.length,I).values()].map(x=>Fe(x.point)),H=[...ae?[{x:ae.x,y:ae.y,w:c.side.pad+ee,h:ae.h}]:[],...Y],W=x=>[...M.map(B=>B.points),...g.map(B=>B.points)].filter(B=>B!==x);for(let x of M){let B=t.steps[x.step]?.events[x.event];if(B?.type!=="edge"||B.label===void 0)continue;let J=x.from===x.to,ye=jt(x),he=E.filter(ht=>ht.text===B.label&&M.some(vt=>vt.step===ht.step&&vt.event===ht.event&&jt(vt)===ye)),be=he[he.length-1];if(be){be.until=x.step,E.push({x:be.x,y:be.y,w:be.w,h:be.h,step:x.step,event:x.event,text:be.text,family:be.family,color:x.color});continue}let We=pe(B.label,Ve(B.label))+w.label.padX*2,Ne=J?{side:"below",base:Yt(x.points,We)}:{},Ie=B.labelSide??(x.to==="finish"?"left":V.get(x));E.push(ze({step:x.step,event:x.event,text:B.label,points:x.points,color:x.color,...Ie?{side:Ie}:J?{}:{flip:!0},...Ne},{hard:C,soft:[...H,...E],touch:ne,lines:W(x.points)}))}let te=[];u.forEach((x,B)=>{let J=g[B];if(x.label===void 0||J.points.length===0)return;let ye=Ve(x.label),he=_.get(x.to)?.ghost===!0&&_.get(x.from)?.ghost!==!0,be=J.points[0][0],We=he?{side:"below",base:{x:be+w.label.soft,y:de+w.label.soft},slide:Math.max(...J.points.map(([Ie])=>Math.abs(Ie-be)))}:{},Ne=ze({step:-1,event:B,text:x.label,points:J.points,color:"slate",...We},{hard:C,soft:[...H,...E,...te],touch:ne,lines:W(J.points)});te.push(Ne),J.label={x:Ne.x,y:Ne.y,w:Ne.w,h:Ne.h,text:x.label,family:ye.family}});let ce={kind:"state",width:0,height:0,regions:[],boxes:C,lifelines:[],edges:M,labels:E,actions:[],badges:[],paths:g,ends:T,...ae?{side:ae}:{}},ke=[...C.map(x=>x.x),...E.map(x=>x.x),...g.flatMap(x=>x.label?[x.label.x]:[])],qe=[...E.map(x=>x.y),...g.flatMap(x=>x.label?[x.label.y]:[])],je=Math.max(0,a-Math.min(...ke)),Me=qe.length>0?Math.max(0,a-Math.min(...qe)):0;(je>0||Me>0)&&St(ce,je,Me);let Re=x=>x.x+(x.text===""?x.r:c.text+pe(x.text,O.regionNote)),Ge=[...C.map(x=>x.x+x.w),...E.map(x=>x.x+x.w),...T.map(Re),...M.flatMap(x=>x.points.map(B=>B[0])),...g.flatMap(x=>[...x.points.map(B=>B[0]),...x.label?[x.label.x+x.label.w]:[]]),...ae?[ae.x+ae.w]:[]],Ye=[...C.map(x=>x.y+x.h),...E.map(x=>x.y+x.h),...T.map(x=>x.y+x.r),...M.flatMap(x=>x.points.map(B=>B[1]))],ut={title:r.trail,states:p.map(x=>({box:x,color:o.get(x)??"slate"}))},ct=Math.max(Math.max(...Ge)+a,Ze(t,ut)+a*2),qt=Math.max(...Ye,$(q-1)+l.h),Lt=Qe(t,a,qt+e,ct-a*2,ut);ce.width=ct,ce.height=(Lt?Lt.y+Lt.h:qt)+a,Lt&&(ce.strip=Lt);let ar=ft(M,t.steps.length,I);return ce.badges=Je(t.steps.map((x,B)=>{let J=ar.get(B);return J?{step:B,x:J.point[0],y:J.point[1],color:J.edge.color}:Tt(x.events,B,ce)})),ce}function Vr(t,n){return t.carry.kind==="coin"?it(t,n):n.get(t.to==="finish"?t.from:t.to)??"slate"}var Ln=t=>t.kind==="time",zt={d:86400,h:3600,min:60,s:1,ms:.001},Wr=Object.keys(zt);function Hr(t){let n=/^([0-9]+(?:\.[0-9]+)?)(ms|s|min|h|d)$/u.exec(t);if(!n)return{seconds:1,unit:"s"};let l=n[2];return{seconds:Number(n[1])*zt[l],unit:l}}var fs=(t,n)=>Wr.find(l=>t/zt[l]>=2-1e-9)??n,us=(t,n,l)=>`${Number((t/zt[n]).toFixed(2))} ${et[l].timeUnits[n]}`;function zr(t,n,l){let c=1;if(n)c=n*Math.max(1,Math.ceil(t/n/8));else for(let s=1;;s*=10){let r=[s,s*2,s*5].find(o=>t/o<=w.time.ticks);if(r!==void 0){c=r;break}}let a=[];for(let s=0;s<=t;s+=c)a.push(s);let e=a[a.length-1];return e!==t&&(t-e)*l>=w.time.minorPx&&a.push(t),{at:a,step:c}}function Kr(t,n,l,c){let a=Array.from({length:n-1},(s,r)=>r+1).find(s=>n%s===0&&s*l>=w.time.minorPx);if(a===void 0)return[];let e=[];for(let s=a;s<t;s+=a)c.includes(s)||e.push(s);return e}function hs(t){let n=0;return t.steps.map(l=>{let c=n;for(let a of l.events)a.type==="now"&&(n=Math.max(n,a.to+1));return[c,n]})}function ys(t,n="ja"){let l=w.time,{margin:c,gap:a}=w,e=w.region,s=et[n],r=t.time??{scale:{unit:"",length:"1s",count:1},rows:[]},{scale:o}=r,i=Math.max(1,o.count),p=Hr(o.length),m=Math.max(l.width,Ze(t)+c*2),u=Math.max(0,...r.rows.map(M=>pe(M.name,O.timeRow))),d=Math.max(l.axisX,c+e.inset+u+l.gutterGap),f=m-l.right-d,y=f/i,k=Xe(t),b=xt(t),h=[],P=[],q=[],R=[],N=new Map(r.rows.map(M=>[M.id,M])),D,L=c;if(r.zoom){let{from:M,to:V}=r.zoom,g=V-M+1,I=f/g,E=c,Y=fs(V*p.seconds,p.unit),ne=[];for(let te=0;te<g;te++){let ce=M+te,ke=d+te*I,qe=t.boxes.map((Me,Re)=>{let Ge=b.get(Me.id),Ye=Math.max(Ue(t,Me.id,!1),wt(Ge,Me.icon!==void 0,w.box.padX)),ut=E+l.boxTop+Re*(w.box.h+l.boxGap),ct=N.get(Me.id),qt={id:Me.id,name:Me.name,...Me.sub!==void 0?{sub:Me.sub}:{},...Me.icon!==void 0?{icon:Me.icon}:{},color:k.get(Me.id)??"slate",x:ke+I/2-Ye/2,y:ut,w:Ye,h:w.box.h,cx:ke+I/2,cy:ut+w.box.h/2,...ct?{row:ct.id}:{},...ct?.empty?.includes(ce)?{empty:!0}:{}};return $t(qt,Ge),qt});P.push(...qe);let je=`${o.unit} ${(o.from??0)+ce}${s.headJoin}${us(ce*p.seconds,Y,n)}`;ne.push({unit:ce,head:je,boxes:qe,x:ke,y:E,w:I,h:0})}let W=Math.max(E+l.boxTop,...P.map(te=>te.y+te.h))+l.zoomBottom;for(let te of ne)te.h=W-E;h.push({id:"zoom",lines:[s.zoom],note:`${g} ${o.unit}`,icon:"clock",color:"blue",x:c,y:E,w:m-c*2,h:W-E,header:{x:c+e.inset,y:E+e.inset,w:Math.max(e.icon,pe(s.zoom,O.regionName)),h:e.nameY-e.inset+e.line}}),D={from:M,to:V,frame:{x:0,y:0,w:0,h:0},guides:[],columns:ne,empty:s.empty,headY:E+l.head},L=W+l.zoomGap}let j=L+l.rowsTop,F=r.rows.map((M,V)=>({id:M.id,name:M.name,color:M.color??k.get(M.id)??gt[V%gt.length],x:d,y:j+V*(l.row+l.rowGap),w:f,h:l.row})),X=F.length>0?Math.max(...F.map(M=>M.y+M.h)):j,U=Math.min(l.markMax,Math.max(l.markMin,y*l.markRatio)),ee=F.flatMap((M,V)=>Array.from({length:i},(g,I)=>({row:M.id,unit:I,empty:r.rows[V]?.empty?.includes(I)===!0,color:M.color,colors:[],x:d+(I+.5)*y-U/2,y:M.y,w:U,h:M.h})));if(t.steps.forEach((M,V)=>M.events.forEach((g,I)=>{if(g.type==="mark")for(let E of ee)E.row===g.row&&E.unit>=g.from&&E.unit<=g.to&&!E.empty&&E.colors.push({step:V,event:I,color:g.color})})),D){let M={x:d+D.from*y-l.frame,y:j-l.frame,w:(D.to-D.from+1)*y+l.frame*2,h:X-j+l.frame*2},V=Math.max(...D.columns.map(g=>g.y+g.h));D.frame=M,D.guides=[[[M.x,M.y],[d,V]],[[M.x+M.w,M.y],[d+f,V]]]}let re=X+l.point.drop,se=(r.points??[]).map(M=>{let V=[];t.steps.forEach((H,W)=>H.events.forEach((te,ce)=>{te.type==="swap"&&te.box===M.id&&V.push({step:W,event:ce,text:te.text,...te.color?{color:te.color}:{}})}));let g=d+(M.at+.5)*y,I=g+l.point.text,E=Math.max(pe(M.id,O.pointName),...V.map(H=>pe(H.text,O.pointState))),Y=re+l.point.nameY-O.pointName.size*.8,ne=re+l.point.stateY+O.pointState.size*.2;return{id:M.id,unit:M.at,cx:g,cy:re,r:l.point.r,text:{x:I,y:Y,w:E,h:ne-Y},changes:V}}),G=new Map(se.map(M=>[M.id,M])),$=(M,V)=>G.get(M)?.changes.filter(I=>I.step<=V&&I.color).at(-1)?.color;t.steps.forEach((M,V)=>M.events.forEach((g,I)=>{if(g.type!=="edge")return;if(g.at===void 0){let ne=G.get(g.from),H=G.get(g.to);if(!ne||!H||ne===H)return;let W=H.cx>ne.cx,te=W?Math.max(ne.cx+ne.r,ne.text.x+ne.text.w+l.point.link):ne.cx-ne.r-l.point.end,ce=W?H.cx-H.r-l.point.end:Math.min(H.cx-H.r,H.text.x+H.text.w+l.point.link),ke={step:V,event:I,from:g.from,to:g.to,points:[[te,ne.cy],[ce,H.cy]],color:g.carry.kind==="coin"?"coin":$(g.to,V)??"slate",carry:g.carry};g.carry.kind!=="none"&&(ke.settle=[ce-(W?1:-1)*(w.carrier.coinR+w.edge.arrow),H.cy]),q.push(ke);return}let E=Xr(g,D);if(!E)return;let Y={step:V,event:I,from:g.from,to:g.to,points:E.points,color:it(g,k),carry:g.carry};Ur(Y,E.from,E.to,b),q.push(Y),R.push({step:V,event:I,from:E.from,to:E.to,column:g.at,into:g.into??g.at})}));let A={kind:"time",width:m,height:0,regions:h,boxes:P,lifelines:[],edges:q,labels:[],actions:[],badges:[],paths:[],ends:[],axis:{x:d,w:f,unit:y,count:i,line:0},rows:F,marks:ee,ticks:[],minor:[],periods:[],points:se,...D?{zoom:D}:{},spans:[],wires:R,needle:{y1:j-l.needle.over,y2:X+l.needle.over}},C=X,_=t.steps.some(M=>M.events.some(V=>V.type==="edge"&&V.at===void 0&&V.label!==void 0)),{r:K,inset:T}=w.badge,Z=se.length>0?re+l.point.r+(_?l.point.room:l.point.plain):C+(K+T)*2,ie=[],ae=t.steps.flatMap((M,V)=>M.events.flatMap((g,I)=>g.type==="span"?[{s:V,e:I,event:g}]:[]));for(let{s:M,e:V,event:g}of ae){let I=g.shape==="box"?"box":"bracket",E=ae.find(te=>te.s>M&&(te.event.shape==="box"?"box":"bracket")===I&&te.event.from<=g.to&&g.from<=te.event.to),Y=g.color??"slate",ne=d+g.from*y,H=d+(g.to+1)*y,W={step:M,event:V,kind:I,from:g.from,to:g.to,text:g.text,color:Y,...E?{until:E.s}:{}};if(I==="box"){let te=l.box,ce={x:ne-te.pad,y:j-te.pad,w:H-ne+te.pad*2,h:X-j+te.pad*2},ke=pe(g.text,O.tag)+te.tagPadX*2,qe={x:ce.x+te.tagX,y:ce.y-te.tagH/2,w:ke,h:te.tagH};ie.push({...W,...ce,textRect:qe,textY:ce.y+w.baseline.tag})}else ie.push({...W,x:ne,y:0,w:H-ne,h:l.bracket.tick,textRect:{x:0,y:0,w:0,h:0},textY:0})}A.spans=ie,A.badges=gs(t,A,hs(t)),A.labels=Zr(t,A),Z=Math.max(Z,...A.labels.map(M=>M.y+M.h+w.label.soft));let de=[];for(let M of ie.filter(V=>V.kind==="bracket")){let V=pe(M.text,O.spanText),g=Math.min(d+f-V/2,Math.max(d+V/2,M.x+M.w/2)),I={x:Math.min(M.x,g-V/2),w:Math.max(M.x+M.w,g+V/2)-Math.min(M.x,g-V/2)},E=ne=>{let H=ne.until===void 0||ne.until>M.step,W=Math.min(ne.x,ne.textRect.x),te=Math.max(ne.x+ne.w,ne.textRect.x+ne.textRect.w)-W;return H&&I.x<W+te&&W<I.x+I.w},Y=de.findIndex(ne=>!ne.some(E));Y<0&&(de.push([]),Y=de.length-1),de[Y].push(M),M.y=Z+l.bracket.gap+Y*l.bracket.lane,M.textY=M.y+l.bracket.tick+l.bracket.text,M.textRect=He(M.text,g,M.textY,O.spanText,"middle")}de.length>0&&(Z=Math.max(...ie.filter(M=>M.kind==="bracket").map(M=>M.textRect.y+M.textRect.h)));let me=Z+l.axisGap;A.axis.line=me;let ve=zr(i,r.period?.length,y),xe=me+l.tickY,Te=fs(i*p.seconds,p.unit);A.ticks=ve.at.map(M=>{let V=us(M*p.seconds,Te,n),g=pe(V,O.timeTick),I=d+M*y,E=M===0?I:M===i?I-g:Math.min(d+f-g,Math.max(d,I-g/2));return{at:M,x:I,text:V,left:E,y:xe}}),A.minor=Kr(i,ve.step,y,ve.at);let S=xe+O.timeTick.size*.2;if(r.period){let M=r.period,V=[];for(let E=0,Y=0;Y<i;E++,Y+=M.length){let ne=Math.min(i,Y+M.length)-1,H=`${M.name} ${(M.from??0)+E}`,W=(o.from??0)+Y,te=`${o.unit} ${s.range(String(W),String((o.from??0)+ne))}`;V.push({index:E,from:Y,to:ne,name:H,range:te,x:d+Y*y,y:me,w:(ne-Y+1)*y,h:0,nameY:xe,rangeY:xe+l.rangeY})}let g=A.ticks.map(E=>He(E.text,E.left,E.y,O.timeTick)),I=V.some(E=>{let Y=He(E.name,E.x+E.w/2,E.nameY,O.timePeriod,"middle");return g.some(ne=>Y.x<ne.x+ne.w+l.nameGap&&ne.x<Y.x+Y.w+l.nameGap)});for(let E of V)I&&(E.nameY=xe+l.rangeY+2,E.rangeY=E.nameY+l.rangeY),E.h=E.rangeY+O.timeRange.size*.2-me;A.periods=V,S=Math.max(S,...V.map(E=>E.rangeY+O.timeRange.size*.2))}let v=S+l.bottom;h.push({id:"axis",lines:[],color:"slate",x:c,y:L,w:m-c*2,h:v-L,header:{x:c+e.inset,y:L+e.inset,w:0,h:0}});let z=Qe(t,c,v+a,m-c*2);return z&&(A.strip=z),A.height=(z?z.y+z.h:v)+c,A.badges=gs(t,A,hs(t)),A}function Xr(t,n){if(!n||t.at===void 0)return;let l=t.into??t.at,c=n.columns.find(d=>d.unit===t.at),a=n.columns.find(d=>d.unit===l),e=c?.boxes.find(d=>d.id===t.from),s=a?.boxes.find(d=>d.id===t.to);if(!c||!a||!e||!s||e===s)return;let r=c.boxes.indexOf(e),o=a.boxes.indexOf(s),i=o>r;if(c===a){if(Math.abs(o-r)===1)return{from:e,to:s,points:[[e.cx,i?e.y+e.h+1:e.y-1],[s.cx,i?s.y-1:s.y+s.h+1]]};let d=Math.min(c.x+c.w-w.gap,Math.max(e.x+e.w,s.x+s.w)+w.gap);return{from:e,to:s,points:[[e.x+e.w+1,e.cy],[d,e.cy],[d,s.cy],[s.x+s.w+1,s.cy]]}}let p=a.x>c.x;if(r===o)return{from:e,to:s,points:[[p?e.x+e.w+1:e.x-1,e.cy],[p?s.x-1:s.x+s.w+1,s.cy]]};let m=e.cx+(p?1:-1)*e.w/4,u=s.cx-(p?1:-1)*s.w/4;return{from:e,to:s,points:[[m,i?e.y+e.h+1:e.y-1],[u,i?s.y-1:s.y+s.h+1]]}}function Ur(t,n,l,c){let a={...t};dt([a],new Map([[t.to,l]]),c);let e={...t};dt([e],new Map([[t.from,n]]),c),a.settle&&(t.settle=a.settle),e.wait&&(t.wait=e.wait)}function gs(t,n,l){let{r:c,inset:a}=w.badge,{axis:e}=n,s=[],r=[],o=Math.min(...n.rows.map(m=>m.y),n.needle.y1+w.time.needle.over),i=Math.max(...n.rows.map(m=>m.y+m.h),o),p=n.points[0]?(i+n.points[0].cy-n.points[0].r)/2:i+c+a;return t.steps.forEach((m,u)=>{let d=(h,P)=>{s.push(h),r.push({step:u,x:h[0],y:h[1],color:P})},f=n.edges.filter(h=>h.step===u).sort((h,P)=>h.event-P.event)[0];if(f){let h=f.carry.kind!=="none"&&!f.wait?[f.points[0]]:[],P=n.edges.filter(q=>q!==f).map(q=>q.points);d(tt(f.points,[...s,...h],P),f.color);return}let[y,k]=l[u]??[0,0];if(k>y){let h=e.x+(y+k)/2*e.unit,P=n.points.find(q=>Math.abs(q.cx-h)<c+a);P&&(h=P.cx+c+a*2),d([h,p],"slate");return}for(let h of m.events){let P=Jr(h,u,n);if(P){d(P.at,P.color);return}}if(n.strip&&m.events.some(h=>h.type==="strip")){r.push({step:u,x:n.strip.x+a,y:n.strip.y+a,color:"slate"});return}let b=r[r.length-1];r.push(b?{...b,step:u}:{step:u,x:e.x-c-a,y:o,color:"slate"})}),Je(r)}function Jr(t,n,l){let{r:c,inset:a}=w.badge;if(t.type==="span"){let e=l.spans.find(s=>s.step===n&&s.from===t.from&&s.to===t.to&&s.text===t.text);return e?e.kind==="box"?{at:[e.x,e.y],color:e.color}:{at:[e.x-c-a,e.y+e.h/2],color:e.color}:void 0}if(t.type==="swap"){let e=l.points.find(s=>s.id===t.box);if(e)return{at:[e.cx-e.r-a-c,e.cy],color:t.color??"slate"}}if(t.type==="mark"){let e=l.rows.find(r=>r.id===t.row),s=Math.min(...l.rows.map(r=>r.y));if(e)return{at:[l.axis.x+(t.from+t.to+1)/2*l.axis.unit,s-c-a],color:t.color}}}function Zr(t,n){let l=[],c=n.points.map(s=>({x:s.cx-s.r,y:s.cy-s.r,w:s.r*2,h:s.r*2})),a=n.points.map(s=>s.text),e=(n.zoom?.columns??[]).map(s=>He(s.head,s.x+s.w/2,n.zoom?.headY??0,O.timeHead,"middle"));for(let s of n.edges){let r=t.steps[s.step]?.events[s.event];if(r?.type!=="edge"||r.label===void 0)continue;let o=n.badges.filter(p=>p.step<=s.step).map(p=>Fe([p.x,p.y])),i=r.labelSide??(r.at===void 0?"below":void 0);l.push(ze({step:s.step,event:s.event,text:r.label,points:s.points,color:s.color,...i?{side:i}:{},flip:r.at!==void 0},{hard:[...c,...n.boxes],soft:[...a,...e,...l.filter(p=>p.step===s.step)],touch:o}))}return l}var Kt=t=>t.kind==="tree";function Qr(t){let n=new Set(t.boxes.map(e=>e.id)),l=new Set,c=new Map,a=[];return t.steps.forEach((e,s)=>{e.events.forEach((r,o)=>{if(r.type!=="leaf"&&r.type!=="node"||l.has(r.id)||n.has(r.id))return;let i=r.type==="node"?[...new Set(r.children)].filter(p=>l.has(p)&&!c.has(p)):[];for(let p of i)c.set(p,r.id);a.push({id:r.id,kind:r.type,children:i,step:s,event:o,...r.hash!==void 0?{hash:r.hash}:{}}),l.add(r.id)})}),{grown:a,parents:c}}function ei(t,n){return t.hash===void 0?[{text:t.id,style:O.boxName}]:n?[{text:t.id,style:O.rootName},{text:t.hash,style:O.rootHash}]:t.kind==="leaf"?[{text:t.hash,style:O.treeHash}]:[{text:t.hash,style:O.treeHash},{text:t.id,style:O.treeName}]}function ti(t,n){let l=w.edge.inset,c=Math.max(t.y,n.y),a=Math.min(t.y+t.h,n.y+n.h);if(a>c){let i=(c+a)/2;return n.x>=t.x+t.w?[[t.x+t.w+l,i],[n.x-l,i]]:[[t.x-l,i],[n.x+n.w+l,i]]}let e=Math.max(t.x,n.x),s=Math.min(t.x+t.w,n.x+n.w);if(s>e){let i=(e+s)/2;return n.y>=t.y+t.h?[[i,t.y+t.h+l],[i,n.y-l]]:[[i,t.y-l],[i,n.y+n.h+l]]}let r=t.x+t.w/2,o=n.y+n.h/2;return[[r,n.y>t.y?t.y+t.h+l:t.y-l],[r,o],[n.x>r?n.x-l:n.x+n.w+l,o]]}function xs(t){let{margin:n,gap:l,box:c,tree:a,badge:e}=w,{grown:s,parents:r}=Qr(t),o=s.filter(v=>!r.has(v.id)),i=o[o.length-1]?.id,p=new Map(s.map(v=>[v.id,v])),m=new Map,u=(v,z)=>{m.set(v,z);for(let M of p.get(v)?.children??[])u(M,z+1)};for(let v of o)u(v.id,0);let d=new Map(s.map(v=>[v.id,ei(v,v.id===i)])),f=v=>Math.max(0,...(d.get(v)??[]).map(z=>pe(z.text,z.style))),y=v=>v.id===i?Math.max(a.root.w,a.root.textX+f(v.id)+a.root.padR):Math.max(a.w,f(v.id)+a.padX*2),k=v=>Math.max(a.card.minW,a.card.padX*2+a.card.icon+a.card.gap+pe(v.id,O.treeCard)),b=v=>v.kind==="leaf"&&v.hash!==void 0,h=s.filter(v=>v.children.length===0),P=Math.max(...s.filter(v=>v.id!==i||v.children.length===0).map(v=>Math.max(y(v),b(v)?k(v):0)),a.w)+a.slotGap,q=n+e.r*2+e.inset,R=new Map;h.forEach((v,z)=>R.set(v.id,q+P*(z+.5)));let N=v=>{let z=R.get(v);if(z!==void 0)return z;let M=p.get(v)?.children??[],V=(N(M[0])+N(M[M.length-1]))/2;return R.set(v,V),V},D=n+a.top,L=v=>D+a.root.h/2+v*a.row,j=Xe(t),F=s.map(v=>{let z=v.id===i,M=m.get(v.id)??0,V=N(v.id),g=L(M),I=y(v),E=z?a.root.h:a.h,Y=d.get(v.id)??[],ne=Y.length===1?[g+a.oneY]:z?[g+a.root.nameY,g+a.root.hashY]:[g+a.hashY,g+a.nameY],H=r.get(v.id),W=z?a.rootColor:a.color;j.set(v.id,W);let te=k(v);return{id:v.id,kind:v.kind,depth:M,...H!==void 0?{parent:H}:{},children:v.children,step:v.step,event:v.event,...v.hash!==void 0?{hash:v.hash}:{},root:z,x:V-I/2,y:g-E/2,w:I,h:E,cx:V,cy:g,color:W,lines:Y.map(ce=>ce.text),baselines:ne,styles:Y.map(ce=>ce.style),...b(v)?{card:{x:V-te/2,y:g+a.card.drop-a.card.h/2,w:te,h:a.card.h,text:v.id}}:{}}}),X=new Map(F.map(v=>[v.id,v])),U=F.flatMap(v=>v.children.flatMap(z=>{let M=X.get(z);if(!M)return[];let V=(M.y+v.y+v.h)/2,g=[[M.cx,M.y-w.edge.inset],[M.cx,V],[v.cx,V],[v.cx,v.y+v.h+w.edge.inset]];return[{from:M.id,to:v.id,step:v.step,event:v.event,points:g}]})),ee=xt(t),re=Math.max(q,...F.flatMap(v=>[v.x+v.w,...v.card?[v.card.x+v.card.w]:[]])),se=F.find(v=>v.root),G=new Set(t.boxes.map(v=>v.id)),$=bt(t).flatMap(({edge:v})=>v.label!==void 0&&(G.has(v.from)||G.has(v.to))?[pe(v.label,Ve(v.label))+w.label.padX*2]:[]),A=Math.max(re+a.boxGap,(se?se.x+se.w:q)+Math.max(0,...$)+l*2),C=se?.y??D,_=t.boxes.map(v=>{let z=Math.max(Ue(t,v.id,!0),wt(ee.get(v.id),v.icon!==void 0,c.padX)),M=C;C+=c.h+l;let V={id:v.id,name:v.name,...v.sub!==void 0?{sub:v.sub}:{},...v.icon!==void 0?{icon:v.icon}:{},color:j.get(v.id)??"slate",x:A,y:M,w:z,h:c.h,cx:A+z/2,cy:M+c.h/2};return $t(V,ee.get(v.id)),V}),K=new Map(_.map(v=>[v.id,v])),T=[],Z=t.steps.flatMap((v,z)=>v.events.flatMap((M,V)=>{if(M.type!=="edge")return[];let g=X.get(M.from)??K.get(M.from),I=X.get(M.to)??K.get(M.to);if(!g||!I)return[];let E=U.find(W=>W.from===M.from&&W.to===M.to),Y=U.find(W=>W.from===M.to&&W.to===M.from),ne=E??Y;ne&&T.push({step:z,event:V,link:ne.from});let H=E?E.points:Y?[...Y.points].reverse():M.from===M.to?Mt({cx:g.x+g.w/2,y:g.y,h:g.h}):ti(g,I);return[{step:z,event:V,from:M.from,to:M.to,points:H,color:it(M,j),carry:M.carry}]}));dt(Z,K,ee);let ie={kind:"tree",width:0,height:0,regions:[],boxes:_,lifelines:[],edges:Z,labels:[],actions:[],badges:[],paths:[],ends:[],nodes:F,links:U,runs:T};ie.badges=bs(t,ie),ie.labels=ri(t,ie);let ae=F.flatMap(v=>v.card?[v.card]:[]),de=[...F,...ae,..._,...ie.labels],me=Z.flatMap(v=>v.points),ve=Math.max(...de.map(v=>v.x+v.w),...me.map(([v])=>v),q),xe=Math.max(...de.map(v=>v.y+v.h),...me.map(([,v])=>v),D),Te=Math.max(ve+n,Ze(t)+n*2),S=Qe(t,n,xe+l,Te-n*2);return ie.width=Te,ie.height=(S?S.y+S.h:xe)+n,S&&(ie.strip=S),ie.badges=bs(t,ie),ie}function bs(t,n){let{r:l,inset:c}=w.badge,a=l*2+c,e=[],s=[],r=[...n.nodes,...n.nodes.flatMap(m=>m.card?[m.card]:[]),...n.boxes],o=m=>e.every(([u,d])=>Math.hypot(m[0]-u,m[1]-d)>=a)&&r.every(u=>yt(Fe(m),u)>=w.label.touch),i=(m,u,d)=>{e.push(u),s.push({step:m,x:u[0],y:u[1],color:d})},p=new Map;return t.steps.forEach((m,u)=>{let d=m.events.findIndex(q=>q.type==="leaf"||q.type==="node"||q.type==="edge"),f=m.events[d],y=n.nodes.find(q=>q.step===u&&q.event===d);if(f&&f.type!=="edge"&&y){let q=[[y.x-c-l,y.cy],[y.x,y.y],[y.x+y.w+c+l,y.cy],[y.x+y.w,y.y]];i(u,q.find(o)??q[0],y.color);return}let k=n.edges.find(q=>q.step===u&&q.event===d);if(f?.type==="edge"&&k){let q=[k.from,k.to].sort().join(`
2
+ `),R=n.runs.some(L=>L.step===u&&L.event===d),N=n.edges.filter(L=>L!==k).map(L=>L.points),D=p.get(q)??(R?ni(k.points,o):si(k,o))??tt(k.points,e,N);p.set(q,D),i(u,D,k.color);return}let b=m.events.flatMap(q=>q.type==="swap"||q.type==="action"?[q.box]:[]).flatMap(q=>n.boxes.filter(R=>R.id===q))[0];if(b){s.push({step:u,x:b.x,y:b.y,color:b.color});return}if(n.strip&&m.events.some(q=>q.type==="strip")){s.push({step:u,x:n.strip.x+c,y:n.strip.y+c,color:"slate"});return}let h=s[s.length-1],P=n.nodes.find(q=>q.root);s.push(h?{...h,step:u}:{step:u,x:P?.x??w.margin,y:P?.y??w.margin,color:P?.color??"slate"})}),Je(s)}function ni(t,n){let[l,c,a]=t,e=Math.abs(a[0]-c[0]),{r:s,inset:r}=w.badge;if(e>=w.tree.badgeAlong+s){let i=Ke(t,mt([l,c])+w.tree.badgeAlong);if(n(i))return i}let o=[c[0]+s+r,c[1]];return n(o)?o:void 0}function si(t,n){let l=mt(t.points),c=ot(t.carry)[0]+w.badge.r+w.badge.inset;for(let a=0;a<=l/2-c;a+=1)for(let e of[l/2-a,l/2+a]){let s=Ke(t.points,e);if(n(s))return s}}function ri(t,n){let l=[],c=n.nodes.flatMap(a=>a.card?[a.card]:[]);for(let a of n.edges){let e=t.steps[a.step]?.events[a.event];if(e?.type!=="edge"||e.label===void 0)continue;let s=n.badges.filter(r=>r.step<=a.step).map(r=>Fe([r.x,r.y]));l.push(ze({step:a.step,event:a.event,text:e.label,points:a.points,color:a.color,...e.labelSide?{side:e.labelSide}:{},flip:!0},{hard:[...n.nodes,...n.boxes],soft:[...c,...l.filter(r=>r.step===a.step)],touch:s}))}return l}var ii={string:"\u6587\u5B57\u5217\u306B\u3059\u308B",integer:"\u6574\u6570\u306B\u3059\u308B",number:"\u6570\u306B\u3059\u308B",object:"\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B\u3059\u308B",array:"\u914D\u5217\u306B\u3059\u308B",boolean:"true \u304B false \u306B\u3059\u308B",null:"null \u306B\u3059\u308B"},oi={string:"Use a string",integer:"Use an integer",number:"Use a number",object:"Use an object",array:"Use an array",boolean:"Use true or false",null:"Use null"},ws=(t,n)=>`${t} ${n}${t===1?"":"s"}`,ai={additionalProperties:t=>`${t} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,required:t=>`${t} \u306E\u6B04\u304C\u8981\u308B`,enum:t=>`${t.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,type:t=>ii[t]??`${t} \u306B\u3059\u308B`,minLength:t=>`${t} \u5B57\u4EE5\u4E0A\u66F8\u304F`,pattern:t=>t?`${t.space?"\u7A7A\u767D\u3068 ":""}${t.chars.join(" ")} \u306F\u4F7F\u3048\u306A\u3044`:"\u4F7F\u3048\u306A\u3044\u5B57\u304C\u5165\u3063\u3066\u3044\u308B",minItems:t=>`${t} \u3064\u4EE5\u4E0A\u66F8\u304F`,minimum:t=>`${t} \u4EE5\u4E0A\u306B\u3059\u308B`,const:t=>`${t} \u306B\u3059\u308B`,not:t=>t?`${t.field} \u306E\u6B04\u306F kind \u304C ${t.kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`:"\u3053\u306E\u6B04\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u66F8\u3051\u306A\u3044",reserved:t=>`${t.join(" \u3068 ")} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,kindOnly:(t,n)=>`${t.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${n} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,hex:(t,n)=>`0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${t} \u304B\u3089 ${n} \u5B57\u306B\u3059\u308B`,duration:t=>`\u6570\u3068\u5358\u4F4D (${t.join(" / ")}) \u306E\u7D44\u3067\u66F8\u304F (12s \u306A\u3069)`,ratio:"\u5206\u6570 (2/3) \u304B\u767E\u5206\u7387 (97%) \u3067\u66F8\u304F",url:"/ \u3067\u59CB\u307E\u308B path \u304B\u3001http:// \u304B https:// \u3067\u59CB\u307E\u308B URL \u306B\u3059\u308B",anyOf:t=>t.length>0?`${t.join(" \u304B ")} \u306E${t.length===2?"\u3069\u3061\u3089\u304B":"\u3069\u308C\u304B"}\u306E\u6B04\u304C\u8981\u308B`:"\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u306B\u3082\u5408\u308F\u306A\u3044",oneOf:"\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",discriminator:(t,n)=>`${t} \u306F ${n.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,newer:(t,n)=>`\u7248 ${t} \u306E\u56F3\u306F\u3001\u3053\u306E\u9053\u5177 (\u7248 ${n}) \u3088\u308A\u65B0\u3057\u3044\u306E\u3067\u8AAD\u3081\u306A\u3044\u3002\u9053\u5177\u3092\u65B0\u3057\u304F\u3059\u308B`},li={additionalProperties:t=>`The ${t} field is not allowed`,required:t=>`The ${t} field is required`,enum:t=>`Use one of ${t.join(" / ")}`,type:t=>oi[t]??`Use ${t}`,minLength:t=>`Write at least ${ws(t,"character")}`,pattern:t=>t?`Cannot contain ${t.space?"spaces or ":""}${t.chars.join(" ")}`:"Contains characters that are not allowed",minItems:t=>`Write at least ${ws(t,"item")}`,minimum:t=>`Use ${t} or greater`,const:t=>`Use ${t}`,not:t=>t?`The ${t.field} field is allowed only when kind is ${t.kind}`:"This combination of fields is not allowed",reserved:t=>`${t.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,kindOnly:(t,n)=>`${t.join(" and ")} events are allowed only when kind is ${n}`,hex:(t,n)=>`Use ${t} to ${n} characters of 0-9 and a-f`,duration:t=>`Write a number and a unit (${t.join(" / ")}), such as 12s`,ratio:"Write a fraction (2/3) or a percentage (97%)",url:"Use a path that starts with / or a URL that starts with http:// or https://",anyOf:t=>t.length>0?`Write one of the ${t.join(" or ")} fields`:"Does not match any of the allowed shapes",oneOf:"Match exactly one of the allowed shapes",discriminator:(t,n)=>`${t} is one of ${n.join(" / ")}`,newer:(t,n)=>`Version ${t} diagrams are newer than this tool (version ${n}) and cannot be read. Update the tool`},Xt={ja:ai,en:li};function ci(t){let n=0;for(let l of t)n++;return n}var Rn=vs,An={title:"dragon \u306E\u56F3\u306E\u539F\u672C",description:"\u533A\u753B\u3001\u7BB1\u3001\u7DDA\u3001\u904B\u3076\u7269\u3001\u6BB5\u3001\u4E2D\u8EAB\u306E\u5E2F\u306E 6 \u90E8\u54C1\u3092\u5171\u901A\u306E\u9AA8\u7D44\u307F\u306B\u7F6E\u304D\u3001\u56F3\u306E\u7A2E\u985E\u3060\u3051\u306E\u7269\u306F\u7A2E\u985E\u306E\u6B04\u306B\u7F6E\u304F\u3002\u5EA7\u6A19\u306F\u6301\u305F\u306A\u3044\u3002\u7BB1\u306F\u679D\u5206\u304B\u308C\u306E\u56F3\u3068\u6642\u9593\u8EF8\u306E\u56F3\u3068\u6728\u306E\u56F3\u3060\u3051\u304C\u6301\u305F\u306A\u304F\u3066\u3088\u3044\u3002",type:"object",additionalProperties:!1,required:["version","kind","title","boxes","steps"],properties:{version:{description:"\u5F62\u5F0F\u306E\u7248",type:"integer",minimum:1},kind:{description:"\u56F3\u306E\u7A2E\u985E",enum:["sequence","architecture","state","git","time","tree"]},title:{$ref:"#/definitions/text"},view:{description:"\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059",enum:["fixed","follow"]},regions:{type:"array",items:{$ref:"#/definitions/region"}},boxes:{type:"array",items:{$ref:"#/definitions/box"}},strip:{$ref:"#/definitions/strip"},steps:{type:"array",minItems:1,items:{$ref:"#/definitions/step"}},sequence:{$ref:"#/definitions/sequence"},state:{$ref:"#/definitions/state"},git:{$ref:"#/definitions/git"},time:{$ref:"#/definitions/time"}},if:{required:["kind"],properties:{kind:{const:"sequence"}}},then:{required:["sequence"],properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{properties:{sequence:{$ref:"#/definitions/absent"}},if:{required:["kind"],properties:{kind:{const:"state"}}},then:{properties:{boxes:{minItems:1,items:{properties:{id:{description:"\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u306F\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044",not:{enum:["start","finish"]}}}}},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"git"}}},then:{required:["git"],properties:{steps:{$ref:"#/definitions/gitSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"time"}}},then:{required:["time"],properties:{steps:{$ref:"#/definitions/timeSteps"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"tree"}}},then:{properties:{steps:{$ref:"#/definitions/treeSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"}}},else:{properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}}}}}},definitions:{text:{type:"string",minLength:1},absent:{description:"\u3053\u306E\u56F3\u306E\u7A2E\u985E\u3067\u306F\u66F8\u3051\u306A\u3044\u6B04",not:{}},plainSteps:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u3067\u3082\u6642\u9593\u8EF8\u306E\u56F3\u3067\u3082\u6728\u306E\u56F3\u3067\u3082\u306A\u3044\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3068\u3001\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (now \u3068 mark \u3068 span) \u3068\u6B04 (at \u3068 into \u3068 color) \u3068\u3001\u6728\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (leaf \u3068 node) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{not:{$ref:"#/definitions/timeEvent"},allOf:[{not:{$ref:"#/definitions/treeEvent"}}],properties:{type:{not:{enum:["commit","branch"]}},at:{$ref:"#/definitions/absent"},into:{$ref:"#/definitions/absent"},color:{$ref:"#/definitions/absent"}}}}}}},gitSteps:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u306E\u6BB5\u3002\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (now \u3068 mark \u3068 span) \u3068\u6B04 (at \u3068 into \u3068 color) \u3068\u3001\u6728\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (leaf \u3068 node) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{not:{$ref:"#/definitions/timeEvent"},allOf:[{not:{$ref:"#/definitions/treeEvent"}}],properties:{at:{$ref:"#/definitions/absent"},into:{$ref:"#/definitions/absent"},color:{$ref:"#/definitions/absent"}}}}}}},timeSteps:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3068\u3001\u6728\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (leaf \u3068 node) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{allOf:[{not:{$ref:"#/definitions/treeEvent"}}],properties:{type:{not:{enum:["commit","branch"]}}}}}}}},treeSteps:{description:"\u6728\u306E\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3068\u3001\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (now \u3068 mark \u3068 span) \u3068\u6B04 (at \u3068 into \u3068 color) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{not:{$ref:"#/definitions/timeEvent"},properties:{type:{not:{enum:["commit","branch"]}},at:{$ref:"#/definitions/absent"},into:{$ref:"#/definitions/absent"},color:{$ref:"#/definitions/absent"}}}}}}},treeEvent:{description:"\u6728\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u51FA\u6765\u4E8B",required:["type"],properties:{type:{enum:["leaf","node"]}}},timeEvent:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u51FA\u6765\u4E8B",required:["type"],properties:{type:{enum:["now","mark","span"]}}},plainStrip:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u3067\u306A\u3044\u56F3\u306E\u4E2D\u8EAB\u306E\u5E2F\u3002\u7269\u5DEE\u3057\u3092\u66F8\u3051\u306A\u3044",properties:{meters:{$ref:"#/definitions/absent"}}},id:{type:"string",pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},color:{enum:["blue","amber","green","violet","rose","slate","coin"]},region:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},note:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"}}},box:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},sub:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"},region:{$ref:"#/definitions/id"},link:{description:"\u98DB\u3073\u5148\u3002\u63CF\u3044\u305F\u56F3\u3067\u306F\u3053\u306E\u7BB1\u304C\u3053\u3053\u3078\u306E link \u306B\u306A\u308B",$ref:"#/definitions/url"}}},strip:{type:"object",additionalProperties:!1,required:["title","fields"],properties:{title:{$ref:"#/definitions/text"},fields:{type:"array",minItems:1,items:{$ref:"#/definitions/text"}},meters:{description:"\u7269\u5DEE\u3057\u306B\u3059\u308B\u6B04\u3002\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B",type:"array",minItems:1,items:{$ref:"#/definitions/meter"}}}},meter:{description:"\u7269\u5DEE\u3057\u306E\u6B04\u3002line \u306E\u5272\u5408\u306E\u6240\u306B\u7DDA\u3092\u5F15\u304D\u3001set \u306E\u5024\u307E\u3067\u91DD\u3068\u4E00\u7DD2\u306B\u6E80\u3061\u308B",type:"object",additionalProperties:!1,required:["field","line"],properties:{field:{$ref:"#/definitions/text"},line:{$ref:"#/definitions/ratio"}}},ratio:{description:"\u5272\u5408\u3002\u5206\u6570 (2/3) \u304B\u767E\u5206\u7387 (97%)",type:"string",pattern:"^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"},step:{type:"object",additionalProperties:!1,required:["title","body","events"],properties:{title:{$ref:"#/definitions/text"},body:{$ref:"#/definitions/text"},code:{$ref:"#/definitions/text"},sources:{description:"\u6BB5\u306E\u51FA\u5178\u3002\u8AAD\u307F\u4E0A\u3052\u306E\u6BB5\u306E\u4E00\u89A7\u306B\u3001\u540D\u524D\u3092 URL \u3078\u306E link \u306B\u3057\u3066\u66F8\u3044\u305F\u9806\u306B\u51FA\u3059",type:"array",minItems:1,items:{$ref:"#/definitions/source"}},events:{type:"array",items:{$ref:"#/definitions/event"}}}},source:{type:"object",additionalProperties:!1,required:["name","url"],properties:{name:{$ref:"#/definitions/text"},url:{$ref:"#/definitions/url"}}},url:{description:"\u9801\u3092\u79FB\u308B\u5F62\u3002/ \u3067\u59CB\u307E\u308B path \u304B\u3001http:// \u304B https:// \u3067\u59CB\u307E\u308B URL",type:"string",pattern:"^(/|https?://)"},event:{description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},oneOf:[{description:"\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B",type:"object",additionalProperties:!1,required:["type","from","to","carry"],properties:{type:{const:"edge"},from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"},carry:{$ref:"#/definitions/carry"},labelSide:{description:"\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)",enum:["above","below","left","right"]},at:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u7DDA\u3092\u5F15\u304F\u5217\u306E\u76EE\u76DB\u308A",$ref:"#/definitions/unit"},into:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u53D7\u3051\u308B\u7BB1\u3092\u9078\u3076\u5217\u306E\u76EE\u76DB\u308A\u3002\u66F8\u304B\u306A\u3051\u308C\u3070 at \u306E\u5217",$ref:"#/definitions/unit"}}},{description:"\u7BB1\u306E\u4E2D\u306E\u51E6\u7406",type:"object",additionalProperties:!1,required:["type","box","label"],properties:{type:{const:"action"},box:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}},{description:"\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048",type:"object",additionalProperties:!1,required:["type","box","text"],properties:{type:{const:"swap"},box:{$ref:"#/definitions/id"},text:{$ref:"#/definitions/text"},color:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7BC0\u76EE\u306E\u4E38\u306E\u8272",$ref:"#/definitions/color"}}},{description:"commit \u3092\u7A4D\u3080\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u7A4D\u3093\u3060\u679D\u306E\u672D\u3068\u3001\u305D\u306E\u679D\u3092\u6307\u3059 HEAD \u304C\u9032\u3080\u3002\u5F53\u3066\u76F4\u3057 (copy) \u306F\u679D\u306E\u672D\u3092\u52D5\u304B\u3055\u305A\u3001merge commit (merge) \u306F\u53D6\u308A\u8FBC\u3080\u679D\u306E\u5148\u7AEF\u3082\u89AA\u306B\u6301\u3064",type:"object",additionalProperties:!1,required:["type","id","branch"],properties:{type:{const:"commit"},id:{$ref:"#/definitions/id"},branch:{$ref:"#/definitions/id"},copy:{$ref:"#/definitions/id"},merge:{$ref:"#/definitions/id"},hash:{$ref:"#/definitions/hash"},note:{$ref:"#/definitions/text"}}},{description:"\u679D\u3092\u5207\u308B\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u679D\u306E\u672D\u3092 from \u306E commit \u3078\u7F6E\u304D\u3001HEAD \u3092\u305D\u306E\u679D\u3078\u79FB\u3059",type:"object",additionalProperties:!1,required:["type","branch","from"],properties:{type:{const:"branch"},branch:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/id"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u4ECA\u306E\u6642\u523B\u306E\u91DD\u3092\u3001to \u306E\u76EE\u76DB\u308A\u306E\u7D42\u308F\u308A\u307E\u3067\u9032\u3081\u308B",type:"object",additionalProperties:!1,required:["type","to"],properties:{type:{const:"now"},to:{$ref:"#/definitions/unit"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u5370\u306E\u5217 row \u306E\u3001from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u8272\u3092\u5909\u3048\u308B",type:"object",additionalProperties:!1,required:["type","row","from","to","color"],properties:{type:{const:"mark"},row:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},color:{$ref:"#/definitions/color"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306B\u3001\u62EC\u5F27\u3068\u5B57\u3092\u51FA\u3059\u3002shape \u304C box \u306A\u3089\u5370\u306E\u5217\u3092\u56F2\u307F\u3001\u5B57\u3092\u7E01\u306E\u672D\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["type","from","to","text"],properties:{type:{const:"span"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},text:{$ref:"#/definitions/text"},shape:{enum:["box"]},color:{$ref:"#/definitions/color"}}},{description:"\u8449\u3092\u51FA\u3059\u3002\u6728\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u66F8\u3044\u305F\u6BB5\u3067\u8449\u306E\u7BB1\u304C\u73FE\u308C\u308B\u3002hash \u3092\u66F8\u304F\u3068\u7BB1\u306B\u5024\u3092\u51FA\u3057\u3001\u540D\u672D\u3092\u8449\u306E\u4E0B\u306E\u672D\u306B\u51FA\u3059",type:"object",additionalProperties:!1,required:["type","id"],properties:{type:{const:"leaf"},id:{$ref:"#/definitions/id"},hash:{$ref:"#/definitions/hash"}}},{description:"1 \u3064\u4EE5\u4E0A\u306E\u5B50\u304B\u3089\u89AA\u3092\u7D44\u3080\u3002\u6728\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u66F8\u3044\u305F\u6BB5\u3067\u89AA\u306E\u7BB1\u3068\u3001\u5B50\u304B\u3089\u89AA\u3078\u306E\u6728\u306E\u7DDA\u304C\u73FE\u308C\u308B",type:"object",additionalProperties:!1,required:["type","id","children"],properties:{type:{const:"node"},id:{$ref:"#/definitions/id"},children:{type:"array",minItems:1,items:{$ref:"#/definitions/id"}},hash:{$ref:"#/definitions/hash"}}},{description:"\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D",type:"object",additionalProperties:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]},carry:{description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}},sequence:{description:"\u6642\u7CFB\u5217\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u751F\u5B58\u7DDA\u3092\u5DE6\u304B\u3089\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["lifelines"],properties:{lifelines:{type:"array",minItems:1,items:{$ref:"#/definitions/id"}}}},state:{description:"\u72B6\u614B\u9077\u79FB\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u6700\u521D\u306E\u6BB5\u3088\u308A\u524D\u306B\u66F8\u3044\u305F\u3001\u79FB\u308C\u308B\u304C\u6BB5\u3067\u901A\u308B\u3068\u306F\u9650\u3089\u306A\u3044\u7DDA",type:"object",additionalProperties:!1,required:["paths"],properties:{paths:{type:"array",minItems:1,items:{$ref:"#/definitions/path"}}}},git:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u679D\u3092\u4E0A\u304B\u3089\u5E2F\u306B\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["branches"],properties:{branches:{type:"array",minItems:1,items:{$ref:"#/definitions/branch"}}}},branch:{description:"\u679D\u3002\u5E2F\u306E\u5DE6\u306B\u540D\u672D\u3068\u6DFB\u3048\u66F8\u304D\u3092\u7F6E\u304F",type:"object",additionalProperties:!1,required:["id"],properties:{id:{$ref:"#/definitions/id"},note:{$ref:"#/definitions/text"}}},hash:{description:"commit \u3068\u6728\u306E\u7BB1\u306E hash\u300216 \u9032\u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57",type:"string",pattern:"^[0-9a-f]{4,40}$"},time:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u76EE\u76DB\u308A\u3001\u533A\u5207\u308A\u3001\u5370\u306E\u5217\u3001\u7BC0\u76EE\u3001\u62E1\u5927\u306E\u7BC4\u56F2",type:"object",additionalProperties:!1,required:["scale","rows"],properties:{scale:{$ref:"#/definitions/scale"},period:{$ref:"#/definitions/period"},rows:{type:"array",minItems:1,items:{$ref:"#/definitions/row"}},points:{type:"array",items:{$ref:"#/definitions/point"}},zoom:{$ref:"#/definitions/zoom"}}},scale:{description:"\u76EE\u76DB\u308A\u3002unit \u306E\u540D\u524D\u306E\u76EE\u76DB\u308A\u3092 length \u306E\u9577\u3055\u3067 count \u500B\u4E26\u3079\u3001\u6700\u521D\u306E\u76EE\u76DB\u308A\u306E\u756A\u53F7\u3092 from \u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["unit","length","count"],properties:{unit:{$ref:"#/definitions/text"},length:{$ref:"#/definitions/duration"},count:{type:"integer",minimum:1},from:{type:"integer",minimum:0}}},duration:{description:"\u9577\u3055\u3002\u6570\u3068\u5358\u4F4D (ms\u3001s\u3001min\u3001h\u3001d) \u306E\u7D44",type:"string",pattern:"^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"},unit:{description:"\u76EE\u76DB\u308A\u306E\u4F4D\u7F6E\u30020 \u304B\u3089\u6570\u3048\u308B",type:"integer",minimum:0},period:{description:"\u533A\u5207\u308A\u3002\u76EE\u76DB\u308A length \u500B\u3054\u3068\u306B name \u306E\u533A\u5207\u308A\u3092\u7F6E\u304D\u3001\u6700\u521D\u306E\u533A\u5207\u308A\u306E\u756A\u53F7\u3092 from \u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["name","length"],properties:{name:{$ref:"#/definitions/text"},length:{type:"integer",minimum:1},from:{type:"integer",minimum:0}}},row:{description:"\u5370\u306E\u5217\u3002\u76EE\u76DB\u308A\u3054\u3068\u306B\u5370\u3092 1 \u3064\u7F6E\u304D\u3001empty \u306E\u76EE\u76DB\u308A\u306F\u7A7A\u304D\u306E\u5370\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},empty:{type:"array",items:{$ref:"#/definitions/unit"}}}},point:{description:"\u7BC0\u76EE\u3002at \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u4E0B\u306B\u65D7\u306E\u4E38\u3068\u540D\u672D\u3092\u7F6E\u304F",type:"object",additionalProperties:!1,required:["id","at"],properties:{id:{$ref:"#/definitions/id"},at:{$ref:"#/definitions/unit"}}},zoom:{description:"\u62E1\u5927\u306E\u7BC4\u56F2\u3002from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u3054\u3068\u306B\u62E1\u5927\u306E\u5E2F\u306B\u5217\u3092\u4F5C\u308B",type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"}}},path:{description:"\u79FB\u308C\u308B\u9053\u3002\u9001\u308B\u5074\u306B\u59CB\u307E\u308A\u306E\u5370 start\u3001\u53D7\u3051\u308B\u5074\u306B\u7D42\u308F\u308A\u306E\u5370 finish \u3092\u66F8\u3051\u308B\u3002\u3069\u306E\u6BB5\u306B\u3082\u51FA\u306A\u3044\u9053\u306F\u70B9\u7DDA\u3067\u63CF\u304D\u3001\u904B\u3076\u7269\u3092\u8D70\u3089\u305B\u306A\u3044",type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}}}};function at(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(Array.isArray(t)){let p=t.length;for(let m=0;m<p;m++){let u=t[m];if(u&&typeof u=="object"&&!Array.isArray(u)&&u.events!==void 0){let d=u.events;if(Array.isArray(d)){let f=d.length;for(let y=0;y<f;y++){let k=d[y],b=s,h=s;if(k&&typeof k=="object"&&!Array.isArray(k)){let R;if(k.type===void 0&&(R="type")){let N={};e===null?e=[N]:e.push(N),s++}else if(k.type!==void 0){let N=k.type;if(!(N==="now"||N==="mark"||N==="span")){let D={};e===null?e=[D]:e.push(D),s++}}}var r=h===s;if(r){let R={instancePath:n+"/"+m+"/events/"+y,schemaPath:"#/items/properties/events/items/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[R]:e.push(R),s++}else s=b,e!==null&&(b?e.length=b:e=null);let P=s,q=s;if(k&&typeof k=="object"&&!Array.isArray(k)){let R;if(k.type===void 0&&(R="type")){let N={};e===null?e=[N]:e.push(N),s++}else if(k.type!==void 0){let N=k.type;if(!(N==="leaf"||N==="node")){let D={};e===null?e=[D]:e.push(D),s++}}}var o=q===s;if(o){let R={instancePath:n+"/"+m+"/events/"+y,schemaPath:"#/items/properties/events/items/allOf/0/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[R]:e.push(R),s++}else s=P,e!==null&&(P?e.length=P:e=null);if(k&&typeof k=="object"&&!Array.isArray(k)){if(k.type!==void 0){let R=k.type,N=s,D=s;if(!(R==="commit"||R==="branch")){let L={};e===null?e=[L]:e.push(L),s++}var i=D===s;if(i){let L={instancePath:n+"/"+m+"/events/"+y+"/type",schemaPath:"#/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[L]:e.push(L),s++}else s=N,e!==null&&(N?e.length=N:e=null)}if(k.at!==void 0){let R={instancePath:n+"/"+m+"/events/"+y+"/at",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[R]:e.push(R),s++}if(k.into!==void 0){let R={instancePath:n+"/"+m+"/events/"+y+"/into",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[R]:e.push(R),s++}if(k.color!==void 0){let R={instancePath:n+"/"+m+"/events/"+y+"/color",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[R]:e.push(R),s++}}}}}}}return at.errors=e,s===0}function Be(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.meters!==void 0){let r={instancePath:n+"/meters",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[r]:e.push(r),s++}return Be.errors=e,s===0}function Ut(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(Array.isArray(t)){let i=t.length;for(let p=0;p<i;p++){let m=t[p];if(m&&typeof m=="object"&&!Array.isArray(m)&&m.events!==void 0){let u=m.events;if(Array.isArray(u)){let d=u.length;for(let f=0;f<d;f++){let y=u[f],k=s,b=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let q;if(y.type===void 0&&(q="type")){let R={};e===null?e=[R]:e.push(R),s++}else if(y.type!==void 0){let R=y.type;if(!(R==="now"||R==="mark"||R==="span")){let N={};e===null?e=[N]:e.push(N),s++}}}var r=b===s;if(r){let q={instancePath:n+"/"+p+"/events/"+f,schemaPath:"#/items/properties/events/items/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),s++}else s=k,e!==null&&(k?e.length=k:e=null);let h=s,P=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let q;if(y.type===void 0&&(q="type")){let R={};e===null?e=[R]:e.push(R),s++}else if(y.type!==void 0){let R=y.type;if(!(R==="leaf"||R==="node")){let N={};e===null?e=[N]:e.push(N),s++}}}var o=P===s;if(o){let q={instancePath:n+"/"+p+"/events/"+f,schemaPath:"#/items/properties/events/items/allOf/0/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),s++}else s=h,e!==null&&(h?e.length=h:e=null);if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.at!==void 0){let q={instancePath:n+"/"+p+"/events/"+f+"/at",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),s++}if(y.into!==void 0){let q={instancePath:n+"/"+p+"/events/"+f+"/into",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),s++}if(y.color!==void 0){let q={instancePath:n+"/"+p+"/events/"+f+"/color",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),s++}}}}}}}return Ut.errors=e,s===0}function Jt(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(Array.isArray(t)){let i=t.length;for(let p=0;p<i;p++){let m=t[p];if(m&&typeof m=="object"&&!Array.isArray(m)&&m.events!==void 0){let u=m.events;if(Array.isArray(u)){let d=u.length;for(let f=0;f<d;f++){let y=u[f],k=s,b=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let h;if(y.type===void 0&&(h="type")){let P={};e===null?e=[P]:e.push(P),s++}else if(y.type!==void 0){let P=y.type;if(!(P==="leaf"||P==="node")){let q={};e===null?e=[q]:e.push(q),s++}}}var r=b===s;if(r){let h={instancePath:n+"/"+p+"/events/"+f,schemaPath:"#/items/properties/events/items/allOf/0/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),s++}else s=k,e!==null&&(k?e.length=k:e=null);if(y&&typeof y=="object"&&!Array.isArray(y)&&y.type!==void 0){let h=y.type,P=s,q=s;if(!(h==="commit"||h==="branch")){let R={};e===null?e=[R]:e.push(R),s++}var o=q===s;if(o){let R={instancePath:n+"/"+p+"/events/"+f+"/type",schemaPath:"#/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[R]:e.push(R),s++}else s=P,e!==null&&(P?e.length=P:e=null)}}}}}}return Jt.errors=e,s===0}function Zt(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(Array.isArray(t)){let i=t.length;for(let p=0;p<i;p++){let m=t[p];if(m&&typeof m=="object"&&!Array.isArray(m)&&m.events!==void 0){let u=m.events;if(Array.isArray(u)){let d=u.length;for(let f=0;f<d;f++){let y=u[f],k=s,b=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let h;if(y.type===void 0&&(h="type")){let P={};e===null?e=[P]:e.push(P),s++}else if(y.type!==void 0){let P=y.type;if(!(P==="now"||P==="mark"||P==="span")){let q={};e===null?e=[q]:e.push(q),s++}}}var r=b===s;if(r){let h={instancePath:n+"/"+p+"/events/"+f,schemaPath:"#/items/properties/events/items/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),s++}else s=k,e!==null&&(k?e.length=k:e=null);if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.type!==void 0){let h=y.type,P=s,q=s;if(!(h==="commit"||h==="branch")){let R={};e===null?e=[R]:e.push(R),s++}var o=q===s;if(o){let R={instancePath:n+"/"+p+"/events/"+f+"/type",schemaPath:"#/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[R]:e.push(R),s++}else s=P,e!==null&&(P?e.length=P:e=null)}if(y.at!==void 0){let h={instancePath:n+"/"+p+"/events/"+f+"/at",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),s++}if(y.into!==void 0){let h={instancePath:n+"/"+p+"/events/"+f+"/into",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),s++}if(y.color!==void 0){let h={instancePath:n+"/"+p+"/events/"+f+"/color",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),s++}}}}}}}return Zt.errors=e,s===0}var Nt={enum:["blue","amber","green","violet","rose","slate","coin"]},Le=new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$","u"),Oe=ci;function Qt(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[r]:e.push(r),s++}if(t.name===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="id"||r==="name"||r==="note"||r==="color"||r==="icon")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.id!==void 0){let r=t.id;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.name!==void 0){let r=t.name;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.note!==void 0){let r=t.note;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.color!==void 0){let r=t.color;if(!(r==="blue"||r==="amber"||r==="green"||r==="violet"||r==="rose"||r==="slate"||r==="coin")){let o={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Nt.enum},message:"must be equal to one of the allowed values"};e===null?e=[o]:e.push(o),s++}}if(t.icon!==void 0){let r=t.icon;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return Qt.errors=e,s===0}var ks=new RegExp("^(/|https?://)","u");function en(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[r]:e.push(r),s++}if(t.name===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="id"||r==="name"||r==="sub"||r==="color"||r==="icon"||r==="region"||r==="link")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.id!==void 0){let r=t.id;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.name!==void 0){let r=t.name;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.sub!==void 0){let r=t.sub;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/sub",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/sub",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.color!==void 0){let r=t.color;if(!(r==="blue"||r==="amber"||r==="green"||r==="violet"||r==="rose"||r==="slate"||r==="coin")){let o={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Nt.enum},message:"must be equal to one of the allowed values"};e===null?e=[o]:e.push(o),s++}}if(t.icon!==void 0){let r=t.icon;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.region!==void 0){let r=t.region;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/region",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/region",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.link!==void 0){let r=t.link;if(typeof r=="string"){if(!ks.test(r)){let o={instancePath:n+"/link",schemaPath:"#/definitions/url/pattern",keyword:"pattern",params:{pattern:"^(/|https?://)"},message:'must match pattern "^(/|https?://)"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/link",schemaPath:"#/definitions/url/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return en.errors=e,s===0}var pi=new RegExp("^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$","u");function tn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.field===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};e===null?e=[r]:e.push(r),s++}if(t.line===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"line"},message:"must have required property 'line'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="field"||r==="line")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.field!==void 0){let r=t.field;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.line!==void 0){let r=t.line;if(typeof r=="string"){if(!pi.test(r)){let o={instancePath:n+"/line",schemaPath:"#/definitions/ratio/pattern",keyword:"pattern",params:{pattern:"^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"},message:'must match pattern "^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/line",schemaPath:"#/definitions/ratio/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return tn.errors=e,s===0}function nn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.title===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[r]:e.push(r),s++}if(t.fields===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"fields"},message:"must have required property 'fields'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="title"||r==="fields"||r==="meters")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.title!==void 0){let r=t.title;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.fields!==void 0){let r=t.fields;if(Array.isArray(r)){if(r.length<1){let i={instancePath:n+"/fields",schemaPath:"#/properties/fields/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[i]:e.push(i),s++}let o=r.length;for(let i=0;i<o;i++){let p=r[i];if(typeof p=="string"){if(Oe(p)<1){let m={instancePath:n+"/fields/"+i,schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[m]:e.push(m),s++}}else{let m={instancePath:n+"/fields/"+i,schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),s++}}}else{let o={instancePath:n+"/fields",schemaPath:"#/properties/fields/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}if(t.meters!==void 0){let r=t.meters;if(Array.isArray(r)){if(r.length<1){let i={instancePath:n+"/meters",schemaPath:"#/properties/meters/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[i]:e.push(i),s++}let o=r.length;for(let i=0;i<o;i++)tn(r[i],{instancePath:n+"/meters/"+i,parentData:r,parentDataProperty:i,rootData:a})||(e=e===null?tn.errors:e.concat(tn.errors),s=e.length)}else{let o={instancePath:n+"/meters",schemaPath:"#/properties/meters/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return nn.errors=e,s===0}function sn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.name===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[r]:e.push(r),s++}if(t.url===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"url"},message:"must have required property 'url'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="name"||r==="url")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.name!==void 0){let r=t.name;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.url!==void 0){let r=t.url;if(typeof r=="string"){if(!ks.test(r)){let o={instancePath:n+"/url",schemaPath:"#/definitions/url/pattern",keyword:"pattern",params:{pattern:"^(/|https?://)"},message:'must match pattern "^(/|https?://)"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/url",schemaPath:"#/definitions/url/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return sn.errors=e,s===0}var $s={description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},oneOf:[{description:"\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B",type:"object",additionalProperties:!1,required:["type","from","to","carry"],properties:{type:{const:"edge"},from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"},carry:{$ref:"#/definitions/carry"},labelSide:{description:"\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)",enum:["above","below","left","right"]},at:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u7DDA\u3092\u5F15\u304F\u5217\u306E\u76EE\u76DB\u308A",$ref:"#/definitions/unit"},into:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u53D7\u3051\u308B\u7BB1\u3092\u9078\u3076\u5217\u306E\u76EE\u76DB\u308A\u3002\u66F8\u304B\u306A\u3051\u308C\u3070 at \u306E\u5217",$ref:"#/definitions/unit"}}},{description:"\u7BB1\u306E\u4E2D\u306E\u51E6\u7406",type:"object",additionalProperties:!1,required:["type","box","label"],properties:{type:{const:"action"},box:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}},{description:"\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048",type:"object",additionalProperties:!1,required:["type","box","text"],properties:{type:{const:"swap"},box:{$ref:"#/definitions/id"},text:{$ref:"#/definitions/text"},color:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7BC0\u76EE\u306E\u4E38\u306E\u8272",$ref:"#/definitions/color"}}},{description:"commit \u3092\u7A4D\u3080\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u7A4D\u3093\u3060\u679D\u306E\u672D\u3068\u3001\u305D\u306E\u679D\u3092\u6307\u3059 HEAD \u304C\u9032\u3080\u3002\u5F53\u3066\u76F4\u3057 (copy) \u306F\u679D\u306E\u672D\u3092\u52D5\u304B\u3055\u305A\u3001merge commit (merge) \u306F\u53D6\u308A\u8FBC\u3080\u679D\u306E\u5148\u7AEF\u3082\u89AA\u306B\u6301\u3064",type:"object",additionalProperties:!1,required:["type","id","branch"],properties:{type:{const:"commit"},id:{$ref:"#/definitions/id"},branch:{$ref:"#/definitions/id"},copy:{$ref:"#/definitions/id"},merge:{$ref:"#/definitions/id"},hash:{$ref:"#/definitions/hash"},note:{$ref:"#/definitions/text"}}},{description:"\u679D\u3092\u5207\u308B\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u679D\u306E\u672D\u3092 from \u306E commit \u3078\u7F6E\u304D\u3001HEAD \u3092\u305D\u306E\u679D\u3078\u79FB\u3059",type:"object",additionalProperties:!1,required:["type","branch","from"],properties:{type:{const:"branch"},branch:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/id"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u4ECA\u306E\u6642\u523B\u306E\u91DD\u3092\u3001to \u306E\u76EE\u76DB\u308A\u306E\u7D42\u308F\u308A\u307E\u3067\u9032\u3081\u308B",type:"object",additionalProperties:!1,required:["type","to"],properties:{type:{const:"now"},to:{$ref:"#/definitions/unit"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u5370\u306E\u5217 row \u306E\u3001from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u8272\u3092\u5909\u3048\u308B",type:"object",additionalProperties:!1,required:["type","row","from","to","color"],properties:{type:{const:"mark"},row:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},color:{$ref:"#/definitions/color"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306B\u3001\u62EC\u5F27\u3068\u5B57\u3092\u51FA\u3059\u3002shape \u304C box \u306A\u3089\u5370\u306E\u5217\u3092\u56F2\u307F\u3001\u5B57\u3092\u7E01\u306E\u672D\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["type","from","to","text"],properties:{type:{const:"span"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},text:{$ref:"#/definitions/text"},shape:{enum:["box"]},color:{$ref:"#/definitions/color"}}},{description:"\u8449\u3092\u51FA\u3059\u3002\u6728\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u66F8\u3044\u305F\u6BB5\u3067\u8449\u306E\u7BB1\u304C\u73FE\u308C\u308B\u3002hash \u3092\u66F8\u304F\u3068\u7BB1\u306B\u5024\u3092\u51FA\u3057\u3001\u540D\u672D\u3092\u8449\u306E\u4E0B\u306E\u672D\u306B\u51FA\u3059",type:"object",additionalProperties:!1,required:["type","id"],properties:{type:{const:"leaf"},id:{$ref:"#/definitions/id"},hash:{$ref:"#/definitions/hash"}}},{description:"1 \u3064\u4EE5\u4E0A\u306E\u5B50\u304B\u3089\u89AA\u3092\u7D44\u3080\u3002\u6728\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u66F8\u3044\u305F\u6BB5\u3067\u89AA\u306E\u7BB1\u3068\u3001\u5B50\u304B\u3089\u89AA\u3078\u306E\u6728\u306E\u7DDA\u304C\u73FE\u308C\u308B",type:"object",additionalProperties:!1,required:["type","id","children"],properties:{type:{const:"node"},id:{$ref:"#/definitions/id"},children:{type:"array",minItems:1,items:{$ref:"#/definitions/id"}},hash:{$ref:"#/definitions/hash"}}},{description:"\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D",type:"object",additionalProperties:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]};var jn=new RegExp("^[0-9a-f]{4,40}$","u"),di={description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}};function rn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0,r=s,o=!0,i=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.kind===void 0&&(d="kind")){let f={};e===null?e=[f]:e.push(f),s++}else if(t.kind!==void 0&&t.kind!=="tag"){let f={};e===null?e=[f]:e.push(f),s++}}var p=i===s;s=r,e!==null&&(r?e.length=r:e=null);let m;if(p){let d=s;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.text===void 0){let y={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[y]:e.push(y),s++}var p=d===s;o=p,m="then"}else{let d=s,f=s,y=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let b;if(t.text===void 0&&(b="text")){let h={};e===null?e=[h]:e.push(h),s++}}var u=y===s;if(u){let b={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[b]:e.push(b),s++}else s=f,e!==null&&(f?e.length=f:e=null);var p=d===s;o=p,m="else"}if(!o){let d={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:m},message:'must match "'+m+'" schema'};e===null?e=[d]:e.push(d),s++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kind===void 0){let d={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};e===null?e=[d]:e.push(d),s++}for(let d in t)if(!(d==="kind"||d==="text")){let f={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties"};e===null?e=[f]:e.push(f),s++}if(t.kind!==void 0){let d=t.kind;if(!(d==="envelope"||d==="tag"||d==="coin"||d==="none")){let f={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:di.properties.kind.enum},message:"must be equal to one of the allowed values"};e===null?e=[f]:e.push(f),s++}}if(t.text!==void 0){let d=t.text;if(typeof d=="string"){if(Oe(d)<1){let f={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[f]:e.push(f),s++}}else{let f={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[f]:e.push(f),s++}}}else{let d={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[d]:e.push(d),s++}return rn.errors=e,s===0}function on(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}let o=t.type;if(typeof o=="string")if(o==="edge")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.from===void 0){let i={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[i]:e.push(i),s++}if(t.to===void 0){let i={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[i]:e.push(i),s++}if(t.carry===void 0){let i={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"carry"},message:"must have required property 'carry'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="from"||i==="to"||i==="label"||i==="carry"||i==="labelSide"||i==="at"||i==="into")){let p={instancePath:n,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="edge"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue:"edge"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.from!==void 0){let i=t.from;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.to!==void 0){let i=t.to;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.label!==void 0){let i=t.label;if(typeof i=="string"){if(Oe(i)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.carry!==void 0&&(rn(t.carry,{instancePath:n+"/carry",parentData:t,parentDataProperty:"carry",rootData:a})||(e=e===null?rn.errors:e.concat(rn.errors),s=e.length)),t.labelSide!==void 0){let i=t.labelSide;if(!(i==="above"||i==="below"||i==="left"||i==="right")){let p={instancePath:n+"/labelSide",schemaPath:"#/oneOf/0/properties/labelSide/enum",keyword:"enum",params:{allowedValues:$s.oneOf[0].properties.labelSide.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),s++}}if(t.at!==void 0){let i=t.at;if(!(typeof i=="number"&&!(i%1)&&!isNaN(i)&&isFinite(i))){let p={instancePath:n+"/at",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),s++}if(typeof i=="number"&&isFinite(i)&&(i<0||isNaN(i))){let p={instancePath:n+"/at",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),s++}}if(t.into!==void 0){let i=t.into;if(!(typeof i=="number"&&!(i%1)&&!isNaN(i)&&isFinite(i))){let p={instancePath:n+"/into",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),s++}if(typeof i=="number"&&isFinite(i)&&(i<0||isNaN(i))){let p={instancePath:n+"/into",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="action")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.box===void 0){let i={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};e===null?e=[i]:e.push(i),s++}if(t.label===void 0){let i={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"label"},message:"must have required property 'label'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="box"||i==="label")){let p={instancePath:n,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="action"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue:"action"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.box!==void 0){let i=t.box;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.label!==void 0){let i=t.label;if(typeof i=="string"){if(Oe(i)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="swap")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.box===void 0){let i={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};e===null?e=[i]:e.push(i),s++}if(t.text===void 0){let i={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="box"||i==="text"||i==="color")){let p={instancePath:n,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="swap"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue:"swap"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.box!==void 0){let i=t.box;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.text!==void 0){let i=t.text;if(typeof i=="string"){if(Oe(i)<1){let p={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.color!==void 0){let i=t.color;if(!(i==="blue"||i==="amber"||i==="green"||i==="violet"||i==="rose"||i==="slate"||i==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Nt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/2/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="commit")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.id===void 0){let i={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[i]:e.push(i),s++}if(t.branch===void 0){let i={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="id"||i==="branch"||i==="copy"||i==="merge"||i==="hash"||i==="note")){let p={instancePath:n,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="commit"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue:"commit"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.id!==void 0){let i=t.id;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.branch!==void 0){let i=t.branch;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.copy!==void 0){let i=t.copy;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.merge!==void 0){let i=t.merge;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.hash!==void 0){let i=t.hash;if(typeof i=="string"){if(!jn.test(i)){let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/pattern",keyword:"pattern",params:{pattern:"^[0-9a-f]{4,40}$"},message:'must match pattern "^[0-9a-f]{4,40}$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.note!==void 0){let i=t.note;if(typeof i=="string"){if(Oe(i)<1){let p={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="branch")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.branch===void 0){let i={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};e===null?e=[i]:e.push(i),s++}if(t.from===void 0){let i={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="branch"||i==="from")){let p={instancePath:n,schemaPath:"#/oneOf/4/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="branch"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/4/properties/type/const",keyword:"const",params:{allowedValue:"branch"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.branch!==void 0){let i=t.branch;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.from!==void 0){let i=t.from;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/4/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="now")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.to===void 0){let i={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="to")){let p={instancePath:n,schemaPath:"#/oneOf/5/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="now"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/5/properties/type/const",keyword:"const",params:{allowedValue:"now"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.to!==void 0){let i=t.to;if(!(typeof i=="number"&&!(i%1)&&!isNaN(i)&&isFinite(i))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),s++}if(typeof i=="number"&&isFinite(i)&&(i<0||isNaN(i))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/5/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="mark")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.row===void 0){let i={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"row"},message:"must have required property 'row'"};e===null?e=[i]:e.push(i),s++}if(t.from===void 0){let i={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[i]:e.push(i),s++}if(t.to===void 0){let i={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[i]:e.push(i),s++}if(t.color===void 0){let i={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"color"},message:"must have required property 'color'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="row"||i==="from"||i==="to"||i==="color")){let p={instancePath:n,schemaPath:"#/oneOf/6/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="mark"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/6/properties/type/const",keyword:"const",params:{allowedValue:"mark"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.row!==void 0){let i=t.row;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/row",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/row",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.from!==void 0){let i=t.from;if(!(typeof i=="number"&&!(i%1)&&!isNaN(i)&&isFinite(i))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),s++}if(typeof i=="number"&&isFinite(i)&&(i<0||isNaN(i))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),s++}}if(t.to!==void 0){let i=t.to;if(!(typeof i=="number"&&!(i%1)&&!isNaN(i)&&isFinite(i))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),s++}if(typeof i=="number"&&isFinite(i)&&(i<0||isNaN(i))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),s++}}if(t.color!==void 0){let i=t.color;if(!(i==="blue"||i==="amber"||i==="green"||i==="violet"||i==="rose"||i==="slate"||i==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Nt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/6/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="span")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.from===void 0){let i={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[i]:e.push(i),s++}if(t.to===void 0){let i={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[i]:e.push(i),s++}if(t.text===void 0){let i={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="from"||i==="to"||i==="text"||i==="shape"||i==="color")){let p={instancePath:n,schemaPath:"#/oneOf/7/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="span"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/7/properties/type/const",keyword:"const",params:{allowedValue:"span"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.from!==void 0){let i=t.from;if(!(typeof i=="number"&&!(i%1)&&!isNaN(i)&&isFinite(i))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),s++}if(typeof i=="number"&&isFinite(i)&&(i<0||isNaN(i))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),s++}}if(t.to!==void 0){let i=t.to;if(!(typeof i=="number"&&!(i%1)&&!isNaN(i)&&isFinite(i))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),s++}if(typeof i=="number"&&isFinite(i)&&(i<0||isNaN(i))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),s++}}if(t.text!==void 0){let i=t.text;if(typeof i=="string"){if(Oe(i)<1){let p={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.shape!==void 0&&t.shape!=="box"){let i={instancePath:n+"/shape",schemaPath:"#/oneOf/7/properties/shape/enum",keyword:"enum",params:{allowedValues:$s.oneOf[7].properties.shape.enum},message:"must be equal to one of the allowed values"};e===null?e=[i]:e.push(i),s++}if(t.color!==void 0){let i=t.color;if(!(i==="blue"||i==="amber"||i==="green"||i==="violet"||i==="rose"||i==="slate"||i==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Nt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/7/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="leaf")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/8/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.id===void 0){let i={instancePath:n,schemaPath:"#/oneOf/8/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="id"||i==="hash")){let p={instancePath:n,schemaPath:"#/oneOf/8/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="leaf"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/8/properties/type/const",keyword:"const",params:{allowedValue:"leaf"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.id!==void 0){let i=t.id;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.hash!==void 0){let i=t.hash;if(typeof i=="string"){if(!jn.test(i)){let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/pattern",keyword:"pattern",params:{pattern:"^[0-9a-f]{4,40}$"},message:'must match pattern "^[0-9a-f]{4,40}$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/8/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="node")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let i={instancePath:n,schemaPath:"#/oneOf/9/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[i]:e.push(i),s++}if(t.id===void 0){let i={instancePath:n,schemaPath:"#/oneOf/9/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[i]:e.push(i),s++}if(t.children===void 0){let i={instancePath:n,schemaPath:"#/oneOf/9/required",keyword:"required",params:{missingProperty:"children"},message:"must have required property 'children'"};e===null?e=[i]:e.push(i),s++}for(let i in t)if(!(i==="type"||i==="id"||i==="children"||i==="hash")){let p={instancePath:n,schemaPath:"#/oneOf/9/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),s++}if(t.type!==void 0&&t.type!=="node"){let i={instancePath:n+"/type",schemaPath:"#/oneOf/9/properties/type/const",keyword:"const",params:{allowedValue:"node"},message:"must be equal to constant"};e===null?e=[i]:e.push(i),s++}if(t.id!==void 0){let i=t.id;if(typeof i=="string"){if(!Le.test(i)){let p={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}if(t.children!==void 0){let i=t.children;if(Array.isArray(i)){if(i.length<1){let m={instancePath:n+"/children",schemaPath:"#/oneOf/9/properties/children/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[m]:e.push(m),s++}let p=i.length;for(let m=0;m<p;m++){let u=i[m];if(typeof u=="string"){if(!Le.test(u)){let d={instancePath:n+"/children/"+m,schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[d]:e.push(d),s++}}else{let d={instancePath:n+"/children/"+m,schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[d]:e.push(d),s++}}}else{let p={instancePath:n+"/children",schemaPath:"#/oneOf/9/properties/children/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[p]:e.push(p),s++}}if(t.hash!==void 0){let i=t.hash;if(typeof i=="string"){if(!jn.test(i)){let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/pattern",keyword:"pattern",params:{pattern:"^[0-9a-f]{4,40}$"},message:'must match pattern "^[0-9a-f]{4,40}$"'};e===null?e=[p]:e.push(p),s++}}else{let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),s++}}}else{let i={instancePath:n,schemaPath:"#/oneOf/9/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),s++}else if(o==="strip"){let i=s,p=!1,m=s;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.value===void 0){let u={instancePath:n,schemaPath:"#/oneOf/10/anyOf/0/required",keyword:"required",params:{missingProperty:"value"},message:"must have required property 'value'"};e===null?e=[u]:e.push(u),s++}var r=m===s;if(p=p||r,!p){let u=s;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.tag===void 0){let f={instancePath:n,schemaPath:"#/oneOf/10/anyOf/1/required",keyword:"required",params:{missingProperty:"tag"},message:"must have required property 'tag'"};e===null?e=[f]:e.push(f),s++}var r=u===s;p=p||r}if(p)s=i,e!==null&&(i?e.length=i:e=null);else{let u={instancePath:n,schemaPath:"#/oneOf/10/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};e===null?e=[u]:e.push(u),s++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let u={instancePath:n,schemaPath:"#/oneOf/10/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[u]:e.push(u),s++}if(t.field===void 0){let u={instancePath:n,schemaPath:"#/oneOf/10/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};e===null?e=[u]:e.push(u),s++}for(let u in t)if(!(u==="type"||u==="field"||u==="value"||u==="tag")){let d={instancePath:n,schemaPath:"#/oneOf/10/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"};e===null?e=[d]:e.push(d),s++}if(t.type!==void 0&&t.type!=="strip"){let u={instancePath:n+"/type",schemaPath:"#/oneOf/10/properties/type/const",keyword:"const",params:{allowedValue:"strip"},message:"must be equal to constant"};e===null?e=[u]:e.push(u),s++}if(t.field!==void 0){let u=t.field;if(typeof u=="string"){if(Oe(u)<1){let d={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[d]:e.push(d),s++}}else{let d={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[d]:e.push(d),s++}}if(t.value!==void 0){let u=t.value;if(typeof u=="string"){if(Oe(u)<1){let d={instancePath:n+"/value",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[d]:e.push(d),s++}}else{let d={instancePath:n+"/value",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[d]:e.push(d),s++}}if(t.tag!==void 0){let u=t.tag;if(typeof u=="string"){if(Oe(u)<1){let d={instancePath:n+"/tag",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[d]:e.push(d),s++}}else{let d={instancePath:n+"/tag",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[d]:e.push(d),s++}}}else{let u={instancePath:n,schemaPath:"#/oneOf/10/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[u]:e.push(u),s++}}else{let i={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"mapping",tag:"type",tagValue:o},message:'value of tag "type" must be in oneOf'};e===null?e=[i]:e.push(i),s++}else{let i={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"tag",tag:"type",tagValue:o},message:'tag "type" must be string'};e===null?e=[i]:e.push(i),s++}}else{let o={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),s++}return on.errors=e,s===0}function an(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.title===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[r]:e.push(r),s++}if(t.body===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"body"},message:"must have required property 'body'"};e===null?e=[r]:e.push(r),s++}if(t.events===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"events"},message:"must have required property 'events'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="title"||r==="body"||r==="code"||r==="sources"||r==="events")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.title!==void 0){let r=t.title;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.body!==void 0){let r=t.body;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/body",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/body",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.code!==void 0){let r=t.code;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/code",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/code",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.sources!==void 0){let r=t.sources;if(Array.isArray(r)){if(r.length<1){let i={instancePath:n+"/sources",schemaPath:"#/properties/sources/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[i]:e.push(i),s++}let o=r.length;for(let i=0;i<o;i++)sn(r[i],{instancePath:n+"/sources/"+i,parentData:r,parentDataProperty:i,rootData:a})||(e=e===null?sn.errors:e.concat(sn.errors),s=e.length)}else{let o={instancePath:n+"/sources",schemaPath:"#/properties/sources/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}if(t.events!==void 0){let r=t.events;if(Array.isArray(r)){let o=r.length;for(let i=0;i<o;i++)on(r[i],{instancePath:n+"/events/"+i,parentData:r,parentDataProperty:i,rootData:a})||(e=e===null?on.errors:e.concat(on.errors),s=e.length)}else{let o={instancePath:n+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return an.errors=e,s===0}function ln(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.lifelines===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"lifelines"},message:"must have required property 'lifelines'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(r!=="lifelines"){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.lifelines!==void 0){let r=t.lifelines;if(Array.isArray(r)){if(r.length<1){let i={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[i]:e.push(i),s++}let o=r.length;for(let i=0;i<o;i++){let p=r[i];if(typeof p=="string"){if(!Le.test(p)){let m={instancePath:n+"/lifelines/"+i,schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[m]:e.push(m),s++}}else{let m={instancePath:n+"/lifelines/"+i,schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),s++}}}else{let o={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return ln.errors=e,s===0}function cn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.from===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[r]:e.push(r),s++}if(t.to===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="from"||r==="to"||r==="label")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.from!==void 0){let r=t.from;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.to!==void 0){let r=t.to;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.label!==void 0){let r=t.label;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return cn.errors=e,s===0}function pn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.paths===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"paths"},message:"must have required property 'paths'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(r!=="paths"){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.paths!==void 0){let r=t.paths;if(Array.isArray(r)){if(r.length<1){let i={instancePath:n+"/paths",schemaPath:"#/properties/paths/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[i]:e.push(i),s++}let o=r.length;for(let i=0;i<o;i++)cn(r[i],{instancePath:n+"/paths/"+i,parentData:r,parentDataProperty:i,rootData:a})||(e=e===null?cn.errors:e.concat(cn.errors),s=e.length)}else{let o={instancePath:n+"/paths",schemaPath:"#/properties/paths/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return pn.errors=e,s===0}function dn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="id"||r==="note")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.id!==void 0){let r=t.id;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.note!==void 0){let r=t.note;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return dn.errors=e,s===0}function mn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.branches===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"branches"},message:"must have required property 'branches'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(r!=="branches"){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.branches!==void 0){let r=t.branches;if(Array.isArray(r)){if(r.length<1){let i={instancePath:n+"/branches",schemaPath:"#/properties/branches/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[i]:e.push(i),s++}let o=r.length;for(let i=0;i<o;i++)dn(r[i],{instancePath:n+"/branches/"+i,parentData:r,parentDataProperty:i,rootData:a})||(e=e===null?dn.errors:e.concat(dn.errors),s=e.length)}else{let o={instancePath:n+"/branches",schemaPath:"#/properties/branches/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return mn.errors=e,s===0}var mi=new RegExp("^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$","u");function fn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.unit===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"unit"},message:"must have required property 'unit'"};e===null?e=[r]:e.push(r),s++}if(t.length===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"length"},message:"must have required property 'length'"};e===null?e=[r]:e.push(r),s++}if(t.count===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"count"},message:"must have required property 'count'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="unit"||r==="length"||r==="count"||r==="from")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.unit!==void 0){let r=t.unit;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/unit",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/unit",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.length!==void 0){let r=t.length;if(typeof r=="string"){if(!mi.test(r)){let o={instancePath:n+"/length",schemaPath:"#/definitions/duration/pattern",keyword:"pattern",params:{pattern:"^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"},message:'must match pattern "^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/length",schemaPath:"#/definitions/duration/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.count!==void 0){let r=t.count;if(!(typeof r=="number"&&!(r%1)&&!isNaN(r)&&isFinite(r))){let o={instancePath:n+"/count",schemaPath:"#/properties/count/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[o]:e.push(o),s++}if(typeof r=="number"&&isFinite(r)&&(r<1||isNaN(r))){let o={instancePath:n+"/count",schemaPath:"#/properties/count/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[o]:e.push(o),s++}}if(t.from!==void 0){let r=t.from;if(!(typeof r=="number"&&!(r%1)&&!isNaN(r)&&isFinite(r))){let o={instancePath:n+"/from",schemaPath:"#/properties/from/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[o]:e.push(o),s++}if(typeof r=="number"&&isFinite(r)&&(r<0||isNaN(r))){let o={instancePath:n+"/from",schemaPath:"#/properties/from/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return fn.errors=e,s===0}function un(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.name===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[r]:e.push(r),s++}if(t.length===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"length"},message:"must have required property 'length'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="name"||r==="length"||r==="from")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.name!==void 0){let r=t.name;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.length!==void 0){let r=t.length;if(!(typeof r=="number"&&!(r%1)&&!isNaN(r)&&isFinite(r))){let o={instancePath:n+"/length",schemaPath:"#/properties/length/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[o]:e.push(o),s++}if(typeof r=="number"&&isFinite(r)&&(r<1||isNaN(r))){let o={instancePath:n+"/length",schemaPath:"#/properties/length/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[o]:e.push(o),s++}}if(t.from!==void 0){let r=t.from;if(!(typeof r=="number"&&!(r%1)&&!isNaN(r)&&isFinite(r))){let o={instancePath:n+"/from",schemaPath:"#/properties/from/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[o]:e.push(o),s++}if(typeof r=="number"&&isFinite(r)&&(r<0||isNaN(r))){let o={instancePath:n+"/from",schemaPath:"#/properties/from/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return un.errors=e,s===0}function hn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[r]:e.push(r),s++}if(t.name===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="id"||r==="name"||r==="color"||r==="empty")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.id!==void 0){let r=t.id;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.name!==void 0){let r=t.name;if(typeof r=="string"){if(Oe(r)<1){let o={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.color!==void 0){let r=t.color;if(!(r==="blue"||r==="amber"||r==="green"||r==="violet"||r==="rose"||r==="slate"||r==="coin")){let o={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Nt.enum},message:"must be equal to one of the allowed values"};e===null?e=[o]:e.push(o),s++}}if(t.empty!==void 0){let r=t.empty;if(Array.isArray(r)){let o=r.length;for(let i=0;i<o;i++){let p=r[i];if(!(typeof p=="number"&&!(p%1)&&!isNaN(p)&&isFinite(p))){let m={instancePath:n+"/empty/"+i,schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[m]:e.push(m),s++}if(typeof p=="number"&&isFinite(p)&&(p<0||isNaN(p))){let m={instancePath:n+"/empty/"+i,schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[m]:e.push(m),s++}}}else{let o={instancePath:n+"/empty",schemaPath:"#/properties/empty/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return hn.errors=e,s===0}function gn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[r]:e.push(r),s++}if(t.at===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="id"||r==="at")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.id!==void 0){let r=t.id;if(typeof r=="string"){if(!Le.test(r)){let o={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[o]:e.push(o),s++}}else{let o={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[o]:e.push(o),s++}}if(t.at!==void 0){let r=t.at;if(!(typeof r=="number"&&!(r%1)&&!isNaN(r)&&isFinite(r))){let o={instancePath:n+"/at",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[o]:e.push(o),s++}if(typeof r=="number"&&isFinite(r)&&(r<0||isNaN(r))){let o={instancePath:n+"/at",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return gn.errors=e,s===0}function yn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.from===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[r]:e.push(r),s++}if(t.to===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="from"||r==="to")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.from!==void 0){let r=t.from;if(!(typeof r=="number"&&!(r%1)&&!isNaN(r)&&isFinite(r))){let o={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[o]:e.push(o),s++}if(typeof r=="number"&&isFinite(r)&&(r<0||isNaN(r))){let o={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[o]:e.push(o),s++}}if(t.to!==void 0){let r=t.to;if(!(typeof r=="number"&&!(r%1)&&!isNaN(r)&&isFinite(r))){let o={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[o]:e.push(o),s++}if(typeof r=="number"&&isFinite(r)&&(r<0||isNaN(r))){let o={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[o]:e.push(o),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return yn.errors=e,s===0}function bn(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.scale===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scale"},message:"must have required property 'scale'"};e===null?e=[r]:e.push(r),s++}if(t.rows===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"rows"},message:"must have required property 'rows'"};e===null?e=[r]:e.push(r),s++}for(let r in t)if(!(r==="scale"||r==="period"||r==="rows"||r==="points"||r==="zoom")){let o={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};e===null?e=[o]:e.push(o),s++}if(t.scale!==void 0&&(fn(t.scale,{instancePath:n+"/scale",parentData:t,parentDataProperty:"scale",rootData:a})||(e=e===null?fn.errors:e.concat(fn.errors),s=e.length)),t.period!==void 0&&(un(t.period,{instancePath:n+"/period",parentData:t,parentDataProperty:"period",rootData:a})||(e=e===null?un.errors:e.concat(un.errors),s=e.length)),t.rows!==void 0){let r=t.rows;if(Array.isArray(r)){if(r.length<1){let i={instancePath:n+"/rows",schemaPath:"#/properties/rows/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[i]:e.push(i),s++}let o=r.length;for(let i=0;i<o;i++)hn(r[i],{instancePath:n+"/rows/"+i,parentData:r,parentDataProperty:i,rootData:a})||(e=e===null?hn.errors:e.concat(hn.errors),s=e.length)}else{let o={instancePath:n+"/rows",schemaPath:"#/properties/rows/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}if(t.points!==void 0){let r=t.points;if(Array.isArray(r)){let o=r.length;for(let i=0;i<o;i++)gn(r[i],{instancePath:n+"/points/"+i,parentData:r,parentDataProperty:i,rootData:a})||(e=e===null?gn.errors:e.concat(gn.errors),s=e.length)}else{let o={instancePath:n+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[o]:e.push(o),s++}}t.zoom!==void 0&&(yn(t.zoom,{instancePath:n+"/zoom",parentData:t,parentDataProperty:"zoom",rootData:a})||(e=e===null?yn.errors:e.concat(yn.errors),s=e.length))}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[r]:e.push(r),s++}return bn.errors=e,s===0}var fi=Object.prototype.hasOwnProperty;function vs(t,{instancePath:n="",parentData:l,parentDataProperty:c,rootData:a=t}={}){let e=null,s=0,r=s,o=!0,i=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let b;if(t.kind===void 0&&(b="kind")){let h={};e===null?e=[h]:e.push(h),s++}else if(t.kind!==void 0&&t.kind!=="sequence"){let h={};e===null?e=[h]:e.push(h),s++}}var p=i===s;s=r,e!==null&&(r?e.length=r:e=null);let m;if(p){let b=s;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.sequence===void 0){let P={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"sequence"},message:"must have required property 'sequence'"};e===null?e=[P]:e.push(P),s++}if(t.boxes!==void 0){let P=t.boxes;if(Array.isArray(P)&&P.length<1){let q={instancePath:n+"/boxes",schemaPath:"#/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[q]:e.push(q),s++}}if(t.steps!==void 0&&(at(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:a})||(e=e===null?at.errors:e.concat(at.errors),s=e.length)),t.strip!==void 0&&(Be(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:a})||(e=e===null?Be.errors:e.concat(Be.errors),s=e.length)),t.state!==void 0){let P={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),s++}if(t.git!==void 0){let P={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),s++}if(t.time!==void 0){let P={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),s++}}var p=b===s;o=p,m="then"}else{let b=s,h=s,P=!0,q=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let D;if(t.kind===void 0&&(D="kind")){let L={};e===null?e=[L]:e.push(L),s++}else if(t.kind!==void 0&&t.kind!=="state"){let L={};e===null?e=[L]:e.push(L),s++}}var u=q===s;s=h,e!==null&&(h?e.length=h:e=null);let R;if(u){let D=s;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.boxes!==void 0){let j=t.boxes;if(Array.isArray(j)){if(j.length<1){let X={instancePath:n+"/boxes",schemaPath:"#/else/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[X]:e.push(X),s++}let F=j.length;for(let X=0;X<F;X++){let U=j[X];if(U&&typeof U=="object"&&!Array.isArray(U)&&U.id!==void 0){let ee=U.id,re=s,se=s;if(!(ee==="start"||ee==="finish")){let G={};e===null?e=[G]:e.push(G),s++}var d=se===s;if(d){let G={instancePath:n+"/boxes/"+X+"/id",schemaPath:"#/else/then/properties/boxes/items/properties/id/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[G]:e.push(G),s++}else s=re,e!==null&&(re?e.length=re:e=null)}}}}if(t.steps!==void 0&&(at(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:a})||(e=e===null?at.errors:e.concat(at.errors),s=e.length)),t.strip!==void 0&&(Be(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:a})||(e=e===null?Be.errors:e.concat(Be.errors),s=e.length)),t.git!==void 0){let j={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[j]:e.push(j),s++}if(t.time!==void 0){let j={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[j]:e.push(j),s++}}var u=D===s;P=u,R="then"}else{let D=s,L=s,j=!0,F=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let ee;if(t.kind===void 0&&(ee="kind")){let re={};e===null?e=[re]:e.push(re),s++}else if(t.kind!==void 0&&t.kind!=="git"){let re={};e===null?e=[re]:e.push(re),s++}}var f=F===s;s=L,e!==null&&(L?e.length=L:e=null);let X;if(f){let ee=s;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.git===void 0){let se={instancePath:n,schemaPath:"#/else/else/then/required",keyword:"required",params:{missingProperty:"git"},message:"must have required property 'git'"};e===null?e=[se]:e.push(se),s++}if(t.steps!==void 0&&(Ut(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:a})||(e=e===null?Ut.errors:e.concat(Ut.errors),s=e.length)),t.strip!==void 0&&(Be(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:a})||(e=e===null?Be.errors:e.concat(Be.errors),s=e.length)),t.state!==void 0){let se={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[se]:e.push(se),s++}if(t.regions!==void 0){let se={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[se]:e.push(se),s++}if(t.time!==void 0){let se={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[se]:e.push(se),s++}}var f=ee===s;j=f,X="then"}else{let ee=s,re=s,se=!0,G=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let C;if(t.kind===void 0&&(C="kind")){let _={};e===null?e=[_]:e.push(_),s++}else if(t.kind!==void 0&&t.kind!=="time"){let _={};e===null?e=[_]:e.push(_),s++}}var y=G===s;s=re,e!==null&&(re?e.length=re:e=null);let $;if(y){let C=s;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.time===void 0){let K={instancePath:n,schemaPath:"#/else/else/else/then/required",keyword:"required",params:{missingProperty:"time"},message:"must have required property 'time'"};e===null?e=[K]:e.push(K),s++}if(t.steps!==void 0&&(Jt(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:a})||(e=e===null?Jt.errors:e.concat(Jt.errors),s=e.length)),t.state!==void 0){let K={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[K]:e.push(K),s++}if(t.git!==void 0){let K={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[K]:e.push(K),s++}if(t.regions!==void 0){let K={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[K]:e.push(K),s++}}var y=C===s;se=y,$="then"}else{let C=s,_=s,K=!0,T=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let ae;if(t.kind===void 0&&(ae="kind")){let de={};e===null?e=[de]:e.push(de),s++}else if(t.kind!==void 0&&t.kind!=="tree"){let de={};e===null?e=[de]:e.push(de),s++}}var k=T===s;s=_,e!==null&&(_?e.length=_:e=null);let Z;if(k){let ae=s;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.steps!==void 0&&(Zt(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:a})||(e=e===null?Zt.errors:e.concat(Zt.errors),s=e.length)),t.strip!==void 0&&(Be(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:a})||(e=e===null?Be.errors:e.concat(Be.errors),s=e.length)),t.state!==void 0){let me={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[me]:e.push(me),s++}if(t.git!==void 0){let me={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[me]:e.push(me),s++}if(t.time!==void 0){let me={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[me]:e.push(me),s++}if(t.regions!==void 0){let me={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[me]:e.push(me),s++}}var k=ae===s;K=k,Z="then"}else{let ae=s;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.boxes!==void 0){let me=t.boxes;if(Array.isArray(me)&&me.length<1){let ve={instancePath:n+"/boxes",schemaPath:"#/else/else/else/else/else/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[ve]:e.push(ve),s++}}if(t.steps!==void 0&&(at(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:a})||(e=e===null?at.errors:e.concat(at.errors),s=e.length)),t.strip!==void 0&&(Be(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:a})||(e=e===null?Be.errors:e.concat(Be.errors),s=e.length)),t.state!==void 0){let me={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[me]:e.push(me),s++}if(t.git!==void 0){let me={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[me]:e.push(me),s++}if(t.time!==void 0){let me={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[me]:e.push(me),s++}}var k=ae===s;K=k,Z="else"}if(!K){let ae={instancePath:n,schemaPath:"#/else/else/else/else/if",keyword:"if",params:{failingKeyword:Z},message:'must match "'+Z+'" schema'};e===null?e=[ae]:e.push(ae),s++}var y=C===s;se=y,$="else"}if(!se){let C={instancePath:n,schemaPath:"#/else/else/else/if",keyword:"if",params:{failingKeyword:$},message:'must match "'+$+'" schema'};e===null?e=[C]:e.push(C),s++}var f=ee===s;j=f,X="else"}if(!j){let ee={instancePath:n,schemaPath:"#/else/else/if",keyword:"if",params:{failingKeyword:X},message:'must match "'+X+'" schema'};e===null?e=[ee]:e.push(ee),s++}var u=D===s;P=u,R="else"}if(!P){let D={instancePath:n,schemaPath:"#/else/if",keyword:"if",params:{failingKeyword:R},message:'must match "'+R+'" schema'};e===null?e=[D]:e.push(D),s++}if(t&&typeof t=="object"&&!Array.isArray(t)&&t.sequence!==void 0){let D={instancePath:n+"/sequence",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[D]:e.push(D),s++}var p=b===s;o=p,m="else"}if(!o){let b={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:m},message:'must match "'+m+'" schema'};e===null?e=[b]:e.push(b),s++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.version===void 0){let b={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"version"},message:"must have required property 'version'"};e===null?e=[b]:e.push(b),s++}if(t.kind===void 0){let b={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};e===null?e=[b]:e.push(b),s++}if(t.title===void 0){let b={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[b]:e.push(b),s++}if(t.boxes===void 0){let b={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"boxes"},message:"must have required property 'boxes'"};e===null?e=[b]:e.push(b),s++}if(t.steps===void 0){let b={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"steps"},message:"must have required property 'steps'"};e===null?e=[b]:e.push(b),s++}for(let b in t)if(!fi.call(An.properties,b)){let h={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:b},message:"must NOT have additional properties"};e===null?e=[h]:e.push(h),s++}if(t.version!==void 0){let b=t.version;if(!(typeof b=="number"&&!(b%1)&&!isNaN(b)&&isFinite(b))){let h={instancePath:n+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[h]:e.push(h),s++}if(typeof b=="number"&&isFinite(b)&&(b<1||isNaN(b))){let h={instancePath:n+"/version",schemaPath:"#/properties/version/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[h]:e.push(h),s++}}if(t.kind!==void 0){let b=t.kind;if(!(b==="sequence"||b==="architecture"||b==="state"||b==="git"||b==="time"||b==="tree")){let h={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:An.properties.kind.enum},message:"must be equal to one of the allowed values"};e===null?e=[h]:e.push(h),s++}}if(t.title!==void 0){let b=t.title;if(typeof b=="string"){if(Oe(b)<1){let h={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[h]:e.push(h),s++}}else{let h={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[h]:e.push(h),s++}}if(t.view!==void 0){let b=t.view;if(!(b==="fixed"||b==="follow")){let h={instancePath:n+"/view",schemaPath:"#/properties/view/enum",keyword:"enum",params:{allowedValues:An.properties.view.enum},message:"must be equal to one of the allowed values"};e===null?e=[h]:e.push(h),s++}}if(t.regions!==void 0){let b=t.regions;if(Array.isArray(b)){let h=b.length;for(let P=0;P<h;P++)Qt(b[P],{instancePath:n+"/regions/"+P,parentData:b,parentDataProperty:P,rootData:a})||(e=e===null?Qt.errors:e.concat(Qt.errors),s=e.length)}else{let h={instancePath:n+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),s++}}if(t.boxes!==void 0){let b=t.boxes;if(Array.isArray(b)){let h=b.length;for(let P=0;P<h;P++)en(b[P],{instancePath:n+"/boxes/"+P,parentData:b,parentDataProperty:P,rootData:a})||(e=e===null?en.errors:e.concat(en.errors),s=e.length)}else{let h={instancePath:n+"/boxes",schemaPath:"#/properties/boxes/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),s++}}if(t.strip!==void 0&&(nn(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:a})||(e=e===null?nn.errors:e.concat(nn.errors),s=e.length)),t.steps!==void 0){let b=t.steps;if(Array.isArray(b)){if(b.length<1){let P={instancePath:n+"/steps",schemaPath:"#/properties/steps/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[P]:e.push(P),s++}let h=b.length;for(let P=0;P<h;P++)an(b[P],{instancePath:n+"/steps/"+P,parentData:b,parentDataProperty:P,rootData:a})||(e=e===null?an.errors:e.concat(an.errors),s=e.length)}else{let h={instancePath:n+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),s++}}t.sequence!==void 0&&(ln(t.sequence,{instancePath:n+"/sequence",parentData:t,parentDataProperty:"sequence",rootData:a})||(e=e===null?ln.errors:e.concat(ln.errors),s=e.length)),t.state!==void 0&&(pn(t.state,{instancePath:n+"/state",parentData:t,parentDataProperty:"state",rootData:a})||(e=e===null?pn.errors:e.concat(pn.errors),s=e.length)),t.git!==void 0&&(mn(t.git,{instancePath:n+"/git",parentData:t,parentDataProperty:"git",rootData:a})||(e=e===null?mn.errors:e.concat(mn.errors),s=e.length)),t.time!==void 0&&(bn(t.time,{instancePath:n+"/time",parentData:t,parentDataProperty:"time",rootData:a})||(e=e===null?bn.errors:e.concat(bn.errors),s=e.length))}else{let b={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[b]:e.push(b),s++}return vs.errors=e,s===0}var ui=["edge","action","swap","strip","commit","branch","now","mark","span","leaf","node"],hi="#/definitions/absent/not",gi={regions:"sequence / architecture / state",at:"time",into:"time",color:"time",meters:"time"},yi={carry:{field:"text",kind:"tag"}},bi=/\/boxes\/items\/properties\/id\/not$/u,xi=/\/events\/items\/properties\/type\/not$/u,wi=["commit","branch"],$i=/\/events\/items\/not$/u,ki=["now","mark","span"],vi=/\/events\/items\/allOf\/0\/not$/u,Pi=["leaf","node"],Mi=/^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u,Si=/%\)\$$/u,Dn=t=>t.replaceAll("~","~0").replaceAll("/","~1"),Ti="#/definitions/url/pattern",Oi=/^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;function Ni(t){let n=/^\^\[\^(.+)\]\+\$$/u.exec(t)?.[1];if(n===void 0)return;let l=n.match(/\\.|[^\\]/gu)??[];return{space:l.includes("\\s"),chars:l.filter(c=>c!=="\\s").map(c=>c.replace(/^\\/u,""))}}var Ps=(t,n)=>n.filter(l=>l!==t&&l.schemaPath.startsWith(`${t.schemaPath}/`)&&(l.instancePath===t.instancePath||l.instancePath.startsWith(`${t.instancePath}/`)));function Ei(t,n,l){let c=t.params,a=t.instancePath;switch(t.keyword){case"additionalProperties":{let e=String(c.additionalProperty);return{pointer:`${a}/${Dn(e)}`,message:l.additionalProperties(e)}}case"required":{let e=String(c.missingProperty);return{pointer:`${a}/${Dn(e)}`,message:l.required(e)}}case"not":{if(bi.test(t.schemaPath))return{pointer:a,message:l.reserved(Ot)};if(xi.test(t.schemaPath))return{pointer:a,message:l.kindOnly(wi,"git")};if($i.test(t.schemaPath))return{pointer:`${a}/type`,message:l.kindOnly(ki,"time")};if(vi.test(t.schemaPath))return{pointer:`${a}/type`,message:l.kindOnly(Pi,"tree")};let e=a.slice(a.lastIndexOf("/")+1);if(t.schemaPath===hi)return{pointer:a,message:l.not({field:e,kind:gi[e]??e})};let s=yi[e];return{pointer:s?`${a}/${s.field}`:a,message:l.not(s)}}case"anyOf":{let e=Ps(t,n),s=e.every(r=>r.keyword==="required")?e.map(r=>String(r.params.missingProperty)):[];return{pointer:a,message:l.anyOf(s)}}case"discriminator":{let e=String(c.tag);return{pointer:`${a}/${Dn(e)}`,message:l.discriminator(e,ui)}}case"enum":return{pointer:a,message:l.enum(c.allowedValues.map(String))};case"type":return{pointer:a,message:l.type(String(c.type))};case"minLength":return{pointer:a,message:l.minLength(Number(c.limit))};case"pattern":{if(t.schemaPath===Ti)return{pointer:a,message:l.url};let e=String(c.pattern),s=Oi.exec(e);if(s)return{pointer:a,message:l.hex(Number(s[1]),Number(s[2]))};let r=Mi.exec(e);return r?{pointer:a,message:l.duration((r[1]??"").split("|"))}:Si.test(e)?{pointer:a,message:l.ratio}:{pointer:a,message:l.pattern(Ni(e))}}case"minItems":return{pointer:a,message:l.minItems(Number(c.limit))};case"minimum":return{pointer:a,message:l.minimum(Number(c.limit))};case"const":return{pointer:a,message:l.const(String(c.allowedValue))};case"oneOf":return{pointer:a,message:l.oneOf};default:return{pointer:a,message:t.message??t.keyword}}}function Ms(t,n={}){if(Rn(t))return{ok:!0};let l=Rn.errors??[],c=new Set(l.filter(s=>s.keyword==="anyOf").flatMap(s=>Ps(s,l))),a=Xt[n.lang??"ja"];return{ok:!1,errors:l.filter(s=>s.keyword!=="if"&&!c.has(s)).map(s=>Ei(s,l,a))}}var Ss=1;function qi(t){if(typeof t!="object"||t===null)return;let n=t.version;return typeof n=="number"&&n>Ss?n:void 0}var Li=(t,n)=>({pointer:"/version",message:Xt[n].newer(t,Ss)});function Ts(t,n={}){let l=qi(t);if(l!==void 0)return{ok:!1,errors:[Li(l,n.lang??"ja")]};let c=Ms(t,n);return c.ok?{ok:!0,diagram:t,warnings:[]}:c}function Os(t,n){let l={edges:[],events:[],busy:0},c=le.edgeAt,a,e=0,s=Number.NEGATIVE_INFINITY,r=(u,d,f)=>{let y=d.carry.kind!=="none",k=f+(y?le.drawCarry:le.draw);return l.edges.push({event:u,a:f,b:k,carries:y,coin:d.carry.kind==="coin",named:d.label!==void 0}),l.busy=Math.max(l.busy,k),k},o=n?t.events.flatMap((u,d)=>u.type==="now"?[{e:d,to:u.to}]:[]):[],i=n?.from??0,p=Math.max(i,...o.map(u=>u.to+1)),m=u=>u.type==="edge"&&u.at!==void 0&&u.at>=i&&u.at<p;return t.events.forEach((u,d)=>{if(n&&d===o[0]?.e){let f=Math.max(c,s+le.change),y=[[f,i]],k=[];for(let b=i;b<p;b++){let h=f,P=t.events.flatMap((N,D)=>m(N)&&N.at===b?[{k:D,ev:N}]:[]),q=P.reduce((N,D,L)=>Math.max(N,r(D.k,D.ev,h+le.stagger*L)),h),R=Math.max(h+n.speed,P.length>0?q+le.time.wait:h);R-n.speed>h+1e-9&&y.push([R-n.speed,b]),y.push([R,b+1]),k.push({unit:b,at:R}),f=R}l.sweep={keys:y,passed:k},l.busy=Math.max(l.busy,f),c=f+le.time.after,a=f,e=0;return}if(!(u.type==="now"||n&&m(u)))if(u.type==="commit"||u.type==="branch"||u.type==="leaf"||u.type==="node"){let f=c,y=f+le.draw;l.edges.push({event:d,a:f,b:y,carries:!1,coin:!1,named:!1}),c=f+le.stagger,a=y,e=0,l.busy=Math.max(l.busy,y)}else if(u.type==="edge"){let f=c;a=r(d,u,f),c=f+le.stagger,e=0}else if(u.type==="action")l.events.push({event:d,at:c}),l.busy=Math.max(l.busy,c+le.action),c+=le.action,e=0;else{let f=(a??c)+le.change*e++;l.events.push({event:d,at:f}),l.busy=Math.max(l.busy,f),s=Math.max(s,f)}}),l.edges.sort((u,d)=>u.a-d.a),l}function Ns(t,n=!1){let l=t.kind==="time"?t.time:void 0,c=le.time,a=l?Math.min(c.unitMax,Math.max(c.unitMin,c.axis/Math.max(1,l.scale.count))):0,e=0,s=t.steps.map(j=>{if(!l)return Os(j);let F=Os(j,{from:e,speed:a});return e=F.sweep?.keys[F.sweep.keys.length-1]?.[1]??e,F}),r=[],o=le.intro;t.steps.forEach((j,F)=>{let X=Math.min(le.stepMax,Math.max(le.stepMin,le.stepBase+[...j.body].length*le.perChar)),U=Math.max(X,(s[F]?.busy??0)+le.dwell);r.push({start:o,end:o+U}),o+=U});let p=Math.ceil(o+le.outro),m=p-le.tail,u=r[r.length-1],d=n&&u?{start:u.start+(s[s.length-1]?.busy??0),end:m}:void 0,f=d?.start??m,y=[],k=[],b=[],h=[];s.forEach((j,F)=>{let X=r[F],U=[];for(let ee of j.edges){let re=X.start+ee.a;y.push({step:F,event:ee.event,start:re,drawn:X.start+ee.b,end:X.end});let se=t.steps[F]?.events[ee.event],G=t.kind==="git"&&se?.type==="edge"&&se.carry.kind==="tag"&&se.carry.text===se.from;ee.carries&&!G&&h.push({step:F,event:ee.event,who:ee.coin?"coin":"main",a:re,b:X.start+ee.b}),ee.named&&U.push({step:F,event:ee.event,start:re+le.labelDelay,end:X.end})}U.forEach((ee,re)=>{let se=U[re+2];se&&(ee.end=Math.min(ee.end,se.start))});for(let ee of U)d&&ee.end>d.start?ee.end=d.end:(t.kind==="state"&&ee.end<f&&(ee.after={start:ee.end,end:f}),d&&(ee.again=d));k.push(...U);for(let ee of j.events)b.push({step:F,event:ee.event,at:X.start+ee.at})});let P=r[0]?.start??0,q=h.some(j=>j.who==="main"),R=[];for(let j of["main","coin"]){let F=h.filter(X=>X.who===j);F.forEach((X,U)=>{let ee=F[U+1],re=U===0&&(j==="main"||!q);R.push({step:X.step,event:X.event,who:j,depart:X.a,arrive:X.b,start:re?Math.min(P,X.a):X.a,end:ee?Math.max(ee.a,X.b):m})})}R.sort((j,F)=>j.depart-F.depart);let N=t.kind==="state"?Ri(t,y,m):void 0,D=[[0,0]],L=[];return s.forEach((j,F)=>{let X=r[F].start;for(let[U,ee]of j.sweep?.keys??[])D.push([X+U,ee]);for(let U of j.sweep?.passed??[])L.push({unit:U.unit,passed:X+U.at})}),D.push([p,e]),{total:p,last:m,steps:r,edges:y,carriers:R,labels:k,badges:r.map((j,F)=>({step:F,appears:j.start})),events:b,stills:r.map(j=>j.end-le.still),...d?{whole:d}:{},...N?{states:N}:{},...l?{needle:D,units:L,meters:Ai(t,s,r)}:{}}}function Ai(t,n,l){let c=t.time?.period?.length;return(t.strip?.meters??[]).map(({field:a})=>{let e=[[0,0]],s=0;return n.forEach((r,o)=>{let i=l[o].start,p=(t.steps[o]?.events??[]).flatMap((y,k)=>{let b=y.type==="strip"&&y.field===a&&y.value!==void 0?qn(y.value):void 0;return b===void 0?[]:[{e:k,ratio:b}]}),m=p[p.length-1];if(!m)return;let u=r.sweep?.keys??[],d=u[0],f=u[u.length-1];if(d&&f&&f[1]>d[1]){let[y,k]=[d[1],f[1]],b=s,h=y,P=c?Math.floor((k-1e-9)/c)*c:0;if(P>0&&P>=y){let q=i+(u.find(([,N])=>N===P)?.[0]??d[0]),R=e[e.length-1][0];e.push([Math.max(R,q-le.time.reset),s],[q,0]),b=0,h=P}for(let[q,R]of u)R>=h&&e.push([i+q,b+(m.ratio-b)*(R-h)/(k-h)])}else{let y=i+(r.events.find(k=>k.event===m.e)?.at??0);e.push([y,s],[y+le.fade,m.ratio])}s=m.ratio}),{field:a,keys:e}})}var ji=t=>Ot.includes(t);function Ri(t,n,l){let c=new Map,a=s=>{let r=c.get(s)??{box:s,lit:[]};return c.set(s,r),r},e;for(let s of n){let r=t.steps[s.step]?.events[s.event];if(!(r?.type!=="edge"||r.from===r.to)){if(e){let o=a(e.box);o.lit.push({start:e.since,end:s.start}),e.box===r.from&&o.done===void 0&&(o.done=s.start+le.done),e=void 0}ji(r.to)||(e={box:r.to,since:s.drawn})}}return e&&a(e.box).lit.push({start:e.since,end:l}),[...c.values()]}var Rt={app:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2 h22",router:"M -9 -4 h16 M 3 -8 l4 4 l-4 4 M 9 5 h-16 M -3 1 l-4 4 l4 4",on:"M -7 7 L 7 -7 M -1 -7 h8 v8",off:"M -7 -7 L 7 7 M 7 -1 v8 h-8",pool:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",db:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",exe:"M -5 -8 L 7 0 L -5 8 Z",idx:"M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",sign:"M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",env:"M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",lock:"M -5.5 -1 h11 v8 h-11 z M -3.5 -1 v-3 a3.5 3.5 0 0 1 7 0 v3",check:"M -5 0 l3.5 3.5 l6.5 -7",flag:"M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",x:"M -5 -5 l10 10 M 5 -5 l-10 10",chain:"M -1.5 4.5 l-2 2 a3.5 3.5 0 0 1 -5 -5 l3 -3 a3.5 3.5 0 0 1 5 0 M 1.5 -4.5 l2 -2 a3.5 3.5 0 0 1 5 5 l-3 3 a3.5 3.5 0 0 1 -5 0 M -2.5 2.5 l5 -5",net:"M -1.3 -4.6 L -5.8 3 M 1.3 -4.6 L 5.8 3 M -4.3 5.5 H 4.3 M -2.2 -7 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M -9.2 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M 4.8 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0",user:"M -4 -4.5 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0 M -8 9 c0 -5 3.6 -7.5 8 -7.5 s8 2.5 8 7.5",server:"M -9 -8 h18 v7 h-18 z M -9 1 h18 v7 h-18 z M -5 -4.5 h0.01 M -5 4.5 h0.01",key:"M -9 0 a3.5 3.5 0 1 0 7 0 a3.5 3.5 0 1 0 -7 0 M -2 0 h10 M 5 0 v3.5 M 8 0 v2.5",shield:"M 0 -9 l8 3 v5 c0 5 -3.5 8 -8 10 c-4.5 -2 -8 -5 -8 -10 v-5 z",globe:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M -9 0 h18 M 0 -9 c-4.5 4 -4.5 14 0 18 M 0 -9 c4.5 4 4.5 14 0 18",bolt:"M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",doc:"M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",box:"M -9 -4.5 l9 -4.5 l9 4.5 v9 l-9 4.5 l-9 -4.5 z M -9 -4.5 l9 4.5 l9 -4.5 M 0 0 v9",truck:"M -10 -6 h11 v10 h-11 z M 1 -2 h5 l3.5 3.5 v2.5 h-8.5 M -7.5 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0 M 3 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0",card:"M -9 -6.5 h18 a2 2 0 0 1 2 2 v9 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-9 a2 2 0 0 1 2 -2 z M -11 -2 h22 M -7 3 h5",cart:"M -10 -8 h3 l3 11 h11 l2.5 -8 h-15.5 M -4.5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M 5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",clock:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M 0 -5 v5 l3.5 2.5",branch:"M -4 -4.5 v9 M 5 0.5 c0 4 -9 3 -9 6.5 M -6.2 -7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M -6.2 7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M 2.8 -2 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0",cloud:"M -7 6 h13 a4.5 4.5 0 0 0 0.5 -9 a6 6 0 0 0 -11.5 -1 a4.5 4.5 0 0 0 -2 10 z",refresh:"M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",undo:"M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",yen:"M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",layers:"M 0 -8 l9 4.5 l-9 4.5 l-9 -4.5 z M -9 2.5 l9 4.5 l9 -4.5",code:"M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",paint:"M -8 8 c 0 -3 2 -5 4.5 -5 l 9 -9 l 3.5 3.5 l -9 9 c 0 2.5 -2 4.5 -5 4.5 z",tree:"M 0 -5 v4 M -6 -1 h12 M -6 -1 v3 M 6 -1 v3 M -9 2 h6 v6 h-6 z M 3 2 h6 v6 h-6 z M -3 -10 h6 v5 h-6 z",block:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"};var _e=[[0,Number.POSITIVE_INFINITY]],Cn=.5,Es=(t,n)=>t.shown.some(([l,c])=>l<=n&&n<c),In=t=>({text:t.text,rect:{x:t.rect.x,y:t.rect.y,w:t.rect.w,h:t.rect.h},badge:t.badge===!0,...t.part?{part:t.part}:{}});function qs(t,n,l=[]){let c=[];return n.forEach((a,e)=>{let s=t.filter(o=>Es(o,a));s.forEach((o,i)=>{for(let p of s.slice(i+1)){let m=Math.min(o.rect.x+o.rect.w,p.rect.x+p.rect.w)-Math.max(o.rect.x,p.rect.x),u=Math.min(o.rect.y+o.rect.h,p.rect.y+p.rect.h)-Math.max(o.rect.y,p.rect.y);m>Cn&&u>Cn&&c.push({kind:"texts",step:e,texts:[o.text,p.text],spots:[In(o),In(p)]})}});let r=l.filter(o=>Es(o,a));for(let o of s)if(!o.boxed)for(let i of r)_t(i.points,o.rect,Cn)&&c.push({kind:"line",step:e,text:o.text,line:{from:i.from,to:i.to},spots:[In(o)]})}),c}var Pe=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),xn=(t,n)=>t===void 0?n:`<a href="${Pe(t)}">${n}</a>`,Q=t=>Math.round(t*100)/100,$e=t=>t==="coin"?"--c:var(--coin);--ct:var(--coint)":`--c:var(--c-${t});--ct:var(--t-${t})`;function nt(t,n,l,c,a="dg-gl"){let e=t===void 0?void 0:Rt[t];return e?`<path class="${a}" transform="translate(${Q(n)} ${Q(l)}) scale(${c})" d="${e}"/>`:""}function st(t){let n=t.filter((e,s)=>s===0||e[0]!==t[s-1][0]||e[1]!==t[s-1][1]),[l,c]=n[0],a=`M ${Q(l)} ${Q(c)}`;for(let e=1;e<n.length-1;e++){let[s,r]=n[e-1],[o,i]=n[e],[p,m]=n[e+1],u=Math.hypot(o-s,i-r),d=Math.hypot(p-o,m-i),f=Math.min(w.edge.bend,u/2,d/2);a+=` L ${Q(o-(o-s)/u*f)} ${Q(i-(i-r)/u*f)} Q ${Q(o)} ${Q(i)} ${Q(o+(p-o)/d*f)} ${Q(i+(m-i)/d*f)}`}if(n.length>1){let[e,s]=n[n.length-1];a+=` L ${Q(e)} ${Q(s)}`}return a}function Et(t){let[n,l]=t[t.length-1],[c,a]=t[t.length-2],e=Math.hypot(n-c,l-a)||1,s=(n-c)/e,r=(l-a)/e,{arrow:o,arrowHalf:i}=w.edge;return`M ${Q(n-s*o-r*i)} ${Q(l-r*o+s*i)} L ${Q(n)} ${Q(l)} L ${Q(n-s*o+r*i)} ${Q(l-r*o-s*i)}`}function Se(t,n,l,c,a,e,s=_e,r){return t?.push({text:a,rect:He(a,l,c,e,r),shown:s}),`<text class="${n}" x="${Q(l)}" y="${Q(c)}"${r?` text-anchor="${r}"`:""}>${Pe(a)}</text>`}function Ls(t,n){let l=[[0,{opacity:0}]];for(let[c,a]of n)l.push([c,{opacity:0},ge.out],[c+le.fade,{opacity:1}],[a-.1,{opacity:1},ge.inOut],[a+.25,{opacity:0}]);return l.push([t.total,{opacity:0}]),t.kf(l)}function wn(t,n){let l=[];for(let c=0;c<n.length;){let a=c;for(;a+1<n.length&&n[a+1]===n[a]+1;)a++;l.push([t.t.steps[n[c]].start,t.t.steps[n[a]].end]),c=a+1}return Ls(t.m,l)}function As(t,n){let{radius:l,icon:c,iconRadius:a,iconScale:e,nameY:s,line:r}=w.region,{x:o,y:i}=t.header,p=t.lines.map((d,f)=>Se(n,"dg-bz",o,t.y+s+f*r,d,O.regionName)).join(""),m=t.note?Se(n,"dg-bx",o,t.y+s+t.lines.length*r+1,t.note,O.regionNote):"",u=t.icon&&Rt[t.icon]?`<rect class="dg-bi" x="${Q(o)}" y="${Q(i)}" width="${c}" height="${c}" rx="${a}"/>${nt(t.icon,o+c/2,i+c/2,e)}`:"";return`<g style="${$e(t.color)}"><rect class="dg-band" x="${Q(t.x+.5)}" y="${Q(t.y+.5)}" width="${Q(t.w-1)}" height="${Q(t.h-1)}" rx="${l}"/>${u}${p}${m}</g>`}function js(t,n,l,c,a){let e=[[0,t.sub??"","dg-ss"],...l];return e.map(([s,r,o],i)=>{let p=e[i+1]?.[0],m=i===0?p===void 0?"":n.until(p-le.untilFade):p===void 0?n.rise(s):n.rise(s,p-le.untilFade);if(r==="")return"";let u=[[i===0?0:s,p===void 0?Number.POSITIVE_INFINITY:p-le.untilFade]];return`<g${m?` class="dg-a" style="${m}"`:""}>${Se(a,o,t.cx,c,r,o==="dg-ss"?O.boxSub:O.boxSubStrong,u,"middle")}</g>`}).join("")}function Rs(t,n,l,c,a){let e=(s,r="")=>`<rect class="${s}" x="${Q(t.x)}" y="${Q(c)}" width="${Q(t.w)}" height="${a}" rx="${w.box.radius}"${r}/>`;return`${l?`<g class="dg-a" style="${l}">${e("dg-halo")}</g>`:""}${e("dg-st",` ${n.sh}`)}${l?`<g class="dg-a" style="${l}">${e("dg-on")}</g>`:""}`}function $n(t,n,l,c,a){let{icon:e,iconRadius:s,iconScale:r,iconY:o,nameY:i,subY:p}=w.box,m=js(t,n.m,c,t.cy+p,n.ink),u=a?a.length>0?Ls(n.m,a.map(k=>[k.start,k.end])):void 0:l.length>0?wn(n,l):void 0,d=t.iconX??t.cx,f=t.slot?`<rect class="dg-slot" x="${Q(t.slot.x)}" y="${Q(t.slot.y)}" width="${Q(t.slot.w)}" height="${Q(t.slot.h)}" rx="${w.slot.radius}"/>`:"",y="";if(t.icon&&Rt[t.icon]){let k={x:d-e/2,y:t.cy+o-e/2,w:e,h:e};n.ink.push({text:`${t.name} \u306E\u7D75\u67C4`,rect:k,shown:_e,boxed:!0,part:{kind:"icon",box:t.name}}),y=`<rect class="dg-ic" x="${Q(k.x)}" y="${Q(k.y)}" width="${e}" height="${e}" rx="${s}"/>${nt(t.icon,d,t.cy+o,r)}`}return`<g style="${$e(t.color)}">${Rs(t,n,u,t.y,t.h)}${f}${y}${Se(n.ink,"dg-sn",t.cx,t.cy+i,t.name,O.boxName,_e,"middle")}${m}</g>`}function Ds(t,n,l,c){let{pad:a,h:e,nameY:s,subY:r}=w.follow.head,o=js(t,n.m,c,a+r),i=l.length>0?wn(n,l):void 0;return`<g style="${$e(t.color)}">${Rs(t,n,i,a,e)}<text class="dg-sn" x="${Q(t.cx)}" y="${Q(a+s)}" text-anchor="middle">${Pe(t.name)}</text>${o}</g>`}function Cs(t,n){let{icon:l,iconRadius:c,iconScale:a,radius:e}=w.box,s=w.state.ghost,r=t.x+s.pad+l/2,o=t.x+s.pad+l+s.gap,i=t.icon&&Rt[t.icon]?`<rect class="dg-ic" x="${Q(r-l/2)}" y="${Q(t.cy-l/2)}" width="${l}" height="${l}" rx="${c}"/>${nt(t.icon,r,t.cy,a)}`:"",p=t.sub?s.nameY:w.baseline.mark,m=t.sub?Se(n,"dg-ss",o,t.cy+s.subY,t.sub,O.boxSub,_e,"start"):"";return`<g data-ghost="${Pe(t.id)}" style="${$e(t.color)}"><rect class="dg-ghost" x="${Q(t.x)}" y="${Q(t.y)}" width="${Q(t.w)}" height="${t.h}" rx="${e}"/>${i}${Se(n,"dg-sn",o,t.cy+p,t.name,O.boxName,_e,"start")}${m}</g>`}function Is(t,n,l){let{r:c,inset:a}=w.state.done,e=t.x+t.w-a,s=t.y+a;return`<g class="dg-popc dg-a" data-done="${Pe(t.id)}" style="${$e(t.color)};${l.m.pop(n)}"><circle class="dg-done" cx="${Q(e)}" cy="${Q(s)}" r="${c}"/>${nt("check",e,s,.5,"dg-done-ck")}</g>`}function Fs(t,n,l,c){c.push({from:t.from,to:t.to,points:t.points,shown:_e});let a=t.label?.family==="sans",e=t.label?Se(l,`dg-path-t${a?" dg-path-tj":""}`,t.label.x+w.label.padX,t.label.y+t.label.h/2+w.baseline.label,t.label.text,a?O.labelJa:O.label):"";return`<g data-path="${Pe(`${t.from}->${t.to}`)}" style="${$e(n)}"><path class="dg-path" d="${st(t.points)}"/><path class="dg-path-h" d="${Et(t.points)}"/>${e}</g>`}function Bs(t,n,l){let{pad:c}=w.state.side,a=t.y+c+O.regionName.size,e=t.notes.map((s,r)=>Se(l,"dg-side-n",t.x+c,a+w.region.line*(r+1),s,O.regionNote)).join("");return`<g style="${$e(n)}"><rect class="dg-side" x="${Q(t.x+.5)}" y="${Q(t.y+.5)}" width="${Q(t.w-1)}" height="${Q(t.h-1)}" rx="${w.region.radius}"/>${Se(l,"dg-side-t",t.x+c,a,t.title,O.regionName)}${e}</g>`}function _s(t,n,l){let{end:c}=w.state,a=Vt(t),e=t.text===""?"":Se(l,"dg-mark",a[0],a[1],t.text,O.regionNote),s=Q(t.x),r=Q(t.y);return t.kind==="start"?`<g data-end="start"><circle class="dg-start" cx="${s}" cy="${r}" r="${t.r}"/>${e}</g>`:t.ghost?`<g data-end="finish" style="${$e(n)}"><circle class="dg-end-x" cx="${s}" cy="${r}" r="${t.r}"/><circle class="dg-end-xi" cx="${s}" cy="${r}" r="${c.inner}"/>${e}</g>`:`<g data-end="finish"><circle class="dg-end" cx="${s}" cy="${r}" r="${t.r}"/><circle class="dg-end-in" cx="${s}" cy="${r}" r="${c.inner}"/>${e}</g>`}function Gs(t,n,l){return`<line class="dg-ll" x1="${Q(t)}" y1="${Q(n)}" x2="${Q(t)}" y2="${Q(l)}"/>`}function Ys(t,n,l,c=!1){let{m:a}=l;l.traces.push({from:t.from,to:t.to,points:t.points,shown:_e});let e=st(t.points),s=Et(t.points),{start:r,drawn:o,end:i}=n,p=c?[[i,{opacity:1},ge.inOut],[i+.4,{opacity:0}],[a.total,{opacity:0}]]:[[i,{opacity:1},ge.inOut],[i+.4,{opacity:.45}],[l.end+.3,{opacity:.45},ge.inOut],[l.end+1,{opacity:.95}],[a.last,{opacity:.95},ge.inOut],[a.total,{opacity:0}]],m=a.kf([[0,{opacity:0,"stroke-dashoffset":1}],[r,{opacity:0,"stroke-dashoffset":1},ge.inOut],[r+.05,{opacity:1}],[o,{"stroke-dashoffset":0}],[a.last,{"stroke-dashoffset":0}],[a.total,{"stroke-dashoffset":1}],...p]),u=a.kf([[0,{opacity:0}],[o-.05,{opacity:0}],[o,{opacity:1}],...p]),d=-(i-o)*26,f=a.kf([[0,{opacity:0,"stroke-dashoffset":0}],[o,{opacity:0,"stroke-dashoffset":0}],[o+.25,{opacity:.9}],[i-.1,{opacity:.9},ge.inOut],[i+.2,{opacity:0,"stroke-dashoffset":d}],[a.total,{opacity:0,"stroke-dashoffset":d}]]),y=c?a.kf([[0,{opacity:0}],[i,{opacity:0},ge.inOut],[i+.4,{opacity:1}],[a.last,{opacity:1},ge.inOut],[a.total,{opacity:0}]]):"";return{base:`<path class="dg-e" d="${e}"/><path class="dg-eh" d="${s}"/>${c?`<path class="dg-e-past dg-a" d="${e}" style="${y}"/><path class="dg-eh-past dg-a" d="${s}" style="${y}"/>`:""}`,lit:`<g style="${$e(t.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${e}" style="${m}"/><path class="dg-eh-on dg-a" d="${s}" style="${u}"/><path class="dg-flow dg-a" d="${e}" style="${f}"/></g>`}}function Vs(t,n,l){let c=t.family==="sans"?" dg-capj":"",{radius:a}=w.label,e=n.again?[[n.start,n.end],[n.again.start,n.again.end]]:[[n.start,n.end]];l.ink.push({text:t.text,rect:t,shown:e,boxed:!0}),n.after&&l.ink.push({text:t.text,rect:He(t.text,t.x+t.w/2,t.y+t.h/2+w.baseline.label,t.family==="sans"?O.labelJa:O.label,"middle"),shown:[[n.after.start,n.after.end]]});let s=Q(t.x+t.w/2),r=Q(t.y+t.h/2+w.baseline.label),o=n.after?`<g class="dg-cap-past${t.family==="sans"?" dg-cap-pastj":""} dg-a" style="${l.m.vis(n.after.start,n.after.end)}"><text x="${s}" y="${r}" text-anchor="middle">${Pe(t.text)}</text></g>`:"",i=e.map(([p,m])=>`<g class="dg-cap${c} dg-a" style="${$e(t.color)};${l.m.rise(p,m,!0)}"><rect x="${Q(t.x)}" y="${Q(t.y)}" width="${Q(t.w)}" height="${t.h}" rx="${a}"/><text x="${s}" y="${r}" text-anchor="middle">${Pe(t.text)}</text></g>`);return`${o}${i.join("")}`}function Fn(t,n,l,c,a){let e=a?[[n,l],[a.start,a.end]]:[[n,l]];return c.ink.push({text:t.text,rect:t,shown:e,boxed:!0}),e.map(([s,r])=>`<g class="dg-act dg-a" style="${$e(t.color)};${c.m.rise(s,r,!0)}"><rect x="${Q(t.x)}" y="${Q(t.y)}" width="${Q(t.w)}" height="${t.h}" rx="${w.action.radius}"/><text x="${Q(t.x+t.w/2)}" y="${Q(t.y+t.h/2+w.baseline.action)}" text-anchor="middle">${Pe(t.text)}</text></g>`).join("")}function Di(t,n){let l=w.carrier;if(t.carry.kind==="coin")return`<circle class="dg-coin" r="${l.coinR}"/><circle class="dg-coin-in" r="${l.coinIn}"/>`;if(t.carry.kind==="tag"){let c=t.carry.text,a=De(c),e=pe(c,a?O.carrierJa:O.carrier)+l.tagPadX*2;return`<rect class="dg-car" x="${Q(-e/2)}" y="${-l.tagH/2}" width="${Q(e)}" height="${l.tagH}" rx="${l.tagH/2}" ${n}/><text class="dg-car-t${a?" dg-car-tj":""}" y="${w.baseline.carrier}" text-anchor="middle">${Pe(c)}</text>`}return`<rect class="dg-env" x="${-l.envW/2}" y="${-l.envH/2}" width="${l.envW}" height="${l.envH}" rx="3" ${n}/><path class="dg-env-in" d="M -8 -4.5 L 0 1.5 L 8 -4.5"/>`}var Ci=t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2;function kn(t,n,l){let{m:c}=l,a=w.carrier.samples,e=t.wait?[t.wait,...t.points]:t.points,s=mt(e),{depart:r,arrive:o,start:i,end:p}=n,m=[];for(let N=0;N<=a;N++){let[D,L]=Ke(e,Ci(N/a)*s);m.push([r+(o-r)*N/a,D,L])}let u=m[0],d=m[m.length-1],f=t.settle??[d[1],d[2]],y=[[0,u[1],u[2]],...m];t.settle&&y.push([Math.min(o+.3,Math.max(p,o+.01)),f[0],f[1]]),y.push([p,f[0],f[1]],[c.total,f[0],f[1]]);let[k,b]=ot(t.carry),h=t.carry.kind==="tag"?t.carry.text:t.carry.kind==="coin"?"\u786C\u8CA8":"\u5C01\u7B52",P=t.carry.kind==="tag"?{}:{part:{kind:t.carry.kind==="coin"?"coin":"envelope"}},q=N=>({x:N[0]-k,y:N[1]-b,w:k*2,h:b*2});r>i&&l.ink.push({text:h,rect:q([u[1],u[2]]),shown:[[i,r]],boxed:!0,...P}),l.ink.push({text:h,rect:q(f),shown:[[o,p]],boxed:!0,...P});let R=p<c.last?.05:.18;return`<g class="dg-a" style="${c.move(y,c.blink(i+.02,p,R))}">${Di(t,l.sh)}</g>`}function Ws(t,n,l=!1){let{m:c}=n,a=n.t.steps[t.step],e=a.start,s=a.end,{r,ring:o}=w.badge,i={visibility:"visible"},p={visibility:"hidden"},m=t.until===void 0?void 0:n.t.steps[t.until].start,u=m!==void 0&&m<=s+1e-6,d=c.kf([[0,{opacity:0,transform:"scale(.5)",...p}],[e,{opacity:0,transform:"scale(.5)",...p},ge.pop],[e+.35,{opacity:1,transform:"scale(1)",...i}],[s,{opacity:1,transform:"scale(1)",...i},ge.inOut],[s+(u?le.untilFade:.4),{opacity:0,transform:"scale(1)",...p}],[c.total,{opacity:0,transform:"scale(.5)",...p}]]),f=m??c.last,y=u?c.kf([[0,{opacity:0,...p}],[c.total,{opacity:0,...p}]]):c.kf([[0,{opacity:0,...p}],[s,{opacity:0,...p},ge.inOut],[s+.4,{opacity:1,...i}],[f,{opacity:1,...i},ge.inOut],...m===void 0?[]:[[m+le.untilFade,{opacity:0,...p}]],[c.total,{opacity:0,...p}]]),k=c.kf([[0,{opacity:0,transform:"scale(1)"}],[e+.05,{opacity:0,transform:"scale(1)"}],[e+.1,{opacity:.7,transform:"scale(1)"},ge.out],[e+.9,{opacity:0,transform:"scale(2.3)"}],[c.total,{opacity:0,transform:"scale(1)"}]]),b=Q(t.x),h=Q(t.y),P=Q(t.y+w.baseline.badge),q=t.step+1;return n.ink.push({text:String(q),rect:{x:t.x-r,y:t.y-r,w:r*2,h:r*2},shown:[[e,f]],boxed:!0,badge:!0}),`<g class="dg-bd" data-step="${t.step}" style="${$e(t.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${b}" cy="${h}" r="${o}" style="${k}"/><g class="dg-a" style="${y}"><circle class="${l?"dg-bdp-g":"dg-bdp"}" cx="${b}" cy="${h}" r="${o}"/><text class="${l?"dg-bdpt-g":"dg-bdpt"}" x="${b}" y="${P}" text-anchor="middle">${q}</text></g><g class="dg-popc dg-a" style="${d}"><circle class="dg-bdf" cx="${b}" cy="${h}" r="${r}"/><text class="dg-bdft" x="${b}" y="${P}" text-anchor="middle">${q}</text></g></g>`}function Hs(t,n,l,c=!1,a=new Map,e){let{m:s,sh:r}=l,o=w.strip,i=t.y+o.h/2,p=[`<rect class="dg-strip" x="${Q(t.x+.5)}" y="${Q(t.y+.5)}" width="${Q(t.w-1)}" height="${Q(t.h-1)}" rx="${w.region.radius}" ${r}/>`,`<g style="${$e("slate")}"><rect class="dg-bi" x="${Q(t.x+o.pad)}" y="${Q(i-o.icon/2)}" width="${o.icon}" height="${o.icon}" rx="${w.box.iconRadius}"/>${nt("env",t.x+o.pad+o.icon/2,i,.78)}</g>`,Se(l.ink,"dg-sh",t.x+o.titleX,i+w.baseline.stripTitle,t.title,O.stripTitle)];if(t.fields.forEach((m,u)=>{let d=t.fields[u-1];if(d&&d.y===m.y){let h=m.x-o.fieldGap/2;p.push(`<line class="dg-sep" x1="${Q(h)}" y1="${Q(m.y+o.sepInset)}" x2="${Q(h)}" y2="${Q(m.y+o.h-o.sepInset)}"/>`)}p.push(Se(l.ink,"dg-fl",m.x,m.y+o.nameY,m.name,O.fieldName));let f=e?.(m);if(f!==void 0){p.push(f);return}let y=n.get(m.name)??[],k=y.filter(h=>h.value!==void 0),b=y.filter(h=>h.tag!==void 0);k.forEach((h,P)=>{let q=k[P+1]?.at,R=h.value,N=De(R)?"dg-fvj":"dg-fv";l.ink.push({text:R,rect:He(R,m.x,m.y+o.valueY,De(R)?O.fieldValueJa:O.fieldValue),shown:[[h.at,q===void 0?Number.POSITIVE_INFINITY:q-le.untilFade]]});let D=X=>`<text class="${X}" x="${Q(m.x)}" y="${Q(m.y+o.valueY)}">${Pe(R)}</text>`,L=D(N);if(!c){let X=q===void 0?s.rise(h.at):s.rise(h.at,q-le.untilFade);p.push(`<g class="dg-a" style="${X}">${L}</g>`);return}let j=Math.min(h.until,q??h.until),F=`<circle class="dg-fl-now" cx="${Q(m.x+pe(m.name,O.fieldName)+o.now.gap)}" cy="${Q(m.y+o.nameY-O.fieldName.size/3)}" r="${o.now.r}"/>`;p.push(`<g class="dg-fv-now dg-a" data-step="${h.step}" style="${$e(h.color)};${s.rise(h.at,j-le.untilFade)}">${D(`${N} dg-fv-c`)}${F}</g>`),(q===void 0||q>j)&&p.push(`<g class="dg-a" style="${s.vis(j-le.untilFade,q===void 0?s.last:q-le.untilFade)}">${L}</g>`)}),b.forEach((h,P)=>{let q=b[P+1]?.at,R=h.tag,N=[...k].reverse().find(F=>F.at<=h.at+1e-9)?.value,D=m.x+(N?pe(N,De(N)?O.fieldValueJa:O.fieldValue)+o.tagGap:0),L=pe(R,O.tag)+o.tagPadX*2,j=m.y+o.valueY-o.tagH/2-w.baseline.tag;l.ink.push({text:R,rect:{x:D,y:j,w:L,h:o.tagH},shown:[[h.at,q===void 0?Number.POSITIVE_INFINITY:q-le.untilFade]],boxed:!0}),p.push(`<g class="dg-tg dg-popc dg-a" style="${$e(h.color)};${q===void 0?s.pop(h.at):s.pop(h.at,q-le.untilFade)}"><rect x="${Q(D)}" y="${Q(j)}" width="${Q(L)}" height="${o.tagH}" rx="${o.tagH/2}"/><text x="${Q(D+L/2)}" y="${Q(j+o.tagH/2+w.baseline.tag)}" text-anchor="middle">${Pe(R)}</text></g>`)})}),t.trail){let m=t.trail,u=t.fields[t.fields.length-1];if(u&&u.y===m.y){let f=m.x-o.fieldGap/2;p.push(`<line class="dg-sep" x1="${Q(f)}" y1="${Q(m.y+o.sepInset)}" x2="${Q(f)}" y2="${Q(m.y+o.h-o.sepInset)}"/>`)}p.push(Se(l.ink,"dg-fl",m.x,m.y+o.nameY,m.title,O.fieldName));let d=m.y+o.valueY-O.fieldValue.size/3;m.states.forEach((f,y)=>{let k=Q(m.x+o.trail.r+y*o.trail.step),b=a.get(f.box),h=b===void 0?"":`<circle class="dg-tr-fill dg-a" cx="${k}" cy="${Q(d)}" r="${o.trail.r}" style="${s.pop(b)}"/>`;p.push(`<g data-trail="${Pe(f.box)}" style="${$e(f.color)}"><circle class="dg-tr-ring" cx="${k}" cy="${Q(d)}" r="${o.trail.r}"/>${h}</g>`)})}return p.join("")}var lt=t=>Math.round(t*100)/100,zs=t=>[t.x+t.w/2,t.y+t.h/2];function Ii(t,n){let l=w.carrier,c=De(t),a=pe(t,c?O.carrierJa:O.carrier)+l.tagPadX*2;return`<rect class="dg-car" x="${lt(-a/2)}" y="${-l.tagH/2}" width="${lt(a)}" height="${l.tagH}" rx="${l.tagH/2}" ${n}/><text class="dg-car-t${c?" dg-car-tj":""}" y="${w.baseline.carrier}" text-anchor="middle">${Pe(t)}</text>`}function Ks(t,n,l,c){let{m:a}=c,e=w.git,s=(d,f)=>l.edges.find(y=>y.step===d&&y.event===f),r=t.links.map(d=>{let f=s(d.step,d.event);if(!f)return"";c.traces.push({from:d.from,to:d.to,points:d.points,shown:[[f.start,Number.POSITIVE_INFINITY]]});let y=st(d.points);if(d.kind==="copy")return`<g style="${$e(d.color)}"><path class="dg-git-cp dg-a" d="${y}" style="${a.vis(f.start,a.last)}"/></g>`;let k=a.kf([[0,{opacity:0,"stroke-dashoffset":1}],[f.start,{opacity:0,"stroke-dashoffset":1},ge.inOut],[f.start+.05,{opacity:1}],[f.drawn,{"stroke-dashoffset":0}],[a.last,{opacity:1,"stroke-dashoffset":0},ge.inOut],[a.total,{opacity:0,"stroke-dashoffset":0}]]);return`<g style="${$e(d.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${y}" style="${k}"/></g>`}).join(""),o=t.commits.map(d=>{let f=s(d.step,d.event)?.drawn??0,y={x:d.cx-d.r,y:d.cy-d.r,w:d.r*2,h:d.r*2};c.ink.push({text:d.id,rect:y,shown:[[f,Number.POSITIVE_INFINITY]],boxed:!0});let k=(d.text?.lines??[]).map((N,D)=>{let L=D===0&&d.hash!==void 0,j=d.text?.baselines[D]??d.cy;return Se(c.ink,L?"dg-git-h":"dg-git-n",d.cx,j,N,L?O.gitHash:O.gitNote,[[f,Number.POSITIVE_INFINITY]],"middle")}).join(""),b=`<text class="dg-git-id" x="${lt(d.cx)}" y="${lt(d.cy+w.baseline.badge)}" text-anchor="middle">${Pe(d.id)}</text>`,h=`<g class="dg-popc dg-a" style="${a.pop(f)}"><circle class="dg-git-c" cx="${lt(d.cx)}" cy="${lt(d.cy)}" r="${d.r}" ${c.sh}/>${b}</g>`,P=k===""?"":`<g class="dg-a" style="${a.vis(f)}">${k}</g>`,q=d.orphan===void 0?void 0:s(d.orphan,d.orphanEvent??0)?.drawn,R=q===void 0?"":`<g class="dg-a" data-orphan="${Pe(d.id)}" style="${a.vis(q,a.last,{f:.5})}"><circle class="dg-git-old" cx="${lt(d.cx)}" cy="${lt(d.cy)}" r="${e.orphan}"/><text class="dg-git-oldl" x="${lt(d.cx)}" y="${lt(d.cy+w.baseline.badge)}" text-anchor="middle">${Pe(d.id)}</text></g>`;return`<g data-commit="${Pe(d.id)}" style="${$e(d.color)}">${h}${P}${R}</g>`}).join(""),i=t.moves.flatMap(d=>{let f=s(d.step,d.event);if(!d.line||!f)return[];let y=l.steps[d.step].end;c.traces.push({from:d.ref,to:d.target??d.ref,points:d.line,shown:[[f.start,y+.4]]});let k=a.kf([[0,{opacity:0,"stroke-dashoffset":1}],[f.start,{opacity:0,"stroke-dashoffset":1},ge.inOut],[f.start+.05,{opacity:1}],[f.drawn,{"stroke-dashoffset":0}],[y,{opacity:1},ge.inOut],[y+.4,{opacity:0}],[a.total,{opacity:0,"stroke-dashoffset":0}]]);return[`<g style="${$e(d.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${st(d.line)}" style="${k}"/></g>`]}).join(""),p=l.carriers.flatMap(d=>{let f=t.moves.find(b=>b.step===d.step&&b.event===d.event&&b.line),y=n.steps[d.step]?.events[d.event];if(!f?.line||y?.type!=="edge")return[];let k={step:d.step,event:d.event,from:f.ref,to:f.target??f.ref,points:f.line,color:f.color,carry:y.carry};return[kn(k,{...d,start:d.depart,end:d.arrive+le.fade},c)]}).join(""),u=[...new Set(t.moves.map(d=>d.ref))].map(d=>Fi(d,t.moves.filter(f=>f.ref===d),s,c)).join("")+p;return{links:r,lines:i,commits:o,tags:u}}function Fi(t,n,l,c){let{m:a}=c,e=[],s=[[0,{opacity:0}]],r=!1,o,i=d=>{o&&c.ink.push({text:t,rect:o.rect,shown:[[o.since,d]],boxed:!0}),o=void 0};for(let d of n){let f=l(d.step,d.event);if(!f)continue;let{start:y,drawn:k}=f,b=d.from?zs(d.from):void 0,h=d.to?zs(d.to):void 0;if(i(y),d.carried&&b&&h&&r){e.push([y+le.fade,b[0],b[1]],[k-le.fade,h[0],h[1]]),s.push([y,{opacity:1},ge.inOut],[y+le.fade,{opacity:0}],[k-le.fade,{opacity:0},ge.out],[k,{opacity:1}]),o={rect:d.to,since:k};continue}if(b&&e.push([y,b[0],b[1]]),h&&e.push([k,h[0],h[1]]),h&&!r){let P=b?y:k-le.fade;s.push([P,{opacity:0},ge.out],[P+le.fade,{opacity:1}]),r=!0}else!h&&r&&(s.push([k,{opacity:1},ge.inOut],[k+le.untilFade,{opacity:0}]),r=!1);d.to&&(o={rect:d.to,since:k})}if(i(Number.POSITIVE_INFINITY),e.length===0)return"";let p=e[0],m=e[e.length-1];r?s.push([a.last,{opacity:1},ge.inOut],[a.total,{opacity:0}]):s.push([a.total,{opacity:0}]);let u=a.move([[0,p[1],p[2]],...e,[a.total,m[1],m[2]]],s);return`<g class="dg-a" data-ref="${Pe(t)}" style="${u}">${Ii(t,c.sh)}</g>`}var oe=t=>Math.round(t*100)/100,Pt=(t,n)=>De(n)?`${t} ${t}j`:t,Dt=t=>({...t,family:"sans"});function Xs(t){let n=[];for(let l of t){let c=n[n.length-2],a=n[n.length-1];if(c&&a){let e=a[0]===c[0]?Number.NaN:(a[1]-c[1])/(a[0]-c[0]),s=l[0]===a[0]?Number.NaN:(l[1]-a[1])/(l[0]-a[0]);Number.isFinite(e)&&Number.isFinite(s)&&Math.abs(e-s)<1e-9?n[n.length-1]=l:n.push(l)}else n.push(l)}return n}function Us(t,n){let l=t[0];if(!l)return 0;if(n<=l[0])return l[1];for(let c=1;c<t.length;c++){let[a,e]=t[c],[s,r]=t[c-1];if(n<=a)return a===s?e:r+(e-r)*(n-s)/(a-s)}return t[t.length-1][1]}function Js(t,n,l,c,a){let{m:e,ink:s}=c,r=w.time,{axis:o}=t,i=new Map((l.units??[]).map($=>[$.unit,$.passed])),p=($,A)=>l.events.find(C=>C.step===$&&C.event===A)?.at,m=($,A)=>l.edges.find(C=>C.step===$&&C.event===A)?.drawn,u=[],d=[],f=[],y=[],k=Math.min(...t.rows.map($=>$.y)),b=Math.max(...t.rows.map($=>$.y+$.h)),h=new Map;for(let $ of t.wires){let A=m($.step,$.event);A!==void 0&&h.set($.to,Math.min(h.get($.to)??Number.POSITIVE_INFINITY,A))}let P=($,A)=>{let C=t.zoom?.columns.find(K=>K.unit===A)?.boxes.find(K=>K.id===$),_=[i.get(A),C?h.get(C):void 0].filter(K=>K!==void 0);return _.length>0?Math.min(..._):void 0};for(let $ of t.periods)$.index%2===1&&u.push(`<rect class="dg-tm-ep" x="${oe($.x)}" y="${oe(k-r.shade)}" width="${oe($.w)}" height="${oe(b-k+r.shade*2)}" rx="4"/>`);if(t.zoom){let $=t.zoom;$.columns.forEach((A,C)=>{C>0&&u.push(`<line class="dg-tm-sep" x1="${oe(A.x)}" y1="${oe(A.y+r.sep)}" x2="${oe(A.x)}" y2="${oe(A.y+A.h-r.sep)}"/>`),u.push(Se(s,Pt("dg-tm-hd",A.head),A.x+A.w/2,$.headY,A.head,O.timeHead,_e,"middle"));for(let _ of A.boxes)f.push(q(_,A.unit))})}function q($,A){let C=[...new Set(t.wires.filter(Z=>Z.from===$||Z.to===$).map(Z=>Z.step))].sort((Z,ie)=>Z-ie),_=Z=>`<rect class="${Z}" x="${oe($.x)}" y="${oe($.y)}" width="${oe($.w)}" height="${$.h}" rx="${w.box.radius}"/>`;if($.empty){let Z=i.get(A),ie=t.zoom?.empty??"",ae=Z===void 0?"":`<g class="dg-a" style="${e.vis(Z)}">${_("dg-tm-ex")}${Se(s,"dg-tm-ext",$.cx,$.cy+w.baseline.mark,ie,O.emptyText,[[Z,Number.POSITIVE_INFINITY]],"middle")}</g>`;return`<g data-empty="${Pe($.id)}">${_("dg-tm-ph")}${ae}</g>`}let K=xn(n.boxes.find(Z=>Z.id===$.id)?.link,$n($,c,C,a.get($.id)??[]));if(!$.row)return K;let T=P($.row,A);return T===void 0?_("dg-tm-ph"):`<g class="dg-a" style="${e.until(T)}">${_("dg-tm-ph")}</g><g class="dg-popc dg-a" style="${e.pop(T)}">${K}</g>`}for(let $ of t.rows){let A=[];for(let C of t.marks.filter(_=>_.row===$.id)){let _=(T,Z="")=>`<rect class="${T}" x="${oe(C.x)}" y="${oe(C.y)}" width="${oe(C.w)}" height="${oe(C.h)}" rx="${r.markRadius}"${Z}/>`;if(A.push(_("dg-tm-slot")),C.empty){let T=i.get(C.unit);T!==void 0&&A.push(`<circle class="dg-tm-x dg-a" cx="${oe(C.x+C.w/2)}" cy="${oe(C.y+C.h/2)}" r="${r.emptyR}" style="${e.vis(T,e.last,{f:.2})}"/>`);continue}let K=P($.id,C.unit);K!==void 0&&A.push(_("dg-tm-m dg-a",` style="${e.vis(K,e.last,{f:.2})}"`)),C.colors.forEach((T,Z)=>{let ie=p(T.step,T.event);if(ie===void 0)return;let ae=C.colors[Z+1],de=ae?p(ae.step,ae.event):void 0;A.push(`<g style="${$e(T.color)}">${_("dg-tm-m dg-a",` style="${e.vis(ie,de??e.last,{f:.35})}"`)}</g>`)})}u.push(`<g data-row="${Pe($.id)}" style="${$e($.color)}">${A.join("")}</g>`),u.push(Se(s,"dg-tm-rn",w.margin+w.region.inset,$.y+$.h/2+w.baseline.mark,$.name,O.timeRow))}if(t.zoom){let $=t.zoom,A=t.spans.filter(K=>K.kind==="box"&&K.from<=$.to&&$.from<=K.to).map(K=>p(K.step,K.event)).filter(K=>K!==void 0).sort((K,T)=>K-T)[0],C=$.guides.map(K=>`<path class="dg-tm-gd" d="${st(K)}"/>`).join(""),_=`<rect class="dg-tm-fr" x="${oe($.frame.x)}" y="${oe($.frame.y)}" width="${oe($.frame.w)}" height="${oe($.frame.h)}" rx="4"/>${C}`;u.push(A===void 0?_:`<g class="dg-a" style="${e.until(A)}">${_}</g>`)}let R=$=>oe(o.x+$*o.unit),N=t.ticks.map($=>`M ${R($.at)} ${oe(o.line-r.major/2)} V ${oe(o.line+r.major/2)}`),D=t.minor.map($=>`M ${R($)} ${oe(o.line-r.minor/2)} V ${oe(o.line+r.minor/2)}`);u.push(`<path class="dg-tm-ax" d="M ${R(0)} ${oe(o.line)} H ${R(o.count)} ${[...N,...D].join(" ")}"/>`);for(let $ of t.ticks)u.push(Se(s,Pt("dg-tm-tk",$.text),$.left,$.y,$.text,O.timeTick));for(let $ of t.periods)u.push(Se(s,Pt("dg-tm-en",$.name),$.x+$.w/2,$.nameY,$.name,O.timePeriod,_e,"middle")),u.push(Se(s,Pt("dg-tm-er",$.range),$.x+$.w/2,$.rangeY,$.range,O.timeRange,_e,"middle"));for(let $ of t.spans){let A=p($.step,$.event);if(A===void 0)continue;let C=$.until===void 0?void 0:l.steps[$.until].start,_=[[A,C??Number.POSITIVE_INFINITY]],K=C===void 0?e.vis(A):e.vis(A,C,{within:!0});if($.kind==="bracket"){let[Z,ie,ae,de]=[oe($.x+1),oe($.x+$.w-1),oe($.y),oe($.y+$.h)],me=Se(s,Pt("dg-tm-bt",$.text),$.textRect.x+$.textRect.w/2,$.textY,$.text,O.spanText,_,"middle");u.push(`<g class="dg-a" data-span="${$.step}" style="${$e($.color)};${K}"><path class="dg-tm-br" d="M ${Z} ${ae} L ${Z} ${de} L ${ie} ${de} L ${ie} ${ae}"/>${me}</g>`);continue}u.push(`<g class="dg-a" data-span="${$.step}" style="${$e($.color)};${K}"><rect class="dg-tm-bx" x="${oe($.x)}" y="${oe($.y)}" width="${oe($.w)}" height="${oe($.h)}" rx="6"/></g>`);let T=$.textRect;s.push({text:$.text,rect:T,shown:_,boxed:!0}),y.push(`<g class="dg-tg dg-popc dg-a" style="${$e($.color)};${C===void 0?e.pop(A):e.pop(A,C)}"><rect x="${oe(T.x)}" y="${oe(T.y)}" width="${oe(T.w)}" height="${T.h}" rx="${T.h/2}"/><text x="${oe(T.x+T.w/2)}" y="${oe($.textY)}" text-anchor="middle">${Pe($.text)}</text></g>`)}let L=r.point;for(let $ of t.points){let{cx:A,cy:C,r:_}=$,K=$.changes.map(xe=>p(xe.step,xe.event)??Number.POSITIVE_INFINITY),T=K[0];u.push(`<path class="dg-tm-con" d="M ${oe(A)} ${oe(b+3)} L ${oe(A)} ${oe(C-_-2)}"/>`);let Z=$.text.x,ie=Se(s,Pt("dg-tm-pn",$.id),Z,C+L.nameY,$.id,O.pointName),ae=ie.replace(/class="([^"]*)"/u,'class="$1 dg-tm-pn-g"'),de=T===void 0||!Number.isFinite(T)?ae:`<g class="dg-a" style="${e.until(T)}">${ae}</g><g class="dg-a" style="${e.vis(T)}">${ie}</g>`,me=$.changes.map((xe,Te)=>{let S=K[Te];if(!Number.isFinite(S))return"";let v=K[Te+1],z=v!==void 0&&Number.isFinite(v)?v-le.untilFade:void 0,M=Se(s,Pt("dg-tm-ps",xe.text),Z,C+L.stateY,xe.text,O.pointState,[[S,z??Number.POSITIVE_INFINITY]]);return`<g class="dg-a" style="${$e(xe.color??"slate")};${z===void 0?e.rise(S):e.rise(S,z)}">${M}</g>`}).join(""),ve=$.changes.map((xe,Te)=>{let S=K[Te];return!xe.color||!Number.isFinite(S)?"":`<g class="dg-popc dg-a" style="${$e(xe.color)};${e.pop(S)}"><circle class="dg-tm-pc" cx="${oe(A)}" cy="${oe(C)}" r="${_+.5}"/>${nt("flag",A,C,L.glyph,"dg-tm-pcg")}</g>`}).join("");f.push(`<g data-point="${Pe($.id)}"><circle class="dg-tm-pg" cx="${oe(A)}" cy="${oe(C)}" r="${_}"/>${nt("flag",A,C,L.glyph,"dg-tm-pgl")}${ve}${de}${me}</g>`)}let j=new Set(t.wires.map($=>`${$.step}/${$.event}`));for(let $ of t.edges){if(j.has(`${$.step}/${$.event}`))continue;let A=l.edges.find(K=>K.step===$.step&&K.event===$.event);if(!A)continue;c.traces.push({from:$.from,to:$.to,points:$.points,shown:[[A.start,Number.POSITIVE_INFINITY]]});let C=e.kf([[0,{opacity:0,"stroke-dashoffset":1}],[A.start,{opacity:0,"stroke-dashoffset":1},ge.inOut],[A.start+.05,{opacity:1}],[A.drawn,{"stroke-dashoffset":0}],[e.last,{opacity:1,"stroke-dashoffset":0},ge.inOut],[e.total,{opacity:0,"stroke-dashoffset":0}]]),_=e.kf([[0,{opacity:0}],[A.drawn-.05,{opacity:0}],[A.drawn,{opacity:1}],[e.last,{opacity:1},ge.inOut],[e.total,{opacity:0}]]);d.push(`<g data-link="${Pe(`${$.from}->${$.to}`)}" style="${$e($.color)}"><path class="dg-tm-ln dg-a" pathLength="1" d="${st($.points)}" style="${C}"/><path class="dg-eh-on dg-a" d="${Et($.points)}" style="${_}"/></g>`)}let F=l.needle??[],X=Xs(F.filter(([$])=>$<e.total)),U=X[X.length-1]?.[1]??0,ee=[...X.map(([$,A])=>[$,o.x+A*o.unit,0]),[e.last,o.x+U*o.unit,0],[e.total,o.x,0]],{y1:re,y2:se}=t.needle,G=r.needle;return y.push(`<g class="dg-a" data-needle="" style="${e.move(ee)}"><line class="dg-tm-nd" x1="0" y1="${oe(re)}" x2="0" y2="${oe(se)}"/><path class="dg-tm-nh" d="M ${-G.head*.75} ${oe(re-G.head)} L ${G.head*.75} ${oe(re-G.head)} L 0 ${oe(re)} Z"/><circle class="dg-tm-nh" cy="${oe(o.line)}" r="${G.dot}"/></g>`),{base:u.join(""),lit:d.join(""),node:f.join(""),top:y.join("")}}function Zs(t,n,l){let{m:c}=l,a=w.time.meter,{x:e,w:s,line:r,text:o}=t.meter,i=t.y+a.y,p=c.kf([...Xs(n).map(([u,d])=>[u,{transform:`scaleX(${oe(d*1e3)/1e3})`}]),[c.last,{transform:`scaleX(${oe(Us(n,c.last)*1e3)/1e3})`},ge.inOut],[c.total,{transform:"scaleX(0)"}]]),m=e+s*r;return`<rect class="dg-tm-mt" x="${oe(e)}" y="${oe(i)}" width="${oe(s)}" height="${a.h}" rx="${a.h/2}"/><rect class="dg-tm-mf dg-a" x="${oe(e)}" y="${oe(i)}" width="${oe(s)}" height="${a.h}" rx="${a.h/2}" style="${$e(a.color)};${p}"/><line class="dg-tm-mk" x1="${oe(m)}" y1="${oe(i-a.mark)}" x2="${oe(m)}" y2="${oe(i+a.h+a.mark)}"/>`+Se(l.ink,"dg-tm-ml",m,t.y+a.textY,o,O.meterLine,_e,"middle")}function Qs(t,n,l,c,a,e){let s=n.steps[l],r=Us(n.needle??[],s.end-le.still),o=t.axis.x+r*t.axis.unit,i=Math.min(...t.rows.map(y=>y.y)),p=Math.max(...t.rows.map(y=>y.y+y.h)),m={x:o-1,y:i,w:2,h:p-i},u=t.badges.find(y=>y.step===l),d=y=>Math.hypot(Math.max(0,y.x-o,o-y.x-y.w),Math.max(0,y.y-i,i-y.y-y.h)),f=[...u?[{x:u.x-w.badge.r,y:u.y-w.badge.r,w:w.badge.r*2,h:w.badge.r*2}]:[],...[...c].sort((y,k)=>d(y)-d(k))];for(let y of f){let k=Math.min(m.x,y.x),b=Math.min(m.y,y.y),h={x:k,y:b,w:Math.max(m.x+m.w,y.x+y.w)-k,h:Math.max(m.y+m.h,y.y+y.h)-b};h.w<=a&&h.h<=e&&(m=h)}return m}var rt=t=>Math.round(t*100)/100;function er(t,n,l,c){let{m:a}=c,e=w.tree,s=w.box,r=(N,D)=>l.edges.find(L=>L.step===N&&L.event===D),o=new Map,i=new Map;n.steps.forEach((N,D)=>{for(let L of N.events)if(L.type==="edge")for(let j of[L.from,L.to])o.set(j,(o.get(j)??new Set).add(D)),L.carry.kind!=="none"&&!i.has(j)&&i.set(j,D)});let p=(N,D)=>{let L=n.steps[N]?.events[D];return L?.type==="edge"&&L.carry.kind!=="none"},m=t.runs.filter(N=>p(N.step,N.event)).reduce((N,D)=>N===void 0?D.step:Math.min(N,D.step),void 0),u=m===void 0?void 0:l.steps[m]?.start,d=N=>{if(m===void 0||u===void 0)return;let D=i.get(N);if(D!==void 0&&D<=m)return;let L=D===void 0?void 0:l.steps[D]?.start,j=[[0,{opacity:1}],[u,{opacity:1},ge.inOut],[u+le.fade,{opacity:e.faint}]];return L!==void 0&&j.push([L,{opacity:e.faint},ge.inOut],[L+le.fade,{opacity:1}]),j.push([a.last,{opacity:L===void 0?e.faint:1},ge.inOut],[a.total,{opacity:1}]),a.kf(j)},f=(N,D,L="")=>{let j=d(N);return j?`<g class="dg-a"${L} style="${j}">${D}</g>`:L===""?D:`<g${L}>${D}</g>`},y=new Map(t.nodes.map(N=>[N.id,r(N.step,N.event)?.drawn??0])),k=t.links.map(N=>{let D=r(N.step,N.event);if(!D)return"";c.traces.push({from:N.from,to:N.to,points:N.points,shown:[[D.start,Number.POSITIVE_INFINITY]]});let L=a.kf([[0,{opacity:0,"stroke-dashoffset":1}],[D.start,{opacity:0,"stroke-dashoffset":1},ge.inOut],[D.start+.05,{opacity:1}],[D.drawn,{"stroke-dashoffset":0}],[a.last,{opacity:1,"stroke-dashoffset":0},ge.inOut],[a.total,{opacity:0,"stroke-dashoffset":0}]]);return f(N.from,`<path class="dg-tree-l dg-a" data-tree-link="${Pe(N.from)}" pathLength="1" d="${st(N.points)}" style="${L}"/>`)}).join(""),b=t.nodes.flatMap(N=>{if(!N.card)return[];let D=y.get(N.id)??0,L=`M ${rt(N.cx)} ${rt(N.y+N.h+w.edge.inset)} V ${rt(N.card.y-w.edge.inset)}`;return[f(N.id,`<path class="dg-tree-con dg-a" d="${L}" style="${a.vis(D)}"/>`)]}).join(""),h=new Set,P=t.runs.flatMap(N=>{let D=t.edges.find(re=>re.step===N.step&&re.event===N.event);if(!D||h.has(N.link))return[];let L=l.carriers.find(re=>re.step===N.step&&re.event===N.event),j=r(N.step,N.event),F=L?.depart??j?.start,X=L?.arrive??j?.drawn;if(F===void 0||X===void 0)return[];h.add(N.link);let U=a.kf([[0,{opacity:0,"stroke-dashoffset":1}],[F,{opacity:0,"stroke-dashoffset":1},ge.inOut],[F+.05,{opacity:1}],[X,{"stroke-dashoffset":0}],[a.last,{opacity:1,"stroke-dashoffset":0},ge.inOut],[a.total,{opacity:0,"stroke-dashoffset":0}]]),ee=st(D.points);return[`<g style="${$e(D.color)}"><path class="dg-tree-tr dg-a" data-tree-trail="${Pe(N.link)}" pathLength="1" d="${ee}" style="${U}"/><path class="dg-tree-h dg-a" d="${Et(D.points)}" style="${a.vis(X)}"/></g>`]}).join(""),q=t.nodes.flatMap(N=>{let D=N.card;if(!D)return[];let L=D.x+e.card.padX+e.card.icon/2,j=D.y+D.h/2,F=Se(c.ink,"dg-tree-ct",D.x+e.card.padX+e.card.icon+e.card.gap,j+w.baseline.label,D.text,O.treeCard,_e);return[f(N.id,`<rect class="dg-tree-card" x="${rt(D.x)}" y="${rt(D.y)}" width="${rt(D.w)}" height="${D.h}" rx="${e.card.radius}"/>${nt("doc",L,j,e.card.glyph,"dg-tree-cg")}${F}`,` data-tree-card="${Pe(N.id)}"`)]}).join(""),R=t.nodes.map(N=>{let D=y.get(N.id)??0,L=[...o.get(N.id)??[]].sort((A,C)=>A-C),j=L.length>0?wn(c,L):void 0,F=N.root?e.root.radius:e.radius,X=(A,C="")=>`<rect class="${A}" x="${rt(N.x)}" y="${rt(N.y)}" width="${rt(N.w)}" height="${N.h}" rx="${F}"${C}/>`,U=`${j?`<g class="dg-a" style="${j}">${X("dg-halo")}</g>`:""}${X("dg-st",` ${c.sh}`)}${j?`<g class="dg-a" style="${j}">${X("dg-on")}</g>`:""}`,ee=N.x+e.root.iconX+s.icon/2,re=N.root?`<rect class="dg-ic" x="${rt(ee-s.icon/2)}" y="${rt(N.cy-s.icon/2)}" width="${s.icon}" height="${s.icon}" rx="${s.iconRadius}"/>${nt("tree",ee,N.cy,s.iconScale)}`:"",se=[[D,Number.POSITIVE_INFINITY]],G=N.lines.map((A,C)=>{let _=N.styles[C]??O.boxName,K=_===O.treeHash?"dg-tree-hash":_===O.treeName?"dg-tree-name":_===O.rootHash?"dg-tree-rh":_===O.rootName?"dg-tree-rn":"dg-tree-one",T=N.baselines[C]??N.cy;return N.root?Se(c.ink,K,N.x+e.root.textX,T,A,_,se):Se(c.ink,K,N.cx,T,A,_,se,"middle")}).join(""),$=f(N.id,`${U}${re}${G}`,` data-tree-node="${Pe(N.id)}"${N.root?` data-tree-root="${Pe(N.id)}"`:""}`);return`<g class="dg-popc dg-a" style="${$e(N.color)};${a.pop(D)}">${$}</g>`}).join("");return{links:k+b,trails:P,nodes:q+R}}var tr=t=>Math.round(t*100)/100,vn=class{constructor(n,l,c){this.prefix=n;this.total=l;this.last=c}prefix;total;last;frames=[];count=0;pct(n){return+(Math.min(Math.max(n,0),this.total)/this.total*100).toFixed(3)}kf(n){let l=`${this.prefix}-${this.count++}`,c=new Map;for(let[e,s,r]of[...n].sort((o,i)=>o[0]-i[0])){let o=this.pct(e),i=c.get(o)??{props:{}};Object.assign(i.props,s),r&&(i.ease=r),c.set(o,i)}let a=[...c].map(([e,{props:s,ease:r}])=>{let o=Object.entries(s).map(([i,p])=>`${i}:${p}`);return r&&o.push(`animation-timing-function:${r}`),`${e}%{${o.join(";")}}`}).join("");return this.frames.push(`@keyframes ${l}{${a}}`),`animation-name:${l}`}vis(n,l=this.last,c={}){let a=c.f??le.fade,e=c.on??{},s=c.off??{},r=c.within?Math.max(n+a,l-a):l;return this.kf([[0,{opacity:0,...s}],[n,{opacity:0,...s},c.ein??ge.out],[n+a,{opacity:1,...e}],[r,{opacity:1,...e},ge.inOut],[Math.min(r+a,this.total),{opacity:0,...s}],[this.total,{opacity:0,...s}]])}rise(n,l=this.last,c=!1){return this.vis(n,l,{on:{transform:"translateY(0)"},off:{transform:`translateY(${w.rise}px)`},within:c})}pop(n,l=this.last){return this.vis(n,l,{f:le.popFade,ein:ge.pop,on:{transform:"scale(1)"},off:{transform:`scale(${w.popFrom})`}})}until(n){let l=le.untilFade;return this.kf([[0,{opacity:1}],[n,{opacity:1},ge.inOut],[n+l,{opacity:0}],[this.last,{opacity:0}],[this.total,{opacity:1}]])}move(n,l=[]){return this.kf(n.map(([c,a,e,s=1,r])=>[c,{transform:`translate(${tr(a)}px,${tr(e)}px) scale(${s})`},r]).concat(l))}blink(n,l,c){return[[0,{opacity:0}],[n-.01,{opacity:0}],[n,{opacity:1}],[l,{opacity:1}],[l+c,{opacity:0}],[this.total,{opacity:0}]]}};var fe=t=>`font:${t.weight} ${t.size}px var(--${t.family})`,Ce=(t,n="var(--surf)")=>`color-mix(in srgb,var(--c) ${t}%,${n})`,ue=w.stroke,Ee=w.mix,Bn=`color-mix(in srgb,var(--mute) ${Ee.past}%,var(--bg))`,Bi=[".dg{display:block;width:100%;height:auto;overflow:visible}",".dg .dg-a{animation-duration:var(--T);animation-timing-function:linear;animation-iteration-count:infinite;animation-fill-mode:both;animation-delay:calc(var(--at,0) * -1s);animation-play-state:var(--play,running)}",".dg .dg-popc{transform-box:fill-box;transform-origin:center}",".dg-bg{fill:var(--bg)}",".dg-band{fill:color-mix(in srgb,var(--c) var(--tint),var(--bg));stroke:color-mix(in srgb,var(--c) var(--edge),transparent)}",`.dg-bi{fill:${Ce(Ee.regionIcon)};stroke:${Ce(Ee.regionIconEdge,"transparent")}}`,`.dg-bz{${fe(O.regionName)};fill:var(--ct)}`,`.dg-bx{${fe(O.regionNote)};fill:var(--mute)}`,".dg-st{fill:var(--surf);stroke:var(--hair)}",`.dg-halo{fill:none;stroke:var(--c);stroke-width:${ue.halo};stroke-opacity:.16}`,`.dg-on{fill:none;stroke:var(--c);stroke-width:${ue.on}}`,`.dg-ic{fill:${Ce(Ee.icon)}}`,`.dg-slot{fill:none;stroke:${Ce(Ee.slot,"transparent")};stroke-width:${ue.slot};stroke-dasharray:3 3}`,`.dg-gl{fill:none;stroke:var(--c);stroke-width:${ue.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-sn{${fe(O.boxName)};fill:var(--ink)}`,`.dg-ss{${fe(O.boxSub)};fill:var(--mute)}`,`.dg-ss-ok{${fe(O.boxSubStrong)};fill:var(--ct)}`,`.dg-ss-act{${fe(O.boxSubStrong)};fill:var(--ink)}`,`.dg-ll{stroke:var(--line);stroke-width:${ue.lifeline};stroke-dasharray:3 4}`,`.dg-e{fill:none;stroke:var(--line);stroke-width:${ue.edge};stroke-linecap:round;stroke-dasharray:0 ${w.edge.ghostDash}}`,`.dg-eh{fill:none;stroke:var(--line);stroke-width:${ue.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-e-on{fill:none;stroke:var(--c);stroke-width:${ue.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-eh-on{fill:none;stroke:var(--c);stroke-width:${ue.edgeOn};stroke-linecap:round;stroke-linejoin:round}`,`.dg-flow{fill:none;stroke:var(--surf);stroke-width:${ue.flow};stroke-linecap:round;stroke-dasharray:1.5 ${w.edge.flowDash}}`,`.dg-e-past{fill:none;stroke:${Bn};stroke-width:${ue.edge};stroke-linecap:round}`,`.dg-eh-past{fill:none;stroke:${Bn};stroke-width:${ue.arrow};stroke-linecap:round;stroke-linejoin:round}`,".dg-bd{cursor:pointer}",".dg-bdf{fill:var(--c)}",`.dg-bdft{${fe(O.badge)};fill:var(--on-c)}`,`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${ue.badgeRing};pointer-events:none}`,`.dg-bdp{fill:${Ce(Ee.badgePast)};stroke:${Ce(Ee.badgePastEdge,"transparent")};stroke-width:${ue.hair}}`,`.dg-bdpt{${fe(O.badge)};fill:var(--ct)}`,`.dg-bdp-g{fill:var(--surf);stroke:${Bn};stroke-width:${ue.hair}}`,`.dg-bdpt-g{${fe(O.badge)};fill:var(--mute)}`,`.dg-cap rect,.dg-act rect{fill:${Ce(Ee.cap)};stroke:${Ce(Ee.capEdge,"transparent")}}`,`.dg-cap text{${fe(O.label)};fill:var(--ct)}`,`.dg-capj text{${fe(O.labelJa)}}`,`.dg-cap-past text{${fe(O.label)};fill:var(--mute);fill-opacity:${w.state.pastLabel}}`,`.dg-cap-pastj text{${fe(O.labelJa)}}`,`.dg-act text{${fe(O.action)};fill:var(--ct)}`,".dg-car{fill:var(--carry,var(--ink))}",`.dg-car-t{${fe(O.carrier)};fill:var(--bg)}`,`.dg-car-tj{${fe(O.carrierJa)}}`,`.dg-env{fill:var(--carry,var(--ink));stroke:var(--surf);stroke-width:${ue.envelope}}`,`.dg-env-in{fill:none;stroke:var(--surf);stroke-width:${ue.flow};stroke-linejoin:round;stroke-linecap:round}`,".dg-coin{fill:var(--coin);stroke:var(--surf);stroke-width:1.2}",".dg-coin-in{fill:none;stroke:var(--coinin);stroke-width:1.1}",".dg-strip{fill:var(--surf);stroke:var(--hair)}",`.dg-sep{stroke:var(--hair);stroke-width:${ue.hair}}`,`.dg-sh{${fe(O.stripTitle)};fill:var(--ink)}`,`.dg-fl{${fe(O.fieldName)};fill:var(--mute)}`,`.dg-fv{${fe(O.fieldValue)};fill:var(--ink)}`,`.dg-fvj{${fe(O.fieldValueJa)};fill:var(--ink)}`,".dg-fv-c{fill:var(--ct)}",".dg-fl-now{fill:var(--c)}",`.dg-tr-ring{fill:none;stroke:var(--line);stroke-width:${ue.trail}}`,".dg-tr-fill{fill:var(--c)}",".dg-tg rect{fill:var(--c)}",`.dg-tg text{${fe(O.tag)};fill:var(--on-c)}`,`.dg-side{fill:color-mix(in srgb,var(--c) ${Ee.side}%,var(--bg));stroke:${Ce(Ee.sideEdge,"transparent")};stroke-dasharray:4 4}`,`.dg-side-t{${fe(O.regionName)};fill:var(--ct)}`,`.dg-side-n{${fe(O.regionNote)};fill:var(--mute)}`,`.dg-ghost{fill:var(--surf);stroke:${Ce(Ee.ghostEdge,"transparent")};stroke-dasharray:4 3}`,`.dg-path{fill:none;stroke:${Ce(Ee.path,"transparent")};stroke-width:${ue.path};stroke-linecap:round;stroke-dasharray:0 ${w.edge.ghostDash}}`,`.dg-path-h{fill:none;stroke:${Ce(Ee.path,"transparent")};stroke-width:${ue.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-path-t{${fe(O.label)};fill:var(--ct)}`,`.dg-path-tj{${fe(O.labelJa)}}`,".dg-start{fill:var(--ink)}",`.dg-end{fill:var(--bg);stroke:var(--ink);stroke-width:${ue.end}}`,".dg-end-in{fill:var(--ink)}",`.dg-end-x{fill:var(--bg);stroke:${Ce(Ee.path,"transparent")};stroke-width:${ue.arrow};stroke-dasharray:2 2.5}`,`.dg-end-xi{fill:${Ce(Ee.path,"transparent")}}`,`.dg-mark{${fe(O.regionNote)};fill:var(--mute)}`,`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${ue.done}}`,`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${ue.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${ue.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${ue.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${ue.git}}`,`.dg-git-id{${fe(O.gitId)};fill:var(--ct)}`,`.dg-git-h{${fe(O.gitHash)};fill:var(--mute)}`,`.dg-git-n{${fe(O.gitNote)};fill:var(--ink2)}`,`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${ue.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,`.dg-git-oldl{${fe(O.gitId)};fill:var(--ct);opacity:.55}`,`.dg-tree-l{fill:none;stroke:var(--line);stroke-width:${ue.tree};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,`.dg-tree-tr{fill:none;stroke:var(--c);stroke-width:${ue.treeTrail};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,`.dg-tree-h{fill:none;stroke:var(--c);stroke-width:${ue.treeTrail};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tree-con{fill:none;stroke:var(--line);stroke-width:${ue.treeCon};stroke-linecap:round;stroke-dasharray:2 3.5}`,`.dg-tree-card{fill:var(--surf);stroke:var(--hair);stroke-width:${ue.hair}}`,`.dg-tree-cg{fill:none;stroke:var(--mute);stroke-width:${ue.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tree-ct{${fe(O.treeCard)};fill:var(--ink)}`,`.dg-tree-hash{${fe(O.treeHash)};fill:var(--ink)}`,`.dg-tree-name{${fe(O.treeName)};fill:var(--mute)}`,`.dg-tree-one{${fe(O.boxName)};fill:var(--ink)}`,`.dg-tree-rh{${fe(O.rootHash)};fill:var(--ink)}`,`.dg-tree-rn{${fe(O.rootName)};fill:var(--mute)}`,`.dg-tm-ep{fill:color-mix(in srgb,var(--ink) ${Ee.timeShade}%,transparent)}`,`.dg-tm-sep{stroke:var(--hair);stroke-width:${ue.hair};stroke-dasharray:2 4}`,`.dg-tm-hd{${fe(O.timeHead)};fill:var(--ink)}`,`.dg-tm-hdj{${fe(Dt(O.timeHead))}}`,`.dg-tm-slot{fill:none;stroke:var(--line);stroke-width:${ue.timeSlot};opacity:.55}`,".dg-tm-m{fill:var(--c)}",".dg-tm-x{fill:var(--c-slate)}",`.dg-tm-fr{fill:none;stroke:var(--c-blue);stroke-width:${ue.timeFrame};stroke-dasharray:3 2}`,`.dg-tm-gd{fill:none;stroke:color-mix(in srgb,var(--c-blue) ${Ee.timeGuide}%,transparent);stroke-width:${ue.hair};stroke-dasharray:2 3}`,`.dg-tm-ax{fill:none;stroke:var(--line);stroke-width:${ue.timeAxis}}`,`.dg-tm-tk{${fe(O.timeTick)};fill:var(--mute)}`,`.dg-tm-tkj{${fe(Dt(O.timeTick))}}`,`.dg-tm-en{${fe(O.timePeriod)};fill:var(--ink2)}`,`.dg-tm-er{${fe(O.timeRange)};fill:var(--mute)}`,`.dg-tm-erj{${fe(Dt(O.timeRange))}}`,`.dg-tm-rn{${fe(O.timeRow)};fill:var(--ink2)}`,`.dg-tm-br{fill:none;stroke:var(--c);stroke-width:${ue.timeSpan};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-bt{${fe(O.spanText)};fill:var(--ct)}`,`.dg-tm-bx{fill:color-mix(in srgb,var(--c) ${Ee.timeSpan}%,transparent);stroke:var(--c);stroke-width:${ue.timeSpan};stroke-dasharray:4 3}`,`.dg-tm-con{fill:none;stroke:var(--line);stroke-width:${ue.timeDrop};stroke-linecap:round;stroke-dasharray:0 3.5}`,".dg-tm-pg{fill:var(--surf);stroke:var(--line);stroke-dasharray:2 2.5}",`.dg-tm-pgl{fill:none;stroke:var(--mute);stroke-width:${ue.timeFlag};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-pc{fill:var(--surf);stroke:var(--c);stroke-width:${ue.timePoint}}`,`.dg-tm-pcg{fill:none;stroke:var(--c);stroke-width:${ue.timeFlag};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-pn{${fe(O.pointName)};fill:var(--ink)}`,`.dg-tm-pnj{${fe(Dt(O.pointName))}}`,".dg-tm-pn-g{fill:var(--mute)}",`.dg-tm-ps{${fe(O.pointState)};fill:var(--ct)}`,`.dg-tm-ln{fill:none;stroke:var(--c);stroke-width:${ue.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-tm-nd{stroke:var(--ink);stroke-width:${ue.timeNeedle};opacity:.55}`,".dg-tm-nh{fill:var(--ink)}",".dg-tm-ph{fill:none;stroke:var(--line);stroke-dasharray:3 3}",`.dg-tm-ex{fill:color-mix(in srgb,var(--c-slate) ${Ee.timeEmpty}%,var(--surf));stroke:var(--c-slate);stroke-width:${ue.timeFrame};stroke-dasharray:3 3}`,`.dg-tm-ext{${fe(O.emptyText)};fill:var(--t-slate)}`,".dg-tm-mt{fill:var(--hair)}",".dg-tm-mf{fill:var(--c);transform-box:fill-box;transform-origin:0 50%}",`.dg-tm-mk{stroke:var(--ink2);stroke-width:${ue.timeMeter}}`,`.dg-tm-ml{${fe(O.meterLine)};fill:var(--ink2)}`,".dg-vp-bg{fill:var(--bg)}",".dg-vp-frame{fill:none;stroke:var(--hair)}",".dg-hd-bg{fill:var(--bg)}",".dg-mm-bg{fill:var(--surf);stroke:var(--hair)}",`.dg-mm-t{${fe(O.miniTitle)};fill:var(--mute)}`,".dg-mm-world{fill:var(--sunk);stroke:var(--hair)}",`.dg-mm-band{fill:${Ce(Ee.miniBand)};stroke:${Ce(Ee.miniBandEdge,"transparent")};stroke-width:.6}`,`.dg-mm-card{fill:${Ce(Ee.mini)}}`,`.dg-mm-vp{fill:color-mix(in srgb,var(--ink) ${Ee.view}%,transparent);stroke:var(--ink);stroke-width:${ue.badgeRing};vector-effect:non-scaling-stroke}`].join("");function _i(t){let n=2166136261;for(let l=0;l<t.length;l++)n^=t.charCodeAt(l),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function Gi(t){let n=new Map,l=(c,a)=>{n.set(c,(n.get(c)??new Set).add(a))};return t.steps.forEach((c,a)=>{for(let e of c.events)e.type==="edge"?(l(e.from,a),l(e.to,a)):(e.type==="action"||e.type==="swap")&&l(e.box,a)}),new Map([...n].map(([c,a])=>[c,[...a].sort((e,s)=>e-s)]))}function Yi(t,n,l){let c=[],{whole:a}=n,e=0;for(let r of n.events){let o=t.steps[r.step]?.events[r.event];if(o?.type==="swap"&&c.push({t:r.at,order:e++,box:o.box,set:o.text}),l&&o?.type==="action"){c.push({t:r.at,order:e++,box:o.box,act:o.label});let i=n.steps[r.step].end;(!a||i<=a.start)&&c.push({t:i,order:e++,box:o.box,act:null})}}c.sort((r,o)=>r.t-o.t||r.order-o.order);let s=new Map;for(let r of t.boxes){let o=[r.sub??"","dg-ss"],i,p=o.join("|"),m=[],u=c.filter(y=>y.box===r.id),d=[...u].reverse().find(y=>y.set!==void 0||typeof y.act=="string");a&&typeof d?.act=="string"&&u.push({t:a.start,order:e++,box:r.id,act:d.act});for(let y of u){y.set!==void 0&&(o=[y.set,"dg-ss-ok"],i=void 0),y.act!==void 0&&(i=y.act??void 0);let k=i!==void 0?[i,"dg-ss-act"]:o;k.join("|")!==p&&(p=k.join("|"),m.push([y.t,k[0],k[1]]))}let f=m.filter((y,k)=>{let b=m[k+1];return b===void 0||b[0]-y[0]>=le.minShow});s.set(r.id,f)}return s}function Vi(t,n,l){let c=new Map;for(let a of n.events){let e=t.steps[a.step]?.events[a.event];if(e?.type!=="strip")continue;let s=l.badges[a.step]?.color??"slate",r=c.get(e.field)??[],o=n.steps[a.step].end;r.push({at:a.at,color:s,step:a.step,until:o,...e.value!==void 0?{value:e.value}:{},...e.tag!==void 0?{tag:e.tag}:{}}),c.set(e.field,r)}return c}function Wi(t,n,l){if(t.until===void 0)return n;let{after:c,again:a,...e}=n;if(!c)return e;let s=l[t.until].start;return s>c.start?{...e,after:{start:c.start,end:Math.min(c.end,s)}}:e}function Gn(t,n,l,c,a,e,s=[],r=[]){let o=Ft(c,a),i=_i(`${JSON.stringify(t)}|${o}|${e?`${e.width}|${e.lang}`:""}`),p=new vn(`dg${i}`,l.total,l.last),m={m:p,t:l,sh:`filter="url(#dg-sh-${i})"`,end:l.steps[l.steps.length-1].end,ink:s,traces:r},u=Gi(t),d=Yi(t,l,n.kind!=="sequence"),f={band:[],base:[],lit:[],node:[],badge:[],top:[]};for(let T of n.regions)f.band.push(As(T,s));let y=n.boxes.find(T=>T.ghost)?.color??"slate";n.side&&f.band.push(Bs(n.side,y,s));let k=(T,Z)=>n.boxes.find(ie=>ie.id===T&&(Z===void 0||ie.ghost===Z))?.color;for(let T of n.paths)f.base.push(Fs(T,k(T.to,!0)??k(T.from)??y,s,r));for(let T of n.ends)f.node.push(_s(T,y,s));let b=n.kind==="state",h=new Map((l.states??[]).flatMap(T=>T.lit[0]?[[T.box,T.lit[0].start]]:[])),P=new Map((l.meters??[]).map(T=>[T.field,T.keys])),q=T=>T.meter?Zs({...T,meter:T.meter},P.get(T.name)??[[0,0]],m):void 0;n.strip&&f.band.push(Hs(n.strip,Vi(t,l,n),m,b,h,q));for(let T of n.lifelines)f.base.push(Gs(T.x,T.y1,T.y2));if(ls(n)){let T=Ks(n,t,l,m);f.base.push(T.links),f.lit.push(T.lines),f.node.push(T.commits),f.top.push(T.tags)}let R=Kt(n)?n:void 0;if(R){let T=er(R,t,l,m);f.base.push(T.links),f.lit.push(T.trails),f.node.push(T.nodes)}let N=new Set((R?.runs??[]).map(T=>`${T.step}/${T.event}`)),D=Ln(n)?n:void 0;if(D){let T=Js(D,t,l,m,d);f.base.push(T.base),f.lit.push(T.lit),f.node.push(T.node),f.top.push(T.top)}let L=new Set((D?.wires??[]).map(T=>`${T.step}/${T.event}`));for(let T of n.edges){let Z=l.edges.find(ae=>ae.step===T.step&&ae.event===T.event);if(!Z||D&&!L.has(`${T.step}/${T.event}`)||N.has(`${T.step}/${T.event}`))continue;let ie=Ys(T,Z,m,b);f.base.push(ie.base),f.lit.push(ie.lit)}let j=new Map((l.states??[]).map(T=>[T.box,T])),F=new Map(t.boxes.flatMap(T=>T.link===void 0?[]:[[T.id,T.link]])),X=(T,Z)=>xn(F.get(T),Z);for(let T of D?[]:n.boxes){if(T.ghost){f.node.push(X(T.id,Cs(T,s)));continue}let Z=j.get(T.id);f.node.push(X(T.id,$n(T,m,u.get(T.id)??[],d.get(T.id)??[],b?Z?.lit??[]:void 0))),Z?.done!==void 0&&f.node.push(Is(T,Z.done,m))}for(let T of n.badges)f.badge.push(Ws(T,m,b));for(let T of n.labels){let Z=l.labels.find(ie=>ie.step===T.step&&ie.event===T.event);Z&&f.top.push(Vs(T,Wi(T,Z,l.steps),m))}let{whole:U}=l;for(let T of n.actions){let Z=l.events.find(ae=>ae.step===T.step&&ae.event===T.event);if(!Z)continue;let ie=l.steps[T.step].end;f.top.push(U&&ie>U.start?Fn(T,Z.at,U.end,m):Fn(T,Z.at,ie,m,U))}for(let T of l.carriers){let Z=n.edges.find(ie=>ie.step===T.step&&ie.event===T.event);Z&&f.top.push(kn(Z,R?{...T,start:T.depart,end:T.arrive+le.fade}:T,m))}let ee=Object.values(f).map(T=>T.join("")).join(""),{near:re,far:se,nearY:G,farY:$}=w.shadow,A=`<filter id="dg-sh-${i}" x="-20%" y="-30%" width="140%" height="180%"><feDropShadow dx="0" dy="${G}" stdDeviation="${re}" style="flood-color:var(--sh);flood-opacity:var(--shA)"/><feDropShadow dx="0" dy="${$}" stdDeviation="${se}" style="flood-color:var(--sh);flood-opacity:var(--shB)"/></filter>`,C=e&&n.kind==="sequence"?n.boxes.map(T=>X(T.id,Ds(T,m,u.get(T.id)??[],d.get(T.id)??[]))).join(""):"",_=e?Ki(n,l,t,p,i,ee,e,C):{body:`<rect class="dg-bg" width="${n.width}" height="${n.height}" rx="${w.region.radius}"/>${ee}`,w:n.width,h:n.height},K=`.dg-${i}{${Bt};--T:${l.total}s;${o}}${Bi}${p.frames.join("")}`;return`<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${i}" viewBox="0 0 ${Math.ceil(_.w)} ${Math.ceil(_.h)}" width="${Math.ceil(_.w)}" height="${Math.ceil(_.h)}" role="img" aria-label="${Pe(t.title)}" data-dragon="figure" data-view="${e?"follow":"fixed"}"><style>${K}</style><defs>${A}</defs>${_.body}</svg>`}function nr(t){let n=Math.min(...t.map(c=>c.x)),l=Math.min(...t.map(c=>c.y));return{x:n,y:l,w:Math.max(...t.map(c=>c.x+c.w))-n,h:Math.max(...t.map(c=>c.y+c.h))-l}}function Hi(t,n,l){let c=_n(t,n,l);return c.length===0?void 0:nr(c)}function zi(t,n,l,c){let a=w.badge.r+w.follow.badgeRoom,{x:e,y:s}=t,r=i=>Math.hypot(Math.max(0,i.x-e,e-i.x-i.w),Math.max(0,i.y-s,s-i.y-i.h)),o={x:e-a,y:s-a,w:a*2,h:a*2};for(let i of[...n].sort((p,m)=>r(p)-r(m))){let p=nr([o,i]);p.w<=l&&p.h<=c&&(o=p)}return o}function _n(t,n,l){let c=[];for(let a of t.edges.filter(e=>e.step===l)){let e=a.points.map(r=>r[0]),s=a.points.map(r=>r[1]);c.push({x:Math.min(...e),y:Math.min(...s),w:Math.max(...e)-Math.min(...e),h:Math.max(...s)-Math.min(...s)})}if(c.push(...t.labels.filter(a=>a.step===l),...t.actions.filter(a=>a.step===l)),Kt(t)){let a=new Set((n.steps[l]?.events??[]).flatMap(e=>e.type==="edge"?[e.from,e.to]:[]));c.push(...t.nodes.filter(e=>e.step===l||a.has(e.id)));for(let e of t.links.filter(s=>s.step===l)){let s=e.points.map(o=>o[0]),r=e.points.map(o=>o[1]);c.push({x:Math.min(...s),y:Math.min(...r),w:Math.max(...s)-Math.min(...s),h:Math.max(...r)-Math.min(...r)})}}for(let a of n.steps[l]?.events??[]){let e=a.type==="edge"?[a.from,a.to]:a.type==="action"||a.type==="swap"?[a.box]:[];for(let s of e){let r=t.boxes.find(o=>o.id===s);r&&(t.kind==="architecture"||a.type==="swap")&&c.push(r)}}return c}function Ki(t,n,l,c,a,e,s,r){let o=w.follow,i=w.mini,p=Math.max(1,s.width),m=Math.min(t.width,p),u=et[s.lang].overview,d=v=>{let z=Math.min(i.w,m*.4,v*.4/t.height*t.width),M=z/t.width,V=t.height*M,g=Math.max(z,Math.ceil(pe(u,O.miniTitle)));return{vh:v,mw:z,k:M,mh:V,bw:g,bgW:g+i.pad*2,bgH:V+i.pad*2+i.title,beside:V>z}},f=d(Math.min(t.height,Math.max(o.minH,m*o.aspect))),y=f.beside&&p<o.narrow,k=s.height===void 0?Number.POSITIVE_INFINITY:f.beside?s.height:s.height-f.bgH-i.inset,{vh:b,mw:h,k:P,mh:q,bw:R,bgW:N,bgH:D,beside:L}=k<f.vh?d(Math.max(o.fitMinH,k)):{...f,vh:Number.isFinite(k)?Math.min(t.height,k):f.vh},j=L&&!y?Math.min(t.width,p-N-i.inset):m,F=v=>Math.min(t.width-j/2,Math.max(j/2,v)),X=r===""?0:Math.max(...t.boxes.map(v=>v.y+v.h))+o.headRoom,U=r===""?0:o.head.pad*2+o.head.h,ee=b-U,re=v=>Math.min(t.height-ee/2,Math.max(X+ee/2,v)),se=w.badge.r,G=[t.width/2,t.height/2],A=n.steps.map((v,z)=>{if(Ln(t)){let E=Qs(t,n,z,_n(t,l,z),j,ee);return G=[E.x+E.w/2,E.y+E.h/2],[F(G[0]),re(G[1])]}let M=Hi(t,l,z);G=M?[M.x+M.w/2,M.y+M.h/2]:G;let V=[F(G[0]),re(G[1])],g=t.badges.find(E=>E.step===z);if(!g||Math.abs(g.x-V[0])<=j/2-se&&Math.abs(g.y-V[1])<=ee/2-se)return V;let I=zi(g,_n(t,l,z),j,ee);return G=[I.x+I.w/2,I.y+I.h/2],[F(G[0]),re(G[1])]}).map(([v,z])=>[v,z-U/2]),C=A[0],_=[[0,C[0],C[1]],[n.steps[0].start,C[0],C[1]]];A.forEach((v,z)=>{if(z===0)return;let M=A[z-1],V=n.steps[z].start;_.push([V,M[0],M[1],1,ge.inOut],[V+o.ease,v[0],v[1]])});let K=A[A.length-1];_.push([n.last,K[0],K[1],1,ge.inOut],[n.total,C[0],C[1]]);let T=c.move(_.map(([v,z,M,V,g])=>[v,j/2-z,b/2-M,V,g])),Z=L?j+i.inset:j-N-i.inset,ie=L?0:b+i.inset,ae=Z+i.pad,de=ae+(R-h)/2,me=ie+i.pad+i.title,xe=y?{clip:"",body:""}:(()=>{let v=[...t.regions.map(M=>`<rect class="dg-mm-band" style="${$e(M.color)}" x="${de+M.x*P}" y="${me+M.y*P}" width="${M.w*P}" height="${M.h*P}" rx="3"/>`),...t.boxes.map(M=>`<rect class="dg-mm-card" style="${$e(M.color)}" x="${de+M.x*P}" y="${me+M.y*P}" width="${M.w*P}" height="${M.h*P}" rx="1.5"/>`),...(Kt(t)?t.nodes:[]).map(M=>`<rect class="dg-mm-card" style="${$e(M.color)}" x="${de+M.x*P}" y="${me+M.y*P}" width="${M.w*P}" height="${M.h*P}" rx="1.5"/>`)].join(""),z=c.move(_.map(([M,V,g,,I])=>[M,de+(V-j/2)*P,me+(g-b/2)*P,1,I]));return{clip:`<clipPath id="dg-mm-${a}"><rect x="${de}" y="${me}" width="${h}" height="${q}" rx="4"/></clipPath>`,body:`<rect class="dg-mm-bg" x="${Z}" y="${ie}" width="${N}" height="${D}" rx="${i.radius}"/><text class="dg-mm-t" x="${ae}" y="${me-i.pad+2}">${u}</text><g clip-path="url(#dg-mm-${a})"><rect class="dg-mm-world" x="${de}" y="${me}" width="${h}" height="${q}"/>${v}<rect class="dg-mm-vp dg-a"${U===0?"":` y="${U*P}"`} width="${j*P}" height="${(b-U)*P}" rx="2" style="${z}"/></g>`}})(),Te=U===0?"":`<g class="dg-hd"><rect class="dg-hd-bg" width="${j}" height="${U}"/><line class="dg-sep" x1="0" y1="${U}" x2="${j}" y2="${U}"/><g class="dg-a" style="${c.move(_.map(([v,z,,M,V])=>[v,j/2-z,0,M,V]))}">${r}</g></g>`;return{body:`<defs><clipPath id="dg-vp-${a}"><rect width="${j}" height="${b}" rx="${w.region.radius}"/></clipPath>${xe.clip}</defs><g clip-path="url(#dg-vp-${a})"><rect class="dg-vp-bg" width="${j}" height="${b}"/><g class="dg-a" style="${T}">${e}</g>${Te}</g><rect class="dg-vp-frame" x="0.5" y="0.5" width="${j-1}" height="${b-1}" rx="${w.region.radius}"/>${xe.body}`,w:L&&!y?j+i.inset+N:m,h:L?b:ie+D}}function Yn(t,n){let l=Xn(t.palette);if(!t.colors)return l;let c=et[t.lang??"ja"],a=Object.entries(t.colors).flatMap(([e,s])=>Un(e)?Jn(s)?[]:[c.unreadableColor(e)]:[c.unknownColor(e)]);if(a.length>0)throw new Error(c.cannotDraw(a.join(" / ")));return{...l,[n]:{...l[n],...t.colors}}}function sr(t,n={}){let l=n.lang??"ja",c=Ts(t,{lang:l});if(!c.ok)throw new Error(et[l].cannotDraw(c.errors.map(s=>`${s.pointer} ${s.message}`).join(" / ")));let a=c.diagram,e=a.kind==="sequence"?ps(a):a.kind==="state"?ms(a,l):a.kind==="git"?cs(a):a.kind==="time"?ys(a,l):a.kind==="tree"?xs(a):ss(a);return Xi(a,e,Ns(a,n.still===!0),n)}function Xi(t,n,l,c={}){let a=c.theme==="dark"?"dark":"light",e=Yn(c,a),s=[],r=[];return{svg:Gn(t,n,l,e,a,void 0,s,r),palette:e.id,theme:a,...t.view?{view:t.view}:{},fonts:{...At},layout:n,timeline:l,diagram:t,overlaps:qs(s,l.stills,r)}}function Vn(t,n,l){let c=Math.max(0,n)/t.layout.width,e=(l===void 0?c:Math.min(c,Math.max(0,l)/t.layout.height))*O.boxName.size;return t.view?{mode:t.view,textPx:e}:{mode:e>=Zn?"fixed":"follow",textPx:e}}var Pn=t=>`font:${t.weight} ${t.size}px var(--${t.family})`,Ae=t=>`${t}px`;function Ui(){let t=w.player,n=Ae(t.hidden);return[`.dg-player{display:flex;flex-direction:column;gap:${Ae(t.gap)};color:var(--ink)}`,`.dg-player .dg-frame{border-radius:${Ae(t.radius)};overflow:hidden}`,".dg-bar{container:dg-bar/inline-size}",`.dg-row{display:flex;align-items:flex-start;gap:${Ae(t.gap)}}`,`.dg-btns{display:flex;gap:${Ae(t.gap/2)};flex:none}`,`.dg-btn{width:${Ae(t.button)};height:${Ae(t.button)};border-radius:${Ae(t.radius)};border:${Ae(w.stroke.hair)} solid var(--hair);background:var(--surf);color:var(--ink);${Pn(O.button)};cursor:pointer}`,`.dg-btn:focus-visible{outline:${Ae(t.focus)} solid var(--c-blue);outline-offset:${Ae(t.focus)}}`,`.dg-say{display:flex;gap:${Ae(t.gap)};min-width:0}`,`.dg-no{${Pn(O.stepNo)};color:var(--mute);padding-top:${Ae(t.focus)}}`,".dg-txt{display:grid;grid-template-columns:minmax(0,1fr);min-width:0}",".dg-txt>*{grid-area:1/1}",".dg-room{visibility:hidden}",`.dg-tt{${Pn(O.stepTitle)};margin:0}`,`.dg-tb{${Pn(O.stepBody)};color:var(--ink2);margin:0;white-space:pre-line}`,`.dg-sr{position:absolute;width:${n};height:${n};margin:-${n};padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}`,`@container dg-bar (width < ${Ae(t.narrow)}){.dg-row{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:0 ${Ae(t.gap)}}.dg-say,.dg-txt,.dg-txt>*{display:contents}.dg-btns{grid-area:1/1;margin-bottom:${Ae(t.gap/2)}}.dg-btn{width:${Ae(t.touch)};height:${Ae(t.touch)}}.dg-no{grid-area:1/2;display:flex;align-items:center;min-height:${Ae(t.touch)};padding-top:0}.dg-tt{grid-area:2/1/3/3}.dg-tb{grid-area:3/1/4/3}}`,`@media (pointer: coarse){.dg-btn{width:${Ae(t.touch)};height:${Ae(t.touch)}}}`,`.dg-spot{fill:none;stroke:var(--t-amber);stroke-width:${Ae(w.stroke.mark)};stroke-dasharray:${w.mark.dash} ${w.mark.gap};pointer-events:none}`].join("")}function Ji(t){if(t.getElementById("dragon-player-css"))return;let n=t.createElement("style");n.id="dragon-player-css",n.textContent=Ui(),t.head.appendChild(n)}var Ct={prev:"\u2039",pause:"\u275A\u275A",play:"\u25B6",next:"\u203A"},rr="http://www.w3.org/2000/svg",ir=t=>String(t).padStart(2,"0"),Zi=(t,n)=>`${ir(t+1)}/${ir(n)}`;function or(t,n,l={}){let c=t.ownerDocument,a=c.defaultView,e=!!a?.matchMedia?.("(prefers-reduced-motion: reduce)").matches,s=sr(n,l),r=l.lang??"ja",o=et[r],i=Yn(l,s.theme),{timeline:p}=s,m=s.diagram.steps,u=m.length;Ji(c);let d=c.createElement("div");d.className="dg-player",d.dataset.dragon="player",d.setAttribute("style",`${Bt};${Ft(i,s.theme)}`);let f=c.createElement("div");f.className="dg-frame";let y=(H,W,te)=>{let ce=c.createElement("button");return ce.type="button",ce.className="dg-btn",ce.dataset.dragon=H,ce.setAttribute("aria-label",W),ce.textContent=te,ce},k=y("prev",o.prev,Ct.prev),b=y("toggle",o.pause,Ct.pause),h=y("next",o.next,Ct.next),P=c.createElement("div");P.className="dg-btns",P.setAttribute("lang",r),P.append(k,b,h);let q=c.createElement("div");q.className="dg-say",q.setAttribute("aria-hidden","true");let R=c.createElement("div");R.className="dg-no",R.dataset.dragon="step-no";let N=c.createElement("div");N.className="dg-txt";let D=c.createElement("p");D.className="dg-tt",D.dataset.dragon="step-title";let L=c.createElement("p");L.className="dg-tb",L.dataset.dragon="step-body";let j=c.createElement("div");j.append(D,L),N.append(j);for(let H of m){let W=c.createElement("div");W.className="dg-room",W.dataset.dragon="caption-room";let te=c.createElement("p");te.className="dg-tt",te.textContent=H.title;let ce=c.createElement("p");ce.className="dg-tb",ce.textContent=H.body,W.append(te,ce),N.append(W)}q.append(R,N);for(let H of[R,D,L])H.setAttribute("aria-hidden","true");let F=c.createElement("div");F.className="dg-row",F.append(P,q);let X=c.createElement("div");X.className="dg-bar",X.append(F);let U=c.createElement("ol");U.className="dg-sr",U.dataset.dragon="steps",U.setAttribute("aria-label",o.steps(s.diagram.title));for(let H of m){let W=c.createElement("li"),te=c.createElement("strong");te.textContent=H.title,W.append(te);for(let ce of H.body.split(`
3
+ `)){let ke=c.createElement("p");ke.textContent=ce,W.append(ke)}if(H.sources){let ce=c.createElement("ul");for(let ke of H.sources){let qe=c.createElement("a");qe.href=ke.url,qe.textContent=ke.name;let je=c.createElement("li");je.append(qe),ce.append(je)}W.append(ce)}U.append(W)}d.append(f,X,U),t.append(d);let ee=()=>f.clientWidth||t.clientWidth||s.layout.width,re=()=>{if(!l.fitHeight||!a)return;let H=a.getComputedStyle(f),W=f.clientHeight-(Number.parseFloat(H.paddingTop)||0)-(Number.parseFloat(H.paddingBottom)||0);return W>0?W:void 0},se=Vn(s,ee(),re()).mode,G=ee(),$=re(),A=null,C=l.pausedAt===void 0?0:Math.min(u-1,Math.max(0,l.pausedAt)),_=!e&&l.pausedAt===void 0,K=_?0:p.stills[C]??0,T=p.stills[u-1]??0,Z=Date.now(),ie=[],ae=()=>{if(!A)return;for(let te of A.querySelectorAll(".dg-spots"))te.remove();if(ie.length===0)return;let H=w.mark,W=c.createElementNS(rr,"g");W.setAttribute("class","dg-spots");for(let te of ie){let ce=c.createElementNS(rr,"rect");ce.setAttribute("class","dg-spot"),ce.setAttribute("x",String(te.x-H.pad)),ce.setAttribute("y",String(te.y-H.pad)),ce.setAttribute("width",String(te.w+H.pad*2)),ce.setAttribute("height",String(te.h+H.pad*2)),ce.setAttribute("rx",String(H.radius)),W.append(ce)}(A.querySelector('g[clip-path^="url(#dg-vp-"] > g.dg-a')??A).append(W)},de=H=>{let W;if(H!==void 0){let te=c.createElement("div");te.innerHTML=H,W=te.querySelector("svg")}else W=A?A.cloneNode(!0):null;W&&(W.setAttribute("aria-hidden","true"),W.removeAttribute("role"),W.removeAttribute("aria-label"),W.style.setProperty("--at",String(K)),W.style.setProperty("--play",_?"running":"paused"),W.dataset.motion=_?"play":"still",A?A.replaceWith(W):f.append(W),A=W,Z=Date.now(),ae())},me=()=>se==="follow"?Gn(s.diagram,s.layout,p,i,s.theme,{width:G,...$===void 0?{}:{height:$},lang:r}):s.svg,ve=()=>_?(K+(Date.now()-Z)/1e3)%p.total:K,xe=H=>{let W=0;return p.steps.forEach((te,ce)=>{te.start<=H&&(W=ce)}),W},Te=()=>{let H=m[C];R.textContent=Zi(C,u),D.textContent=H?.title??"",L.textContent=H?.body??"",b.setAttribute("aria-label",_?o.pause:o.play),b.textContent=_?Ct.pause:Ct.play,l.onStep?.(C)},S=(H,W)=>{K=H,_=W,de(),Te()},v=H=>{C=Math.min(u-1,Math.max(0,H));let W=p.steps[C];S(_?W.start:p.stills[C]??W.start,_)},z=()=>{l.playOnce&&K>=T&&(C=0,K=0),S(K,!0)};de(me()),Te();let M=a?.setInterval(()=>{if(!_)return;if(l.playOnce&&K+(Date.now()-Z)/1e3>=T){C=u-1,S(T,!1);return}let H=xe(ve());H!==C&&(C=H,Te())},120),V=()=>v(C-1),g=()=>v(C+1),I=()=>_?S(ve(),!1):z(),E=H=>{let W=H.target?.closest?.("[data-step]"),te=W?Number(W.getAttribute("data-step")):Number.NaN;Number.isInteger(te)&&v(te)};k.addEventListener("click",V),h.addEventListener("click",g),b.addEventListener("click",I),f.addEventListener("click",E);let Y=a?.ResizeObserver,ne=Y?new Y(()=>{let H=ee(),W=re(),te=Vn(s,H,W).mode;if(te===se&&(se==="fixed"||H===G&&W===$))return;let ce=ve();se=te,G=H,$=W,K=ce,de(me())}):void 0;return ne?.observe(f),{get step(){return C},get playing(){return _},next:g,prev:V,play:()=>{_||z()},pause:()=>{_&&S(ve(),!1)},goTo:H=>{_=!1,v(H)},mark:H=>{ie=H,ae()},destroy:()=>{M!==void 0&&a?.clearInterval(M),ne?.disconnect(),k.removeEventListener("click",V),h.removeEventListener("click",g),b.removeEventListener("click",I),f.removeEventListener("click",E),d.remove()}}}return fr(Qi);})();