@johnoscott/isometric-engine 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/iso-editor.js +230 -193
- package/iso-remotion.js +353 -0
- package/iso-render.js +184 -147
- package/iso-systems.js +183 -146
- package/isometric-diagram.js +389 -0
- package/js/iso-core/arimo.js +5 -0
- package/js/iso-core/arimo.json +1 -0
- package/js/iso-core/index.js +8 -2
- package/js/iso-core/kernel.js +13 -2
- package/js/iso-core/mono.js +242 -0
- package/js/iso-editor/ui/canvas.js +23 -1
- package/js/iso-objects/ants.js +1 -1
- package/js/iso-objects/index.js +10 -2
- package/js/iso-objects/mono-paint.js +96 -0
- package/js/iso-objects/motion-doc.js +0 -79
- package/js/iso-objects/motion-entry.js +4 -2
- package/js/iso-objects/motion-schema.js +83 -0
- package/js/iso-objects/motion.js +9 -4
- package/js/iso-objects/timeline.js +60 -16
- package/js/iso-systems/compile.js +34 -3
- package/js/iso-systems/render.js +1 -1
- package/js/iso-systems/schema.json +1 -0
- package/js/iso-viewer/index.js +6 -0
- package/js/iso-viewer/page.js +40 -17
- package/js/iso-viewer/play.js +340 -0
- package/js/iso-viewer/player.js +147 -162
- package/js/iso-viewer/transport.js +289 -0
- package/package.json +61 -2
- package/src/iso-core/arimo.json +1 -0
- package/src/iso-core/arimo.ts +6 -0
- package/src/iso-core/index.ts +2 -1
- package/src/iso-core/kernel.ts +11 -1
- package/src/iso-core/mono.ts +306 -0
- package/src/iso-core/theme.ts +2 -1
- package/src/iso-editor/ui/canvas.ts +14 -1
- package/src/iso-objects/ants.ts +2 -2
- package/src/iso-objects/index.ts +5 -3
- package/src/iso-objects/mono-paint.ts +97 -0
- package/src/iso-objects/motion-doc.ts +0 -52
- package/src/iso-objects/motion-entry.ts +4 -3
- package/src/iso-objects/motion-schema.ts +55 -0
- package/src/iso-objects/motion.ts +6 -5
- package/src/iso-objects/scene.ts +3 -0
- package/src/iso-objects/timeline.ts +71 -15
- package/src/iso-objects/types.ts +2 -0
- package/src/iso-systems/compile.ts +37 -4
- package/src/iso-systems/render.ts +5 -1
- package/src/iso-systems/schema.json +1 -0
- package/src/iso-viewer/index.ts +4 -0
- package/src/iso-viewer/page.ts +28 -12
- package/src/iso-viewer/play.ts +280 -0
- package/src/iso-viewer/player.ts +133 -134
- package/src/iso-viewer/transport.ts +272 -0
- package/types/iso-core/arimo.d.ts +2 -0
- package/types/iso-core/index.d.ts +2 -1
- package/types/iso-core/kernel.d.ts +9 -0
- package/types/iso-core/mono.d.ts +61 -0
- package/types/iso-core/theme.d.ts +2 -0
- package/types/iso-objects/ants.d.ts +1 -0
- package/types/iso-objects/index.d.ts +5 -3
- package/types/iso-objects/mono-paint.d.ts +20 -0
- package/types/iso-objects/motion-doc.d.ts +0 -594
- package/types/iso-objects/motion-entry.d.ts +4 -3
- package/types/iso-objects/motion-schema.d.ts +594 -0
- package/types/iso-objects/motion.d.ts +4 -2
- package/types/iso-objects/scene.d.ts +3 -0
- package/types/iso-objects/timeline.d.ts +26 -3
- package/types/iso-objects/types.d.ts +2 -0
- package/types/iso-systems/compile.d.ts +8 -0
- package/types/iso-systems/render.d.ts +4 -0
- package/types/iso-viewer/index.d.ts +4 -0
- package/types/iso-viewer/play.d.ts +37 -0
- package/types/iso-viewer/transport.d.ts +73 -0
- package/types/player/isometric-diagram.d.ts +24 -0
- package/types/remotion/entry.d.ts +2 -0
- package/types/remotion/frames.d.ts +70 -0
- package/types/remotion/index.d.ts +39 -0
package/iso-systems.js
CHANGED
|
@@ -1,154 +1,156 @@
|
|
|
1
|
-
var gm=Object.defineProperty;var co=(t,e)=>{for(var s in e)gm(t,s,{get:e[s],enumerable:!0})};var hf={};co(hf,{Bounds:()=>ii,C:()=>Ct,DiagError:()=>ea,FONTS:()=>wt,Kernel:()=>fr,S:()=>lt,VEl:()=>Ti,allowed:()=>Kl,apply:()=>si,bubble:()=>fo,buildSvg:()=>ff,center:()=>Zs,colorRef:()=>as,createHash:()=>uf,depthSort:()=>ci,didYouMean:()=>Vt,distance:()=>ql,envelope:()=>po,esc:()=>St,extendTheme:()=>Mr,faceFrame:()=>fl,fileLines:()=>mo,formatDiag:()=>Vl,formatDiags:()=>af,iso:()=>Re,keyGlyph:()=>uo,loadTheme:()=>vr,matStr:()=>ri,n1:()=>bt,parse:()=>ta,parseSvg:()=>Gl,placeholderFace:()=>ai,pt:()=>Gs,screenFaces:()=>dr,screenGlass:()=>li,serialize:()=>na,sha256Hex:()=>Zl,socketGlyph:()=>ho,tag:()=>ve,termLines:()=>oi,textWidth:()=>Sn,themeCss:()=>Qo,themeParts:()=>Ai,vdoc:()=>df});var up={sans700_13:{"0":.6787,"1":.5059,"2":.6372,"3":.6631,"4":.6812,"5":.6577,"6":.6777,"7":.6172,"8":.688,"9":.6777," ":.252,"!":.3506,'"':.563,"#":.6655,$:.6655,"%":1.0298,"&":.7388,"'":.3418,"(":.4229,")":.4229,"*":.4785,"+":.6655,",":.3418,"-":.4785,".":.3418,"/":.3286,":":.3418,";":.3418,"<":.6655,"=":.6655,">":.6655,"?":.5513,"@":.9214,A:.7266,B:.6875,C:.7354,D:.7417,E:.6162,F:.5918,G:.7544,H:.7773,I:.3125,J:.5952,K:.7036,L:.5889,M:.9009,N:.7622,O:.7808,P:.668,Q:.7808,R:.6885,S:.6694,T:.6543,U:.7544,V:.7153,W:1.0034,X:.7236,Y:.7021,Z:.6699,"[":.4229,"\\":.3286,"]":.4229,"^":.6655,_:.5845,"`":.4941,a:.584,b:.6455,c:.5815,d:.6455,e:.5952,f:.407,g:.6396,h:.6265,i:.2813,j:.2813,k:.5957,l:.2891,m:.9263,n:.6216,o:.6138,p:.6411,q:.6416,r:.4338,s:.5513,t:.4114,u:.6216,v:.5771,w:.8413,x:.5747,y:.5913,z:.5605,"{":.4229,"|":.2935,"}":.4229,"~":.6655,"\xB7":.3418,"\u2192":.9375,"\u2190":.9375,"\u2191":.8096,"\u2193":.8096,"\u2019":.3418,"\u2018":.3418,"\u201C":.5474,"\u201D":.5474,"\u2026":.9482,"\u2013":.6216,"\u2014":.9045,"\u2715":.7622,"\xD7":.6655,"\u2248":.6655,"\u2264":.6655,"\u2265":.6655,\u00E9:.5952},sans800_15:{"0":.687,"1":.5122,"2":.6406,"3":.6675,"4":.686,"5":.6626,"6":.6836,"7":.6191,"8":.6968,"9":.6836," ":.2344,"!":.3555,'"':.5835,"#":.6694,$:.6694,"%":1.0566,"&":.7397,"'":.3491,"(":.4287,")":.4287,"*":.4731,"+":.6694,",":.3491,"-":.4731,".":.3491,"/":.3286,":":.3491,";":.3491,"<":.6694,"=":.6694,">":.6694,"?":.5562,"@":.9146,A:.7363,B:.6899,C:.7339,D:.7388,E:.6147,F:.5903,G:.749,H:.7813,I:.3198,J:.6064,K:.7104,L:.5879,M:.9019,N:.7612,O:.7759,P:.6709,Q:.7759,R:.6924,S:.6719,T:.6533,U:.7524,V:.7212,W:1.0073,X:.731,Y:.71,Z:.6646,"[":.4287,"\\":.3286,"]":.4287,"^":.6694,_:.5889,"`":.4844,a:.5864,b:.6479,c:.5811,d:.6479,e:.5952,f:.4139,g:.6416,h:.6309,i:.2847,j:.2847,k:.605,l:.2935,m:.937,n:.626,o:.6138,p:.6436,q:.6445,r:.4406,s:.5557,t:.4198,u:.626,v:.5806,w:.856,x:.5835,y:.5996,z:.5601,"{":.4287,"|":.2974,"}":.4287,"~":.6694,"\xB7":.3491,"\u2192":.9404,"\u2190":.9404,"\u2191":.811,"\u2193":.811,"\u2019":.3491,"\u2018":.3491,"\u201C":.5688,"\u201D":.5688,"\u2026":.9883,"\u2013":.626,"\u2014":.9118,"\u2715":.7622,"\xD7":.6694,"\u2248":.6694,"\u2264":.6694,"\u2265":.6694,\u00E9:.5952},sans800_10_5:{"0":.7114,"1":.5366,"2":.665,"3":.6919,"4":.7104,"5":.687,"6":.708,"7":.6436,"8":.7212,"9":.708," ":.2588,"!":.3799,'"':.6079,"#":.6938,$:.6938,"%":1.0811,"&":.7642,"'":.3735,"(":.4531,")":.4531,"*":.4976,"+":.6938,",":.3735,"-":.4976,".":.3735,"/":.353,":":.3735,";":.3735,"<":.6938,"=":.6938,">":.6938,"?":.5806,"@":.939,A:.7607,B:.7144,C:.7583,D:.7632,E:.6392,F:.6147,G:.7734,H:.8057,I:.3442,J:.6309,K:.7349,L:.6123,M:.9263,N:.7856,O:.8003,P:.6953,Q:.8003,R:.7168,S:.6963,T:.6777,U:.7769,V:.7456,W:1.0317,X:.7554,Y:.7344,Z:.689,"[":.4531,"\\":.353,"]":.4531,"^":.6938,_:.6133,"`":.5088,a:.6108,b:.6724,c:.6055,d:.6724,e:.6196,f:.4383,g:.666,h:.6553,i:.3091,j:.3091,k:.6294,l:.3179,m:.9614,n:.6504,o:.6382,p:.668,q:.6689,r:.465,s:.5801,t:.4442,u:.6504,v:.605,w:.8804,x:.6079,y:.624,z:.5845,"{":.4531,"|":.3218,"}":.4531,"~":.6938,"\xB7":.3735,"\u2192":.9648,"\u2190":.9648,"\u2191":.8354,"\u2193":.8354,"\u2019":.3735,"\u2018":.3735,"\u201C":.5933,"\u201D":.5933,"\u2026":1.0127,"\u2013":.6504,"\u2014":.9204,"\u2715":.7622,"\xD7":.6938,"\u2248":.6938,"\u2264":.6938,"\u2265":.6938,\u00E9:.6196},sans600_12:{"0":.6665,"1":.4956,"2":.6299,"3":.6548,"4":.6724,"5":.6484,"6":.668,"7":.6113,"8":.6753,"9":.668," ":.2656,"!":.3413,'"':.5386,"#":.6577,$:.6577,"%":.999,"&":.7334,"'":.3306,"(":.4131,")":.4131,"*":.48,"+":.6577,",":.3306,"-":.48,".":.3306,"/":.3247,":":.3306,";":.3306,"<":.6577,"=":.6577,">":.6577,"?":.5425,"@":.9238,A:.7129,B:.6812,C:.7329,D:.7402,E:.6133,F:.5889,G:.7559,H:.7695,I:.3013,J:.5801,K:.6924,L:.5859,M:.8955,N:.7593,O:.7813,P:.6606,Q:.7813,R:.6807,S:.6626,T:.6514,U:.7524,V:.7056,W:.9956,X:.7124,Y:.6904,Z:.6709,"[":.4131,"\\":.3247,"]":.4131,"^":.6577,_:.5757,"`":.5,a:.5771,b:.6392,c:.5781,d:.6392,e:.5908,f:.3957,g:.6333,h:.6177,i:.2739,j:.2734,k:.582,l:.2808,m:.9116,n:.6128,o:.6099,p:.6348,q:.6348,r:.4232,s:.543,t:.3991,u:.6128,v:.5693,w:.8228,x:.562,y:.5791,z:.5571,"{":.4131,"|":.2856,"}":.4131,"~":.6577,"\xB7":.3306,"\u2192":.9307,"\u2190":.9307,"\u2191":.8037,"\u2193":.8037,"\u2019":.3306,"\u2018":.3306,"\u201C":.522,"\u201D":.522,"\u2026":.9043,"\u2013":.6128,"\u2014":.8957,"\u2715":.7622,"\xD7":.6577,"\u2248":.6577,"\u2264":.6577,"\u2265":.6577,\u00E9:.5908},sans800_12:{"0":.7026,"1":.5278,"2":.6563,"3":.6831,"4":.7017,"5":.6782,"6":.6992,"7":.6348,"8":.7124,"9":.6992," ":.25,"!":.3711,'"':.5991,"#":.6851,$:.6851,"%":1.0723,"&":.7554,"'":.3647,"(":.4443,")":.4443,"*":.4888,"+":.6851,",":.3647,"-":.4888,".":.3647,"/":.3442,":":.3647,";":.3647,"<":.6851,"=":.6851,">":.6851,"?":.5718,"@":.9302,A:.752,B:.7056,C:.7495,D:.7544,E:.6304,F:.606,G:.7646,H:.7969,I:.3354,J:.6221,K:.7261,L:.6035,M:.9175,N:.7769,O:.7915,P:.6865,Q:.7915,R:.708,S:.6875,T:.6689,U:.7681,V:.7368,W:1.0229,X:.7466,Y:.7256,Z:.6802,"[":.4443,"\\":.3442,"]":.4443,"^":.6851,_:.6045,"`":.5,a:.6021,b:.6636,c:.5967,d:.6636,e:.6108,f:.4295,g:.6572,h:.6465,i:.3003,j:.3003,k:.6206,l:.3091,m:.9526,n:.6416,o:.6294,p:.6592,q:.6602,r:.4562,s:.5713,t:.4354,u:.6416,v:.5962,w:.8716,x:.5991,y:.6152,z:.5757,"{":.4443,"|":.313,"}":.4443,"~":.6851,"\xB7":.3647,"\u2192":.9561,"\u2190":.9561,"\u2191":.8267,"\u2193":.8267,"\u2019":.3647,"\u2018":.3647,"\u201C":.5845,"\u201D":.5845,"\u2026":1.0039,"\u2013":.6416,"\u2014":.9173,"\u2715":.7622,"\xD7":.6851,"\u2248":.6851,"\u2264":.6851,"\u2265":.6851,\u00E9:.6108},sans800_11_5:{"0":.7056,"1":.5308,"2":.6592,"3":.686,"4":.7046,"5":.6812,"6":.7021,"7":.6377,"8":.7153,"9":.7021," ":.2529,"!":.374,'"':.6021,"#":.688,$:.688,"%":1.0752,"&":.7583,"'":.3677,"(":.4473,")":.4473,"*":.4917,"+":.688,",":.3677,"-":.4917,".":.3677,"/":.3472,":":.3677,";":.3677,"<":.688,"=":.688,">":.688,"?":.5747,"@":.9331,A:.7549,B:.7085,C:.7524,D:.7573,E:.6333,F:.6089,G:.7676,H:.7998,I:.3384,J:.625,K:.729,L:.6064,M:.9204,N:.7798,O:.7944,P:.6895,Q:.7944,R:.7109,S:.6904,T:.6719,U:.771,V:.7397,W:1.0259,X:.7495,Y:.7285,Z:.6831,"[":.4473,"\\":.3472,"]":.4473,"^":.688,_:.6074,"`":.5029,a:.605,b:.6665,c:.5996,d:.6665,e:.6138,f:.4325,g:.6602,h:.6494,i:.3032,j:.3032,k:.6235,l:.312,m:.9556,n:.6445,o:.6323,p:.6621,q:.6631,r:.4591,s:.5742,t:.4383,u:.6445,v:.5991,w:.8745,x:.6021,y:.6182,z:.5786,"{":.4473,"|":.3159,"}":.4473,"~":.688,"\xB7":.3677,"\u2192":.959,"\u2190":.959,"\u2191":.8296,"\u2193":.8296,"\u2019":.3677,"\u2018":.3677,"\u201C":.5874,"\u201D":.5874,"\u2026":1.0068,"\u2013":.6445,"\u2014":.9183,"\u2715":.7622,"\xD7":.688,"\u2248":.688,"\u2264":.688,"\u2265":.688,\u00E9:.6138},sans400_13:{"0":.624,"1":.458,"2":.5977,"3":.6211,"4":.6377,"5":.6123,"6":.6309,"7":.582,"8":.6328,"9":.6309," ":.2754,"!":.3052,'"':.4717,"#":.624,$:.624,"%":.9194,"&":.7056,"'":.291,"(":.376,")":.376,"*":.4658,"+":.624,",":.291,"-":.4658,".":.291,"/":.2988,":":.291,";":.291,"<":.624,"=":.624,">":.624,"?":.5068,"@":.9121,A:.668,B:.6514,C:.71,D:.7207,E:.5898,F:.5664,G:.7407,H:.7363,I:.2617,J:.5322,K:.6528,L:.562,M:.8682,N:.7363,O:.7656,P:.6294,Q:.7656,R:.6475,S:.6313,T:.6279,U:.7314,V:.668,W:.9619,X:.6729,Y:.6494,Z:.6558,"[":.376,"\\":.2988,"]":.376,"^":.624,_:.5405,"`":.4941,a:.5459,b:.6084,c:.5537,d:.6084,e:.5654,f:.356,g:.6035,h:.5825,i:.2412,j:.2407,k:.5371,l:.2471,m:.8643,n:.5776,o:.585,p:.6045,q:.6035,r:.3843,s:.5083,t:.3574,u:.5776,v:.5361,w:.7686,x:.5186,y:.5371,z:.5332,"{":.376,"|":.2529,"}":.376,"~":.624,"\xB7":.291,"\u2192":.8999,"\u2190":.8999,"\u2191":.7754,"\u2193":.7754,"\u2019":.291,"\u2018":.291,"\u201C":.4531,"\u201D":.4531,"\u2026":.7988,"\u2013":.5776,"\u2014":.872,"\u2715":.7622,"\xD7":.624,"\u2248":.624,"\u2264":.624,"\u2265":.624,\u00E9:.5654},mono400_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021},mono600_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021}};var lt=34,Ct=Math.cos(Math.PI/6),Re=(t,e,s=0)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],bt=t=>{let e=Math.round(t*10)/10;return Object.is(e,-0)?"0":String(e)},Gs=t=>`${bt(t[0])},${bt(t[1])}`,St=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function ve(t,e={},s){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${St(typeof o=="number"?bt(o):o)}"`)}return s===void 0?`<${t}${r}/>`:`<${t}${r}>${s}</${t}>`}var wt={lbl:{key:"sans700_13",size:13},sub:{key:"mono400_11",size:11},slabname:{key:"sans800_15",size:15,spacing:.12},sm:{key:"sans800_10_5",size:10.5,spacing:.1},floor:{key:"mono600_11",size:11,spacing:.01},say:{key:"sans600_12",size:12},tunname:{key:"sans800_12",size:12,spacing:.14},badge:{key:"sans800_11_5",size:11.5}};function Sn(t,e){let s=up[e.key],r=e.key.startsWith("mono")?.6:.58,i=0;for(let o of t)i+=s[o]??r;return(i+(e.spacing??0)*[...t].length)*e.size}var si=(t,e,s)=>[t[0]*e+t[2]*s+t[4],t[1]*e+t[3]*s+t[5]],ri=t=>`matrix(${t.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function fl(t,e){if(e==="left"){let[i,o]=Re(t.x0,t.y1,t.z1);return{m:[Ct,.5,0,1,i,o],w:(t.x1-t.x0)*lt,h:(t.z1-t.z0)*lt}}if(e==="right"){let[i,o]=Re(t.x1,t.y1,t.z1);return{m:[Ct,-.5,0,1,i,o],w:(t.y1-t.y0)*lt,h:(t.z1-t.z0)*lt}}let[s,r]=Re(t.x0,t.y0,t.z1);return{m:[Ct,.5,-Ct,.5,s,r],w:(t.x1-t.x0)*lt,h:(t.y1-t.y0)*lt}}var ii=class{x0=1/0;y0=1/0;x1=-1/0;y1=-1/0;add(e){e[0]<this.x0&&(this.x0=e[0]),e[0]>this.x1&&(this.x1=e[0]),e[1]<this.y0&&(this.y0=e[1]),e[1]>this.y1&&(this.y1=e[1])}addRect(e,s,r,i){this.add([e,s]),this.add([e+r,s+i])}get empty(){return this.x0===1/0}},fr=class{bounds=new ii;texts=[];planes=[];planePolys=[];defs=new Map;poly(e,s,r={}){let i=e.map(o=>Re(o[0],o[1],o[2]));return i.forEach(o=>this.bounds.add(o)),ve("polygon",{points:i.map(Gs).join(" "),class:s,...r})}line3(e,s,r,i={}){let o=Re(...e),n=Re(...s);return this.bounds.add(o),this.bounds.add(n),ve("line",{x1:o[0],y1:o[1],x2:n[0],y2:n[1],class:r,...i})}blockFaces(e){let{x0:s,y0:r,x1:i,y1:o,z0:n,z1:a}=e;return this.poly([[s,o,n],[i,o,n],[i,o,a],[s,o,a]],"lft")+this.poly([[i,r,n],[i,o,n],[i,o,a],[i,r,a]],"rgt")+this.poly([[s,r,a],[i,r,a],[i,o,a],[s,o,a]],"top")}onFace(e,s,r,i){let o=fl(e,s);for(let[n,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(si(o.m,n,a));return ve("g",{class:i,transform:ri(o.m)},r(o.w,o.h))}onMatrix(e,s,r,i,o){for(let[n,a]of[[0,0],[s,0],[0,r],[s,r]])this.bounds.add(si(e,n,a));return ve("g",{class:o,transform:ri(e)},i(s,r))}text(e,s,r,i,o,n="middle",a={},m){let p=Sn(r,o),l={x:n==="start"?e:n==="end"?e-p:e-p/2,y:s-o.size*.8,w:p,h:o.size*1.05,text:r,owner:m};return this.bounds.addRect(l.x-2,l.y-2,l.w+4,l.h+4),this.texts.push(l),ve("text",{x:e,y:s,class:i,"text-anchor":n==="start"?void 0:n,...a},St(r))}planeText(e,s,r,i,o="start",n={}){let a=Sn(s,i),m=o==="start"?0:o==="end"?-a:-a/2,p=[[m,-i.size*.8],[m+a,-i.size*.8],[m,i.size*.25],[m+a,i.size*.25]].map(([f,d])=>si(e,f,d));p.forEach(f=>this.bounds.add(f));let c=p.map(f=>f[0]),l=p.map(f=>f[1]);return this.planePolys.push([p[0],p[1],p[3],p[2]]),this.planes.push({x:Math.min(...c),y:Math.min(...l),w:Math.max(...c)-Math.min(...c),h:Math.max(...l)-Math.min(...l)}),ve("text",{transform:ri(e),class:r,"text-anchor":o==="start"?void 0:o,...n},St(s))}floorText(e,s,r,i,o,n="x",a="start",m={}){let[p,c]=Re(e,s,r),l=n==="x"?[Ct,.5,-Ct,.5,p,c]:[Ct,-.5,Ct,.5,p,c];return this.planeText(l,i,o,wt.floor,a,m)}faceText(e,s,r,i,o,n,a="left",m="start",p={}){let[c,l]=Re(e,s,r),f=a==="left"?[Ct,.5,0,1,c,l]:[Ct,-.5,0,1,c,l];return this.planeText(f,i,o,n,m,p)}def(e,s){this.defs.set(e,s)}},Zs=t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1];function oi(t,e,s){let r="";for(let i=0;i<s;i++){let o=e.z1-(e.z1-e.z0)*(.28+i*.2),n=(e.x1-e.x0)*(i===s-1?.35:.62-i*.1);r+=t.line3([e.x0+.35,e.y1,o],[e.x0+.35+n,e.y1,o],"det")}return r}function po(t,e){let r=e.z1,i=[e.x0+.55,e.y0+.55,r],o=[e.x1-.55,e.y0+.55,r],n=[e.x1-.55,e.y1-.55,r],a=[e.x0+.55,e.y1-.55,r],m=[(e.x0+e.x1)/2,(e.y0+e.y1)/2,r];return t.poly([i,o,n,a],"det")+t.line3(i,m,"det")+t.line3(m,o,"det")}function fo(t,e){let r=e.z1,i=t.poly([[e.x0+.55,e.y0+.55,r],[e.x1-.55,e.y0+.55,r],[e.x1-.55,e.y1-.55,r],[e.x0+.55,e.y1-.55,r]],"det");for(let o=1;o<=2;o++){let n=e.y0+.55+(e.y1-e.y0-1.1)*o/3;i+=t.line3([e.x0+.55+.3,n,r],[e.x1-.55-.3-(o===2?.5:0),n,r],"det")}return i}function mo(t,e){let r=e.z1,i=(e.y0+e.y1)/2;return t.line3([e.x0+.3,i-.2,r],[e.x1-.3,i-.2,r],"det")+t.line3([e.x0+.3,i+.2,r],[e.x1-.3-.3,i+.2,r],"det")}function uo(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.16,n=[];for(let a=0;a<20;a++){let m=a/20*Math.PI*2;n.push([s-o*1.4+Math.cos(m)*o,r+Math.sin(m)*o,i])}return t.poly(n,"det")+t.line3([s-o*.4,r,i],[s+o*2.2,r,i],"det")+t.line3([s+o*1.7,r,i],[s+o*1.7,r+o*.8,i],"det")}function ho(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.28,n=[];for(let a=0;a<24;a++){let m=a/24*Math.PI*2;n.push([s+Math.cos(m)*o,r+Math.sin(m)*o,i])}return t.poly(n,"det sock-hole")}var Us=(t,e,s,r,i,o=0)=>ve("rect",{class:t,x:e,y:s,width:r,height:i,rx:o||void 0}),dr={terminal(t,e){let s="",r=Math.max(2,Math.floor((e-12)/9));for(let i=0;i<r;i++){let o=10+i*9,n=(t-18)*[.7,.45,.6,.3,.55][i%5];s+=ve("line",{class:"ln",x1:8,y1:o,x2:8+n,y2:o})}return s},chat(t,e){return[[6,.62,"w"],[.3,.58,"m"],[6,.46,"w"],[.42,.5,"m"]].map((r,i)=>{let o=(t-14)*r[1],n=r[0]===6?7:t-7-o;return Us(r[2],n,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return Us("wall",5,5,t-10,e-10,2)+Us("bar",5,5,t-10,6)+Us("win",t*.5,13,t*.38,e*.42,2)},tiles(t,e){let n=(t-12-5)/3,a=(e-12-2.5*1)/2,m="";for(let p=0;p<2;p++)for(let c=0;c<3;c++){let l=6+c*(n+2.5),f=6+p*(a+2.5);m+=Us("t",l,f,n,a,1.5),[.3,.52,.74].forEach((d,u)=>{m+=ve("line",{class:"ln",x1:l+2.5,y1:f+a*d,x2:l+2.5+(n-5)*[.8,.5,.65][(u+p+c)%3],y2:f+a*d})})}return m}};function ai(t,e){let s=t/2,r=e/2,i=Math.min(t,e)*.22;return Us("unk",t*.2,e*.2,t*.6,e*.6,2)+ve("path",{class:"unk-q",d:`M${bt(s-i*.5)},${bt(r-i*.45)}a${bt(i*.5)},${bt(i*.5)} 0 1 1 ${bt(i*.5)},${bt(i*.55)}v${bt(i*.3)}`})+ve("circle",{class:"unk-dot",cx:bt(s),cy:bt(r+i*.75),r:bt(Math.max(.8,i*.1))})}function li(t,e){return Us("glass",3,3,t-6,e-6,3)}function wm(t){let e=[Re(t.x0,t.y0,t.z1),Re(t.x1,t.y0,t.z0),Re(t.x0,t.y1,t.z0),Re(t.x1,t.y1,t.z0),Re(t.x1,t.y1,t.z1),Re(t.x0,t.y0,t.z0)],s=e.map(i=>i[0]),r=e.map(i=>i[1]);return[Math.min(...s),Math.min(...r),Math.max(...s),Math.max(...r)]}function xm(t,e){let r=t.x1<=e.x0+1e-6,i=e.x1<=t.x0+1e-6,o=t.y1<=e.y0+1e-6,n=e.y1<=t.y0+1e-6,a=t.z1<=e.z0+1e-6,m=e.z1<=t.z0+1e-6,p=r||o||a,c=i||n||m;return p&&!c?-1:c&&!p?1:0}function ci(t){let e=t.length,s=t.map(p=>wm(p.box)),r=p=>p.box.x0+p.box.y0+p.box.z0*.01,i=t.map(()=>[]),o=new Array(e).fill(0);for(let p=0;p<e;p++)for(let c=p+1;c<e;c++){let l=s[p],f=s[c];if(l[2]<=f[0]||f[2]<=l[0]||l[3]<=f[1]||f[3]<=l[1])continue;let d=xm(t[p].box,t[c].box);d<0?(i[p].push(c),o[c]++):d>0&&(i[c].push(p),o[p]++)}let n=[],a=t.map((p,c)=>c).filter(p=>!o[p]),m=new Array(e).fill(!1);for(;n.length<e;){if(!a.length){let c=t.map((l,f)=>f).filter(l=>!m[l]).sort((l,f)=>r(t[l])-r(t[f]));a.push(c[0]),o[c[0]]=0}a.sort((c,l)=>r(t[c])-r(t[l])||c-l);let p=a.shift();if(!m[p]){m[p]=!0,n.push(t[p]);for(let c of i[p])!m[c]&&--o[c]===0&&a.push(c)}}return n}var yo=Symbol.for("yaml.alias"),go=Symbol.for("yaml.document"),_n=Symbol.for("yaml.map"),dl=Symbol.for("yaml.pair"),gn=Symbol.for("yaml.scalar"),hs=Symbol.for("yaml.seq"),rn=Symbol.for("yaml.node.type"),Fn=t=>!!t&&typeof t=="object"&&t[rn]===yo,es=t=>!!t&&typeof t=="object"&&t[rn]===go,cn=t=>!!t&&typeof t=="object"&&t[rn]===_n,Qe=t=>!!t&&typeof t=="object"&&t[rn]===dl,Ge=t=>!!t&&typeof t=="object"&&t[rn]===gn,pn=t=>!!t&&typeof t=="object"&&t[rn]===hs;function ct(t){if(t&&typeof t=="object")switch(t[rn]){case _n:case hs:return!0}return!1}function nt(t){if(t&&typeof t=="object")switch(t[rn]){case yo:case _n:case gn:case hs:return!0}return!1}var bo=t=>(Ge(t)||ct(t))&&!!t.anchor;var fn=Symbol("break visit"),yp=Symbol("skip children"),ts=Symbol("remove node");function ns(t,e){let s=gp(e);es(t)?mr(null,t.contents,s,Object.freeze([t]))===ts&&(t.contents=null):mr(null,t,s,Object.freeze([]))}ns.BREAK=fn;ns.SKIP=yp;ns.REMOVE=ts;function mr(t,e,s,r){let i=bp(t,e,s,r);if(nt(i)||Qe(i))return wp(t,r,i),mr(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=mr(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===ts&&(e.items.splice(o,1),o-=1)}}}else if(Qe(e)){r=Object.freeze(r.concat(e));let o=mr("key",e.key,s,r);if(o===fn)return fn;o===ts&&(e.key=null);let n=mr("value",e.value,s,r);if(n===fn)return fn;n===ts&&(e.value=null)}}return i}async function wo(t,e){let s=gp(e);es(t)?await ur(null,t.contents,s,Object.freeze([t]))===ts&&(t.contents=null):await ur(null,t,s,Object.freeze([]))}wo.BREAK=fn;wo.SKIP=yp;wo.REMOVE=ts;async function ur(t,e,s,r){let i=await bp(t,e,s,r);if(nt(i)||Qe(i))return wp(t,r,i),ur(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=await ur(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===ts&&(e.items.splice(o,1),o-=1)}}}else if(Qe(e)){r=Object.freeze(r.concat(e));let o=await ur("key",e.key,s,r);if(o===fn)return fn;o===ts&&(e.key=null);let n=await ur("value",e.value,s,r);if(n===fn)return fn;n===ts&&(e.value=null)}}return i}function gp(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function bp(t,e,s,r){if(typeof s=="function")return s(t,e,r);if(cn(e))return s.Map?.(t,e,r);if(pn(e))return s.Seq?.(t,e,r);if(Qe(e))return s.Pair?.(t,e,r);if(Ge(e))return s.Scalar?.(t,e,r);if(Fn(e))return s.Alias?.(t,e,r)}function wp(t,e,s){let r=e[e.length-1];if(ct(r))r.items[t]=s;else if(Qe(r))t==="key"?r.key=s:r.value=s;else if(es(r))r.contents=s;else{let i=Fn(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var km={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$m=t=>t.replace(/[!,[\]{}]/g,e=>km[e]),ss=class t{constructor(e,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,s)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,s){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(s(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,n]=r;return this.tags[o]=n,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return s(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let n=/^\d+\.\d+$/.test(o);return s(6,`Unsupported YAML version ${o}`,n),!1}}default:return s(0,`Unknown directive ${i}`,!0),!1}}tagName(e,s){if(e==="!")return"!";if(e[0]!=="!")return s(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let n=e.slice(2,-1);return n==="!"||n==="!!"?(s(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&s("Verbatim tags must end with a >"),n)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||s(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(n){return s(String(n)),null}return r==="!"?e:(s(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[s,r]of Object.entries(this.tags))if(e.startsWith(r))return s+$m(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&nt(e.contents)){let o={};ns(e.contents,(n,a)=>{nt(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,n]of r)o==="!!"&&n==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(n)))&&s.push(`%TAG ${o} ${n}`);return s.join(`
|
|
2
|
-
`)}};
|
|
3
|
-
`)?
|
|
1
|
+
var Zm=Object.defineProperty;var yo=(t,e)=>{for(var s in e)Zm(t,s,{get:e[s],enumerable:!0})};var Dd={};yo(Dd,{Bounds:()=>ci,C:()=>Ct,DiagError:()=>la,FONTS:()=>wt,Kernel:()=>yr,MONO:()=>tn,S:()=>lt,VEl:()=>Ii,allowed:()=>lc,apply:()=>ai,bubble:()=>xo,buildSvg:()=>zd,center:()=>Hs,colorRef:()=>Hn,contrast:()=>Ci,createHash:()=>Ld,depthSort:()=>mi,didYouMean:()=>Vt,distance:()=>oc,envelope:()=>wo,esc:()=>vt,extendTheme:()=>_s,faceFrame:()=>Tl,fileLines:()=>ko,formatDiag:()=>ac,formatDiags:()=>Ed,greyOf:()=>zi,iso:()=>Ne,keyGlyph:()=>$o,loadTheme:()=>Tr,matStr:()=>li,monoOf:()=>fa,n1:()=>bt,parse:()=>ca,parseSvg:()=>cc,placeholderFace:()=>di,pt:()=>Us,screenFaces:()=>gr,screenGlass:()=>fi,serialize:()=>pa,sha256Hex:()=>pc,socketGlyph:()=>So,tag:()=>Se,termLines:()=>pi,textWidth:()=>On,themeCss:()=>aa,themeParts:()=>Ri,vdoc:()=>Cd,withFont:()=>bo});var _p={sans700_13:{"0":.6787,"1":.5059,"2":.6372,"3":.6631,"4":.6812,"5":.6577,"6":.6777,"7":.6172,"8":.688,"9":.6777," ":.252,"!":.3506,'"':.563,"#":.6655,$:.6655,"%":1.0298,"&":.7388,"'":.3418,"(":.4229,")":.4229,"*":.4785,"+":.6655,",":.3418,"-":.4785,".":.3418,"/":.3286,":":.3418,";":.3418,"<":.6655,"=":.6655,">":.6655,"?":.5513,"@":.9214,A:.7266,B:.6875,C:.7354,D:.7417,E:.6162,F:.5918,G:.7544,H:.7773,I:.3125,J:.5952,K:.7036,L:.5889,M:.9009,N:.7622,O:.7808,P:.668,Q:.7808,R:.6885,S:.6694,T:.6543,U:.7544,V:.7153,W:1.0034,X:.7236,Y:.7021,Z:.6699,"[":.4229,"\\":.3286,"]":.4229,"^":.6655,_:.5845,"`":.4941,a:.584,b:.6455,c:.5815,d:.6455,e:.5952,f:.407,g:.6396,h:.6265,i:.2813,j:.2813,k:.5957,l:.2891,m:.9263,n:.6216,o:.6138,p:.6411,q:.6416,r:.4338,s:.5513,t:.4114,u:.6216,v:.5771,w:.8413,x:.5747,y:.5913,z:.5605,"{":.4229,"|":.2935,"}":.4229,"~":.6655,"\xB7":.3418,"\u2192":.9375,"\u2190":.9375,"\u2191":.8096,"\u2193":.8096,"\u2019":.3418,"\u2018":.3418,"\u201C":.5474,"\u201D":.5474,"\u2026":.9482,"\u2013":.6216,"\u2014":.9045,"\u2715":.7622,"\xD7":.6655,"\u2248":.6655,"\u2264":.6655,"\u2265":.6655,\u00E9:.5952},sans800_15:{"0":.687,"1":.5122,"2":.6406,"3":.6675,"4":.686,"5":.6626,"6":.6836,"7":.6191,"8":.6968,"9":.6836," ":.2344,"!":.3555,'"':.5835,"#":.6694,$:.6694,"%":1.0566,"&":.7397,"'":.3491,"(":.4287,")":.4287,"*":.4731,"+":.6694,",":.3491,"-":.4731,".":.3491,"/":.3286,":":.3491,";":.3491,"<":.6694,"=":.6694,">":.6694,"?":.5562,"@":.9146,A:.7363,B:.6899,C:.7339,D:.7388,E:.6147,F:.5903,G:.749,H:.7813,I:.3198,J:.6064,K:.7104,L:.5879,M:.9019,N:.7612,O:.7759,P:.6709,Q:.7759,R:.6924,S:.6719,T:.6533,U:.7524,V:.7212,W:1.0073,X:.731,Y:.71,Z:.6646,"[":.4287,"\\":.3286,"]":.4287,"^":.6694,_:.5889,"`":.4844,a:.5864,b:.6479,c:.5811,d:.6479,e:.5952,f:.4139,g:.6416,h:.6309,i:.2847,j:.2847,k:.605,l:.2935,m:.937,n:.626,o:.6138,p:.6436,q:.6445,r:.4406,s:.5557,t:.4198,u:.626,v:.5806,w:.856,x:.5835,y:.5996,z:.5601,"{":.4287,"|":.2974,"}":.4287,"~":.6694,"\xB7":.3491,"\u2192":.9404,"\u2190":.9404,"\u2191":.811,"\u2193":.811,"\u2019":.3491,"\u2018":.3491,"\u201C":.5688,"\u201D":.5688,"\u2026":.9883,"\u2013":.626,"\u2014":.9118,"\u2715":.7622,"\xD7":.6694,"\u2248":.6694,"\u2264":.6694,"\u2265":.6694,\u00E9:.5952},sans800_10_5:{"0":.7114,"1":.5366,"2":.665,"3":.6919,"4":.7104,"5":.687,"6":.708,"7":.6436,"8":.7212,"9":.708," ":.2588,"!":.3799,'"':.6079,"#":.6938,$:.6938,"%":1.0811,"&":.7642,"'":.3735,"(":.4531,")":.4531,"*":.4976,"+":.6938,",":.3735,"-":.4976,".":.3735,"/":.353,":":.3735,";":.3735,"<":.6938,"=":.6938,">":.6938,"?":.5806,"@":.939,A:.7607,B:.7144,C:.7583,D:.7632,E:.6392,F:.6147,G:.7734,H:.8057,I:.3442,J:.6309,K:.7349,L:.6123,M:.9263,N:.7856,O:.8003,P:.6953,Q:.8003,R:.7168,S:.6963,T:.6777,U:.7769,V:.7456,W:1.0317,X:.7554,Y:.7344,Z:.689,"[":.4531,"\\":.353,"]":.4531,"^":.6938,_:.6133,"`":.5088,a:.6108,b:.6724,c:.6055,d:.6724,e:.6196,f:.4383,g:.666,h:.6553,i:.3091,j:.3091,k:.6294,l:.3179,m:.9614,n:.6504,o:.6382,p:.668,q:.6689,r:.465,s:.5801,t:.4442,u:.6504,v:.605,w:.8804,x:.6079,y:.624,z:.5845,"{":.4531,"|":.3218,"}":.4531,"~":.6938,"\xB7":.3735,"\u2192":.9648,"\u2190":.9648,"\u2191":.8354,"\u2193":.8354,"\u2019":.3735,"\u2018":.3735,"\u201C":.5933,"\u201D":.5933,"\u2026":1.0127,"\u2013":.6504,"\u2014":.9204,"\u2715":.7622,"\xD7":.6938,"\u2248":.6938,"\u2264":.6938,"\u2265":.6938,\u00E9:.6196},sans600_12:{"0":.6665,"1":.4956,"2":.6299,"3":.6548,"4":.6724,"5":.6484,"6":.668,"7":.6113,"8":.6753,"9":.668," ":.2656,"!":.3413,'"':.5386,"#":.6577,$:.6577,"%":.999,"&":.7334,"'":.3306,"(":.4131,")":.4131,"*":.48,"+":.6577,",":.3306,"-":.48,".":.3306,"/":.3247,":":.3306,";":.3306,"<":.6577,"=":.6577,">":.6577,"?":.5425,"@":.9238,A:.7129,B:.6812,C:.7329,D:.7402,E:.6133,F:.5889,G:.7559,H:.7695,I:.3013,J:.5801,K:.6924,L:.5859,M:.8955,N:.7593,O:.7813,P:.6606,Q:.7813,R:.6807,S:.6626,T:.6514,U:.7524,V:.7056,W:.9956,X:.7124,Y:.6904,Z:.6709,"[":.4131,"\\":.3247,"]":.4131,"^":.6577,_:.5757,"`":.5,a:.5771,b:.6392,c:.5781,d:.6392,e:.5908,f:.3957,g:.6333,h:.6177,i:.2739,j:.2734,k:.582,l:.2808,m:.9116,n:.6128,o:.6099,p:.6348,q:.6348,r:.4232,s:.543,t:.3991,u:.6128,v:.5693,w:.8228,x:.562,y:.5791,z:.5571,"{":.4131,"|":.2856,"}":.4131,"~":.6577,"\xB7":.3306,"\u2192":.9307,"\u2190":.9307,"\u2191":.8037,"\u2193":.8037,"\u2019":.3306,"\u2018":.3306,"\u201C":.522,"\u201D":.522,"\u2026":.9043,"\u2013":.6128,"\u2014":.8957,"\u2715":.7622,"\xD7":.6577,"\u2248":.6577,"\u2264":.6577,"\u2265":.6577,\u00E9:.5908},sans800_12:{"0":.7026,"1":.5278,"2":.6563,"3":.6831,"4":.7017,"5":.6782,"6":.6992,"7":.6348,"8":.7124,"9":.6992," ":.25,"!":.3711,'"':.5991,"#":.6851,$:.6851,"%":1.0723,"&":.7554,"'":.3647,"(":.4443,")":.4443,"*":.4888,"+":.6851,",":.3647,"-":.4888,".":.3647,"/":.3442,":":.3647,";":.3647,"<":.6851,"=":.6851,">":.6851,"?":.5718,"@":.9302,A:.752,B:.7056,C:.7495,D:.7544,E:.6304,F:.606,G:.7646,H:.7969,I:.3354,J:.6221,K:.7261,L:.6035,M:.9175,N:.7769,O:.7915,P:.6865,Q:.7915,R:.708,S:.6875,T:.6689,U:.7681,V:.7368,W:1.0229,X:.7466,Y:.7256,Z:.6802,"[":.4443,"\\":.3442,"]":.4443,"^":.6851,_:.6045,"`":.5,a:.6021,b:.6636,c:.5967,d:.6636,e:.6108,f:.4295,g:.6572,h:.6465,i:.3003,j:.3003,k:.6206,l:.3091,m:.9526,n:.6416,o:.6294,p:.6592,q:.6602,r:.4562,s:.5713,t:.4354,u:.6416,v:.5962,w:.8716,x:.5991,y:.6152,z:.5757,"{":.4443,"|":.313,"}":.4443,"~":.6851,"\xB7":.3647,"\u2192":.9561,"\u2190":.9561,"\u2191":.8267,"\u2193":.8267,"\u2019":.3647,"\u2018":.3647,"\u201C":.5845,"\u201D":.5845,"\u2026":1.0039,"\u2013":.6416,"\u2014":.9173,"\u2715":.7622,"\xD7":.6851,"\u2248":.6851,"\u2264":.6851,"\u2265":.6851,\u00E9:.6108},sans800_11_5:{"0":.7056,"1":.5308,"2":.6592,"3":.686,"4":.7046,"5":.6812,"6":.7021,"7":.6377,"8":.7153,"9":.7021," ":.2529,"!":.374,'"':.6021,"#":.688,$:.688,"%":1.0752,"&":.7583,"'":.3677,"(":.4473,")":.4473,"*":.4917,"+":.688,",":.3677,"-":.4917,".":.3677,"/":.3472,":":.3677,";":.3677,"<":.688,"=":.688,">":.688,"?":.5747,"@":.9331,A:.7549,B:.7085,C:.7524,D:.7573,E:.6333,F:.6089,G:.7676,H:.7998,I:.3384,J:.625,K:.729,L:.6064,M:.9204,N:.7798,O:.7944,P:.6895,Q:.7944,R:.7109,S:.6904,T:.6719,U:.771,V:.7397,W:1.0259,X:.7495,Y:.7285,Z:.6831,"[":.4473,"\\":.3472,"]":.4473,"^":.688,_:.6074,"`":.5029,a:.605,b:.6665,c:.5996,d:.6665,e:.6138,f:.4325,g:.6602,h:.6494,i:.3032,j:.3032,k:.6235,l:.312,m:.9556,n:.6445,o:.6323,p:.6621,q:.6631,r:.4591,s:.5742,t:.4383,u:.6445,v:.5991,w:.8745,x:.6021,y:.6182,z:.5786,"{":.4473,"|":.3159,"}":.4473,"~":.688,"\xB7":.3677,"\u2192":.959,"\u2190":.959,"\u2191":.8296,"\u2193":.8296,"\u2019":.3677,"\u2018":.3677,"\u201C":.5874,"\u201D":.5874,"\u2026":1.0068,"\u2013":.6445,"\u2014":.9183,"\u2715":.7622,"\xD7":.688,"\u2248":.688,"\u2264":.688,"\u2265":.688,\u00E9:.6138},sans400_13:{"0":.624,"1":.458,"2":.5977,"3":.6211,"4":.6377,"5":.6123,"6":.6309,"7":.582,"8":.6328,"9":.6309," ":.2754,"!":.3052,'"':.4717,"#":.624,$:.624,"%":.9194,"&":.7056,"'":.291,"(":.376,")":.376,"*":.4658,"+":.624,",":.291,"-":.4658,".":.291,"/":.2988,":":.291,";":.291,"<":.624,"=":.624,">":.624,"?":.5068,"@":.9121,A:.668,B:.6514,C:.71,D:.7207,E:.5898,F:.5664,G:.7407,H:.7363,I:.2617,J:.5322,K:.6528,L:.562,M:.8682,N:.7363,O:.7656,P:.6294,Q:.7656,R:.6475,S:.6313,T:.6279,U:.7314,V:.668,W:.9619,X:.6729,Y:.6494,Z:.6558,"[":.376,"\\":.2988,"]":.376,"^":.624,_:.5405,"`":.4941,a:.5459,b:.6084,c:.5537,d:.6084,e:.5654,f:.356,g:.6035,h:.5825,i:.2412,j:.2407,k:.5371,l:.2471,m:.8643,n:.5776,o:.585,p:.6045,q:.6035,r:.3843,s:.5083,t:.3574,u:.5776,v:.5361,w:.7686,x:.5186,y:.5371,z:.5332,"{":.376,"|":.2529,"}":.376,"~":.624,"\xB7":.291,"\u2192":.8999,"\u2190":.8999,"\u2191":.7754,"\u2193":.7754,"\u2019":.291,"\u2018":.291,"\u201C":.4531,"\u201D":.4531,"\u2026":.7988,"\u2013":.5776,"\u2014":.872,"\u2715":.7622,"\xD7":.624,"\u2248":.624,"\u2264":.624,"\u2265":.624,\u00E9:.5654},mono400_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021},mono600_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021}};var lt=34,Ct=Math.cos(Math.PI/6),Ne=(t,e,s=0)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],bt=t=>{let e=Math.round(t*10)/10;return Object.is(e,-0)?"0":String(e)},Us=t=>`${bt(t[0])},${bt(t[1])}`,vt=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function Se(t,e={},s){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${vt(typeof o=="number"?bt(o):o)}"`)}return s===void 0?`<${t}${r}/>`:`<${t}${r}>${s}</${t}>`}var wt={lbl:{key:"sans700_13",size:13},sub:{key:"mono400_11",size:11},slabname:{key:"sans800_15",size:15,spacing:.12},sm:{key:"sans800_10_5",size:10.5,spacing:.1},floor:{key:"mono600_11",size:11,spacing:.01},say:{key:"sans600_12",size:12},tunname:{key:"sans800_12",size:12,spacing:.14},badge:{key:"sans800_11_5",size:11.5}},go;function bo(t,e){let s=go;go=t;try{return e()}finally{go=s}}function On(t,e){let s=go?.widths[e.key]??_p[e.key],r=e.key.startsWith("mono")?.6:.58,i=0;for(let o of t)i+=s[o]??r;return(i+(e.spacing??0)*[...t].length)*e.size}var ai=(t,e,s)=>[t[0]*e+t[2]*s+t[4],t[1]*e+t[3]*s+t[5]],li=t=>`matrix(${t.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function Tl(t,e){if(e==="left"){let[i,o]=Ne(t.x0,t.y1,t.z1);return{m:[Ct,.5,0,1,i,o],w:(t.x1-t.x0)*lt,h:(t.z1-t.z0)*lt}}if(e==="right"){let[i,o]=Ne(t.x1,t.y1,t.z1);return{m:[Ct,-.5,0,1,i,o],w:(t.y1-t.y0)*lt,h:(t.z1-t.z0)*lt}}let[s,r]=Ne(t.x0,t.y0,t.z1);return{m:[Ct,.5,-Ct,.5,s,r],w:(t.x1-t.x0)*lt,h:(t.y1-t.y0)*lt}}var ci=class{x0=1/0;y0=1/0;x1=-1/0;y1=-1/0;add(e){e[0]<this.x0&&(this.x0=e[0]),e[0]>this.x1&&(this.x1=e[0]),e[1]<this.y0&&(this.y0=e[1]),e[1]>this.y1&&(this.y1=e[1])}addRect(e,s,r,i){this.add([e,s]),this.add([e+r,s+i])}get empty(){return this.x0===1/0}},yr=class{bounds=new ci;texts=[];planes=[];planePolys=[];defs=new Map;poly(e,s,r={}){let i=e.map(o=>Ne(o[0],o[1],o[2]));return i.forEach(o=>this.bounds.add(o)),Se("polygon",{points:i.map(Us).join(" "),class:s,...r})}line3(e,s,r,i={}){let o=Ne(...e),n=Ne(...s);return this.bounds.add(o),this.bounds.add(n),Se("line",{x1:o[0],y1:o[1],x2:n[0],y2:n[1],class:r,...i})}blockFaces(e){let{x0:s,y0:r,x1:i,y1:o,z0:n,z1:a}=e;return this.poly([[s,o,n],[i,o,n],[i,o,a],[s,o,a]],"lft")+this.poly([[i,r,n],[i,o,n],[i,o,a],[i,r,a]],"rgt")+this.poly([[s,r,a],[i,r,a],[i,o,a],[s,o,a]],"top")}onFace(e,s,r,i){let o=Tl(e,s);for(let[n,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(ai(o.m,n,a));return Se("g",{class:i,transform:li(o.m)},r(o.w,o.h))}onMatrix(e,s,r,i,o){for(let[n,a]of[[0,0],[s,0],[0,r],[s,r]])this.bounds.add(ai(e,n,a));return Se("g",{class:o,transform:li(e)},i(s,r))}text(e,s,r,i,o,n="middle",a={},f){let p=On(r,o),l={x:n==="start"?e:n==="end"?e-p:e-p/2,y:s-o.size*.8,w:p,h:o.size*1.05,text:r,owner:f};return this.bounds.addRect(l.x-2,l.y-2,l.w+4,l.h+4),this.texts.push(l),Se("text",{x:e,y:s,class:i,"text-anchor":n==="start"?void 0:n,...a},vt(r))}planeText(e,s,r,i,o="start",n={}){let a=On(s,i),f=o==="start"?0:o==="end"?-a:-a/2,p=[[f,-i.size*.8],[f+a,-i.size*.8],[f,i.size*.25],[f+a,i.size*.25]].map(([d,m])=>ai(e,d,m));p.forEach(d=>this.bounds.add(d));let c=p.map(d=>d[0]),l=p.map(d=>d[1]);return this.planePolys.push([p[0],p[1],p[3],p[2]]),this.planes.push({x:Math.min(...c),y:Math.min(...l),w:Math.max(...c)-Math.min(...c),h:Math.max(...l)-Math.min(...l)}),Se("text",{transform:li(e),class:r,"text-anchor":o==="start"?void 0:o,...n},vt(s))}floorText(e,s,r,i,o,n="x",a="start",f={}){let[p,c]=Ne(e,s,r),l=n==="x"?[Ct,.5,-Ct,.5,p,c]:[Ct,-.5,Ct,.5,p,c];return this.planeText(l,i,o,wt.floor,a,f)}faceText(e,s,r,i,o,n,a="left",f="start",p={}){let[c,l]=Ne(e,s,r),d=a==="left"?[Ct,.5,0,1,c,l]:[Ct,-.5,0,1,c,l];return this.planeText(d,i,o,n,f,p)}def(e,s){this.defs.set(e,s)}},Hs=t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1];function pi(t,e,s){let r="";for(let i=0;i<s;i++){let o=e.z1-(e.z1-e.z0)*(.28+i*.2),n=(e.x1-e.x0)*(i===s-1?.35:.62-i*.1);r+=t.line3([e.x0+.35,e.y1,o],[e.x0+.35+n,e.y1,o],"det")}return r}function wo(t,e){let r=e.z1,i=[e.x0+.55,e.y0+.55,r],o=[e.x1-.55,e.y0+.55,r],n=[e.x1-.55,e.y1-.55,r],a=[e.x0+.55,e.y1-.55,r],f=[(e.x0+e.x1)/2,(e.y0+e.y1)/2,r];return t.poly([i,o,n,a],"det")+t.line3(i,f,"det")+t.line3(f,o,"det")}function xo(t,e){let r=e.z1,i=t.poly([[e.x0+.55,e.y0+.55,r],[e.x1-.55,e.y0+.55,r],[e.x1-.55,e.y1-.55,r],[e.x0+.55,e.y1-.55,r]],"det");for(let o=1;o<=2;o++){let n=e.y0+.55+(e.y1-e.y0-1.1)*o/3;i+=t.line3([e.x0+.55+.3,n,r],[e.x1-.55-.3-(o===2?.5:0),n,r],"det")}return i}function ko(t,e){let r=e.z1,i=(e.y0+e.y1)/2;return t.line3([e.x0+.3,i-.2,r],[e.x1-.3,i-.2,r],"det")+t.line3([e.x0+.3,i+.2,r],[e.x1-.3-.3,i+.2,r],"det")}function $o(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.16,n=[];for(let a=0;a<20;a++){let f=a/20*Math.PI*2;n.push([s-o*1.4+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det")+t.line3([s-o*.4,r,i],[s+o*2.2,r,i],"det")+t.line3([s+o*1.7,r,i],[s+o*1.7,r+o*.8,i],"det")}function So(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.28,n=[];for(let a=0;a<24;a++){let f=a/24*Math.PI*2;n.push([s+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det sock-hole")}var Ys=(t,e,s,r,i,o=0)=>Se("rect",{class:t,x:e,y:s,width:r,height:i,rx:o||void 0}),gr={terminal(t,e){let s="",r=Math.max(2,Math.floor((e-12)/9));for(let i=0;i<r;i++){let o=10+i*9,n=(t-18)*[.7,.45,.6,.3,.55][i%5];s+=Se("line",{class:"ln",x1:8,y1:o,x2:8+n,y2:o})}return s},chat(t,e){return[[6,.62,"w"],[.3,.58,"m"],[6,.46,"w"],[.42,.5,"m"]].map((r,i)=>{let o=(t-14)*r[1],n=r[0]===6?7:t-7-o;return Ys(r[2],n,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return Ys("wall",5,5,t-10,e-10,2)+Ys("bar",5,5,t-10,6)+Ys("win",t*.5,13,t*.38,e*.42,2)},tiles(t,e){let n=(t-12-5)/3,a=(e-12-2.5*1)/2,f="";for(let p=0;p<2;p++)for(let c=0;c<3;c++){let l=6+c*(n+2.5),d=6+p*(a+2.5);f+=Ys("t",l,d,n,a,1.5),[.3,.52,.74].forEach((m,h)=>{f+=Se("line",{class:"ln",x1:l+2.5,y1:d+a*m,x2:l+2.5+(n-5)*[.8,.5,.65][(h+p+c)%3],y2:d+a*m})})}return f}};function di(t,e){let s=t/2,r=e/2,i=Math.min(t,e)*.22;return Ys("unk",t*.2,e*.2,t*.6,e*.6,2)+Se("path",{class:"unk-q",d:`M${bt(s-i*.5)},${bt(r-i*.45)}a${bt(i*.5)},${bt(i*.5)} 0 1 1 ${bt(i*.5)},${bt(i*.55)}v${bt(i*.3)}`})+Se("circle",{class:"unk-dot",cx:bt(s),cy:bt(r+i*.75),r:bt(Math.max(.8,i*.1))})}function fi(t,e){return Ys("glass",3,3,t-6,e-6,3)}function Hm(t){let e=[Ne(t.x0,t.y0,t.z1),Ne(t.x1,t.y0,t.z0),Ne(t.x0,t.y1,t.z0),Ne(t.x1,t.y1,t.z0),Ne(t.x1,t.y1,t.z1),Ne(t.x0,t.y0,t.z0)],s=e.map(i=>i[0]),r=e.map(i=>i[1]);return[Math.min(...s),Math.min(...r),Math.max(...s),Math.max(...r)]}function Ym(t,e){let r=t.x1<=e.x0+1e-6,i=e.x1<=t.x0+1e-6,o=t.y1<=e.y0+1e-6,n=e.y1<=t.y0+1e-6,a=t.z1<=e.z0+1e-6,f=e.z1<=t.z0+1e-6,p=r||o||a,c=i||n||f;return p&&!c?-1:c&&!p?1:0}function mi(t){let e=t.length,s=t.map(p=>Hm(p.box)),r=p=>p.box.x0+p.box.y0+p.box.z0*.01,i=t.map(()=>[]),o=new Array(e).fill(0);for(let p=0;p<e;p++)for(let c=p+1;c<e;c++){let l=s[p],d=s[c];if(l[2]<=d[0]||d[2]<=l[0]||l[3]<=d[1]||d[3]<=l[1])continue;let m=Ym(t[p].box,t[c].box);m<0?(i[p].push(c),o[c]++):m>0&&(i[c].push(p),o[p]++)}let n=[],a=t.map((p,c)=>c).filter(p=>!o[p]),f=new Array(e).fill(!1);for(;n.length<e;){if(!a.length){let c=t.map((l,d)=>d).filter(l=>!f[l]).sort((l,d)=>r(t[l])-r(t[d]));a.push(c[0]),o[c[0]]=0}a.sort((c,l)=>r(t[c])-r(t[l])||c-l);let p=a.shift();if(!f[p]){f[p]=!0,n.push(t[p]);for(let c of i[p])!f[c]&&--o[c]===0&&a.push(c)}}return n}var vo=Symbol.for("yaml.alias"),Mo=Symbol.for("yaml.document"),Bn=Symbol.for("yaml.map"),El=Symbol.for("yaml.pair"),bn=Symbol.for("yaml.scalar"),gs=Symbol.for("yaml.seq"),on=Symbol.for("yaml.node.type"),qn=t=>!!t&&typeof t=="object"&&t[on]===vo,ss=t=>!!t&&typeof t=="object"&&t[on]===Mo,pn=t=>!!t&&typeof t=="object"&&t[on]===Bn,Xe=t=>!!t&&typeof t=="object"&&t[on]===El,Ge=t=>!!t&&typeof t=="object"&&t[on]===bn,dn=t=>!!t&&typeof t=="object"&&t[on]===gs;function ct(t){if(t&&typeof t=="object")switch(t[on]){case Bn:case gs:return!0}return!1}function nt(t){if(t&&typeof t=="object")switch(t[on]){case vo:case Bn:case bn:case gs:return!0}return!1}var Po=t=>(Ge(t)||ct(t))&&!!t.anchor;var fn=Symbol("break visit"),Dp=Symbol("skip children"),rs=Symbol("remove node");function is(t,e){let s=Bp(e);ss(t)?br(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):br(null,t,s,Object.freeze([]))}is.BREAK=fn;is.SKIP=Dp;is.REMOVE=rs;function br(t,e,s,r){let i=qp(t,e,s,r);if(nt(i)||Xe(i))return Vp(t,r,i),br(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=br(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(Xe(e)){r=Object.freeze(r.concat(e));let o=br("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=br("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}async function Oo(t,e){let s=Bp(e);ss(t)?await wr(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):await wr(null,t,s,Object.freeze([]))}Oo.BREAK=fn;Oo.SKIP=Dp;Oo.REMOVE=rs;async function wr(t,e,s,r){let i=await qp(t,e,s,r);if(nt(i)||Xe(i))return Vp(t,r,i),wr(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=await wr(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(Xe(e)){r=Object.freeze(r.concat(e));let o=await wr("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=await wr("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}function Bp(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function qp(t,e,s,r){if(typeof s=="function")return s(t,e,r);if(pn(e))return s.Map?.(t,e,r);if(dn(e))return s.Seq?.(t,e,r);if(Xe(e))return s.Pair?.(t,e,r);if(Ge(e))return s.Scalar?.(t,e,r);if(qn(e))return s.Alias?.(t,e,r)}function Vp(t,e,s){let r=e[e.length-1];if(ct(r))r.items[t]=s;else if(Xe(r))t==="key"?r.key=s:r.value=s;else if(ss(r))r.contents=s;else{let i=qn(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var Wm={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Jm=t=>t.replace(/[!,[\]{}]/g,e=>Wm[e]),os=class t{constructor(e,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,s)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,s){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(s(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,n]=r;return this.tags[o]=n,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return s(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let n=/^\d+\.\d+$/.test(o);return s(6,`Unsupported YAML version ${o}`,n),!1}}default:return s(0,`Unknown directive ${i}`,!0),!1}}tagName(e,s){if(e==="!")return"!";if(e[0]!=="!")return s(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let n=e.slice(2,-1);return n==="!"||n==="!!"?(s(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&s("Verbatim tags must end with a >"),n)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||s(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(n){return s(String(n)),null}return r==="!"?e:(s(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[s,r]of Object.entries(this.tags))if(e.startsWith(r))return s+Jm(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&nt(e.contents)){let o={};is(e.contents,(n,a)=>{nt(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,n]of r)o==="!!"&&n==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(n)))&&s.push(`%TAG ${o} ${n}`);return s.join(`
|
|
2
|
+
`)}};os.defaultYaml={explicit:!1,version:"1.2"};os.defaultTags={"!!":"tag:yaml.org,2002:"};function Ao(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(s)}return!0}function Nl(t){let e=new Set;return is(t,{Value(s,r){r.anchor&&e.add(r.anchor)}}),e}function Rl(t,e){for(let s=1;;++s){let r=`${t}${s}`;if(!e.has(r))return r}}function Kp(t,e){let s=[],r=new Map,i=null;return{onAnchor:o=>{s.push(o),i??(i=Nl(t));let n=Rl(e,i);return i.add(n),n},setAnchors:()=>{for(let o of s){let n=r.get(o);if(typeof n=="object"&&n.anchor&&(Ge(n.node)||ct(n.node)))n.node.anchor=n.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}function Ns(t,e,s,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let n=r[i],a=Ns(t,r,String(i),n);a===void 0?delete r[i]:a!==n&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),n=Ns(t,r,i,o);n===void 0?r.delete(i):n!==o&&r.set(i,n)}else if(r instanceof Set)for(let i of Array.from(r)){let o=Ns(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let n=Ns(t,r,i,o);n===void 0?delete r[i]:n!==o&&(r[i]=n)}return t.call(e,s,r)}function qt(t,e,s){if(Array.isArray(t))return t.map((r,i)=>qt(r,String(i),s));if(t&&typeof t.toJSON=="function"){if(!s||!Po(t))return t.toJSON(e,s);let r={aliasCount:0,count:1,res:void 0};s.anchors.set(t,r),s.onCreate=o=>{r.res=o,delete s.onCreate};let i=t.toJSON(e,s);return s.onCreate&&s.onCreate(i),i}return typeof t=="bigint"&&!s?.keep?Number(t):t}var Rs=class{constructor(e){Object.defineProperty(this,on,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!ss(e))throw new TypeError("A document argument is required");let n={anchors:new Map,doc:e,keep:!0,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=qt(this,"",n);if(typeof i=="function")for(let{count:f,res:p}of n.anchors.values())i(p,f);return typeof o=="function"?Ns(o,{"":a},"",a):a}};var bs=class extends Rs{constructor(e){super(vo),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,s){if(s?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;s?.aliasResolveCache?r=s.aliasResolveCache:(r=[],is(e,{Node:(o,n)=>{(qn(n)||Po(n))&&r.push(n)}}),s&&(s.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}if(i&&s){let{anchors:o,doc:n,maxAliasCount:a}=s,f=o.get(i);if(f||(qt(i,null,s),f=o.get(i)),f?.res===void 0){let p="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(p)}if(a>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=To(n,i,o)),f.count*f.aliasCount>a)){let p="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(p)}}return i}toJSON(e,s){if(!s)return{source:this.source};let r=this.resolve(s.doc,s);if(!r){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return s.anchors.get(r).res}toString(e,s,r){let i=`*${this.source}`;if(e){if(Ao(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function To(t,e,s){if(qn(e)){let r=e.resolve(t),i=s&&r&&s.get(r);return i?i.count*i.aliasCount:0}else if(ct(e)){let r=0;for(let i of e.items){let o=To(t,i,s);o>r&&(r=o)}return r}else if(Xe(e)){let r=To(t,e.key,s),i=To(t,e.value,s);return Math.max(r,i)}return 1}var Eo=t=>!t||typeof t!="function"&&typeof t!="object",Re=class extends Rs{constructor(e){super(bn),this.value=e}toJSON(e,s){return s?.keep?this.value:qt(this.value,e,s)}toString(){return String(this.value)}};Re.BLOCK_FOLDED="BLOCK_FOLDED";Re.BLOCK_LITERAL="BLOCK_LITERAL";Re.PLAIN="PLAIN";Re.QUOTE_DOUBLE="QUOTE_DOUBLE";Re.QUOTE_SINGLE="QUOTE_SINGLE";var Xm="tag:yaml.org,2002:";function Qm(t,e,s){if(e){let r=s.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return s.find(r=>r.identify?.(t)&&!r.format)}function ws(t,e,s){if(ss(t)&&(t=t.contents),nt(t))return t;if(Xe(t)){let l=s.schema[Bn].createNode?.(s.schema,null,s);return l.items.push(t),l}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:n,sourceObjects:a}=s,f;if(r&&t&&typeof t=="object"){if(f=a.get(t),f)return f.anchor??(f.anchor=i(t)),new bs(f.anchor);f={anchor:null,node:null},a.set(t,f)}e?.startsWith("!!")&&(e=Xm+e.slice(2));let p=Qm(t,e,n.tags);if(!p){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let l=new Re(t);return f&&(f.node=l),l}p=t instanceof Map?n[Bn]:Symbol.iterator in Object(t)?n[gs]:n[Bn]}o&&(o(p),delete s.onTagObj);let c=p?.createNode?p.createNode(s.schema,t,s):typeof p?.nodeClass?.from=="function"?p.nodeClass.from(s.schema,t,s):new Re(t);return e?c.tag=e:p.default||(c.tag=p.tag),f&&(f.node=c),c}function ui(t,e,s){let r=s;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let n=[];n[o]=r,r=n}else r=new Map([[o,r]])}return ws(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var kr=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,xr=class extends Rs{constructor(e,s){super(e),Object.defineProperty(this,"schema",{value:s,configurable:!0,enumerable:!1,writable:!0})}clone(e){let s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(s.schema=e),s.items=s.items.map(r=>nt(r)||Xe(r)?r.clone(e):r),this.range&&(s.range=this.range.slice()),s}addIn(e,s){if(kr(e))this.add(s);else{let[r,...i]=e,o=this.get(r,!0);if(ct(o))o.addIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[s,...r]=e;if(r.length===0)return this.delete(s);let i=this.get(s,!0);if(ct(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}getIn(e,s){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!s&&Ge(o)?o.value:o:ct(o)?o.getIn(i,s):void 0}hasAllNullValues(e){return this.items.every(s=>{if(!Xe(s))return!1;let r=s.value;return r==null||e&&Ge(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[s,...r]=e;if(r.length===0)return this.has(s);let i=this.get(s,!0);return ct(i)?i.hasIn(r):!1}setIn(e,s){let[r,...i]=e;if(i.length===0)this.set(r,s);else{let o=this.get(r,!0);if(ct(o))o.setIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var Gp=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function An(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var as=(t,e,s)=>t.endsWith(`
|
|
3
|
+
`)?An(s,e):s.includes(`
|
|
4
4
|
`)?`
|
|
5
|
-
`+
|
|
6
|
-
`)s===
|
|
7
|
-
`&&
|
|
8
|
-
`&&
|
|
9
|
-
${e}${t.slice(0,
|
|
10
|
-
${e}${t.slice(
|
|
11
|
-
`);r=e,i=e+1,o=t[i]}return r}var
|
|
12
|
-
`){if(o-n>r)return!0;if(n=o+1,i-n<=r)return!1}return!0}function
|
|
5
|
+
`+An(s,e):(t.endsWith(" ")?"":" ")+s;var Il="flow",No="block",hi="quoted";function yi(t,e,s="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:n,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let f=Math.max(1+o,1+i-e.length);if(t.length<=f)return t;let p=[],c={},l=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?p.push(0):l=i-r);let d,m,h=!1,y=-1,g=-1,k=-1;s===No&&(y=Zp(t,y,e.length),y!==-1&&(l=y+f));for(let b;b=t[y+=1];){if(s===hi&&b==="\\"){switch(g=y,t[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}k=y}if(b===`
|
|
6
|
+
`)s===No&&(y=Zp(t,y,e.length)),l=y+e.length+f,d=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
|
|
7
|
+
`&&m!==" "){let x=t[y+1];x&&x!==" "&&x!==`
|
|
8
|
+
`&&x!==" "&&(d=y)}if(y>=l)if(d)p.push(d),l=d+f,d=void 0;else if(s===hi){for(;m===" "||m===" ";)m=b,b=t[y+=1],h=!0;let x=y>k+1?y-2:g-1;if(c[x])return t;p.push(x),c[x]=!0,l=x+f,d=void 0}else h=!0}m=b}if(h&&a&&a(),p.length===0)return t;n&&n();let u=t.slice(0,p[0]);for(let b=0;b<p.length;++b){let x=p[b],w=p[b+1]||t.length;x===0?u=`
|
|
9
|
+
${e}${t.slice(0,w)}`:(s===hi&&c[x]&&(u+=`${t[x]}\\`),u+=`
|
|
10
|
+
${e}${t.slice(x+1,w)}`)}return u}function Zp(t,e,s){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+s)o=t[++e];else{do o=t[++e];while(o&&o!==`
|
|
11
|
+
`);r=e,i=e+1,o=t[i]}return r}var Io=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),zo=t=>/^(%|---|\.\.\.)/m.test(t);function eu(t,e,s){if(!e||e<0)return!1;let r=e-s,i=t.length;if(i<=r)return!1;for(let o=0,n=0;o<i;++o)if(t[o]===`
|
|
12
|
+
`){if(o-n>r)return!0;if(n=o+1,i-n<=r)return!1}return!0}function gi(t,e){let s=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return s;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(zo(t)?" ":""),n="",a=0;for(let f=0,p=s[f];p;p=s[++f])if(p===" "&&s[f+1]==="\\"&&s[f+2]==="n"&&(n+=s.slice(a,f)+"\\ ",f+=1,a=f,p="\\"),p==="\\")switch(s[f+1]){case"u":{n+=s.slice(a,f);let c=s.substr(f+2,4);switch(c){case"0000":n+="\\0";break;case"0007":n+="\\a";break;case"000b":n+="\\v";break;case"001b":n+="\\e";break;case"0085":n+="\\N";break;case"00a0":n+="\\_";break;case"2028":n+="\\L";break;case"2029":n+="\\P";break;default:c.substr(0,2)==="00"?n+="\\x"+c.substr(2):n+=s.substr(f,6)}f+=5,a=f+1}break;case"n":if(r||s[f+2]==='"'||s.length<i)f+=1;else{for(n+=s.slice(a,f)+`
|
|
13
13
|
|
|
14
|
-
`;s[
|
|
15
|
-
`,
|
|
16
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return
|
|
17
|
-
${s}`)+"'";return e.implicitKey?r:
|
|
14
|
+
`;s[f+2]==="\\"&&s[f+3]==="n"&&s[f+4]!=='"';)n+=`
|
|
15
|
+
`,f+=2;n+=o,s[f+2]===" "&&(n+="\\"),f+=1,a=f+1}break;default:f+=1}return n=a?n+s.slice(a):s,r?n:yi(n,o,hi,Io(e,!1))}function zl(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
16
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return gi(t,e);let s=e.indent||(zo(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
+
${s}`)+"'";return e.implicitKey?r:yi(r,s,Il,Io(e,!1))}function $r(t,e){let{singleQuote:s}=e.options,r;if(s===!1)r=gi;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=zl:o&&!i?r=gi:r=s?zl:gi}return r(t,e)}var Cl;try{Cl=new RegExp(`(^|(?<!
|
|
18
18
|
))
|
|
19
19
|
+(?!
|
|
20
|
-
|$)`,"g")}catch{
|
|
20
|
+
|$)`,"g")}catch{Cl=/\n+(?!\n|$)/g}function Ro({comment:t,type:e,value:s},r,i,o){let{blockQuote:n,commentString:a,lineWidth:f}=r.options;if(!n||/\n[\t ]+$/.test(s))return $r(s,r);let p=r.indent||(r.forceBlockIndent||zo(s)?" ":""),c=n==="literal"?!0:n==="folded"||e===Re.BLOCK_FOLDED?!1:e===Re.BLOCK_LITERAL?!0:!eu(s,f,p.length);if(!s)return c?`|
|
|
21
21
|
`:`>
|
|
22
|
-
`;let l,
|
|
23
|
-
`&&
|
|
24
|
-
`);
|
|
25
|
-
`&&(
|
|
26
|
-
`)
|
|
27
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`),$=!1,v=
|
|
28
|
-
${p}${
|
|
29
|
-
${p}${
|
|
30
|
-
`)||c&&/[[\]{},]/.test(o))return
|
|
31
|
-
`)
|
|
32
|
-
`))return
|
|
33
|
-
${
|
|
34
|
-
${e.indent}${a}`:a}function
|
|
35
|
-
${a}:`):(g=`${g}:`,
|
|
36
|
-
`:"",
|
|
37
|
-
${
|
|
22
|
+
`;let l,d;for(d=s.length;d>0;--d){let w=s[d-1];if(w!==`
|
|
23
|
+
`&&w!==" "&&w!==" ")break}let m=s.substring(d),h=m.indexOf(`
|
|
24
|
+
`);h===-1?l="-":s===m||h!==m.length-1?(l="+",o&&o()):l="",m&&(s=s.slice(0,-m.length),m[m.length-1]===`
|
|
25
|
+
`&&(m=m.slice(0,-1)),m=m.replace(Cl,`$&${p}`));let y=!1,g,k=-1;for(g=0;g<s.length;++g){let w=s[g];if(w===" ")y=!0;else if(w===`
|
|
26
|
+
`)k=g;else break}let u=s.substring(0,k<g?k+1:g);u&&(s=s.substring(u.length),u=u.replace(/\n+/g,`$&${p}`));let x=(y?p?"2":"1":"")+l;if(t&&(x+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!c){let w=s.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`),$=!1,v=Io(r,!0);n!=="folded"&&e!==Re.BLOCK_FOLDED&&(v.onOverflow=()=>{$=!0});let O=yi(`${u}${w}${m}`,p,No,v);if(!$)return`>${x}
|
|
28
|
+
${p}${O}`}return s=s.replace(/\n+/g,`$&${p}`),`|${x}
|
|
29
|
+
${p}${u}${s}${m}`}function tu(t,e,s,r){let{type:i,value:o}=t,{actualString:n,implicitKey:a,indent:f,indentStep:p,inFlow:c}=e;if(a&&o.includes(`
|
|
30
|
+
`)||c&&/[[\]{},]/.test(o))return $r(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||c||!o.includes(`
|
|
31
|
+
`)?$r(o,e):Ro(t,e,s,r);if(!a&&!c&&i!==Re.PLAIN&&o.includes(`
|
|
32
|
+
`))return Ro(t,e,s,r);if(zo(o)){if(f==="")return e.forceBlockIndent=!0,Ro(t,e,s,r);if(a&&f===p)return $r(o,e)}let l=o.replace(/\n+/g,`$&
|
|
33
|
+
${f}`);if(n){let d=y=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(l),{compat:m,tags:h}=e.doc.schema;if(h.some(d)||m?.some(d))return $r(o,e)}return a?l:yi(l,f,Il,Io(e,!1))}function Ws(t,e,s,r){let{implicitKey:i,inFlow:o}=e,n=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Re.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(n.value)&&(a=Re.QUOTE_DOUBLE);let f=c=>{switch(c){case Re.BLOCK_FOLDED:case Re.BLOCK_LITERAL:return i||o?$r(n.value,e):Ro(n,e,s,r);case Re.QUOTE_DOUBLE:return gi(n.value,e);case Re.QUOTE_SINGLE:return zl(n.value,e);case Re.PLAIN:return tu(n,e,s,r);default:return null}},p=f(a);if(p===null){let{defaultKeyType:c,defaultStringType:l}=e.options,d=i&&c||l;if(p=f(d),p===null)throw new Error(`Unsupported default string type ${d}`)}return p}function Co(t,e){let s=Object.assign({blockQuote:!0,commentString:Gp,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(s.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:typeof s.indent=="number"?" ".repeat(s.indent):" ",inFlow:r,options:s}}function nu(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let s,r;if(Ge(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(n=>n.test);o.length>0&&(i=o)}s=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,s=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!s){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return s}function su(t,e,{anchors:s,doc:r}){if(!r.directives)return"";let i=[],o=(Ge(t)||ct(t))&&t.anchor;o&&Ao(o)&&(s.add(o),i.push(`&${o}`));let n=t.tag??(e.default?null:e.tag);return n&&i.push(r.directives.tagString(n)),i.join(" ")}function xs(t,e,s,r){if(Xe(t))return t.toString(e,s,r);if(qn(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=nt(t)?t:e.doc.createNode(t,{onTagObj:f=>i=f});i??(i=nu(e.doc.schema.tags,o));let n=su(o,i,e);n.length>0&&(e.indentAtStart=(e.indentAtStart??0)+n.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,s,r):Ge(o)?Ws(o,e,s,r):o.toString(e,s,r);return n?Ge(o)||a[0]==="{"||a[0]==="["?`${n} ${a}`:`${n}
|
|
34
|
+
${e.indent}${a}`:a}function Up({key:t,value:e},s,r,i){let{allNullValues:o,doc:n,indent:a,indentStep:f,options:{commentString:p,indentSeq:c,simpleKeys:l}}=s,d=nt(t)&&t.comment||null;if(l){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ct(t)||!nt(t)&&typeof t=="object"){let v="With simple keys, collection cannot be used as a key value";throw new Error(v)}}let m=!l&&(!t||d&&e==null&&!s.inFlow||ct(t)||(Ge(t)?t.type===Re.BLOCK_FOLDED||t.type===Re.BLOCK_LITERAL:typeof t=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!m&&(l||!o),indent:a+f});let h=!1,y=!1,g=xs(t,s,()=>h=!0,()=>y=!0);if(!m&&!s.inFlow&&g.length>1024){if(l)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(s.inFlow){if(o||e==null)return h&&r&&r(),g===""?"?":m?`? ${g}`:g}else if(o&&!l||e==null&&m)return g=`? ${g}`,d&&!h?g+=as(g,s.indent,p(d)):y&&i&&i(),g;h&&(d=null),m?(d&&(g+=as(g,s.indent,p(d))),g=`? ${g}
|
|
35
|
+
${a}:`):(g=`${g}:`,d&&(g+=as(g,s.indent,p(d))));let k,u,b;nt(e)?(k=!!e.spaceBefore,u=e.commentBefore,b=e.comment):(k=!1,u=null,b=null,e&&typeof e=="object"&&(e=n.createNode(e))),s.implicitKey=!1,!m&&!d&&Ge(e)&&(s.indentAtStart=g.length+1),y=!1,!c&&f.length>=2&&!s.inFlow&&!m&&dn(e)&&!e.flow&&!e.tag&&!e.anchor&&(s.indent=s.indent.substring(2));let x=!1,w=xs(e,s,()=>x=!0,()=>y=!0),$=" ";if(d||k||u){if($=k?`
|
|
36
|
+
`:"",u){let v=p(u);$+=`
|
|
37
|
+
${An(v,s.indent)}`}w===""&&!s.inFlow?$===`
|
|
38
38
|
`&&b&&($=`
|
|
39
39
|
|
|
40
40
|
`):$+=`
|
|
41
|
-
${s.indent}`}else if(!
|
|
42
|
-
`),
|
|
43
|
-
${s.indent}`)}}else(
|
|
44
|
-
`)&&($="");return g+=$+
|
|
45
|
-
${
|
|
46
|
-
`}}return t?(
|
|
47
|
-
`+
|
|
48
|
-
`)),
|
|
41
|
+
${s.indent}`}else if(!m&&ct(e)){let v=w[0],O=w.indexOf(`
|
|
42
|
+
`),C=O!==-1,A=s.inFlow??e.flow??e.items.length===0;if(C||!A){let R=!1;if(C&&(v==="&"||v==="!")){let M=w.indexOf(" ");v==="&"&&M!==-1&&M<O&&w[M+1]==="!"&&(M=w.indexOf(" ",M+1)),(M===-1||O<M)&&(R=!0)}R||($=`
|
|
43
|
+
${s.indent}`)}}else(w===""||w[0]===`
|
|
44
|
+
`)&&($="");return g+=$+w,s.inFlow?x&&r&&r():b&&!x?g+=as(g,s.indent,p(b)):y&&i&&i(),g}function jo(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var Lo="<<",Vn={identify:t=>t===Lo||typeof t=="symbol"&&t.description===Lo,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Re(Symbol(Lo)),{addToJSMap:Ll}),stringify:()=>Lo},Hp=(t,e)=>(Vn.identify(e)||Ge(e)&&(!e.type||e.type===Re.PLAIN)&&Vn.identify(e.value))&&t?.doc.schema.tags.some(s=>s.tag===Vn.tag&&s.default);function Ll(t,e,s){let r=Yp(t,s);if(dn(r))for(let i of r.items)jl(t,e,i);else if(Array.isArray(r))for(let i of r)jl(t,e,i);else jl(t,e,r)}function jl(t,e,s){let r=Yp(t,s);if(!pn(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,n]of i)e instanceof Map?e.has(o)||e.set(o,n):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0});return e}function Yp(t,e){return t&&qn(e)?e.resolve(t.doc,t):e}function _o(t,e,{key:s,value:r}){if(nt(s)&&s.addToJSMap)s.addToJSMap(t,e,r);else if(Hp(t,s))Ll(t,e,r);else{let i=qt(s,"",t);if(e instanceof Map)e.set(i,qt(r,i,t));else if(e instanceof Set)e.add(i);else{let o=ru(s,i,t),n=qt(r,o,t);o in e?Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[o]=n}}return e}function ru(t,e,s){if(e===null)return"";if(typeof e!="object")return String(e);if(nt(t)&&s?.doc){let r=Co(s.doc,{});r.anchors=new Set;for(let o of s.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!s.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),jo(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Sr(t,e,s){let r=ws(t,void 0,s),i=ws(e,void 0,s);return new Et(r,i)}var Et=class t{constructor(e,s=null){Object.defineProperty(this,on,{value:El}),this.key=e,this.value=s}clone(e){let{key:s,value:r}=this;return nt(s)&&(s=s.clone(e)),nt(r)&&(r=r.clone(e)),new t(s,r)}toJSON(e,s){let r=s?.mapAsMap?new Map:{};return _o(s,r,this)}toString(e,s,r){return e?.doc?Up(this,e,s,r):JSON.stringify(this)}};function Do(t,e,s){return(e.inFlow??t.flow?ou:iu)(t,e,s)}function iu({comment:t,items:e},s,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:n,onComment:a}){let{indent:f,options:{commentString:p}}=s,c=Object.assign({},s,{indent:o,type:null}),l=!1,d=[];for(let h=0;h<e.length;++h){let y=e[h],g=null;if(nt(y))!l&&y.spaceBefore&&d.push(""),Fo(s,d,y.commentBefore,l),y.comment&&(g=y.comment);else if(Xe(y)){let u=nt(y.key)?y.key:null;u&&(!l&&u.spaceBefore&&d.push(""),Fo(s,d,u.commentBefore,l))}l=!1;let k=xs(y,c,()=>g=null,()=>l=!0);g&&(k+=as(k,o,p(g))),l&&g&&(l=!1),d.push(r+k)}let m;if(d.length===0)m=i.start+i.end;else{m=d[0];for(let h=1;h<d.length;++h){let y=d[h];m+=y?`
|
|
45
|
+
${f}${y}`:`
|
|
46
|
+
`}}return t?(m+=`
|
|
47
|
+
`+An(p(t),f),a&&a()):l&&n&&n(),m}function ou({items:t},e,{flowChars:s,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:n,options:{commentString:a}}=e;r+=o;let f=Object.assign({},e,{indent:r,inFlow:!0,type:null}),p=!1,c=0,l=[];for(let h=0;h<t.length;++h){let y=t[h],g=null;if(nt(y))y.spaceBefore&&l.push(""),Fo(e,l,y.commentBefore,!1),y.comment&&(g=y.comment);else if(Xe(y)){let u=nt(y.key)?y.key:null;u&&(u.spaceBefore&&l.push(""),Fo(e,l,u.commentBefore,!1),u.comment&&(p=!0));let b=nt(y.value)?y.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(p=!0)):y.value==null&&u?.comment&&(g=u.comment)}g&&(p=!0);let k=xs(y,f,()=>g=null);p||(p=l.length>c||k.includes(`
|
|
48
|
+
`)),h<t.length-1?k+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(p||(p=l.reduce((u,b)=>u+b.length+2,2)+(k.length+2)>e.options.lineWidth)),p&&(k+=",")),g&&(k+=as(k,r,a(g))),l.push(k),c=l.length}let{start:d,end:m}=s;if(l.length===0)return d+m;if(!p){let h=l.reduce((y,g)=>y+g.length+2,2);p=e.options.lineWidth>0&&h>e.options.lineWidth}if(p){let h=d;for(let y of l)h+=y?`
|
|
49
49
|
${o}${i}${y}`:`
|
|
50
|
-
`;return`${
|
|
51
|
-
${i}${
|
|
52
|
-
`:" ")}return
|
|
50
|
+
`;return`${h}
|
|
51
|
+
${i}${m}`}else return`${d}${n}${l.join(" ")}${n}${m}`}function Fo({indent:t,options:{commentString:e}},s,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=An(e(r),t);s.push(o.trimStart())}}function Is(t,e){let s=Ge(e)?e.value:e;for(let r of t)if(Xe(r)&&(r.key===e||r.key===s||Ge(r.key)&&r.key.value===s))return r}var jt=class extends xr{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Bn,e),this.items=[]}static from(e,s,r){let{keepUndefined:i,replacer:o}=r,n=new this(e),a=(f,p)=>{if(typeof o=="function")p=o.call(s,f,p);else if(Array.isArray(o)&&!o.includes(f))return;(p!==void 0||i)&&n.items.push(Sr(f,p,r))};if(s instanceof Map)for(let[f,p]of s)a(f,p);else if(s&&typeof s=="object")for(let f of Object.keys(s))a(f,s[f]);return typeof e.sortMapEntries=="function"&&n.items.sort(e.sortMapEntries),n}add(e,s){let r;Xe(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Et(e,e?.value):r=new Et(e.key,e.value);let i=Is(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!s)throw new Error(`Key ${r.key} already set`);Ge(i.value)&&Eo(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let n=this.items.findIndex(a=>o(r,a)<0);n===-1?this.items.push(r):this.items.splice(n,0,r)}else this.items.push(r)}delete(e){let s=Is(this.items,e);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(e,s){let i=Is(this.items,e)?.value;return(!s&&Ge(i)?i.value:i)??void 0}has(e){return!!Is(this.items,e)}set(e,s){this.add(new Et(e,s),!0)}toJSON(e,s,r){let i=r?new r:s?.mapAsMap?new Map:{};s?.onCreate&&s.onCreate(i);for(let o of this.items)_o(s,i,o);return i}toString(e,s,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xe(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Do(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:s})}};var Kn={collection:"map",default:!0,nodeClass:jt,tag:"tag:yaml.org,2002:map",resolve(t,e){return pn(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,s)=>jt.from(t,e,s)};var Qt=class extends xr{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gs,e),this.items=[]}add(e){this.items.push(e)}delete(e){let s=Bo(e);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(e,s){let r=Bo(e);if(typeof r!="number")return;let i=this.items[r];return!s&&Ge(i)?i.value:i}has(e){let s=Bo(e);return typeof s=="number"&&s<this.items.length}set(e,s){let r=Bo(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Ge(i)&&Eo(s)?i.value=s:this.items[r]=s}toJSON(e,s){let r=[];s?.onCreate&&s.onCreate(r);let i=0;for(let o of this.items)r.push(qt(o,String(i++),s));return r}toString(e,s,r){return e?Do(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:s}):JSON.stringify(this)}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s)){let n=0;for(let a of s){if(typeof i=="function"){let f=s instanceof Set?a:String(n++);a=i.call(s,f,a)}o.items.push(ws(a,void 0,r))}}return o}};function Bo(t){let e=Ge(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Gn={collection:"seq",default:!0,nodeClass:Qt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return dn(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,s)=>Qt.from(t,e,s)};var zs={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,s,r){return e=Object.assign({actualString:!0},e),Ws(t,e,s,r)}};var Js={identify:t=>t==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Re(null),stringify:({source:t},e)=>typeof t=="string"&&Js.test.test(t)?t:e.options.nullStr};var bi={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Re(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},s){if(t&&bi.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?s.options.trueStr:s.options.falseStr}};function en({format:t,minFractionDigits:e,tag:s,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!s||s==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let n=o.indexOf(".");n<0&&(n=o.length,o+=".");let a=e-(o.length-n-1);for(;a-- >0;)o+="0"}return o}var qo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},Vo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},Ko={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Re(parseFloat(t)),s=t.indexOf(".");return s!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-s-1),e},stringify:en};var Go=t=>typeof t=="bigint"||Number.isInteger(t),_l=(t,e,s,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),s);function Wp(t,e,s){let{value:r}=t;return Go(r)&&r>=0?s+r.toString(e):en(t)}var Zo={identify:t=>Go(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,s)=>_l(t,2,8,s),stringify:t=>Wp(t,8,"0o")},Uo={identify:Go,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,s)=>_l(t,0,10,s),stringify:en},Ho={identify:t=>Go(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,s)=>_l(t,2,16,s),stringify:t=>Wp(t,16,"0x")};var Jp=[Kn,Gn,zs,Js,bi,Zo,Uo,Ho,qo,Vo,Ko];function Xp(t){return typeof t=="bigint"||Number.isInteger(t)}var Yo=({value:t})=>JSON.stringify(t),au=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Yo},{identify:t=>t==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Yo},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Yo},{identify:Xp,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:s})=>s?BigInt(t):parseInt(t,10),stringify:({value:t})=>Xp(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Yo}],lu={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Qp=[Kn,Gn].concat(au,lu);var wi={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let s=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(s.length);for(let i=0;i<s.length;++i)r[i]=s.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:s},r,i,o){if(!s)return"";let n=s,a;if(typeof btoa=="function"){let f="";for(let p=0;p<n.length;++p)f+=String.fromCharCode(n[p]);a=btoa(f)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Re.BLOCK_LITERAL),e!==Re.QUOTE_DOUBLE){let f=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),p=Math.ceil(a.length/f),c=new Array(p);for(let l=0,d=0;l<p;++l,d+=f)c[l]=a.substr(d,f);a=c.join(e===Re.BLOCK_LITERAL?`
|
|
52
|
+
`:" ")}return Ws({comment:t,type:e,value:a},r,i,o)}};function Fl(t,e){if(dn(t))for(let s=0;s<t.items.length;++s){let r=t.items[s];if(!Xe(r)){if(pn(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Et(new Re(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
|
53
53
|
${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
|
|
54
|
-
${o.comment}`:r.comment}r=i}t.items[s]=
|
|
55
|
-
`)?(s.push("..."),s.push(
|
|
54
|
+
${o.comment}`:r.comment}r=i}t.items[s]=Xe(r)?r:new Et(r)}}else e("Expected a sequence for this tag");return t}function Dl(t,e,s){let{replacer:r}=s,i=new Qt(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let n of e){typeof r=="function"&&(n=r.call(e,String(o++),n));let a,f;if(Array.isArray(n))if(n.length===2)a=n[0],f=n[1];else throw new TypeError(`Expected [key, value] tuple: ${n}`);else if(n&&n instanceof Object){let p=Object.keys(n);if(p.length===1)a=p[0],f=n[a];else throw new TypeError(`Expected tuple with one key, not ${p.length} keys`)}else a=n;i.items.push(Sr(a,f,s))}return i}var xi={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Fl,createNode:Dl};var vr=class t extends Qt{constructor(){super(),this.add=jt.prototype.add.bind(this),this.delete=jt.prototype.delete.bind(this),this.get=jt.prototype.get.bind(this),this.has=jt.prototype.has.bind(this),this.set=jt.prototype.set.bind(this),this.tag=t.tag}toJSON(e,s){if(!s)return super.toJSON(e);let r=new Map;s?.onCreate&&s.onCreate(r);for(let i of this.items){let o,n;if(Xe(i)?(o=qt(i.key,"",s),n=qt(i.value,o,s)):o=qt(i,"",s),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,n)}return r}static from(e,s,r){let i=Dl(e,s,r),o=new this;return o.items=i.items,o}};vr.tag="tag:yaml.org,2002:omap";var ki={collection:"seq",identify:t=>t instanceof Map,nodeClass:vr,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let s=Fl(t,e),r=[];for(let{key:i}of s.items)Ge(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new vr,s)},createNode:(t,e,s)=>vr.from(t,e,s)};function ed({value:t,source:e},s){return e&&(t?Bl:ql).test.test(e)?e:t?s.options.trueStr:s.options.falseStr}var Bl={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Re(!0),stringify:ed},ql={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Re(!1),stringify:ed};var td={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},nd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},sd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Re(parseFloat(t.replace(/_/g,""))),s=t.indexOf(".");if(s!==-1){let r=t.substring(s+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:en};var $i=t=>typeof t=="bigint"||Number.isInteger(t);function Wo(t,e,s,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(s){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let n=BigInt(t);return i==="-"?BigInt(-1)*n:n}let o=parseInt(t,s);return i==="-"?-1*o:o}function Vl(t,e,s){let{value:r}=t;if($i(r)){let i=r.toString(e);return r<0?"-"+s+i.substr(1):s+i}return en(t)}var rd={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,s)=>Wo(t,2,2,s),stringify:t=>Vl(t,2,"0b")},id={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,s)=>Wo(t,1,8,s),stringify:t=>Vl(t,8,"0")},od={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,s)=>Wo(t,0,10,s),stringify:en},ad={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,s)=>Wo(t,2,16,s),stringify:t=>Vl(t,16,"0x")};var Mr=class t extends jt{constructor(e){super(e),this.tag=t.tag}add(e){let s;Xe(e)?s=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?s=new Et(e.key,null):s=new Et(e,null),Is(this.items,s.key)||this.items.push(s)}get(e,s){let r=Is(this.items,e);return!s&&Xe(r)?Ge(r.key)?r.key.value:r.key:r}set(e,s){if(typeof s!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof s}`);let r=Is(this.items,e);r&&!s?this.items.splice(this.items.indexOf(r),1):!r&&s&&this.items.push(new Et(e))}toJSON(e,s){return super.toJSON(e,s,Set)}toString(e,s,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),s,r);throw new Error("Set items must all have null values")}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s))for(let n of s)typeof i=="function"&&(n=i.call(s,n,n)),o.items.push(Sr(n,null,r));return o}};Mr.tag="tag:yaml.org,2002:set";var Si={collection:"map",identify:t=>t instanceof Set,nodeClass:Mr,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,s)=>Mr.from(t,e,s),resolve(t,e){if(pn(t)){if(t.hasAllNullValues(!0))return Object.assign(new Mr,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Kl(t,e){let s=t[0],r=s==="-"||s==="+"?t.substring(1):t,i=n=>e?BigInt(n):Number(n),o=r.replace(/_/g,"").split(":").reduce((n,a)=>n*i(60)+i(a),i(0));return s==="-"?i(-1)*o:o}function ld(t){let{value:e}=t,s=n=>n;if(typeof e=="bigint")s=n=>BigInt(n);else if(isNaN(e)||!isFinite(e))return en(t);let r="";e<0&&(r="-",e*=s(-1));let i=s(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(n=>String(n).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Jo={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:s})=>Kl(t,s),stringify:ld},Xo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Kl(t,!1),stringify:ld},Pr={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Pr.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,r,i,o,n,a]=e.map(Number),f=e[7]?Number((e[7]+"00").substr(1,3)):0,p=Date.UTC(s,r-1,i,o||0,n||0,a||0,f),c=e[8];if(c&&c!=="Z"){let l=Kl(c,!1);Math.abs(l)<30&&(l*=60),p-=6e4*l}return new Date(p)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var Gl=[Kn,Gn,zs,Js,Bl,ql,rd,id,od,ad,td,nd,sd,wi,Vn,ki,xi,Si,Jo,Xo,Pr];var cd=new Map([["core",Jp],["failsafe",[Kn,Gn,zs]],["json",Qp],["yaml11",Gl],["yaml-1.1",Gl]]),pd={binary:wi,bool:bi,float:Ko,floatExp:Vo,floatNaN:qo,floatTime:Xo,int:Uo,intHex:Ho,intOct:Zo,intTime:Jo,map:Kn,merge:Vn,null:Js,omap:ki,pairs:xi,seq:Gn,set:Si,timestamp:Pr},dd={"tag:yaml.org,2002:binary":wi,"tag:yaml.org,2002:merge":Vn,"tag:yaml.org,2002:omap":ki,"tag:yaml.org,2002:pairs":xi,"tag:yaml.org,2002:set":Si,"tag:yaml.org,2002:timestamp":Pr};function Qo(t,e,s){let r=cd.get(e);if(r&&!t)return s&&!r.includes(Vn)?r.concat(Vn):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(cd.keys()).filter(n=>n!=="yaml11").map(n=>JSON.stringify(n)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return s&&(i=i.concat(Vn)),i.reduce((o,n)=>{let a=typeof n=="string"?pd[n]:n;if(!a){let f=JSON.stringify(n),p=Object.keys(pd).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${f}; use one of ${p}`)}return o.includes(a)||o.push(a),o},[])}var cu=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,vi=class t{constructor({compat:e,customTags:s,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:n,toStringDefaults:a}){this.compat=Array.isArray(e)?Qo(e,"compat"):e?Qo(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?dd:{},this.tags=Qo(s,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Bn,{value:Kn}),Object.defineProperty(this,bn,{value:zs}),Object.defineProperty(this,gs,{value:Gn}),this.sortMapEntries=typeof n=="function"?n:n===!0?cu:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function fd(t,e){let s=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let f=t.directives.toString(t);f?(s.push(f),r=!0):t.directives.docStart&&(r=!0)}r&&s.push("---");let i=Co(t,e),{commentString:o}=i.options;if(t.commentBefore){s.length!==1&&s.unshift("");let f=o(t.commentBefore);s.unshift(An(f,""))}let n=!1,a=null;if(t.contents){if(nt(t.contents)){if(t.contents.spaceBefore&&r&&s.push(""),t.contents.commentBefore){let c=o(t.contents.commentBefore);s.push(An(c,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let f=a?void 0:()=>n=!0,p=xs(t.contents,i,()=>a=null,f);a&&(p+=as(p,"",o(a))),(p[0]==="|"||p[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${p}`:s.push(p)}else s.push(xs(t.contents,i));if(t.directives?.docEnd)if(t.comment){let f=o(t.comment);f.includes(`
|
|
55
|
+
`)?(s.push("..."),s.push(An(f,""))):s.push(`... ${f}`)}else s.push("...");else{let f=t.comment;f&&n&&(f=f.replace(/^\n+/,"")),f&&((!n||a)&&s[s.length-1]!==""&&s.push(""),s.push(An(o(f),"")))}return s.join(`
|
|
56
56
|
`)+`
|
|
57
|
-
`}var
|
|
58
|
-
`),n=a+n}if(/[^ ]/.test(n)){let a=1,
|
|
57
|
+
`}var Cs=class t{constructor(e,s,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,on,{value:Mo});let i=null;typeof s=="function"||Array.isArray(s)?i=s:r===void 0&&s&&(r=s,s=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:n}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(n=this.directives.yaml.version)):this.directives=new os({version:n}),this.setSchema(n,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[on]:{value:Mo}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=nt(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Or(this.contents)&&this.contents.add(e)}addIn(e,s){Or(this.contents)&&this.contents.addIn(e,s)}createAlias(e,s){if(!e.anchor){let r=Nl(this);e.anchor=!s||r.has(s)?Rl(s||"a",r):s}return new bs(e.anchor)}createNode(e,s,r){let i;if(typeof s=="function")e=s.call({"":e},"",e),i=s;else if(Array.isArray(s)){let g=u=>typeof u=="number"||u instanceof String||u instanceof Number,k=s.filter(g).map(String);k.length>0&&(s=s.concat(k)),i=s}else r===void 0&&s&&(r=s,s=void 0);let{aliasDuplicateObjects:o,anchorPrefix:n,flow:a,keepUndefined:f,onTagObj:p,tag:c}=r??{},{onAnchor:l,setAnchors:d,sourceObjects:m}=Kp(this,n||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:f??!1,onAnchor:l,onTagObj:p,replacer:i,schema:this.schema,sourceObjects:m},y=ws(e,c,h);return a&&ct(y)&&(y.flow=!0),d(),y}createPair(e,s,r={}){let i=this.createNode(e,null,r),o=this.createNode(s,null,r);return new Et(i,o)}delete(e){return Or(this.contents)?this.contents.delete(e):!1}deleteIn(e){return kr(e)?this.contents==null?!1:(this.contents=null,!0):Or(this.contents)?this.contents.deleteIn(e):!1}get(e,s){return ct(this.contents)?this.contents.get(e,s):void 0}getIn(e,s){return kr(e)?!s&&Ge(this.contents)?this.contents.value:this.contents:ct(this.contents)?this.contents.getIn(e,s):void 0}has(e){return ct(this.contents)?this.contents.has(e):!1}hasIn(e){return kr(e)?this.contents!==void 0:ct(this.contents)?this.contents.hasIn(e):!1}set(e,s){this.contents==null?this.contents=ui(this.schema,[e],s):Or(this.contents)&&this.contents.set(e,s)}setIn(e,s){kr(e)?this.contents=s:this.contents==null?this.contents=ui(this.schema,Array.from(e),s):Or(this.contents)&&this.contents.setIn(e,s)}setSchema(e,s={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new os({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new os({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(s.schema instanceof Object)this.schema=s.schema;else if(r)this.schema=new vi(Object.assign(r,s));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:s,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:n}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},f=qt(this.contents,s??"",a);if(typeof o=="function")for(let{count:p,res:c}of a.anchors.values())o(c,p);return typeof n=="function"?Ns(n,{"":f},"",f):f}toJSON(e,s){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:s})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let s=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${s}`)}return fd(this,e)}};function Or(t){if(ct(t))return!0;throw new Error("Expected a YAML collection as document contents")}var Mi=class extends Error{constructor(e,s,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=s}},Zn=class extends Mi{constructor(e,s,r){super("YAMLParseError",e,s,r)}},Pi=class extends Mi{constructor(e,s,r){super("YAMLWarning",e,s,r)}},Zl=(t,e)=>s=>{if(s.pos[0]===-1)return;s.linePos=s.pos.map(a=>e.linePos(a));let{line:r,col:i}=s.linePos[0];s.message+=` at line ${r}, column ${i}`;let o=i-1,n=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&n.length>80){let a=Math.min(o-39,n.length-79);n="\u2026"+n.substring(a),o-=a-1}if(n.length>80&&(n=n.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(n.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
58
|
+
`),n=a+n}if(/[^ ]/.test(n)){let a=1,f=s.linePos[1];f?.line===r&&f.col>i&&(a=Math.max(1,Math.min(f.col-i,80-o)));let p=" ".repeat(o)+"^".repeat(a);s.message+=`:
|
|
59
59
|
|
|
60
60
|
${n}
|
|
61
61
|
${p}
|
|
62
|
-
`}};function
|
|
63
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let s of e.start)if(s.type==="newline")return!0;if(e.sep){for(let s of e.sep)if(s.type==="newline")return!0}if(
|
|
64
|
-
`+y.comment:a.comment=y.comment);continue}(y.newlineAfterProp||
|
|
65
|
-
`+b.comment:
|
|
66
|
-
`+$.comment:p.comment=$.comment),l=$.end;continue}!n&&s.options.strict&&
|
|
67
|
-
`+v:
|
|
68
|
-
`+
|
|
69
|
-
`+g.comment:p.comment=g.comment),p.range=[r.offset,y,g.offset]}else p.range=[r.offset,y,y];return p}function
|
|
70
|
-
`.repeat(Math.max(1,n.length-1)):"",g=r+i.length;return e.source&&(g+=e.source.length),{value:y,type:o,comment:i.comment,range:[r,g,g]}}let
|
|
71
|
-
`;for(let y=c;y<a;++y){let[g,
|
|
72
|
-
`):g.length>
|
|
73
|
-
`:!d
|
|
74
|
-
`&&(
|
|
62
|
+
`}};function ls(t,{flow:e,indicator:s,next:r,offset:i,onError:o,parentIndent:n,startOnNewline:a}){let f=!1,p=a,c=a,l="",d="",m=!1,h=!1,y=null,g=null,k=null,u=null,b=null,x=null,w=null;for(let O of t)switch(h&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&o(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),y&&(p&&O.type!=="comment"&&O.type!=="newline"&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),O.type){case"space":!e&&(s!=="doc-start"||r?.type!=="flow-collection")&&O.source.includes(" ")&&(y=O),c=!0;break;case"comment":{c||o(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=O.source.substring(1)||" ";l?l+=d+C:l=C,d="",p=!1;break}case"newline":p?l?l+=O.source:(!x||s!=="seq-item-ind")&&(f=!0):d+=O.source,p=!0,m=!0,(g||k)&&(u=O),c=!0;break;case"anchor":g&&o(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&o(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=O,w??(w=O.offset),p=!1,c=!1,h=!0;break;case"tag":{k&&o(O,"MULTIPLE_TAGS","A node can have at most one tag"),k=O,w??(w=O.offset),p=!1,c=!1,h=!0;break}case s:(g||k)&&o(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),x&&o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${e??"collection"}`),x=O,p=s==="seq-item-ind"||s==="explicit-key-ind",c=!1;break;case"comma":if(e){b&&o(O,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=O,p=!1,c=!1;break}default:o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),p=!1,c=!1}let $=t[t.length-1],v=$?$.offset+$.source.length:i;return h&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(p&&y.indent<=n||r?.type==="block-map"||r?.type==="block-seq")&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:x,spaceBefore:f,comment:l,hasNewline:m,anchor:g,tag:k,newlineAfterProp:u,end:v,start:w??v}}function js(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
63
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let s of e.start)if(s.type==="newline")return!0;if(e.sep){for(let s of e.sep)if(s.type==="newline")return!0}if(js(e.key)||js(e.value))return!0}return!1;default:return!0}}function Oi(t,e,s){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&js(e)&&s(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function ea(t,e,s){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,n)=>o===n||Ge(o)&&Ge(n)&&o.value===n.value;return e.some(o=>i(o.key,s))}var md="All mapping items must start at the same column";function ud({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??jt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1);let f=r.offset,p=null;for(let c of r.items){let{start:l,key:d,sep:m,value:h}=c,y=ls(l,{indicator:"explicit-key-ind",next:d??m?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!y.found;if(g){if(d&&(d.type==="block-seq"?i(f,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(f,"BAD_INDENT",md)),!y.anchor&&!y.tag&&!m){p=y.end,y.comment&&(a.comment?a.comment+=`
|
|
64
|
+
`+y.comment:a.comment=y.comment);continue}(y.newlineAfterProp||js(d))&&i(d??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else y.found?.indent!==r.indent&&i(f,"BAD_INDENT",md);s.atKey=!0;let k=y.end,u=d?t(s,d,y,i):e(s,k,l,null,y,i);s.schema.compat&&Oi(r.indent,d,i),s.atKey=!1,ea(s,a.items,u)&&i(k,"DUPLICATE_KEY","Map keys must be unique");let b=ls(m??[],{indicator:"map-value-ind",next:h,offset:u.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(f=b.end,b.found){g&&(h?.type==="block-map"&&!b.hasNewline&&i(f,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&y.start<b.found.offset-1024&&i(u.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=h?t(s,h,b,i):e(s,f,m,null,b,i);s.schema.compat&&Oi(r.indent,h,i),f=x.range[2];let w=new Et(u,x);s.options.keepSourceTokens&&(w.srcToken=c),a.items.push(w)}else{g&&i(u.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(u.comment?u.comment+=`
|
|
65
|
+
`+b.comment:u.comment=b.comment);let x=new Et(u);s.options.keepSourceTokens&&(x.srcToken=c),a.items.push(x)}}return p&&p<f&&i(p,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,f,p??f],a}function hd({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??Qt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let f=r.offset,p=null;for(let{start:c,value:l}of r.items){let d=ls(c,{indicator:"seq-item-ind",next:l,offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||l)l?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(f,"MISSING_CHAR","Sequence item without - indicator");else{p=d.end,d.comment&&(a.comment=d.comment);continue}let m=l?t(s,l,d,i):e(s,d.end,c,null,d,i);s.schema.compat&&Oi(r.indent,l,i),f=m.range[2],a.items.push(m)}return a.range=[r.offset,f,p??f],a}function cs(t,e,s,r){let i="";if(t){let o=!1,n="";for(let a of t){let{source:f,type:p}=a;switch(p){case"space":o=!0;break;case"comment":{s&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=f.substring(1)||" ";i?i+=n+c:i=c,n="";break}case"newline":i&&(n+=f),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${p} at node end`)}e+=f.length}}return{comment:i,offset:e}}var Ul="Block collections are not allowed within flow collections",Hl=t=>t&&(t.type==="block-map"||t.type==="block-seq");function yd({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=r.start.source==="{",a=n?"flow map":"flow sequence",f=o?.nodeClass??(n?jt:Qt),p=new f(s.schema);p.flow=!0;let c=s.atRoot;c&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let l=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let k=r.items[g],{start:u,key:b,sep:x,value:w}=k,$=ls(u,{flow:a,indicator:"explicit-key-ind",next:b??x?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!$.found){if(!$.anchor&&!$.tag&&!x&&!w){g===0&&$.comma?i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<r.items.length-1&&i($.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),$.comment&&(p.comment?p.comment+=`
|
|
66
|
+
`+$.comment:p.comment=$.comment),l=$.end;continue}!n&&s.options.strict&&js(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)$.comma&&i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if($.comma||i($.start,"MISSING_CHAR",`Missing , between ${a} items`),$.comment){let v="";e:for(let O of u)switch(O.type){case"comma":case"space":break;case"comment":v=O.source.substring(1);break e;default:break e}if(v){let O=p.items[p.items.length-1];Xe(O)&&(O=O.value??O.key),O.comment?O.comment+=`
|
|
67
|
+
`+v:O.comment=v,$.comment=$.comment.substring(v.length+1)}}if(!n&&!x&&!$.found){let v=w?t(s,w,$,i):e(s,$.end,x,null,$,i);p.items.push(v),l=v.range[2],Hl(w)&&i(v.range,"BLOCK_IN_FLOW",Ul)}else{s.atKey=!0;let v=$.end,O=b?t(s,b,$,i):e(s,v,u,null,$,i);Hl(b)&&i(O.range,"BLOCK_IN_FLOW",Ul),s.atKey=!1;let C=ls(x??[],{flow:a,indicator:"map-value-ind",next:w,offset:O.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!n&&!$.found&&s.options.strict){if(x)for(let M of x){if(M===C.found)break;if(M.type==="newline"){i(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}$.start<C.found.offset-1024&&i(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?i(w,"MISSING_CHAR",`Missing space after : in ${a}`):i(C.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let A=w?t(s,w,C,i):C.found?e(s,C.end,x,null,C,i):null;A?Hl(w)&&i(A.range,"BLOCK_IN_FLOW",Ul):C.comment&&(O.comment?O.comment+=`
|
|
68
|
+
`+C.comment:O.comment=C.comment);let R=new Et(O,A);if(s.options.keepSourceTokens&&(R.srcToken=k),n){let M=p;ea(s,M.items,O)&&i(v,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(R)}else{let M=new jt(s.schema);M.flow=!0,M.items.push(R);let T=(A??O).range;M.range=[O.range[0],T[1],T[2]],p.items.push(M)}l=A?A.range[2]:C.end}}let d=n?"}":"]",[m,...h]=r.end,y=l;if(m?.source===d)y=m.offset+m.source.length;else{let g=a[0].toUpperCase()+a.substring(1),k=c?`${g} must end with a ${d}`:`${g} in block collection must be sufficiently indented and end with a ${d}`;i(l,c?"MISSING_CHAR":"BAD_INDENT",k),m&&m.source.length!==1&&h.unshift(m)}if(h.length>0){let g=cs(h,y,s.options.strict,i);g.comment&&(p.comment?p.comment+=`
|
|
69
|
+
`+g.comment:p.comment=g.comment),p.range=[r.offset,y,g.offset]}else p.range=[r.offset,y,y];return p}function Yl(t,e,s,r,i,o){let n=s.type==="block-map"?ud(t,e,s,r,o):s.type==="block-seq"?hd(t,e,s,r,o):yd(t,e,s,r,o),a=n.constructor;return i==="!"||i===a.tagName?(n.tag=a.tagName,n):(i&&(n.tag=i),n)}function gd(t,e,s,r,i){let o=r.tag,n=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(s.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=r,h=d&&o?d.offset>o.offset?d:o:d??o;h&&(!m||m.offset<h.offset)&&i(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=s.type==="block-map"?"map":s.type==="block-seq"?"seq":s.start.source==="{"?"map":"seq";if(!o||!n||n==="!"||n===jt.tagName&&a==="map"||n===Qt.tagName&&a==="seq")return Yl(t,e,s,i,n);let f=e.schema.tags.find(d=>d.tag===n&&d.collection===a);if(!f){let d=e.schema.knownTags[n];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),f=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,!0),Yl(t,e,s,i,n)}let p=Yl(t,e,s,i,n,f),c=f.resolve?.(p,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??p,l=nt(c)?c:new Re(c);return l.range=p.range,l.tag=n,f?.format&&(l.format=f.format),l}function Wl(t,e,s){let r=e.offset,i=pu(e,t.options.strict,s);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Re.BLOCK_FOLDED:Re.BLOCK_LITERAL,n=e.source?du(e.source):[],a=n.length;for(let y=n.length-1;y>=0;--y){let g=n[y][1];if(g===""||g==="\r")a=y;else break}if(a===0){let y=i.chomp==="+"&&n.length>0?`
|
|
70
|
+
`.repeat(Math.max(1,n.length-1)):"",g=r+i.length;return e.source&&(g+=e.source.length),{value:y,type:o,comment:i.comment,range:[r,g,g]}}let f=e.indent+i.indent,p=e.offset+i.length,c=0;for(let y=0;y<a;++y){let[g,k]=n[y];if(k===""||k==="\r")i.indent===0&&g.length>f&&(f=g.length);else{g.length<f&&s(p+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(f=g.length),c=y,f===0&&!t.atRoot&&s(p,"BAD_INDENT","Block scalar values in collections must be indented");break}p+=g.length+k.length+1}for(let y=n.length-1;y>=a;--y)n[y][0].length>f&&(a=y+1);let l="",d="",m=!1;for(let y=0;y<c;++y)l+=n[y][0].slice(f)+`
|
|
71
|
+
`;for(let y=c;y<a;++y){let[g,k]=n[y];p+=g.length+k.length+1;let u=k[k.length-1]==="\r";if(u&&(k=k.slice(0,-1)),k&&g.length<f){let x=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;s(p-k.length-(u?2:1),"BAD_INDENT",x),g=""}o===Re.BLOCK_LITERAL?(l+=d+g.slice(f)+k,d=`
|
|
72
|
+
`):g.length>f||k[0]===" "?(d===" "?d=`
|
|
73
|
+
`:!m&&d===`
|
|
74
|
+
`&&(d=`
|
|
75
75
|
|
|
76
|
-
`),l+=
|
|
77
|
-
`,
|
|
76
|
+
`),l+=d+g.slice(f)+k,d=`
|
|
77
|
+
`,m=!0):k===""?d===`
|
|
78
78
|
`?l+=`
|
|
79
|
-
`:
|
|
80
|
-
`:(l+=
|
|
81
|
-
`+n[y][0].slice(
|
|
79
|
+
`:d=`
|
|
80
|
+
`:(l+=d+k,d=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let y=a;y<n.length;++y)l+=`
|
|
81
|
+
`+n[y][0].slice(f);l[l.length-1]!==`
|
|
82
82
|
`&&(l+=`
|
|
83
83
|
`);break;default:l+=`
|
|
84
|
-
`}let
|
|
84
|
+
`}let h=r+i.length+e.source.length;return{value:l,type:o,comment:i.comment,range:[r,h,h]}}function pu({offset:t,props:e},s,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],n=0,a="",f=-1;for(let d=1;d<i.length;++d){let m=i[d];if(!a&&(m==="-"||m==="+"))a=m;else{let h=Number(m);!n&&h?n=h:f===-1&&(f=t+d)}}f!==-1&&r(f,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let p=!1,c="",l=i.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":p=!0;case"newline":l+=m.source.length;break;case"comment":s&&!p&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),l+=m.source.length,c=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),l+=m.source.length;break;default:{let h=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",h);let y=m.source;y&&typeof y=="string"&&(l+=y.length)}}}return{mode:o,indent:n,chomp:a,comment:c,length:l}}function du(t){let e=t.split(/\n( *)/),s=e[0],r=s.match(/^( *)/),o=[r?.[1]?[r[1],s.slice(r[1].length)]:["",s]];for(let n=1;n<e.length;n+=2)o.push([e[n],e[n+1]]);return o}function Jl(t,e,s){let{offset:r,type:i,source:o,end:n}=t,a,f,p=(d,m,h)=>s(r+d,m,h);switch(i){case"scalar":a=Re.PLAIN,f=fu(o,p);break;case"single-quoted-scalar":a=Re.QUOTE_SINGLE,f=mu(o,p);break;case"double-quoted-scalar":a=Re.QUOTE_DOUBLE,f=uu(o,p);break;default:return s(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let c=r+o.length,l=cs(n,c,e,s);return{value:f,type:a,comment:l.comment,range:[r,c,l.offset]}}function fu(t,e){let s="";switch(t[0]){case" ":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":{s=`block scalar indicator ${t[0]}`;break}case"@":case"`":{s=`reserved character ${t[0]}`;break}}return s&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`),bd(t)}function mu(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),bd(t.slice(1,-1)).replace(/''/g,"'")}function bd(t){let e=/(.*?)\r?\n/sy,s=e.exec(t);if(!s)return t;let r,i;try{r=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=s[1].replace(r,""),n=" ",a=e.lastIndex;for(;s=e.exec(t);){let p=s[1].replace(i,"");p===""?n===`
|
|
85
85
|
`?o+=n:n=`
|
|
86
|
-
`:(o+=n+p,n=" "),a=e.lastIndex}let
|
|
86
|
+
`:(o+=n+p,n=" "),a=e.lastIndex}let f=/[ \t]*(.*)/sy;return f.lastIndex=a,s=f.exec(t),o+n+(s?.[1]??"")}function uu(t,e){let s="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
|
|
87
87
|
`))if(i===`
|
|
88
|
-
`){let{fold:o,offset:n}=
|
|
88
|
+
`){let{fold:o,offset:n}=hu(t,r);s+=o,r=n}else if(i==="\\"){let o=t[++r],n=yu[o];if(n)s+=n;else if(o===`
|
|
89
89
|
`)for(o=t[r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="\r"&&t[r+1]===`
|
|
90
|
-
`)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;s+=
|
|
90
|
+
`)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;s+=gu(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),s+=a}}else if(i===" "||i===" "){let o=r,n=t[r+1];for(;n===" "||n===" ";)n=t[++r+1];n!==`
|
|
91
91
|
`&&!(n==="\r"&&t[r+2]===`
|
|
92
|
-
`)&&(s+=r>o?t.slice(o,r+1):i)}else s+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),s}function
|
|
92
|
+
`)&&(s+=r>o?t.slice(o,r+1):i)}else s+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),s}function hu(t,e){let s="",r=t[e+1];for(;(r===" "||r===" "||r===`
|
|
93
93
|
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
|
94
94
|
`);)r===`
|
|
95
95
|
`&&(s+=`
|
|
96
|
-
`),e+=1,r=t[e+1];return s||(s=" "),{fold:s,offset:e}}var
|
|
97
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
96
|
+
`),e+=1,r=t[e+1];return s||(s=" "),{fold:s,offset:e}}var yu={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
97
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function gu(t,e,s,r){let i=t.substr(e,s),n=i.length===s&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(n)}catch{let a=t.substr(e-2,s+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Xl(t,e,s,r){let{value:i,type:o,comment:n,range:a}=e.type==="block-scalar"?Wl(t,e,r):Jl(e,t.options.strict,r),f=s?t.directives.tagName(s.source,l=>r(s,"TAG_RESOLVE_FAILED",l)):null,p;t.options.stringKeys&&t.atKey?p=t.schema[bn]:f?p=bu(t.schema,i,f,s,r):e.type==="scalar"?p=wu(t,i,e,r):p=t.schema[bn];let c;try{let l=p.resolve(i,d=>r(s??e,"TAG_RESOLVE_FAILED",d),t.options);c=Ge(l)?l:new Re(l)}catch(l){let d=l instanceof Error?l.message:String(l);r(s??e,"TAG_RESOLVE_FAILED",d),c=new Re(i)}return c.range=a,c.source=i,o&&(c.type=o),f&&(c.tag=f),p.format&&(c.format=p.format),n&&(c.comment=n),c}function bu(t,e,s,r,i){if(s==="!")return t[bn];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===s)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let n=t.knownTags[s];return n&&!n.collection?(t.tags.push(Object.assign({},n,{default:!1,test:void 0})),n):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,s!=="tag:yaml.org,2002:str"),t[bn])}function wu({atKey:t,directives:e,schema:s},r,i,o){let n=s.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||s[bn];if(s.compat){let a=s.compat.find(f=>f.default&&f.test?.test(r))??s[bn];if(n.tag!==a.tag){let f=e.tagString(n.tag),p=e.tagString(a.tag),c=`Value may be parsed as either ${f} or ${p}`;o(i,"TAG_RESOLVE_FAILED",c,!0)}}return n}function wd(t,e,s){if(e){s??(s=e.length);for(let r=s-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}var xu={composeNode:Ql,composeEmptyNode:ta};function Ql(t,e,s,r){let i=t.atKey,{spaceBefore:o,comment:n,anchor:a,tag:f}=s,p,c=!0;switch(e.type){case"alias":p=ku(t,e,r),(a||f)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":p=Xl(t,e,f,r),a&&(p.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{p=gd(xu,t,e,s,r),a&&(p.anchor=a.source.substring(1))}catch(l){let d=l instanceof Error?l.message:String(l);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let l=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",l),c=!1}}return p??(p=ta(t,e.offset,void 0,null,s,r)),a&&p.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Ge(p)||typeof p.value!="string"||p.tag&&p.tag!=="tag:yaml.org,2002:str")&&r(f??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(p.spaceBefore=!0),n&&(e.type==="scalar"&&e.source===""?p.comment=n:p.commentBefore=n),t.options.keepSourceTokens&&c&&(p.srcToken=e),p}function ta(t,e,s,r,{spaceBefore:i,comment:o,anchor:n,tag:a,end:f},p){let c={type:"scalar",offset:wd(e,s,r),indent:-1,source:""},l=Xl(t,c,a,p);return n&&(l.anchor=n.source.substring(1),l.anchor===""&&p(n,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(l.spaceBefore=!0),o&&(l.comment=o,l.range[2]=f),l}function ku({options:t},{offset:e,source:s,end:r},i){let o=new bs(s.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let n=e+s.length,a=cs(r,n,t.strict,i);return o.range=[e,n,a.offset],a.comment&&(o.comment=a.comment),o}function xd(t,e,{offset:s,start:r,value:i,end:o},n){let a=Object.assign({_directives:e},t),f=new Cs(void 0,a),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},c=ls(r,{indicator:"doc-start",next:i??o?.[0],offset:s,onError:n,parentIndent:0,startOnNewline:!0});c.found&&(f.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!c.hasNewline&&n(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=i?Ql(p,i,c,n):ta(p,c.end,r,null,c,n);let l=f.contents.range[2],d=cs(o,l,!1,n);return d.comment&&(f.comment=d.comment),f.range=[s,l,d.offset],f}function Ai(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:s}=t;return[e,e+(typeof s=="string"?s.length:1)]}function kd(t){let e="",s=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
|
|
98
98
|
|
|
99
99
|
`:`
|
|
100
|
-
`)+(o.substring(1)||" "),s=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),s=!1;break;default:s||(r=!0),s=!1}}return{comment:e,afterEmptyLine:r}}var
|
|
101
|
-
${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(ct(o)&&!o.flow&&o.items.length>0){let n=o.items[0];
|
|
100
|
+
`)+(o.substring(1)||" "),s=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),s=!1;break;default:s||(r=!0),s=!1}}return{comment:e,afterEmptyLine:r}}var Ti=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,r,i,o)=>{let n=Ai(s);o?this.warnings.push(new Pi(n,r,i)):this.errors.push(new Zn(n,r,i))},this.directives=new os({version:e.version||"1.2"}),this.options=e}decorate(e,s){let{comment:r,afterEmptyLine:i}=kd(this.prelude);if(r){let o=e.contents;if(s)e.comment=e.comment?`${e.comment}
|
|
101
|
+
${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(ct(o)&&!o.flow&&o.items.length>0){let n=o.items[0];Xe(n)&&(n=n.key);let a=n.commentBefore;n.commentBefore=a?`${r}
|
|
102
102
|
${a}`:r}else{let n=o.commentBefore;o.commentBefore=n?`${r}
|
|
103
|
-
${n}`:r}}if(s){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
104
|
-
${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new
|
|
103
|
+
${n}`:r}}if(s){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:kd(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,s=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(s,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(s,r,i)=>{let o=Ai(e);o[0]+=s,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let s=xd(this.options,this.directives,e,this.onError);this.atDirectives&&!s.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(s,!1),this.doc&&(yield this.doc),this.doc=s,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let s=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Zn(Ai(e),"UNEXPECTED_TOKEN",s);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Zn(Ai(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let s=cs(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),s.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
104
|
+
${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new Zn(Ai(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,s=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Cs(void 0,r);this.atDirectives&&this.onError(s,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,s,s],this.decorate(i,!1),yield i}}};var ec=Symbol("break visit"),$u=Symbol("skip children"),$d=Symbol("remove item");function Xs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Sd(Object.freeze([]),t,e)}Xs.BREAK=ec;Xs.SKIP=$u;Xs.REMOVE=$d;Xs.itemAtPath=(t,e)=>{let s=t;for(let[r,i]of e){let o=s?.[r];if(o&&"items"in o)s=o.items[i];else return}return s};Xs.parentCollection=(t,e)=>{let s=Xs.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=s?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Sd(t,e,s){let r=s(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let n=0;n<o.items.length;++n){let a=Sd(Object.freeze(t.concat([[i,n]])),o.items[n],s);if(typeof a=="number")n=a-1;else{if(a===ec)return ec;a===$d&&(o.items.splice(n,1),n-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}var tc="\uFEFF",nc="",sc="",na="";function vd(t){switch(t){case tc:return"byte-order-mark";case nc:return"doc-mode";case sc:return"flow-error-end";case na:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
105
105
|
`:case`\r
|
|
106
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function
|
|
107
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
108
|
-
\r `),
|
|
106
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Un(t){switch(t){case void 0:case" ":case`
|
|
107
|
+
`:case"\r":case" ":return!0;default:return!1}}var Md=new Set("0123456789ABCDEFabcdef"),vu=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),sa=new Set(",[]{}"),Mu=new Set(` ,[]{}
|
|
108
|
+
\r `),rc=t=>!t||Mu.has(t),Ei=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,s=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!s;let r=this.next??"stream";for(;r&&(s||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,s=this.buffer[e];for(;s===" "||s===" ";)s=this.buffer[++e];return!s||s==="#"||s===`
|
|
109
109
|
`?!0:s==="\r"?this.buffer[e+1]===`
|
|
110
110
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let s=this.buffer[e];if(this.indentNext>0){let r=0;for(;s===" ";)s=this.buffer[++r+e];if(s==="\r"){let i=this.buffer[r+e+1];if(i===`
|
|
111
111
|
`||!i&&!this.atEnd)return e+r+1}return s===`
|
|
112
|
-
`||r>=this.indentNext||!s&&!this.atEnd?e+r:-1}if(s==="-"||s==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&
|
|
113
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
112
|
+
`||r>=this.indentNext||!s&&!this.atEnd?e+r:-1}if(s==="-"||s==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Un(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
113
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===tc&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let s=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){s=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[s-1];if(o===" "||o===" ")s-=1;else break}let i=(yield*this.pushCount(s))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let s=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-s),yield*this.pushNewline(),"stream"}return yield nc,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let s=this.peek(3);if((s==="---"||s==="...")&&Un(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,s==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Un(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,s]=this.peek(2);if(!s&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Un(s)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let s=yield*this.pushIndicators();switch(e[s]){case"#":yield*this.pushCount(e.length-s);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(rc),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return s+=yield*this.parseBlockScalarHeader(),s+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-s),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,s,r=-1;do e=yield*this.pushNewline(),e>0?(s=yield*this.pushSpaces(!1),this.indentValue=r=s):s=0,s+=yield*this.pushSpaces(!0);while(e+s>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&Un(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield sc,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(rc),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let n=this.charAt(1);if(this.flowKey||Un(n)||n===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),s=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;s!==-1&&this.buffer[s+1]==="'";)s=this.buffer.indexOf("'",s+2);else for(;s!==-1;){let o=0;for(;this.buffer[s-1-o]==="\\";)o+=1;if(o%2===0)break;s=this.buffer.indexOf('"',s+1)}let r=this.buffer.substring(0,s),i=r.indexOf(`
|
|
114
114
|
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
|
|
115
|
-
`,o)}i!==-1&&(s=i-(r[i-1]==="\r"?2:1))}if(s===-1){if(!this.atEnd)return this.setNext("quoted-scalar");s=this.buffer.length}return yield*this.pushToIndex(s+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let s=this.buffer[++e];if(s==="+")this.blockScalarKeep=!0;else if(s>"0"&&s<="9")this.blockScalarIndent=Number(s)-1;else if(s!=="-")break}return yield*this.pushUntil(s=>
|
|
115
|
+
`,o)}i!==-1&&(s=i-(r[i-1]==="\r"?2:1))}if(s===-1){if(!this.atEnd)return this.setNext("quoted-scalar");s=this.buffer.length}return yield*this.pushToIndex(s+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let s=this.buffer[++e];if(s==="+")this.blockScalarKeep=!0;else if(s>"0"&&s<="9")this.blockScalarIndent=Number(s)-1;else if(s!=="-")break}return yield*this.pushUntil(s=>Un(s)||s==="#")}*parseBlockScalar(){let e=this.pos-1,s=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":s+=1;break;case`
|
|
116
116
|
`:e=o,s=0;break;case"\r":{let n=this.buffer[o+1];if(!n&&!this.atEnd)return this.setNext("block-scalar");if(n===`
|
|
117
117
|
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(s>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=s:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
|
|
118
118
|
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
119
119
|
`;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,n=this.buffer[o];n==="\r"&&(n=this.buffer[--o]);let a=o;for(;n===" ";)n=this.buffer[--o];if(n===`
|
|
120
|
-
`&&o>=this.pos&&o+1+s>a)e=o;else break}while(!0);return yield
|
|
120
|
+
`&&o>=this.pos&&o+1+s>a)e=o;else break}while(!0);return yield na,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,s=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Un(o)||e&&sa.has(o))break;s=r}else if(Un(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
|
|
121
121
|
`?(r+=1,i=`
|
|
122
|
-
`,o=this.buffer[r+1]):s=r),o==="#"||e&&
|
|
123
|
-
`){let n=this.continueScalar(r+1);if(n===-1)break;r=Math.max(r,n-2)}}else{if(e&&
|
|
122
|
+
`,o=this.buffer[r+1]):s=r),o==="#"||e&&sa.has(o))break;if(i===`
|
|
123
|
+
`){let n=this.continueScalar(r+1);if(n===-1)break;r=Math.max(r,n-2)}}else{if(e&&sa.has(i))break;s=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield na,yield*this.pushToIndex(s+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,s){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(s&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(rc),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let s=this.flowLevel>0,r=this.charAt(1);if(Un(r)||s&&sa.has(r)){s?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,s=this.buffer[e];for(;!Un(s)&&s!==">";)s=this.buffer[++e];return yield*this.pushToIndex(s===">"?e+1:e,!1)}else{let e=this.pos+1,s=this.buffer[e];for(;s;)if(vu.has(s))s=this.buffer[++e];else if(s==="%"&&Md.has(this.buffer[e+1])&&Md.has(this.buffer[e+2]))s=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
124
124
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
125
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let s=this.pos-1,r;do r=this.buffer[++s];while(r===" "||e&&r===" ");let i=s-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=s),i}*pushUntil(e){let s=this.pos,r=this.buffer[s];for(;!e(r);)r=this.buffer[++s];return yield*this.pushToIndex(s,!1)}};var
|
|
125
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let s=this.pos-1,r;do r=this.buffer[++s];while(r===" "||e&&r===" ");let i=s-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=s),i}*pushUntil(e){let s=this.pos,r=this.buffer[s];for(;!e(r);)r=this.buffer[++s];return yield*this.pushToIndex(s,!1)}};var Qs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let s=0,r=this.lineStarts.length;for(;s<r;){let o=s+r>>1;this.lineStarts[o]<e?s=o+1:r=o}if(this.lineStarts[s]===e)return{line:s+1,col:1};if(s===0)return{line:0,col:e};let i=this.lineStarts[s-1];return{line:s,col:e-i+1}}}};function Ls(t,e){for(let s=0;s<t.length;++s)if(t[s].type===e)return!0;return!1}function Pd(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Ad(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ra(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Ar(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function ia(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let s=0;s<e.length;++s)t.push(e[s])}function Od(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ls(e.start,"explicit-key-ind")&&!Ls(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ad(e.value)?e.value.end?ia(e.value.end,e.sep):e.value.end=e.sep:ia(e.start,e.sep),delete e.sep)}var Ni=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ei,this.onNewLine=e}*parse(e,s=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,s))yield*this.next(r);s||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let s=vd(e);if(s)if(s==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=s,yield*this.step(),s){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let s=e??this.stack.pop();if(!s)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield s;else{let r=this.peek(1);switch(s.type==="block-scalar"?s.indent="indent"in r?r.indent:0:s.type==="flow-collection"&&r.type==="document"&&(s.indent=0),s.type==="flow-collection"&&Od(s),r.type){case"document":r.value=s;break;case"block-scalar":r.props.push(s);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:s,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=s;else{Object.assign(i,{key:s,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:s}):i.value=s;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:s,sep:[]}):i.sep?i.value=s:Object.assign(i,{key:s,sep:[]});return}default:yield*this.pop(),yield*this.pop(s)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(s.type==="block-map"||s.type==="block-seq")){let i=s.items[s.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Pd(i.start)===-1&&(s.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<s.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),s.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Pd(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let s=ra(this.peek(2)),r=Ar(s),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let s=this.source.indexOf(`
|
|
126
126
|
`)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
|
|
127
|
-
`,s)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else if(s.sep)s.sep.push(this.sourceToken);else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){
|
|
127
|
+
`,s)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else if(s.sep)s.sep.push(this.sourceToken);else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ia(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(s.sep||s.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&s.sep&&!s.value){let n=[];for(let a=0;a<s.sep.length;++a){let f=s.sep[a];switch(f.type){case"newline":n.push(a);break;case"space":break;case"comment":f.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(o=s.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":i||s.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"explicit-key-ind":!s.sep&&!s.explicitKey?(s.start.push(this.sourceToken),s.explicitKey=!0):i||s.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(s.explicitKey)if(s.sep)if(s.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ls(s.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Ad(s.key)&&!Ls(s.sep,"newline")){let n=Ar(s.start),a=s.key,f=s.sep;f.push(this.sourceToken),delete s.key,delete s.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:a,sep:f}]})}else o.length>0?s.sep=s.sep.concat(o,this.sourceToken):s.sep.push(this.sourceToken);else if(Ls(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let n=Ar(s.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]})}else s.sep?s.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ls(s.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);i||s.value?(e.items.push({start:o,key:n,sep:[]}),this.onKeyLine=!0):s.sep?this.stack.push(n):(Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let n=this.startBlockValue(e);if(n){if(n.type==="block-seq"){if(!s.explicitKey&&s.sep&&!Ls(s.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(n);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ia(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return;case"anchor":case"tag":if(s.value||this.indent<=e.indent)break;s.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;s.value||Ls(s.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let s=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!s||s.sep?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return;case"map-value-ind":!s||s.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!s||s.value?e.items.push({start:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!s||s.value?e.items.push({start:[],key:i,sep:[]}):s.sep?this.stack.push(i):Object.assign(s,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=ra(r),o=Ar(i);Od(e);let n=e.end.splice(1,e.end.length);n.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let s=this.source.indexOf(`
|
|
128
128
|
`)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
|
|
129
|
-
`,s)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let s=
|
|
129
|
+
`,s)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let s=ra(e),r=Ar(s);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let s=ra(e),r=Ar(s);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,s){return this.type!=="comment"||this.indent<=s?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Pu(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Qs||null,prettyErrors:e}}function oa(t,e={}){let{lineCounter:s,prettyErrors:r}=Pu(e),i=new Ni(s?.addNewLine),o=new Ti(e),n=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!n)n=a;else if(n.options.logLevel!=="silent"){n.errors.push(new Zn(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&s&&(n.errors.forEach(Zl(t,s)),n.warnings.forEach(Zl(t,s))),n}function ic(t,e,s){let r;typeof e=="function"?r=e:s===void 0&&e&&typeof e=="object"&&(s=e);let i=oa(t,s);if(!i)return null;if(i.warnings.forEach(o=>jo(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},s))}function Tr(t){let e=ic(t);for(let s of["light","dark","kinds","roles"])if(!e||typeof e[s]!="object")throw new Error(`theme: missing "${s}"`);return e}function _s(t,e={},s={}){let r={...t.kinds};for(let[i,o]of Object.entries(s)){let n=r[o.like??i]??r.control;r[i]={color:o.color??n.color,dash:o.dash??n.dash,legend:o.legend??n.legend}}return{...t,roles:{...t.roles,...e},kinds:r}}var Td=t=>Object.entries(t).map(([e,s])=>`--${e}:${s}`).join(";");function Hn(t,e){return e in t.light?`var(--${e})`:e}function aa(t){let{light:e,dark:s,rest:r}=Ri(t);return`:root{${e}}
|
|
130
130
|
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){${s}}}
|
|
131
131
|
:root[data-theme="dark"]{${s}}
|
|
132
|
-
${r}`}function
|
|
133
|
-
`;for(let[s,r]of Object.entries(t.kinds)){let i=
|
|
134
|
-
`}return{light:
|
|
135
|
-
`)),this.diags=e}};function
|
|
132
|
+
${r}`}function Ri(t){let e="";for(let[s,r]of Object.entries(t.roles))e+=`.k-${s}{--h:${r.h};--s:${r.s}%}`,r.top?e+=`.k-${s} .top{fill:${r.top}}`:r.tint&&(e+=`.k-${s} .top{fill:color-mix(in srgb,hsl(${r.h} ${Math.min(100,r.s+15)}% 50%) ${r.tint}%,var(--pad-top))}`),e+=`
|
|
133
|
+
`;for(let[s,r]of Object.entries(t.kinds)){let i=Hn(t,r.color),o=r.dash==="dashed"?";stroke-dasharray:7 6;stroke-width:2.4":r.dash==="dotted"?";stroke-dasharray:3 6;stroke-width:2.4":"";e+=`.f-${s}{stroke:${i}${o}} .t-${s}{fill:${i}} .c-${s}{--c:${i}}
|
|
134
|
+
`}return{light:Td(t.light),dark:Td(t.dark),rest:e}}var la=class extends Error{diags;constructor(e){super(e.map(s=>`${s.line}:${s.col} ${s.message}`).join(`
|
|
135
|
+
`)),this.diags=e}};function oc(t,e){let s=t.length,r=e.length;if(!s)return r;if(!r)return s;let i=Array.from({length:s+1},(o,n)=>[n,...Array(r).fill(0)]);for(let o=0;o<=r;o++)i[0][o]=o;for(let o=1;o<=s;o++)for(let n=1;n<=r;n++){let a=t[o-1]===e[n-1]?0:1;i[o][n]=Math.min(i[o-1][n]+1,i[o][n-1]+1,i[o-1][n-1]+a),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(i[o][n]=Math.min(i[o][n],i[o-2][n-2]+1))}return i[s][r]}function Vt(t,e){let s,r=1/0,i=t.toLowerCase();for(let n of e){let a=oc(i,n.toLowerCase());a<r&&(r=a,s=n)}if(s===void 0)return;let o=Math.max(1,Math.min(3,Math.floor(Math.max(t.length,s.length)/3)));return r<=o?s:void 0}function ac(t,e,s){t.file&&(e=t.file,s=t.source);let i=`${t.line?`${e}:${t.line}:${t.col}`:e} ${t.severity}: ${t.message}`;if(t.hint&&(i+=`
|
|
136
136
|
${t.hint}`),s&&t.line){let n=s.split(/\r?\n/)[t.line-1]??"",a=String(t.line).padStart(4);i+=`
|
|
137
137
|
${a} | ${n}
|
|
138
|
-
${" ".repeat(a.length)} | ${" ".repeat(Math.max(0,t.col-1))}^`}return i}function
|
|
138
|
+
${" ".repeat(a.length)} | ${" ".repeat(Math.max(0,t.col-1))}^`}return i}function Ed(t,e,s){return t.map(r=>ac(r,e,s)).join(`
|
|
139
139
|
|
|
140
|
-
`)}function
|
|
141
|
-
`)[0],l=/Nested mappings|Implicit keys|mapping values/i.test(c)?`text that contains ": " (a colon followed by a blank) must be in quotes, e.g. command: 'send "a: b"'`:/Map keys must be unique/i.test(c)?"a key is written twice in the same map":void 0;r.push({severity:"error",message:`YAML: ${c}`,line:p.line,col:p.col,path:"",hint:l})}for(let
|
|
142
|
-
`)[0]}`,line:p.line,col:p.col,path:""})}function o(m,p={}){let c=lf(m),l=s.contents,f={line:1,col:1},d=u=>{let y=u?.range;y&&(f=i(y[0]))};d(l);for(let u=0;u<c.length;u++){let y=c[u];if(cn(l)){let g=l.items.find(x=>Qe(x)&&Ge(x.key)&&String(x.key.value)===String(y));if(!g)break;if(p.key&&u===c.length-1)return d(g.key),f;d(g.key),l=g.value,l&&d(l)}else if(pn(l)&&typeof y=="number"){if(l=l.items[y],!l)break;d(l)}else break}return f}function n(m){let p=s.contents;for(let d of lf(m)){if(cn(p)){let u=p.items.find(y=>Qe(y)&&Ge(y.key)&&String(y.key.value)===String(d));if(!u)return;p=u.value}else if(pn(p)&&typeof d=="number")p=p.items[d];else return;if(!p)return}let c=p.range;if(!c)return;let l=e.linePos(Math.max(c[0],c[1]-1)).line,f=t.split(/\r?\n/);for(;l>e.linePos(c[0]).line&&/^\s*(#.*)?$/.test(f[l-1]??"");)l--;return{start:e.linePos(c[0]).line,end:l}}let a=null;return s.errors.length||(a=s.toJS({maxAliasCount:100})),{data:a,locate:o,span:n,diags:r}}var Qm=new Set(["svg","g","defs","marker","symbol","title","desc","path","polygon","polyline","line","rect","circle","ellipse","text","tspan","linearGradient","radialGradient","stop","clipPath"]),eu=new Set(["id","class","role","transform","viewBox","width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","fx","fy","d","points","offset","gradientUnits","gradientTransform","markerWidth","markerHeight","refX","refY","orient","markerUnits","text-anchor","dominant-baseline","font-size","font-weight","letter-spacing","fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","stop-color","stop-opacity","marker-start","marker-mid","marker-end","clip-path","preserveAspectRatio","vector-effect","paint-order","style"]),tu=new Set(["fill","stroke","marker-start","marker-mid","marker-end","clip-path","style"]),nu={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"},cf=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,s)=>nu[s]);function Kl(t,e){return t.startsWith("data-")||t.startsWith("aria-")?/^[a-z][\w-]*$/.test(t):!(!eu.has(t)||tu.has(t)&&/url\(\s*(?!['"]?#)|javascript:|expression\(|@import/i.test(e))}function Gl(t){let e={name:"#root",attrs:[],children:[]},s=[{node:e,dropped:!1}],r=/<(?:!--)[\s\S]*?-->|<\/([a-zA-Z][\w:-]*)\s*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,i,o=0;for(;i=r.exec(t);){if(i.index!==o)throw new Error(`not the renderer's SVG at ${o}: ${JSON.stringify(t.slice(o,o+40))}`);o=r.lastIndex;let n=s[s.length-1];if(i[0].charAt(1)!=="!"){if(i[1]){if(s.length<2||n.node.name!==i[1])throw new Error(`a stray </${i[1]}>`);s.pop();continue}if(i[2]){let a=i[2],m=[];for(let l of i[3].matchAll(/([\w:-]+)="([^"]*)"/g)){let f=l[1],d=cf(l[2]);f==="xmlns"||f.startsWith("xmlns:")||Kl(f,d)&&m.push([f,d])}let p={name:a,attrs:m,children:[]},c=n.dropped||!Qm.has(a);c||n.node.children.push(p),i[4]||s.push({node:p,dropped:c});continue}!n.dropped&&i[5].trim()&&n.node.children.push(cf(i[5]))}}if(o!==t.length)throw new Error(`not the renderer's SVG at ${o}`);if(s.length!==1)throw new Error(`<${s[s.length-1].node.name}> is never closed`);return e}var su="http://www.w3.org/2000/svg",pf=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function ff(t,e=document){let s=i=>{let o=e.createElementNS(su,i.name);for(let[n,a]of i.attrs)n==="style"?o.style.cssText=pf(a):o.setAttribute(n,/var\(--/.test(a)?pf(a):a);for(let n of i.children)o.append(typeof n=="string"?e.createTextNode(n):s(n));return o},r=Gl(t).children.find(i=>typeof i!="string"&&i.name==="svg");if(!r)throw new Error("the drawing has no <svg>");return s(r)}var ru=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ti=class t{name;attrs=[];children=[];style={};constructor(e){this.name=e}setAttribute(e,s){let r=this.attrs.findIndex(i=>i[0]===e);r>=0?this.attrs[r][1]=String(s):this.attrs.push([e,String(s)])}getAttribute(e){return this.attrs.find(s=>s[0]===e)?.[1]??null}append(...e){for(let s of e)s!=null&&this.children.push(s)}set textContent(e){this.children=[String(e)]}get textContent(){return this.children.map(e=>typeof e=="string"?e:e.textContent).join("")}toNode(){let e=Object.entries(this.style).filter(([,s])=>s!==""&&s!==void 0).map(([s,r])=>`${ru(s)}:${r}`).join(";");return{name:this.name,attrs:e?[...this.attrs,["style",e]]:[...this.attrs],children:this.children.map(s=>s instanceof t?s.toNode():s)}}},df={createElementNS:(t,e)=>new Ti(e)},mf=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),iu=t=>mf(t).replace(/"/g,""");function na(t,e=new Set(["style"])){if(typeof t=="string")return mf(t);let s=t.attrs.map(([i,o])=>` ${i}="${iu(o)}"`).join("");if(!t.children.length)return`<${t.name}${s}/>`;let r=e.has(t.name)?t.children.map(i=>typeof i=="string"?i.replace(/<\//g,"<\\/"):na(i,e)).join(""):t.children.map(i=>na(i,e)).join("");return`<${t.name}${s}>${r}</${t.name}>`}var ou=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function Zl(t){let e=new TextEncoder().encode(t),s=e.length,r=Math.ceil((s+9)/64),i=new Uint8Array(r*64);i.set(e),i[s]=128;let o=new DataView(i.buffer);o.setUint32(i.length-4,s*8>>>0),o.setUint32(i.length-8,Math.floor(s/536870912));let n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),m=(p,c)=>p>>>c|p<<32-c;for(let p=0;p<r;p++){for(let h=0;h<16;h++)a[h]=o.getUint32(p*64+h*4);for(let h=16;h<64;h++){let b=m(a[h-15],7)^m(a[h-15],18)^a[h-15]>>>3,w=m(a[h-2],17)^m(a[h-2],19)^a[h-2]>>>10;a[h]=a[h-16]+b+a[h-7]+w>>>0}let[c,l,f,d,u,y,g,x]=n;for(let h=0;h<64;h++){let b=x+(m(u,6)^m(u,11)^m(u,25))+(u&y^~u&g)+ou[h]+a[h]>>>0,w=(m(c,2)^m(c,13)^m(c,22))+(c&l^c&f^l&f)>>>0;x=g,g=y,y=u,u=d+b>>>0,d=f,f=l,l=c,c=b+w>>>0}n[0]+=c,n[1]+=l,n[2]+=f,n[3]+=d,n[4]+=u,n[5]+=y,n[6]+=g,n[7]+=x}return[...n].map(p=>p.toString(16).padStart(8,"0")).join("")}function uf(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",s={update(r){return e+=r,s},digest(r){return Zl(e)}};return s}var fd={};co(fd,{ANTS_CSS:()=>Bf,ANT_DASH:()=>hc,ANT_SPEED:()=>Bi,ANT_STILL:()=>yc,ASSEMBLE_STYLES:()=>_i,BOARD_3D:()=>Fs,BOARD_CSS:()=>ld,DISASSEMBLE_STYLES:()=>Fi,EASING_NAMES:()=>Ea,EXTRAPOLATE:()=>Lr,FLAT_DEFAULTS:()=>Ac,FLAT_FONTS:()=>Tc,FONT_STACKS:()=>kc,GRID_CSS:()=>Hi,LABEL_BUDGET:()=>Ma,MARKS_CSS:()=>Yi,MOTION_EASINGS:()=>Ef,MOTION_ORDERS:()=>Rr,MOTION_SCHEMA:()=>Zf,MotionBuilder:()=>Vi,NodesBuilder:()=>Cr,Obstacles:()=>er,PAGE_CSS:()=>vc,PLAYER_CSS:()=>za,PLAYER_UI_CSS:()=>Mc,ROUTE_BUDGET:()=>da,SeriesBuilder:()=>jr,WALL_T:()=>ls,alongPath:()=>$a,antDash:()=>qi,antsOf:()=>ks,assemble:()=>uc,assembly:()=>wa,baseCss:()=>Vr,bezier:()=>Ls,bindMotion:()=>Br,boardCatalog:()=>cd,boardDiagram:()=>pd,boardErrors:()=>La,boardOf:()=>_a,boxAsset:()=>on,boxSilhouette:()=>nd,calloutRect:()=>rc,cardAsset:()=>Ec,checkMotion:()=>Na,cloudPath:()=>Jl,compileRaw:()=>Ca,convexOverlap:()=>Ci,curveAt:()=>Fr,defaultLabel:()=>gf,disassemble:()=>Ff,drawCloud:()=>Pr,drawDecos:()=>Wl,drawLooks:()=>Oa,drawingCss:()=>nr,durationFor:()=>$c,easeOf:()=>Hn,facePainter:()=>Qs,flatHit:()=>ad,floorAt:()=>Ar,floorOf:()=>sd,focusView:()=>Qf,gateBox:()=>Ii,iconPainter:()=>Ei,inConvex:()=>ic,introSvg:()=>Df,kindsCss:()=>ra,labelRect:()=>ji,layoutFlat:()=>Kr,lineRectArea:()=>Sf,localAt:()=>td,markCss:()=>ia,metricsMeasure:()=>od,midpoint:()=>Sc,motion:()=>Vf,motionModel:()=>js,motionOfSteps:()=>Uf,motionOrder:()=>fc,msOf:()=>Yn,noSource:()=>Pc,nodeKind:()=>Xs,nodeKindOr:()=>Mn,offscreen:()=>Nr,openList:()=>ec,overlap2:()=>aa,overlaps:()=>ja,paddingOf:()=>rd,paint:()=>Lf,parseEnd:()=>bn,place:()=>Or,placeBoard:()=>Wi,placeCallout:()=>ga,placeNodeLabel:()=>Li,placeholderIcon:()=>Hl,planOf:()=>Ir,plate:()=>Ni,polyBounds:()=>Gn,polyRectArea:()=>Er,readMs:()=>Gi,rectArea:()=>sc,regionKind:()=>Pt,regionRole:()=>Pa,registerMarks:()=>yf,renderScene:()=>zr,resolveSteps:()=>Ia,resolveSvg:()=>Ui,routeAll:()=>ma,screenToGrid:()=>ed,silhouette:()=>Ht,simplify:()=>zi,snapMove:()=>id,springAt:()=>_r,svgAt:()=>Di,wallHeight:()=>sa,wallsOf:()=>va,withAnts:()=>Aa});var Pt=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,Xs=(t,e)=>t.nodes[e??t.defaultNode],Mn=(t,e)=>Xs(t,e)??t.nodes[t.defaultNode],sa=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,ra=t=>Object.values(t.regions).map(e=>e.css??"").join("");var Ul=Object.create(null),Yl=[];function yf(t){Object.assign(Ul,t.icons??{}),Object.assign(dr,t.faces??{}),t.css&&!Yl.includes(t.css)&&Yl.push(t.css)}var ia=()=>Yl.join(""),Ei=t=>Object.hasOwn(Ul,t)?Ul[t]:void 0,Qs=t=>Object.hasOwn(dr,t)?dr[t]:void 0;function Hl(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(.6,(e.x1-e.x0)*.24,(e.y1-e.y0)*.24),n=[[s-o,r-o,i],[s+o,r-o,i],[s+o,r+o,i],[s-o,r+o,i]];return t.poly(n,"ico-unknown")+t.line3([s-o*.3,r-o*.35,i],[s+o*.3,r-o*.35,i],"ico-unknown-q")+t.line3([s+o*.3,r-o*.35,i],[s,r+o*.1,i],"ico-unknown-q")+t.line3([s,r+o*.45,i],[s,r+o*.5,i],"ico-unknown-q")}function Wl(t,e,s){let r="";for(let i of s??[])i==="terminal"?r+=oi(t,e,3):i==="envelope"?r+=po(t,e):i==="bubble"?r+=fo(t,e):i==="file-lines"?r+=mo(t,e):typeof i=="object"&&(i.terminal&&(r+=oi(t,e,i.terminal)),i.icon&&(r+=(Ei(i.icon)??Hl)(t,e)));return r}var au=(t,e)=>(t.deco??e.deco??[]).filter(s=>s!=="ghost");function on(t,e,s,r,i,o){let n={name:t,description:e,size:s,role:r,deco:i,draw:(a,m,p)=>a.blockFaces(m)+Wl(a,m,au(p,n))+(o?o(a,m):"")};return n}function Ni(t){let[e,s]=Zs(t);return{x0:e-.75,y0:s-.75,x1:e+.75,y1:s+.75,z0:t.z0,z1:t.z0+.18}}function Jl(t,e){let s=Math.max(8,Math.min(t,e)*.18),r=s*.55,i=r,o=r,n=t-r,a=e-r,m=(p,c,l,f)=>{let d=Math.hypot(l-p,f-c),u=Math.max(1,Math.round(d/(s*1.7))),y="";for(let g=1;g<=u;g++){let x=p+(l-p)*g/u,h=c+(f-c)*g/u,b=d/u/2*1.08;y+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${x.toFixed(1)},${h.toFixed(1)}`}return y};return`M${i.toFixed(1)},${o.toFixed(1)}`+m(i,o,n,o)+m(n,o,n,a)+m(n,a,i,a)+m(i,a,i,o)+"Z"}function Pr(t,e){let s={...e,z0:e.z1},r=a=>{let[m,p]=Re(e.x0,e.y0,a);return[Ct,.5,-Ct,.5,m,p]},i=(e.x1-e.x0)*lt,o=(e.y1-e.y0)*lt,n=Jl(i,o);return t.onMatrix(r(e.z0),i,o,()=>ve("path",{d:n,class:"lft cloud-side"}))+t.onMatrix(r(e.z1),i,o,()=>ve("path",{d:n,class:"top cloud-top"}))}function gf(t,e){let[s,r]=Re((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1+.75);return{x:s,y:r-18+(e?0:6),anchor:"middle"}}var ls=.16,Xl=["right-of","left-of","below","behind"];function Or(t,e,s,r,i,o={},n){let a=[],m=(M,A,P,j=!1,F="error")=>{let Y=s.locate(M,{key:j});a.push({severity:F,message:A,line:Y.line,col:Y.col,path:M,hint:P})},p=[],c=new Map,l=[],f=new Map,d=new Set([...Object.keys(r.roles),...Object.keys(o)]);function u(M,A){let P=c.get(M.id);if(P){let j=s.locate(P.path+"/id");return m(M.path+"/id",`duplicate id "${M.id}" (first used on line ${j.line})`),!1}return c.set(M.id,M),p.push(M),M.parent=A,A?A.children.push(M):l.push(M),!0}let y=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function g(M,A,P){let j={id:M.id,type:"node",path:A,children:[],box:y(),floor:0,node:M,appears:M.appears,disappears:M.disappears};u(j,P)&&(M.nodes??[]).forEach((F,Y)=>g(F,`${A}/nodes/${Y}`,j))}function x(M,A,P){let j={id:M.id,type:"region",path:A,children:[],box:y(),floor:0,region:M,appears:M.appears,disappears:M.disappears};u(j,P)&&((M.nodes??[]).forEach((F,Y)=>g(F,`${A}/nodes/${Y}`,j)),(M.regions??[]).forEach((F,Y)=>x(F,`${A}/regions/${Y}`,j)))}(t.regions??[]).forEach((M,A)=>x(M,`${e}/regions/${A}`,void 0)),(t.nodes??[]).forEach((M,A)=>g(M,`${e}/nodes/${A}`,void 0));let h=()=>c.keys(),b=()=>p.filter(M=>M.type==="region").map(M=>M.id);for(let M of[...p]){let A=M.node??M.region;if(A.in!==void 0){let j=c.get(A.in);if(!j){m(M.path+"/in",`unknown region "${A.in}"`+Ri(A.in,b()));continue}if(j.type!=="region"){m(M.path+"/in",`"${A.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(M.parent&&M.parent!==j){m(M.path+"/in",`"${M.id}" is written inside "${M.parent.id}" but says in: ${A.in}; use one or the other`);continue}for(let F=j;F;F=F.parent)if(F===M){m(M.path+"/in",`"${M.id}" cannot be inside itself`);continue}M.parent||(l.splice(l.indexOf(M),1),M.parent=j,j.children.push(M))}if(M.node){let j=M.node.asset;j!==void 0&&!Xs(i,j)&&m(M.path+"/asset",`unknown asset "${j}"`+Ri(j,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let P=(M.node??M.region).role;P!==void 0&&!d.has(P)&&m(M.path+"/role",`unknown colour role "${P}"`+Ri(P,d),`add it under "roles:" at the top of the file, or use one of: ${[...d].join(", ")}`)}for(let M of p){let A=M.region?.gate;if(!A?.node)continue;let P=c.get(A.node);if(!P){m(M.path+"/gate/node",`unknown node "${A.node}"`+Ri(A.node,h()));continue}if(P.type!=="node"){m(M.path+"/gate/node",`"${A.node}" is a region; a gate is a node`);continue}P.placedBy=M.id;let j=P.node;(j.at||Xl.some(F=>j[F]))&&m(P.path,`"${P.id}" is the gate of "${M.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let w=M=>M.gap??t.gap??2;function k(M){let A=M.node,P=Mn(i,A.asset),j=A.size,F=P.size[0],Y=P.size[1],J=P.size[2];if(j&&(F=j[0],Y=j[1],j.length>2&&(J=j[2])),M.placedBy){let U=c.get(M.placedBy).region,C=U.gate,G=C.width??2,Z=j?Math.min(F,Y):.3;J=j&&j.length>2?J:C.height??(U.height??sa(i))+.3,C.side==="e"||C.side==="w"?(F=Z,Y=G):(F=G,Y=Z)}return[F,Y,J]}function $(M,A,P,j,F){for(let H of A)T(H);let Y=A.filter(H=>!H.placedBy),J=new Set(Y),U=new Set,C=[],G=new Set,Z=H=>{let ne=H.node??H.region,Ee=[];for(let qe of Xl){let N=ne[qe];if(N===void 0)continue;let ee=c.get(N);if(!ee){m(`${H.path}/${qe}`,`unknown id "${N}"`+Ri(N,h()));continue}if(ee===H){m(`${H.path}/${qe}`,`"${H.id}" cannot be placed ${qe} itself`);continue}if(!J.has(ee)){let ye=ke=>ke.parent?`"${ke.parent.id}"`:"the scene";m(`${H.path}/${qe}`,`"${N}" is in ${ye(ee)} but "${H.id}" is in ${ye(H)}; relative placement works between items in the same region`,ee.placedBy?`"${N}" is a gate, placed by its ${c.get(ee.placedBy)?.region?.kind??"region"}`:`place "${H.id}" relative to something in ${ye(H)}, or use "at:"`);continue}Ee.push(ee)}if(!Ee.length&&!ne.at){let qe=Y.indexOf(H);qe>0&&Ee.push(Y[qe-1])}return Ee},Q=H=>{if(!U.has(H)){if(G.has(H)){m(H.path,`placement loop: "${H.id}" is placed relative to something placed relative to it`);return}G.add(H),Z(H).forEach(Q),G.delete(H),U.add(H),C.push(H)}};Y.forEach(Q);for(let H of C){let ne=H.node??H.region,Ee=f.get(H),qe=Xl.find(N=>ne[N]!==void 0&&c.get(ne[N])&&J.has(c.get(ne[N])));if(ne.at&&qe&&m(`${H.path}/at`,`"${H.id}" has both "at" and "${qe}"; "at" wins`,void 0,!0,"warning"),ne.at)Ee.x=ne.at[0],Ee.y=ne.at[1];else if(qe)v(Ee,f.get(c.get(ne[qe])),qe,w(ne),ne.align??"center");else{let N=Y.indexOf(H);N>0?v(Ee,f.get(Y[N-1]),j==="row"?"right-of":"below",w(ne),"center"):(Ee.x=P,Ee.y=P)}ne.shift&&(Ee.x+=ne.shift[0],Ee.y+=ne.shift[1])}if(F||!Y.length)return{w:0,d:0};let z=1/0,D=1/0,V=-1/0,W=-1/0;for(let H of Y){let ne=f.get(H);z=Math.min(z,ne.x),D=Math.min(D,ne.y),V=Math.max(V,ne.x+ne.w),W=Math.max(W,ne.y+ne.d)}let de=Math.min(0,z-P),ce=Math.min(0,D-P);if(de||ce)for(let H of Y){let ne=f.get(H);ne.x-=de,ne.y-=ce}return{w:V-de+P,d:W-ce+P}}function v(M,A,P,j,F){let Y=()=>{M.y=F==="start"?A.y:F==="end"?A.y+A.d-M.d:A.y+(A.d-M.d)/2},J=()=>{M.x=F==="start"?A.x:F==="end"?A.x+A.w-M.w:A.x+(A.w-M.w)/2};P==="right-of"?(M.x=A.x+A.w+j,Y()):P==="left-of"?(M.x=A.x-j-M.w,Y()):P==="below"?(M.y=A.y+A.d+j,J()):(M.y=A.y-j-M.d,J())}function T(M){if(M.type==="node"){let[C,G,Z]=k(M);f.set(M,{x:0,y:0,w:C,d:G,h:Z,z:M.node.z??0}),M.children.length&&$(M,M.children,0,"row",!0);return}let A=M.region,P=A.padding??Pt(i,A.kind)?.pad,j=!!A.size,F=$(M,M.children,P,A.flow??"row",j),Y=A.size?A.size[0]:Math.max(F.w,P*2+.5),J=A.size?A.size[1]:Math.max(F.d,P*2+.5);if(!A.size&&A.gate){let C=(A.gate.width??2)+1;A.gate.side==="e"||A.gate.side==="w"?J=Math.max(J,C):Y=Math.max(Y,C)}let U=A.size&&A.size.length>2?A.size[2]:A.height??Pt(i,A.kind).z[1];f.set(M,{x:0,y:0,w:Y,d:J,h:U,z:0})}$(void 0,l,0,t.flow??"row",!0);function R(M,A,P,j){let F=f.get(M),Y=A+F.x,J=P+F.y;if(M.type==="region"){let U=Pt(i,M.region.kind),[C]=U.z,G=U.floor,Z=U.shape==="slab"&&Pt(i,M.parent?.region?.kind)?.shape==="slab"?0:C,Q=M.region.z??0,z=j+Z+Q,D=j+F.h+Q;M.box={x0:Y,y0:J,z0:z,x1:Y+F.w,y1:J+F.d,z1:D},M.floor=G?D:j}else{let U=j+F.z;M.box={x0:Y,y0:J,z0:U,x1:Y+F.w,y1:J+F.d,z1:U+F.h},M.floor=M.box.z1}for(let U of M.children)U.placedBy||R(U,Y,J,M.floor)}for(let M of l)M.placedBy||R(M,0,0,0);if(n){let M=P=>Math.round(P/n)*n,A=P=>Math.round(P*1e9)/1e9;for(let P of p){if(P.placedBy)continue;let j=P.box,F=M(j.x0),Y=M(j.x1),J=M(j.y0),U=M(j.y1);Y-F<n&&(Y=F+n),U-J<n&&(U=J+n),P.box={...j,x0:A(F),x1:A(Y),y0:A(J),y1:A(U)};let C=P.node??P.region;C.at&&C.at.forEach((G,Z)=>{let Q=G/n;Math.abs(Q-Math.round(Q))>1e-6&&m(`${P.path}/at/${Z}`,`${G} is not on the ${n} grid; it is drawn at ${A(M(G))}`,void 0,!1,"warning")})}}for(let M of p){let A=M.region?.gate;if(!A?.node)continue;let P=c.get(A.node);!P||P.placedBy!==M.id||(P.box=Ii(M,f.get(P).h,f.get(P).w,f.get(P).d),P.floor=P.box.z1)}for(let M of p){let A=M.children.filter(P=>!P.placedBy);for(let P=0;P<A.length;P++)for(let j=P+1;j<A.length;j++){let F=A[P],Y=A[j];oa(F,i)||oa(Y,i)||aa(F.box,Y.box)&&m(Y.path,`"${Y.id}" overlaps "${F.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(M.parent&&M.parent.type==="region"&&!M.placedBy){let P=M.parent.box,j=M.box,F=1e-6;(j.x0<P.x0-F||j.y0<P.y0-F||j.x1>P.x1+F||j.y1>P.y1+F)&&m(M.path,`"${M.id}" sticks out of region "${M.parent.id}"`,`make "${M.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let M=l.filter(A=>!A.placedBy);for(let A=0;A<M.length;A++)for(let P=A+1;P<M.length;P++){let j=M[A],F=M[P];aa(j.box,F.box)&&!oa(j,i)&&!oa(F,i)&&m(F.path,`"${F.id}" overlaps "${j.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let O=new Set,I=a.filter(M=>{let A=M.path+M.message;return O.has(A)?!1:(O.add(A),!0)});return{items:p,byId:c,roots:l,diags:I,catalog:i}}var oa=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(Pt(e,t.region.kind)?.shape??"");function Ii(t,e,s,r){let i=t.region.gate,o=t.box,n=t.box.z0,a=i.at??.5,m=i.width??2;if(i.side==="w"||i.side==="e"){let l=i.side==="w"?o.x0+ls/2:o.x1-ls/2,f=o.y0+(o.y1-o.y0)*a;return{x0:l-s/2,x1:l+s/2,y0:f-m/2,y1:f+m/2,z0:n,z1:n+e}}let p=i.side==="n"?o.y0+ls/2:o.y1-ls/2,c=o.x0+(o.x1-o.x0)*a;return{x0:c-m/2,x1:c+m/2,y0:p-r/2,y1:p+r/2,z0:n,z1:n+e}}function aa(t,e,s=1e-6){return t.x0<e.x1-s&&e.x0<t.x1-s&&t.y0<e.y1-s&&e.y0<t.y1-s}function Ri(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var ws=.2,la=.05,lu=.6,ca=.25,pa={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function bn(t){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(t);return{id:e[1],side:e[2]}}var bf=new WeakMap;function Ar(t,e,s){let r=bf.get(t);if(!r){r=[];for(let n of t.items){if(n.type!=="region"||!Pt(t.catalog,n.region.kind)?.floor)continue;let a=0;for(let m=n.parent;m;m=m.parent)a++;r.push({r:n,d:a})}bf.set(t,r)}let i=0,o=-1;for(let{r:n,d:a}of r){let m=n.box,p=1e-6;e>=m.x0-p&&e<=m.x1+p&&s>=m.y0-p&&s<=m.y1+p&&a>o&&(o=a,i=n.floor)}return i}function cu(t,e){let s=[(t.x0+t.x1)/2,(t.y0+t.y1)/2],r=[(e.x0+e.x1)/2,(e.y0+e.y1)/2],i=r[0]-s[0],o=r[1]-s[1],n=Math.max(e.x0-t.x1,t.x0-e.x1),a=Math.max(e.y0-t.y1,t.y0-e.y1);return n>0&&(a<=0||n>=a)?i>0?"e":"w":a>0?o>0?"s":"n":Math.abs(i)>=Math.abs(o)?i>0?"e":"w":o>0?"s":"n"}var da=5e5;function ma(t,e,s,r,i,o){let n=[],a=(b,w,k,$="error")=>{let v=r.locate(b);n.push({severity:$,message:w,line:v.line,col:v.col,path:b,hint:k})},m=t.routes??[],p={left:da},c=0,l=()=>s.items.map(b=>b.id),f=new Map,d=[],u=[];m.forEach((b,w)=>{let k=`${e}/routes/${w}`;(f.has(b.id)||s.byId.has(b.id))&&a(k+"/id",`duplicate id "${b.id}"`),f.set(b.id,w);let $=b.kind??"send";i.has($)||a(k+"/kind",`unknown flow kind "${$}"`+Ql($,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let v={id:b.id,raw:b,path:k,kind:$,points:[]},T=(R,O)=>{let{id:I}=bn(R),M=s.byId.get(I);if(!M){a(`${k}/${O}`,`unknown node "${I}"`+Ql(I,l()));return}return M};v.from=T(b.from,"from"),v.to=T(b.to,"to"),d.push(v),u.push({r:v})});let y=new Map;for(let b of u){let{r:w}=b;if(!w.from||!w.to||w.raw.points)continue;let k=bn(w.raw.from).side,$=bn(w.raw.to).side,v=w.raw.via?.[0],T=w.raw.via?.[w.raw.via.length-1],R=(A,P)=>{if(Array.isArray(A))return{x0:A[0],x1:A[0],y0:A[1],y1:A[1],z0:0,z1:0};if(typeof A=="string"){let j=s.byId.get(bn(A).id);if(j)return j.box}return P.box},O=(A,P,j)=>{let F=P??cu(A.box,j);return{node:A,side:F,explicit:!!P,p:[0,0],z:0}};b.a=O(w.from,k,R(v,w.to)),b.b=O(w.to,$,R(T,w.from));let I=R(v,w.to),M=R(T,w.from);for(let[A,P]of[[b.a,I],[b.b,M]]){let j=`${A.node.id}.${A.side}`;y.has(j)||y.set(j,[]),y.get(j).push({e:A,other:[(P.x0+P.x1)/2,(P.y0+P.y1)/2]})}}for(let[,b]of y){let w=b[0].e,k=w.node.box,$=w.side,v=$==="e"||$==="w"?1:0;b.sort((A,P)=>A.other[v]-P.other[v]);let T=v?k.y0:k.x0,R=v?k.y1:k.x1,O=(T+R)/2,I=Math.max(0,R-T-.3),M=b.length>1?Math.min(lu,I/(b.length-1)):0;b.forEach((A,P)=>{let j=(P-(b.length-1)/2)*M,F=O+j,Y=A.e.node.box.z0;if($==="top"){A.e.p=[(k.x0+k.x1)/2,(k.y0+k.y1)/2],A.e.z=k.z1;return}let[J,U]=pa[$];A.e.p=v?[J>0?k.x1+la:k.x0-la,F]:[F,U>0?k.y1+la:k.y0-la],A.e.z=Y})}let g=[];for(let b of s.items)b.type==="node"&&g.push(b.box);let x=[];for(let b of s.items.filter(w=>Pt(s.catalog,w.region?.kind)?.shape==="walled")){let{x0:w,y0:k,x1:$,y1:v}=b.box,T=ls,R=b.region.gate,O=[[{x0:w,y0:k,x1:$,y1:k+T,z0:0,z1:0},"n"],[{x0:w,y0:v-T,x1:$,y1:v,z0:0,z1:0},"s"],[{x0:w,y0:k,x1:w+T,y1:v,z0:0,z1:0},"w"],[{x0:$-T,y0:k,x1:$,y1:v,z0:0,z1:0},"e"]];for(let[I,M]of O)if(R&&R.side===M){if(R.node)continue;let A=R.at??.5,P=R.width??2;if(M==="e"||M==="w"){let j=k+(v-k)*A;x.push({...I,y1:j-P/2},{...I,y0:j+P/2})}else{let j=w+($-w)*A;x.push({...I,x1:j-P/2},{...I,x0:j+P/2})}}else x.push(I)}let h=new Map;for(let b of u){let{r:w,a:k,b:$}=b;if(w.raw.points){w.points=w.raw.points.map(F=>[F[0],F[1],F.length>2?F[2]:Ar(s,F[0],F[1])+.01]);continue}if(!k||!$)continue;let v=[];(w.raw.via??[]).forEach((F,Y)=>{if(Array.isArray(F))if(o){let J=U=>Math.round(Math.round(U/o)*o*1e9)/1e9;F.forEach((U,C)=>{Math.abs(U/o-Math.round(U/o))>1e-6&&a(`${w.path}/via/${Y}/${C}`,`${U} is not on the ${o} grid; it is drawn at ${J(U)}`,void 0,"warning")}),v.push({p:[J(F[0]),J(F[1])]})}else v.push({p:[F[0],F[1]]});else{let{id:J,side:U}=bn(F),C=s.byId.get(J);if(!C){a(`${w.path}/via/${Y}`,`unknown node "${J}"`+Ql(J,l()));return}let G=U&&U!=="top"?U:"n",[Z,Q]=pa[G],z=C.box;v.push({p:[Z?Z>0?z.x1+.4:z.x0-.4:(z.x0+z.x1)/2,Q?Q>0?z.y1+.4:z.y0-.4:(z.y0+z.y1)/2]})}});let R=g.filter(F=>F!==k.node.box&&F!==$.node.box).concat(w.raw.cross?[]:x).filter(F=>!fa(k.node.box,F)&&!fa($.node.box,F)&&!fa(F,k.node.box)&&!fa(F,$.node.box)),O=k.side==="top"?void 0:pa[k.side],I=$.side==="top"?void 0:pa[$.side],M=[k.p,...v.map(F=>F.p),$.p],A=[k.p],P=O,j=!0;for(let F=0;F+1<M.length;F++){let Y=F+2===M.length,J=fu(M[F],M[F+1],R,h,P,Y&&I?[-I[0],-I[1]]:void 0,p);if(!J){j=!1;break}A.push(...J.slice(1));let U=A.length;if(U>=2){let C=Math.sign(A[U-1][0]-A[U-2][0]),G=Math.sign(A[U-1][1]-A[U-2][1]);P=[C,G]}}!j&&p.left<=0?(c++,A=[k.p,[$.p[0],k.p[1]],$.p]):j||(a(w.path,`no path found for route "${w.id}" from "${k.node.id}" to "${$.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),A=[k.p,[$.p[0],k.p[1]],$.p]),A=zi(A);for(let F=0;F+1<A.length;F++)pu(h,A[F],A[F+1]);w.points=uu(s,A,k,$)}return c&&a(e,`${c} of ${d.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${da.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:d,diags:n}}function fa(t,e){return e.x0>=t.x0-1e-6&&e.x1<=t.x1+1e-6&&e.y0>=t.y0-1e-6&&e.y1<=t.y1+1e-6&&e.z0>=t.z1-1e-6}var wf=(t,e)=>`${Math.round(t/ws)},${Math.round(e/ws)}`;function pu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(s[0]-e[0],s[1]-e[1])/ws));for(let i=0;i<=r;i++){let o=wf(e[0]+(s[0]-e[0])*i/r,e[1]+(s[1]-e[1])*i/r);t.set(o,(t.get(o)??0)+1)}}function xf(t,e,s){for(let r of s)if(t>r.x0-ca&&t<r.x1+ca&&e>r.y0-ca&&e<r.y1+ca)return!0;return!1}function fu(t,e,s,r,i,o,n={left:1/0}){if((Math.abs(t[0]-e[0])<1e-6||Math.abs(t[1]-e[1])<1e-6)&&mu(t,e,s)){let C=[Math.sign(e[0]-t[0]),Math.sign(e[1]-t[1])],G=!i||i[0]===C[0]&&i[1]===C[1],Z=!o||o[0]===C[0]&&o[1]===C[1];if(G&&Z)return[t,e]}if(n.left<=0)return null;let a=C=>Math.round((C-t[0])/ws),m=C=>Math.round((C-t[1])/ws),p=C=>t[0]+C*ws,c=C=>t[1]+C*ws,l=a(e[0]),f=m(e[1]),d=30,u=Math.min(0,l)-d,y=Math.max(0,l)+d,g=Math.min(0,f)-d,x=Math.max(0,f)+d,h=1.2,b=ws,w=.06,k=[[1,0],[-1,0],[0,1],[0,-1]],$=y-u+1,v=x-g+1,T=(C,G)=>(C-u)*v+(G-g),R=new Int8Array($*v).fill(-1),O=new Float64Array($*v).fill(-1),I=new Float64Array($*v*4).fill(1/0),M=(C,G)=>{let Z=T(C,G);return R[Z]<0&&(R[Z]=xf(p(C),c(G),s)?1:0),R[Z]===1},A=(C,G)=>{let Z=T(C,G);return O[Z]<0&&(O[Z]=r.get(wf(p(C),c(G)))??0),O[Z]},P=ec(),j=(C,G)=>(Math.abs(C-l)+Math.abs(G-f))*b,F=i?k.findIndex(C=>C[0]===i[0]&&C[1]===i[1]):-1;P.push({i:0,j:0,d:F,g:0,f:j(0,0),idx:0,hp:0});let Y=(C,G)=>Math.abs(C)+Math.abs(G)<=2,J=(C,G)=>Math.abs(C-l)+Math.abs(G-f)<=2,U=0;for(;P.length()&&U++<2e5;){if(n.left--<=0)return null;let C=P.take();if(C.i===l&&C.j===f&&!(o&&C.d>=0&&(k[C.d][0]!==o[0]||k[C.d][1]!==o[1]))){let G=[];for(let Z=C;Z;Z=Z.prev)G.push([p(Z.i),c(Z.j)]);return G.reverse(),G[0]=t,du(zi(G),e)}for(let G=0;G<4;G++){let Z=k[G];if(C.d>=0&&Z[0]===-k[C.d][0]&&Z[1]===-k[C.d][1])continue;let Q=C.i+Z[0],z=C.j+Z[1];if(Q<u||Q>y||z<g||z>x||!Y(Q,z)&&!J(Q,z)&&M(Q,z))continue;if((Y(Q,z)||J(Q,z))&&M(Q,z)&&!(Q===l&&z===f)){let de=Y(Q,z)?i:o&&[-o[0],-o[1]];if(!de||(Y(Q,z)?Z[0]!==de[0]||Z[1]!==de[1]:Z[0]!==o[0]||Z[1]!==o[1]))continue}let D=C.d>=0&&C.d!==G?h:0,V=C.g+b+D+A(Q,z)*w,W=T(Q,z)*4+G;I[W]<=V||(I[W]=V,P.push({i:Q,j:z,d:G,g:V,f:V+j(Q,z),prev:C,idx:0,hp:0}))}}return null}function ec(){let t=[],e=[],s=(n,a)=>n.f<a.f||n.f===a.f&&n.idx<a.idx,r=(n,a)=>{let m=e[n];e[n]=e[a],e[a]=m,e[n].hp=n,e[a].hp=a},i=n=>{for(;n>0;){let a=n-1>>1;if(!s(e[n],e[a]))break;r(n,a),n=a}},o=n=>{for(;;){let a=2*n+1,m=a+1,p=n;if(a<e.length&&s(e[a],e[p])&&(p=a),m<e.length&&s(e[m],e[p])&&(p=m),p===n)return;r(n,p),n=p}};return{length:()=>t.length,push(n){n.idx=t.length,t.push(n),n.hp=e.length,e.push(n),i(n.hp)},take(){let n=e[0],a=e.pop();e.length&&(e[0]=a,a.hp=0,o(0));let m=t.pop();return m!==n&&(t[n.idx]=m,m.idx=n.idx,i(m.hp)),n}}}function du(t,e){let s=t.map(o=>[o[0],o[1]]),r=s.length,i=s[r-1];if(r>=2){let o=s[r-2];Math.abs(o[1]-i[1])<1e-9?(o[1]=e[1],r>=3&&Math.abs(s[r-3][1]-i[1])<1e-9&&(s[r-3][1]=e[1])):Math.abs(o[0]-i[0])<1e-9&&(o[0]=e[0],r>=3&&Math.abs(s[r-3][0]-i[0])<1e-9&&(s[r-3][0]=e[0]))}return s[r-1]=e,zi(s)}function mu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(e[0]-t[0],e[1]-t[1])/(ws/2)));for(let i=2;i<r-1;i++)if(xf(t[0]+(e[0]-t[0])*i/r,t[1]+(e[1]-t[1])*i/r,s))return!1;return!0}function zi(t){let e=[];for(let s of t){let r=e.length;if(!(r&&Math.abs(e[r-1][0]-s[0])<1e-6&&Math.abs(e[r-1][1]-s[1])<1e-6)){if(r>=2){let i=e[r-2],o=e[r-1];if(Math.abs(i[0]-o[0])<1e-6&&Math.abs(o[0]-s[0])<1e-6||Math.abs(i[1]-o[1])<1e-6&&Math.abs(o[1]-s[1])<1e-6){e[r-1]=s;continue}}e.push(s)}}return e}function uu(t,e,s,r){let i=new Set,o=new Set;for(let p of t.items)p.type!=="region"||!Pt(t.catalog,p.region.kind)?.floor||(i.add(p.box.x0),i.add(p.box.x1),o.add(p.box.y0),o.add(p.box.y1));let n=[],a=(p,c)=>Ar(t,p,c)+.01;for(let p=0;p+1<e.length;p++){let[c,l]=e[p],[f,d]=e[p+1],u=[0,1];if(Math.abs(l-d)<1e-6)for(let y of i){let g=(y-c)/(f-c);g>1e-6&&g<1-1e-6&&u.push(g)}else for(let y of o){let g=(y-l)/(d-l);g>1e-6&&g<1-1e-6&&u.push(g)}u.sort((y,g)=>y-g);for(let y=0;y+1<u.length;y++){let g=u[y],x=u[y+1],h=(g+x)/2,b=a(c+(f-c)*h,l+(d-l)*h),w=[c+(f-c)*g,l+(d-l)*g,b],k=[c+(f-c)*x,l+(d-l)*x,b],$=n[n.length-1];$&&(Math.abs($[0]-w[0])>1e-6||Math.abs($[1]-w[1])>1e-6||Math.abs($[2]-w[2])>1e-6)?n.push(w):$||n.push(w),n.push(k)}}n.length&&(n[0][2]=s.side==="top"?s.z:s.node.box.z0+.01,n[n.length-1][2]=r.side==="top"?r.z:r.node.box.z0+.01);let m=[];for(let p of n){let c=m.length;if(c>=2){let l=m[c-2],f=m[c-1],d=Math.abs(l[2]-f[2])<1e-9&&Math.abs(f[2]-p[2])<1e-9,u=Math.abs(l[0]-f[0])<1e-6&&Math.abs(f[0]-p[0])<1e-6||Math.abs(l[1]-f[1])<1e-6&&Math.abs(f[1]-p[1])<1e-6;if(d&&u){m[c-1]=p;continue}}m.push(p)}return m}function Ql(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}function Ht(t){return[Re(t.x0,t.y0,t.z1),Re(t.x1,t.y0,t.z1),Re(t.x1,t.y0,t.z0),Re(t.x1,t.y1,t.z0),Re(t.x0,t.y1,t.z0),Re(t.x0,t.y1,t.z1)]}function Gn(t){let e=t.map(o=>o[0]),s=t.map(o=>o[1]),r=Math.min(...e),i=Math.min(...s);return{x:r,y:i,w:Math.max(...e)-r,h:Math.max(...s)-i}}function Er(t,e){let s=t,r=(a,m)=>{let p=[];for(let c=0;c<s.length;c++){let l=s[c],f=s[(c+1)%s.length],d=a(l),u=a(f);d&&p.push(l),d!==u&&p.push(m(l,f))}s=p},i=a=>(m,p)=>[a,m[1]+(p[1]-m[1])*(a-m[0])/(p[0]-m[0])],o=a=>(m,p)=>[m[0]+(p[0]-m[0])*(a-m[1])/(p[1]-m[1]),a];if(r(a=>a[0]>=e.x,i(e.x)),!s.length||(r(a=>a[0]<=e.x+e.w,i(e.x+e.w)),!s.length)||(r(a=>a[1]>=e.y,o(e.y)),!s.length)||(r(a=>a[1]<=e.y+e.h,o(e.y+e.h)),!s.length))return 0;let n=0;for(let a=0;a<s.length;a++){let m=s[a],p=s[(a+1)%s.length];n+=m[0]*p[1]-p[0]*m[1]}return Math.abs(n)/2}function sc(t,e){let s=Math.min(t.x+t.w,e.x+e.w)-Math.max(t.x,e.x),r=Math.min(t.y+t.h,e.y+e.h)-Math.max(t.y,e.y);return s>0&&r>0?s*r:0}function Sf(t,e){let s=0;for(let r=0;r+1<t.length;r++){let i=t[r],o=t[r+1],n=Math.hypot(o[0]-i[0],o[1]-i[1]),a=Math.max(1,Math.ceil(n/4));for(let m=0;m<a;m++){let p=i[0]+(o[0]-i[0])*(m+.5)/a,c=i[1]+(o[1]-i[1])*(m+.5)/a;p>=e.x&&p<=e.x+e.w&&c>=e.y&&c<=e.y+e.h&&(s+=n/a*4)}}return s}var xs=64,ha=class{cells=new Map;n=0;add(e,s,r,i,o){for(let n=Math.floor(s/xs);n<=Math.floor(i/xs);n++)for(let a=Math.floor(r/xs);a<=Math.floor(o/xs);a++){let m=n*1048576+a,p=this.cells.get(m);p||this.cells.set(m,p=[]),p[p.length-1]!==e&&p.push(e)}}query(e,s,r,i){let o=new Set;for(let n=Math.floor(e/xs);n<=Math.floor(r/xs);n++)for(let a=Math.floor(s/xs);a<=Math.floor(i/xs);a++){let m=this.cells.get(n*1048576+a);if(m)for(let p of m)o.add(p)}return[...o].sort((n,a)=>n-a)}},tc=t=>{let e=1/0,s=1/0,r=-1/0,i=-1/0;for(let[o,n]of t)o<e&&(e=o),o>r&&(r=o),n<s&&(s=n),n>i&&(i=n);return[e,s,r,i]},ya=new WeakMap;function Cs(t,e){let s=ya.get(t);for((!s||s.n>t.length)&&ya.set(t,s=new ha);s.n<t.length;s.n++){let[r,i,o,n]=e(t[s.n]);s.add(s.n,r,i,o,n)}return s}function kf(t){let e=ya.get(t);for((!e||e.n>t.length)&&ya.set(t,e=new ha);e.n<t.length;e.n++){let s=t[e.n].pts;for(let r=0;r+1<s.length;r++){let i=s[r],o=s[r+1],n=e.n*65536+r,a=Math.max(1,Math.ceil(Math.hypot(o[0]-i[0],o[1]-i[1])/(xs/2)));for(let m=0;m<a;m++){let p=m/a,c=(m+1)/a,l=i[0]+(o[0]-i[0])*p,f=i[1]+(o[1]-i[1])*p,d=i[0]+(o[0]-i[0])*c,u=i[1]+(o[1]-i[1])*c;e.add(n,Math.min(l,d)-1,Math.min(f,u)-1,Math.max(l,d)+1,Math.max(f,u)+1)}}}return e}var cs=(t,e,s,r,i)=>t.query(e,s,r,i),Tr=t=>tc(t),ua=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function $f(t,e,s,[r,i,o,n]){let a=0,m=s-1;for(let p of[0,1]){let c=e[p]-t[p],l=p?i:r,f=p?n:o;if(Math.abs(c)<1e-12){if(t[p]<l||t[p]>f)return[1,0];continue}let d=(l-t[p])/c*s-.5,u=(f-t[p])/c*s-.5;d>u&&([d,u]=[u,d]),a=Math.max(a,Math.floor(d)-1),m=Math.min(m,Math.ceil(u)+1)}return[a,m]}var er=class t{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let s=0;for(let r of cs(Cs(this.solids,Tr),...ua(e)))s+=Er(this.solids[r],e);return s}hiddenPoly(e){let s=0;for(let r of cs(Cs(this.solids,Tr),...tc(e)))s+=Ci(e,this.solids[r]);return s}costPoly(e,s=1/0){let r=tc(e),i=0;for(let o of cs(Cs(this.polys,n=>Tr(n.poly)),...r))i+=Ci(e,this.polys[o].poly);for(let o of cs(Cs(this.rects,n=>ua(n.r)),...r))i+=Er(e,this.rects[o].r)*2;for(let o of cs(Cs(this.slants,Tr),...r))i+=Ci(e,this.slants[o])*2;if(i>=s)return i;for(let o of cs(kf(this.lines),...r)){if(i>=s)return i;let n=this.lines[Math.floor(o/65536)].pts,a=o%65536,m=n[a],p=n[a+1],c=Math.hypot(p[0]-m[0],p[1]-m[1]),l=Math.max(1,Math.ceil(c/4)),[f,d]=$f(m,p,l,r);for(let u=f;u<=d;u++)ic(e,[m[0]+(p[0]-m[0])*(u+.5)/l,m[1]+(p[1]-m[1])*(u+.5)/l])&&(i+=c/l*4*.6)}return i}cost(e,s,r=.6){let i=ua(e),o=0;for(let n of cs(Cs(this.polys,a=>Tr(a.poly)),...i)){let a=this.polys[n];o+=Er(a.poly,e)*(a.owner===s?1.5:1)}for(let n of cs(Cs(this.rects,a=>ua(a.r)),...i)){let a=this.rects[n];(a.owner!==s||!s)&&(o+=sc(a.r,e)*2)}for(let n of cs(Cs(this.slants,Tr),...i))o+=Er(this.slants[n],e)*2;if(r){let n=-1,a=0;for(let m of cs(kf(this.lines),...i)){let p=Math.floor(m/65536);p!==n&&(n>=0&&(o+=a*r),n=p,a=0);let c=this.lines[p].pts,l=m%65536,f=c[l],d=c[l+1],u=Math.hypot(d[0]-f[0],d[1]-f[1]),y=Math.max(1,Math.ceil(u/4)),[g,x]=$f(f,d,y,i);for(let h=g;h<=x;h++){let b=f[0]+(d[0]-f[0])*(h+.5)/y,w=f[1]+(d[1]-f[1])*(h+.5)/y;b>=e.x&&b<=e.x+e.w&&w>=e.y&&w<=e.y+e.h&&(a+=u/y*4)}}n>=0&&(o+=a*r)}return o}fork(){let e=new t;return e.budget=this.budget,e.polys=this.polys,e.lines=this.lines,e.solids=this.solids,e.rects=[...this.rects],e.slants=this.slants,e}},vf=14;function ji(t,e,s,r){let i=Math.max(t.name?Sn(t.name,wt.lbl):0,t.sub?Sn(t.sub,wt.sub):0)+4,o=(t.name?1:0)+(t.sub?1:0),n=s-(t.name?11:9)-1,a=(o-1)*vf+(t.name?11:9)+4;return{x:r==="start"?e-2:r==="end"?e-i+2:e-i/2,y:n,w:i,h:a}}function Li(t,e,s,r,i,o){let n=Gn(s),a=Re((e.x0+e.x1)/2,(e.y0+e.y1)/2,e.z1)[0],p=((t.name?1:0)+(t.sub?1:0)-1)*vf+4,c=n.y-6-p,l=n.y+Math.min(n.h,60)*.45,f=[];o&&f.push({...o,pen:0}),f.push({x:a,y:c,anchor:"middle",pen:o?20:0});for(let y of[12,24,40])f.push({x:a,y:c-y,anchor:"middle",pen:20+y});for(let y of[-30,30,-60,60])f.push({x:a+y,y:c-4,anchor:"middle",pen:30+Math.abs(y)});f.push({x:n.x+n.w+8,y:l,anchor:"start",pen:120}),f.push({x:n.x-8,y:l,anchor:"end",pen:120}),f.push({x:a,y:n.y+n.h+14,anchor:"middle",pen:300});let d,u=1/0;for(let y of f){let g=ji(t,y.x,y.y,y.anchor),x=r.cost(g,i,.15)*2+y.pen;x<u&&(u=x,d={x:y.x,y:y.y,anchor:y.anchor,rect:g})}return d}function rc(t,e,s,r){return{x:(r==="start"?e:r==="end"?e-t:e-t/2)-2,y:s-14,w:t+4,h:28}}function ga(t,e,s,r,i){let o=[{...r,pen:0}];for(let c of[-46,-66,-86,-106,-126,-146])for(let l of[0,-70,70,-140,140])o.push({x:e+l,y:s+c,anchor:"middle",pen:10+(-c-46)*.5+Math.abs(l)*.4});for(let c of[34,60,86])o.push({x:e,y:s+c,anchor:"middle",pen:60+c*.3});let n=r.x-e,a=r.y-s;for(let c of[-1,1])for(let l of[16,32,48])o.push({...r,y:s+a+c*l,x:e+n,pen:5+l});for(let c of[-1,1])for(let l of[30,60,90])for(let f of[0,16,-16])o.push({...r,x:e+n+c*l,y:s+a+f,pen:8+l*.6+Math.abs(f)});let m,p=1/0;for(let c of o){let l=rc(t,c.x,c.y,c.anchor),f=i.cost(l,void 0,.05)*3+c.pen;f<p&&(p=f,m={x:c.x,y:c.y,anchor:c.anchor,rect:l})}return m}var Mf=t=>{let e=0;for(let s=0;s<t.length;s++){let r=t[s],i=t[(s+1)%t.length];e+=r[0]*i[1]-i[0]*r[1]}return e/2},nc=t=>Mf(t)<0?[...t].reverse():t;function ic(t,e){let s=nc(t);for(let r=0;r<s.length;r++){let i=s[r],o=s[(r+1)%s.length];if((o[0]-i[0])*(e[1]-i[1])-(o[1]-i[1])*(e[0]-i[0])<0)return!1}return!0}function Ci(t,e){let s=nc(t),r=nc(e);for(let i=0;i<r.length&&s.length;i++){let o=r[i],n=r[(i+1)%r.length],a=p=>(n[0]-o[0])*(p[1]-o[1])-(n[1]-o[1])*(p[0]-o[0]),m=s;s=[];for(let p=0;p<m.length;p++){let c=m[p],l=m[(p+1)%m.length],f=a(c),d=a(l);if(f>=0&&s.push(c),f>=0!=d>=0){let u=f/(f-d);s.push([c[0]+(l[0]-c[0])*u,c[1]+(l[1]-c[1])*u])}}}return s.length>=3?Math.abs(Mf(s)):0}var ba=24;function Nr(t,e){let[s,r,i,o]=e,n=t.x+t.w/2,a=t.y+t.h/2,m=[["left",n-s],["right",s+i-n],["top",a-r],["bottom",r+o-a]];m.sort((c,l)=>c[1]-l[1]);let p=m[0][0];return p==="left"?{edge:p,dx:-(t.x+t.w-s)-ba,dy:0}:p==="right"?{edge:p,dx:s+i-t.x+ba,dy:0}:p==="top"?{edge:p,dx:0,dy:-(t.y+t.h-r)-ba}:{edge:p,dx:0,dy:r+o-t.y+ba}}function wa(t,e,s){let r=w=>{let k=0;for(let $=w.parent;$;$=$.parent)k++;return k},i=w=>w.box.x0+w.box.y0+w.box.z0*.01,o=t.items.filter(w=>w.type==="region").sort((w,k)=>r(w)-r(k)||i(w)-i(k)),n=t.items.filter(w=>w.type==="node").sort((w,k)=>i(w)-i(k)||w.box.z0-k.box.z0),a=[],m=Math.min(90,400/Math.max(1,o.length)),p=650;o.forEach((w,k)=>{let $=Gn(Ht(w.box));a.push({id:w.id,kind:"region",...Nr($,s),delay:Math.round(k*m),dur:p,bbox:$})});let c=250+Math.round(m*o.length),l=Math.min(70,700/Math.max(1,n.length)),f=600;n.forEach((w,k)=>{let $=Gn(Ht(w.box));a.push({id:w.id,kind:"node",...Nr($,s),delay:Math.round(c+k*l),dur:f,bbox:$})});let d=n.length?c+(n.length-1)*l:c,u=Math.round(d+300),y=Math.min(30,300/Math.max(1,e.length)),g=400,x=e.filter(w=>w.points.length>=2).map((w,k)=>({id:w.id,delay:Math.round(u+k*y),dur:g})),h={delay:u+200,dur:400},b=Math.max(...a.map(w=>w.delay+w.dur),...x.map(w=>w.delay+w.dur),h.delay+h.dur);return{pieces:a,routes:x,labels:h,total:b}}var _i=["edge","drop","rise","fly","pop","scatter","build","fade"],Fi=["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],Rr=["by-depth","by-layer","by-region","by-flow","as-listed","random"],Ef=["linear","ease","ease-in","ease-out","settle","spring","bounce"],Pn=t=>Math.round(t*100)/100||0,an=t=>Math.round(t*1e4)/1e4||0;function js(t){let e=i=>{let o=0;for(let n=i.parent;n;n=n.parent)o++;return o},s=i=>{let o=[];for(let n=i;n;n=n.parent){let a=(n.region??n.node)?.motion;a&&o.unshift(a)}return o.length?Object.assign({},...o):void 0},r=new Set(t.layout.items.filter(i=>i.region&&t.layout.catalog&&t.rendered.svg.includes(`class="tunnel" data-id="${i.id}"`)).map(i=>i.id));return{viewBox:t.rendered.viewBox,pieces:t.layout.items.map(i=>{let o=i.box,n=Re((o.x0+o.x1)/2,(o.y0+o.y1)/2,o.z0),a=s(i);return{id:i.id,kind:i.type,...i.parent?{parent:i.parent.id}:{},depth:e(i),layer:r.has(i.id)?2:i.type==="region"?0:1,key:Pn(o.x0+o.y0+o.z0*.01),bbox:Gn(Ht(o)),foot:[Pn(n[0]),Pn(n[1])],base:[Re(o.x0,o.y1,o.z0),Re(o.x1,o.y1,o.z0),Re(o.x1,o.y0,o.z0)].map(m=>[Pn(m[0]),Pn(m[1])]),...a?{motion:a}:{}}}),routes:t.routes.filter(i=>t.rendered.paths[i.id]).map(i=>({id:i.id,path:t.rendered.paths[i.id],...hu(i.raw)})),notes:Object.fromEntries((t.raw.notes??[]).map((i,o)=>[`${t.id}-note-${o}`,i.on])),intro:t.rendered.assembly}}var Pf=t=>typeof t=="string"?t.split(".")[0]:void 0,hu=t=>{let e=Pf(t.from),s=Pf(t.to);return{...e?{from:e}:{},...s?{to:s}:{}}},xa=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(m,p,c)=>3*m*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let m=0;m<40;m++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},oc={linear:t=>t,ease:xa(.42,0,.58,1),"ease-in":xa(.42,0,1,1),"ease-out":xa(0,0,.58,1),settle:xa(.16,.84,.3,1),spring:t=>t<=0?0:t>=1?1:1-Math.exp(-6*t)*Math.cos(9.5*t)*(1-t),bounce:t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375}};function cc(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Of=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0},Zn=t=>Math.max(0,Math.min(1,t)),ka=24;function ac(t,e,s){let[r,i,o,n]=e;return s==="left"?[-(t.x+t.w-r)-ka,0]:s==="right"?[r+o-t.x+ka,0]:s==="top"?[0,-(t.y+t.h-i)-ka]:[0,i+n-t.y+ka]}function fc(t,e,s={}){let r=t.pieces,i=new Map(r.map(y=>[y.id,y])),o=(y,g)=>y.depth-g.depth||y.key-g.key;if(e==="as-listed")return[...r];if(e==="random"){let y=cc(s.seed??1);return r.map(g=>[y(),g]).sort((g,x)=>g[0]-x[0]).map(g=>g[1])}if(e==="by-layer")return[...r].sort((y,g)=>y.layer-g.layer||o(y,g));if(e==="by-depth")return[...r].sort((y,g)=>y.key-g.key||y.depth-g.depth);let n=new Map;for(let y of[...r].sort(o)){let g=n.get(y.parent)??[];g.push(y),n.set(y.parent,g)}let a=[],m=new Set,p=y=>{if(m.has(y.id))return;let g=y.parent?i.get(y.parent):void 0;g&&p(g),m.add(y.id),a.push(y)};if(e==="by-region"){let y=g=>{for(let x of n.get(g)??[])p(x),y(x.id)};return y(),a}let c=new Map,l=new Set;for(let y of t.routes)y.from&&y.to&&(c.set(y.from,[...c.get(y.from)??[],y.to]),l.add(y.to));let f=s.source??t.routes.find(y=>y.from&&!l.has(y.from))?.from??t.routes[0]?.from,d=f?[f]:[],u=new Set(d);for(;d.length;){let y=d.shift(),g=i.get(y);g&&p(g);for(let x of c.get(y)??[])u.has(x)||(u.add(x),d.push(x))}for(let y of[...r].sort(o))p(y);return a}var yu={edge:"settle",drop:"settle",rise:"ease-out",fly:"settle",pop:"spring",scatter:"settle",build:"ease-out",fade:"linear",explode:"ease-in","lift-off":"ease-in",sink:"ease-in","fly-out":"ease-in",collapse:"ease-in"},gu={"lift-off":"lift",sink:"rise",scatter:"scatter","fly-out":"edge",fade:"fade",explode:"explode",collapse:"collapse"};function Ir(t,e,s={}){let r=s.seed??1,i=e==="disassemble",o=i&&s.style==="reverse",n=U=>{if(!i)return U.motion?.style??s.style??"edge";let C=U.motion?.out??s.style??"fly-out";return C==="reverse"?U.motion?.style??s.of??"edge":gu[C]},a=U=>i?U.motion?.out??s.style??"fly-out":n(U),m=!i&&!s.order&&s.stagger===void 0&&s.piece===void 0&&s.overlap===void 0&&(s.style??"edge")==="edge",p=s.order??(s.style==="build"?"by-layer":"by-depth"),c=[],l,f,d=(U,C,G)=>{let Z=n(U),Q=U.motion?.easing??s.easing??yu[i&&a(U)!=="reverse"?a(U):Z]??"ease";return{p:U,delay:C+(U.motion?.delay??0),dur:Math.max(1,U.motion?.duration??G),style:Z,curve:oc[Q],from:U.motion?.from??s.from??"left"}};if(m){let U=new Map(t.pieces.map(C=>[C.id,C]));for(let C of t.intro.pieces){let G=U.get(C.id);G&&c.push(d(G,C.delay,C.dur))}l=t.intro.routes.map(C=>({...C})),f={...t.intro.labels}}else{let U=fc(t,p,{seed:r,source:s.source}),C=s.piece??600,G=s.stagger??Math.min(70,900/Math.max(1,U.length)),Z=Zn(s.overlap??.5),Q=o||i?[...U].reverse():U,z=Math.min(30,300/Math.max(1,t.routes.length)),D=400,V=400;if(i){f={delay:0,dur:V};let W=V*(1-Z);l=[...t.routes].reverse().map((H,ne)=>({id:H.id,delay:W+ne*z,dur:D}));let de=Math.max(W,...l.map(H=>H.delay+H.dur)),ce=Math.max(0,de-Z*D);Q.forEach((H,ne)=>c.push(d(H,ce+ne*G,C)))}else{Q.forEach((H,ne)=>c.push(d(H,ne*G,C)));let W=Math.max(0,...c.map(H=>H.delay+H.dur)),de=Math.max(0,W-Z*C);l=t.routes.map((H,ne)=>({id:H.id,delay:de+ne*z,dur:D}));let ce=Math.max(de,...l.map(H=>H.delay+H.dur));f={delay:Math.max(0,ce-Z*V),dur:V}}}let u=s.pulses&&t.routes.length?700:0;if(u&&i)for(let U of[...c,...l,f])U.delay+=u;let y=Math.max(1,...c.map(U=>U.delay+U.dur),...l.map(U=>U.delay+U.dur),f.delay+f.dur),g=i?0:y;u&&!i&&(y+=u);let x=s.duration!==void 0?Math.max(1,s.duration)/y:1;for(let U of[...c,...l,f])U.delay=Pn(U.delay*x),U.dur=Math.max(.01,Pn(U.dur*x));let h=s.duration!==void 0?Math.max(1,s.duration):Math.max(1,Pn(y)),b=new Map(c.map(U=>[U.p.id,U])),w=new Map(l.map(U=>[U.id,U])),[k,$,v,T]=t.viewBox,R=[k+v/2,$+T/2],O=U=>[U.x+U.w/2,U.y+U.h/2],I=(U,C)=>{let G=s.point;if(Array.isArray(G))return G;if(G==="region"||C==="collapse"&&G===void 0&&U.parent){let Z=t.pieces.find(Q=>Q.id===U.parent);return Z?Z.foot:R}if(typeof G=="string"){let Z=t.pieces.find(Q=>Q.id===G);if(Z)return Z.foot}return R};function M(U,C,G){let{p:Z}=U,Q=Z.bbox,z=1-C,D=(V,W)=>({dx:Pn(V*z),dy:Pn(W*z)});switch(U.style){case"drop":return D(...ac(Q,t.viewBox,"top"));case"lift":return D(...ac(Q,t.viewBox,"top"));case"fly":return D(...ac(Q,t.viewBox,U.from));case"rise":{let V=Q.h*z,[W,de,ce]=Z.base,H=Q.y-Q.h-4;return{...D(0,Q.h),clip:[[W[0],W[1]-V],[de[0],de[1]-V],[ce[0],ce[1]-V],[ce[0]+2,H-V],[W[0]-2,H-V]].map(ne=>[Pn(ne[0]),Pn(ne[1])])}}case"pop":return{scale:an(Math.max(0,C)),about:Z.foot,opacity:an(Zn(G*4))};case"scatter":{let V=cc((r^Of(Z.id))>>>0),W=V()*Math.PI*2,de=.35+V()*.65;return{...D(Math.cos(W)*v*de*.6,Math.sin(W)*T*de*.6),opacity:an(Zn(C*1.6))}}case"build":return{...D(0,-18),opacity:an(Zn(C))};case"fade":return{opacity:an(Zn(C))};case"explode":{let V=I(Z,"explode"),W=O(Q),de=W[0]-V[0],ce=W[1]-V[1],H=Math.hypot(de,ce),ne=cc((r^Of(Z.id))>>>0),Ee=ne()*Math.PI*2,qe=H>1?[de/H,ce/H]:[Math.cos(Ee),Math.sin(Ee)],N=Math.hypot(v,T)+Math.max(Q.w,Q.h);return D(qe[0]*N,qe[1]*N)}case"collapse":{let V=I(Z,"collapse");return{...D(V[0]-Z.foot[0],V[1]-Z.foot[1]),scale:an(Math.max(0,C)),about:Z.foot,opacity:an(Zn(C*3))}}default:{let V=Nr(Q,t.viewBox);return D(V.dx,V.dy)}}}let A=(U,C,G)=>{let Z=Zn((U-C)/G);return i?1-Z:Z},P={opacity:0},j=s.connectors??"draw",F=s.labels??"fade",Y=[...t.pieces.map(U=>U.id),...t.routes.map(U=>U.id),...Object.keys(t.notes)];function J(U){let C=Math.max(0,Math.min(h,Number.isFinite(U)?U:0));if(i?C<=0:C>=h)return{};let G=i?C>=h:C<=0,Z={},Q={},z={};for(let ce of c){let H=G?0:A(C,ce.delay,ce.dur);H<=0?Z[ce.p.id]=P:H<1&&(Z[ce.p.id]=M(ce,i?1-ce.curve(1-H):ce.curve(H),H))}for(let ce of t.routes){let H=w.get(ce.id),ne=G||!H?0:A(C,H.delay,H.dur);ne<=0?Q[ce.id]={opacity:0,drawn:0}:ne<1&&(Q[ce.id]=j==="fade"?{opacity:an(ne)}:j==="grow"?{drawn:an(ne),by:"grow"}:{drawn:an(oc["ease-out"](ne))})}let D=G?0:A(C,f.delay,f.dur),V=D<=0?P:D>=1?void 0:F==="type"?{typed:an(D)}:{opacity:an(D)};for(let ce of Y){let H=V;if(F==="with-piece"){let ne=Object.hasOwn(t.notes,ce)?t.notes[ce]:ce,Ee=ne===void 0?void 0:b.get(ne)??w.get(ne);if(Ee){let qe=G?0:A(C,Ee.delay,Ee.dur);H=qe<=0?P:qe>=1?void 0:{opacity:an(qe)}}}H&&(z[ce]=H)}let W=[];if(u&&!G){let ce=(C-g*x)/(u*x);if(ce>0&&ce<1)for(let H of t.routes)W.push({route:H.id,at:an(oc.ease(ce))})}let de=ce=>Object.keys(ce).length>0;return{...de(Z)?{items:Z}:{},...de(z)?{labels:z}:{},...de(Q)?{routes:Q}:{},...D<1?{marks:{opacity:an(Math.max(0,D))}}:{},...W.length?{tokens:W}:{}}}return{kind:e,duration:h,pieces:c.map(U=>({id:U.p.id,delay:U.delay,dur:U.dur,style:a(U.p)})),routes:l,labels:f,at:J}}var xt=t=>{let e=t.toFixed(2);return e==="-0.00"?"0":String(Number(e))},bu=(t,e)=>`translate(${xt(t[0])} ${xt(t[1])}) scale(${Number(e.toFixed(4))}) translate(${xt(-t[0])} ${xt(-t[1])})`,dc=t=>[...t.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map(e=>[Number(e[1]),Number(e[2])]),mc=t=>t.slice(1).reduce((e,s,r)=>e+Math.hypot(s[0]-t[r][0],s[1]-t[r][1]),0);function $a(t,e){let s=dc(t),r=mc(s)*e;for(let i=0;i+1<s.length;i++){let o=Math.hypot(s[i+1][0]-s[i][0],s[i+1][1]-s[i][1]);if(r<=o&&o>0){let n=r/o;return[s[i][0]+(s[i+1][0]-s[i][0])*n,s[i][1]+(s[i+1][1]-s[i][1])*n]}r-=o}return s[s.length-1]??[0,0]}function wu(t,e){let s=dc(t),r=$a(t,e),i=[],o=mc(s)*e;for(let n=0;n<s.length;n++){i.push(s[n]);let a=n+1<s.length?Math.hypot(s[n+1][0]-s[n][0],s[n+1][1]-s[n][1]):1/0;if(o<=a)break;o-=a}return"M"+[...i,r].map(n=>`${xt(n[0])},${xt(n[1])}`).join(" L")}var ps=t=>String(Number(t.toFixed(4)));function xu(t,e){let s=t.match(/&[^;\s]+;|[\s\S]/gu)??[];return s.slice(0,Math.round(s.length*e)).join("")}function ku(t){let e=[];return(t.dx||t.dy)&&e.push(`translate(${xt(t.dx??0)} ${xt(t.dy??0)})`),t.scale!==void 0&&t.scale!==1&&e.push(bu(t.about??[0,0],t.scale)),{attrs:{...t.opacity===void 0||t.opacity===1?{}:{opacity:ps(t.opacity)},...e.length?{transform:e.join(" ")}:{}},clip:t.clip}}function $u(t,e){let s={attrs:t.opacity===void 0||t.opacity===1?{}:{opacity:ps(t.opacity)}};if(t.drawn!==void 0&&t.drawn<1&&e!==void 0){let r=Zn(t.drawn),i=mc(dc(e));s.path=t.by==="grow"?{d:wu(e,r),head:!1}:{style:`stroke-dasharray:${xt(i)} ${xt(i)};stroke-dashoffset:${xt(i*(1-r))}`,head:!1}}else t.ants&&(s.path={style:`stroke-dasharray:${xt(t.ants.dash[0])} ${xt(t.ants.dash[1])};stroke-dashoffset:${xt(-t.ants.offset)}`,head:!0});return s}function Nf(t,e,s,r,i){if(r==="label"||r==="note"){let n=t.labels&&Object.hasOwn(t.labels,s)?t.labels[s]:void 0;return n&&{attrs:{...n.opacity===void 0||n.opacity===1?{}:{opacity:ps(n.opacity)},...n.dx||n.dy?{transform:`translate(${xt(n.dx??0)} ${xt(n.dy??0)})`}:{}},...n.typed===void 0||n.typed>=1?{}:{typed:n.typed}}}if(e==="route"){let n=t.routes&&Object.hasOwn(t.routes,s)?t.routes[s]:void 0;return n&&$u(n,i(s))}let o=t.items&&Object.hasOwn(t.items,s)?t.items[s]:void 0;return o&&ku(o)}function Rf(t,e,s){let r=[];for(let i of t.outlines??[])r.push(["polygon",{points:i.points.map(o=>o.map(xt).join(",")).join(" "),class:"ring",fill:"none","stroke-width":"2.5","stroke-linejoin":"round",...i.opacity===void 0?{}:{opacity:ps(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"var(--ring,var(--control,currentColor))"}`}}]);for(let i of t.pulses??[])r.push(["ellipse",{cx:xt(i.x),cy:xt(i.y),rx:xt(i.rx),ry:xt(i.ry),class:"ring",fill:"none","stroke-width":"2.5",...i.opacity===void 0?{}:{opacity:ps(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"currentColor"}`}}]);for(let i of t.tokens??[]){let o=e(i.route);if(o===void 0)continue;let[n,a]=$a(o,Zn(i.at));r.push(["circle",{cx:xt(n),cy:xt(a),r:"7",class:"tok",...s?{fill:i.color??(i.kind!==void 0?s.kinds?.[i.kind]:void 0)??s.control,stroke:s.surface,"stroke-width":"2.5"}:{style:`fill:${i.color??(i.kind!==void 0?`var(--${i.kind},var(--control,currentColor))`:"var(--control,currentColor)")}`}}])}return r}var If=t=>Object.keys(t).every(e=>e==="morph"||t[e]===void 0),zf=new Set(["marks","badges"]),Af=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,""");function pc(t){let e=new Map,s=[];for(let r of t.matchAll(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>/g)){if(r[1]){let n=s.pop();n?.key!==void 0&&e.set(n.key,[n.from,r.index]);continue}if(r[4])continue;let i=/\sdata-item="([^"]*)"/.exec(r[3])?.[1],o=/\sdata-part="([^"]*)"/.exec(r[3])?.[1];s.push({...s.length===2&&i!==void 0&&o!==void 0?{key:`${jf(i)}
|
|
143
|
-
${o}`}:{},from:r.index+r[0].length})}return e}var
|
|
144
|
-
`)[0]]?.includes(e)&&t.svg.slice(...p)!==i.slice(a,
|
|
145
|
-
${s}`):void 0;a!==void 0&&i.push([a,n])}return i.length?{own:
|
|
146
|
-
`),p=Object.hasOwn(e,a)?Cf(t,a,m,e[a]):void 0;p&&(s+=t.svg.slice(r,o)+vu(t.svg.slice(o,n),p),r=n)}return s+t.svg.slice(r)}function Di(t,e){if(If(e))return t.rendered.svg;let s=e.variants?Mu(t.rendered,e.variants):t.rendered.svg,r=l=>Object.hasOwn(t.rendered.paths,l)?t.rendered.paths[l]:void 0,i=0,o="",n="",a=0,m,p=s.replace(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,(l,f,d,u,y,g)=>{if(g!==void 0)return m?.w.typed===void 0?l:xu(g,m.w.typed);if(f)return i--,m&&i===m.at&&(m=void 0),i===1&&(o=""),l;let x=i;y||i++;let h={};for(let[,b,w]of u.matchAll(/([\w:-]+)="([^"]*)"/g))h[b]=w;if(x===0){if(!e.camera)return l;h.viewBox=e.camera.map(xt).join(" ")}else if(x===1)if(o=d==="g"&&h.class?.startsWith("g-")?h.class.slice(2):"",zf.has(o)&&e.marks&&e.marks.opacity!==1)h.opacity=ps(e.marks.opacity);else return l;else if(x===2&&h["data-part"]!==void 0){let b=h["data-route"]===void 0?"item":"route",w=jf(h["data-route"]??h["data-item"]??""),k=Nf(e,b,w,h["data-part"],r);if(!k)return l;for(let[$,v]of Object.entries(k.attrs))h[$]=Af(v);if(k.clip){let $=`${t.id}-mc${a++}`;n+=`<clipPath id="${$}"><polygon points="${k.clip.map(v=>v.join(",")).join(" ")}"/></clipPath>`,h["clip-path"]=`url(#${$})`}if(!y&&(k.path||k.typed!==void 0)&&(m={at:x,w:k}),!Object.keys(k.attrs).length&&!k.clip)return l}else if(m?.w.path&&d==="path"&&h.class?.split(" ")[0]==="flow"){let b=m.w.path;b.d!==void 0&&(h.d=b.d),b.style!==void 0&&(h.style=b.style),b.head||delete h["marker-end"]}else return l;return`<${d}${Object.entries(h).map(([b,w])=>` ${b}="${w}"`).join("")}${y?"/":""}>`});n&&(p=p.replace(/<defs>|<defs\/>/,l=>l==="<defs/>"?`<defs>${n}</defs>`:l+n));let c=Rf(e,r,t.rendered.inks);return c.length&&(p=p.replace('<g class="g-anim">',l=>l+c.map(([f,d])=>`<${f}${Object.entries(d).map(([u,y])=>` ${u}="${Af(y)}"`).join("")}/>`).join(""))),p}var jf=t=>t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&"),lc=new WeakMap;function Lf(t,e,s){let r=lc.get(t);if(r){for(let[x,h]of r.mixed)x.replaceChildren(...h);for(let[x,h]of r.attrs)for(let[b,w]of h)w===null?x.removeAttribute(b):x.setAttribute(b,w);for(let[x,h,b]of r.gone.reverse())h.insertBefore(x,b);for(let[x,h]of r.texts)x.data=h;for(let x of r.made)x.remove();lc.delete(t)}if(If(e))return;let i={attrs:new Map,texts:new Map,gone:[],made:[],mixed:[]};lc.set(t,i);let o=(x,h,b)=>{let w=i.attrs.get(x)??new Map;w.has(h)||w.set(h,x.getAttribute(h)),i.attrs.set(x,w),b===null?x.removeAttribute(h):x.setAttribute(h,b)},n=t.ownerDocument,a=(x,h,b)=>{let w=n.createElementNS("http://www.w3.org/2000/svg",x);for(let[k,$]of Object.entries(h))w.setAttribute(k,$);return b.append(w),i.made.push(w),w},m=Array.from(t.children),p=x=>m.find(h=>h.getAttribute("class")===`g-${x}`),c=new Map;for(let x of Array.from(p("flows")?.children??[])){let h=x.getAttribute("data-route"),b=x.querySelector("path.flow")?.getAttribute("d");h!==null&&b&&c.set(h,b)}let l=x=>c.get(x);e.camera&&o(t,"viewBox",e.camera.map(xt).join(" "));for(let x of zf){let h=p(x);h&&e.marks&&e.marks.opacity!==1&&o(h,"opacity",ps(e.marks.opacity))}let f=0,d=m.find(x=>x.localName==="defs"),u=d?.firstChild??null,y=t.getAttribute("data-scene")??"scene";for(let x of m)for(let h of Array.from(x.children)){let b=h.getAttribute("data-part");if(b===null)continue;let w=h.getAttribute("data-route"),k=w===null?h.getAttribute("data-item")??"":"",$=s&&e.variants&&Object.hasOwn(e.variants,k)?Cf(s,k,b,e.variants[k]):void 0;if($){let R=Array.from(h.childNodes),O=(M,A)=>{let P=n.createElementNS("http://www.w3.org/2000/svg","g");return P.setAttribute("opacity",ps(M)),P.append(...A),P},I=M=>Array.from(n.importNode(new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${M}</svg>`,"image/svg+xml").documentElement,!0).childNodes);i.mixed.push([h,R]),h.replaceChildren(...$.own>0?[O($.own,R)]:[],...$.looks.map(([M,A])=>O(A,I(M))))}let v=Nf(e,w===null?"item":"route",w??h.getAttribute("data-item")??"",b,l);if(!v)continue;for(let[R,O]of Object.entries(v.attrs))o(h,R,O);if(v.clip&&d){let R=a("clipPath",{id:`${y}-mc${f++}`},d);d.insertBefore(R,u);let O=n.createElementNS("http://www.w3.org/2000/svg","polygon");O.setAttribute("points",v.clip.map(I=>I.join(",")).join(" ")),R.append(O),o(h,"clip-path",`url(#${R.id})`)}if(v.typed!==void 0){let R=[];for(let O=n.createTreeWalker(h,4);O.nextNode();)R.push(O.currentNode);for(let O of R)i.texts.set(O,O.data),O.data=Array.from(O.data).slice(0,Math.round(Array.from(O.data).length*v.typed)).join(""),O.data||(i.gone.push([O,O.parentNode,O.nextSibling]),O.remove())}let T=v.path&&h.querySelector("path.flow");T&&v.path&&(v.path.d!==void 0&&o(T,"d",v.path.d),v.path.style!==void 0&&o(T,"style",v.path.style),v.path.head||o(T,"marker-end",null))}let g=p("anim");if(g)for(let[x,h]of Rf(e,l))a(x,h,g)}var _f=(t,e)=>({...e,frame:s=>Di(t,e.at(s))}),uc=(t,e={})=>_f(t,Ir(js(t),"assemble",e)),Ff=(t,e={})=>_f(t,Ir(js(t),"disassemble",e)),Df=(t,e)=>uc(t).frame(e);var Pa=(t,e)=>e.role??Pt(t,e.kind)?.role,Sa=(t,e)=>Pt(t,e.region.kind)?.shape,wn=(t,e,s,r="item")=>s?ve("g",{[`data-${r}`]:t,"data-part":e},s):"";function zr({scene:t,layout:e,routes:s,steps:r,theme:i,id:o,gridStep:n=1}){let a=new fr,m={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},p=new er;p.budget.spots=Ma;let c=P=>r.vis[P]?{"data-vis":"1"}:{},l=e.items.filter(P=>P.type==="region"),f=P=>{let j=0;for(let F=P.parent;F;F=F.parent)j++;return j},d=e.catalog,u=l.filter(P=>Sa(d,P)!=="walled"&&Sa(d,P)!=="tunnel"),y=ci(u.map(P=>({box:P.box,r:P}))).map(P=>P.r).sort((P,j)=>f(P)-f(j));for(let P of y)m.base+=Ou(a,d,P,c(P.id),n);for(let P of l.filter(j=>Sa(d,j)==="walled")){for(let F of va(P))p.solids.push(Ht(F));for(let[F,Y]of va(P).entries())m.blocks.push({box:Y,svg:wn(P.id,`wall-${F+1}`,ve("g",{class:`blk k-${Pa(d,P.region)} wall${P.region.ghost?" ghost":""}`,"data-id":P.id,"data-dim":"1",...c(P.id)},a.blockFaces(Y)))});let j=P.region.gate;if(j&&!j.node){let F=Ii(P,j.height??(P.region.height??.8)+.3,.3,.3);p.solids.push(Ht(F)),m.blocks.push({box:F,svg:wn(P.id,"gate",ve("g",{class:"blk k-gate","data-id":P.id,...c(P.id)},a.blockFaces(F)))})}P.region.label&&(P.region["label-style"]??"face")!=="none"&&(m.labels+=wn(P.id,"name",a.faceText(P.box.x0+.3,P.box.y1,P.box.z0+.13,P.region.label,"slabname sm fz",wt.sm,"left","start",{"data-id":P.id,...c(P.id)})))}for(let P of l.filter(j=>Sa(d,j)==="tunnel"))m.air+=wn(P.id,"block",Tu(a,P,c(P.id)));let g=e.items.filter(P=>P.type==="node");for(let P of g){let j=P.node,F=Mn(d,j.asset),Y=j.ghost||(j.deco??[]).includes("ghost"),J=["blk",`k-${j.role??F.role}`,F.cls,Y?"ghost":""].filter(Boolean).join(" ");m.blocks.push({box:P.box,svg:wn(P.id,"block",ve("g",{class:J,"data-id":P.id,"data-dim":"1",...c(P.id)},F.draw(a,P.box,j)))}),p.polys.push({poly:Ht(P.box),owner:P.id}),p.solids.push(Ht(P.box))}let x=ci(m.blocks).map(P=>P.svg).join(""),h=new Set,b={};for(let P of s){if(P.points.length<2)continue;let j=P.points.map(J=>Re(J[0],J[1],J[2]));j.forEach(J=>a.bounds.add(J));let F="M"+j.map(Gs).join(" L");b[P.id]=F;let Y=P.raw.arrow!==!1;Y&&h.add(P.kind),m.flows+=wn(P.id,"line",ve("g",{"data-hl":P.id,"data-id":P.id,...c(P.id)},ve("path",{d:F,class:`flow f-${P.kind}`,"marker-end":Y?`url(#ah-${o}-${P.kind})`:void 0})),"route"),p.lines.push({pts:j,owner:P.id})}for(let P of h)a.def(`ah-${o}-${P}`,ve("marker",{id:`ah-${o}-${P}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},ve("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${as(i,i.kinds[P]?.color??"control")}`})));for(let P of a.planePolys)p.slants.push(P);let w=g.filter(P=>P.node.label||P.node.sub).sort((P,j)=>(j.box.x1-j.box.x0)*(j.box.y1-j.box.y0)-(P.box.x1-P.box.x0)*(P.box.y1-P.box.y0));for(let P of w)m.labels+=wn(P.id,"label",Au(a,d,P,p,c(P.id)));let k=[];for(let P of s)if(P.raw.label&&P.points.length>=2){let j=Eu(a,P,p,c(P.id),e);m.floor+=wn(P.id,"label",j.svg,"route"),j.warning&&k.push({path:`${P.path}/label`,message:j.warning}),p.budget.over&&!p.budget.told&&(p.budget.told=!0,k.push({path:P.path,message:`from route "${P.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${Ma.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((P,j)=>{let F=wn(`${o}-note-${j}`,"note",Nu(a,P,e,s,`${o}-note-${j}`));P.floor?m.floor+=F:m.labels+=F});let $=[],v=new Map;for(let P of r.says){let j=v.get(P.step)??p.fork();v.set(P.step,j);let F=Sn(P.text,wt.say)+18,Y=ga(F,P.ax,P.ay,{x:P.x,y:P.y,anchor:P.anchor},j);j.rects.push({r:Y.rect,owner:""}),$.push({step:P.step,...Y.rect,text:P.text});let J=Y.rect.x+2;a.bounds.addRect(Y.rect.x,Y.rect.y,Y.rect.w,Y.rect.h);let U=as(i,i.kinds[P.kind]?.color??"control");m.marks+=ve("g",{class:"say","data-step":P.step},ve("rect",{x:J,y:Y.y-12,width:F,height:24,rx:12,style:`stroke:${U}`})+ve("text",{x:J+F/2,y:Y.y+4,"text-anchor":"middle",style:`fill:${U}`},St(P.text)))}for(let P of r.marks){let[j,F]=Re(...P.p);a.bounds.addRect(j-12,F-12,24,24),m.marks+=ve("g",{class:"xm","data-step":P.step,"data-hl":P.on},ve("circle",{cx:j,cy:F,r:10})+ve("path",{d:`M${bt(j-4.5)},${bt(F-4.5)} L${bt(j+4.5)},${bt(F+4.5)} M${bt(j+4.5)},${bt(F-4.5)} L${bt(j-4.5)},${bt(F+4.5)}`}))}for(let P of r.badges){let[j,F]=Re(...P.p);a.bounds.addRect(j-13,F-13,26,26),m.badges+=ve("g",{class:`badge c-${P.kind}`,"data-go":P.step,"data-badge":P.step,tabindex:"0",role:"button","aria-label":`Step ${P.num}`},ve("circle",{cx:j,cy:F,r:11.5})+ve("text",{x:j,y:F+.5},String(P.num)))}let T=a.bounds,R=22,O=T.empty?[0,0,100,100]:[Math.floor(T.x0-R),Math.floor(T.y0-R),Math.ceil(T.x1-T.x0+R*2),Math.ceil(T.y1-T.y0+R*2)],I=[...a.defs.values()].join(""),M=(P,j)=>ve("g",{class:"g-"+P},j);return{svg:ve("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:O.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},ve("defs",{},I)+M("base",m.base)+M("floor",m.floor)+M("flows",m.flows)+M("blocks",x)+M("air",m.air)+M("labels",m.labels)+M("marks",m.marks)+M("badges",m.badges)+M("anim","")),viewBox:O,texts:a.texts,paths:b,warnings:k,callouts:$,assembly:wa(e,s,O)}}function Pu(t,e){let s=t.z1+.002,r=1e-6,i=[],o=(n,a)=>{let m=Re(n[0],n[1],s),p=Re(a[0],a[1],s);i.push(`M${Gs(m)}L${Gs(p)}`)};for(let n=Math.ceil((t.x0+r)/e)*e;n<t.x1-r;n+=e)o([n,t.y0],[n,t.y1]);for(let n=Math.ceil((t.y0+r)/e)*e;n<t.y1-r;n+=e)o([t.x0,n],[t.x1,n]);return i.length?ve("path",{class:"grid",d:i.join("")}):""}function Ou(t,e,s,r,i=1){let o=s.region,n=s.box,a=Pa(e,o),m=Pt(e,o.kind),p=m?.shape,c={"data-id":s.id,"data-dim":"1",...r},l="";p==="cloud"?l=ve("g",{class:`blk k-${a} cloud`,...c},Pr(t,n)):p==="zone"?l=ve("g",{class:`zone k-${a}`,...c},t.poly([[n.x0,n.y0,n.z1],[n.x1,n.y0,n.z1],[n.x1,n.y1,n.z1],[n.x0,n.y1,n.z1]])):l=ve("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...c},t.blockFaces(n)+Pu(n,i)),l=wn(s.id,"block",l);let f=o["label-style"]??m?.labelStyle;if(o.label&&f!=="none")if(f==="face"){let d=n.z1-n.z0,u=h=>h.size*.73/lt,y=p==="slab"&&.28+u(wt.slabname)+.08>d,g=p==="slab"&&!y,x=g?n.z0+.28:y?n.z0+Math.max(.02,(d-u(wt.sm))/2):n.z0+Math.min(.1,d*.25);l+=wn(s.id,"name",ve("g",c,t.faceText(n.x0+(g?.6:.3),n.y1,x,o.label,g?"slabname":"slabname sm",g?wt.slabname:wt.sm,"left","start")))}else if(f==="face-right")l+=wn(s.id,"name",ve("g",c,t.faceText(n.x1,n.y0+.6,n.z0+Math.max(.14,(n.z1-n.z0)*.2),o.label,"slabname",wt.slabname,"right","end")));else{let d=p==="cloud"?"middle":"start",u=p==="cloud"?(n.x0+n.x1)/2:n.x0+.35,y=p==="cloud"?(n.y0+n.y1)/2:n.y1-.35;l+=wn(s.id,"name",ve("g",c,t.floorText(u,y,n.z1+.01,o.label,"slabname sm","x",d)))}return l}function va(t){let{x0:e,y0:s,x1:r,y1:i,z0:o,z1:n}=t.box,a=ls,m=t.region.gate,p=[],c=f=>{f.x1-f.x0>1e-6&&f.y1-f.y0>1e-6&&p.push({...f,z0:o,z1:n})},l=(f,d,u)=>{if(!m||m.side!==u)return[[f,d]];let y=m.at??.5,g=m.width??2,x=u==="e"||u==="w"?s+(i-s)*y:e+(r-e)*y;return[[f,x-g/2],[x+g/2,d]]};for(let[f,d]of l(e,r,"n"))c({x0:f,y0:s,x1:d,y1:s+a});for(let[f,d]of l(s+a,i-a,"w"))c({x0:e,y0:f,x1:e+a,y1:d});for(let[f,d]of l(s+a,i-a,"e"))c({x0:r-a,y0:f,x1:r,y1:d});for(let[f,d]of l(e,r,"s"))c({x0:f,y0:i-a,x1:d,y1:i});return p}function Au(t,e,s,r,i){let o=s.node,n=Mn(e,o.asset),a=s.box,m={name:o.label,sub:o.sub},p=o["label-at"],c;if(p){let f=Gn(Ht(a)),d=p.side??"above",u=f.y+Math.min(f.h,60)*.45;d==="right"?c={x:f.x+f.w+8,y:u,anchor:"start"}:d==="left"?c={x:f.x-8,y:u,anchor:"end"}:d==="below"?c={x:f.x+f.w/2,y:f.y+f.h+14,anchor:"middle"}:c=Li(m,a,Ht(a),new er,s.id),c={...c,x:c.x+(p.dx??0),y:c.y+(p.dy??0)}}else{let f=n.label?n.label(a,o,!!o.sub):void 0;c=Li(m,a,Ht(a),r,s.id,f)}r.rects.push({r:ji(m,c.x,c.y,c.anchor),owner:""});let l="";return o.label&&(l+=t.text(c.x,c.y,o.label,"lbl",wt.lbl,c.anchor,{},s.id)),o.sub&&(l+=t.text(c.x,o.label?c.y+14:c.y,o.sub,"sub mono",wt.sub,c.anchor,{},s.id)),ve("g",{"data-id":s.id,"data-dim":"1",...i},l)}function Tu(t,e,s){let{x0:r,y0:i,x1:o,y1:n,z0:a,z1:m}=e.box,p=t.blockFaces(e.box),c=o-r>=n-i,l=Math.max(1,Math.round((c?o-r:n-i)/1.6));for(let d=1;d<l;d++){let u=c?r+(o-r)*d/l:i+(n-i)*d/l;p+=t.poly(c?[[u,i,m],[u,n,m],[u,n,a]]:[[r,u,m],[o,u,m],[o,u,a]],"rib")}let f=e.region.label;return f&&e.region["label-style"]!=="none"&&(p+=c?t.faceText(r+.35,n,a+.14,f,"tunname",wt.tunname,"left","start"):t.faceText(o,n-.35,a+.18,f,"tunname",wt.tunname,"right","start")),ve("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...s},p)}var Ma=2e4;function Eu(t,e,s,r,i){let o=typeof e.raw.label=="string"?{text:e.raw.label}:e.raw.label,n=`floor mono t-${e.kind}`,a={"data-hl":e.id,...r},m=wt.floor;if(o.at){let h=o.at.length>2?o.at[2]:e.points[0][2];return{svg:t.floorText(o.at[0],o.at[1],h,o.text,n,o.dir??"x",o.anchor??"start",a)}}let p=e.points,c=[];for(let h=0;h+1<p.length;h++){let b=p[h],w=p[h+1];Math.abs(b[2]-w[2])>1e-6||c.push({i:h,len:Math.hypot(w[0]-b[0],w[1]-b[1])})}if(!c.length)return{svg:"",warning:`label "${o.text}" of route "${e.id}" was dropped: the route has no level segment`};let l=o.along?c.filter(h=>h.i===Math.min(o.along-1,p.length-2)):[...c].sort((h,b)=>b.len-h.len),f=.22,d=11/lt,u=h=>{let b=Sn(h,m)/lt,w,k=1/0,$=0;e:for(let v of l.length?l:c){let T=p[v.i],R=p[v.i+1],O=T[2],I=Math.abs(T[1]-R[1])<1e-6,M=I?Math.min(T[0],R[0]):Math.min(T[1],R[1]),A=I?Math.max(T[0],R[0]):Math.max(T[1],R[1]),P=I?T[1]:T[0],j=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],F=[];for(let Y=M+.3;Y<=Math.max(M+.3,A-b-.2)+1e-9;Y+=.4)F.push(Y);for(let Y=A-b-.2+.4;Y<A+.5&&A-M<b+.5;Y+=.6)F.push(Y);for(let Y of j)for(let J of F){if(k<=$*.5)break e;let U=Y<0?P-f:P+f+d,C,G,Z;if(I?(C=J,G=U,Z=[Re(C,G-d,O),Re(C+b,G-d,O),Re(C+b,G,O),Re(C,G,O)]):(C=U,G=J+b,Z=[Re(C-d,G,O),Re(C-d,G-b,O),Re(C,G-b,O),Re(C,G,O)]),(I?[[C,G-d],[C+b,G-d],[C+b,G],[C,G]]:[[C-d,G],[C-d,G-b],[C,G-b],[C,G]]).some(([de,ce])=>Math.abs(Ar(i,de,ce)+.01-O)>.001)){$++;continue}let z=s.hiddenPoly(Z),D=z*50+$*.5,V=s.budget.spots-- >0;V||(s.budget.over=!0);let W=D>=k?1/0:V?D+s.costPoly(Z,k-D):D;$++,W<k&&(k=W,w={x:C,y:G,z:O,dir:I?"x":"y",rect:Gn(Z),poly:Z,hidden:z})}}return w&&w.hidden<6?w:void 0},y=o.text,g=u(y),x;if(!g){let h=o.text.split(/(\s+)/);for(let b=h.length-1;b>0&&!g;b--){let w=h.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(w.length<6)break;let k=u(w);k&&(g=k,y=w)}x=g?`label of route "${e.id}" shortened to "${y}": no clear floor for the whole text`:`label "${o.text}" of route "${e.id}" was dropped: blocks cover every spot beside it`,g?x+='; give it "along", "side" or "at", or move the nodes apart':x+='; give it "at: [x, y]", or move the nodes apart'}return g?(s.slants.push(g.poly),{svg:t.floorText(g.x,g.y,g.z+.01,y,n,g.dir,"start",a),warning:x}):{svg:"",warning:x}}function Nu(t,e,s,r,i){let o=e.on?r.find(c=>c.id===e.on):void 0,n=e.on&&!o?s.byId.get(e.on):void 0,a=e.at,m={"data-id":i,"data-hl":o?.id,"data-dim":o?void 0:"1"},p=e.kind??o?.kind??"control";if(e.floor){let c=a&&a.length>2?a[2]:o?o.points[0][2]:n?n.floor:.36,[l,f]=a?[a[0],a[1]]:o?[o.points[0][0]+.35,o.points[0][1]-.25]:n?[n.box.x0+.3,n.box.y1-.3]:[0,0];return t.floorText(l,f,c+.01,e.floor,`floor mono t-${p}`,e.dir??"x",e.anchor??"start",m)}if(e.face){let c=n?.box,[l,f,d]=a?[a[0],a[1],a[2]??.45]:c?[c.x0+.3,c.y1,c.z0+.13]:[0,0,0];return t.faceText(l,f,d,e.face,"slabname sm",wt.sm,"left",e.anchor??"start",m)}if(e.label||e.sub){let c=n?.box,l=a?[a[0],a[1],a[2]??.36]:c?[(c.x0+c.x1)/2,(c.y0+c.y1)/2,c.z1+.75]:[0,0,0],[f,d]=Re(l[0],l[1],l[2]),u=f+(e.dx??0),y=d-18+(e.dy??0),g=e.anchor??"middle",x="";return e.label&&(x+=t.text(u,y,e.label,"lbl",wt.lbl,g)),e.sub&&(x+=t.text(u,e.label?y+14:y,e.sub,"sub mono",wt.sub,g)),ve("g",m,x)}return""}function Oa(t,e){let s={};for(let r of t.layout.items){let i=(r.region??r.node)?.variants;i&&(s[r.id]=Object.keys(i))}Object.keys(s).length&&(t.rendered.looks=s,t.rendered.variants=Object.fromEntries([...new Set(Object.values(s).flat())].map(r=>[r,zr({scene:t.raw,routes:t.routes,steps:t.steps,theme:e,id:t.raw.id,gridStep:t.grid.step??t.grid.snap??1,layout:{...t.layout,items:t.layout.items.map(i=>{let o=(i.region??i.node)?.variants?.[r];return o?i.region?{...i,region:{...i.region,...o,deco:void 0}}:{...i,node:{...i.node,...o}}:i})}}).svg])))}var Bi=29.09090909090909,hc={solid:[9,7],dashed:[7,6],dotted:[3,6]},yc=["blocked","planned"],Bf=`
|
|
140
|
+
`)}function Nd(t){return t.split("/").slice(1).map(e=>{let s=e.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(s)?Number(s):s})}function ca(t){let e=new Qs,s=oa(t,{lineCounter:e,prettyErrors:!1,uniqueKeys:!0}),r=[],i=f=>{let p=e.linePos(f);return{line:p.line,col:p.col}};for(let f of s.errors){let p=i(f.pos[0]),c=f.message.split(`
|
|
141
|
+
`)[0],l=/Nested mappings|Implicit keys|mapping values/i.test(c)?`text that contains ": " (a colon followed by a blank) must be in quotes, e.g. command: 'send "a: b"'`:/Map keys must be unique/i.test(c)?"a key is written twice in the same map":void 0;r.push({severity:"error",message:`YAML: ${c}`,line:p.line,col:p.col,path:"",hint:l})}for(let f of s.warnings){let p=i(f.pos[0]);r.push({severity:"warning",message:`YAML: ${f.message.split(`
|
|
142
|
+
`)[0]}`,line:p.line,col:p.col,path:""})}function o(f,p={}){let c=Nd(f),l=s.contents,d={line:1,col:1},m=h=>{let y=h?.range;y&&(d=i(y[0]))};m(l);for(let h=0;h<c.length;h++){let y=c[h];if(pn(l)){let g=l.items.find(k=>Xe(k)&&Ge(k.key)&&String(k.key.value)===String(y));if(!g)break;if(p.key&&h===c.length-1)return m(g.key),d;m(g.key),l=g.value,l&&m(l)}else if(dn(l)&&typeof y=="number"){if(l=l.items[y],!l)break;m(l)}else break}return d}function n(f){let p=s.contents;for(let m of Nd(f)){if(pn(p)){let h=p.items.find(y=>Xe(y)&&Ge(y.key)&&String(y.key.value)===String(m));if(!h)return;p=h.value}else if(dn(p)&&typeof m=="number")p=p.items[m];else return;if(!p)return}let c=p.range;if(!c)return;let l=e.linePos(Math.max(c[0],c[1]-1)).line,d=t.split(/\r?\n/);for(;l>e.linePos(c[0]).line&&/^\s*(#.*)?$/.test(d[l-1]??"");)l--;return{start:e.linePos(c[0]).line,end:l}}let a=null;return s.errors.length||(a=s.toJS({maxAliasCount:100})),{data:a,locate:o,span:n,diags:r}}var Au=new Set(["svg","g","defs","marker","symbol","title","desc","path","polygon","polyline","line","rect","circle","ellipse","text","tspan","linearGradient","radialGradient","stop","clipPath"]),Tu=new Set(["id","class","role","transform","viewBox","width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","fx","fy","d","points","offset","gradientUnits","gradientTransform","markerWidth","markerHeight","refX","refY","orient","markerUnits","text-anchor","dominant-baseline","font-size","font-weight","letter-spacing","fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","stop-color","stop-opacity","marker-start","marker-mid","marker-end","clip-path","preserveAspectRatio","vector-effect","paint-order","style"]),Eu=new Set(["fill","stroke","marker-start","marker-mid","marker-end","clip-path","style"]),Nu={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"},Rd=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,s)=>Nu[s]);function lc(t,e){return t.startsWith("data-")||t.startsWith("aria-")?/^[a-z][\w-]*$/.test(t):!(!Tu.has(t)||Eu.has(t)&&/url\(\s*(?!['"]?#)|javascript:|expression\(|@import/i.test(e))}function cc(t){let e={name:"#root",attrs:[],children:[]},s=[{node:e,dropped:!1}],r=/<(?:!--)[\s\S]*?-->|<\/([a-zA-Z][\w:-]*)\s*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,i,o=0;for(;i=r.exec(t);){if(i.index!==o)throw new Error(`not the renderer's SVG at ${o}: ${JSON.stringify(t.slice(o,o+40))}`);o=r.lastIndex;let n=s[s.length-1];if(i[0].charAt(1)!=="!"){if(i[1]){if(s.length<2||n.node.name!==i[1])throw new Error(`a stray </${i[1]}>`);s.pop();continue}if(i[2]){let a=i[2],f=[];for(let l of i[3].matchAll(/([\w:-]+)="([^"]*)"/g)){let d=l[1],m=Rd(l[2]);d==="xmlns"||d.startsWith("xmlns:")||lc(d,m)&&f.push([d,m])}let p={name:a,attrs:f,children:[]},c=n.dropped||!Au.has(a);c||n.node.children.push(p),i[4]||s.push({node:p,dropped:c});continue}!n.dropped&&i[5].trim()&&n.node.children.push(Rd(i[5]))}}if(o!==t.length)throw new Error(`not the renderer's SVG at ${o}`);if(s.length!==1)throw new Error(`<${s[s.length-1].node.name}> is never closed`);return e}var Ru="http://www.w3.org/2000/svg",Id=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function zd(t,e=document){let s=i=>{let o=e.createElementNS(Ru,i.name);for(let[n,a]of i.attrs)n==="style"?o.style.cssText=Id(a):o.setAttribute(n,/var\(--/.test(a)?Id(a):a);for(let n of i.children)o.append(typeof n=="string"?e.createTextNode(n):s(n));return o},r=cc(t).children.find(i=>typeof i!="string"&&i.name==="svg");if(!r)throw new Error("the drawing has no <svg>");return s(r)}var Iu=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ii=class t{name;attrs=[];children=[];style={};constructor(e){this.name=e}setAttribute(e,s){let r=this.attrs.findIndex(i=>i[0]===e);r>=0?this.attrs[r][1]=String(s):this.attrs.push([e,String(s)])}getAttribute(e){return this.attrs.find(s=>s[0]===e)?.[1]??null}append(...e){for(let s of e)s!=null&&this.children.push(s)}set textContent(e){this.children=[String(e)]}get textContent(){return this.children.map(e=>typeof e=="string"?e:e.textContent).join("")}toNode(){let e=Object.entries(this.style).filter(([,s])=>s!==""&&s!==void 0).map(([s,r])=>`${Iu(s)}:${r}`).join(";");return{name:this.name,attrs:e?[...this.attrs,["style",e]]:[...this.attrs],children:this.children.map(s=>s instanceof t?s.toNode():s)}}},Cd={createElementNS:(t,e)=>new Ii(e)},jd=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),zu=t=>jd(t).replace(/"/g,""");function pa(t,e=new Set(["style"])){if(typeof t=="string")return jd(t);let s=t.attrs.map(([i,o])=>` ${i}="${zu(o)}"`).join("");if(!t.children.length)return`<${t.name}${s}/>`;let r=e.has(t.name)?t.children.map(i=>typeof i=="string"?i.replace(/<\//g,"<\\/"):pa(i,e)).join(""):t.children.map(i=>pa(i,e)).join("");return`<${t.name}${s}>${r}</${t.name}>`}var Cu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function pc(t){let e=new TextEncoder().encode(t),s=e.length,r=Math.ceil((s+9)/64),i=new Uint8Array(r*64);i.set(e),i[s]=128;let o=new DataView(i.buffer);o.setUint32(i.length-4,s*8>>>0),o.setUint32(i.length-8,Math.floor(s/536870912));let n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),f=(p,c)=>p>>>c|p<<32-c;for(let p=0;p<r;p++){for(let u=0;u<16;u++)a[u]=o.getUint32(p*64+u*4);for(let u=16;u<64;u++){let b=f(a[u-15],7)^f(a[u-15],18)^a[u-15]>>>3,x=f(a[u-2],17)^f(a[u-2],19)^a[u-2]>>>10;a[u]=a[u-16]+b+a[u-7]+x>>>0}let[c,l,d,m,h,y,g,k]=n;for(let u=0;u<64;u++){let b=k+(f(h,6)^f(h,11)^f(h,25))+(h&y^~h&g)+Cu[u]+a[u]>>>0,x=(f(c,2)^f(c,13)^f(c,22))+(c&l^c&d^l&d)>>>0;k=g,g=y,y=h,h=m+b>>>0,m=d,d=l,l=c,c=b+x>>>0}n[0]+=c,n[1]+=l,n[2]+=d,n[3]+=m,n[4]+=h,n[5]+=y,n[6]+=g,n[7]+=k}return[...n].map(p=>p.toString(16).padStart(8,"0")).join("")}function Ld(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",s={update(r){return e+=r,s},digest(r){return pc(e)}};return s}var Fd=t=>{if(t&&typeof t=="object"){Object.freeze(t);for(let e of Object.values(t))Fd(e)}return t},da=[86,81,76],ju=["send","reply","token","blocked","user","event","control","planned"],tn=Fd({light:{paper:"#ffffff",ink:"#141414",steps:[{top:"#f4f4f4",left:"#dcdcdc",right:"#c4c4c4",edge:"#3a3a3a"},{top:"#dedede",left:"#bfbfbf",right:"#a2a2a2",edge:"#2e2e2e"},{top:"#bcbcbc",left:"#9a9a9a",right:"#7e7e7e",edge:"#222222"},{top:"#8f8f8f",left:"#707070",right:"#565656",edge:"#141414"}]},dark:{paper:"#161616",ink:"#f2f2f2",steps:[{top:"#2a2a2a",left:"#222222",right:"#1b1b1b",edge:"#b8b8b8"},{top:"#454545",left:"#383838",right:"#2c2c2c",edge:"#c8c8c8"},{top:"#6a6a6a",left:"#565656",right:"#444444",edge:"#dadada"},{top:"#9c9c9c",left:"#808080",right:"#686868",edge:"#141414"}]},patterns:["none","hatch","hatch-wide","dots"],rhythms:[{dash:[],width:2.6},{dash:[9,4],width:2.4},{dash:[7,6],width:2.4},{dash:[3,6],width:2.4},{dash:[1.5,3.5],width:2.6},{dash:[10,3,2,3],width:2.4},{dash:[],width:1.4},{dash:[7,6],width:1.4},{dash:[3,3],width:1.6},{dash:[14,4],width:1.8}],kindOrder:ju,thresholds:da,darkWidthAdd:.4}),Lu=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,_u=/^hsl\(\s*([+-]?(?:\d+\.?\d*|\.\d+))\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s*\)$/i;function Fu(t){if(typeof t!="string")throw new Error(`mono: invalid colour "${String(t)}"`);let e=t.trim(),s=Lu.exec(e);if(s){let i=s[1];return i.length===3?[parseInt(i[0]+i[0],16)/255,parseInt(i[1]+i[1],16)/255,parseInt(i[2]+i[2],16)/255]:[parseInt(i.slice(0,2),16)/255,parseInt(i.slice(2,4),16)/255,parseInt(i.slice(4,6),16)/255]}let r=_u.exec(e);if(r){let i=Number(r[1]),o=Number(r[2]),n=Number(r[3]);if(!Number.isFinite(i)||o<0||o>100||n<0||n>100)throw new Error(`mono: invalid colour "${t}"`);let a=(i%360+360)%360,f=o/100,p=n/100,c=f*Math.min(p,1-p),l=d=>{let m=(d+a/30)%12;return p-c*Math.max(-1,Math.min(m-3,9-m,1))};return[l(0),l(8),l(4)]}throw new Error(`mono: invalid colour "${t}"`)}function dc(t){let[e,s,r]=Fu(t),i=o=>o<=.04045?o/12.92:((o+.055)/1.055)**2.4;return .2126*i(e)+.7152*i(s)+.0722*i(r)}function zi(t){let e=dc(t);return e>216/24389?116*Math.cbrt(e)-16:24389/27*e}function Ci(t,e){let s=dc(t),r=dc(e);return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}var Du=new Set(tn.patterns),Bu=new Map(tn.kindOrder.map((t,e)=>[t,e])),qu=(t,e)=>t<e?-1:t>e?1:0,_d=t=>[...new Set(t)].sort(qu),Vu=t=>Math.round(t*100)/100;function Ku(t){return t>=da[0]?0:t>=da[1]?1:t>=da[2]?2:3}function Gu(t){if(t.roles)for(let[e,s]of Object.entries(t.roles)){if(s.step!==void 0&&(typeof s.step!="number"||!Number.isInteger(s.step)||s.step<0||s.step>3))throw new Error(`mono: invalid step "${String(s.step)}" for role "${e}"`);if(s.pattern!==void 0&&(typeof s.pattern!="string"||!Du.has(s.pattern)))throw new Error(`mono: invalid pattern "${String(s.pattern)}" for role "${e}"`)}if(t.kinds)for(let[e,s]of Object.entries(t.kinds)){if(s.dash!==void 0&&(!Array.isArray(s.dash)||!s.dash.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)))throw new Error(`mono: invalid dash "${String(s.dash)}" for kind "${e}"`);if(s.width!==void 0&&(typeof s.width!="number"||!Number.isFinite(s.width)||s.width<=0))throw new Error(`mono: invalid width "${String(s.width)}" for kind "${e}"`)}}function fa(t,e,s,r){if(e!=="light"&&e!=="dark")throw new Error(`mono: invalid mode "${String(e)}"`);r&&Gu(r);let i=tn[e],o=[],n=t.light["l-top"],a=_d(s?.roles??Object.keys(t.roles)),f=new Map,p=[[],[],[],[]];for(let g of a){let k=r?.roles?.[g]?.step,u;if(k!==void 0)u=k;else{let b=t.roles[g];if(!b)throw new Error(`mono: unknown role "${g}"`);if(typeof n!="string")throw new Error('mono: theme.light is missing "l-top"');u=Ku(zi(`hsl(${b.h} ${b.s}% ${n})`))}f.set(g,u),p[u].push(g)}let c=new Map;for(let g=0;g<p.length;g++){let k=p[g];for(let u=0;u<k.length;u++){let b=k[u],x=r?.roles?.[b]?.pattern;if(x!==void 0)c.set(b,x);else{let w=u%tn.patterns.length,$=tn.patterns[w];if(c.set(b,$),u>=tn.patterns.length){let v=k.slice(0,u).find(O=>c.get(O)===$);v!==void 0&&o.push(`role "${b}" wraps on step ${g} to pattern "${$}", matching "${v}"`)}}}}let l={};for(let g of a){let k=f.get(g),u=c.get(g),b=i.steps[k];l[g]={step:k,pattern:u,top:b.top,left:b.left,right:b.right,edge:b.edge}}let d=_d(s?.kinds??Object.keys(t.kinds)),m=e==="dark"?tn.darkWidthAdd:0,h={},y=0;for(let g of d){let k=r?.kinds?.[g],u=Bu.get(g),b;if(u!==void 0)b=u;else if(b=tn.kindOrder.length+y,y++,b>=tn.rhythms.length){let v=b%tn.rhythms.length;(!k||k.dash===void 0||k.width===void 0)&&o.push(`kind "${g}" exceeds the ${tn.rhythms.length} line rhythms; reusing rhythm ${v}`),b=v}let x=tn.rhythms[b],w=k?.dash!==void 0?[...k.dash]:[...x.dash],$=k?.width!==void 0?k.width:Vu(x.width+m);h[g]={dash:w,width:$}}return{mode:e,paper:i.paper,ink:i.ink,roles:l,kinds:h,warnings:o}}var zf={};yo(zf,{ANTS_CSS:()=>ff,ANT_DASH:()=>zc,ANT_SPEED:()=>Gi,ANT_STILL:()=>Cc,ASSEMBLE_STYLES:()=>jr,BOARD_3D:()=>qs,BOARD_CSS:()=>Nf,DISASSEMBLE_STYLES:()=>Lr,EASING_NAMES:()=>Yi,EXTRAPOLATE:()=>or,FLAT_DEFAULTS:()=>Wc,FLAT_FONTS:()=>Jc,FONT_STACKS:()=>Qi,GRID_CSS:()=>to,LABEL_BUDGET:()=>ja,MARKS_CSS:()=>eo,MOTION_EASINGS:()=>tf,MOTION_ORDERS:()=>sr,MOTION_SCHEMA:()=>gf,MotionBuilder:()=>Ui,NodesBuilder:()=>Dr,Obstacles:()=>nr,PAGE_CSS:()=>Zc,PLAYER_CSS:()=>Ya,PLAYER_UI_CSS:()=>Uc,ROUTE_BUDGET:()=>$a,SeriesBuilder:()=>Br,WALL_T:()=>ps,alongPath:()=>Ra,antDash:()=>Zi,antsOf:()=>Ss,assemble:()=>Ic,assembly:()=>Ta,baseCss:()=>Ur,bezier:()=>Ds,bindMotion:()=>vs,boardCatalog:()=>Rf,boardDiagram:()=>If,boardErrors:()=>Xa,boardOf:()=>Qa,boxAsset:()=>an,boxSilhouette:()=>Mf,calloutRect:()=>Sc,cardAsset:()=>Xc,checkMotion:()=>qa,cloudPath:()=>yc,compileRaw:()=>Wa,convexOverlap:()=>Bi,curveAt:()=>Vr,defaultLabel:()=>qd,disassemble:()=>pf,drawCloud:()=>Er,drawDecos:()=>hc,drawLooks:()=>_a,drawingCss:()=>ar,durationFor:()=>Kc,easeOf:()=>Xn,facePainter:()=>tr,flatHit:()=>Ef,floorAt:()=>Rr,floorOf:()=>Pf,focusView:()=>Ba,gateBox:()=>Fi,iconPainter:()=>ji,inConvex:()=>vc,introSvg:()=>df,kindsCss:()=>ua,labelRect:()=>qi,layoutFlat:()=>Hr,lineRectArea:()=>Hd,localAt:()=>vf,markCss:()=>ha,metricsMeasure:()=>Tf,midpoint:()=>Gc,monoCss:()=>Vc,monoOfDrawing:()=>Ua,monoTheme:()=>qc,motion:()=>uf,motionModel:()=>rr,motionOfSteps:()=>Va,motionOrder:()=>Ec,motionSource:()=>Ji,msOf:()=>kn,noSource:()=>Hc,nodeKind:()=>er,nodeKindOr:()=>Tn,offscreen:()=>Cr,openList:()=>wc,overlap2:()=>ga,overlaps:()=>Ja,paddingOf:()=>Of,paint:()=>Ia,paintMono:()=>Za,parseEnd:()=>wn,place:()=>Nr,placeBoard:()=>no,placeCallout:()=>Oa,placeNodeLabel:()=>Vi,placeholderIcon:()=>uc,planOf:()=>_r,plate:()=>Li,polyBounds:()=>Yn,polyRectArea:()=>zr,readMs:()=>Wi,rectArea:()=>$c,regionKind:()=>Ot,regionRole:()=>La,registerMarks:()=>Bd,renderScene:()=>Fr,resolveSteps:()=>Ha,resolveSvg:()=>Zr,routeAll:()=>Sa,screenToGrid:()=>Sf,silhouette:()=>Yt,simplify:()=>Di,snapMove:()=>Af,springAt:()=>qr,svgAt:()=>Ki,usedIn:()=>Bc,wallHeight:()=>ma,wallsOf:()=>Ca,withAnts:()=>Fa});var Ot=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,er=(t,e)=>t.nodes[e??t.defaultNode],Tn=(t,e)=>er(t,e)??t.nodes[t.defaultNode],ma=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,ua=t=>Object.values(t.regions).map(e=>e.css??"").join("");var fc=Object.create(null),mc=[];function Bd(t){Object.assign(fc,t.icons??{}),Object.assign(gr,t.faces??{}),t.css&&!mc.includes(t.css)&&mc.push(t.css)}var ha=()=>mc.join(""),ji=t=>Object.hasOwn(fc,t)?fc[t]:void 0,tr=t=>Object.hasOwn(gr,t)?gr[t]:void 0;function uc(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(.6,(e.x1-e.x0)*.24,(e.y1-e.y0)*.24),n=[[s-o,r-o,i],[s+o,r-o,i],[s+o,r+o,i],[s-o,r+o,i]];return t.poly(n,"ico-unknown")+t.line3([s-o*.3,r-o*.35,i],[s+o*.3,r-o*.35,i],"ico-unknown-q")+t.line3([s+o*.3,r-o*.35,i],[s,r+o*.1,i],"ico-unknown-q")+t.line3([s,r+o*.45,i],[s,r+o*.5,i],"ico-unknown-q")}function hc(t,e,s){let r="";for(let i of s??[])i==="terminal"?r+=pi(t,e,3):i==="envelope"?r+=wo(t,e):i==="bubble"?r+=xo(t,e):i==="file-lines"?r+=ko(t,e):typeof i=="object"&&(i.terminal&&(r+=pi(t,e,i.terminal)),i.icon&&(r+=(ji(i.icon)??uc)(t,e)));return r}var Zu=(t,e)=>(t.deco??e.deco??[]).filter(s=>s!=="ghost");function an(t,e,s,r,i,o){let n={name:t,description:e,size:s,role:r,deco:i,draw:(a,f,p)=>a.blockFaces(f)+hc(a,f,Zu(p,n))+(o?o(a,f):"")};return n}function Li(t){let[e,s]=Hs(t);return{x0:e-.75,y0:s-.75,x1:e+.75,y1:s+.75,z0:t.z0,z1:t.z0+.18}}function yc(t,e){let s=Math.max(8,Math.min(t,e)*.18),r=s*.55,i=r,o=r,n=t-r,a=e-r,f=(p,c,l,d)=>{let m=Math.hypot(l-p,d-c),h=Math.max(1,Math.round(m/(s*1.7))),y="";for(let g=1;g<=h;g++){let k=p+(l-p)*g/h,u=c+(d-c)*g/h,b=m/h/2*1.08;y+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${k.toFixed(1)},${u.toFixed(1)}`}return y};return`M${i.toFixed(1)},${o.toFixed(1)}`+f(i,o,n,o)+f(n,o,n,a)+f(n,a,i,a)+f(i,a,i,o)+"Z"}function Er(t,e){let s={...e,z0:e.z1},r=a=>{let[f,p]=Ne(e.x0,e.y0,a);return[Ct,.5,-Ct,.5,f,p]},i=(e.x1-e.x0)*lt,o=(e.y1-e.y0)*lt,n=yc(i,o);return t.onMatrix(r(e.z0),i,o,()=>Se("path",{d:n,class:"lft cloud-side"}))+t.onMatrix(r(e.z1),i,o,()=>Se("path",{d:n,class:"top cloud-top"}))}function qd(t,e){let[s,r]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1+.75);return{x:s,y:r-18+(e?0:6),anchor:"middle"}}var ps=.16,gc=["right-of","left-of","below","behind"];function Nr(t,e,s,r,i,o={},n){let a=[],f=(M,T,S,N=!1,z="error")=>{let K=s.locate(M,{key:N});a.push({severity:z,message:T,line:K.line,col:K.col,path:M,hint:S})},p=[],c=new Map,l=[],d=new Map,m=new Set([...Object.keys(r.roles),...Object.keys(o)]);function h(M,T){let S=c.get(M.id);if(S){let N=s.locate(S.path+"/id");return f(M.path+"/id",`duplicate id "${M.id}" (first used on line ${N.line})`),!1}return c.set(M.id,M),p.push(M),M.parent=T,T?T.children.push(M):l.push(M),!0}let y=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function g(M,T,S){let N={id:M.id,type:"node",path:T,children:[],box:y(),floor:0,node:M,appears:M.appears,disappears:M.disappears};h(N,S)&&(M.nodes??[]).forEach((z,K)=>g(z,`${T}/nodes/${K}`,N))}function k(M,T,S){let N={id:M.id,type:"region",path:T,children:[],box:y(),floor:0,region:M,appears:M.appears,disappears:M.disappears};h(N,S)&&((M.nodes??[]).forEach((z,K)=>g(z,`${T}/nodes/${K}`,N)),(M.regions??[]).forEach((z,K)=>k(z,`${T}/regions/${K}`,N)))}(t.regions??[]).forEach((M,T)=>k(M,`${e}/regions/${T}`,void 0)),(t.nodes??[]).forEach((M,T)=>g(M,`${e}/nodes/${T}`,void 0));let u=()=>c.keys(),b=()=>p.filter(M=>M.type==="region").map(M=>M.id);for(let M of[...p]){let T=M.node??M.region;if(T.in!==void 0){let N=c.get(T.in);if(!N){f(M.path+"/in",`unknown region "${T.in}"`+_i(T.in,b()));continue}if(N.type!=="region"){f(M.path+"/in",`"${T.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(M.parent&&M.parent!==N){f(M.path+"/in",`"${M.id}" is written inside "${M.parent.id}" but says in: ${T.in}; use one or the other`);continue}for(let z=N;z;z=z.parent)if(z===M){f(M.path+"/in",`"${M.id}" cannot be inside itself`);continue}M.parent||(l.splice(l.indexOf(M),1),M.parent=N,N.children.push(M))}if(M.node){let N=M.node.asset;N!==void 0&&!er(i,N)&&f(M.path+"/asset",`unknown asset "${N}"`+_i(N,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let S=(M.node??M.region).role;S!==void 0&&!m.has(S)&&f(M.path+"/role",`unknown colour role "${S}"`+_i(S,m),`add it under "roles:" at the top of the file, or use one of: ${[...m].join(", ")}`)}for(let M of p){let T=M.region?.gate;if(!T?.node)continue;let S=c.get(T.node);if(!S){f(M.path+"/gate/node",`unknown node "${T.node}"`+_i(T.node,u()));continue}if(S.type!=="node"){f(M.path+"/gate/node",`"${T.node}" is a region; a gate is a node`);continue}S.placedBy=M.id;let N=S.node;(N.at||gc.some(z=>N[z]))&&f(S.path,`"${S.id}" is the gate of "${M.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let x=M=>M.gap??t.gap??2;function w(M){let T=M.node,S=Tn(i,T.asset),N=T.size,z=S.size[0],K=S.size[1],J=S.size[2];if(N&&(z=N[0],K=N[1],N.length>2&&(J=N[2])),M.placedBy){let Z=c.get(M.placedBy).region,L=Z.gate,U=L.width??2,H=N?Math.min(z,K):.3;J=N&&N.length>2?J:L.height??(Z.height??ma(i))+.3,L.side==="e"||L.side==="w"?(z=H,K=U):(z=U,K=H)}return[z,K,J]}function $(M,T,S,N,z){for(let Y of T)O(Y);let K=T.filter(Y=>!Y.placedBy),J=new Set(K),Z=new Set,L=[],U=new Set,H=Y=>{let ie=Y.node??Y.region,Ae=[];for(let De of gc){let I=ie[De];if(I===void 0)continue;let V=c.get(I);if(!V){f(`${Y.path}/${De}`,`unknown id "${I}"`+_i(I,u()));continue}if(V===Y){f(`${Y.path}/${De}`,`"${Y.id}" cannot be placed ${De} itself`);continue}if(!J.has(V)){let te=ae=>ae.parent?`"${ae.parent.id}"`:"the scene";f(`${Y.path}/${De}`,`"${I}" is in ${te(V)} but "${Y.id}" is in ${te(Y)}; relative placement works between items in the same region`,V.placedBy?`"${I}" is a gate, placed by its ${c.get(V.placedBy)?.region?.kind??"region"}`:`place "${Y.id}" relative to something in ${te(Y)}, or use "at:"`);continue}Ae.push(V)}if(!Ae.length&&!ie.at){let De=K.indexOf(Y);De>0&&Ae.push(K[De-1])}return Ae},ee=Y=>{if(!Z.has(Y)){if(U.has(Y)){f(Y.path,`placement loop: "${Y.id}" is placed relative to something placed relative to it`);return}U.add(Y),H(Y).forEach(ee),U.delete(Y),Z.add(Y),L.push(Y)}};K.forEach(ee);for(let Y of L){let ie=Y.node??Y.region,Ae=d.get(Y),De=gc.find(I=>ie[I]!==void 0&&c.get(ie[I])&&J.has(c.get(ie[I])));if(ie.at&&De&&f(`${Y.path}/at`,`"${Y.id}" has both "at" and "${De}"; "at" wins`,void 0,!0,"warning"),ie.at)Ae.x=ie.at[0],Ae.y=ie.at[1];else if(De)v(Ae,d.get(c.get(ie[De])),De,x(ie),ie.align??"center");else{let I=K.indexOf(Y);I>0?v(Ae,d.get(K[I-1]),N==="row"?"right-of":"below",x(ie),"center"):(Ae.x=S,Ae.y=S)}ie.shift&&(Ae.x+=ie.shift[0],Ae.y+=ie.shift[1])}if(z||!K.length)return{w:0,d:0};let j=1/0,q=1/0,G=-1/0,Q=-1/0;for(let Y of K){let ie=d.get(Y);j=Math.min(j,ie.x),q=Math.min(q,ie.y),G=Math.max(G,ie.x+ie.w),Q=Math.max(Q,ie.y+ie.d)}let le=Math.min(0,j-S),pe=Math.min(0,q-S);if(le||pe)for(let Y of K){let ie=d.get(Y);ie.x-=le,ie.y-=pe}return{w:G-le+S,d:Q-pe+S}}function v(M,T,S,N,z){let K=()=>{M.y=z==="start"?T.y:z==="end"?T.y+T.d-M.d:T.y+(T.d-M.d)/2},J=()=>{M.x=z==="start"?T.x:z==="end"?T.x+T.w-M.w:T.x+(T.w-M.w)/2};S==="right-of"?(M.x=T.x+T.w+N,K()):S==="left-of"?(M.x=T.x-N-M.w,K()):S==="below"?(M.y=T.y+T.d+N,J()):(M.y=T.y-N-M.d,J())}function O(M){if(M.type==="node"){let[L,U,H]=w(M);d.set(M,{x:0,y:0,w:L,d:U,h:H,z:M.node.z??0}),M.children.length&&$(M,M.children,0,"row",!0);return}let T=M.region,S=T.padding??Ot(i,T.kind)?.pad,N=!!T.size,z=$(M,M.children,S,T.flow??"row",N),K=T.size?T.size[0]:Math.max(z.w,S*2+.5),J=T.size?T.size[1]:Math.max(z.d,S*2+.5);if(!T.size&&T.gate){let L=(T.gate.width??2)+1;T.gate.side==="e"||T.gate.side==="w"?J=Math.max(J,L):K=Math.max(K,L)}let Z=T.size&&T.size.length>2?T.size[2]:T.height??Ot(i,T.kind).z[1];d.set(M,{x:0,y:0,w:K,d:J,h:Z,z:0})}$(void 0,l,0,t.flow??"row",!0);function C(M,T,S,N){let z=d.get(M),K=T+z.x,J=S+z.y;if(M.type==="region"){let Z=Ot(i,M.region.kind),[L]=Z.z,U=Z.floor,H=Z.shape==="slab"&&Ot(i,M.parent?.region?.kind)?.shape==="slab"?0:L,ee=M.region.z??0,j=N+H+ee,q=N+z.h+ee;M.box={x0:K,y0:J,z0:j,x1:K+z.w,y1:J+z.d,z1:q},M.floor=U?q:N}else{let Z=N+z.z;M.box={x0:K,y0:J,z0:Z,x1:K+z.w,y1:J+z.d,z1:Z+z.h},M.floor=M.box.z1}for(let Z of M.children)Z.placedBy||C(Z,K,J,M.floor)}for(let M of l)M.placedBy||C(M,0,0,0);if(n){let M=S=>Math.round(S/n)*n,T=S=>Math.round(S*1e9)/1e9;for(let S of p){if(S.placedBy)continue;let N=S.box,z=M(N.x0),K=M(N.x1),J=M(N.y0),Z=M(N.y1);K-z<n&&(K=z+n),Z-J<n&&(Z=J+n),S.box={...N,x0:T(z),x1:T(K),y0:T(J),y1:T(Z)};let L=S.node??S.region;L.at&&L.at.forEach((U,H)=>{let ee=U/n;Math.abs(ee-Math.round(ee))>1e-6&&f(`${S.path}/at/${H}`,`${U} is not on the ${n} grid; it is drawn at ${T(M(U))}`,void 0,!1,"warning")})}}for(let M of p){let T=M.region?.gate;if(!T?.node)continue;let S=c.get(T.node);!S||S.placedBy!==M.id||(S.box=Fi(M,d.get(S).h,d.get(S).w,d.get(S).d),S.floor=S.box.z1)}for(let M of p){let T=M.children.filter(S=>!S.placedBy);for(let S=0;S<T.length;S++)for(let N=S+1;N<T.length;N++){let z=T[S],K=T[N];ya(z,i)||ya(K,i)||ga(z.box,K.box)&&f(K.path,`"${K.id}" overlaps "${z.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(M.parent&&M.parent.type==="region"&&!M.placedBy){let S=M.parent.box,N=M.box,z=1e-6;(N.x0<S.x0-z||N.y0<S.y0-z||N.x1>S.x1+z||N.y1>S.y1+z)&&f(M.path,`"${M.id}" sticks out of region "${M.parent.id}"`,`make "${M.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let M=l.filter(T=>!T.placedBy);for(let T=0;T<M.length;T++)for(let S=T+1;S<M.length;S++){let N=M[T],z=M[S];ga(N.box,z.box)&&!ya(N,i)&&!ya(z,i)&&f(z.path,`"${z.id}" overlaps "${N.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let A=new Set,R=a.filter(M=>{let T=M.path+M.message;return A.has(T)?!1:(A.add(T),!0)});return{items:p,byId:c,roots:l,diags:R,catalog:i}}var ya=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(Ot(e,t.region.kind)?.shape??"");function Fi(t,e,s,r){let i=t.region.gate,o=t.box,n=t.box.z0,a=i.at??.5,f=i.width??2;if(i.side==="w"||i.side==="e"){let l=i.side==="w"?o.x0+ps/2:o.x1-ps/2,d=o.y0+(o.y1-o.y0)*a;return{x0:l-s/2,x1:l+s/2,y0:d-f/2,y1:d+f/2,z0:n,z1:n+e}}let p=i.side==="n"?o.y0+ps/2:o.y1-ps/2,c=o.x0+(o.x1-o.x0)*a;return{x0:c-f/2,x1:c+f/2,y0:p-r/2,y1:p+r/2,z0:n,z1:n+e}}function ga(t,e,s=1e-6){return t.x0<e.x1-s&&e.x0<t.x1-s&&t.y0<e.y1-s&&e.y0<t.y1-s}function _i(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var ks=.2,ba=.05,Uu=.6,wa=.25,xa={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function wn(t){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(t);return{id:e[1],side:e[2]}}var Vd=new WeakMap;function Rr(t,e,s){let r=Vd.get(t);if(!r){r=[];for(let n of t.items){if(n.type!=="region"||!Ot(t.catalog,n.region.kind)?.floor)continue;let a=0;for(let f=n.parent;f;f=f.parent)a++;r.push({r:n,d:a})}Vd.set(t,r)}let i=0,o=-1;for(let{r:n,d:a}of r){let f=n.box,p=1e-6;e>=f.x0-p&&e<=f.x1+p&&s>=f.y0-p&&s<=f.y1+p&&a>o&&(o=a,i=n.floor)}return i}function Hu(t,e){let s=[(t.x0+t.x1)/2,(t.y0+t.y1)/2],r=[(e.x0+e.x1)/2,(e.y0+e.y1)/2],i=r[0]-s[0],o=r[1]-s[1],n=Math.max(e.x0-t.x1,t.x0-e.x1),a=Math.max(e.y0-t.y1,t.y0-e.y1);return n>0&&(a<=0||n>=a)?i>0?"e":"w":a>0?o>0?"s":"n":Math.abs(i)>=Math.abs(o)?i>0?"e":"w":o>0?"s":"n"}var $a=5e5;function Sa(t,e,s,r,i,o){let n=[],a=(b,x,w,$="error")=>{let v=r.locate(b);n.push({severity:$,message:x,line:v.line,col:v.col,path:b,hint:w})},f=t.routes??[],p={left:$a},c=0,l=()=>s.items.map(b=>b.id),d=new Map,m=[],h=[];f.forEach((b,x)=>{let w=`${e}/routes/${x}`;(d.has(b.id)||s.byId.has(b.id))&&a(w+"/id",`duplicate id "${b.id}"`),d.set(b.id,x);let $=b.kind??"send";i.has($)||a(w+"/kind",`unknown flow kind "${$}"`+bc($,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let v={id:b.id,raw:b,path:w,kind:$,points:[]},O=(C,A)=>{let{id:R}=wn(C),M=s.byId.get(R);if(!M){a(`${w}/${A}`,`unknown node "${R}"`+bc(R,l()));return}return M};v.from=O(b.from,"from"),v.to=O(b.to,"to"),m.push(v),h.push({r:v})});let y=new Map;for(let b of h){let{r:x}=b;if(!x.from||!x.to||x.raw.points)continue;let w=wn(x.raw.from).side,$=wn(x.raw.to).side,v=x.raw.via?.[0],O=x.raw.via?.[x.raw.via.length-1],C=(T,S)=>{if(Array.isArray(T))return{x0:T[0],x1:T[0],y0:T[1],y1:T[1],z0:0,z1:0};if(typeof T=="string"){let N=s.byId.get(wn(T).id);if(N)return N.box}return S.box},A=(T,S,N)=>{let z=S??Hu(T.box,N);return{node:T,side:z,explicit:!!S,p:[0,0],z:0}};b.a=A(x.from,w,C(v,x.to)),b.b=A(x.to,$,C(O,x.from));let R=C(v,x.to),M=C(O,x.from);for(let[T,S]of[[b.a,R],[b.b,M]]){let N=`${T.node.id}.${T.side}`;y.has(N)||y.set(N,[]),y.get(N).push({e:T,other:[(S.x0+S.x1)/2,(S.y0+S.y1)/2]})}}for(let[,b]of y){let x=b[0].e,w=x.node.box,$=x.side,v=$==="e"||$==="w"?1:0;b.sort((T,S)=>T.other[v]-S.other[v]);let O=v?w.y0:w.x0,C=v?w.y1:w.x1,A=(O+C)/2,R=Math.max(0,C-O-.3),M=b.length>1?Math.min(Uu,R/(b.length-1)):0;b.forEach((T,S)=>{let N=(S-(b.length-1)/2)*M,z=A+N,K=T.e.node.box.z0;if($==="top"){T.e.p=[(w.x0+w.x1)/2,(w.y0+w.y1)/2],T.e.z=w.z1;return}let[J,Z]=xa[$];T.e.p=v?[J>0?w.x1+ba:w.x0-ba,z]:[z,Z>0?w.y1+ba:w.y0-ba],T.e.z=K})}let g=[];for(let b of s.items)b.type==="node"&&g.push(b.box);let k=[];for(let b of s.items.filter(x=>Ot(s.catalog,x.region?.kind)?.shape==="walled")){let{x0:x,y0:w,x1:$,y1:v}=b.box,O=ps,C=b.region.gate,A=[[{x0:x,y0:w,x1:$,y1:w+O,z0:0,z1:0},"n"],[{x0:x,y0:v-O,x1:$,y1:v,z0:0,z1:0},"s"],[{x0:x,y0:w,x1:x+O,y1:v,z0:0,z1:0},"w"],[{x0:$-O,y0:w,x1:$,y1:v,z0:0,z1:0},"e"]];for(let[R,M]of A)if(C&&C.side===M){if(C.node)continue;let T=C.at??.5,S=C.width??2;if(M==="e"||M==="w"){let N=w+(v-w)*T;k.push({...R,y1:N-S/2},{...R,y0:N+S/2})}else{let N=x+($-x)*T;k.push({...R,x1:N-S/2},{...R,x0:N+S/2})}}else k.push(R)}let u=new Map;for(let b of h){let{r:x,a:w,b:$}=b;if(x.raw.points){x.points=x.raw.points.map(z=>[z[0],z[1],z.length>2?z[2]:Rr(s,z[0],z[1])+.01]);continue}if(!w||!$)continue;let v=[];(x.raw.via??[]).forEach((z,K)=>{if(Array.isArray(z))if(o){let J=Z=>Math.round(Math.round(Z/o)*o*1e9)/1e9;z.forEach((Z,L)=>{Math.abs(Z/o-Math.round(Z/o))>1e-6&&a(`${x.path}/via/${K}/${L}`,`${Z} is not on the ${o} grid; it is drawn at ${J(Z)}`,void 0,"warning")}),v.push({p:[J(z[0]),J(z[1])]})}else v.push({p:[z[0],z[1]]});else{let{id:J,side:Z}=wn(z),L=s.byId.get(J);if(!L){a(`${x.path}/via/${K}`,`unknown node "${J}"`+bc(J,l()));return}let U=Z&&Z!=="top"?Z:"n",[H,ee]=xa[U],j=L.box;v.push({p:[H?H>0?j.x1+.4:j.x0-.4:(j.x0+j.x1)/2,ee?ee>0?j.y1+.4:j.y0-.4:(j.y0+j.y1)/2]})}});let C=g.filter(z=>z!==w.node.box&&z!==$.node.box).concat(x.raw.cross?[]:k).filter(z=>!ka(w.node.box,z)&&!ka($.node.box,z)&&!ka(z,w.node.box)&&!ka(z,$.node.box)),A=w.side==="top"?void 0:xa[w.side],R=$.side==="top"?void 0:xa[$.side],M=[w.p,...v.map(z=>z.p),$.p],T=[w.p],S=A,N=!0;for(let z=0;z+1<M.length;z++){let K=z+2===M.length,J=Wu(M[z],M[z+1],C,u,S,K&&R?[-R[0],-R[1]]:void 0,p);if(!J){N=!1;break}T.push(...J.slice(1));let Z=T.length;if(Z>=2){let L=Math.sign(T[Z-1][0]-T[Z-2][0]),U=Math.sign(T[Z-1][1]-T[Z-2][1]);S=[L,U]}}!N&&p.left<=0?(c++,T=[w.p,[$.p[0],w.p[1]],$.p]):N||(a(x.path,`no path found for route "${x.id}" from "${w.node.id}" to "${$.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),T=[w.p,[$.p[0],w.p[1]],$.p]),T=Di(T);for(let z=0;z+1<T.length;z++)Yu(u,T[z],T[z+1]);x.points=Qu(s,T,w,$)}return c&&a(e,`${c} of ${m.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${$a.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:m,diags:n}}function ka(t,e){return e.x0>=t.x0-1e-6&&e.x1<=t.x1+1e-6&&e.y0>=t.y0-1e-6&&e.y1<=t.y1+1e-6&&e.z0>=t.z1-1e-6}var Kd=(t,e)=>`${Math.round(t/ks)},${Math.round(e/ks)}`;function Yu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(s[0]-e[0],s[1]-e[1])/ks));for(let i=0;i<=r;i++){let o=Kd(e[0]+(s[0]-e[0])*i/r,e[1]+(s[1]-e[1])*i/r);t.set(o,(t.get(o)??0)+1)}}function Gd(t,e,s){for(let r of s)if(t>r.x0-wa&&t<r.x1+wa&&e>r.y0-wa&&e<r.y1+wa)return!0;return!1}function Wu(t,e,s,r,i,o,n={left:1/0}){if((Math.abs(t[0]-e[0])<1e-6||Math.abs(t[1]-e[1])<1e-6)&&Xu(t,e,s)){let L=[Math.sign(e[0]-t[0]),Math.sign(e[1]-t[1])],U=!i||i[0]===L[0]&&i[1]===L[1],H=!o||o[0]===L[0]&&o[1]===L[1];if(U&&H)return[t,e]}if(n.left<=0)return null;let a=L=>Math.round((L-t[0])/ks),f=L=>Math.round((L-t[1])/ks),p=L=>t[0]+L*ks,c=L=>t[1]+L*ks,l=a(e[0]),d=f(e[1]),m=30,h=Math.min(0,l)-m,y=Math.max(0,l)+m,g=Math.min(0,d)-m,k=Math.max(0,d)+m,u=1.2,b=ks,x=.06,w=[[1,0],[-1,0],[0,1],[0,-1]],$=y-h+1,v=k-g+1,O=(L,U)=>(L-h)*v+(U-g),C=new Int8Array($*v).fill(-1),A=new Float64Array($*v).fill(-1),R=new Float64Array($*v*4).fill(1/0),M=(L,U)=>{let H=O(L,U);return C[H]<0&&(C[H]=Gd(p(L),c(U),s)?1:0),C[H]===1},T=(L,U)=>{let H=O(L,U);return A[H]<0&&(A[H]=r.get(Kd(p(L),c(U)))??0),A[H]},S=wc(),N=(L,U)=>(Math.abs(L-l)+Math.abs(U-d))*b,z=i?w.findIndex(L=>L[0]===i[0]&&L[1]===i[1]):-1;S.push({i:0,j:0,d:z,g:0,f:N(0,0),idx:0,hp:0});let K=(L,U)=>Math.abs(L)+Math.abs(U)<=2,J=(L,U)=>Math.abs(L-l)+Math.abs(U-d)<=2,Z=0;for(;S.length()&&Z++<2e5;){if(n.left--<=0)return null;let L=S.take();if(L.i===l&&L.j===d&&!(o&&L.d>=0&&(w[L.d][0]!==o[0]||w[L.d][1]!==o[1]))){let U=[];for(let H=L;H;H=H.prev)U.push([p(H.i),c(H.j)]);return U.reverse(),U[0]=t,Ju(Di(U),e)}for(let U=0;U<4;U++){let H=w[U];if(L.d>=0&&H[0]===-w[L.d][0]&&H[1]===-w[L.d][1])continue;let ee=L.i+H[0],j=L.j+H[1];if(ee<h||ee>y||j<g||j>k||!K(ee,j)&&!J(ee,j)&&M(ee,j))continue;if((K(ee,j)||J(ee,j))&&M(ee,j)&&!(ee===l&&j===d)){let le=K(ee,j)?i:o&&[-o[0],-o[1]];if(!le||(K(ee,j)?H[0]!==le[0]||H[1]!==le[1]:H[0]!==o[0]||H[1]!==o[1]))continue}let q=L.d>=0&&L.d!==U?u:0,G=L.g+b+q+T(ee,j)*x,Q=O(ee,j)*4+U;R[Q]<=G||(R[Q]=G,S.push({i:ee,j,d:U,g:G,f:G+N(ee,j),prev:L,idx:0,hp:0}))}}return null}function wc(){let t=[],e=[],s=(n,a)=>n.f<a.f||n.f===a.f&&n.idx<a.idx,r=(n,a)=>{let f=e[n];e[n]=e[a],e[a]=f,e[n].hp=n,e[a].hp=a},i=n=>{for(;n>0;){let a=n-1>>1;if(!s(e[n],e[a]))break;r(n,a),n=a}},o=n=>{for(;;){let a=2*n+1,f=a+1,p=n;if(a<e.length&&s(e[a],e[p])&&(p=a),f<e.length&&s(e[f],e[p])&&(p=f),p===n)return;r(n,p),n=p}};return{length:()=>t.length,push(n){n.idx=t.length,t.push(n),n.hp=e.length,e.push(n),i(n.hp)},take(){let n=e[0],a=e.pop();e.length&&(e[0]=a,a.hp=0,o(0));let f=t.pop();return f!==n&&(t[n.idx]=f,f.idx=n.idx,i(f.hp)),n}}}function Ju(t,e){let s=t.map(o=>[o[0],o[1]]),r=s.length,i=s[r-1];if(r>=2){let o=s[r-2];Math.abs(o[1]-i[1])<1e-9?(o[1]=e[1],r>=3&&Math.abs(s[r-3][1]-i[1])<1e-9&&(s[r-3][1]=e[1])):Math.abs(o[0]-i[0])<1e-9&&(o[0]=e[0],r>=3&&Math.abs(s[r-3][0]-i[0])<1e-9&&(s[r-3][0]=e[0]))}return s[r-1]=e,Di(s)}function Xu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(e[0]-t[0],e[1]-t[1])/(ks/2)));for(let i=2;i<r-1;i++)if(Gd(t[0]+(e[0]-t[0])*i/r,t[1]+(e[1]-t[1])*i/r,s))return!1;return!0}function Di(t){let e=[];for(let s of t){let r=e.length;if(!(r&&Math.abs(e[r-1][0]-s[0])<1e-6&&Math.abs(e[r-1][1]-s[1])<1e-6)){if(r>=2){let i=e[r-2],o=e[r-1];if(Math.abs(i[0]-o[0])<1e-6&&Math.abs(o[0]-s[0])<1e-6||Math.abs(i[1]-o[1])<1e-6&&Math.abs(o[1]-s[1])<1e-6){e[r-1]=s;continue}}e.push(s)}}return e}function Qu(t,e,s,r){let i=new Set,o=new Set;for(let p of t.items)p.type!=="region"||!Ot(t.catalog,p.region.kind)?.floor||(i.add(p.box.x0),i.add(p.box.x1),o.add(p.box.y0),o.add(p.box.y1));let n=[],a=(p,c)=>Rr(t,p,c)+.01;for(let p=0;p+1<e.length;p++){let[c,l]=e[p],[d,m]=e[p+1],h=[0,1];if(Math.abs(l-m)<1e-6)for(let y of i){let g=(y-c)/(d-c);g>1e-6&&g<1-1e-6&&h.push(g)}else for(let y of o){let g=(y-l)/(m-l);g>1e-6&&g<1-1e-6&&h.push(g)}h.sort((y,g)=>y-g);for(let y=0;y+1<h.length;y++){let g=h[y],k=h[y+1],u=(g+k)/2,b=a(c+(d-c)*u,l+(m-l)*u),x=[c+(d-c)*g,l+(m-l)*g,b],w=[c+(d-c)*k,l+(m-l)*k,b],$=n[n.length-1];$&&(Math.abs($[0]-x[0])>1e-6||Math.abs($[1]-x[1])>1e-6||Math.abs($[2]-x[2])>1e-6)?n.push(x):$||n.push(x),n.push(w)}}n.length&&(n[0][2]=s.side==="top"?s.z:s.node.box.z0+.01,n[n.length-1][2]=r.side==="top"?r.z:r.node.box.z0+.01);let f=[];for(let p of n){let c=f.length;if(c>=2){let l=f[c-2],d=f[c-1],m=Math.abs(l[2]-d[2])<1e-9&&Math.abs(d[2]-p[2])<1e-9,h=Math.abs(l[0]-d[0])<1e-6&&Math.abs(d[0]-p[0])<1e-6||Math.abs(l[1]-d[1])<1e-6&&Math.abs(d[1]-p[1])<1e-6;if(m&&h){f[c-1]=p;continue}}f.push(p)}return f}function bc(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}function Yt(t){return[Ne(t.x0,t.y0,t.z1),Ne(t.x1,t.y0,t.z1),Ne(t.x1,t.y0,t.z0),Ne(t.x1,t.y1,t.z0),Ne(t.x0,t.y1,t.z0),Ne(t.x0,t.y1,t.z1)]}function Yn(t){let e=t.map(o=>o[0]),s=t.map(o=>o[1]),r=Math.min(...e),i=Math.min(...s);return{x:r,y:i,w:Math.max(...e)-r,h:Math.max(...s)-i}}function zr(t,e){let s=t,r=(a,f)=>{let p=[];for(let c=0;c<s.length;c++){let l=s[c],d=s[(c+1)%s.length],m=a(l),h=a(d);m&&p.push(l),m!==h&&p.push(f(l,d))}s=p},i=a=>(f,p)=>[a,f[1]+(p[1]-f[1])*(a-f[0])/(p[0]-f[0])],o=a=>(f,p)=>[f[0]+(p[0]-f[0])*(a-f[1])/(p[1]-f[1]),a];if(r(a=>a[0]>=e.x,i(e.x)),!s.length||(r(a=>a[0]<=e.x+e.w,i(e.x+e.w)),!s.length)||(r(a=>a[1]>=e.y,o(e.y)),!s.length)||(r(a=>a[1]<=e.y+e.h,o(e.y+e.h)),!s.length))return 0;let n=0;for(let a=0;a<s.length;a++){let f=s[a],p=s[(a+1)%s.length];n+=f[0]*p[1]-p[0]*f[1]}return Math.abs(n)/2}function $c(t,e){let s=Math.min(t.x+t.w,e.x+e.w)-Math.max(t.x,e.x),r=Math.min(t.y+t.h,e.y+e.h)-Math.max(t.y,e.y);return s>0&&r>0?s*r:0}function Hd(t,e){let s=0;for(let r=0;r+1<t.length;r++){let i=t[r],o=t[r+1],n=Math.hypot(o[0]-i[0],o[1]-i[1]),a=Math.max(1,Math.ceil(n/4));for(let f=0;f<a;f++){let p=i[0]+(o[0]-i[0])*(f+.5)/a,c=i[1]+(o[1]-i[1])*(f+.5)/a;p>=e.x&&p<=e.x+e.w&&c>=e.y&&c<=e.y+e.h&&(s+=n/a*4)}}return s}var $s=64,Ma=class{cells=new Map;n=0;add(e,s,r,i,o){for(let n=Math.floor(s/$s);n<=Math.floor(i/$s);n++)for(let a=Math.floor(r/$s);a<=Math.floor(o/$s);a++){let f=n*1048576+a,p=this.cells.get(f);p||this.cells.set(f,p=[]),p[p.length-1]!==e&&p.push(e)}}query(e,s,r,i){let o=new Set;for(let n=Math.floor(e/$s);n<=Math.floor(r/$s);n++)for(let a=Math.floor(s/$s);a<=Math.floor(i/$s);a++){let f=this.cells.get(n*1048576+a);if(f)for(let p of f)o.add(p)}return[...o].sort((n,a)=>n-a)}},xc=t=>{let e=1/0,s=1/0,r=-1/0,i=-1/0;for(let[o,n]of t)o<e&&(e=o),o>r&&(r=o),n<s&&(s=n),n>i&&(i=n);return[e,s,r,i]},Pa=new WeakMap;function Fs(t,e){let s=Pa.get(t);for((!s||s.n>t.length)&&Pa.set(t,s=new Ma);s.n<t.length;s.n++){let[r,i,o,n]=e(t[s.n]);s.add(s.n,r,i,o,n)}return s}function Zd(t){let e=Pa.get(t);for((!e||e.n>t.length)&&Pa.set(t,e=new Ma);e.n<t.length;e.n++){let s=t[e.n].pts;for(let r=0;r+1<s.length;r++){let i=s[r],o=s[r+1],n=e.n*65536+r,a=Math.max(1,Math.ceil(Math.hypot(o[0]-i[0],o[1]-i[1])/($s/2)));for(let f=0;f<a;f++){let p=f/a,c=(f+1)/a,l=i[0]+(o[0]-i[0])*p,d=i[1]+(o[1]-i[1])*p,m=i[0]+(o[0]-i[0])*c,h=i[1]+(o[1]-i[1])*c;e.add(n,Math.min(l,m)-1,Math.min(d,h)-1,Math.max(l,m)+1,Math.max(d,h)+1)}}}return e}var ds=(t,e,s,r,i)=>t.query(e,s,r,i),Ir=t=>xc(t),va=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function Ud(t,e,s,[r,i,o,n]){let a=0,f=s-1;for(let p of[0,1]){let c=e[p]-t[p],l=p?i:r,d=p?n:o;if(Math.abs(c)<1e-12){if(t[p]<l||t[p]>d)return[1,0];continue}let m=(l-t[p])/c*s-.5,h=(d-t[p])/c*s-.5;m>h&&([m,h]=[h,m]),a=Math.max(a,Math.floor(m)-1),f=Math.min(f,Math.ceil(h)+1)}return[a,f]}var nr=class t{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...va(e)))s+=zr(this.solids[r],e);return s}hiddenPoly(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...xc(e)))s+=Bi(e,this.solids[r]);return s}costPoly(e,s=1/0){let r=xc(e),i=0;for(let o of ds(Fs(this.polys,n=>Ir(n.poly)),...r))i+=Bi(e,this.polys[o].poly);for(let o of ds(Fs(this.rects,n=>va(n.r)),...r))i+=zr(e,this.rects[o].r)*2;for(let o of ds(Fs(this.slants,Ir),...r))i+=Bi(e,this.slants[o])*2;if(i>=s)return i;for(let o of ds(Zd(this.lines),...r)){if(i>=s)return i;let n=this.lines[Math.floor(o/65536)].pts,a=o%65536,f=n[a],p=n[a+1],c=Math.hypot(p[0]-f[0],p[1]-f[1]),l=Math.max(1,Math.ceil(c/4)),[d,m]=Ud(f,p,l,r);for(let h=d;h<=m;h++)vc(e,[f[0]+(p[0]-f[0])*(h+.5)/l,f[1]+(p[1]-f[1])*(h+.5)/l])&&(i+=c/l*4*.6)}return i}cost(e,s,r=.6){let i=va(e),o=0;for(let n of ds(Fs(this.polys,a=>Ir(a.poly)),...i)){let a=this.polys[n];o+=zr(a.poly,e)*(a.owner===s?1.5:1)}for(let n of ds(Fs(this.rects,a=>va(a.r)),...i)){let a=this.rects[n];(a.owner!==s||!s)&&(o+=$c(a.r,e)*2)}for(let n of ds(Fs(this.slants,Ir),...i))o+=zr(this.slants[n],e)*2;if(r){let n=-1,a=0;for(let f of ds(Zd(this.lines),...i)){let p=Math.floor(f/65536);p!==n&&(n>=0&&(o+=a*r),n=p,a=0);let c=this.lines[p].pts,l=f%65536,d=c[l],m=c[l+1],h=Math.hypot(m[0]-d[0],m[1]-d[1]),y=Math.max(1,Math.ceil(h/4)),[g,k]=Ud(d,m,y,i);for(let u=g;u<=k;u++){let b=d[0]+(m[0]-d[0])*(u+.5)/y,x=d[1]+(m[1]-d[1])*(u+.5)/y;b>=e.x&&b<=e.x+e.w&&x>=e.y&&x<=e.y+e.h&&(a+=h/y*4)}}n>=0&&(o+=a*r)}return o}fork(){let e=new t;return e.budget=this.budget,e.polys=this.polys,e.lines=this.lines,e.solids=this.solids,e.rects=[...this.rects],e.slants=this.slants,e}},Yd=14;function qi(t,e,s,r){let i=Math.max(t.name?On(t.name,wt.lbl):0,t.sub?On(t.sub,wt.sub):0)+4,o=(t.name?1:0)+(t.sub?1:0),n=s-(t.name?11:9)-1,a=(o-1)*Yd+(t.name?11:9)+4;return{x:r==="start"?e-2:r==="end"?e-i+2:e-i/2,y:n,w:i,h:a}}function Vi(t,e,s,r,i,o){let n=Yn(s),a=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,e.z1)[0],p=((t.name?1:0)+(t.sub?1:0)-1)*Yd+4,c=n.y-6-p,l=n.y+Math.min(n.h,60)*.45,d=[];o&&d.push({...o,pen:0}),d.push({x:a,y:c,anchor:"middle",pen:o?20:0});for(let y of[12,24,40])d.push({x:a,y:c-y,anchor:"middle",pen:20+y});for(let y of[-30,30,-60,60])d.push({x:a+y,y:c-4,anchor:"middle",pen:30+Math.abs(y)});d.push({x:n.x+n.w+8,y:l,anchor:"start",pen:120}),d.push({x:n.x-8,y:l,anchor:"end",pen:120}),d.push({x:a,y:n.y+n.h+14,anchor:"middle",pen:300});let m,h=1/0;for(let y of d){let g=qi(t,y.x,y.y,y.anchor),k=r.cost(g,i,.15)*2+y.pen;k<h&&(h=k,m={x:y.x,y:y.y,anchor:y.anchor,rect:g})}return m}function Sc(t,e,s,r){return{x:(r==="start"?e:r==="end"?e-t:e-t/2)-2,y:s-14,w:t+4,h:28}}function Oa(t,e,s,r,i){let o=[{...r,pen:0}];for(let c of[-46,-66,-86,-106,-126,-146])for(let l of[0,-70,70,-140,140])o.push({x:e+l,y:s+c,anchor:"middle",pen:10+(-c-46)*.5+Math.abs(l)*.4});for(let c of[34,60,86])o.push({x:e,y:s+c,anchor:"middle",pen:60+c*.3});let n=r.x-e,a=r.y-s;for(let c of[-1,1])for(let l of[16,32,48])o.push({...r,y:s+a+c*l,x:e+n,pen:5+l});for(let c of[-1,1])for(let l of[30,60,90])for(let d of[0,16,-16])o.push({...r,x:e+n+c*l,y:s+a+d,pen:8+l*.6+Math.abs(d)});let f,p=1/0;for(let c of o){let l=Sc(t,c.x,c.y,c.anchor),d=i.cost(l,void 0,.05)*3+c.pen;d<p&&(p=d,f={x:c.x,y:c.y,anchor:c.anchor,rect:l})}return f}var Wd=t=>{let e=0;for(let s=0;s<t.length;s++){let r=t[s],i=t[(s+1)%t.length];e+=r[0]*i[1]-i[0]*r[1]}return e/2},kc=t=>Wd(t)<0?[...t].reverse():t;function vc(t,e){let s=kc(t);for(let r=0;r<s.length;r++){let i=s[r],o=s[(r+1)%s.length];if((o[0]-i[0])*(e[1]-i[1])-(o[1]-i[1])*(e[0]-i[0])<0)return!1}return!0}function Bi(t,e){let s=kc(t),r=kc(e);for(let i=0;i<r.length&&s.length;i++){let o=r[i],n=r[(i+1)%r.length],a=p=>(n[0]-o[0])*(p[1]-o[1])-(n[1]-o[1])*(p[0]-o[0]),f=s;s=[];for(let p=0;p<f.length;p++){let c=f[p],l=f[(p+1)%f.length],d=a(c),m=a(l);if(d>=0&&s.push(c),d>=0!=m>=0){let h=d/(d-m);s.push([c[0]+(l[0]-c[0])*h,c[1]+(l[1]-c[1])*h])}}}return s.length>=3?Math.abs(Wd(s)):0}var Aa=24;function Cr(t,e){let[s,r,i,o]=e,n=t.x+t.w/2,a=t.y+t.h/2,f=[["left",n-s],["right",s+i-n],["top",a-r],["bottom",r+o-a]];f.sort((c,l)=>c[1]-l[1]);let p=f[0][0];return p==="left"?{edge:p,dx:-(t.x+t.w-s)-Aa,dy:0}:p==="right"?{edge:p,dx:s+i-t.x+Aa,dy:0}:p==="top"?{edge:p,dx:0,dy:-(t.y+t.h-r)-Aa}:{edge:p,dx:0,dy:r+o-t.y+Aa}}function Ta(t,e,s){let r=x=>{let w=0;for(let $=x.parent;$;$=$.parent)w++;return w},i=x=>x.box.x0+x.box.y0+x.box.z0*.01,o=t.items.filter(x=>x.type==="region").sort((x,w)=>r(x)-r(w)||i(x)-i(w)),n=t.items.filter(x=>x.type==="node").sort((x,w)=>i(x)-i(w)||x.box.z0-w.box.z0),a=[],f=Math.min(90,400/Math.max(1,o.length)),p=650;o.forEach((x,w)=>{let $=Yn(Yt(x.box));a.push({id:x.id,kind:"region",...Cr($,s),delay:Math.round(w*f),dur:p,bbox:$})});let c=250+Math.round(f*o.length),l=Math.min(70,700/Math.max(1,n.length)),d=600;n.forEach((x,w)=>{let $=Yn(Yt(x.box));a.push({id:x.id,kind:"node",...Cr($,s),delay:Math.round(c+w*l),dur:d,bbox:$})});let m=n.length?c+(n.length-1)*l:c,h=Math.round(m+300),y=Math.min(30,300/Math.max(1,e.length)),g=400,k=e.filter(x=>x.points.length>=2).map((x,w)=>({id:x.id,delay:Math.round(h+w*y),dur:g})),u={delay:h+200,dur:400},b=Math.max(...a.map(x=>x.delay+x.dur),...k.map(x=>x.delay+x.dur),u.delay+u.dur);return{pieces:a,routes:k,labels:u,total:b}}var jr=["edge","drop","rise","fly","pop","scatter","build","fade"],Lr=["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],sr=["by-depth","by-layer","by-region","by-flow","as-listed","random"],tf=["linear","ease","ease-in","ease-out","settle","spring","bounce"],En=t=>Math.round(t*100)/100||0,ln=t=>Math.round(t*1e4)/1e4||0;function rr(t){let e=i=>{let o=0;for(let n=i.parent;n;n=n.parent)o++;return o},s=i=>{let o=[];for(let n=i;n;n=n.parent){let a=(n.region??n.node)?.motion;a&&o.unshift(a)}return o.length?Object.assign({},...o):void 0},r=new Set(t.layout.items.filter(i=>i.region&&t.layout.catalog&&t.rendered.svg.includes(`class="tunnel" data-id="${i.id}"`)).map(i=>i.id));return{viewBox:t.rendered.viewBox,pieces:t.layout.items.map(i=>{let o=i.box,n=Ne((o.x0+o.x1)/2,(o.y0+o.y1)/2,o.z0),a=s(i);return{id:i.id,kind:i.type,...i.parent?{parent:i.parent.id}:{},depth:e(i),layer:r.has(i.id)?2:i.type==="region"?0:1,key:En(o.x0+o.y0+o.z0*.01),bbox:Yn(Yt(o)),foot:[En(n[0]),En(n[1])],base:[Ne(o.x0,o.y1,o.z0),Ne(o.x1,o.y1,o.z0),Ne(o.x1,o.y0,o.z0)].map(f=>[En(f[0]),En(f[1])]),...a?{motion:a}:{}}}),routes:t.routes.filter(i=>t.rendered.paths[i.id]).map(i=>({id:i.id,path:t.rendered.paths[i.id],...eh(i.raw)})),notes:Object.fromEntries((t.raw.notes??[]).map((i,o)=>[`${t.id}-note-${o}`,i.on])),intro:t.rendered.assembly}}var Jd=t=>typeof t=="string"?t.split(".")[0]:void 0,eh=t=>{let e=Jd(t.from),s=Jd(t.to);return{...e?{from:e}:{},...s?{to:s}:{}}},Ea=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<40;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},Mc={linear:t=>t,ease:Ea(.42,0,.58,1),"ease-in":Ea(.42,0,1,1),"ease-out":Ea(0,0,.58,1),settle:Ea(.16,.84,.3,1),spring:t=>t<=0?0:t>=1?1:1-Math.exp(-6*t)*Math.cos(9.5*t)*(1-t),bounce:t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375}};function Ac(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Xd=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0},Wn=t=>Math.max(0,Math.min(1,t)),Na=24;function Pc(t,e,s){let[r,i,o,n]=e;return s==="left"?[-(t.x+t.w-r)-Na,0]:s==="right"?[r+o-t.x+Na,0]:s==="top"?[0,-(t.y+t.h-i)-Na]:[0,i+n-t.y+Na]}function Ec(t,e,s={}){let r=t.pieces,i=new Map(r.map(y=>[y.id,y])),o=(y,g)=>y.depth-g.depth||y.key-g.key;if(e==="as-listed")return[...r];if(e==="random"){let y=Ac(s.seed??1);return r.map(g=>[y(),g]).sort((g,k)=>g[0]-k[0]).map(g=>g[1])}if(e==="by-layer")return[...r].sort((y,g)=>y.layer-g.layer||o(y,g));if(e==="by-depth")return[...r].sort((y,g)=>y.key-g.key||y.depth-g.depth);let n=new Map;for(let y of[...r].sort(o)){let g=n.get(y.parent)??[];g.push(y),n.set(y.parent,g)}let a=[],f=new Set,p=y=>{if(f.has(y.id))return;let g=y.parent?i.get(y.parent):void 0;g&&p(g),f.add(y.id),a.push(y)};if(e==="by-region"){let y=g=>{for(let k of n.get(g)??[])p(k),y(k.id)};return y(),a}let c=new Map,l=new Set;for(let y of t.routes)y.from&&y.to&&(c.set(y.from,[...c.get(y.from)??[],y.to]),l.add(y.to));let d=s.source??t.routes.find(y=>y.from&&!l.has(y.from))?.from??t.routes[0]?.from,m=d?[d]:[],h=new Set(m);for(;m.length;){let y=m.shift(),g=i.get(y);g&&p(g);for(let k of c.get(y)??[])h.has(k)||(h.add(k),m.push(k))}for(let y of[...r].sort(o))p(y);return a}var th={edge:"settle",drop:"settle",rise:"ease-out",fly:"settle",pop:"spring",scatter:"settle",build:"ease-out",fade:"linear",explode:"ease-in","lift-off":"ease-in",sink:"ease-in","fly-out":"ease-in",collapse:"ease-in"},nh={"lift-off":"lift",sink:"rise",scatter:"scatter","fly-out":"edge",fade:"fade",explode:"explode",collapse:"collapse"};function _r(t,e,s={}){let r=s.seed??1,i=e==="disassemble",o=i&&s.style==="reverse",n=Z=>{if(!i)return Z.motion?.style??s.style??"edge";let L=Z.motion?.out??s.style??"fly-out";return L==="reverse"?Z.motion?.style??s.of??"edge":nh[L]},a=Z=>i?Z.motion?.out??s.style??"fly-out":n(Z),f=!i&&!s.order&&s.stagger===void 0&&s.piece===void 0&&s.overlap===void 0&&(s.style??"edge")==="edge",p=s.order??(s.style==="build"?"by-layer":"by-depth"),c=[],l,d,m=(Z,L,U)=>{let H=n(Z),ee=Z.motion?.easing??s.easing??th[i&&a(Z)!=="reverse"?a(Z):H]??"ease";return{p:Z,delay:L+(Z.motion?.delay??0),dur:Math.max(1,Z.motion?.duration??U),style:H,curve:Mc[ee],from:Z.motion?.from??s.from??"left"}};if(f){let Z=new Map(t.pieces.map(L=>[L.id,L]));for(let L of t.intro.pieces){let U=Z.get(L.id);U&&c.push(m(U,L.delay,L.dur))}l=t.intro.routes.map(L=>({...L})),d={...t.intro.labels}}else{let Z=Ec(t,p,{seed:r,source:s.source}),L=s.piece??600,U=s.stagger??Math.min(70,900/Math.max(1,Z.length)),H=Wn(s.overlap??.5),ee=o||i?[...Z].reverse():Z,j=Math.min(30,300/Math.max(1,t.routes.length)),q=400,G=400;if(i){d={delay:0,dur:G};let Q=G*(1-H);l=[...t.routes].reverse().map((Y,ie)=>({id:Y.id,delay:Q+ie*j,dur:q}));let le=Math.max(Q,...l.map(Y=>Y.delay+Y.dur)),pe=Math.max(0,le-H*q);ee.forEach((Y,ie)=>c.push(m(Y,pe+ie*U,L)))}else{ee.forEach((Y,ie)=>c.push(m(Y,ie*U,L)));let Q=Math.max(0,...c.map(Y=>Y.delay+Y.dur)),le=Math.max(0,Q-H*L);l=t.routes.map((Y,ie)=>({id:Y.id,delay:le+ie*j,dur:q}));let pe=Math.max(le,...l.map(Y=>Y.delay+Y.dur));d={delay:Math.max(0,pe-H*G),dur:G}}}let h=s.pulses&&t.routes.length?700:0;if(h&&i)for(let Z of[...c,...l,d])Z.delay+=h;let y=Math.max(1,...c.map(Z=>Z.delay+Z.dur),...l.map(Z=>Z.delay+Z.dur),d.delay+d.dur),g=i?0:y;h&&!i&&(y+=h);let k=s.duration!==void 0?Math.max(1,s.duration)/y:1;for(let Z of[...c,...l,d])Z.delay=En(Z.delay*k),Z.dur=Math.max(.01,En(Z.dur*k));let u=s.duration!==void 0?Math.max(1,s.duration):Math.max(1,En(y)),b=new Map(c.map(Z=>[Z.p.id,Z])),x=new Map(l.map(Z=>[Z.id,Z])),[w,$,v,O]=t.viewBox,C=[w+v/2,$+O/2],A=Z=>[Z.x+Z.w/2,Z.y+Z.h/2],R=(Z,L)=>{let U=s.point;if(Array.isArray(U))return U;if(U==="region"||L==="collapse"&&U===void 0&&Z.parent){let H=t.pieces.find(ee=>ee.id===Z.parent);return H?H.foot:C}if(typeof U=="string"){let H=t.pieces.find(ee=>ee.id===U);if(H)return H.foot}return C};function M(Z,L,U){let{p:H}=Z,ee=H.bbox,j=1-L,q=(G,Q)=>({dx:En(G*j),dy:En(Q*j)});switch(Z.style){case"drop":return q(...Pc(ee,t.viewBox,"top"));case"lift":return q(...Pc(ee,t.viewBox,"top"));case"fly":return q(...Pc(ee,t.viewBox,Z.from));case"rise":{let G=ee.h*j,[Q,le,pe]=H.base,Y=ee.y-ee.h-4;return{...q(0,ee.h),clip:[[Q[0],Q[1]-G],[le[0],le[1]-G],[pe[0],pe[1]-G],[pe[0]+2,Y-G],[Q[0]-2,Y-G]].map(ie=>[En(ie[0]),En(ie[1])])}}case"pop":return{scale:ln(Math.max(0,L)),about:H.foot,opacity:ln(Wn(U*4))};case"scatter":{let G=Ac((r^Xd(H.id))>>>0),Q=G()*Math.PI*2,le=.35+G()*.65;return{...q(Math.cos(Q)*v*le*.6,Math.sin(Q)*O*le*.6),opacity:ln(Wn(L*1.6))}}case"build":return{...q(0,-18),opacity:ln(Wn(L))};case"fade":return{opacity:ln(Wn(L))};case"explode":{let G=R(H,"explode"),Q=A(ee),le=Q[0]-G[0],pe=Q[1]-G[1],Y=Math.hypot(le,pe),ie=Ac((r^Xd(H.id))>>>0),Ae=ie()*Math.PI*2,De=Y>1?[le/Y,pe/Y]:[Math.cos(Ae),Math.sin(Ae)],I=Math.hypot(v,O)+Math.max(ee.w,ee.h);return q(De[0]*I,De[1]*I)}case"collapse":{let G=R(H,"collapse");return{...q(G[0]-H.foot[0],G[1]-H.foot[1]),scale:ln(Math.max(0,L)),about:H.foot,opacity:ln(Wn(L*3))}}default:{let G=Cr(ee,t.viewBox);return q(G.dx,G.dy)}}}let T=(Z,L,U)=>{let H=Wn((Z-L)/U);return i?1-H:H},S={opacity:0},N=s.connectors??"draw",z=s.labels??"fade",K=[...t.pieces.map(Z=>Z.id),...t.routes.map(Z=>Z.id),...Object.keys(t.notes)];function J(Z){let L=Math.max(0,Math.min(u,Number.isFinite(Z)?Z:0));if(i?L<=0:L>=u)return{};let U=i?L>=u:L<=0,H={},ee={},j={};for(let pe of c){let Y=U?0:T(L,pe.delay,pe.dur);Y<=0?H[pe.p.id]=S:Y<1&&(H[pe.p.id]=M(pe,i?1-pe.curve(1-Y):pe.curve(Y),Y))}for(let pe of t.routes){let Y=x.get(pe.id),ie=U||!Y?0:T(L,Y.delay,Y.dur);ie<=0?ee[pe.id]={opacity:0,drawn:0}:ie<1&&(ee[pe.id]=N==="fade"?{opacity:ln(ie)}:N==="grow"?{drawn:ln(ie),by:"grow"}:{drawn:ln(Mc["ease-out"](ie))})}let q=U?0:T(L,d.delay,d.dur),G=q<=0?S:q>=1?void 0:z==="type"?{typed:ln(q)}:{opacity:ln(q)};for(let pe of K){let Y=G;if(z==="with-piece"){let ie=Object.hasOwn(t.notes,pe)?t.notes[pe]:pe,Ae=ie===void 0?void 0:b.get(ie)??x.get(ie);if(Ae){let De=U?0:T(L,Ae.delay,Ae.dur);Y=De<=0?S:De>=1?void 0:{opacity:ln(De)}}}Y&&(j[pe]=Y)}let Q=[];if(h&&!U){let pe=(L-g*k)/(h*k);if(pe>0&&pe<1)for(let Y of t.routes)Q.push({route:Y.id,at:ln(Mc.ease(pe))})}let le=pe=>Object.keys(pe).length>0;return{...le(H)?{items:H}:{},...le(j)?{labels:j}:{},...le(ee)?{routes:ee}:{},...q<1?{marks:{opacity:ln(Math.max(0,q))}}:{},...Q.length?{tokens:Q}:{}}}return{kind:e,duration:u,pieces:c.map(Z=>({id:Z.p.id,delay:Z.delay,dur:Z.dur,style:a(Z.p)})),routes:l,labels:d,at:J}}var xt=t=>{let e=t.toFixed(2);return e==="-0.00"?"0":String(Number(e))},sh=(t,e)=>`translate(${xt(t[0])} ${xt(t[1])}) scale(${Number(e.toFixed(4))}) translate(${xt(-t[0])} ${xt(-t[1])})`,Nc=t=>[...t.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map(e=>[Number(e[1]),Number(e[2])]),Rc=t=>t.slice(1).reduce((e,s,r)=>e+Math.hypot(s[0]-t[r][0],s[1]-t[r][1]),0);function Ra(t,e){let s=Nc(t),r=Rc(s)*e;for(let i=0;i+1<s.length;i++){let o=Math.hypot(s[i+1][0]-s[i][0],s[i+1][1]-s[i][1]);if(r<=o&&o>0){let n=r/o;return[s[i][0]+(s[i+1][0]-s[i][0])*n,s[i][1]+(s[i+1][1]-s[i][1])*n]}r-=o}return s[s.length-1]??[0,0]}function rh(t,e){let s=Nc(t),r=Ra(t,e),i=[],o=Rc(s)*e;for(let n=0;n<s.length;n++){i.push(s[n]);let a=n+1<s.length?Math.hypot(s[n+1][0]-s[n][0],s[n+1][1]-s[n][1]):1/0;if(o<=a)break;o-=a}return"M"+[...i,r].map(n=>`${xt(n[0])},${xt(n[1])}`).join(" L")}var fs=t=>String(Number(t.toFixed(4)));function ih(t,e){let s=t.match(/&[^;\s]+;|[\s\S]/gu)??[];return s.slice(0,Math.round(s.length*e)).join("")}function oh(t){let e=[];return(t.dx||t.dy)&&e.push(`translate(${xt(t.dx??0)} ${xt(t.dy??0)})`),t.scale!==void 0&&t.scale!==1&&e.push(sh(t.about??[0,0],t.scale)),{attrs:{...t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)},...e.length?{transform:e.join(" ")}:{}},clip:t.clip}}function ah(t,e){let s={attrs:t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)}};if(t.drawn!==void 0&&t.drawn<1&&e!==void 0){let r=Wn(t.drawn),i=Rc(Nc(e));s.path=t.by==="grow"?{d:rh(e,r),head:!1}:{style:`stroke-dasharray:${xt(i)} ${xt(i)};stroke-dashoffset:${xt(i*(1-r))}`,head:!1}}else t.ants&&(s.path={style:`stroke-dasharray:${xt(t.ants.dash[0])} ${xt(t.ants.dash[1])};stroke-dashoffset:${xt(-t.ants.offset)}`,head:!0});return s}function nf(t,e,s,r,i){if(r==="label"||r==="note"){let n=t.labels&&Object.hasOwn(t.labels,s)?t.labels[s]:void 0;return n&&{attrs:{...n.opacity===void 0||n.opacity===1?{}:{opacity:fs(n.opacity)},...n.dx||n.dy?{transform:`translate(${xt(n.dx??0)} ${xt(n.dy??0)})`}:{}},...n.typed===void 0||n.typed>=1?{}:{typed:n.typed}}}if(e==="route"){let n=t.routes&&Object.hasOwn(t.routes,s)?t.routes[s]:void 0;return n&&ah(n,i(s))}let o=t.items&&Object.hasOwn(t.items,s)?t.items[s]:void 0;return o&&oh(o)}function sf(t,e,s){let r=[];for(let i of t.outlines??[])r.push(["polygon",{points:i.points.map(o=>o.map(xt).join(",")).join(" "),class:"ring",fill:"none","stroke-width":"2.5","stroke-linejoin":"round",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"var(--ring,var(--control,currentColor))"}`}}]);for(let i of t.pulses??[])r.push(["ellipse",{cx:xt(i.x),cy:xt(i.y),rx:xt(i.rx),ry:xt(i.ry),class:"ring",fill:"none","stroke-width":"2.5",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"currentColor"}`}}]);for(let i of t.tokens??[]){let o=e(i.route);if(o===void 0)continue;let[n,a]=Ra(o,Wn(i.at));r.push(["circle",{cx:xt(n),cy:xt(a),r:"7",class:"tok",...s?{fill:i.color??(i.kind!==void 0?s.kinds?.[i.kind]:void 0)??s.control,stroke:s.surface,"stroke-width":"2.5"}:{style:`fill:${i.color??(i.kind!==void 0?`var(--${i.kind},var(--control,currentColor))`:"var(--control,currentColor)")}`}}])}return r}var rf=t=>Object.keys(t).every(e=>e==="morph"||t[e]===void 0),of=new Set(["marks","badges"]),Qd=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,""");function Tc(t){let e=new Map,s=[];for(let r of t.matchAll(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>/g)){if(r[1]){let n=s.pop();n?.key!==void 0&&e.set(n.key,[n.from,r.index]);continue}if(r[4])continue;let i=/\sdata-item="([^"]*)"/.exec(r[3])?.[1],o=/\sdata-part="([^"]*)"/.exec(r[3])?.[1];s.push({...s.length===2&&i!==void 0&&o!==void 0?{key:`${lf(i)}
|
|
143
|
+
${o}`}:{},from:r.index+r[0].length})}return e}var ef=new WeakMap;function lh(t,e){let s=ef.get(t)??new Map;ef.set(t,s);let r=s.get(e);if(!r){s.set(e,r=new Map);let i=t.variants?.[e],o=Tc(t.svg);if(i!==void 0)for(let[n,[a,f]]of Tc(i)){let p=o.get(n);p&&t.looks?.[n.split(`
|
|
144
|
+
`)[0]]?.includes(e)&&t.svg.slice(...p)!==i.slice(a,f)&&r.set(n,i.slice(a,f))}}return r}function af(t,e,s,r){let i=[];for(let o of t.looks?.[e]??[]){let n=Wn(r[o]??0),a=n>0?lh(t,o).get(`${e}
|
|
145
|
+
${s}`):void 0;a!==void 0&&i.push([a,n])}return i.length?{own:Wn(1-i.reduce((o,[,n])=>o+n,0)),looks:i}:void 0}var ch=(t,e)=>(e.own>0?`<g opacity="${fs(e.own)}">${t}</g>`:"")+e.looks.map(([s,r])=>`<g opacity="${fs(r)}">${s}</g>`).join("");function ph(t,e){let s="",r=0;for(let[i,[o,n]]of[...Tc(t.svg)].sort((a,f)=>a[1][0]-f[1][0])){let[a,f]=i.split(`
|
|
146
|
+
`),p=Object.hasOwn(e,a)?af(t,a,f,e[a]):void 0;p&&(s+=t.svg.slice(r,o)+ch(t.svg.slice(o,n),p),r=n)}return s+t.svg.slice(r)}function Ki(t,e){if(rf(e))return t.rendered.svg;let s=e.variants?ph(t.rendered,e.variants):t.rendered.svg,r=l=>Object.hasOwn(t.rendered.paths,l)?t.rendered.paths[l]:void 0,i=0,o="",n="",a=0,f,p=s.replace(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,(l,d,m,h,y,g)=>{if(g!==void 0)return f?.w.typed===void 0?l:ih(g,f.w.typed);if(d)return i--,f&&i===f.at&&(f=void 0),i===1&&(o=""),l;let k=i;y||i++;let u={};for(let[,b,x]of h.matchAll(/([\w:-]+)="([^"]*)"/g))u[b]=x;if(k===0){if(!e.camera)return l;u.viewBox=e.camera.map(xt).join(" ")}else if(k===1)if(o=m==="g"&&u.class?.startsWith("g-")?u.class.slice(2):"",of.has(o)&&e.marks&&e.marks.opacity!==1)u.opacity=fs(e.marks.opacity);else return l;else if(k===2&&u["data-part"]!==void 0){let b=u["data-route"]===void 0?"item":"route",x=lf(u["data-route"]??u["data-item"]??""),w=nf(e,b,x,u["data-part"],r);if(!w)return l;for(let[$,v]of Object.entries(w.attrs))u[$]=Qd(v);if(w.clip){let $=`${t.id}-mc${a++}`;n+=`<clipPath id="${$}"><polygon points="${w.clip.map(v=>v.join(",")).join(" ")}"/></clipPath>`,u["clip-path"]=`url(#${$})`}if(!y&&(w.path||w.typed!==void 0)&&(f={at:k,w}),!Object.keys(w.attrs).length&&!w.clip)return l}else if(f?.w.path&&m==="path"&&u.class?.split(" ")[0]==="flow"){let b=f.w.path;b.d!==void 0&&(u.d=b.d),b.style!==void 0&&(u.style=b.style),b.head||delete u["marker-end"]}else return l;return`<${m}${Object.entries(u).map(([b,x])=>` ${b}="${x}"`).join("")}${y?"/":""}>`});n&&(p=p.replace(/<defs>|<defs\/>/,l=>l==="<defs/>"?`<defs>${n}</defs>`:l+n));let c=sf(e,r,t.rendered.inks);return c.length&&(p=p.replace('<g class="g-anim">',l=>l+c.map(([d,m])=>`<${d}${Object.entries(m).map(([h,y])=>` ${h}="${Qd(y)}"`).join("")}/>`).join(""))),p}var lf=t=>t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&"),Oc=new WeakMap;function Ia(t,e,s,r={}){let i=Oc.get(t);if(i){for(let[u,b]of i.mixed)u.replaceChildren(...b);for(let[u,b]of i.attrs)for(let[x,w]of b)w===null?u.removeAttribute(x):u.setAttribute(x,w);for(let[u,b,x]of i.gone.reverse())b.insertBefore(u,x);for(let[u,b]of i.texts)u.data=b;for(let u of i.made)u.remove();Oc.delete(t)}if(rf(e))return;let o={attrs:new Map,texts:new Map,gone:[],made:[],mixed:[]};Oc.set(t,o);let n=(u,b,x)=>{let w=o.attrs.get(u)??new Map;w.has(b)||w.set(b,b==="style"?u.getAttribute(b)||null:u.getAttribute(b)),o.attrs.set(u,w),x===null?u.removeAttribute(b):u.setAttribute(b,x)},a=t.ownerDocument,f=(u,b,x)=>{let w=a.createElementNS("http://www.w3.org/2000/svg",u);for(let[$,v]of Object.entries(b))w.setAttribute($,v);return x.append(w),o.made.push(w),w},p=Array.from(t.children),c=u=>p.find(b=>b.getAttribute("class")===`g-${u}`),l=new Map;for(let u of Array.from(c("flows")?.children??[])){let b=u.getAttribute("data-route"),x=u.querySelector("path.flow")?.getAttribute("d");b!==null&&x&&l.set(b,x)}let d=u=>l.get(u);e.camera&&n(t,"viewBox",e.camera.map(xt).join(" "));for(let u of of){let b=c(u);b&&e.marks&&e.marks.opacity!==1&&n(b,"opacity",fs(e.marks.opacity))}let m=0,h=p.find(u=>u.localName==="defs"),y=h?.firstChild??null,g=t.getAttribute("data-scene")??"scene";for(let u of p)for(let b of Array.from(u.children)){let x=b.getAttribute("data-part");if(x===null)continue;let w=b.getAttribute("data-route"),$=w===null?b.getAttribute("data-item")??"":"",v=s&&e.variants&&Object.hasOwn(e.variants,$)?af(s,$,x,e.variants[$]):void 0;if(v){let A=Array.from(b.childNodes),R=(T,S)=>{let N=a.createElementNS("http://www.w3.org/2000/svg","g");return N.setAttribute("opacity",fs(T)),N.append(...S),N},M=T=>Array.from(a.importNode(new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${T}</svg>`,"image/svg+xml").documentElement,!0).childNodes);o.mixed.push([b,A]),b.replaceChildren(...v.own>0?[R(v.own,A)]:[],...v.looks.map(([T,S])=>R(S,M(T))))}let O=nf(e,w===null?"item":"route",w??b.getAttribute("data-item")??"",x,d);if(!O)continue;for(let[A,R]of Object.entries(O.attrs))n(b,A,R);if(O.clip&&h){let A=f("clipPath",{id:`${g}-mc${m++}`},h);h.insertBefore(A,y);let R=a.createElementNS("http://www.w3.org/2000/svg","polygon");R.setAttribute("points",O.clip.map(M=>M.join(",")).join(" ")),A.append(R),n(b,"clip-path",`url(#${A.id})`)}if(O.typed!==void 0){let A=[];for(let R=a.createTreeWalker(b,4);R.nextNode();)A.push(R.currentNode);for(let R of A)o.texts.set(R,R.data),R.data=Array.from(R.data).slice(0,Math.round(Array.from(R.data).length*O.typed)).join(""),R.data||(o.gone.push([R,R.parentNode,R.nextSibling]),R.remove())}let C=O.path&&b.querySelector("path.flow");C&&O.path&&(O.path.d!==void 0&&n(C,"d",O.path.d),O.path.style!==void 0&&(r.styles==="cssom"?(n(C,"style",null),C.style.cssText=O.path.style):n(C,"style",O.path.style)),O.path.head||n(C,"marker-end",null))}let k=c("anim");if(k)for(let[u,b]of sf(e,d,s?.inks))f(u,b,k)}var cf=(t,e)=>({...e,frame:s=>Ki(t,e.at(s))}),Ic=(t,e={})=>cf(t,_r(rr(t),"assemble",e)),pf=(t,e={})=>cf(t,_r(rr(t),"disassemble",e)),df=(t,e)=>Ic(t).frame(e);var La=(t,e)=>e.role??Ot(t,e.kind)?.role,za=(t,e)=>Ot(t,e.region.kind)?.shape,xn=(t,e,s,r="item")=>s?Se("g",{[`data-${r}`]:t,"data-part":e},s):"";function Fr({scene:t,layout:e,routes:s,steps:r,theme:i,id:o,gridStep:n=1}){let a=new yr,f={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},p=new nr;p.budget.spots=ja;let c=S=>r.vis[S]?{"data-vis":"1"}:{},l=e.items.filter(S=>S.type==="region"),d=S=>{let N=0;for(let z=S.parent;z;z=z.parent)N++;return N},m=e.catalog,h=l.filter(S=>za(m,S)!=="walled"&&za(m,S)!=="tunnel"),y=mi(h.map(S=>({box:S.box,r:S}))).map(S=>S.r).sort((S,N)=>d(S)-d(N));for(let S of y)f.base+=fh(a,m,S,c(S.id),n);for(let S of l.filter(N=>za(m,N)==="walled")){for(let z of Ca(S))p.solids.push(Yt(z));for(let[z,K]of Ca(S).entries())f.blocks.push({box:K,svg:xn(S.id,`wall-${z+1}`,Se("g",{class:`blk k-${La(m,S.region)} wall${S.region.ghost?" ghost":""}`,"data-id":S.id,"data-dim":"1",...c(S.id)},a.blockFaces(K)))});let N=S.region.gate;if(N&&!N.node){let z=Fi(S,N.height??(S.region.height??.8)+.3,.3,.3);p.solids.push(Yt(z)),f.blocks.push({box:z,svg:xn(S.id,"gate",Se("g",{class:"blk k-gate","data-id":S.id,...c(S.id)},a.blockFaces(z)))})}S.region.label&&(S.region["label-style"]??"face")!=="none"&&(f.labels+=xn(S.id,"name",a.faceText(S.box.x0+.3,S.box.y1,S.box.z0+.13,S.region.label,"slabname sm fz",wt.sm,"left","start",{"data-id":S.id,...c(S.id)})))}for(let S of l.filter(N=>za(m,N)==="tunnel"))f.air+=xn(S.id,"block",uh(a,S,c(S.id)));let g=e.items.filter(S=>S.type==="node");for(let S of g){let N=S.node,z=Tn(m,N.asset),K=N.ghost||(N.deco??[]).includes("ghost"),J=["blk",`k-${N.role??z.role}`,z.cls,K?"ghost":""].filter(Boolean).join(" ");f.blocks.push({box:S.box,svg:xn(S.id,"block",Se("g",{class:J,"data-id":S.id,"data-dim":"1",...c(S.id)},z.draw(a,S.box,N)))}),p.polys.push({poly:Yt(S.box),owner:S.id}),p.solids.push(Yt(S.box))}let k=mi(f.blocks).map(S=>S.svg).join(""),u=new Set,b={};for(let S of s){if(S.points.length<2)continue;let N=S.points.map(J=>Ne(J[0],J[1],J[2]));N.forEach(J=>a.bounds.add(J));let z="M"+N.map(Us).join(" L");b[S.id]=z;let K=S.raw.arrow!==!1;K&&u.add(S.kind),f.flows+=xn(S.id,"line",Se("g",{"data-hl":S.id,"data-id":S.id,...c(S.id)},Se("path",{d:z,class:`flow f-${S.kind}`,"marker-end":K?`url(#ah-${o}-${S.kind})`:void 0})),"route"),p.lines.push({pts:N,owner:S.id})}for(let S of u)a.def(`ah-${o}-${S}`,Se("marker",{id:`ah-${o}-${S}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},Se("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${Hn(i,i.kinds[S]?.color??"control")}`})));for(let S of a.planePolys)p.slants.push(S);let x=g.filter(S=>S.node.label||S.node.sub).sort((S,N)=>(N.box.x1-N.box.x0)*(N.box.y1-N.box.y0)-(S.box.x1-S.box.x0)*(S.box.y1-S.box.y0));for(let S of x)f.labels+=xn(S.id,"label",mh(a,m,S,p,c(S.id)));let w=[];for(let S of s)if(S.raw.label&&S.points.length>=2){let N=hh(a,S,p,c(S.id),e);f.floor+=xn(S.id,"label",N.svg,"route"),N.warning&&w.push({path:`${S.path}/label`,message:N.warning}),p.budget.over&&!p.budget.told&&(p.budget.told=!0,w.push({path:S.path,message:`from route "${S.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${ja.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((S,N)=>{let z=xn(`${o}-note-${N}`,"note",yh(a,S,e,s,`${o}-note-${N}`));S.floor?f.floor+=z:f.labels+=z});let $=[],v=new Map;for(let S of r.says){let N=v.get(S.step)??p.fork();v.set(S.step,N);let z=On(S.text,wt.say)+18,K=Oa(z,S.ax,S.ay,{x:S.x,y:S.y,anchor:S.anchor},N);N.rects.push({r:K.rect,owner:""}),$.push({step:S.step,...K.rect,text:S.text});let J=K.rect.x+2;a.bounds.addRect(K.rect.x,K.rect.y,K.rect.w,K.rect.h);let Z=Hn(i,i.kinds[S.kind]?.color??"control");f.marks+=Se("g",{class:"say","data-step":S.step},Se("rect",{x:J,y:K.y-12,width:z,height:24,rx:12,style:`stroke:${Z}`})+Se("text",{x:J+z/2,y:K.y+4,"text-anchor":"middle",style:`fill:${Z}`},vt(S.text)))}for(let S of r.marks){let[N,z]=Ne(...S.p);a.bounds.addRect(N-12,z-12,24,24),f.marks+=Se("g",{class:"xm","data-step":S.step,"data-hl":S.on},Se("circle",{cx:N,cy:z,r:10})+Se("path",{d:`M${bt(N-4.5)},${bt(z-4.5)} L${bt(N+4.5)},${bt(z+4.5)} M${bt(N+4.5)},${bt(z-4.5)} L${bt(N-4.5)},${bt(z+4.5)}`}))}for(let S of r.badges){let[N,z]=Ne(...S.p);a.bounds.addRect(N-13,z-13,26,26),f.badges+=Se("g",{class:`badge c-${S.kind}`,"data-go":S.step,"data-badge":S.step,tabindex:"0",role:"button","aria-label":`Step ${S.num}`},Se("circle",{cx:N,cy:z,r:11.5})+Se("text",{x:N,y:z+.5},String(S.num)))}let O=a.bounds,C=22,A=O.empty?[0,0,100,100]:[Math.floor(O.x0-C),Math.floor(O.y0-C),Math.ceil(O.x1-O.x0+C*2),Math.ceil(O.y1-O.y0+C*2)],R=[...a.defs.values()].join(""),M=(S,N)=>Se("g",{class:"g-"+S},N);return{svg:Se("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:A.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},Se("defs",{},R)+M("base",f.base)+M("floor",f.floor)+M("flows",f.flows)+M("blocks",k)+M("air",f.air)+M("labels",f.labels)+M("marks",f.marks)+M("badges",f.badges)+M("anim","")),viewBox:A,texts:a.texts,paths:b,warnings:w,callouts:$,assembly:Ta(e,s,A)}}function dh(t,e){let s=t.z1+.002,r=1e-6,i=[],o=(n,a)=>{let f=Ne(n[0],n[1],s),p=Ne(a[0],a[1],s);i.push(`M${Us(f)}L${Us(p)}`)};for(let n=Math.ceil((t.x0+r)/e)*e;n<t.x1-r;n+=e)o([n,t.y0],[n,t.y1]);for(let n=Math.ceil((t.y0+r)/e)*e;n<t.y1-r;n+=e)o([t.x0,n],[t.x1,n]);return i.length?Se("path",{class:"grid",d:i.join("")}):""}function fh(t,e,s,r,i=1){let o=s.region,n=s.box,a=La(e,o),f=Ot(e,o.kind),p=f?.shape,c={"data-id":s.id,"data-dim":"1",...r},l="";p==="cloud"?l=Se("g",{class:`blk k-${a} cloud`,...c},Er(t,n)):p==="zone"?l=Se("g",{class:`zone k-${a}`,...c},t.poly([[n.x0,n.y0,n.z1],[n.x1,n.y0,n.z1],[n.x1,n.y1,n.z1],[n.x0,n.y1,n.z1]])):l=Se("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...c},t.blockFaces(n)+dh(n,i)),l=xn(s.id,"block",l);let d=o["label-style"]??f?.labelStyle;if(o.label&&d!=="none")if(d==="face"){let m=n.z1-n.z0,h=u=>u.size*.73/lt,y=p==="slab"&&.28+h(wt.slabname)+.08>m,g=p==="slab"&&!y,k=g?n.z0+.28:y?n.z0+Math.max(.02,(m-h(wt.sm))/2):n.z0+Math.min(.1,m*.25);l+=xn(s.id,"name",Se("g",c,t.faceText(n.x0+(g?.6:.3),n.y1,k,o.label,g?"slabname":"slabname sm",g?wt.slabname:wt.sm,"left","start")))}else if(d==="face-right")l+=xn(s.id,"name",Se("g",c,t.faceText(n.x1,n.y0+.6,n.z0+Math.max(.14,(n.z1-n.z0)*.2),o.label,"slabname",wt.slabname,"right","end")));else{let m=p==="cloud"?"middle":"start",h=p==="cloud"?(n.x0+n.x1)/2:n.x0+.35,y=p==="cloud"?(n.y0+n.y1)/2:n.y1-.35;l+=xn(s.id,"name",Se("g",c,t.floorText(h,y,n.z1+.01,o.label,"slabname sm","x",m)))}return l}function Ca(t){let{x0:e,y0:s,x1:r,y1:i,z0:o,z1:n}=t.box,a=ps,f=t.region.gate,p=[],c=d=>{d.x1-d.x0>1e-6&&d.y1-d.y0>1e-6&&p.push({...d,z0:o,z1:n})},l=(d,m,h)=>{if(!f||f.side!==h)return[[d,m]];let y=f.at??.5,g=f.width??2,k=h==="e"||h==="w"?s+(i-s)*y:e+(r-e)*y;return[[d,k-g/2],[k+g/2,m]]};for(let[d,m]of l(e,r,"n"))c({x0:d,y0:s,x1:m,y1:s+a});for(let[d,m]of l(s+a,i-a,"w"))c({x0:e,y0:d,x1:e+a,y1:m});for(let[d,m]of l(s+a,i-a,"e"))c({x0:r-a,y0:d,x1:r,y1:m});for(let[d,m]of l(e,r,"s"))c({x0:d,y0:i-a,x1:m,y1:i});return p}function mh(t,e,s,r,i){let o=s.node,n=Tn(e,o.asset),a=s.box,f={name:o.label,sub:o.sub},p=o["label-at"],c;if(p){let d=Yn(Yt(a)),m=p.side??"above",h=d.y+Math.min(d.h,60)*.45;m==="right"?c={x:d.x+d.w+8,y:h,anchor:"start"}:m==="left"?c={x:d.x-8,y:h,anchor:"end"}:m==="below"?c={x:d.x+d.w/2,y:d.y+d.h+14,anchor:"middle"}:c=Vi(f,a,Yt(a),new nr,s.id),c={...c,x:c.x+(p.dx??0),y:c.y+(p.dy??0)}}else{let d=n.label?n.label(a,o,!!o.sub):void 0;c=Vi(f,a,Yt(a),r,s.id,d)}r.rects.push({r:qi(f,c.x,c.y,c.anchor),owner:""});let l="";return o.label&&(l+=t.text(c.x,c.y,o.label,"lbl",wt.lbl,c.anchor,{},s.id)),o.sub&&(l+=t.text(c.x,o.label?c.y+14:c.y,o.sub,"sub mono",wt.sub,c.anchor,{},s.id)),Se("g",{"data-id":s.id,"data-dim":"1",...i},l)}function uh(t,e,s){let{x0:r,y0:i,x1:o,y1:n,z0:a,z1:f}=e.box,p=t.blockFaces(e.box),c=o-r>=n-i,l=Math.max(1,Math.round((c?o-r:n-i)/1.6));for(let m=1;m<l;m++){let h=c?r+(o-r)*m/l:i+(n-i)*m/l;p+=t.poly(c?[[h,i,f],[h,n,f],[h,n,a]]:[[r,h,f],[o,h,f],[o,h,a]],"rib")}let d=e.region.label;return d&&e.region["label-style"]!=="none"&&(p+=c?t.faceText(r+.35,n,a+.14,d,"tunname",wt.tunname,"left","start"):t.faceText(o,n-.35,a+.18,d,"tunname",wt.tunname,"right","start")),Se("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...s},p)}var ja=2e4;function hh(t,e,s,r,i){let o=typeof e.raw.label=="string"?{text:e.raw.label}:e.raw.label,n=`floor mono t-${e.kind}`,a={"data-hl":e.id,...r},f=wt.floor;if(o.at){let u=o.at.length>2?o.at[2]:e.points[0][2];return{svg:t.floorText(o.at[0],o.at[1],u,o.text,n,o.dir??"x",o.anchor??"start",a)}}let p=e.points,c=[];for(let u=0;u+1<p.length;u++){let b=p[u],x=p[u+1];Math.abs(b[2]-x[2])>1e-6||c.push({i:u,len:Math.hypot(x[0]-b[0],x[1]-b[1])})}if(!c.length)return{svg:"",warning:`label "${o.text}" of route "${e.id}" was dropped: the route has no level segment`};let l=o.along?c.filter(u=>u.i===Math.min(o.along-1,p.length-2)):[...c].sort((u,b)=>b.len-u.len),d=.22,m=11/lt,h=u=>{let b=On(u,f)/lt,x,w=1/0,$=0;e:for(let v of l.length?l:c){let O=p[v.i],C=p[v.i+1],A=O[2],R=Math.abs(O[1]-C[1])<1e-6,M=R?Math.min(O[0],C[0]):Math.min(O[1],C[1]),T=R?Math.max(O[0],C[0]):Math.max(O[1],C[1]),S=R?O[1]:O[0],N=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],z=[];for(let K=M+.3;K<=Math.max(M+.3,T-b-.2)+1e-9;K+=.4)z.push(K);for(let K=T-b-.2+.4;K<T+.5&&T-M<b+.5;K+=.6)z.push(K);for(let K of N)for(let J of z){if(w<=$*.5)break e;let Z=K<0?S-d:S+d+m,L,U,H;if(R?(L=J,U=Z,H=[Ne(L,U-m,A),Ne(L+b,U-m,A),Ne(L+b,U,A),Ne(L,U,A)]):(L=Z,U=J+b,H=[Ne(L-m,U,A),Ne(L-m,U-b,A),Ne(L,U-b,A),Ne(L,U,A)]),(R?[[L,U-m],[L+b,U-m],[L+b,U],[L,U]]:[[L-m,U],[L-m,U-b],[L,U-b],[L,U]]).some(([le,pe])=>Math.abs(Rr(i,le,pe)+.01-A)>.001)){$++;continue}let j=s.hiddenPoly(H),q=j*50+$*.5,G=s.budget.spots-- >0;G||(s.budget.over=!0);let Q=q>=w?1/0:G?q+s.costPoly(H,w-q):q;$++,Q<w&&(w=Q,x={x:L,y:U,z:A,dir:R?"x":"y",rect:Yn(H),poly:H,hidden:j})}}return x&&x.hidden<6?x:void 0},y=o.text,g=h(y),k;if(!g){let u=o.text.split(/(\s+)/);for(let b=u.length-1;b>0&&!g;b--){let x=u.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(x.length<6)break;let w=h(x);w&&(g=w,y=x)}k=g?`label of route "${e.id}" shortened to "${y}": no clear floor for the whole text`:`label "${o.text}" of route "${e.id}" was dropped: blocks cover every spot beside it`,g?k+='; give it "along", "side" or "at", or move the nodes apart':k+='; give it "at: [x, y]", or move the nodes apart'}return g?(s.slants.push(g.poly),{svg:t.floorText(g.x,g.y,g.z+.01,y,n,g.dir,"start",a),warning:k}):{svg:"",warning:k}}function yh(t,e,s,r,i){let o=e.on?r.find(c=>c.id===e.on):void 0,n=e.on&&!o?s.byId.get(e.on):void 0,a=e.at,f={"data-id":i,"data-hl":o?.id,"data-dim":o?void 0:"1"},p=e.kind??o?.kind??"control";if(e.floor){let c=a&&a.length>2?a[2]:o?o.points[0][2]:n?n.floor:.36,[l,d]=a?[a[0],a[1]]:o?[o.points[0][0]+.35,o.points[0][1]-.25]:n?[n.box.x0+.3,n.box.y1-.3]:[0,0];return t.floorText(l,d,c+.01,e.floor,`floor mono t-${p}`,e.dir??"x",e.anchor??"start",f)}if(e.face){let c=n?.box,[l,d,m]=a?[a[0],a[1],a[2]??.45]:c?[c.x0+.3,c.y1,c.z0+.13]:[0,0,0];return t.faceText(l,d,m,e.face,"slabname sm",wt.sm,"left",e.anchor??"start",f)}if(e.label||e.sub){let c=n?.box,l=a?[a[0],a[1],a[2]??.36]:c?[(c.x0+c.x1)/2,(c.y0+c.y1)/2,c.z1+.75]:[0,0,0],[d,m]=Ne(l[0],l[1],l[2]),h=d+(e.dx??0),y=m-18+(e.dy??0),g=e.anchor??"middle",k="";return e.label&&(k+=t.text(h,y,e.label,"lbl",wt.lbl,g)),e.sub&&(k+=t.text(h,e.label?y+14:y,e.sub,"sub mono",wt.sub,g)),Se("g",f,k)}return""}function _a(t,e){let s={};for(let r of t.layout.items){let i=(r.region??r.node)?.variants;i&&(s[r.id]=Object.keys(i))}Object.keys(s).length&&(t.rendered.looks=s,t.rendered.variants=Object.fromEntries([...new Set(Object.values(s).flat())].map(r=>[r,Fr({scene:t.raw,routes:t.routes,steps:t.steps,theme:e,id:t.raw.id,gridStep:t.grid.step??t.grid.snap??1,layout:{...t.layout,items:t.layout.items.map(i=>{let o=(i.region??i.node)?.variants?.[r];return o?i.region?{...i,region:{...i.region,...o,deco:void 0}}:{...i,node:{...i.node,...o}}:i})}}).svg])))}var Gi=29.09090909090909,zc={solid:[9,7],dashed:[7,6],dotted:[3,6]},Cc=["blocked","planned"],ff=`
|
|
147
147
|
.flow.iso-ants{stroke-dasharray:var(--ant-on) var(--ant-off);animation:iso-ants var(--ant-turn) linear infinite;animation-play-state:var(--ants,running)}
|
|
148
148
|
@keyframes iso-ants{to{stroke-dashoffset:var(--ant-to)}}
|
|
149
|
-
`;function qi(t,e={}){return(e.still??yc).includes(t)?void 0:e.dash??hc[e.kinds?.[t]?.dash??"solid"]}function ks(t){let e=t?.ants;return e?e===!0?{}:Array.isArray(e)?{ids:e}:e:void 0}function Aa(t,e={}){let s=new Map(t.routes.map(n=>[n.id,n.kind])),r=e.ids&&new Set(e.ids),i=e.speed??Bi,o=n=>String(Number(n.toFixed(3)));return t.rendered.svg.replace(/(<g data-route="([^"]*)" data-part="line">(?:<g[^>]*>)*)<path ([^>]*?)\s*\/>/g,(n,a,m,p)=>{let c=m.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"),l=r&&!r.has(c)?void 0:qi(s.get(c)??"",e);if(!l||!/class="flow\b/.test(p))return n;let f=l[0]+l[1],d=o(f/Math.max(1e-6,Math.abs(i))),u=o(i<0?f:-f);return e.by==="css"?`${a}<path ${p.replace(/class="flow\b/,'class="flow iso-ants')} style="--ant-on:${o(l[0])};--ant-off:${o(l[1])};--ant-to:${u};--ant-turn:${d}s"/>`:e.by==="none"?`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"/>`:`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"><animate attributeName="stroke-dashoffset" from="0" to="${u}" dur="${d}s" repeatCount="indefinite"/></path>`})}var tr=t=>typeof t=="string"?[t]:[...t],Ta=t=>JSON.parse(JSON.stringify(t)),On=(t={})=>({...t.from===void 0?{}:{from:t.from},...t.over===void 0?{}:{duration:t.over},...t.easing===void 0?{}:{easing:t.easing}}),Cr=class t{nodes=[];add(e){return this.nodes.push(Ta(e)),this}assemble(e={},s={}){return this.add({assemble:e,...On(s)})}disassemble(e={},s={}){return this.add({disassemble:e,...On(s)})}travel(e,s={}){let{each:r,hold:i,loop:o}=s;return this.add({travel:e,...On(s),each:r,hold:i,loop:o})}pulse(e,s={}){return this.add({pulse:tr(e),...On(s),loop:s.loop})}ants(e=!0,s={}){return this.add({ants:e===!0?!0:tr(e),...On(s),speed:s.speed,dash:s.dash})}draw(e,s={}){return this.add({draw:tr(e),...On(s),by:s.by,stagger:s.stagger})}type(e,s={}){return this.add({type:tr(e),...On(s)})}move(e,s){return this.add({move:e,...s})}lift(e,s,r={}){return this.add({lift:tr(e),by:s,...On(r),stagger:r.stagger,to:r.to,opacity:r.opacity})}focus(e,s={}){let{scope:r,level:i,always:o}=s;return this.add({focus:{lit:tr(e),scope:r,level:i,always:o},...On(s),fade:s.fade})}highlight(e,s={}){return this.add({highlight:tr(e),...On(s),fade:s.fade})}get camera(){return{focus:(e,s={})=>this.add({camera:{focus:e,zoom:s.zoom,margin:s.margin},...On(s)}),fit:(e={})=>this.add({camera:"fit",...On(e)})}}sequence(e,s={},r){return this.add({sequence:qf(e,s,r)})}series(e){let s=new jr;return e(s),this.add({series:s.items})}layers(e){let s=new t;return e(s),this.add({layers:s.nodes})}};function qf(t,e,s){let{read:r,duration:i,...o}=e,n=new Cr;return s?.(n),Ta({...t===void 0?{}:{name:t},...o,...r!==void 0?{duration:{read:r}}:i!==void 0?{duration:i}:{},...n.nodes.length?{children:n.nodes}:{}})}var jr=class{items=[];sequence(e,s={},r){return this.items.push({sequence:qf(e,s,r)}),this}transition(e){return this.items.push({transition:Ta(e)}),this}},Vi=class extends jr{over=[];marks={};head;constructor(e={}){super(),this.head=e}beat(e,s,r={},i){return this.sequence(e,{...r,say:s},i)}assemble(e={},s={}){return this.sequence(void 0,{},r=>r.assemble(e,s))}disassemble(e={},s={}){return this.sequence(void 0,{},r=>r.disassemble(e,s))}mark(e,s){return this.marks[e]=s,this}layers(e){let s=new Cr;return e(s),this.over.push(...s.nodes),this}toJSON(){return Ta({isomotion:1,...this.head,...this.items.length?{series:this.items}:{},...this.over.length?{layers:this.over}:{},...Object.keys(this.marks).length?{markers:this.marks}:{}})}},Vf=(t={})=>new Vi(t);var Ea=["linear","ease","ease-in","ease-out","ease-in-out","settle","bounce"],Lr=["extend","clamp","wrap","identity"];function Yn(t,e){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t!="string")return;let s=/^(-?\d+(?:\.\d+)?)(ms|s|f)?$/.exec(t.trim());if(!s)return;let r=Number(s[1]);return s[2]==="s"?r*1e3:s[2]==="f"?e?r/e*1e3:void 0:r}function Gi(t,e){let s=e===!0?{}:e,r=s.base??2600,i=s.perChar??40,o=s.min??5600,n=s.max??12500;return Math.max(o,Math.min(n,r+(t?.text??"").length*i))}var Ls=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(m,p,c)=>3*m*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let m=0;m<50;m++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},Ru=t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375},Iu={linear:t=>t,ease:Ls(.25,.1,.25,1),"ease-in":Ls(.42,0,1,1),"ease-out":Ls(0,0,.58,1),"ease-in-out":Ls(.42,0,.58,1),settle:Ls(.16,.84,.3,1),bounce:Ru};function _r(t,e={}){let s=e.mass??1,r=e.stiffness??100,i=e.damping??10,o=Math.max(0,t)/1e3,n=Math.sqrt(r/s),a=i/(2*Math.sqrt(r*s)),m;if(a<1){let p=n*Math.sqrt(1-a*a);m=1-Math.exp(-a*n*o)*(Math.cos(p*o)+a*n/p*Math.sin(p*o))}else m=1-Math.exp(-n*o)*(1+n*o);return e.overshootClamping?Math.min(1,m):m}function Hn(t,e,s="ease-in-out"){let r=t??s;return typeof r=="string"?Iu[r]:"bezier"in r?Ls(...r.bezier):i=>i<=0?0:i>=1?1:_r(i*e,r.spring)}function Fr(t,e,s){let r=t.times.map(l=>Yn(l,s)),i=t.values,o=r.length;if(o===1)return i[0];let n=(l,f)=>{if(l==="clamp")return f?i[0]:i[o-1];if(l==="identity")return e;if(l==="wrap"){let d=r[o-1]-r[0];return Fr({...t,extrapolateLeft:"clamp",extrapolateRight:"clamp"},r[0]+((e-r[0])%d+d)%d,s)}};if(e<r[0]){let l=n(t.extrapolateLeft??"extend",!0);if(l!==void 0)return l}if(e>r[o-1]){let l=n(t.extrapolateRight??"extend",!1);if(l!==void 0)return l}let a=0;for(;a<o-2&&e>=r[a+1];)a++;let m=r[a+1]-r[a],p=(e-r[a])/m,c=p<0||p>1?p:Hn(t.easing,m,"linear")(p);return i[a]+(i[a+1]-i[a])*c}var zu={anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+(\\.\\d+)?(ms|s|f)?$"}]},Cu={type:"array",items:{type:"string"}},ju={anyOf:[{enum:Ea},{type:"object",required:["bezier"],additionalProperties:!1,properties:{bezier:{type:"array",items:{type:"number"},minItems:4,maxItems:4}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{$ref:"#/$defs/spring"}}}]},Gf={from:{$ref:"#/$defs/time"},duration:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}},dn=(t,e,s={},r=!0)=>({type:"object",required:[t],additionalProperties:!1,properties:{[t]:e,...r?Gf:{},...s}}),Zf={$schema:"https://json-schema.org/draft/2020-12/schema",title:"isomotion/1",type:"object",required:["isomotion"],additionalProperties:!1,properties:{isomotion:{const:1},fps:{type:"number",exclusiveMinimum:0,description:'Frames a second, for lengths written "30f".'},seed:{type:"integer"},ambient:{enum:["on","off"],description:"Off: the ants and the looping tokens and pulses stand still, each at its start."},series:{$ref:"#/$defs/series"},layers:{$ref:"#/$defs/nodes"},markers:{type:"object",additionalProperties:{anyOf:[{type:"number"},{type:"string"}]}}},$defs:{time:zu,ids:Cu,ease:ju,spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"}}},curve:{type:"object",required:["times","values"],additionalProperties:!1,properties:{times:{type:"array",items:{$ref:"#/$defs/time"},minItems:1},values:{type:"array",items:{type:"number"},minItems:1},easing:{$ref:"#/$defs/ease"},extrapolateLeft:{enum:Lr},extrapolateRight:{enum:Lr}}},say:{type:"object",additionalProperties:!1,properties:{chapter:{type:"string"},title:{type:"string"},text:{type:"string"},code:{type:"string"},color:{type:"string"},facts:{type:"array",items:{type:"array",items:{type:"string"},minItems:2,maxItems:2}}}},focus:{type:"object",required:["lit"],additionalProperties:!1,properties:{lit:{$ref:"#/$defs/ids"},scope:{enum:["all","links"]},level:{type:"number",minimum:0,maximum:1},always:{$ref:"#/$defs/ids"}}},sequence:{type:"object",additionalProperties:!1,properties:{name:{type:"string",pattern:"^[A-Za-z][\\w-]*$"},from:{$ref:"#/$defs/time"},offset:{$ref:"#/$defs/time"},trimBefore:{$ref:"#/$defs/time"},duration:{anyOf:[{$ref:"#/$defs/time"},{type:"object",required:["read"],additionalProperties:!1,properties:{read:{anyOf:[{const:!0},{type:"object",additionalProperties:!1,properties:{base:{type:"number"},perChar:{type:"number"},min:{type:"number"},max:{type:"number"}}}]}}}]},loop:{anyOf:[{type:"boolean"},{type:"integer",minimum:1}]},playbackRate:{type:"number",exclusiveMinimum:0},say:{$ref:"#/$defs/say"},show:{$ref:"#/$defs/ids"},hide:{$ref:"#/$defs/ids"},focus:{$ref:"#/$defs/focus"},highlight:{$ref:"#/$defs/ids"},levels:{type:"object",additionalProperties:{type:"number",minimum:0,maximum:1}},variants:{type:"object",additionalProperties:{type:"string"}},enter:{type:"object",required:["fade"],additionalProperties:!1,properties:{fade:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}}},ants:{anyOf:[{type:"boolean"},{$ref:"#/$defs/ids"}]},children:{$ref:"#/$defs/nodes"},layers:{$ref:"#/$defs/nodes"},series:{$ref:"#/$defs/series"}}},series:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},dn("transition",{type:"object",required:["presentation","timing"],additionalProperties:!1,properties:{presentation:{enum:["fade","none"]},timing:{anyOf:[{type:"object",required:["linear"],additionalProperties:!1,properties:{linear:{$ref:"#/$defs/time"}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"},duration:{$ref:"#/$defs/time"}}}}}]}}},{},!1)]}},seq:dn("sequence",{$ref:"#/$defs/sequence"},{},!1),plan:{type:"object"},nodes:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},dn("series",{$ref:"#/$defs/series"},{},!1),dn("layers",{$ref:"#/$defs/nodes"},{},!1),dn("assemble",{type:"object",properties:{style:{enum:_i},order:{enum:Rr}}}),dn("disassemble",{type:"object",properties:{style:{enum:Fi},order:{enum:Rr}}}),dn("travel",{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"}]},minItems:1},{each:{$ref:"#/$defs/time"},hold:{$ref:"#/$defs/time"},loop:{type:"boolean"}}),dn("pulse",{$ref:"#/$defs/ids"},{loop:{type:"boolean"}}),dn("ants",{anyOf:[{const:!0},{$ref:"#/$defs/ids"}]},{speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}),dn("draw",{$ref:"#/$defs/ids"},{by:{enum:["stroke","grow"]},stagger:{$ref:"#/$defs/time"}}),dn("type",{$ref:"#/$defs/ids"}),{type:"object",required:["move"],additionalProperties:!1,properties:{move:{type:"string"},from:{$ref:"#/$defs/time"},x:{$ref:"#/$defs/curve"},y:{$ref:"#/$defs/curve"},scale:{$ref:"#/$defs/curve"},opacity:{$ref:"#/$defs/curve"}}},{type:"object",required:["lift","by"],additionalProperties:!1,properties:{lift:{$ref:"#/$defs/ids"},by:{type:"number"},stagger:{$ref:"#/$defs/time"},to:{enum:["up","down"]},opacity:{$ref:"#/$defs/curve"},...Gf}},dn("focus",{$ref:"#/$defs/focus"},{fade:{$ref:"#/$defs/time"}}),dn("highlight",{$ref:"#/$defs/ids"},{fade:{$ref:"#/$defs/time"}}),dn("camera",{anyOf:[{const:"fit"},{type:"object",required:["focus"],additionalProperties:!1,properties:{focus:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"},{type:"array",items:{type:"number"},minItems:4,maxItems:4}]},zoom:{type:"number",exclusiveMinimum:0},margin:{type:"number"}}}]})]}}}},gc=["sequence","series","layers","assemble","disassemble","travel","pulse","ants","draw","type","move","lift","focus","highlight","camera"],Kf={morph:"the 2D morph is a later version's",diff:"diffs are a later version's",switch:"a look is a beat's: its variants"},Un=["from","duration","easing"],Ki={sequence:[],series:[],layers:[],assemble:Un,disassemble:Un,travel:[...Un,"each","hold","loop"],pulse:[...Un,"loop"],ants:[...Un,"speed","dash"],draw:[...Un,"by","stagger"],type:Un,move:["from","x","y","scale","opacity"],lift:[...Un,"by","stagger","to","opacity"],focus:[...Un,"fade"],highlight:[...Un,"fade"],camera:Un},Lu=["name","from","offset","duration","loop","playbackRate","trimBefore","say","show","hide","focus","highlight","levels","variants","enter","ants","children","layers","series"],Ot=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Na(t){let e=[],s=(h,b,w)=>{e.push({severity:"error",path:h,message:b,...w?{hint:w}:{}})},r=(h,b,w)=>{for(let k of Object.keys(h))if(!b.includes(k)){let $=Vt(k,b);s(`${w}/${k}`,`unknown key "${k}"`,$?`did you mean "${$}"?`:void 0)}};if(!Ot(t))return s("","a motion document is a map"),e;r(t,["isomotion","fps","seed","ambient","series","layers","markers"],""),t.isomotion!==1&&s("/isomotion","isomotion is 1");let i=typeof t.fps=="number"&&t.fps>0?t.fps:void 0;t.fps!==void 0&&i===void 0&&s("/fps","fps is a number over 0"),t.seed!==void 0&&!Number.isInteger(t.seed)&&s("/seed","seed is a whole number"),t.ambient!==void 0&&t.ambient!=="on"&&t.ambient!=="off"&&s("/ambient",'ambient is "on" or "off"');let o=(h,b,w={})=>{if(h===void 0)return;if(typeof h=="string"&&/f$/.test(h)&&i===void 0){s(b,`"${h}" is in frames: the document needs its fps`);return}let k=Yn(h,i);k===void 0?s(b,`${JSON.stringify(h)} isn't a time (ms, "1.2s", "450ms", "30f")`):k<0&&!w.negative&&s(b,"a time can't be negative")},n=(h,b,w)=>{if(h!==void 0&&!b.includes(h)){let k=typeof h=="string"?Vt(h,b):void 0;s(w,`${JSON.stringify(h)} isn't one of ${b.join(", ")}`,k?`did you mean "${k}"?`:void 0)}},a=(h,b,w={})=>{h!==void 0&&(typeof h!="number"||!Number.isFinite(h)||w.min!==void 0&&h<w.min||w.max!==void 0&&h>w.max||w.over!==void 0&&h<=w.over)&&s(b,`${JSON.stringify(h)} isn't a number${w.over!==void 0?` over ${w.over}`:w.min!==void 0?` from ${w.min}${w.max!==void 0?` to ${w.max}`:""}`:""}`)},m=(h,b)=>{if(h!==void 0){if(!Array.isArray(h)){s(b,"a list of ids");return}h.forEach((w,k)=>{typeof w!="string"&&s(`${b}/${k}`,"an id")})}},p=(h,b,w=[])=>{if(!Ot(h)){s(b,"a spring is a map");return}r(h,["mass","damping","stiffness","overshootClamping",...w],b);for(let k of["mass","damping","stiffness"])a(h[k],`${b}/${k}`,{over:0});h.overshootClamping!==void 0&&typeof h.overshootClamping!="boolean"&&s(`${b}/overshootClamping`,"true or false")},c=(h,b)=>{if(h!==void 0){if(typeof h=="string"){n(h,Ea,b);return}if(Ot(h)&&"bezier"in h){r(h,["bezier"],b),(!Array.isArray(h.bezier)||h.bezier.length!==4||h.bezier.some(w=>typeof w!="number"))&&s(`${b}/bezier`,"four numbers");return}if(Ot(h)&&"spring"in h){r(h,["spring"],b),p(h.spring,`${b}/spring`);return}s(b,"an easing is a name, { bezier: [a, b, c, d] } or { spring: { \u2026 } }")}},l=(h,b)=>{if(h===void 0)return;if(!Ot(h)){s(b,"a curve is { times, values }");return}r(h,["times","values","easing","extrapolateLeft","extrapolateRight"],b);let w=h.times,k=h.values;if(!Array.isArray(w)||!w.length)s(`${b}/times`,"a list of times");else{w.forEach((v,T)=>o(v,`${b}/times/${T}`,{negative:!0}));let $=w.map(v=>Yn(v,i));for(let v=1;v<$.length;v++)$[v]!==void 0&&$[v-1]!==void 0&&$[v]<=$[v-1]&&s(`${b}/times/${v}`,"times go up")}!Array.isArray(k)||k.some($=>typeof $!="number")?s(`${b}/values`,"a list of numbers"):Array.isArray(w)&&k.length!==w.length&&s(`${b}/values`,`${k.length} values for ${w.length} times`),c(h.easing,`${b}/easing`),n(h.extrapolateLeft,Lr,`${b}/extrapolateLeft`),n(h.extrapolateRight,Lr,`${b}/extrapolateRight`)},f=(h,b)=>{if(h!==void 0){if(!Ot(h)){s(b,"focus is { lit: [ids] }");return}r(h,["lit","scope","level","always"],b),h.lit===void 0&&s(`${b}/lit`,"what is lit"),m(h.lit,`${b}/lit`),m(h.always,`${b}/always`),n(h.scope,["all","links"],`${b}/scope`),a(h.level,`${b}/level`,{min:0,max:1})}},d=(h,b)=>{h!==void 0&&typeof h!="string"&&s(b,"text")},u=new Map;function y(h,b,w){if(!Ot(h)){s(b,"a sequence is a map");return}if(r(h,Lu,b),h.name!==void 0&&(typeof h.name!="string"||!/^[A-Za-z][\w-]*$/.test(h.name)?s(`${b}/name`,"a name is letters, digits, - and _, from a letter"):u.has(h.name)?s(`${b}/name`,`"${h.name}" is already a name (${u.get(h.name)})`):u.set(h.name,b)),w&&h.from!==void 0&&s(`${b}/from`,"in a series a sequence follows the one before","offset moves it"),!w&&h.offset!==void 0&&s(`${b}/offset`,"offset is for a series","use from"),o(h.from,`${b}/from`),o(h.offset,`${b}/offset`,{negative:!0}),o(h.trimBefore,`${b}/trimBefore`),Ot(h.duration)){r(h.duration,["read"],`${b}/duration`);let k=h.duration.read;if(k!==!0&&!Ot(k))s(`${b}/duration/read`,"true, or { base, perChar, min, max }");else if(Ot(k)){r(k,["base","perChar","min","max"],`${b}/duration/read`);for(let $ of["base","perChar","min","max"])a(k[$],`${b}/duration/read/${$}`,{min:0})}}else o(h.duration,`${b}/duration`);if(h.loop!==void 0&&typeof h.loop!="boolean"&&!(Number.isInteger(h.loop)&&h.loop>=1)&&s(`${b}/loop`,"true, false, or how many times"),a(h.playbackRate,`${b}/playbackRate`,{over:0}),h.say!==void 0)if(!Ot(h.say))s(`${b}/say`,"say is a map");else{let k=h.say;r(k,["chapter","title","text","code","facts","color"],`${b}/say`);for(let $ of["chapter","title","text","code","color"])d(k[$],`${b}/say/${$}`);k.facts!==void 0&&(!Array.isArray(k.facts)||k.facts.some($=>!Array.isArray($)||$.length!==2||$.some(v=>typeof v!="string")))&&s(`${b}/say/facts`,"a list of [name, value]")}for(let k of["show","hide","highlight"])m(h[k],`${b}/${k}`);if(f(h.focus,`${b}/focus`),h.levels!==void 0)if(!Ot(h.levels))s(`${b}/levels`,"levels is a map: an id, and how much of it");else for(let[k,$]of Object.entries(h.levels))a($,`${b}/levels/${k}`,{min:0,max:1});if(h.variants!==void 0)if(!Ot(h.variants))s(`${b}/variants`,"variants is a map: an id, and the name of its look");else for(let[k,$]of Object.entries(h.variants))typeof $!="string"&&s(`${b}/variants/${k}`,`a look's name, or "" for its own`);h.enter!==void 0&&(Ot(h.enter)?(r(h.enter,["fade","easing"],`${b}/enter`),h.enter.fade===void 0&&s(`${b}/enter/fade`,"how long the fade is"),o(h.enter.fade,`${b}/enter/fade`),c(h.enter.easing,`${b}/enter/easing`)):s(`${b}/enter`,"enter is { fade }")),h.ants!==void 0&&typeof h.ants!="boolean"&&m(h.ants,`${b}/ants`);for(let k of["children","layers"])h[k]!==void 0&&x(h[k],`${b}/${k}`);h.series!==void 0&&g(h.series,`${b}/series`)}function g(h,b){if(!Array.isArray(h)){s(b,"a series is a list");return}h.forEach((w,k)=>{let $=`${b}/${k}`;if(!Ot(w)||Object.keys(w).length!==1||!("sequence"in w||"transition"in w)){s($,"a series holds sequences and transitions");return}if("sequence"in w){y(w.sequence,`${$}/sequence`,!0);return}let v=w.transition,T=`${$}/transition`,R=O=>Ot(h[O])&&"sequence"in h[O];if((!R(k-1)||!R(k+1))&&s(T,"a transition is between two sequences"),!Ot(v)){s(T,"a transition is { presentation, timing }");return}r(v,["presentation","timing"],T),v.presentation===void 0?s(`${T}/presentation`,"a presentation"):n(v.presentation,["fade","none"],`${T}/presentation`),Ot(v.timing)?"linear"in v.timing?(r(v.timing,["linear"],`${T}/timing`),o(v.timing.linear,`${T}/timing/linear`)):"spring"in v.timing?(r(v.timing,["spring"],`${T}/timing`),p(v.timing.spring,`${T}/timing/spring`,["duration"]),Ot(v.timing.spring)&&o(v.timing.spring.duration,`${T}/timing/spring/duration`)):s(`${T}/timing`,"a timing is { linear } or { spring }"):s(`${T}/timing`,"a timing is { linear } or { spring }")})}function x(h,b){if(!Array.isArray(h)){s(b,"a list");return}h.forEach((w,k)=>{let $=`${b}/${k}`;if(!Ot(w)){s($,"a map");return}let v=gc.filter(I=>I in w);if(v.length!==1){let I=Object.keys(w).find(P=>P in Kf),M=Object.keys(w)[0],A=M?Vt(M,gc):void 0;s($,I?`${I}: ${Kf[I]}`:v.length?`one of ${v.join(", ")}, not several`:`one of ${gc.join(", ")}`,!I&&!v.length&&A?`did you mean "${A}"?`:void 0);return}let T=v[0],R=w[T],O=`${$}/${T}`;r(w,[T,...Ki[T]],$),Ki[T].includes("from")&&o(w.from,`${$}/from`),Ki[T].includes("duration")&&(o(w.duration,`${$}/duration`),c(w.easing,`${$}/easing`));for(let I of["each","hold","stagger","fade"])Ki[T].includes(I)&&o(w[I],`${$}/${I}`);if(Ki[T].includes("loop")&&w.loop!==void 0&&typeof w.loop!="boolean"&&s(`${$}/loop`,"true or false"),T==="sequence")y(R,O,!1);else if(T==="series")g(R,O);else if(T==="layers")x(R,O);else if(T==="assemble"||T==="disassemble")Ot(R)?(n(R.style,T==="assemble"?_i:Fi,`${O}/style`),n(R.order,Rr,`${O}/order`),R.duration!==void 0&&s(`${O}/duration`,"its length is beside it","duration is the node's")):s(O,`${T} is a map (its options)`);else if(T==="travel")!Array.isArray(R)||!R.length?s(O,"a list of connectors"):R.forEach((I,M)=>{Array.isArray(I)?m(I,`${O}/${M}`):typeof I!="string"&&s(`${O}/${M}`,"a connector, or a list of them at once")});else if(T==="ants")R!==!0&&m(R,O),a(w.speed,`${$}/speed`),w.dash!==void 0&&(!Array.isArray(w.dash)||w.dash.length!==2||w.dash.some(I=>typeof I!="number"||I<=0))&&s(`${$}/dash`,"two numbers over 0: on, off");else if(T==="move"){typeof R!="string"&&s(O,"an id");for(let I of["x","y","scale","opacity"])l(w[I],`${$}/${I}`)}else if(T==="focus")f(R,O);else if(T==="camera"){if(R!=="fit")if(!Ot(R))s(O,'"fit", or { focus, zoom, margin }');else{r(R,["focus","zoom","margin"],O),a(R.zoom,`${O}/zoom`,{over:0}),a(R.margin,`${O}/margin`);let I=R.focus;typeof I=="string"||Array.isArray(I)&&(I.every(M=>typeof M=="string")||I.length===4&&I.every(M=>typeof M=="number"))||s(`${O}/focus`,"an id, some ids, or a box [x, y, w, h]")}}else m(R,O);T==="draw"&&n(w.by,["stroke","grow"],`${$}/by`),T==="lift"&&(w.by===void 0&&s(`${$}/by`,"how far apart"),a(w.by,`${$}/by`),n(w.to,["up","down"],`${$}/to`),l(w.opacity,`${$}/opacity`))})}if(t.series!==void 0&&g(t.series,"/series"),t.layers!==void 0&&x(t.layers,"/layers"),t.markers!==void 0)if(!Ot(t.markers))s("/markers","markers is a map");else for(let[h,b]of Object.entries(t.markers))if(typeof b=="string"&&/^[A-Za-z][\w-]*([+-].+)?$/.test(b)){let w=/^([A-Za-z][\w-]*?)(?:([+-])(\d.*))?$/.exec(b);if(w&&(u.has(w[1])?w[1]:void 0))w[3]!==void 0&&o(w[3],`/markers/${h}`);else if(!u.has(b)){let v=Vt(w?.[1]??b,u.keys());s(`/markers/${h}`,`no sequence is named "${w?.[1]??b}"`,v?`did you mean "${v}"?`:void 0)}}else o(b,`/markers/${h}`);return e}var Tn=t=>Math.round(t*100)/100||0,Wt=t=>Math.round(t*1e4)/1e4||0,An=t=>Math.max(0,Math.min(1,t)),Dr=(t,e,s)=>t+(e-t)*s,_u=250,bc=class{items=new Map;labels=new Map;routes=new Map;tokens=[];pulses=[];outlines=[];variants={};marks=1;at(e,s){let r=e.get(s);return r||e.set(s,r={}),r}item(e,s){let r=this.at(this.items,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.scale!==void 0&&(r.scale=(r.scale??1)*s.scale,r.about=s.about??r.about),s.clip&&(r.clip=s.clip)}label(e,s){let r=this.at(this.labels,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.typed!==void 0&&(r.typed=Math.min(r.typed??1,s.typed))}route(e,s){let r=this.at(this.routes,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.drawn!==void 0&&s.drawn<(r.drawn??1)&&(r.drawn=s.drawn,r.by=s.by),s.ants&&(r.ants=s.ants)}add(e){for(let[s,r]of Object.entries(e.items??{}))this.item(s,r);for(let[s,r]of Object.entries(e.labels??{}))this.label(s,r);for(let[s,r]of Object.entries(e.routes??{}))this.route(s,r);e.marks&&(this.marks*=e.marks.opacity),this.tokens.push(...e.tokens??[]),this.pulses.push(...e.pulses??[])}state(e){let s={},r=(c,l)=>{let f={};for(let[d,u]of c){let y=l(u);Object.keys(y).length&&(f[d]=y)}return f},i=c=>Object.keys(c).length>0,o=c=>c===void 0||Wt(c)>=1?{}:{opacity:Wt(Math.max(0,c))},n=c=>({...Tn(c.dx??0)?{dx:Tn(c.dx)}:{},...Tn(c.dy??0)?{dy:Tn(c.dy)}:{}}),a=r(this.items,c=>({...o(c.opacity),...n(c),...c.scale!==void 0&&Wt(c.scale)!==1?{scale:Wt(c.scale),...c.about?{about:c.about}:{}}:{},...c.clip?{clip:c.clip}:{}})),m=r(this.labels,c=>({...o(c.opacity),...c.typed!==void 0&&c.typed<1?{typed:Wt(c.typed)}:{},...n(c)})),p=r(this.routes,c=>{let l=c.opacity!==void 0&&Wt(c.opacity)<=0,f=c.drawn!==void 0&&c.drawn<1;return{...o(c.opacity),...f?{drawn:Wt(c.drawn),...c.by?{by:c.by}:{}}:{},...c.ants&&!l&&!f?{ants:c.ants}:{}}});return i(a)&&(s.items=a),i(m)&&(s.labels=m),i(p)&&(s.routes=p),Wt(this.marks)<1&&(s.marks={opacity:Wt(this.marks)}),this.tokens.length&&(s.tokens=this.tokens),this.pulses.length&&(s.pulses=this.pulses),this.outlines.length&&(s.outlines=this.outlines),i(this.variants)&&(s.variants=this.variants),e&&(s.camera=e),s}};function Br(t,e,s={}){let r=Na(e),i=js(t),o=e.fps,n=ks(t.raw),a=()=>({ok:!1,diags:r,duration:0,beats:[],markers:{},at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}});if(r.length)return a();let m=(S,B,K)=>{r.push({severity:"error",path:S,message:B,...K?{hint:K}:{}})},p=(S,B)=>S===void 0?B:Yn(S,o),c=new Map(i.pieces.map(S=>[S.id,S])),l=new Set(i.routes.map(S=>S.id)),f=new Set(Object.keys(i.notes)),d=new Map(t.routes.map(S=>[S.id,S.kind])),u=[...c.keys(),...l,...f],y=new Set(u),g=new Map;for(let[S,B]of Object.entries(i.notes))B!==void 0&&g.set(B,[...g.get(B)??[],S]);let x={any:y,thing:new Set(c.keys()),route:l},h={any:"thing, connector or note",thing:"thing",route:"connector"},b=(S,B,K="any")=>{if(!x[K].has(S)){let ae=Vt(S,x[K]);m(B,`no ${h[K]} "${S}" in this drawing`,ae?`did you mean "${ae}"?`:void 0)}},w=(S,B,K="any")=>S?.forEach((ae,le)=>b(ae,`${B}/${le}`,K)),k=new Map(t.layout.items.map(S=>[S.id,Ht(S.box).map(B=>[Tn(B[0]),Tn(B[1])])])),$=new Map;function v(S,B){let K="from"in S?p(S.from,0):0,ae="duration"in S?p(S.duration,NaN):NaN,le=Number.isFinite(ae);if("sequence"in S){let fe=S.sequence;return p(fe.from,0)+I(fe,`${B}/sequence`)}if("series"in S)return M(S.series,`${B}/series`).end;if("layers"in S)return Math.max(0,...S.layers.map((fe,se)=>v(fe,`${B}/layers/${se}`)));if("assemble"in S||"disassemble"in S){let fe="assemble"in S?"assemble":"disassemble",se="assemble"in S?S.assemble:S.disassemble,ge=$.get(S);return ge||$.set(S,ge=Ir(i,fe,{seed:e.seed??1,...se,...le?{duration:ae}:{}})),K+ge.duration}return"draw"in S?K+(le?ae:400)+Math.max(0,S.draw.length-1)*p(S.stagger,0):"lift"in S?K+Math.max(le?ae:750,...S.opacity?.times.map(fe=>Yn(fe,o))??[])+Math.max(0,S.lift.length-1)*p(S.stagger,0):le?K+ae:"travel"in S?S.loop?K:K+S.travel.length*p(S.each,1150):"pulse"in S?S.loop?K:K+1500:"type"in S?K+400:"camera"in S?K+900:"move"in S?K+Math.max(0,...[S.x,S.y,S.scale,S.opacity].flatMap(fe=>fe?.times.map(se=>Yn(se,o))??[])):K}let T=(S,B)=>Math.max(0,...(S.children??[]).map((K,ae)=>v(K,`${B}/children/${ae}`)),...(S.layers??[]).map((K,ae)=>v(K,`${B}/layers/${ae}`)),S.series?M(S.series,`${B}/series`).end:0),R=new Map;function O(S,B){let K=R.get(S);if(K!==void 0)return K;let ae;return S.duration!==void 0&&typeof S.duration=="object"?ae=Gi(S.say,S.duration.read):ae=S.duration!==void 0?p(S.duration,0):T(S,B),S.duration===void 0&&ae<=0&&S.say&&(ae=Gi(S.say,!0)),ae<=0&&m(`${B}/duration`,"how long is it? (nothing in it says)"),R.set(S,ae),ae}let I=(S,B)=>{let K=O(S,B),ae=S.playbackRate??1;return S.loop===!0?K/ae:(typeof S.loop=="number"?K*S.loop:K)/ae};function M(S,B){let K=[],ae=0,le;return S.forEach((fe,se)=>{if("transition"in fe){let he=fe.transition,Ie=he.timing,E=he.presentation==="none"?0:"linear"in Ie?p(Ie.linear,0):p(Ie.spring.duration,Fu(Ie.spring));le={t:he,length:E};return}let ge=fe.sequence,Se=`${B}/${se}/sequence`,te=I(ge,Se),xe=Math.max(0,ae+p(ge.offset,0)-(le?.length??0));le&&K.length&&le.length>Math.min(K[K.length-1].end-K[K.length-1].start,te)&&m(`${B}/${se-1}/transition/timing`,"a transition is no longer than either side of it"),K.push({s:ge,path:Se,start:xe,end:xe+te,...le?{into:le}:{}}),ae=xe+te,le=void 0}),{list:K,end:Math.max(0,...K.map(fe=>fe.end))}}let A=M(e.series??[],"/series"),P=Math.max(0,...(e.layers??[]).map((S,B)=>v(S,`/layers/${B}`))),j=Math.max(A.end,P);j<=0&&!r.length&&m("","a motion document has a series, or layers, that last");let F=new Map,Y=[],J=i.viewBox,U=(S,B,K)=>{let ae=K!==void 0?1/K:Math.max((S.w+B*2)/J[2],(S.h+B*2)/J[3]);return[S.x+S.w/2-J[2]*ae/2,S.y+S.h/2-J[3]*ae/2,J[2]*ae,J[3]*ae]};function C(S,B,K){let ae=le=>K?{at:K.at+le/K.rate,rate:K.rate}:void 0;if("sequence"in S){Z(S.sequence,`${B}/sequence`,ae(p(S.sequence.from,0)),!1);return}if("series"in S){for(let le of M(S.series,`${B}/series`).list)Z(le.s,le.path,ae(le.start),!1);return}if("layers"in S){S.layers.forEach((le,fe)=>C(le,`${B}/layers/${fe}`,K));return}if("travel"in S)S.travel.forEach((le,fe)=>(Array.isArray(le)?le:[le]).forEach((se,ge)=>b(se.split(":")[0],`${B}/travel/${fe}${Array.isArray(le)?`/${ge}`:""}`,"route")));else if("pulse"in S)w(S.pulse,`${B}/pulse`,"thing");else if("ants"in S)S.ants!==!0&&w(S.ants,`${B}/ants`,"route");else if("draw"in S)w(S.draw,`${B}/draw`,"route");else if("type"in S)w(S.type,`${B}/type`);else if("move"in S)b(S.move,`${B}/move`,"thing");else if("lift"in S)w(S.lift,`${B}/lift`,"thing");else if("focus"in S)G(S.focus,`${B}/focus`);else if("highlight"in S)w(S.highlight,`${B}/highlight`,"thing");else if("camera"in S){let le=S.camera,fe=p(S.duration,900);if(!K){m(`${B}/camera`,"a camera can't be in a loop");return}let se=J;if(le!=="fit"){let ge=le.focus;if(Array.isArray(ge)&&typeof ge[0]=="number")se=U({x:ge[0],y:ge[1],w:ge[2],h:ge[3]},le.margin??0,le.zoom);else{let Se=typeof ge=="string"?[ge]:ge;Se.forEach((xe,he)=>b(xe,`${B}/camera/focus${typeof ge=="string"?"":`/${he}`}`,"thing"));let te=Se.map(xe=>c.get(xe)?.bbox).filter(xe=>!!xe);if(te.length){let xe=Math.min(...te.map(Ie=>Ie.x)),he=Math.min(...te.map(Ie=>Ie.y));se=U({x:xe,y:he,w:Math.max(...te.map(Ie=>Ie.x+Ie.w))-xe,h:Math.max(...te.map(Ie=>Ie.y+Ie.h))-he},le.margin??40,le.zoom)}}}Y.push({at:K.at+p(S.from,0)/K.rate,over:fe/K.rate,ease:Hn(S.easing,fe,"settle"),to:se})}}let G=(S,B)=>{S&&(w(S.lit,`${B}/lit`),w(S.always,`${B}/always`))};function Z(S,B,K,ae){if(S.name!==void 0&&K&&F.set(S.name,K.at),!ae)for(let se of["show","hide","say","enter","focus","highlight","levels","variants","ants"])S[se]!==void 0&&m(`${B}/${se}`,`${se} is for a sequence of the document's own series`,se==="focus"||se==="highlight"||se==="ants"?`here, a child: { ${se}: \u2026 }`:void 0);w(S.show,`${B}/show`),w(S.hide,`${B}/hide`),w(S.highlight,`${B}/highlight`,"thing"),G(S.focus,`${B}/focus`);for(let se of Object.keys(S.levels??{}))se!=="*"&&b(se,`${B}/levels/${se}`);for(let[se,ge]of Object.entries(S.variants??{})){b(se,`${B}/variants/${se}`,"thing");let Se=t.rendered.looks?.[se]??[];if(c.has(se)&&ge!==""&&!Se.includes(ge)){let te=Vt(ge,Se);m(`${B}/variants/${se}`,Se.length?`${se} has no look "${ge}" (it has ${Se.join(", ")})`:`${se} declares no looks (variants: in the diagram)`,te?`did you mean "${te}"?`:void 0)}}Array.isArray(S.ants)&&w(S.ants,`${B}/ants`,"route");let le=S.playbackRate??1,fe=K&&!S.loop?{at:K.at-p(S.trimBefore,0)/(K.rate*le),rate:K.rate*le}:void 0;if((S.children??[]).forEach((se,ge)=>C(se,`${B}/children/${ge}`,fe)),(S.layers??[]).forEach((se,ge)=>C(se,`${B}/layers/${ge}`,fe)),S.series)for(let se of M(S.series,`${B}/series`).list)Z(se.s,se.path,fe&&{at:fe.at+se.start/fe.rate,rate:fe.rate},!1)}for(let S of A.list)Z(S.s,S.path,{at:S.start,rate:1},!0);(e.layers??[]).forEach((S,B)=>C(S,`/layers/${B}`,{at:0,rate:1})),Y.sort((S,B)=>S.at-B.at);let Q={};for(let[S,B]of Object.entries(e.markers??{})){let K=Yn(B,o);if(K!==void 0){Q[S]=K;continue}let ae=String(B),le=[...F.keys()].filter(ge=>ae===ge||ae.startsWith(ge+"+")||ae.startsWith(ge+"-")).sort((ge,Se)=>Se.length-ge.length)[0];if(le===void 0){m(`/markers/${S}`,`"${ae}" isn't a moment of this document`);continue}let fe=ae.slice(le.length),se=fe?Yn(fe.slice(1),o):0;if(se===void 0){m(`/markers/${S}`,`"${fe}" isn't a time`);continue}Q[S]=F.get(le)+(fe[0]==="-"?-se:se)}if(r.length)return a();let z=A.list.map((S,B)=>({name:S.s.name??`beat-${B+1}`,index:B,start:S.start,end:S.end,...S.s.say?{say:S.s.say}:{}})),D=new Map;for(let S of A.list){for(let B of S.s.show??[])D.has(B)||D.set(B,!1);for(let B of S.s.hide??[])D.has(B)||D.set(B,!0)}let V=[new Map(D)];for(let S of A.list){let B=new Map(V[V.length-1]);for(let K of S.s.show??[])B.set(K,!0);for(let K of S.s.hide??[])B.set(K,!1);V.push(B)}let W=[new Map];for(let S of A.list){let B=new Map(W[W.length-1]);for(let[K,ae]of Object.entries(S.s.variants??{}))B.set(K,ae);W.push(B)}let de=(S,B)=>!S||S.lit.includes(B)||S.always?.includes(B)||S.scope==="links"&&c.has(B)?1:S.level??.12,ce=(S,B)=>{let K=S<0?void 0:A.list[S].s.levels;return K?K[B]??K["*"]??1:1},H=(S,B)=>(V[S+1].get(B)===!1?0:1)*(S<0?1:de(A.list[S].s.focus,B))*ce(S,B),ne=(S,B)=>{let K=i.notes[B];if(K===void 0)return H(S,B);let ae=S<0?void 0:A.list[S].s.levels?.[B];return H(S,K)*(V[S+1].get(B)===!1?0:1)*(ae??1)},Ee=S=>{let B=-1;for(let K=0;K<A.list.length;K++)A.list[K].start<=S&&(B=K);return B},qe=(S,B)=>{let K=A.list[S],ae=B-K.start;if(K.into&&K.into.length>0){let se=K.into.t.timing;return"spring"in se?ae>=K.into.length?1:An(_r(ae,{...se.spring,overshootClamping:!0})/_r(K.into.length,{...se.spring,overshootClamping:!0})):An(ae/K.into.length)}let le=K.s.enter;if(!le)return 1;let fe=p(le.fade,0);return fe<=0?1:Hn(le.easing,fe,"ease")(An(ae/fe))};function N(S,B,K,ae,le){if("sequence"in S){let Se=S.sequence,te=p(Se.from,0);Ue(Se,B-te,K-te,we(Se,ae-te),le);return}if("series"in S){for(let Se of M(S.series,"").list)Ue(Se.s,B-Se.start,K-Se.start,Se.end-Se.start,le);return}if("layers"in S){for(let Se of S.layers)N(Se,B,K,ae,le);return}let fe=p("from"in S?S.from:void 0,0),se=B-fe;if("assemble"in S||"disassemble"in S){le.sum.add($.get(S).at(se));return}if("draw"in S){let Se=Math.max(1,p(S.duration,400)),te=p(S.stagger,0),xe=Hn(S.easing,Se,"ease-out");S.draw.forEach((he,Ie)=>{let E=xe(An((se-Ie*te)/Se));E<=0?(le.sum.route(he,{opacity:0,drawn:0}),le.sum.label(he,{opacity:0})):E<1&&(le.sum.route(he,{drawn:E,...S.by?{by:S.by}:{}}),le.sum.label(he,{opacity:E}))});return}if("type"in S){let Se=p(S.duration,400),te=Hn(S.easing,Se,"linear")(An(se/Math.max(1,Se)));if(te<1)for(let xe of S.type)le.sum.label(xe,te<=0?{opacity:0}:{typed:te});return}if("move"in S){let Se=E=>E?Fr(E,se,o):void 0,te=Se(S.x)??0,xe=Se(S.y)??0,he=Se(S.scale),Ie=Se(S.opacity);le.sum.item(S.move,{dx:te,dy:xe,...he===void 0?{}:{scale:he,about:c.get(S.move).foot},...Ie===void 0?{}:{opacity:An(Ie)}});for(let E of[S.move,...g.get(S.move)??[]])le.sum.label(E,{dx:te,dy:xe,...Ie===void 0?{}:{opacity:An(Ie)}});return}if("lift"in S){let Se=p(S.stagger,0),te=Math.max(1,p(S.duration,750)),xe=Hn(S.easing,te,"ease-out"),he=S.to==="down",Ie=S.lift.length;S.lift.forEach((E,q)=>{let _=se-(he?Ie-1-q:q)*Se,re=xe(An(_/te)),pe=(q+1)*S.by*(he?re:-re),Te=S.opacity?An(Fr(S.opacity,_,o)):1;if(!(!pe&&Te>=1)){le.sum.item(E,{dy:pe,opacity:Te});for(let Pe of[E,...g.get(E)??[]])le.sum.label(Pe,{dy:pe,opacity:Te})}});return}if("camera"in S)return;let ge=S.duration===void 0?Math.max(0,ae-fe):p(S.duration,0);if(!(se<0||se>ge)){if("focus"in S||"highlight"in S){let Se=Math.max(1,p(S.fade,_u)),te=An(Math.min(se/Se,S.duration===void 0?1:(ge-se)/Se)),xe=Hn(S.easing,Se,"linear")(te);if("focus"in S)ke(S.focus,xe,le.sum);else for(let he of S.highlight)le.shown(he)&&ye(he,xe,le.sum);return}if("ants"in S){Ve(S.ants===!0?[...l]:S.ants,le,S.speed,S.dash);return}if("pulse"in S){let te=S.loop?ee(K-fe,1500,le)/1500:se/Math.max(1,S.duration===void 0?1500:ge);if(te<0||te>=1)return;for(let xe of S.pulse)if(le.shown(xe)){let he=c.get(xe),Ie=he.bbox.w*.5*(.7+te*.6);le.sum.pulses.push({x:Tn(he.foot[0]),y:Tn(he.foot[1]),rx:Tn(Ie),ry:Tn(Ie*.58),opacity:Wt(1-te)})}return}if("travel"in S){let Se=p(S.each,1150),te=p(S.hold,S.loop?700:0),xe=S.travel.length*Se+te,he=S.loop?ee(K-fe,xe,le):se,Ie=Math.floor(he/Se);if(Ie>=S.travel.length)return;let E=Hn(S.easing,Se,"ease-in-out")((he-Ie*Se)/Se),q=S.travel[Ie];for(let _ of Array.isArray(q)?q:[q]){let[re,pe]=_.split(":");le.shown(re)&&le.sum.tokens.push({route:re,at:Wt(E),...pe?{kind:pe}:{}})}}}}let ee=(S,B,K)=>K.off?0:(S%B+B)%B,ye=(S,B,K)=>{Wt(B)>0&&k.has(S)&&K.outlines.push({id:S,points:k.get(S),...Wt(B)<1?{opacity:Wt(B)}:{}})},ke=(S,B,K)=>{for(let ae of u){let le=f.has(ae)&&!S.lit.includes(ae)&&!S.always?.includes(ae)?i.notes[ae]:void 0,fe=Dr(1,de(S,le??ae),B);fe>=1||(c.has(ae)?(K.item(ae,{opacity:fe}),K.label(ae,{opacity:fe})):l.has(ae)?(K.route(ae,{opacity:fe}),K.label(ae,{opacity:fe})):K.label(ae,{opacity:fe}))}},Ve=(S,B,K=Bi,ae)=>{for(let le of S){let fe=qi(d.get(le)??"",{dash:ae,kinds:s.kinds,still:s.still});if(!fe)continue;let se=fe[0]+fe[1],ge=ee(K*B.A/1e3,se,B);B.sum.route(le,{ants:{dash:fe,offset:Tn(ge)}})}},we=(S,B)=>S.loop===!0?Math.max(0,B):I(S,"");function Ue(S,B,K,ae,le){if(B<0||B>ae||B===ae&&ae<j&&ae>0&&S.loop)return;let fe=S.playbackRate??1,se=O(S,""),ge=p(S.trimBefore,0),Se=S.loop&&se>0?B*fe%se:B*fe,te=Se+ge,xe=K*fe+ge;for(let he of S.children??[])N(he,te,xe,se+ge,le);for(let he of S.layers??[])N(he,te,xe,se+ge,le);if(S.series)for(let he of M(S.series,"").list)Ue(he.s,te-he.start,xe-he.start,he.end-he.start,le)}function Le(S,B={}){let K=Math.max(0,Math.min(j,Number.isFinite(S)?S:0)),ae=B.ambient==="off"||e.ambient==="off"&&B.ambient===void 0,le=typeof B.ambient=="number"?B.ambient:K,fe=new bc,se=Ee(K),ge=se<0?1:qe(se,K),Se=(_,re)=>se<0?re(-1,_):ge>=1?re(se,_):Dr(re(se-1,_),re(se,_),ge),te=_=>(se<0?V[0]:V[se+1]).get(_)!==!1;if(D.size||A.list.some(_=>_.s.focus||_.s.levels))for(let _ of u){let re=Se(_,f.has(_)?ne:H);re>=1||(c.has(_)&&fe.item(_,{opacity:re}),l.has(_)&&fe.route(_,{opacity:re}),fe.label(_,{opacity:re}))}if(se>=0)for(let _ of W[W.length-1].keys()){let re=W[se].get(_)??"",pe=W[se+1].get(_)??"",Te={};re&&ge<1&&(Te[re]=Wt(1-ge)),pe&&(Te[pe]=Wt((Te[pe]??0)+ge));for(let Pe of Object.keys(Te))Te[Pe]<=0&&delete Te[Pe];Object.keys(Te).length&&(fe.variants[_]=Te)}if(se>=0){let _=new Set(A.list[se].s.highlight??[]),re=new Set(se>0&&ge<1?A.list[se-1].s.highlight??[]:[]);for(let pe of new Set([...re,..._]))ye(pe,Dr(re.has(pe)?1:0,_.has(pe)?1:0,ge),fe)}let xe={sum:fe,shown:te,off:ae,A:le},he=se>=0?A.list[se].s.ants:void 0,Ie=he===void 0?n:void 0;he?Ve(he===!0?[...l]:he,xe):Ie&&Ve(Ie.ids??[...l],xe,Ie.speed,Ie.dash),A.list.forEach((_,re)=>{K>=_.start&&(K<_.end||re===se&&K<=_.end)&&Ue(_.s,K-_.start,le-_.start,_.end-_.start,xe)});for(let _ of e.layers??[])N(_,K,le,j,xe);let E;for(let _ of Y){if(_.at>K)break;let re=_.over<=0?1:_.ease(An((K-_.at)/_.over)),pe=E??J;if(re>=1){E=_.to;continue}let Te=pe[2],Pe=_.to[2],rt=Math.exp(Dr(Math.log(Te),Math.log(Pe),re)),Fe=Math.abs(Pe-Te)<1e-6?re:(rt-Te)/(Pe-Te),Ce=Dr(pe[0]+pe[2]/2,_.to[0]+_.to[2]/2,Fe),Ke=Dr(pe[1]+pe[3]/2,_.to[1]+_.to[3]/2,Fe),We=rt*J[3]/J[2];E=[Ce-rt/2,Ke-We/2,rt,We]}let q=E?.map(Tn);return fe.state(q&&q.some((_,re)=>Math.abs(_-J[re])>.005)?q:void 0)}let $e=S=>{let B=Ee(Math.max(0,Math.min(j,S)));return B<0?void 0:z[B]};return{ok:!0,diags:r,duration:j,beats:z,markers:Q,at:Le,beatAt:$e,startOf:S=>F.get(S)??z.find(B=>B.name===S)?.start,cues(S){let B=$e(S);if(!B)return;let K=Math.max(0,Math.min(j,S));return{beat:B.name,index:B.index,of:z.length,progress:Wt(An((K-B.start)/Math.max(1,B.end-B.start))),...B.say?{say:B.say,...B.say.chapter!==void 0?{chapter:B.say.chapter}:{},...B.say.color!==void 0?{color:B.say.color}:{}}:{}}}}}function Fu(t){let e=t.mass??1,s=t.stiffness??100,r=t.damping??10,i=Math.sqrt(s/e),o=Math.min(1,r/(2*Math.sqrt(s*e)));return Math.ceil(Math.log(200)/(o*i)*1e3*(o>=1?1.6:1))}function Uf(t){let{steps:e,vis:s}=t.steps,r=e.map((i,o)=>{let n=[],a=[];for(let[l,f]of Object.entries(s))(o===0?!f.includes(!0):f[o-1]&&!f[o])?a.push(l):o>0&&f[o]&&!f[o-1]&&n.push(l);let m=[];i.phases.length&&m.push({travel:i.phases.map(l=>l.length===1?l[0].route:l.map(f=>f.route)),each:1150,hold:700,loop:!0});let p=(t.raw.steps??[])[o]?.pulse?.filter(l=>t.layout.byId.has(l))??[];p.length&&m.push({pulse:p,loop:!0});let c={name:`step-${i.n}`,duration:i.duration,say:{title:i.heading,...i.caption?{text:i.caption}:{},...i.command?{code:i.command}:{}}};return n.length&&(c.show=n),a.length&&(c.hide=a),m.length&&(c.children=m),{sequence:c}});return{isomotion:1,...r.length?{series:r}:{}}}var Wf=new Set(["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","font-size","font-weight","font-family","letter-spacing","text-anchor","dominant-baseline","paint-order","display","stop-color","stop-opacity"]),Du=new Set("cursor pointer-events transition animation transform-box transform-origin user-select".split(" "));function Bu(t,e){let s={classes:[],not:[],attrs:[],child:e},r=t,i=n=>{let a=n.exec(r);return a&&(r=r.slice(a[0].length)),a},o=i(/^[a-zA-Z][\w-]*/);for(o?s.tag=o[0]:i(/^\*/);r;){let n;if(n=i(/^\.([\w-]+)/))s.classes.push(n[1]);else if(n=i(/^:not\(\.([\w-]+)\)/))s.not.push(n[1]);else if(n=i(/^\[([\w-]+)(?:="([^"]*)")?\]/))s.attrs.push([n[1],n[2]]);else throw new Error(`resolve: a selector it doesn't know: ${t}`)}return s}function qu(t){let e=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/@keyframes[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"").replace(/@media[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"");if(/@/.test(e.replace(/"[^"]*"/g,"")))throw new Error("resolve: an at-rule it doesn't know");let s=[];for(let r of e.matchAll(/([^{}]+)\{([^{}]*)\}/g)){let i=r[2].split(";").map(o=>o.trim()).filter(Boolean).map(o=>{let n=o.indexOf(":"),a=o.slice(0,n).trim(),m=o.slice(n+1).trim();return[a,m.replace(/\s*!important$/,""),/!important$/.test(m)]});for(let o of i)if(!o[0].startsWith("--")&&!Wf.has(o[0])&&!Du.has(o[0]))throw new Error(`resolve: a property it doesn't know: ${o[0]}`);for(let o of r[1].split(",").map(n=>n.trim()).filter(Boolean)){if(o.includes(":root")||o.includes("::")||/^(html|body)\b/.test(o))continue;let a=o.replace(/\s*>\s*/g," >").split(/\s+/).map(p=>Bu(p.replace(/^>/,""),p.startsWith(">"))),m=a.reduce((p,c)=>p+10*(c.classes.length+c.not.length+c.attrs.length)+(c.tag?1:0),0);s.push({parts:a,spec:m,order:s.length,decls:i})}}return s}function Vu(t){let e={name:"#root",attrs:[],children:[]},s=e;for(let r of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g)){if(r[4]!==void 0){s.children.push(r[4]);continue}if(r[1]===void 0){s=s.parent;continue}let i={name:r[1],attrs:[...r[2].matchAll(/([\w:-]+)="([^"]*)"/g)].map(o=>[o[1],o[2]]),children:[],parent:s};s.children.push(i),r[3]||(s=i)}return e.children[0]}var Jf=t=>typeof t=="string"?t:`<${t.name}${t.attrs.map(([e,s])=>` ${e}="${s}"`).join("")}${t.children.length||t.name==="g"?`>${t.children.map(Jf).join("")}</${t.name}>`:"/>"}`,Zi=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1],qr=(t,e,s)=>{let r=t.attrs.find(i=>i[0]===e);r?r[1]=s:t.attrs.push([e,s])},Ku=t=>(Zi(t,"class")??"").split(/\s+/).filter(Boolean);function Gu(t,e){if(e.tag&&e.tag!==t.name)return!1;let s=Ku(t);return e.classes.every(r=>s.includes(r))&&!e.not.some(r=>s.includes(r))&&e.attrs.every(([r,i])=>{let o=Zi(t,r);return o!==void 0&&(i===void 0||o===i)})}function wc(t,e,s=e.length-1){if(!Gu(t,e[s]))return!1;if(s===0)return!0;let r=t.parent;if(e[s].child)return!!r&&r.name!=="#root"&&wc(r,e,s-1);for(;r&&r.name!=="#root";r=r.parent)if(wc(r,e,s-1))return!0;return!1}var _s=t=>t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Zu(t,e,s,r){let i=(1-Math.abs(2*s-1))*e,o=(t%360+360)%360/60,n=i*(1-Math.abs(o%2-1)),a=s-i/2,[m,p,c]=o<1?[i,n,0]:o<2?[n,i,0]:o<3?[0,i,n]:o<4?[0,n,i]:o<5?[n,0,i]:[i,0,n];return[(m+a)*255,(p+a)*255,(c+a)*255,r]}function Xf(t,e){let s=[],r=0,i="";for(let o of t)o==="("&&r++,o===")"&&r--,o===e&&r===0?(s.push(i.trim()),i=""):i+=o;return[...s,i.trim()].filter(Boolean)}var Yf={transparent:[0,0,0,0],black:[0,0,0,1],white:[255,255,255,1]};function Ra(t){let e=t.trim();if(Object.hasOwn(Yf,e))return Yf[e];let s=/^#([0-9a-f]{3,8})$/i.exec(e);if(s){let r=s[1].length<6?[...s[1]].map(i=>i+i).join(""):s[1];return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),r.length===8?parseInt(r.slice(6),16)/255:1]}if(s=/^hsla?\((.*)\)$/.exec(e),s){let[r,i]=s[1].split("/").map(p=>p.trim()),[o,n,a,m]=r.split(/[\s,]+/);return Zu(parseFloat(o),_s(n),_s(a),i!==void 0?_s(i):m!==void 0?_s(m):1)}if(s=/^rgba?\((.*)\)$/.exec(e),s){let[r,i,o,n]=s[1].split(/[\s,/]+/).filter(Boolean);return[_s(r),_s(i),_s(o),n===void 0?1:_s(n)]}if(s=/^color-mix\(in srgb\s*,(.*)\)$/.exec(e),s){let[r,i]=Xf(s[1],",").map(c=>{let l=/^(.*?)\s+([\d.]+)%$/.exec(c);return l?{c:Ra(l[1]),p:Number(l[2])/100}:{c:Ra(c),p:void 0}});if(!r?.c||!i?.c)return;let o=r.p??(i.p===void 0?.5:1-i.p),n=i.p??1-o,a=o+n,m=(r.c[3]*o+i.c[3]*n)/a,p=c=>m===0?0:(r.c[c]*r.c[3]*o+i.c[c]*i.c[3]*n)/a/m;return[p(0),p(1),p(2),m*Math.min(1,a)]}}var Hf=t=>"#"+[t[0],t[1],t[2]].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join(""),Uu=t=>String(Math.round(t*1e4)/1e4);function xc(t,e,s=0){if(s>20)throw new Error(`resolve: a custom property in a loop: ${t}`);let r=t.indexOf("var(");if(r<0)return t;let i=0,o=r+3;do t[o]==="("&&i++,t[o]===")"&&i--,o++;while(i>0&&o<t.length);let[n,...a]=Xf(t.slice(r+4,o-1),","),m=e.get(n)??(a.length?a.join(","):void 0);if(m===void 0)throw new Error(`resolve: no value for ${n}`);return xc(t.slice(0,r)+m+t.slice(o),e,s+1)}var Yu=t=>new Map(t.split(";").filter(Boolean).map(e=>{let s=e.indexOf(":");return[e.slice(0,s).trim(),e.slice(s+1).trim()]})),kc={sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"};function Ui(t,e){let s=Ai(e.theme),r=e.fonts??kc,i=qu(`.mono{font-family:${r.mono.replace(/"/g,"")}}
|
|
149
|
+
`;function Zi(t,e={}){return(e.still??Cc).includes(t)?void 0:e.dash??e.kinds?.[t]?.ants??zc[e.kinds?.[t]?.dash??"solid"]}function Ss(t){let e=t?.ants;return e?e===!0?{}:Array.isArray(e)?{ids:e}:e:void 0}function Fa(t,e={}){let s=new Map(t.routes.map(n=>[n.id,n.kind])),r=e.ids&&new Set(e.ids),i=e.speed??Gi,o=n=>String(Number(n.toFixed(3)));return t.rendered.svg.replace(/(<g data-route="([^"]*)" data-part="line">(?:<g[^>]*>)*)<path ([^>]*?)\s*\/>/g,(n,a,f,p)=>{let c=f.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"),l=r&&!r.has(c)?void 0:Zi(s.get(c)??"",e);if(!l||!/class="flow\b/.test(p))return n;let d=l[0]+l[1],m=o(d/Math.max(1e-6,Math.abs(i))),h=o(i<0?d:-d);return e.by==="css"?`${a}<path ${p.replace(/class="flow\b/,'class="flow iso-ants')} style="--ant-on:${o(l[0])};--ant-off:${o(l[1])};--ant-to:${h};--ant-turn:${m}s"/>`:e.by==="none"?`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"/>`:`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"><animate attributeName="stroke-dashoffset" from="0" to="${h}" dur="${m}s" repeatCount="indefinite"/></path>`})}var ir=t=>typeof t=="string"?[t]:[...t],Da=t=>JSON.parse(JSON.stringify(t)),Nn=(t={})=>({...t.from===void 0?{}:{from:t.from},...t.over===void 0?{}:{duration:t.over},...t.easing===void 0?{}:{easing:t.easing}}),Dr=class t{nodes=[];add(e){return this.nodes.push(Da(e)),this}assemble(e={},s={}){return this.add({assemble:e,...Nn(s)})}disassemble(e={},s={}){return this.add({disassemble:e,...Nn(s)})}travel(e,s={}){let{each:r,hold:i,loop:o}=s;return this.add({travel:e,...Nn(s),each:r,hold:i,loop:o})}pulse(e,s={}){return this.add({pulse:ir(e),...Nn(s),loop:s.loop})}ants(e=!0,s={}){return this.add({ants:e===!0?!0:ir(e),...Nn(s),speed:s.speed,dash:s.dash})}draw(e,s={}){return this.add({draw:ir(e),...Nn(s),by:s.by,stagger:s.stagger})}type(e,s={}){return this.add({type:ir(e),...Nn(s)})}move(e,s){return this.add({move:e,...s})}lift(e,s,r={}){return this.add({lift:ir(e),by:s,...Nn(r),stagger:r.stagger,to:r.to,opacity:r.opacity})}focus(e,s={}){let{scope:r,level:i,always:o}=s;return this.add({focus:{lit:ir(e),scope:r,level:i,always:o},...Nn(s),fade:s.fade})}highlight(e,s={}){return this.add({highlight:ir(e),...Nn(s),fade:s.fade})}get camera(){return{focus:(e,s={})=>this.add({camera:{focus:e,zoom:s.zoom,margin:s.margin},...Nn(s)}),fit:(e={})=>this.add({camera:"fit",...Nn(e)})}}sequence(e,s={},r){return this.add({sequence:mf(e,s,r)})}series(e){let s=new Br;return e(s),this.add({series:s.items})}layers(e){let s=new t;return e(s),this.add({layers:s.nodes})}};function mf(t,e,s){let{read:r,duration:i,...o}=e,n=new Dr;return s?.(n),Da({...t===void 0?{}:{name:t},...o,...r!==void 0?{duration:{read:r}}:i!==void 0?{duration:i}:{},...n.nodes.length?{children:n.nodes}:{}})}var Br=class{items=[];sequence(e,s={},r){return this.items.push({sequence:mf(e,s,r)}),this}transition(e){return this.items.push({transition:Da(e)}),this}},Ui=class extends Br{over=[];marks={};head;constructor(e={}){super(),this.head=e}beat(e,s,r={},i){return this.sequence(e,{...r,say:s},i)}assemble(e={},s={}){return this.sequence(void 0,{},r=>r.assemble(e,s))}disassemble(e={},s={}){return this.sequence(void 0,{},r=>r.disassemble(e,s))}mark(e,s){return this.marks[e]=s,this}layers(e){let s=new Dr;return e(s),this.over.push(...s.nodes),this}toJSON(){return Da({isomotion:1,...this.head,...this.items.length?{series:this.items}:{},...this.over.length?{layers:this.over}:{},...Object.keys(this.marks).length?{markers:this.marks}:{}})}},uf=(t={})=>new Ui(t);function Ba(t,e){if(!e)return t;let[s,r,i,o]=e,n=t[2]/t[3],a=i-s,f=o-r;a/f<n?a=f*n:f=a/n,a=Math.min(a,t[2]),f=Math.min(f,t[3]);let p=(s+i)/2,c=(r+o)/2,l=Math.max(t[0],Math.min(t[0]+t[2]-a,p-a/2)),d=Math.max(t[1],Math.min(t[1]+t[3]-f,c-f/2));return[l,d,a,f]}var Yi=["linear","ease","ease-in","ease-out","ease-in-out","settle","bounce"],or=["extend","clamp","wrap","identity"];function kn(t,e){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t!="string")return;let s=/^(-?\d+(?:\.\d+)?)(ms|s|f)?$/.exec(t.trim());if(!s)return;let r=Number(s[1]);return s[2]==="s"?r*1e3:s[2]==="f"?e?r/e*1e3:void 0:r}function Wi(t,e){let s=e===!0?{}:e,r=s.base??2600,i=s.perChar??40,o=s.min??5600,n=s.max??12500;return Math.max(o,Math.min(n,r+(t?.text??"").length*i))}var Ds=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<50;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},gh=t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375},bh={linear:t=>t,ease:Ds(.25,.1,.25,1),"ease-in":Ds(.42,0,1,1),"ease-out":Ds(0,0,.58,1),"ease-in-out":Ds(.42,0,.58,1),settle:Ds(.16,.84,.3,1),bounce:gh};function qr(t,e={}){let s=e.mass??1,r=e.stiffness??100,i=e.damping??10,o=Math.max(0,t)/1e3,n=Math.sqrt(r/s),a=i/(2*Math.sqrt(r*s)),f;if(a<1){let p=n*Math.sqrt(1-a*a);f=1-Math.exp(-a*n*o)*(Math.cos(p*o)+a*n/p*Math.sin(p*o))}else f=1-Math.exp(-n*o)*(1+n*o);return e.overshootClamping?Math.min(1,f):f}function Xn(t,e,s="ease-in-out"){let r=t??s;return typeof r=="string"?bh[r]:"bezier"in r?Ds(...r.bezier):i=>i<=0?0:i>=1?1:qr(i*e,r.spring)}function Vr(t,e,s){let r=t.times.map(l=>kn(l,s)),i=t.values,o=r.length;if(o===1)return i[0];let n=(l,d)=>{if(l==="clamp")return d?i[0]:i[o-1];if(l==="identity")return e;if(l==="wrap"){let m=r[o-1]-r[0];return Vr({...t,extrapolateLeft:"clamp",extrapolateRight:"clamp"},r[0]+((e-r[0])%m+m)%m,s)}};if(e<r[0]){let l=n(t.extrapolateLeft??"extend",!0);if(l!==void 0)return l}if(e>r[o-1]){let l=n(t.extrapolateRight??"extend",!1);if(l!==void 0)return l}let a=0;for(;a<o-2&&e>=r[a+1];)a++;let f=r[a+1]-r[a],p=(e-r[a])/f,c=p<0||p>1?p:Xn(t.easing,f,"linear")(p);return i[a]+(i[a+1]-i[a])*c}var jc=["sequence","series","layers","assemble","disassemble","travel","pulse","ants","draw","type","move","lift","focus","highlight","camera"],hf={morph:"the 2D morph is a later version's",diff:"diffs are a later version's",switch:"a look is a beat's: its variants"},Jn=["from","duration","easing"],Hi={sequence:[],series:[],layers:[],assemble:Jn,disassemble:Jn,travel:[...Jn,"each","hold","loop"],pulse:[...Jn,"loop"],ants:[...Jn,"speed","dash"],draw:[...Jn,"by","stagger"],type:Jn,move:["from","x","y","scale","opacity"],lift:[...Jn,"by","stagger","to","opacity"],focus:[...Jn,"fade"],highlight:[...Jn,"fade"],camera:Jn},wh=["name","from","offset","duration","loop","playbackRate","trimBefore","say","show","hide","focus","highlight","levels","variants","enter","ants","children","layers","series"],At=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function qa(t){let e=[],s=(u,b,x)=>{e.push({severity:"error",path:u,message:b,...x?{hint:x}:{}})},r=(u,b,x)=>{for(let w of Object.keys(u))if(!b.includes(w)){let $=Vt(w,b);s(`${x}/${w}`,`unknown key "${w}"`,$?`did you mean "${$}"?`:void 0)}};if(!At(t))return s("","a motion document is a map"),e;r(t,["isomotion","fps","seed","ambient","series","layers","markers"],""),t.isomotion!==1&&s("/isomotion","isomotion is 1");let i=typeof t.fps=="number"&&t.fps>0?t.fps:void 0;t.fps!==void 0&&i===void 0&&s("/fps","fps is a number over 0"),t.seed!==void 0&&!Number.isInteger(t.seed)&&s("/seed","seed is a whole number"),t.ambient!==void 0&&t.ambient!=="on"&&t.ambient!=="off"&&s("/ambient",'ambient is "on" or "off"');let o=(u,b,x={})=>{if(u===void 0)return;if(typeof u=="string"&&/f$/.test(u)&&i===void 0){s(b,`"${u}" is in frames: the document needs its fps`);return}let w=kn(u,i);w===void 0?s(b,`${JSON.stringify(u)} isn't a time (ms, "1.2s", "450ms", "30f")`):w<0&&!x.negative&&s(b,"a time can't be negative")},n=(u,b,x)=>{if(u!==void 0&&!b.includes(u)){let w=typeof u=="string"?Vt(u,b):void 0;s(x,`${JSON.stringify(u)} isn't one of ${b.join(", ")}`,w?`did you mean "${w}"?`:void 0)}},a=(u,b,x={})=>{u!==void 0&&(typeof u!="number"||!Number.isFinite(u)||x.min!==void 0&&u<x.min||x.max!==void 0&&u>x.max||x.over!==void 0&&u<=x.over)&&s(b,`${JSON.stringify(u)} isn't a number${x.over!==void 0?` over ${x.over}`:x.min!==void 0?` from ${x.min}${x.max!==void 0?` to ${x.max}`:""}`:""}`)},f=(u,b)=>{if(u!==void 0){if(!Array.isArray(u)){s(b,"a list of ids");return}u.forEach((x,w)=>{typeof x!="string"&&s(`${b}/${w}`,"an id")})}},p=(u,b,x=[])=>{if(!At(u)){s(b,"a spring is a map");return}r(u,["mass","damping","stiffness","overshootClamping",...x],b);for(let w of["mass","damping","stiffness"])a(u[w],`${b}/${w}`,{over:0});u.overshootClamping!==void 0&&typeof u.overshootClamping!="boolean"&&s(`${b}/overshootClamping`,"true or false")},c=(u,b)=>{if(u!==void 0){if(typeof u=="string"){n(u,Yi,b);return}if(At(u)&&"bezier"in u){r(u,["bezier"],b),(!Array.isArray(u.bezier)||u.bezier.length!==4||u.bezier.some(x=>typeof x!="number"))&&s(`${b}/bezier`,"four numbers");return}if(At(u)&&"spring"in u){r(u,["spring"],b),p(u.spring,`${b}/spring`);return}s(b,"an easing is a name, { bezier: [a, b, c, d] } or { spring: { \u2026 } }")}},l=(u,b)=>{if(u===void 0)return;if(!At(u)){s(b,"a curve is { times, values }");return}r(u,["times","values","easing","extrapolateLeft","extrapolateRight"],b);let x=u.times,w=u.values;if(!Array.isArray(x)||!x.length)s(`${b}/times`,"a list of times");else{x.forEach((v,O)=>o(v,`${b}/times/${O}`,{negative:!0}));let $=x.map(v=>kn(v,i));for(let v=1;v<$.length;v++)$[v]!==void 0&&$[v-1]!==void 0&&$[v]<=$[v-1]&&s(`${b}/times/${v}`,"times go up")}!Array.isArray(w)||w.some($=>typeof $!="number")?s(`${b}/values`,"a list of numbers"):Array.isArray(x)&&w.length!==x.length&&s(`${b}/values`,`${w.length} values for ${x.length} times`),c(u.easing,`${b}/easing`),n(u.extrapolateLeft,or,`${b}/extrapolateLeft`),n(u.extrapolateRight,or,`${b}/extrapolateRight`)},d=(u,b)=>{if(u!==void 0){if(!At(u)){s(b,"focus is { lit: [ids] }");return}r(u,["lit","scope","level","always"],b),u.lit===void 0&&s(`${b}/lit`,"what is lit"),f(u.lit,`${b}/lit`),f(u.always,`${b}/always`),n(u.scope,["all","links"],`${b}/scope`),a(u.level,`${b}/level`,{min:0,max:1})}},m=(u,b)=>{u!==void 0&&typeof u!="string"&&s(b,"text")},h=new Map;function y(u,b,x){if(!At(u)){s(b,"a sequence is a map");return}if(r(u,wh,b),u.name!==void 0&&(typeof u.name!="string"||!/^[A-Za-z][\w-]*$/.test(u.name)?s(`${b}/name`,"a name is letters, digits, - and _, from a letter"):h.has(u.name)?s(`${b}/name`,`"${u.name}" is already a name (${h.get(u.name)})`):h.set(u.name,b)),x&&u.from!==void 0&&s(`${b}/from`,"in a series a sequence follows the one before","offset moves it"),!x&&u.offset!==void 0&&s(`${b}/offset`,"offset is for a series","use from"),o(u.from,`${b}/from`),o(u.offset,`${b}/offset`,{negative:!0}),o(u.trimBefore,`${b}/trimBefore`),At(u.duration)){r(u.duration,["read"],`${b}/duration`);let w=u.duration.read;if(w!==!0&&!At(w))s(`${b}/duration/read`,"true, or { base, perChar, min, max }");else if(At(w)){r(w,["base","perChar","min","max"],`${b}/duration/read`);for(let $ of["base","perChar","min","max"])a(w[$],`${b}/duration/read/${$}`,{min:0})}}else o(u.duration,`${b}/duration`);if(u.loop!==void 0&&typeof u.loop!="boolean"&&!(Number.isInteger(u.loop)&&u.loop>=1)&&s(`${b}/loop`,"true, false, or how many times"),a(u.playbackRate,`${b}/playbackRate`,{over:0}),u.say!==void 0)if(!At(u.say))s(`${b}/say`,"say is a map");else{let w=u.say;r(w,["chapter","title","text","code","facts","color"],`${b}/say`);for(let $ of["chapter","title","text","code","color"])m(w[$],`${b}/say/${$}`);w.facts!==void 0&&(!Array.isArray(w.facts)||w.facts.some($=>!Array.isArray($)||$.length!==2||$.some(v=>typeof v!="string")))&&s(`${b}/say/facts`,"a list of [name, value]")}for(let w of["show","hide","highlight"])f(u[w],`${b}/${w}`);if(d(u.focus,`${b}/focus`),u.levels!==void 0)if(!At(u.levels))s(`${b}/levels`,"levels is a map: an id, and how much of it");else for(let[w,$]of Object.entries(u.levels))a($,`${b}/levels/${w}`,{min:0,max:1});if(u.variants!==void 0)if(!At(u.variants))s(`${b}/variants`,"variants is a map: an id, and the name of its look");else for(let[w,$]of Object.entries(u.variants))typeof $!="string"&&s(`${b}/variants/${w}`,`a look's name, or "" for its own`);u.enter!==void 0&&(At(u.enter)?(r(u.enter,["fade","easing"],`${b}/enter`),u.enter.fade===void 0&&s(`${b}/enter/fade`,"how long the fade is"),o(u.enter.fade,`${b}/enter/fade`),c(u.enter.easing,`${b}/enter/easing`)):s(`${b}/enter`,"enter is { fade }")),u.ants!==void 0&&typeof u.ants!="boolean"&&f(u.ants,`${b}/ants`);for(let w of["children","layers"])u[w]!==void 0&&k(u[w],`${b}/${w}`);u.series!==void 0&&g(u.series,`${b}/series`)}function g(u,b){if(!Array.isArray(u)){s(b,"a series is a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)||Object.keys(x).length!==1||!("sequence"in x||"transition"in x)){s($,"a series holds sequences and transitions");return}if("sequence"in x){y(x.sequence,`${$}/sequence`,!0);return}let v=x.transition,O=`${$}/transition`,C=A=>At(u[A])&&"sequence"in u[A];if((!C(w-1)||!C(w+1))&&s(O,"a transition is between two sequences"),!At(v)){s(O,"a transition is { presentation, timing }");return}r(v,["presentation","timing"],O),v.presentation===void 0?s(`${O}/presentation`,"a presentation"):n(v.presentation,["fade","none"],`${O}/presentation`),At(v.timing)?"linear"in v.timing?(r(v.timing,["linear"],`${O}/timing`),o(v.timing.linear,`${O}/timing/linear`)):"spring"in v.timing?(r(v.timing,["spring"],`${O}/timing`),p(v.timing.spring,`${O}/timing/spring`,["duration"]),At(v.timing.spring)&&o(v.timing.spring.duration,`${O}/timing/spring/duration`)):s(`${O}/timing`,"a timing is { linear } or { spring }"):s(`${O}/timing`,"a timing is { linear } or { spring }")})}function k(u,b){if(!Array.isArray(u)){s(b,"a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)){s($,"a map");return}let v=jc.filter(R=>R in x);if(v.length!==1){let R=Object.keys(x).find(S=>S in hf),M=Object.keys(x)[0],T=M?Vt(M,jc):void 0;s($,R?`${R}: ${hf[R]}`:v.length?`one of ${v.join(", ")}, not several`:`one of ${jc.join(", ")}`,!R&&!v.length&&T?`did you mean "${T}"?`:void 0);return}let O=v[0],C=x[O],A=`${$}/${O}`;r(x,[O,...Hi[O]],$),Hi[O].includes("from")&&o(x.from,`${$}/from`),Hi[O].includes("duration")&&(o(x.duration,`${$}/duration`),c(x.easing,`${$}/easing`));for(let R of["each","hold","stagger","fade"])Hi[O].includes(R)&&o(x[R],`${$}/${R}`);if(Hi[O].includes("loop")&&x.loop!==void 0&&typeof x.loop!="boolean"&&s(`${$}/loop`,"true or false"),O==="sequence")y(C,A,!1);else if(O==="series")g(C,A);else if(O==="layers")k(C,A);else if(O==="assemble"||O==="disassemble")At(C)?(n(C.style,O==="assemble"?jr:Lr,`${A}/style`),n(C.order,sr,`${A}/order`),C.duration!==void 0&&s(`${A}/duration`,"its length is beside it","duration is the node's")):s(A,`${O} is a map (its options)`);else if(O==="travel")!Array.isArray(C)||!C.length?s(A,"a list of connectors"):C.forEach((R,M)=>{Array.isArray(R)?f(R,`${A}/${M}`):typeof R!="string"&&s(`${A}/${M}`,"a connector, or a list of them at once")});else if(O==="ants")C!==!0&&f(C,A),a(x.speed,`${$}/speed`),x.dash!==void 0&&(!Array.isArray(x.dash)||x.dash.length!==2||x.dash.some(R=>typeof R!="number"||R<=0))&&s(`${$}/dash`,"two numbers over 0: on, off");else if(O==="move"){typeof C!="string"&&s(A,"an id");for(let R of["x","y","scale","opacity"])l(x[R],`${$}/${R}`)}else if(O==="focus")d(C,A);else if(O==="camera"){if(C!=="fit")if(!At(C))s(A,'"fit", or { focus, zoom, margin }');else{r(C,["focus","zoom","margin"],A),a(C.zoom,`${A}/zoom`,{over:0}),a(C.margin,`${A}/margin`);let R=C.focus;typeof R=="string"||Array.isArray(R)&&(R.every(M=>typeof M=="string")||R.length===4&&R.every(M=>typeof M=="number"))||s(`${A}/focus`,"an id, some ids, or a box [x, y, w, h]")}}else f(C,A);O==="draw"&&n(x.by,["stroke","grow"],`${$}/by`),O==="lift"&&(x.by===void 0&&s(`${$}/by`,"how far apart"),a(x.by,`${$}/by`),n(x.to,["up","down"],`${$}/to`),l(x.opacity,`${$}/opacity`))})}if(t.series!==void 0&&g(t.series,"/series"),t.layers!==void 0&&k(t.layers,"/layers"),t.markers!==void 0)if(!At(t.markers))s("/markers","markers is a map");else for(let[u,b]of Object.entries(t.markers))if(typeof b=="string"&&/^[A-Za-z][\w-]*([+-].+)?$/.test(b)){let x=/^([A-Za-z][\w-]*?)(?:([+-])(\d.*))?$/.exec(b);if(x&&(h.has(x[1])?x[1]:void 0))x[3]!==void 0&&o(x[3],`/markers/${u}`);else if(!h.has(b)){let v=Vt(x?.[1]??b,h.keys());s(`/markers/${u}`,`no sequence is named "${x?.[1]??b}"`,v?`did you mean "${v}"?`:void 0)}}else o(b,`/markers/${u}`);return e}var $n=t=>Math.round(t*100)/100||0,Wt=t=>Math.round(t*1e4)/1e4||0,Rn=t=>Math.max(0,Math.min(1,t)),Kr=(t,e,s)=>t+(e-t)*s,xh=250,Lc=class{items=new Map;labels=new Map;routes=new Map;tokens=[];pulses=[];outlines=[];variants={};marks=1;at(e,s){let r=e.get(s);return r||e.set(s,r={}),r}item(e,s){let r=this.at(this.items,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.scale!==void 0&&(r.scale=(r.scale??1)*s.scale,r.about=s.about??r.about),s.clip&&(r.clip=s.clip)}label(e,s){let r=this.at(this.labels,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.typed!==void 0&&(r.typed=Math.min(r.typed??1,s.typed))}route(e,s){let r=this.at(this.routes,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.drawn!==void 0&&s.drawn<(r.drawn??1)&&(r.drawn=s.drawn,r.by=s.by),s.ants&&(r.ants=s.ants)}add(e){for(let[s,r]of Object.entries(e.items??{}))this.item(s,r);for(let[s,r]of Object.entries(e.labels??{}))this.label(s,r);for(let[s,r]of Object.entries(e.routes??{}))this.route(s,r);e.marks&&(this.marks*=e.marks.opacity),this.tokens.push(...e.tokens??[]),this.pulses.push(...e.pulses??[])}state(e){let s={},r=(c,l)=>{let d={};for(let[m,h]of c){let y=l(h);Object.keys(y).length&&(d[m]=y)}return d},i=c=>Object.keys(c).length>0,o=c=>c===void 0||Wt(c)>=1?{}:{opacity:Wt(Math.max(0,c))},n=c=>({...$n(c.dx??0)?{dx:$n(c.dx)}:{},...$n(c.dy??0)?{dy:$n(c.dy)}:{}}),a=r(this.items,c=>({...o(c.opacity),...n(c),...c.scale!==void 0&&Wt(c.scale)!==1?{scale:Wt(c.scale),...c.about?{about:c.about}:{}}:{},...c.clip?{clip:c.clip}:{}})),f=r(this.labels,c=>({...o(c.opacity),...c.typed!==void 0&&c.typed<1?{typed:Wt(c.typed)}:{},...n(c)})),p=r(this.routes,c=>{let l=c.opacity!==void 0&&Wt(c.opacity)<=0,d=c.drawn!==void 0&&c.drawn<1;return{...o(c.opacity),...d?{drawn:Wt(c.drawn),...c.by?{by:c.by}:{}}:{},...c.ants&&!l&&!d?{ants:c.ants}:{}}});return i(a)&&(s.items=a),i(f)&&(s.labels=f),i(p)&&(s.routes=p),Wt(this.marks)<1&&(s.marks={opacity:Wt(this.marks)}),this.tokens.length&&(s.tokens=this.tokens),this.pulses.length&&(s.pulses=this.pulses),this.outlines.length&&(s.outlines=this.outlines),i(this.variants)&&(s.variants=this.variants),e&&(s.camera=e),s}};function Ji(t){let e=Ss(t.raw),s=t.rendered.looks,r=rr(t),i=Object.keys(r.notes).filter(o=>r.notes[o]===void 0);return{model:r,kinds:Object.fromEntries(t.routes.map(o=>[o.id,o.kind])),outlines:Object.fromEntries(t.layout.items.map(o=>[o.id,Yt(o.box).map(n=>[$n(n[0]),$n(n[1])])])),...s&&Object.keys(s).length?{looks:s}:{},...e?{ants:e}:{},...i.length?{free:i}:{}}}function vs(t,e,s={}){let r="model"in t?t:Ji(t),i=r.free?{...r.model,notes:{...r.model.notes,...Object.fromEntries(r.free.map(P=>[P,void 0]))}}:r.model,o=qa(e),n=e.fps,a=r.ants,f=()=>({ok:!1,diags:o,duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}});if(o.length)return f();let p=(P,B,W)=>{o.push({severity:"error",path:P,message:B,...W?{hint:W}:{}})},c=(P,B)=>P===void 0?B:kn(P,n),l=new Map(i.pieces.map(P=>[P.id,P])),d=new Set(i.routes.map(P=>P.id)),m=new Set(Object.keys(i.notes)),h=new Map(Object.entries(r.kinds)),y=[...l.keys(),...d,...m],g=new Set(y),k=new Map;for(let[P,B]of Object.entries(i.notes))B!==void 0&&k.set(B,[...k.get(B)??[],P]);let u={any:g,thing:new Set(l.keys()),route:d},b={any:"thing, connector or note",thing:"thing",route:"connector"},x=(P,B,W="any")=>{if(!u[W].has(P)){let he=Vt(P,u[W]);p(B,`no ${b[W]} "${P}" in this drawing`,he?`did you mean "${he}"?`:void 0)}},w=(P,B,W="any")=>P?.forEach((he,fe)=>x(he,`${B}/${fe}`,W)),$=new Map(Object.entries(r.outlines)),v=new Map;function O(P,B){let W="from"in P?c(P.from,0):0,he="duration"in P?c(P.duration,NaN):NaN,fe=Number.isFinite(he);if("sequence"in P){let X=P.sequence;return c(X.from,0)+M(X,`${B}/sequence`)}if("series"in P)return T(P.series,`${B}/series`).end;if("layers"in P)return Math.max(0,...P.layers.map((X,ne)=>O(X,`${B}/layers/${ne}`)));if("assemble"in P||"disassemble"in P){let X="assemble"in P?"assemble":"disassemble",ne="assemble"in P?P.assemble:P.disassemble,ye=v.get(P);return ye||v.set(P,ye=_r(i,X,{seed:e.seed??1,...ne,...fe?{duration:he}:{}})),W+ye.duration}return"draw"in P?W+(fe?he:400)+Math.max(0,P.draw.length-1)*c(P.stagger,0):"lift"in P?W+Math.max(fe?he:750,...P.opacity?.times.map(X=>kn(X,n))??[])+Math.max(0,P.lift.length-1)*c(P.stagger,0):fe?W+he:"travel"in P?P.loop?W:W+P.travel.length*c(P.each,1150):"pulse"in P?P.loop?W:W+1500:"type"in P?W+400:"camera"in P?W+900:"move"in P?W+Math.max(0,...[P.x,P.y,P.scale,P.opacity].flatMap(X=>X?.times.map(ne=>kn(ne,n))??[])):W}let C=(P,B)=>Math.max(0,...(P.children??[]).map((W,he)=>O(W,`${B}/children/${he}`)),...(P.layers??[]).map((W,he)=>O(W,`${B}/layers/${he}`)),P.series?T(P.series,`${B}/series`).end:0),A=new Map;function R(P,B){let W=A.get(P);if(W!==void 0)return W;let he;return P.duration!==void 0&&typeof P.duration=="object"?he=Wi(P.say,P.duration.read):he=P.duration!==void 0?c(P.duration,0):C(P,B),P.duration===void 0&&he<=0&&P.say&&(he=Wi(P.say,!0)),he<=0&&p(`${B}/duration`,"how long is it? (nothing in it says)"),A.set(P,he),he}let M=(P,B)=>{let W=R(P,B),he=P.playbackRate??1;return P.loop===!0?W/he:(typeof P.loop=="number"?W*P.loop:W)/he};function T(P,B){let W=[],he=0,fe;return P.forEach((X,ne)=>{if("transition"in X){let D=X.transition,ce=D.timing,me=D.presentation==="none"?0:kh(ce,n);fe={t:D,length:me};return}let ye=X.sequence,$e=`${B}/${ne}/sequence`,E=M(ye,$e),_=Math.max(0,he+c(ye.offset,0)-(fe?.length??0));fe&&W.length&&fe.length>Math.min(W[W.length-1].end-W[W.length-1].start,E)&&p(`${B}/${ne-1}/transition/timing`,"a transition is no longer than either side of it"),W.push({s:ye,path:$e,start:_,end:_+E,...fe?{into:fe}:{}}),he=_+E,fe=void 0}),{list:W,end:Math.max(0,...W.map(X=>X.end))}}let S=T(e.series??[],"/series"),N=Math.max(0,...(e.layers??[]).map((P,B)=>O(P,`/layers/${B}`))),z=Math.max(S.end,N);z<=0&&!o.length&&p("","a motion document has a series, or layers, that last");let K=new Map,J=[],Z=i.viewBox,L=(P,B,W)=>{let he=W!==void 0?1/W:Math.max((P.w+B*2)/Z[2],(P.h+B*2)/Z[3]);return[P.x+P.w/2-Z[2]*he/2,P.y+P.h/2-Z[3]*he/2,Z[2]*he,Z[3]*he]};function U(P,B,W){let he=fe=>W?{at:W.at+fe/W.rate,rate:W.rate}:void 0;if("sequence"in P){ee(P.sequence,`${B}/sequence`,he(c(P.sequence.from,0)),!1);return}if("series"in P){for(let fe of T(P.series,`${B}/series`).list)ee(fe.s,fe.path,he(fe.start),!1);return}if("layers"in P){P.layers.forEach((fe,X)=>U(fe,`${B}/layers/${X}`,W));return}if("travel"in P)P.travel.forEach((fe,X)=>(Array.isArray(fe)?fe:[fe]).forEach((ne,ye)=>x(ne.split(":")[0],`${B}/travel/${X}${Array.isArray(fe)?`/${ye}`:""}`,"route")));else if("pulse"in P)w(P.pulse,`${B}/pulse`,"thing");else if("ants"in P)P.ants!==!0&&w(P.ants,`${B}/ants`,"route");else if("draw"in P)w(P.draw,`${B}/draw`,"route");else if("type"in P)w(P.type,`${B}/type`);else if("move"in P)x(P.move,`${B}/move`,"thing");else if("lift"in P)w(P.lift,`${B}/lift`,"thing");else if("focus"in P)H(P.focus,`${B}/focus`);else if("highlight"in P)w(P.highlight,`${B}/highlight`,"thing");else if("camera"in P){let fe=P.camera,X=c(P.duration,900);if(!W){p(`${B}/camera`,"a camera can't be in a loop");return}let ne=Z;if(fe!=="fit"){let ye=fe.focus;if(Array.isArray(ye)&&typeof ye[0]=="number")ne=L({x:ye[0],y:ye[1],w:ye[2],h:ye[3]},fe.margin??0,fe.zoom);else{let $e=typeof ye=="string"?[ye]:ye;$e.forEach((_,D)=>x(_,`${B}/camera/focus${typeof ye=="string"?"":`/${D}`}`,"thing"));let E=$e.map(_=>l.get(_)?.bbox).filter(_=>!!_);if(E.length){let _=Math.min(...E.map(ce=>ce.x)),D=Math.min(...E.map(ce=>ce.y));ne=L({x:_,y:D,w:Math.max(...E.map(ce=>ce.x+ce.w))-_,h:Math.max(...E.map(ce=>ce.y+ce.h))-D},fe.margin??40,fe.zoom)}}}J.push({at:W.at+c(P.from,0)/W.rate,over:X/W.rate,ease:Xn(P.easing,X,"settle"),to:ne})}}let H=(P,B)=>{P&&(w(P.lit,`${B}/lit`),w(P.always,`${B}/always`))};function ee(P,B,W,he){if(P.name!==void 0&&W&&K.set(P.name,W.at),!he)for(let ne of["show","hide","say","enter","focus","highlight","levels","variants","ants"])P[ne]!==void 0&&p(`${B}/${ne}`,`${ne} is for a sequence of the document's own series`,ne==="focus"||ne==="highlight"||ne==="ants"?`here, a child: { ${ne}: \u2026 }`:void 0);w(P.show,`${B}/show`),w(P.hide,`${B}/hide`),w(P.highlight,`${B}/highlight`,"thing"),H(P.focus,`${B}/focus`);for(let ne of Object.keys(P.levels??{}))ne!=="*"&&x(ne,`${B}/levels/${ne}`);for(let[ne,ye]of Object.entries(P.variants??{})){x(ne,`${B}/variants/${ne}`,"thing");let $e=r.looks?.[ne]??[];if(l.has(ne)&&ye!==""&&!$e.includes(ye)){let E=Vt(ye,$e);p(`${B}/variants/${ne}`,$e.length?`${ne} has no look "${ye}" (it has ${$e.join(", ")})`:`${ne} declares no looks (variants: in the diagram)`,E?`did you mean "${E}"?`:void 0)}}Array.isArray(P.ants)&&w(P.ants,`${B}/ants`,"route");let fe=P.playbackRate??1,X=W&&!P.loop?{at:W.at-c(P.trimBefore,0)/(W.rate*fe),rate:W.rate*fe}:void 0;if((P.children??[]).forEach((ne,ye)=>U(ne,`${B}/children/${ye}`,X)),(P.layers??[]).forEach((ne,ye)=>U(ne,`${B}/layers/${ye}`,X)),P.series)for(let ne of T(P.series,`${B}/series`).list)ee(ne.s,ne.path,X&&{at:X.at+ne.start/X.rate,rate:X.rate},!1)}for(let P of S.list)ee(P.s,P.path,{at:P.start,rate:1},!0);(e.layers??[]).forEach((P,B)=>U(P,`/layers/${B}`,{at:0,rate:1})),J.sort((P,B)=>P.at-B.at);let j={};for(let[P,B]of Object.entries(e.markers??{})){let W=kn(B,n);if(W!==void 0){j[P]=W;continue}let he=String(B),fe=[...K.keys()].filter(ye=>he===ye||he.startsWith(ye+"+")||he.startsWith(ye+"-")).sort((ye,$e)=>$e.length-ye.length)[0];if(fe===void 0){p(`/markers/${P}`,`"${he}" isn't a moment of this document`);continue}let X=he.slice(fe.length),ne=X?kn(X.slice(1),n):0;if(ne===void 0){p(`/markers/${P}`,`"${X}" isn't a time`);continue}j[P]=K.get(fe)+(X[0]==="-"?-ne:ne)}if(o.length)return f();let q=S.list.map((P,B)=>({name:P.s.name??`beat-${B+1}`,index:B,start:P.start,end:P.end,...P.s.say?{say:P.s.say}:{}})),G=new Map;for(let P of S.list){for(let B of P.s.show??[])G.has(B)||G.set(B,!1);for(let B of P.s.hide??[])G.has(B)||G.set(B,!0)}let Q=[new Map(G)];for(let P of S.list){let B=new Map(Q[Q.length-1]);for(let W of P.s.show??[])B.set(W,!0);for(let W of P.s.hide??[])B.set(W,!1);Q.push(B)}let le=[new Map];for(let P of S.list){let B=new Map(le[le.length-1]);for(let[W,he]of Object.entries(P.s.variants??{}))B.set(W,he);le.push(B)}let pe=(P,B)=>!P||P.lit.includes(B)||P.always?.includes(B)||P.scope==="links"&&l.has(B)?1:P.level??.12,Y=(P,B)=>{let W=P<0?void 0:S.list[P].s.levels;return W?W[B]??W["*"]??1:1},ie=(P,B)=>(Q[P+1].get(B)===!1?0:1)*(P<0?1:pe(S.list[P].s.focus,B))*Y(P,B),Ae=(P,B)=>{let W=i.notes[B];if(W===void 0)return ie(P,B);let he=P<0?void 0:S.list[P].s.levels?.[B];return ie(P,W)*(Q[P+1].get(B)===!1?0:1)*(he??1)},De=P=>{let B=-1;for(let W=0;W<S.list.length;W++)S.list[W].start<=P&&(B=W);return B},I=(P,B)=>{let W=S.list[P],he=B-W.start;if(W.into&&W.into.length>0)return $h(W.into.t.timing,he,W.into.length);let fe=W.s.enter;if(!fe)return 1;let X=c(fe.fade,0);return X<=0?1:Xn(fe.easing,X,"ease")(Rn(he/X))};function V(P,B,W,he,fe){if("sequence"in P){let $e=P.sequence,E=c($e.from,0);ke($e,B-E,W-E,Ie($e,he-E),fe);return}if("series"in P){for(let $e of T(P.series,"").list)ke($e.s,B-$e.start,W-$e.start,$e.end-$e.start,fe);return}if("layers"in P){for(let $e of P.layers)V($e,B,W,he,fe);return}let X=c("from"in P?P.from:void 0,0),ne=B-X;if("assemble"in P||"disassemble"in P){fe.sum.add(v.get(P).at(ne));return}if("draw"in P){let $e=Math.max(1,c(P.duration,400)),E=c(P.stagger,0),_=Xn(P.easing,$e,"ease-out");P.draw.forEach((D,ce)=>{let me=_(Rn((ne-ce*E)/$e));me<=0?(fe.sum.route(D,{opacity:0,drawn:0}),fe.sum.label(D,{opacity:0})):me<1&&(fe.sum.route(D,{drawn:me,...P.by?{by:P.by}:{}}),fe.sum.label(D,{opacity:me}))});return}if("type"in P){let $e=c(P.duration,400),E=Xn(P.easing,$e,"linear")(Rn(ne/Math.max(1,$e)));if(E<1)for(let _ of P.type)fe.sum.label(_,E<=0?{opacity:0}:{typed:E});return}if("move"in P){let $e=me=>me?Vr(me,ne,n):void 0,E=$e(P.x)??0,_=$e(P.y)??0,D=$e(P.scale),ce=$e(P.opacity);fe.sum.item(P.move,{dx:E,dy:_,...D===void 0?{}:{scale:D,about:l.get(P.move).foot},...ce===void 0?{}:{opacity:Rn(ce)}});for(let me of[P.move,...k.get(P.move)??[]])fe.sum.label(me,{dx:E,dy:_,...ce===void 0?{}:{opacity:Rn(ce)}});return}if("lift"in P){let $e=c(P.stagger,0),E=Math.max(1,c(P.duration,750)),_=Xn(P.easing,E,"ease-out"),D=P.to==="down",ce=P.lift.length;P.lift.forEach((me,Ce)=>{let oe=ne-(D?ce-1-Ce:Ce)*$e,Le=_(Rn(oe/E)),Pe=(Ce+1)*P.by*(D?Le:-Le),xe=P.opacity?Rn(Vr(P.opacity,oe,n)):1;if(!(!Pe&&xe>=1)){fe.sum.item(me,{dy:Pe,opacity:xe});for(let _e of[me,...k.get(me)??[]])fe.sum.label(_e,{dy:Pe,opacity:xe})}});return}if("camera"in P)return;let ye=P.duration===void 0?Math.max(0,he-X):c(P.duration,0);if(!(ne<0||ne>ye)){if("focus"in P||"highlight"in P){let $e=Math.max(1,c(P.fade,xh)),E=Rn(Math.min(ne/$e,P.duration===void 0?1:(ye-ne)/$e)),_=Xn(P.easing,$e,"linear")(E);if("focus"in P)be(P.focus,_,fe.sum);else for(let D of P.highlight)fe.shown(D)&&Te(D,_,fe.sum);return}if("ants"in P){ze(P.ants===!0?[...d]:P.ants,fe,P.speed,P.dash);return}if("pulse"in P){let E=P.loop?ae(W-X,1500,fe)/1500:ne/Math.max(1,P.duration===void 0?1500:ye);if(E<0||E>=1)return;for(let _ of P.pulse)if(fe.shown(_)){let D=l.get(_),ce=D.bbox.w*.5*(.7+E*.6);fe.sum.pulses.push({x:$n(D.foot[0]),y:$n(D.foot[1]),rx:$n(ce),ry:$n(ce*.58),opacity:Wt(1-E)})}return}if("travel"in P){let $e=c(P.each,1150),E=c(P.hold,P.loop?700:0),_=P.travel.length*$e+E,D=P.loop?ae(W-X,_,fe):ne,ce=Math.floor(D/$e);if(ce>=P.travel.length)return;let me=(D-ce*$e)/$e,Ce=Xn(P.easing,$e,"ease-in-out")(me),oe=P.travel[ce];for(let Le of Array.isArray(oe)?oe:[oe]){let[Pe,xe]=Le.split(":");fe.shown(Pe)&&fe.sum.tokens.push({route:Pe,at:Wt((xe??h.get(Pe))==="blocked"?te(me):Ce),...xe?{kind:xe}:{}})}}}}let te=P=>P<.7?P/.7:1-(P-.7)/.3*.25,ae=(P,B,W)=>W.off?0:(P%B+B)%B,Te=(P,B,W)=>{Wt(B)>0&&$.has(P)&&W.outlines.push({id:P,points:$.get(P),...Wt(B)<1?{opacity:Wt(B)}:{}})},be=(P,B,W)=>{for(let he of y){let fe=m.has(he)&&!P.lit.includes(he)&&!P.always?.includes(he)?i.notes[he]:void 0,X=Kr(1,pe(P,fe??he),B);X>=1||(l.has(he)?(W.item(he,{opacity:X}),W.label(he,{opacity:X})):d.has(he)?(W.route(he,{opacity:X}),W.label(he,{opacity:X})):W.label(he,{opacity:X}))}},ze=(P,B,W=Gi,he)=>{for(let fe of P){let X=Zi(h.get(fe)??"",{dash:he,kinds:s.kinds,still:s.still});if(!X)continue;let ne=X[0]+X[1],ye=ae(W*B.A/1e3,ne,B);B.sum.route(fe,{ants:{dash:X,offset:$n(ye)}})}},Ie=(P,B)=>P.loop===!0?Math.max(0,B):M(P,"");function ke(P,B,W,he,fe){if(B<0||B>he||B===he&&he<z&&he>0&&P.loop)return;let X=P.playbackRate??1,ne=R(P,""),ye=c(P.trimBefore,0),$e=P.loop&&ne>0?B*X%ne:B*X,E=$e+ye,_=W*X+ye;for(let D of P.children??[])V(D,E,_,ne+ye,fe);for(let D of P.layers??[])V(D,E,_,ne+ye,fe);if(P.series)for(let D of T(P.series,"").list)ke(D.s,E-D.start,_-D.start,D.end-D.start,fe)}function Be(P,B={}){let W=Math.max(0,Math.min(z,Number.isFinite(P)?P:0)),he=B.ambient==="off"||e.ambient==="off"&&B.ambient===void 0,fe=typeof B.ambient=="number"?B.ambient:W,X=new Lc,ne=De(W),ye=ne<0?1:I(ne,W),$e=(oe,Le)=>ne<0?Le(-1,oe):ye>=1?Le(ne,oe):Kr(Le(ne-1,oe),Le(ne,oe),ye),E=oe=>(ne<0?Q[0]:Q[ne+1]).get(oe)!==!1;if(G.size||S.list.some(oe=>oe.s.focus||oe.s.levels))for(let oe of y){let Le=$e(oe,m.has(oe)?Ae:ie);Le>=1||(l.has(oe)&&X.item(oe,{opacity:Le}),d.has(oe)&&X.route(oe,{opacity:Le}),X.label(oe,{opacity:Le}))}if(ne>=0)for(let oe of le[le.length-1].keys()){let Le=le[ne].get(oe)??"",Pe=le[ne+1].get(oe)??"",xe={};Le&&ye<1&&(xe[Le]=Wt(1-ye)),Pe&&(xe[Pe]=Wt((xe[Pe]??0)+ye));for(let _e of Object.keys(xe))xe[_e]<=0&&delete xe[_e];Object.keys(xe).length&&(X.variants[oe]=xe)}if(ne>=0){let oe=new Set(S.list[ne].s.highlight??[]),Le=new Set(ne>0&&ye<1?S.list[ne-1].s.highlight??[]:[]);for(let Pe of new Set([...Le,...oe]))Te(Pe,Kr(Le.has(Pe)?1:0,oe.has(Pe)?1:0,ye),X)}let _={sum:X,shown:E,off:he,A:fe},D=ne>=0?S.list[ne].s.ants:void 0,ce=D===void 0?a:void 0;D?ze(D===!0?[...d]:D,_):ce&&ze(ce.ids??[...d],_,ce.speed,ce.dash),S.list.forEach((oe,Le)=>{W>=oe.start&&(W<oe.end||Le===ne&&W<=oe.end)&&ke(oe.s,W-oe.start,fe-oe.start,oe.end-oe.start,_)});for(let oe of e.layers??[])V(oe,W,fe,z,_);let me;for(let oe of J){if(oe.at>W)break;let Le=oe.over<=0?1:oe.ease(Rn((W-oe.at)/oe.over)),Pe=me??Z;if(Le>=1){me=oe.to;continue}let xe=Pe[2],_e=oe.to[2],Ue=Math.exp(Kr(Math.log(xe),Math.log(_e),Le)),mt=Math.abs(_e-xe)<1e-6?Le:(Ue-xe)/(_e-xe),ys=Kr(Pe[0]+Pe[2]/2,oe.to[0]+oe.to[2]/2,mt),kt=Kr(Pe[1]+Pe[3]/2,oe.to[1]+oe.to[3]/2,mt),at=Ue*Z[3]/Z[2];me=[ys-Ue/2,kt-at/2,Ue,at]}let Ce=me?.map($n);return X.state(Ce&&Ce.some((oe,Le)=>Math.abs(oe-Z[Le])>.005)?Ce:void 0)}let Qe=P=>{if(!P||typeof P!="object")return!1;if(Array.isArray(P))return P.some(Qe);let B=P;return B.ants!==void 0&&B.ants!==!1||B.loop===!0&&("travel"in B||"pulse"in B)?!0:Object.values(B).some(Qe)},Ke=a!==void 0||Qe(e.series)||Qe(e.layers),pt=P=>{let B=De(Math.max(0,Math.min(z,P)));return B<0?void 0:q[B]};return{ok:!0,diags:o,duration:z,beats:q,markers:j,ambient:e.ambient??"on",loops:Ke,at:Be,beatAt:pt,startOf:P=>K.get(P)??q.find(B=>B.name===P)?.start,cues(P){let B=pt(P);if(!B)return;let W=Math.max(0,Math.min(z,P));return{beat:B.name,index:B.index,of:q.length,progress:Wt(Rn((W-B.start)/Math.max(1,B.end-B.start))),...B.say?{say:B.say,...B.say.chapter!==void 0?{chapter:B.say.chapter}:{},...B.say.color!==void 0?{color:B.say.color}:{}}:{}}}}}var kh=(t,e)=>"linear"in t?kn(t.linear,e)??0:kn(t.spring.duration,e)??Sh(t.spring);function $h(t,e,s){return s<=0||e>=s?1:"spring"in t?Rn(qr(e,{...t.spring,overshootClamping:!0})/qr(s,{...t.spring,overshootClamping:!0})):Rn(e/s)}function Sh(t){let e=t.mass??1,s=t.stiffness??100,r=t.damping??10,i=Math.sqrt(s/e),o=Math.min(1,r/(2*Math.sqrt(s*e)));return Math.ceil(Math.log(200)/(o*i)*1e3*(o>=1?1.6:1))}function Va(t){let{steps:e,vis:s}=t.steps,r=t.rendered.viewBox,i=!1,o=rr(t),n=new Set([...o.pieces.map(c=>c.id),...o.routes.map(c=>c.id),...Object.keys(o.notes)]),a=c=>n.has(c),f=Object.keys(o.notes).filter(c=>o.notes[c]===void 0),p=e.map((c,l)=>{let d=[],m=[];for(let[u,b]of Object.entries(s))(l===0?!b.includes(!0):b[l-1]&&!b[l])?m.push(u):l>0&&b[l]&&!b[l-1]&&d.push(u);let h=[],y=u=>`${u.route}:${u.kind}`;c.phases.length&&h.push({travel:c.phases.map(u=>u.length===1?y(u[0]):u.map(y)),each:1150,hold:700,loop:!0});let g=(t.raw.steps??[])[l]?.pulse?.filter(u=>t.layout.byId.has(u))??[];if(g.length&&h.push({pulse:g,loop:!0}),c.focus){let[u,b,x,w]=Ba(r,c.focus).map($n);h.push({camera:{focus:[u,b,x,w]},duration:900,easing:"ease-in-out"}),i=!0}else i&&(h.push({camera:"fit",duration:900,easing:"ease-in-out"}),i=!1);let k={name:`step-${c.n}`,duration:c.duration,say:{title:c.heading,...c.caption?{text:c.caption}:{},...c.command?{code:c.command}:{}}};return d.length&&(k.show=d),m.length&&(k.hide=m),k.focus=t.raw.dim==="all"?{lit:c.lit.filter(a),scope:"all",level:.14}:{lit:c.lit.filter(a),scope:"links",level:.12,...f.length?{always:f}:{}},h.length&&(k.children=h),{sequence:k}});return{isomotion:1,...p.length?{series:p}:{}}}var vh={anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+(\\.\\d+)?(ms|s|f)?$"}]},Mh={type:"array",items:{type:"string"}},Ph={anyOf:[{enum:Yi},{type:"object",required:["bezier"],additionalProperties:!1,properties:{bezier:{type:"array",items:{type:"number"},minItems:4,maxItems:4}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{$ref:"#/$defs/spring"}}}]},yf={from:{$ref:"#/$defs/time"},duration:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}},mn=(t,e,s={},r=!0)=>({type:"object",required:[t],additionalProperties:!1,properties:{[t]:e,...r?yf:{},...s}}),gf={$schema:"https://json-schema.org/draft/2020-12/schema",title:"isomotion/1",type:"object",required:["isomotion"],additionalProperties:!1,properties:{isomotion:{const:1},fps:{type:"number",exclusiveMinimum:0,description:'Frames a second, for lengths written "30f".'},seed:{type:"integer"},ambient:{enum:["on","off"],description:"Off: the ants and the looping tokens and pulses stand still, each at its start."},series:{$ref:"#/$defs/series"},layers:{$ref:"#/$defs/nodes"},markers:{type:"object",additionalProperties:{anyOf:[{type:"number"},{type:"string"}]}}},$defs:{time:vh,ids:Mh,ease:Ph,spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"}}},curve:{type:"object",required:["times","values"],additionalProperties:!1,properties:{times:{type:"array",items:{$ref:"#/$defs/time"},minItems:1},values:{type:"array",items:{type:"number"},minItems:1},easing:{$ref:"#/$defs/ease"},extrapolateLeft:{enum:or},extrapolateRight:{enum:or}}},say:{type:"object",additionalProperties:!1,properties:{chapter:{type:"string"},title:{type:"string"},text:{type:"string"},code:{type:"string"},color:{type:"string"},facts:{type:"array",items:{type:"array",items:{type:"string"},minItems:2,maxItems:2}}}},focus:{type:"object",required:["lit"],additionalProperties:!1,properties:{lit:{$ref:"#/$defs/ids"},scope:{enum:["all","links"]},level:{type:"number",minimum:0,maximum:1},always:{$ref:"#/$defs/ids"}}},sequence:{type:"object",additionalProperties:!1,properties:{name:{type:"string",pattern:"^[A-Za-z][\\w-]*$"},from:{$ref:"#/$defs/time"},offset:{$ref:"#/$defs/time"},trimBefore:{$ref:"#/$defs/time"},duration:{anyOf:[{$ref:"#/$defs/time"},{type:"object",required:["read"],additionalProperties:!1,properties:{read:{anyOf:[{const:!0},{type:"object",additionalProperties:!1,properties:{base:{type:"number"},perChar:{type:"number"},min:{type:"number"},max:{type:"number"}}}]}}}]},loop:{anyOf:[{type:"boolean"},{type:"integer",minimum:1}]},playbackRate:{type:"number",exclusiveMinimum:0},say:{$ref:"#/$defs/say"},show:{$ref:"#/$defs/ids"},hide:{$ref:"#/$defs/ids"},focus:{$ref:"#/$defs/focus"},highlight:{$ref:"#/$defs/ids"},levels:{type:"object",additionalProperties:{type:"number",minimum:0,maximum:1}},variants:{type:"object",additionalProperties:{type:"string"}},enter:{type:"object",required:["fade"],additionalProperties:!1,properties:{fade:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}}},ants:{anyOf:[{type:"boolean"},{$ref:"#/$defs/ids"}]},children:{$ref:"#/$defs/nodes"},layers:{$ref:"#/$defs/nodes"},series:{$ref:"#/$defs/series"}}},series:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("transition",{type:"object",required:["presentation","timing"],additionalProperties:!1,properties:{presentation:{enum:["fade","none"]},timing:{anyOf:[{type:"object",required:["linear"],additionalProperties:!1,properties:{linear:{$ref:"#/$defs/time"}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"},duration:{$ref:"#/$defs/time"}}}}}]}}},{},!1)]}},seq:mn("sequence",{$ref:"#/$defs/sequence"},{},!1),plan:{type:"object"},nodes:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("series",{$ref:"#/$defs/series"},{},!1),mn("layers",{$ref:"#/$defs/nodes"},{},!1),mn("assemble",{type:"object",properties:{style:{enum:jr},order:{enum:sr}}}),mn("disassemble",{type:"object",properties:{style:{enum:Lr},order:{enum:sr}}}),mn("travel",{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"}]},minItems:1},{each:{$ref:"#/$defs/time"},hold:{$ref:"#/$defs/time"},loop:{type:"boolean"}}),mn("pulse",{$ref:"#/$defs/ids"},{loop:{type:"boolean"}}),mn("ants",{anyOf:[{const:!0},{$ref:"#/$defs/ids"}]},{speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}),mn("draw",{$ref:"#/$defs/ids"},{by:{enum:["stroke","grow"]},stagger:{$ref:"#/$defs/time"}}),mn("type",{$ref:"#/$defs/ids"}),{type:"object",required:["move"],additionalProperties:!1,properties:{move:{type:"string"},from:{$ref:"#/$defs/time"},x:{$ref:"#/$defs/curve"},y:{$ref:"#/$defs/curve"},scale:{$ref:"#/$defs/curve"},opacity:{$ref:"#/$defs/curve"}}},{type:"object",required:["lift","by"],additionalProperties:!1,properties:{lift:{$ref:"#/$defs/ids"},by:{type:"number"},stagger:{$ref:"#/$defs/time"},to:{enum:["up","down"]},opacity:{$ref:"#/$defs/curve"},...yf}},mn("focus",{$ref:"#/$defs/focus"},{fade:{$ref:"#/$defs/time"}}),mn("highlight",{$ref:"#/$defs/ids"},{fade:{$ref:"#/$defs/time"}}),mn("camera",{anyOf:[{const:"fit"},{type:"object",required:["focus"],additionalProperties:!1,properties:{focus:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"},{type:"array",items:{type:"number"},minItems:4,maxItems:4}]},zoom:{type:"number",exclusiveMinimum:0},margin:{type:"number"}}}]})]}}}};var xf=new Set(["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","font-size","font-weight","font-family","letter-spacing","text-anchor","dominant-baseline","paint-order","display","stop-color","stop-opacity"]),Oh=new Set("cursor pointer-events transition animation transform-box transform-origin user-select".split(" "));function Ah(t,e){let s={classes:[],not:[],attrs:[],child:e},r=t,i=n=>{let a=n.exec(r);return a&&(r=r.slice(a[0].length)),a},o=i(/^[a-zA-Z][\w-]*/);for(o?s.tag=o[0]:i(/^\*/);r;){let n;if(n=i(/^\.([\w-]+)/))s.classes.push(n[1]);else if(n=i(/^:not\(\.([\w-]+)\)/))s.not.push(n[1]);else if(n=i(/^\[([\w-]+)(?:="([^"]*)")?\]/))s.attrs.push([n[1],n[2]]);else throw new Error(`resolve: a selector it doesn't know: ${t}`)}return s}function Th(t){let e=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/@keyframes[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"").replace(/@media[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"");if(/@/.test(e.replace(/"[^"]*"/g,"")))throw new Error("resolve: an at-rule it doesn't know");let s=[];for(let r of e.matchAll(/([^{}]+)\{([^{}]*)\}/g)){let i=r[2].split(";").map(o=>o.trim()).filter(Boolean).map(o=>{let n=o.indexOf(":"),a=o.slice(0,n).trim(),f=o.slice(n+1).trim();return[a,f.replace(/\s*!important$/,""),/!important$/.test(f)]});for(let o of i)if(!o[0].startsWith("--")&&!xf.has(o[0])&&!Oh.has(o[0]))throw new Error(`resolve: a property it doesn't know: ${o[0]}`);for(let o of r[1].split(",").map(n=>n.trim()).filter(Boolean)){if(o.includes(":root")||o.includes("::")||/^(html|body)\b/.test(o))continue;let a=o.replace(/\s*>\s*/g," >").split(/\s+/).map(p=>Ah(p.replace(/^>/,""),p.startsWith(">"))),f=a.reduce((p,c)=>p+10*(c.classes.length+c.not.length+c.attrs.length)+(c.tag?1:0),0);s.push({parts:a,spec:f,order:s.length,decls:i})}}return s}function Eh(t){let e={name:"#root",attrs:[],children:[]},s=e;for(let r of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g)){if(r[4]!==void 0){s.children.push(r[4]);continue}if(r[1]===void 0){s=s.parent;continue}let i={name:r[1],attrs:[...r[2].matchAll(/([\w:-]+)="([^"]*)"/g)].map(o=>[o[1],o[2]]),children:[],parent:s};s.children.push(i),r[3]||(s=i)}return e.children[0]}var kf=t=>typeof t=="string"?t:`<${t.name}${t.attrs.map(([e,s])=>` ${e}="${s}"`).join("")}${t.children.length||t.name==="g"?`>${t.children.map(kf).join("")}</${t.name}>`:"/>"}`,Xi=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1],Gr=(t,e,s)=>{let r=t.attrs.find(i=>i[0]===e);r?r[1]=s:t.attrs.push([e,s])},Nh=t=>(Xi(t,"class")??"").split(/\s+/).filter(Boolean);function Rh(t,e){if(e.tag&&e.tag!==t.name)return!1;let s=Nh(t);return e.classes.every(r=>s.includes(r))&&!e.not.some(r=>s.includes(r))&&e.attrs.every(([r,i])=>{let o=Xi(t,r);return o!==void 0&&(i===void 0||o===i)})}function _c(t,e,s=e.length-1){if(!Rh(t,e[s]))return!1;if(s===0)return!0;let r=t.parent;if(e[s].child)return!!r&&r.name!=="#root"&&_c(r,e,s-1);for(;r&&r.name!=="#root";r=r.parent)if(_c(r,e,s-1))return!0;return!1}var Bs=t=>t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Ih(t,e,s,r){let i=(1-Math.abs(2*s-1))*e,o=(t%360+360)%360/60,n=i*(1-Math.abs(o%2-1)),a=s-i/2,[f,p,c]=o<1?[i,n,0]:o<2?[n,i,0]:o<3?[0,i,n]:o<4?[0,n,i]:o<5?[n,0,i]:[i,0,n];return[(f+a)*255,(p+a)*255,(c+a)*255,r]}function $f(t,e){let s=[],r=0,i="";for(let o of t)o==="("&&r++,o===")"&&r--,o===e&&r===0?(s.push(i.trim()),i=""):i+=o;return[...s,i.trim()].filter(Boolean)}var bf={transparent:[0,0,0,0],black:[0,0,0,1],white:[255,255,255,1]};function Ka(t){let e=t.trim();if(Object.hasOwn(bf,e))return bf[e];let s=/^#([0-9a-f]{3,8})$/i.exec(e);if(s){let r=s[1].length<6?[...s[1]].map(i=>i+i).join(""):s[1];return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),r.length===8?parseInt(r.slice(6),16)/255:1]}if(s=/^hsla?\((.*)\)$/.exec(e),s){let[r,i]=s[1].split("/").map(p=>p.trim()),[o,n,a,f]=r.split(/[\s,]+/);return Ih(parseFloat(o),Bs(n),Bs(a),i!==void 0?Bs(i):f!==void 0?Bs(f):1)}if(s=/^rgba?\((.*)\)$/.exec(e),s){let[r,i,o,n]=s[1].split(/[\s,/]+/).filter(Boolean);return[Bs(r),Bs(i),Bs(o),n===void 0?1:Bs(n)]}if(s=/^color-mix\(in srgb\s*,(.*)\)$/.exec(e),s){let[r,i]=$f(s[1],",").map(c=>{let l=/^(.*?)\s+([\d.]+)%$/.exec(c);return l?{c:Ka(l[1]),p:Number(l[2])/100}:{c:Ka(c),p:void 0}});if(!r?.c||!i?.c)return;let o=r.p??(i.p===void 0?.5:1-i.p),n=i.p??1-o,a=o+n,f=(r.c[3]*o+i.c[3]*n)/a,p=c=>f===0?0:(r.c[c]*r.c[3]*o+i.c[c]*i.c[3]*n)/a/f;return[p(0),p(1),p(2),f*Math.min(1,a)]}}var wf=t=>"#"+[t[0],t[1],t[2]].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join(""),zh=t=>String(Math.round(t*1e4)/1e4);function Fc(t,e,s=0){if(s>20)throw new Error(`resolve: a custom property in a loop: ${t}`);let r=t.indexOf("var(");if(r<0)return t;let i=0,o=r+3;do t[o]==="("&&i++,t[o]===")"&&i--,o++;while(i>0&&o<t.length);let[n,...a]=$f(t.slice(r+4,o-1),","),f=e.get(n)??(a.length?a.join(","):void 0);if(f===void 0)throw new Error(`resolve: no value for ${n}`);return Fc(t.slice(0,r)+f+t.slice(o),e,s+1)}var Ch=t=>new Map(t.split(";").filter(Boolean).map(e=>{let s=e.indexOf(":");return[e.slice(0,s).trim(),e.slice(s+1).trim()]})),Qi={sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"};function Zr(t,e){let s=Ri(e.theme),r=e.fonts??Qi,i=Th(`.mono{font-family:${r.mono.replace(/"/g,"")}}
|
|
150
150
|
${s.rest}
|
|
151
|
-
${e.css}`),o=
|
|
151
|
+
${e.css}`),o=Eh(t);Gr(o,"font-family",r.sans.replace(/"/g,""));let n=(a,f)=>{let p=f,c=new Map,l=(h,y,g)=>{let k=c.get(h);(!k||g[0]>k.rank[0]||g[0]===k.rank[0]&&(g[1]>k.rank[1]||g[1]===k.rank[1]&&g[2]>=k.rank[2]))&&c.set(h,{v:y,rank:g})};for(let h of i)if(_c(a,h.parts))for(let[y,g,k]of h.decls)l(y,g,[k?1:0,h.spec,h.order]);let d=Xi(a,"style");if(d){for(let h of d.split(";").map(y=>y.trim()).filter(Boolean)){let y=h.indexOf(":");l(h.slice(0,y).trim(),h.slice(y+1).trim(),[0,1e6,0])}a.attrs=a.attrs.filter(h=>h[0]!=="style")}for(let[h,y]of c)h.startsWith("--")&&(p===f&&(p=new Map(f)),p.set(h,y.v));let m={};for(let[h,y]of c){if(!xf.has(h))continue;let g=Fc(y.v,p).trim();if(h==="fill"||h==="stroke"||h==="stop-color"){if(g==="none"||g==="currentColor"||g==="inherit"||g.startsWith("url(")){Gr(a,h,g);continue}let k=Ka(g);if(!k)throw new Error(`resolve: a colour it doesn't know: ${g}`);Gr(a,h,wf(k)),k[3]!==1&&(m[h==="stop-color"?"stop":h]=k[3])}else Gr(a,h,h==="letter-spacing"||h==="font-size"||h==="stroke-width"?g:g.replace(/"/g,""))}for(let[h,y]of Object.entries(m))Gr(a,`${h}-opacity`,zh(y*Number(Xi(a,`${h}-opacity`)??1)));Xi(a,"opacity")==="0"&&(Gr(a,"display","none"),a.attrs=a.attrs.filter(h=>h[0]!=="opacity"));for(let h of a.attrs)if(/var\(|hsl\(|color-mix/.test(h[1])){let y=Fc(h[1],p),g=Ka(y);h[1]=g?wf(g):y}for(let h of a.children)typeof h!="string"&&n(h,p)};return n(o,Ch(e.mode==="dark"?`${s.light};${s.dark}`:s.light)),kf(o)}var Ga=t=>`${Math.round(parseInt(t.slice(1,3),16)/255*1e4)/100}%`,Dc=(t,e,s)=>{let[r,i]=[t,e].map(n=>parseInt(n.slice(1,3),16)),o=Math.round(r+(i-r)*s).toString(16).padStart(2,"0");return`#${o}${o}${o}`};function Bc(t,e,s){let r=new Set([...t.matchAll(/\sclass="([^"]*)"/g)].flatMap(i=>i[1].split(/\s+/)).filter(i=>i.startsWith("k-")).map(i=>i.slice(2)));return{roles:Object.keys(e.roles).filter(i=>r.has(i)),kinds:[...new Set(s)].filter(i=>i in e.kinds)}}function qc(t,e){let s=tn[e.mode].steps,r=(p,c)=>e.roles[p]??s[c],i={};for(let[p,c]of Object.entries(t.light))i[p]=/%$/.test(c)?c:e.ink;let o=r("slab",0),n=r("pad",0);Object.assign(i,{bg:e.paper,surface:e.paper,on:e.paper,ink:e.ink,muted:Dc(e.paper,e.ink,.72),line:Dc(e.paper,e.ink,.3),"code-bg":Dc(e.paper,e.ink,.06),"slab-top":o.top,"slab-l":o.left,"slab-r":o.right,"pad-top":n.top});let a=Object.fromEntries(Object.entries(t.roles).map(([p])=>[p,{h:0,s:0}])),f=Object.fromEntries(Object.entries(t.kinds).map(([p,c])=>[p,{...c,color:e.ink}]));return _s({...t,light:i,dark:i,roles:a,kinds:f})}function Vc(t){let e="";for(let[s,r]of Object.entries(t.roles))e+=`.k-${s}{--s:0%;--l-top:${Ga(r.top)};--l-left:${Ga(r.left)};--l-right:${Ga(r.right)};--l-edge:${Ga(r.edge)}}
|
|
152
|
+
`;for(let[s,r]of Object.entries(t.kinds))e+=`.flow.f-${s}{stroke-width:${r.width}${r.dash.length?`;stroke-dasharray:${r.dash.join(" ")}`:";stroke-dasharray:none"}}
|
|
153
|
+
`;return e}var jh={hatch:{size:6,draw:(t,e)=>`<path d="M0,6L6,0M-1.5,1.5L1.5,-1.5M4.5,7.5L7.5,4.5" stroke="${t}" stroke-width="${e}" fill="none"/>`},"hatch-wide":{size:12,draw:(t,e)=>`<path d="M0,0L12,12M-3,9L3,15M9,-3L15,3" stroke="${t}" stroke-width="${e}" fill="none"/>`},dots:{size:8,draw:(t,e)=>`<circle cx="2" cy="2" r="${e+.2}" fill="${t}"/><circle cx="6" cy="6" r="${e+.2}" fill="${t}"/>`}},Lh=t=>Math.round(t*100)/100,_h=(t,e)=>Ci(t,e.ink)>=Ci(t,e.paper)?e.ink:e.paper;function Za(t,e,s){let r=new Map,i=(f,p)=>{let c=`${s}-mono-${f}-${p.slice(1)}`,l=jh[f],d=e.mode==="dark"?1.2:.9;return r.has(c)||r.set(c,`<pattern id="${c}" width="${l.size}" height="${l.size}" patternUnits="userSpaceOnUse">${l.draw(p,Lh(d))}</pattern>`),c},o=[],n="",a="";for(let f of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|[^<]+/g)){if(n+=f[0],f[0].startsWith("</")){o.pop();continue}if(f[1]===void 0)continue;let p=(/\sclass="([^"]*)"/.exec(f[2])?.[1]??"").split(/\s+/);o.length===1&&(a=p.find(y=>y.startsWith("g-"))??"");let c=p.find(y=>y.startsWith("k-"))?.slice(2)??o.at(-1);if(f[3]||o.push(p.includes("ghost")?"":c),!f[3]||f[1]!=="polygon"&&f[1]!=="path"||!c||!p.some(y=>y==="top"||y==="lft"||y==="rgt")||a==="g-base"&&!p.includes("rgt"))continue;let l=Object.hasOwn(e.roles,c)?e.roles[c].pattern:"none",d=/\sfill="(#[0-9a-f]{6})"/.exec(f[2])?.[1],m=/\s(points|d)="[^"]*"/.exec(f[2])?.[0];if(l==="none"||!d||!m)continue;let h=/\sfill-opacity="[^"]*"/.exec(f[2])?.[0]??"";n+=`<${f[1]}${m} class="mono-pattern" fill="url(#${i(l,_h(d,e))})" stroke="none"${h}/>`}return n=n.replace(/#([0-9a-f]{6})\b/g,(f,p)=>p.slice(0,2)===p.slice(2,4)&&p.slice(2,4)===p.slice(4,6)?f:Fh(f)),r.size&&(n=n.replace(/<defs\/>|<defs>/,f=>f==="<defs/>"?`<defs>${[...r.values()].join("")}</defs>`:f+[...r.values()].join(""))),n}function Fh(t){let e=zi(t),s=e>8?((e+16)/116)**3:e/(24389/27),r=s<=.0031308?s*12.92:1.055*s**(1/2.4)-.055,i=Math.max(0,Math.min(255,Math.round(r*255))).toString(16).padStart(2,"0");return`#${i}${i}${i}`}function Ua(t,e,s,r,i){let o=fa(e,s,Bc(t,e,r),i);return{look:o,theme:qc(e,o),css:Vc(o)}}function Kc(t){return Math.max(5600,Math.min(12500,2600+t.length*40))}function Ha(t,e,s,r,i,o){let n=[],a=(A,R,M,T="error")=>{let S=i.locate(A);n.push({severity:T,message:R,line:S.line,col:S.col,path:A,hint:M})},f=t.steps??[],p=new Set(Object.keys(o.kinds)),c=new Map(r.map(A=>[A.id,A])),l=()=>[...s.byId.keys(),...c.keys()],d=new Map;f.forEach((A,R)=>{A.id&&(d.has(A.id)&&a(`${e}/steps/${R}/id`,`duplicate step id "${A.id}"`),d.set(A.id,R+1))});let m=f.length,h=(A,R)=>{if(typeof A=="number"){if(A<1||A>m){a(R,`there is no step ${A}; this scene has ${m} step(s)`);return}return A}let M=d.get(A);return M===void 0&&a(R,`unknown step "${A}"`+In(A,d.keys())),M},y=A=>Hn(o,o.kinds[A]?.color??"control"),g=[],k=A=>{g.includes(A)||g.push(A)};for(let A of r)k(A.kind);let u={},b=(A,R,M,T)=>{if(R===void 0&&M===void 0)return;let S=R!==void 0?h(R,T+"/appears"):1,N=M!==void 0?h(M,T+"/disappears"):m+1;u[A]=Array.from({length:m},(z,K)=>K+1>=(S??1)&&K+1<(N??m+1))};for(let A of s.items)b(A.id,A.appears,A.disappears,A.path);for(let A of r)b(A.id,A.raw.appears,A.raw.disappears,A.path);let x=[],w=[],$=[],v=[],O=()=>{for(let A of r){if(A.raw.appears!==void 0||A.raw.disappears!==void 0)continue;let R=[A.from,A.to].map(M=>M&&(u[M.id]??C(M)));R.some(Boolean)&&(u[A.id]=Array.from({length:m},(M,T)=>R.every(S=>!S||S[T])))}},C=A=>{for(let R=A.parent;R;R=R.parent)if(u[R.id])return u[R.id]};return f.forEach((A,R)=>{let M=R+1,T=`${e}/steps/${R}`,S=A.kind??"control";p.has(S)||a(T+"/kind",`unknown flow kind "${S}"`+In(S,p)),k(S);let N=new Set,z=[];(A.animate??[]).forEach((L,U)=>{let H=Array.isArray(L)?L:[L],ee=[];H.forEach((j,q)=>{let G=Array.isArray(L)?`${T}/animate/${U}/${q}`:`${T}/animate/${U}`,Q,le;if(typeof j=="string"){let ie=/^([^:\s]+)\s*(?::\s*(\S+))?$/.exec(j.trim());Q=ie?ie[1]:j,le=ie?.[2]}else{let ie=Object.entries(j)[0];Q=ie[0],le=ie[1]}let pe=c.get(Q);if(!pe){a(G,`unknown route "${Q}"`+In(Q,c.keys()));return}if(le&&!p.has(le)){a(G,`unknown flow kind "${le}"`+In(le,p));return}let Y=le??pe.kind;k(Y),ee.push({route:Q,kind:Y,color:y(Y)}),N.add(Q),pe.from&&N.add(pe.from.id),pe.to&&N.add(pe.to.id)}),ee.length&&z.push(ee)});let K=[];(A.pulse??[]).forEach((L,U)=>{let H=s.byId.get(L);if(!H){a(`${T}/pulse/${U}`,`unknown node "${L}"`+In(L,s.byId.keys()));return}let ee,j,q,G,Q=H.node?er(s.catalog,H.node.asset):void 0;if(Q?.pulse)[ee,j,q,G]=Q.pulse(H.box);else{let Y=H.box;ee=(Y.x0+Y.x1)/2,j=(Y.y0+Y.y1)/2,q=Y.z1,G=Math.max(22,Math.min(60,(Y.x1-Y.x0+Y.y1-Y.y0)*8.5))}let[le,pe]=Ne(ee,j,q);K.push([le,pe,G*1.7,G*.98]),N.add(L)}),(A.highlight??[]).forEach((L,U)=>{!s.byId.has(L)&&!c.has(L)&&a(`${T}/highlight/${U}`,`unknown id "${L}"`+In(L,l())),N.add(L)});for(let[L,U]of[["show",!0],["hide",!1]])(A[L]??[]).forEach((H,ee)=>{if(!s.byId.has(H)&&!c.has(H)){a(`${T}/${L}/${ee}`,`unknown id "${H}"`+In(H,l()));return}let j=u[H]??(u[H]=Array(m).fill(!U));for(let q=R;q<m;q++)j[q]=U});if((A.say??[]).forEach((L,U)=>{let H,ee;if(Array.isArray(L.at))[H,ee]=Ne(L.at[0],L.at[1],L.at[2]??.36);else{let q=s.byId.get(L.at);if(!q){a(`${T}/say/${U}/at`,`unknown node "${L.at}"`+In(L.at,s.byId.keys()));return}let G=q.box;[H,ee]=Ne((G.x0+G.x1)/2,(G.y0+G.y1)/2,G.z1+.75)}let j=L.kind??S;p.has(j)||a(`${T}/say/${U}/kind`,`unknown flow kind "${j}"`+In(j,p)),w.push({step:M,x:H+(L.dx??0),y:ee+(L.dy??(Array.isArray(L.at)?0:-46)),ax:H,ay:ee,text:L.text,kind:j,anchor:L.anchor??"middle"})}),(A.mark??[]).forEach((L,U)=>{if(L.at){$.push({step:M,p:[L.at[0],L.at[1],L.at[2]??.36]});return}let H=L.on?c.get(L.on):void 0;if(!H){a(`${T}/mark/${U}`,L.on?`unknown route "${L.on}"`+In(L.on,c.keys()):'a mark needs "on: ROUTE" or "at: [x, y]"');return}let ee=H.points[H.points.length-1];$.push({step:M,p:[ee[0],ee[1],ee[2]+.6],on:H.id}),N.add(H.id)}),t.badges&&A.badge!==!1){let L=Array.isArray(A.badge)?[A.badge[0],A.badge[1],A.badge[2]??.36]:void 0,U=typeof A.badge=="string"?A.badge:z[0]?.[0]?.route,H=U?c.get(U):void 0;if(!L)if(H)L=Gc(H.points);else if(U&&s.byId.get(U)){let ee=s.byId.get(U).box;L=[(ee.x0+ee.x1)/2,(ee.y0+ee.y1)/2,ee.z1+.3]}else typeof A.badge=="string"&&a(`${T}/badge`,`unknown id "${A.badge}"`+In(A.badge,l()));L&&v.push({step:M,num:A.number??M,kind:S,p:L})}for(let L of[...N])for(let U=s.byId.get(L)?.parent;U;U=U.parent)N.add(U.id);for(let L of s.items)L.region?.kind==="tunnel"&&(L.region.around??[]).some(U=>N.has(U))&&N.add(L.id);let J;if(A.focus?.length){let L=1/0,U=1/0,H=-1/0,ee=-1/0;A.focus.forEach((j,q)=>{let G=s.byId.get(j);if(!G){a(`${T}/focus/${q}`,`unknown node or region "${j}"`+In(j,s.byId.keys()));return}let Q=G.box;for(let[le,pe,Y]of[[Q.x0,Q.y0,Q.z1],[Q.x1,Q.y0,Q.z0],[Q.x0,Q.y1,Q.z0],[Q.x1,Q.y1,Q.z0],[Q.x1,Q.y0,Q.z1],[Q.x0,Q.y1,Q.z1]]){let[ie,Ae]=Ne(le,pe,Y);L=Math.min(L,ie),U=Math.min(U,Ae),H=Math.max(H,ie),ee=Math.max(ee,Ae)}N.add(j)}),L<1/0&&(J=[Math.round(L-60),Math.round(U-70),Math.round(H+60),Math.round(ee+40)])}let Z=A.caption??"";x.push({n:M,num:A.number??M,kind:S,color:y(S),heading:A.heading,caption:Z,command:A.command??"",phases:z,pulses:K,lit:[...N],duration:A.duration===void 0||A.duration==="auto"?Kc(Z):A.duration,...J?{focus:J}:{}})}),O(),{steps:x,says:w,marks:$,badges:v,vis:u,diags:n,kindsUsed:g}}function Gc(t){let e=t.slice(1).map((r,i)=>Math.hypot(r[0]-t[i][0],r[1]-t[i][1],r[2]-t[i][2])),s=e.reduce((r,i)=>r+i,0)/2;for(let r=0;r<e.length;r++){if(s<=e[r]&&e[r]>0){let i=s/e[r],o=t[r],n=t[r+1];return[o[0]+(n[0]-o[0])*i,o[1]+(n[1]-o[1])*i,o[2]+(n[2]-o[2])*i]}s-=e[r]}return t[0]}function In(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var Zc=`
|
|
152
154
|
*{box-sizing:border-box}
|
|
153
155
|
html,body{margin:0}
|
|
154
156
|
body{background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-font-smoothing:antialiased;overflow-x:hidden}
|
|
@@ -172,7 +174,7 @@ h2{font-size:20px;margin:44px 0 4px;letter-spacing:-.005em;text-wrap:balance}
|
|
|
172
174
|
.legend i{display:inline-block;width:26px;height:0;border-top:3px solid}
|
|
173
175
|
.legend i.box{height:10px;border-width:1.5px;border-style:solid;border-radius:2px}
|
|
174
176
|
footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
|
|
175
|
-
`,
|
|
177
|
+
`,ar=t=>Dh+ua(t)+Bh+ha(),Dh=`
|
|
176
178
|
/* blocks: hue per role, lightness per face and theme */
|
|
177
179
|
.blk .top{fill:hsl(var(--h) var(--s) var(--l-top))}
|
|
178
180
|
.blk .lft{fill:hsl(var(--h) var(--s) var(--l-left))}
|
|
@@ -213,14 +215,14 @@ footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
|
|
|
213
215
|
.floor.t-control{fill:var(--muted)}
|
|
214
216
|
.slabname{font-size:15px;font-weight:800;fill:var(--muted);letter-spacing:.12em;opacity:.8}
|
|
215
217
|
.slabname.sm{font-size:10.5px;letter-spacing:.1em;opacity:1}
|
|
216
|
-
`,
|
|
218
|
+
`,Bh=`.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
|
|
217
219
|
.tunnel .top{fill:hsl(205 85% 65% / .22)}
|
|
218
220
|
.tunnel .rib{fill:none;stroke:hsl(205 75% 45% / .5);stroke-width:1}
|
|
219
221
|
.tunname{font-size:12px;font-weight:800;letter-spacing:.14em;fill:var(--tunnel-text);paint-order:stroke;stroke:var(--surface);stroke-width:3px;stroke-linejoin:round}
|
|
220
222
|
|
|
221
223
|
/* flows */
|
|
222
224
|
.flow{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
|
|
223
|
-
`,
|
|
225
|
+
`,Ur=t=>Zc+ar(t),eo=`
|
|
224
226
|
/* step marks */
|
|
225
227
|
.xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}
|
|
226
228
|
.xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}
|
|
@@ -243,7 +245,7 @@ svg.all .badge{opacity:1}
|
|
|
243
245
|
svg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}
|
|
244
246
|
svg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}
|
|
245
247
|
.pre{opacity:0!important;pointer-events:none}
|
|
246
|
-
`,
|
|
248
|
+
`,Uc=`
|
|
247
249
|
/* player */
|
|
248
250
|
.player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
|
|
249
251
|
.ctrls{display:flex;gap:6px;flex:none}
|
|
@@ -278,57 +280,57 @@ details.steps li code{font-size:11.5px}
|
|
|
278
280
|
.still .ctrls,.still .tools{display:none}
|
|
279
281
|
.tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}
|
|
280
282
|
.pbtn.small{font-size:12px;padding:4px 11px;font-weight:600;color:var(--muted)}
|
|
281
|
-
.pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,
|
|
283
|
+
.pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,to=`
|
|
282
284
|
.grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}
|
|
283
285
|
svg.show-grid .grid{display:inline}
|
|
284
286
|
svg.pre-assemble > g:not(.g-anim){opacity:0}
|
|
285
|
-
`,za=Yi+Mc+Hi;var Pc=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function Ca(t,e,s,r=Pc(t),i,o={},n=[]){let a=Mr(vr(e),t.roles,t.kinds),m=[],p=new Map;return t.scenes.forEach((c,l)=>{let f=`/scenes/${l}`;if(p.has(c.id)){let h=r.locate(f+"/id");n.push({severity:"error",message:`duplicate scene id "${c.id}"`,line:h.line,col:h.col,path:f+"/id"})}p.set(c.id,l);let d={...t.grid,...c.grid,...o.snap?{snap:o.snap}:{}},u=Or(c,f,r,a,s,t.roles,d.snap);n.push(...u.diags);let y=ma(c,f,u,r,new Set(Object.keys(a.kinds)),d.snap);n.push(...y.diags);let g=Ia(c,f,u,y.routes,r,a);n.push(...g.diags),n.push(...Ju(c,f,s,r));let x=zr({scene:c,layout:u,routes:y.routes,steps:g,theme:a,id:c.id,gridStep:d.step??d.snap??1});for(let h of x.warnings){let b=r.locate(h.path);n.push({severity:"warning",message:h.message,line:b.line,col:b.col,path:h.path})}m.push({id:c.id,raw:c,layout:u,routes:y.routes,steps:g,rendered:x,grid:d,assemble:c.assemble??t.assemble??!1})}),n.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!n.some(c=>c.severity==="error"),diags:n,doc:t,theme:a,catalog:s,scenes:m,parsed:r,source:i}}function Ju(t,e,s,r){let i=[],o=(a,m)=>{let p=r.locate(a);i.push({severity:"warning",message:m,line:p.line,col:p.col,path:a})},n=(a,m)=>{a.nodes?.forEach((p,c)=>{let l=`${m}/nodes/${c}`;(p.deco??Mn(s,p.asset).deco??[]).forEach((f,d)=>{typeof f=="object"&&f.icon&&!Ei(f.icon)&&o(p.deco?`${l}/deco/${d}/icon`:l,`node "${p.id}": no icon "${f.icon}" is registered here, so it is drawn as a placeholder`)}),p.face!==void 0&&!Qs(p.face)&&o(`${l}/face`,`node "${p.id}": no screen face "${p.face}" is registered here, so it is drawn as a placeholder`)}),a.regions?.forEach((p,c)=>n(p,`${m}/regions/${c}`))};return n(t,e),i}function ed(t,e){let s=t/(Ct*lt),r=2*e/lt;return[(s+r)/2,(r-s)/2]}function td(t,e){let s=t.layout.byId.get(e);if(!s)return;let r=s.parent?[s.parent.box.x0,s.parent.box.y0]:[0,0];return[s.box.x0-r[0],s.box.y0-r[1]]}function nd(t){let e=[];for(let s of[t.x0,t.x1])for(let r of[t.y0,t.y1])for(let i of[t.z0,t.z1])e.push(Re(s,r,i));return Xu(e)}function sd(t){return[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([e,s])=>Re(e,s,t.z0))}function Xu(t){let e=[...new Map(t.map(o=>[`${o[0].toFixed(3)},${o[1].toFixed(3)}`,o])).values()].sort((o,n)=>o[0]-n[0]||o[1]-n[1]);if(e.length<3)return e;let s=(o,n,a)=>(n[0]-o[0])*(a[1]-o[1])-(n[1]-o[1])*(a[0]-o[0]),r=[],i=[];for(let o of e){for(;r.length>=2&&s(r[r.length-2],r[r.length-1],o)<=1e-9;)r.pop();r.push(o)}for(let o of[...e].reverse()){for(;i.length>=2&&s(i[i.length-2],i[i.length-1],o)<=1e-9;)i.pop();i.push(o)}return[...r.slice(0,-1),...i.slice(0,-1)]}var rd=(t,e)=>e?.padding??Pt(t,e?.kind)?.pad??0;function id(t,e,s,r,i){let o=c=>Math.round(c/s)*s,n=o(t[0]+e[0]),a=o(t[1]+e[1]),m={left:!1,right:!1,top:!1,bottom:!1};if(i){let c=Math.ceil(i.pad/s-1e-9)*s,l=Math.floor((i.w-i.pad-r[0])/s+1e-9)*s,f=Math.floor((i.d-i.pad-r[1])/s+1e-9)*s;n<c&&(n=c,m.left=!0),l>=c&&n>l&&(n=l,m.right=!0),a<c&&(a=c,m.top=!0),f>=c&&a>f&&(a=f,m.bottom=!0)}let p=c=>Math.round(c*1e3)/1e3;return{at:[p(n),p(a)],delta:[p(n-t[0]),p(a-t[1])],clamped:m}}function ja(t,e){return e.some(r=>t.x0<r.x1-1e-6&&t.x1>r.x0+1e-6&&t.y0<r.y1-1e-6&&t.y1>r.y0+1e-6)}var Ac=Object.freeze({W:178,H:58,GX:44,GY:44,PAD:22,TITLE:30,CH:96,cardRx:9,panelRx:14,bend:70,overlap:400,crossPanel:300,border:120,nearEdge:200,margin:16}),Tc={name:{key:"sans600_12",size:13},sub:{key:"sans400_13",size:10},title:{key:"sans700_13",size:12,spacing:.02},titleSub:{key:"sans400_13",size:10.5},label:{key:"sans600_12",size:10.5}},od=(t,e)=>Sn(t,Tc[e]);function La(t){let e=[],s=new Map,r=(m,p)=>{if(typeof p!="string"||!p){e.push(`${m} has no id`);return}let c=s.get(p);c?e.push(`duplicate id "${p}": a ${c} and a ${m} (cards and panels share one set of ids)`):s.set(p,m)};for(let m of t.cards)r("card",m.id),(!Array.isArray(m.cell)||m.cell.length!==2||!m.cell.every(p=>Number.isInteger(p)&&p>=0))&&e.push(`card "${m.id}": cell must be [column, row], whole numbers from 0`);for(let m of t.panels??[]){r("panel",m.id);let p=m.cells;(!Array.isArray(p)||p.length!==4||!p.every(c=>Number.isInteger(c)&&c>=0)||p[2]<p[0]||p[3]<p[1])&&e.push(`panel "${m.id}": cells must be [c0, r0, c1, r1] with c0 \u2264 c1 and r0 \u2264 r1`)}let i=new Map;for(let m of t.cards){let p=String(m.cell);i.has(p)?e.push(`cards "${i.get(p)}" and "${m.id}" are both at cell [${p}]`):i.set(p,m.id)}let o=(t.panels??[]).filter(m=>Array.isArray(m.cells)&&m.cells.length===4);for(let m=0;m<o.length;m++)for(let p=m+1;p<o.length;p++){let c=o[m].cells,l=o[p].cells;c[0]<=l[2]&&l[0]<=c[2]&&c[1]<=l[3]&&l[1]<=c[3]&&!Oc(c,l)&&!Oc(l,c)&&e.push(`panels "${o[m].id}" and "${o[p].id}" overlap without one holding the other`)}let n=new Set([...t.cards.map(m=>m.id),...o.map(m=>m.id)]),a=new Set(o.map(m=>m.id));return(t.links??[]).forEach((m,p)=>{let c=`link ${m.id?`"${m.id}"`:p}`;for(let l of["a","b"])n.has(m[l])||e.push(`${c}: ${l} "${m[l]}" is no card or panel`);for(let l of["aOn","bOn"])m[l]!==void 0&&!a.has(m[l])&&e.push(`${c}: ${l} "${m[l]}" is no panel`);m.id!==void 0&&r("link",m.id)}),e}var Oc=(t,e)=>t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3];function Wi(t,e){let{W:s,H:r,GX:i,GY:o,PAD:n,TITLE:a,CH:m}=e,p=t.panels??[],c=z=>(z[2]-z[0]+1)*(z[3]-z[1]+1),l=(z,D)=>{let V=p[z].cells,W=p[D].cells;return Oc(W,V)?c(V)>c(W)||z<D:!1},f=p.map((z,D)=>{let V=-1;return p.forEach((W,de)=>{de!==D&&l(de,D)&&(V<0||l(V,de))&&(V=de)}),V}),d=z=>f[z]<0?0:1+d(f[z]),u=(z,D)=>{let V=-1;p.forEach((de,ce)=>{let H=de.cells;z>=H[0]&&z<=H[2]&&D>=H[1]&&D<=H[3]&&(V<0||l(V,ce))&&(V=ce)});let W=[];for(let de=V;de>=0;de=f[de])W.unshift(de);return W},y=Math.max(1,...t.cards.map(z=>z.cell[0]+1),...p.map(z=>z.cells[2]+1)),g=Math.max(1,...t.cards.map(z=>z.cell[1]+1),...p.map(z=>z.cells[3]+1)),x=[];for(let z=0;z<y;z++){x.push([]);for(let D=0;D<g;D++)x[z].push(u(z,D))}let h=(z,D,V)=>{let W=z.filter(ce=>!D.includes(ce)),de=D.filter(ce=>!z.includes(ce));return!W.length&&!de.length?0:W.length*(n+(V?a:0))+de.length*n+m},b=new Array(y+1).fill(0),w=new Array(g+1).fill(0);for(let z=0;z<g;z++)for(let D=1;D<y;D++){let V=h(x[D-1][z],x[D][z],!1);V&&(b[D]=Math.max(b[D],V-i))}for(let z=0;z<y;z++)for(let D=1;D<g;D++){let V=h(x[z][D-1],x[z][D],!0);V&&(w[D]=Math.max(w[D],V-o))}let k=z=>{let D=z*(s+i);for(let V=1;V<=z;V++)D+=b[V];return D},$=z=>{let D=z*(r+o);for(let V=1;V<=z;V++)D+=w[V];return D},v=(z,D,V,W)=>V===D?z(D):z(D)+(W-D)*(z(V)-z(D))/(V-D),T=p.map(()=>new Set),R=(z,D)=>{for(let V=z;V>=0;V=f[V])T[V].add(D)};p.forEach((z,D)=>{R(D,z.cells[1]),R(D,z.cells[3])});for(let z of t.cards){let D=x[z.cell[0]][z.cell[1]];D.length&&R(D[D.length-1],z.cell[1])}let O=p.map(()=>new Map),I=(z,D)=>z.slice(z.indexOf(D)+1);for(let z of p.map((D,V)=>V).sort((D,V)=>d(D)-d(V)||D-V)){let D=p[z].cells,V=[...T[z]].sort((de,ce)=>de-ce),W=f[z]>=0?O[f[z]].get(V[0]):$(V[0]);O[z].set(V[0],W);for(let de=1;de<V.length;de++){let ce=0;for(let H=D[0];H<=D[2];H++)ce=Math.max(ce,h(I(x[H][V[de-1]],z),I(x[H][V[de]],z),!0));W+=r+Math.max(o,ce),O[z].set(V[de],W)}}let M=p.map(()=>new Set),A=(z,D)=>{for(let V=z;V>=0;V=f[V])M[V].add(D)};p.forEach((z,D)=>{A(D,z.cells[0]),A(D,z.cells[2])});for(let z of t.cards){let D=x[z.cell[0]][z.cell[1]];D.length&&A(D[D.length-1],z.cell[0])}let P=p.map(()=>new Map);for(let z of p.map((D,V)=>V).sort((D,V)=>d(D)-d(V)||D-V)){let D=p[z].cells,V=[...M[z]].sort((de,ce)=>de-ce);if(f[z]<0&&!f.includes(z)&&V.length===D[2]-D[0]+1){for(let de of V)P[z].set(de,v(k,D[0],D[2],de));continue}let W=f[z]>=0?P[f[z]].get(V[0]):k(V[0]);P[z].set(V[0],W);for(let de=1;de<V.length;de++){let ce=0;for(let H=D[1];H<=D[3];H++)ce=Math.max(ce,h(I(x[V[de-1]][H],z),I(x[V[de]][H],z),!1));W+=s+Math.max(i,ce),P[z].set(V[de],W)}}let j=(z,D)=>{let V=x[z][D],W=V.length?V[V.length-1]:-1;return W>=0?[P[W].get(z),O[W].get(D)]:[k(z),$(D)]},F=p.map((z,D)=>D).sort((z,D)=>d(D)-d(z)||z-D),Y=new Array(p.length);for(let z of F){let D=p[z].cells,V=[],W=[];for(let H of t.cards){let ne=x[H.cell[0]][H.cell[1]];ne[ne.length-1]===z&&(V.push(P[z].get(H.cell[0])),W.push(O[z].get(H.cell[1])))}let de=H=>H.cell[0]>=D[0]&&H.cell[0]<=D[2]&&H.cell[1]>=D[1]&&H.cell[1]<=D[3];for(let H of[D[1],D[3]])t.cards.some(ne=>ne.cell[1]===H&&de(ne))||W.push(O[z].get(H));for(let H of[D[0],D[2]])t.cards.some(ne=>ne.cell[0]===H&&de(ne))||V.push(P[z].get(H));let ce={l:V.length?Math.min(...V):1/0,t:W.length?Math.min(...W):1/0,r:V.length?Math.max(...V)+s:-1/0,b:W.length?Math.max(...W)+r:-1/0};p.forEach((H,ne)=>{if(f[ne]!==z)return;let Ee=Y[ne];ce.l=Math.min(ce.l,Ee.l),ce.t=Math.min(ce.t,Ee.t),ce.r=Math.max(ce.r,Ee.r),ce.b=Math.max(ce.b,Ee.b)}),Y[z]={l:ce.l-n,t:ce.t-n,r:ce.r+n,b:ce.b+n+a}}let J=t.cards.map(z=>j(z.cell[0],z.cell[1])),U=t.cards.map(z=>{let D=x[z.cell[0]][z.cell[1]];return D.length?D[D.length-1]:-1}),C=(z,D)=>{for(let V=z;V>=0;V=f[V])if(V===D)return!0;return!1},G=(z,D)=>{t.cards.forEach((V,W)=>{U[W]>=0&&C(U[W],z)&&(J[W]=[J[W][0]+D,J[W][1]])}),p.forEach((V,W)=>{C(W,z)&&(Y[W]={...Y[W],l:Y[W].l+D,r:Y[W].r+D})})},Z=z=>{let D=[],V=[],W=[],de=[];t.cards.forEach((N,ee)=>{U[ee]===z&&(D.push(J[ee][0]),W.push(J[ee][0]+s),V.push(J[ee][1]),de.push(J[ee][1]+r))}),p.forEach((N,ee)=>{f[ee]===z&&(D.push(Y[ee].l),W.push(Y[ee].r),V.push(Y[ee].t),de.push(Y[ee].b))});let ce=Y[z],H=Math.min(...D,ce.l+n),ne=Math.max(...W,ce.r-n),Ee=Math.min(...V,ce.t+n),qe=Math.max(...de,ce.b-n-a);Y[z]={l:H-n,t:Ee-n,r:ne+n,b:qe+n+a}};for(let z of F)if(f[z]<0&&!f.includes(z))Z(z);else{let V=[];t.cards.forEach((ne,Ee)=>{U[Ee]===z&&V.push({l:J[Ee][0],r:J[Ee][0]+s,t:J[Ee][1],b:J[Ee][1]+r,card:Ee})}),p.forEach((ne,Ee)=>{f[Ee]===z&&V.push({...Y[Ee],panel:Ee})}),V.sort((ne,Ee)=>ne.l-Ee.l||ne.t-Ee.t);let W=Math.min(...V.map(ne=>ne.l)),de=[];for(let ne of V){let Ee=W;for(let N of de)N.t<ne.b&&ne.t<N.b&&N.r<=ne.l+1e-6&&(Ee=Math.max(Ee,N.r+(N.card!==void 0&&ne.card!==void 0?i:m)));let qe=Ee-ne.l;qe<-1e-6&&(ne.card!==void 0?J[ne.card]=[J[ne.card][0]+qe,J[ne.card][1]]:G(ne.panel,qe),ne.l+=qe,ne.r+=qe),de.push(ne)}let ce=V.map(ne=>ne.l),H=V.map(ne=>ne.r);Y[z]={...Y[z],l:Math.min(...ce)-n,r:Math.max(...H)+n}}return{prect:Y,parentIx:f,depthOf:d,pos:j,cardAt:z=>J[z]}}function Kr(t,e,s={}){if(s.wrap){let{wrap:E,...q}=s;return Kr(Qu(t,e,E.aspect,q),e,q)}let r=La(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
|
|
287
|
+
`,Ya=eo+Uc+to;var Hc=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function Wa(t,e,s,r=Hc(t),i,o={},n=[]){let a=_s(Tr(e),t.roles,t.kinds),f=[],p=new Map;return t.scenes.forEach((c,l)=>{let d=`/scenes/${l}`;if(p.has(c.id)){let u=r.locate(d+"/id");n.push({severity:"error",message:`duplicate scene id "${c.id}"`,line:u.line,col:u.col,path:d+"/id"})}p.set(c.id,l);let m={...t.grid,...c.grid,...o.snap?{snap:o.snap}:{}},h=Nr(c,d,r,a,s,t.roles,m.snap);n.push(...h.diags);let y=Sa(c,d,h,r,new Set(Object.keys(a.kinds)),m.snap);n.push(...y.diags);let g=Ha(c,d,h,y.routes,r,a);n.push(...g.diags),n.push(...qh(c,d,s,r));let k=Fr({scene:c,layout:h,routes:y.routes,steps:g,theme:a,id:c.id,gridStep:m.step??m.snap??1});for(let u of k.warnings){let b=r.locate(u.path);n.push({severity:"warning",message:u.message,line:b.line,col:b.col,path:u.path})}f.push({id:c.id,raw:c,layout:h,routes:y.routes,steps:g,rendered:k,grid:m,assemble:c.assemble??t.assemble??!1})}),n.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!n.some(c=>c.severity==="error"),diags:n,doc:t,theme:a,catalog:s,scenes:f,parsed:r,source:i}}function qh(t,e,s,r){let i=[],o=(a,f)=>{let p=r.locate(a);i.push({severity:"warning",message:f,line:p.line,col:p.col,path:a})},n=(a,f)=>{a.nodes?.forEach((p,c)=>{let l=`${f}/nodes/${c}`;(p.deco??Tn(s,p.asset).deco??[]).forEach((d,m)=>{typeof d=="object"&&d.icon&&!ji(d.icon)&&o(p.deco?`${l}/deco/${m}/icon`:l,`node "${p.id}": no icon "${d.icon}" is registered here, so it is drawn as a placeholder`)}),p.face!==void 0&&!tr(p.face)&&o(`${l}/face`,`node "${p.id}": no screen face "${p.face}" is registered here, so it is drawn as a placeholder`)}),a.regions?.forEach((p,c)=>n(p,`${f}/regions/${c}`))};return n(t,e),i}function Sf(t,e){let s=t/(Ct*lt),r=2*e/lt;return[(s+r)/2,(r-s)/2]}function vf(t,e){let s=t.layout.byId.get(e);if(!s)return;let r=s.parent?[s.parent.box.x0,s.parent.box.y0]:[0,0];return[s.box.x0-r[0],s.box.y0-r[1]]}function Mf(t){let e=[];for(let s of[t.x0,t.x1])for(let r of[t.y0,t.y1])for(let i of[t.z0,t.z1])e.push(Ne(s,r,i));return Vh(e)}function Pf(t){return[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([e,s])=>Ne(e,s,t.z0))}function Vh(t){let e=[...new Map(t.map(o=>[`${o[0].toFixed(3)},${o[1].toFixed(3)}`,o])).values()].sort((o,n)=>o[0]-n[0]||o[1]-n[1]);if(e.length<3)return e;let s=(o,n,a)=>(n[0]-o[0])*(a[1]-o[1])-(n[1]-o[1])*(a[0]-o[0]),r=[],i=[];for(let o of e){for(;r.length>=2&&s(r[r.length-2],r[r.length-1],o)<=1e-9;)r.pop();r.push(o)}for(let o of[...e].reverse()){for(;i.length>=2&&s(i[i.length-2],i[i.length-1],o)<=1e-9;)i.pop();i.push(o)}return[...r.slice(0,-1),...i.slice(0,-1)]}var Of=(t,e)=>e?.padding??Ot(t,e?.kind)?.pad??0;function Af(t,e,s,r,i){let o=c=>Math.round(c/s)*s,n=o(t[0]+e[0]),a=o(t[1]+e[1]),f={left:!1,right:!1,top:!1,bottom:!1};if(i){let c=Math.ceil(i.pad/s-1e-9)*s,l=Math.floor((i.w-i.pad-r[0])/s+1e-9)*s,d=Math.floor((i.d-i.pad-r[1])/s+1e-9)*s;n<c&&(n=c,f.left=!0),l>=c&&n>l&&(n=l,f.right=!0),a<c&&(a=c,f.top=!0),d>=c&&a>d&&(a=d,f.bottom=!0)}let p=c=>Math.round(c*1e3)/1e3;return{at:[p(n),p(a)],delta:[p(n-t[0]),p(a-t[1])],clamped:f}}function Ja(t,e){return e.some(r=>t.x0<r.x1-1e-6&&t.x1>r.x0+1e-6&&t.y0<r.y1-1e-6&&t.y1>r.y0+1e-6)}var Wc=Object.freeze({W:178,H:58,GX:44,GY:44,PAD:22,TITLE:30,CH:96,cardRx:9,panelRx:14,bend:70,overlap:400,crossPanel:300,border:120,nearEdge:200,margin:16}),Jc={name:{key:"sans600_12",size:13},sub:{key:"sans400_13",size:10},title:{key:"sans700_13",size:12,spacing:.02},titleSub:{key:"sans400_13",size:10.5},label:{key:"sans600_12",size:10.5}},Tf=(t,e)=>On(t,Jc[e]);function Xa(t){let e=[],s=new Map,r=(f,p)=>{if(typeof p!="string"||!p){e.push(`${f} has no id`);return}let c=s.get(p);c?e.push(`duplicate id "${p}": a ${c} and a ${f} (cards and panels share one set of ids)`):s.set(p,f)};for(let f of t.cards)r("card",f.id),(!Array.isArray(f.cell)||f.cell.length!==2||!f.cell.every(p=>Number.isInteger(p)&&p>=0))&&e.push(`card "${f.id}": cell must be [column, row], whole numbers from 0`);for(let f of t.panels??[]){r("panel",f.id);let p=f.cells;(!Array.isArray(p)||p.length!==4||!p.every(c=>Number.isInteger(c)&&c>=0)||p[2]<p[0]||p[3]<p[1])&&e.push(`panel "${f.id}": cells must be [c0, r0, c1, r1] with c0 \u2264 c1 and r0 \u2264 r1`)}let i=new Map;for(let f of t.cards){let p=String(f.cell);i.has(p)?e.push(`cards "${i.get(p)}" and "${f.id}" are both at cell [${p}]`):i.set(p,f.id)}let o=(t.panels??[]).filter(f=>Array.isArray(f.cells)&&f.cells.length===4);for(let f=0;f<o.length;f++)for(let p=f+1;p<o.length;p++){let c=o[f].cells,l=o[p].cells;c[0]<=l[2]&&l[0]<=c[2]&&c[1]<=l[3]&&l[1]<=c[3]&&!Yc(c,l)&&!Yc(l,c)&&e.push(`panels "${o[f].id}" and "${o[p].id}" overlap without one holding the other`)}let n=new Set([...t.cards.map(f=>f.id),...o.map(f=>f.id)]),a=new Set(o.map(f=>f.id));return(t.links??[]).forEach((f,p)=>{let c=`link ${f.id?`"${f.id}"`:p}`;for(let l of["a","b"])n.has(f[l])||e.push(`${c}: ${l} "${f[l]}" is no card or panel`);for(let l of["aOn","bOn"])f[l]!==void 0&&!a.has(f[l])&&e.push(`${c}: ${l} "${f[l]}" is no panel`);f.id!==void 0&&r("link",f.id)}),e}var Yc=(t,e)=>t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3];function no(t,e){let{W:s,H:r,GX:i,GY:o,PAD:n,TITLE:a,CH:f}=e,p=t.panels??[],c=j=>(j[2]-j[0]+1)*(j[3]-j[1]+1),l=(j,q)=>{let G=p[j].cells,Q=p[q].cells;return Yc(Q,G)?c(G)>c(Q)||j<q:!1},d=p.map((j,q)=>{let G=-1;return p.forEach((Q,le)=>{le!==q&&l(le,q)&&(G<0||l(G,le))&&(G=le)}),G}),m=j=>d[j]<0?0:1+m(d[j]),h=(j,q)=>{let G=-1;p.forEach((le,pe)=>{let Y=le.cells;j>=Y[0]&&j<=Y[2]&&q>=Y[1]&&q<=Y[3]&&(G<0||l(G,pe))&&(G=pe)});let Q=[];for(let le=G;le>=0;le=d[le])Q.unshift(le);return Q},y=Math.max(1,...t.cards.map(j=>j.cell[0]+1),...p.map(j=>j.cells[2]+1)),g=Math.max(1,...t.cards.map(j=>j.cell[1]+1),...p.map(j=>j.cells[3]+1)),k=[];for(let j=0;j<y;j++){k.push([]);for(let q=0;q<g;q++)k[j].push(h(j,q))}let u=(j,q,G)=>{let Q=j.filter(pe=>!q.includes(pe)),le=q.filter(pe=>!j.includes(pe));return!Q.length&&!le.length?0:Q.length*(n+(G?a:0))+le.length*n+f},b=new Array(y+1).fill(0),x=new Array(g+1).fill(0);for(let j=0;j<g;j++)for(let q=1;q<y;q++){let G=u(k[q-1][j],k[q][j],!1);G&&(b[q]=Math.max(b[q],G-i))}for(let j=0;j<y;j++)for(let q=1;q<g;q++){let G=u(k[j][q-1],k[j][q],!0);G&&(x[q]=Math.max(x[q],G-o))}let w=j=>{let q=j*(s+i);for(let G=1;G<=j;G++)q+=b[G];return q},$=j=>{let q=j*(r+o);for(let G=1;G<=j;G++)q+=x[G];return q},v=(j,q,G,Q)=>G===q?j(q):j(q)+(Q-q)*(j(G)-j(q))/(G-q),O=p.map(()=>new Set),C=(j,q)=>{for(let G=j;G>=0;G=d[G])O[G].add(q)};p.forEach((j,q)=>{C(q,j.cells[1]),C(q,j.cells[3])});for(let j of t.cards){let q=k[j.cell[0]][j.cell[1]];q.length&&C(q[q.length-1],j.cell[1])}let A=p.map(()=>new Map),R=(j,q)=>j.slice(j.indexOf(q)+1);for(let j of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[j].cells,G=[...O[j]].sort((le,pe)=>le-pe),Q=d[j]>=0?A[d[j]].get(G[0]):$(G[0]);A[j].set(G[0],Q);for(let le=1;le<G.length;le++){let pe=0;for(let Y=q[0];Y<=q[2];Y++)pe=Math.max(pe,u(R(k[Y][G[le-1]],j),R(k[Y][G[le]],j),!0));Q+=r+Math.max(o,pe),A[j].set(G[le],Q)}}let M=p.map(()=>new Set),T=(j,q)=>{for(let G=j;G>=0;G=d[G])M[G].add(q)};p.forEach((j,q)=>{T(q,j.cells[0]),T(q,j.cells[2])});for(let j of t.cards){let q=k[j.cell[0]][j.cell[1]];q.length&&T(q[q.length-1],j.cell[0])}let S=p.map(()=>new Map);for(let j of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[j].cells,G=[...M[j]].sort((le,pe)=>le-pe);if(d[j]<0&&!d.includes(j)&&G.length===q[2]-q[0]+1){for(let le of G)S[j].set(le,v(w,q[0],q[2],le));continue}let Q=d[j]>=0?S[d[j]].get(G[0]):w(G[0]);S[j].set(G[0],Q);for(let le=1;le<G.length;le++){let pe=0;for(let Y=q[1];Y<=q[3];Y++)pe=Math.max(pe,u(R(k[G[le-1]][Y],j),R(k[G[le]][Y],j),!1));Q+=s+Math.max(i,pe),S[j].set(G[le],Q)}}let N=(j,q)=>{let G=k[j][q],Q=G.length?G[G.length-1]:-1;return Q>=0?[S[Q].get(j),A[Q].get(q)]:[w(j),$(q)]},z=p.map((j,q)=>q).sort((j,q)=>m(q)-m(j)||j-q),K=new Array(p.length);for(let j of z){let q=p[j].cells,G=[],Q=[];for(let Y of t.cards){let ie=k[Y.cell[0]][Y.cell[1]];ie[ie.length-1]===j&&(G.push(S[j].get(Y.cell[0])),Q.push(A[j].get(Y.cell[1])))}let le=Y=>Y.cell[0]>=q[0]&&Y.cell[0]<=q[2]&&Y.cell[1]>=q[1]&&Y.cell[1]<=q[3];for(let Y of[q[1],q[3]])t.cards.some(ie=>ie.cell[1]===Y&&le(ie))||Q.push(A[j].get(Y));for(let Y of[q[0],q[2]])t.cards.some(ie=>ie.cell[0]===Y&&le(ie))||G.push(S[j].get(Y));let pe={l:G.length?Math.min(...G):1/0,t:Q.length?Math.min(...Q):1/0,r:G.length?Math.max(...G)+s:-1/0,b:Q.length?Math.max(...Q)+r:-1/0};p.forEach((Y,ie)=>{if(d[ie]!==j)return;let Ae=K[ie];pe.l=Math.min(pe.l,Ae.l),pe.t=Math.min(pe.t,Ae.t),pe.r=Math.max(pe.r,Ae.r),pe.b=Math.max(pe.b,Ae.b)}),K[j]={l:pe.l-n,t:pe.t-n,r:pe.r+n,b:pe.b+n+a}}let J=t.cards.map(j=>N(j.cell[0],j.cell[1])),Z=t.cards.map(j=>{let q=k[j.cell[0]][j.cell[1]];return q.length?q[q.length-1]:-1}),L=(j,q)=>{for(let G=j;G>=0;G=d[G])if(G===q)return!0;return!1},U=(j,q)=>{t.cards.forEach((G,Q)=>{Z[Q]>=0&&L(Z[Q],j)&&(J[Q]=[J[Q][0]+q,J[Q][1]])}),p.forEach((G,Q)=>{L(Q,j)&&(K[Q]={...K[Q],l:K[Q].l+q,r:K[Q].r+q})})},H=j=>{let q=[],G=[],Q=[],le=[];t.cards.forEach((I,V)=>{Z[V]===j&&(q.push(J[V][0]),Q.push(J[V][0]+s),G.push(J[V][1]),le.push(J[V][1]+r))}),p.forEach((I,V)=>{d[V]===j&&(q.push(K[V].l),Q.push(K[V].r),G.push(K[V].t),le.push(K[V].b))});let pe=K[j],Y=Math.min(...q,pe.l+n),ie=Math.max(...Q,pe.r-n),Ae=Math.min(...G,pe.t+n),De=Math.max(...le,pe.b-n-a);K[j]={l:Y-n,t:Ae-n,r:ie+n,b:De+n+a}};for(let j of z)if(d[j]<0&&!d.includes(j))H(j);else{let G=[];t.cards.forEach((ie,Ae)=>{Z[Ae]===j&&G.push({l:J[Ae][0],r:J[Ae][0]+s,t:J[Ae][1],b:J[Ae][1]+r,card:Ae})}),p.forEach((ie,Ae)=>{d[Ae]===j&&G.push({...K[Ae],panel:Ae})}),G.sort((ie,Ae)=>ie.l-Ae.l||ie.t-Ae.t);let Q=Math.min(...G.map(ie=>ie.l)),le=[];for(let ie of G){let Ae=Q;for(let I of le)I.t<ie.b&&ie.t<I.b&&I.r<=ie.l+1e-6&&(Ae=Math.max(Ae,I.r+(I.card!==void 0&&ie.card!==void 0?i:f)));let De=Ae-ie.l;De<-1e-6&&(ie.card!==void 0?J[ie.card]=[J[ie.card][0]+De,J[ie.card][1]]:U(ie.panel,De),ie.l+=De,ie.r+=De),le.push(ie)}let pe=G.map(ie=>ie.l),Y=G.map(ie=>ie.r);K[j]={...K[j],l:Math.min(...pe)-n,r:Math.max(...Y)+n}}return{prect:K,parentIx:d,depthOf:m,pos:N,cardAt:j=>J[j]}}function Hr(t,e,s={}){if(s.wrap){let{wrap:E,..._}=s;return Hr(Kh(t,e,E.aspect,_),e,_)}let r=Xa(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
|
|
286
288
|
${r.join(`
|
|
287
|
-
`)}`);let i={...Ac,...s},{W:o,H:n}=i,a=E=>Math.round(E*10)/10,m=[],p=t.panels??[],{prect:c,parentIx:l,depthOf:f,cardAt:d}=Wi(t,i),u=p.map((E,q)=>{let _=c[q],re=e(E.label??"","title")+(E.sub?e(E.sub,"titleSub"):0);return{...E,rect:_,titleAt:[a(_.l+16),a(_.b-15)],depth:f(q),parent:l[q]>=0?p[l[q]].id:void 0,title:{l:_.l+10,r:_.l+22+re,t:_.b-30,b:_.b-6}}}),y=t.cards.map(E=>{let[q,_]=d(t.cards.indexOf(E));return{...E,rect:{l:q,t:_,r:q+o,b:_+n}}}),g=new Map;u.forEach(E=>g.set(E.id,E.rect)),y.forEach(E=>g.set(E.id,E.rect));let x=y.map(E=>E.rect),h=u.map(E=>E.rect),b=u.filter(E=>E.label).map(E=>E.title),w=(E,q)=>E.l>=q.l&&E.r<=q.r&&E.t>=q.t&&E.b<=q.b,k=(E,q,_,re)=>Math.min(E[0],q[0])<_.r+re&&Math.max(E[0],q[0])>_.l-re&&Math.min(E[1],q[1])<_.b+re&&Math.max(E[1],q[1])>_.t-re,$=(E,q)=>h.reduce((_,re)=>{if(E[0]===q[0]){let pe=Math.min(E[1],q[1]),Te=Math.max(E[1],q[1]);E[0]>re.l&&E[0]<re.r&&(_+=[re.t,re.b].filter(Pe=>Pe>pe+1&&Pe<Te-1).length)}else{let pe=Math.min(E[0],q[0]),Te=Math.max(E[0],q[0]);E[1]>re.t&&E[1]<re.b&&(_+=[re.l,re.r].filter(Pe=>Pe>pe+1&&Pe<Te-1).length)}return _},0),v=(E,q)=>h.some(_=>E[1]===q[1]?[_.t,_.b].some(re=>Math.abs(E[1]-re)<16&&Math.max(E[0],q[0])>_.l&&Math.min(E[0],q[0])<_.r):[_.l,_.r].some(re=>Math.abs(E[0]-re)<16&&Math.max(E[1],q[1])>_.t&&Math.min(E[1],q[1])<_.b)),T=(E,q,_,re)=>h.filter(pe=>pe!==_&&pe!==re&&!w(_,pe)&&!w(re,pe)&&k(E,q,{l:pe.l+3,r:pe.r-3,t:pe.t+3,b:pe.b-3},0)).length,R=[],O=new Map,I=new Map,M=(E,q)=>{R.push([E,q]);let[_,re]=E[1]===q[1]?[O,E[1]]:E[0]===q[0]?[I,E[0]]:[void 0,0];if(!_)return;let pe=Math.floor(re/6);(_.get(pe)??_.set(pe,[]).get(pe)).push([E,q])},A=(E,q)=>{let _=E[1]===q[1];if(!_&&E[0]!==q[0])return 0;let re=_?1:0,pe=_?0:1,Te=_?O:I,Pe=Math.floor(E[re]/6),rt=Math.min(E[pe],q[pe]),Fe=Math.max(E[pe],q[pe]),Ce=0;for(let Ke=Pe-1;Ke<=Pe+1;Ke++)for(let[We,gt]of Te.get(Ke)??[])Math.abs(E[re]-We[re])<6&&Math.min(Fe,Math.max(We[pe],gt[pe]))-Math.max(rt,Math.min(We[pe],gt[pe]))>0&&Ce++;return Ce},P=[...g.values()],j=Math.min(...P.map(E=>E.l)),F=Math.max(...P.map(E=>E.r)),Y=Math.min(...P.map(E=>E.t)),J=Math.max(...P.map(E=>E.b)),U=(E,q)=>{let _=(E+q)/2;return[_,_-12,_+12,_-24,_+24]},C=(()=>{let E=[];return x.forEach(q=>x.forEach(_=>{_.t>q.b&&_.l<q.r+400&&_.r>q.l-400&&E.push(...U(q.b,_.t))})),E.push(Y-22,Y-34,J+22,J+34),[...new Set(E.map(Math.round))]})(),G=(()=>{let E=[];return x.forEach(q=>x.forEach(_=>{_.l>q.r&&E.push(...U(q.r,_.l))})),E.push(j-22,j-34,F+22,F+34),[...new Set(E.map(Math.round))]})(),Z=new Map,Q=new Map,z=E=>{let q=Z.get(E);return q||Z.set(E,q=x.filter(_=>E<_.b+6&&E>_.t-6)),q},D=E=>{let q=Q.get(E);return q||Q.set(E,q=x.filter(_=>E<_.r+6&&E>_.l-6)),q},V=i.crossPanel/i.overlap,W=i.border/i.overlap,de=i.nearEdge/i.overlap;function ce(E,q,_,re,pe=!0){let Te=0;for(let Ce=1;Ce<E.length;Ce++)Te+=Math.abs(E[Ce-1][0]-E[Ce][0])+Math.abs(E[Ce-1][1]-E[Ce][1]);let Pe=Te+i.bend*(E.length-2);if(Pe>=re)return Pe;let rt=0,Fe=0;for(let Ce=1;Ce<E.length;Ce++){let Ke=E[Ce-1],We=E[Ce];if(pe){if(ke(Ke,We,q,_)||v(Ke,We))return 1/0;continue}for(let gt of Ke[1]===We[1]?z(Ke[1]):D(Ke[0]))gt!==q&>!==_&&k(Ke,We,gt,6)&&rt++;for(let gt of b)k(Ke,We,gt,2)&&rt++}for(let Ce=1;Ce<E.length;Ce++){let Ke=E[Ce-1],We=E[Ce];if(Fe+=A(Ke,We)+V*T(Ke,We,q,_)+W*$(Ke,We),v(Ke,We)&&(Fe+=de),Pe+i.overlap*Fe>=re)return Pe+i.overlap*Fe}return Pe+i.overlap*Fe+rt*1e5}let H=E=>(E.l+E.r)/2,ne=E=>(E.t+E.b)/2,Ee=[0,-22,22,-44,44],qe={bc:1/0},N=(E,q,_,re)=>Math.abs(E-_)+Math.abs(q-re),ee=(E,q,_,re,pe,Te,Pe,rt)=>{let Fe=0;return Fe+=N(E,q,_,re),Fe+=N(_,re,pe,Te),Fe+=N(pe,Te,Pe,rt),Fe+i.bend*2},ye=(E,q,_,re,pe,Te,Pe,rt,Fe,Ce)=>{let Ke=0;return Ke+=N(E,q,_,re),Ke+=N(_,re,pe,Te),Ke+=N(pe,Te,Pe,rt),Ke+=N(Pe,rt,Fe,Ce),Ke+i.bend*3},ke=(E,q,_,re)=>{for(let pe of E[1]===q[1]?z(E[1]):D(E[0]))if(pe!==_&&pe!==re&&k(E,q,pe,6))return!0;for(let pe of b)if(k(E,q,pe,2))return!0;return v(E,q)};function Ve(E,q,_,re){let pe=Math.max(E.l,q.l),Te=Math.min(E.r,q.r);if(Te-pe>24)for(let dt of Ee){let ut=(pe+Te)/2+dt;ut>pe+8&&ut<Te-8&&_(q.t>=E.b?[[ut,E.b],[ut,q.t]]:[[ut,E.t],[ut,q.b]])}let Pe=Math.max(E.t,q.t),rt=Math.min(E.b,q.b);if(rt-Pe>16)for(let dt of[0,-10,10]){let ut=(Pe+rt)/2+dt;_(q.l>=E.r?[[E.r,ut],[q.l,ut]]:[[E.l,ut],[q.r,ut]])}let Fe=G.length,Ce=C.length,Ke=new Uint8Array(Ee.length*Ce),We=new Uint8Array(Ee.length*Ce),gt=new Uint8Array(Ee.length*Fe),Vs=new Uint8Array(Ee.length*Fe),Tt=(dt,ut,Cn,Kt)=>re?(dt[ut]||(dt[ut]=ke(Cn,Kt,E,q)?2:1),dt[ut]===1):!0;Ee.forEach((dt,ut)=>Ee.forEach((Cn,Kt)=>{let _t=H(E)+dt,Dt=H(q)+Cn,Gt=ne(E)+dt/3,kt=ne(q)+Cn/3;C.forEach((Je,jn)=>{let ht=Je>E.b?E.b:Je<E.t?E.t:null,ln=Je>q.b?q.b:Je<q.t?q.t:null;ht!==null&&ln!==null&&ee(_t,ht,_t,Je,Dt,Je,Dt,ln)<qe.bc&&Tt(Ke,ut*Ce+jn,[_t,ht],[_t,Je])&&Tt(We,Kt*Ce+jn,[Dt,Je],[Dt,ln])&&_([[_t,ht],[_t,Je],[Dt,Je],[Dt,ln]])}),G.forEach((Je,jn)=>{let ht=Je>E.r?E.r:Je<E.l?E.l:null,ln=Je>q.r?q.r:Je<q.l?q.l:null;ht!==null&&ln!==null&&ee(ht,Gt,Je,Gt,Je,kt,ln,kt)<qe.bc&&Tt(gt,ut*Fe+jn,[ht,Gt],[Je,Gt])&&Tt(Vs,Kt*Fe+jn,[Je,kt],[ln,kt])&&_([[ht,Gt],[Je,Gt],[Je,kt],[ln,kt]])}),dt===0&&Cn===0&&G.forEach((Je,jn)=>C.forEach((ht,ln)=>{let L=Je>E.r?E.r:Je<E.l?E.l:null,X=ht>q.b?q.b:ht<q.t?q.t:null;L!==null&&X!==null&&ye(L,Gt,Je,Gt,Je,ht,Dt,ht,Dt,X)<qe.bc&&Tt(gt,ut*Fe+jn,[L,Gt],[Je,Gt])&&Tt(We,Kt*Ce+ln,[Dt,ht],[Dt,X])&&_([[L,Gt],[Je,Gt],[Je,ht],[Dt,ht],[Dt,X]]);let oe=ht>E.b?E.b:ht<E.t?E.t:null,ue=Je>q.r?q.r:Je<q.l?q.l:null;oe!==null&&ue!==null&&ye(_t,oe,_t,ht,Je,ht,Je,kt,ue,kt)<qe.bc&&Tt(Ke,ut*Ce+ln,[_t,oe],[_t,ht])&&Tt(Vs,Kt*Fe+jn,[Je,kt],[ue,kt])&&_([[_t,oe],[_t,ht],[Je,ht],[Je,kt],[ue,kt]])}));let cr=H(E)<q.l?q.l:H(E)>q.r?q.r:null,Zt=kt<E.t?E.t:kt>E.b?E.b:null;cr!==null&&Zt!==null&&_([[_t,Zt],[_t,kt],[cr,kt]]);let Ks=ne(E)<q.t?q.t:ne(E)>q.b?q.b:null,pr=Dt<E.l?E.l:Dt>E.r?E.r:null;Ks!==null&&pr!==null&&_([[pr,Gt],[Dt,Gt],[Dt,Ks]])}))}function we(E,q,_,re){for(let pe of Ee){let Te=H(E)+pe,Pe=ne(E)+pe/3,rt=[[[Te,E.t],[Te,q.t]],[[E.r,Pe],[q.r,Pe]],[[Te,E.b],[Te,q.b]],[[E.l,Pe],[q.l,Pe]]];for(let Fe of rt)re(_?[Fe[1],Fe[0]]:Fe)}}let Ue=(E,q,_,re)=>{let pe=null;return qe.bc=1/0,E(Te=>{let Pe=ce(Te,q,_,qe.bc,re);Pe<qe.bc&&(qe.bc=Pe,pe=Te)},re),pe},Le=[],$e=E=>h.some(q=>[q.l,q.r].some(_=>E.l<_+3&&E.r>_-3&&E.b>q.t&&E.t<q.b)||[q.t,q.b].some(_=>E.t<_+3&&E.b>_-3&&E.r>q.l&&E.l<q.r)),S=E=>R.filter(([q,_])=>k(q,_,E,1)).length,B=E=>b.some(q=>E.l<q.r&&E.r>q.l&&E.t<q.b&&E.b>q.t),K=E=>x.filter(q=>E.l<q.r+3&&E.r>q.l-3&&E.t<q.b+3&&E.b>q.t-3).length,ae=E=>Le.filter(q=>E.l<q.r+4&&E.r>q.l-4&&E.t<q.b+2&&E.b>q.t-2).length,le=E=>50*Se(E)+3*S(E)+($e(E)?1:0)+(B(E)?5:0)+5*K(E)+5*ae(E),fe=E=>S(E)>0||$e(E)||B(E)||K(E)>0||ae(E)>0,se=[];(t.links??[]).forEach((E,q)=>{let _=E.id??`link-${q}`,re=g.get(E.aOn??E.a),pe=g.get(E.bOn??E.b);if(re===pe){m.push(`link "${_}" joins "${E.aOn??E.a}" to itself: not drawn`),se.push({...E,id:_,points:[],routed:!1});return}let Te=w(re,pe)?Fe=>we(re,pe,!1,Fe):w(pe,re)?Fe=>we(pe,re,!0,Fe):(Fe,Ce)=>Ve(re,pe,Fe,Ce),Pe=Ue(Te,re,pe,!0),rt=!0;if(Pe||(Pe=Ue(Te,re,pe,!1),rt=!1,m.push(`link "${_}": no clear route; drawn the least bad way`)),!Pe){se.push({...E,id:_,points:[],routed:!1});return}for(let Fe=1;Fe<Pe.length;Fe++)M(Pe[Fe-1],Pe[Fe]);se.push({...E,id:_,points:Pe,routed:rt})});let ge=[];for(let E=0;E<R.length;E++)for(let q=E+1;q<R.length;q++){let[_,re]=R[E],[pe,Te]=R[q],Pe=_[1]===re[1],rt=pe[1]===Te[1];if(Pe===rt)continue;let[Fe,Ce]=Pe?[[_,re],[pe,Te]]:[[pe,Te],[_,re]],Ke=Ce[0][0],We=Fe[0][1];Ke>Math.min(Fe[0][0],Fe[1][0])&&Ke<Math.max(Fe[0][0],Fe[1][0])&&We>Math.min(Ce[0][1],Ce[1][1])&&We<Math.max(Ce[0][1],Ce[1][1])&&ge.push([Ke,We])}let Se=E=>ge.filter(([q,_])=>q>E.l-2&&q<E.r+2&&_>E.t-2&&_<E.b+2).length;for(let E of se){let q=E,_=E.points;if(!q.label||!_.length)continue;let re=[];for(let Ce=1;Ce<_.length;Ce++)re.push([_[Ce-1],_[Ce]]);let pe=Ce=>Math.abs(Ce[0][0]-Ce[1][0])+Math.abs(Ce[0][1]-Ce[1][1]);re.sort((Ce,Ke)=>pe(Ke)-pe(Ce));let Te=e(q.label,"label")+6,Pe=null,rt=null,Fe=1/0;for(let[Ce,Ke]of re){let We=(Ce[0]+Ke[0])/2,gt=(Ce[1]+Ke[1])/2,Vs=Ce[1]===Ke[1]?[0,-.3,.3,-.15,.15].flatMap(Tt=>{let dt=We+Tt*Math.abs(Ce[0]-Ke[0]);return[[dt,gt-6,"middle"],[dt,gt+15,"middle"]]}):[0,-.3,.3].flatMap(Tt=>{let dt=gt+4+Tt*Math.abs(Ce[1]-Ke[1]);return[[We+7,dt,"start"],[We-7,dt,"end"],[We+24,dt,"start"],[We-24,dt,"end"]]});for(let[Tt,dt,ut]of Vs){let Cn=ut==="middle"?Tt-Te/2:ut==="end"?Tt-Te:Tt,Kt={l:Cn,r:Cn+Te,t:dt-11,b:dt+3};if(!fe(Kt)){Pe=[Tt,dt,ut,Kt];break}let _t=le(Kt);_t<Fe&&(Fe=_t,rt=[Tt,dt,ut,Kt])}if(Pe)break}if(!Pe&&rt&&(Pe=rt),!Pe){let[Ce,Ke]=re[0],We=(Ce[0]+Ke[0])/2,gt=(Ce[1]+Ke[1])/2-6;Pe=[We,gt,"middle",{l:We-Te/2,r:We+Te/2,t:gt-11,b:gt+3}]}Le.push(Pe[3]),E.at={x:a(Pe[0]),y:a(Pe[1]),anchor:Pe[2],box:Pe[3],text:q.label}}let te=[],xe=[];for(let E of[...P,...Le,...u.map(q=>q.title)])te.push(E.l,E.r),xe.push(E.t,E.b);for(let E of se)for(let q of E.points)te.push(q[0]),xe.push(q[1]);let he=i.margin,Ie={l:Math.min(...te)-he,t:Math.min(...xe)-he,r:Math.max(...te)+he,b:Math.max(...xe)+he};return{cards:y,panels:u,links:se,bounds:Ie,options:i,warnings:m}}function ad(t,e,s){let r=o=>e>=o.l&&e<=o.r&&s>=o.t&&s<=o.b,i=t.cards.find(o=>r(o.rect));return i?i.id:[...t.panels].sort((o,n)=>n.depth-o.depth).find(o=>r(o.rect))?.id}function Qu(t,e,s,r={}){let i=a=>{let m=Kr(a,e,r);return Math.max(m.bounds.r-m.bounds.l,(m.bounds.b-m.bounds.t)*s)},o=t,n=i(t);for(let a=0;a<12;a++){let m,p=n;for(let c of eh(o)){if(La(c).length)continue;let l=i(c);l<p-.5&&(p=l,m=c)}if(!m)break;o=m,n=p}return o}function*eh(t){let e=t.panels??[],s=(n,a)=>n[0]>=a[0]&&n[2]<=a[2]&&n[1]>=a[1]&&n[3]<=a[3],r=(n,a)=>n.every((m,p)=>m===a[p]),i=(n,a=-1)=>{let m=-1;return e.forEach((p,c)=>{c===a||!s(n,p.cells)||a>=0&&c>a&&r(p.cells,e[a].cells)||(m<0||s(p.cells,e[m].cells)&&(!r(p.cells,e[m].cells)||c>m))&&(m=c)}),m},o=n=>{let a=[];return e.forEach((m,p)=>{i(m.cells,p)===n&&a.push({range:[...m.cells],panel:p})}),t.cards.forEach((m,p)=>{let c=[m.cell[0],m.cell[1],m.cell[0],m.cell[1]];i(c)===n&&a.push({range:c,card:p})}),a};for(let n of[-1,...e.map((a,m)=>m)]){let a=o(n);if(n>=0&&!a.some(l=>l.panel!==void 0))continue;let m=l=>[l.range[1],l.range[3]],p=[];for(let l of[...a].sort((f,d)=>f.range[1]-d.range[1]||f.range[0]-d.range[0])){let f=p.find(d=>d.some(u=>m(u)[0]<=m(l)[1]&&m(l)[0]<=m(u)[1]));f?f.push(l):p.push([l])}let c=Math.max(...a.map(l=>l.range[3]));for(let l of p){l.sort((f,d)=>f.range[0]-d.range[0]);for(let f=1;f<l.length;f++){let d=l.slice(f),u=l[0].range[0],y=c+1,g=Math.min(...d.map($=>$.range[1])),x=Math.max(...d.map($=>$.range[3]))-g+1,h=t.cards.map($=>({...$,cell:[...$.cell]})),b=e.map($=>({...$,cells:[...$.cells]}));for(let $ of h)$.cell[1]>c&&($.cell[1]+=x);let w=new Set;for(let $=n;$>=0&&!w.has($);$=i(e[$].cells,$))w.add($);b.forEach(($,v)=>{$.cells[1]>c?($.cells[1]+=x,$.cells[3]+=x):(w.has(v)||$.cells[1]<=c&&$.cells[3]>c)&&($.cells[3]+=x)});let k=u;for(let $ of d){let v=k-$.range[0],T=y+($.range[1]-g)-$.range[1],R=O=>O[0]>=$.range[0]&&O[0]<=$.range[2]&&O[1]>=$.range[1]&&O[1]<=$.range[3];t.cards.forEach((O,I)=>{R([O.cell[0],O.cell[1]])&&(h[I].cell=[O.cell[0]+v,O.cell[1]+T])}),e.forEach((O,I)=>{s(O.cells,$.range)&&(b[I].cells=[O.cells[0]+v,O.cells[1]+T,O.cells[2]+v,O.cells[3]+T])}),k+=$.range[2]-$.range[0]+1}e.forEach(($,v)=>{let T=t.cards.map((R,O)=>s([R.cell[0],R.cell[1],R.cell[0],R.cell[1]],$.cells)?h[O].cell:void 0).filter(R=>!!R);T.length&&(b[v].cells=[Math.min(...T.map(R=>R[0])),Math.min(...T.map(R=>R[1])),Math.max(...T.map(R=>R[0])),Math.max(...T.map(R=>R[1]))])}),yield{cards:h,panels:b,links:t.links}}}}}function _a(t,e=()=>!0){let s=t.layout.items.filter(v=>e(v.id)),r=t.layout.catalog,i=!t.layout.items.some(v=>v.type==="node"),o=v=>i?!v.children.some(T=>e(T.id)):v.type==="node"&&!v.children.some(T=>T.type==="node"&&e(T.id)),n=s.filter(o),a=v=>{let T=[];for(let R=v;R;R=R.parent)T.unshift(R);return T},m=new Map(n.map(v=>[v.id,a(v)])),p=(v,T)=>{let R=m.get(v.id),O=m.get(T.id),I=0;for(;I<R.length&&I<O.length&&R[I]===O[I];)I++;return[R[I].box,O[I].box]},c=1e-6,l=(v,T)=>{let[R,O]=p(v,T);return R.y1<=O.y0+c&&R.x0<O.x1-c&&O.x0<R.x1-c},f=(v,T)=>{let[R,O]=p(v,T);return R.x1<=O.x0+c&&R.y0<O.y1-c&&O.y0<R.y1-c},d=(v,T)=>{let R=new Map,O=[];for(let I of[...n].sort((M,A)=>T(M)-T(A))){let M=0;for(let A of O)R.get(A.id)+1>M&&v(A,I)&&(M=R.get(A.id)+1);R.set(I.id,M),O.push(I)}return R},u=d(l,v=>v.box.y0),y=d(f,v=>v.box.x0),g=Math.min(...n.map(v=>v.box.x1-v.box.x0))/2;for(let v of n)if(!v.parent)for(let T of n)T.parent&&T.box.x0<=v.box.x0+g&&y.set(v.id,Math.max(y.get(v.id),y.get(T.id)));let x=new Map;for(let v of n)x.set(v.id,[y.get(v.id),u.get(v.id)]);let h=new Map;for(let v of n){let T=x.get(v.id),R=h.get(String(T));if(R!==void 0&&R!==v.id){for(let[,O]of x)O[0]>T[0]&&O!==T&&O[0]++;T[0]++,h.clear();for(let O of n)h.set(String(x.get(O.id)),O.id)}else h.set(String(T),v.id)}let b=n.map(v=>{if(v.region){let O=v.region;return{id:v.id,label:O.label??v.id,sub:void 0,role:O.role??Pt(r,O.kind)?.role??"grey",ghost:O.ghost||void 0,cell:x.get(v.id)}}let T=v.node,R=Mn(r,T.asset);return{id:v.id,label:T.label??v.id,sub:T.sub,role:T.role??R.role,ghost:T.ghost||void 0,cell:x.get(v.id)}}),w=[];for(let v of s){if(o(v))continue;let T=[],R=P=>{for(let j of P.children){let F=x.get(j.id);F&&T.push(F),R(j)}};if(R(v),!T.length)continue;let O=T.map(P=>P[0]),I=T.map(P=>P[1]),M=v.type==="region"?v.region.label:v.node.label??v.id,A=v.type==="region"?v.region.role??Pt(r,v.region.kind)?.role:v.node.role??Mn(r,v.node.asset).role;w.push({id:v.id,label:M,sub:v.type==="node"?v.node.sub:void 0,role:A,cells:[Math.min(...O),Math.min(...I),Math.max(...O),Math.max(...I)]})}let k=new Set([...b.map(v=>v.id),...w.map(v=>v.id)]),$=[];for(let v of t.routes){if(!e(v.id))continue;let T=bn(v.raw.from).id,R=bn(v.raw.to).id;if(!k.has(T)||!k.has(R))continue;let O=typeof v.raw.label=="string"?v.raw.label:v.raw.label?.text;$.push({id:v.id,a:T,b:R,kind:v.kind,label:O})}return{cards:b,panels:w,links:$}}var Fs={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},ld=`
|
|
289
|
+
`)}`);let i={...Wc,...s},{W:o,H:n}=i,a=E=>Math.round(E*10)/10,f=[],p=t.panels??[],{prect:c,parentIx:l,depthOf:d,cardAt:m}=no(t,i),h=p.map((E,_)=>{let D=c[_],ce=e(E.label??"","title")+(E.sub?e(E.sub,"titleSub"):0);return{...E,rect:D,titleAt:[a(D.l+16),a(D.b-15)],depth:d(_),parent:l[_]>=0?p[l[_]].id:void 0,title:{l:D.l+10,r:D.l+22+ce,t:D.b-30,b:D.b-6}}}),y=t.cards.map(E=>{let[_,D]=m(t.cards.indexOf(E));return{...E,rect:{l:_,t:D,r:_+o,b:D+n}}}),g=new Map;h.forEach(E=>g.set(E.id,E.rect)),y.forEach(E=>g.set(E.id,E.rect));let k=y.map(E=>E.rect),u=h.map(E=>E.rect),b=h.filter(E=>E.label).map(E=>E.title),x=(E,_)=>E.l>=_.l&&E.r<=_.r&&E.t>=_.t&&E.b<=_.b,w=(E,_,D,ce)=>Math.min(E[0],_[0])<D.r+ce&&Math.max(E[0],_[0])>D.l-ce&&Math.min(E[1],_[1])<D.b+ce&&Math.max(E[1],_[1])>D.t-ce,$=(E,_)=>u.reduce((D,ce)=>{if(E[0]===_[0]){let me=Math.min(E[1],_[1]),Ce=Math.max(E[1],_[1]);E[0]>ce.l&&E[0]<ce.r&&(D+=[ce.t,ce.b].filter(oe=>oe>me+1&&oe<Ce-1).length)}else{let me=Math.min(E[0],_[0]),Ce=Math.max(E[0],_[0]);E[1]>ce.t&&E[1]<ce.b&&(D+=[ce.l,ce.r].filter(oe=>oe>me+1&&oe<Ce-1).length)}return D},0),v=(E,_)=>u.some(D=>E[1]===_[1]?[D.t,D.b].some(ce=>Math.abs(E[1]-ce)<16&&Math.max(E[0],_[0])>D.l&&Math.min(E[0],_[0])<D.r):[D.l,D.r].some(ce=>Math.abs(E[0]-ce)<16&&Math.max(E[1],_[1])>D.t&&Math.min(E[1],_[1])<D.b)),O=(E,_,D,ce)=>u.filter(me=>me!==D&&me!==ce&&!x(D,me)&&!x(ce,me)&&w(E,_,{l:me.l+3,r:me.r-3,t:me.t+3,b:me.b-3},0)).length,C=[],A=new Map,R=new Map,M=(E,_)=>{C.push([E,_]);let[D,ce]=E[1]===_[1]?[A,E[1]]:E[0]===_[0]?[R,E[0]]:[void 0,0];if(!D)return;let me=Math.floor(ce/6);(D.get(me)??D.set(me,[]).get(me)).push([E,_])},T=(E,_)=>{let D=E[1]===_[1];if(!D&&E[0]!==_[0])return 0;let ce=D?1:0,me=D?0:1,Ce=D?A:R,oe=Math.floor(E[ce]/6),Le=Math.min(E[me],_[me]),Pe=Math.max(E[me],_[me]),xe=0;for(let _e=oe-1;_e<=oe+1;_e++)for(let[Ue,mt]of Ce.get(_e)??[])Math.abs(E[ce]-Ue[ce])<6&&Math.min(Pe,Math.max(Ue[me],mt[me]))-Math.max(Le,Math.min(Ue[me],mt[me]))>0&&xe++;return xe},S=[...g.values()],N=Math.min(...S.map(E=>E.l)),z=Math.max(...S.map(E=>E.r)),K=Math.min(...S.map(E=>E.t)),J=Math.max(...S.map(E=>E.b)),Z=(E,_)=>{let D=(E+_)/2;return[D,D-12,D+12,D-24,D+24]},L=(()=>{let E=[];return k.forEach(_=>k.forEach(D=>{D.t>_.b&&D.l<_.r+400&&D.r>_.l-400&&E.push(...Z(_.b,D.t))})),E.push(K-22,K-34,J+22,J+34),[...new Set(E.map(Math.round))]})(),U=(()=>{let E=[];return k.forEach(_=>k.forEach(D=>{D.l>_.r&&E.push(...Z(_.r,D.l))})),E.push(N-22,N-34,z+22,z+34),[...new Set(E.map(Math.round))]})(),H=new Map,ee=new Map,j=E=>{let _=H.get(E);return _||H.set(E,_=k.filter(D=>E<D.b+6&&E>D.t-6)),_},q=E=>{let _=ee.get(E);return _||ee.set(E,_=k.filter(D=>E<D.r+6&&E>D.l-6)),_},G=i.crossPanel/i.overlap,Q=i.border/i.overlap,le=i.nearEdge/i.overlap;function pe(E,_,D,ce,me=!0){let Ce=0;for(let xe=1;xe<E.length;xe++)Ce+=Math.abs(E[xe-1][0]-E[xe][0])+Math.abs(E[xe-1][1]-E[xe][1]);let oe=Ce+i.bend*(E.length-2);if(oe>=ce)return oe;let Le=0,Pe=0;for(let xe=1;xe<E.length;xe++){let _e=E[xe-1],Ue=E[xe];if(me){if(ae(_e,Ue,_,D)||v(_e,Ue))return 1/0;continue}for(let mt of _e[1]===Ue[1]?j(_e[1]):q(_e[0]))mt!==_&&mt!==D&&w(_e,Ue,mt,6)&&Le++;for(let mt of b)w(_e,Ue,mt,2)&&Le++}for(let xe=1;xe<E.length;xe++){let _e=E[xe-1],Ue=E[xe];if(Pe+=T(_e,Ue)+G*O(_e,Ue,_,D)+Q*$(_e,Ue),v(_e,Ue)&&(Pe+=le),oe+i.overlap*Pe>=ce)return oe+i.overlap*Pe}return oe+i.overlap*Pe+Le*1e5}let Y=E=>(E.l+E.r)/2,ie=E=>(E.t+E.b)/2,Ae=[0,-22,22,-44,44],De={bc:1/0},I=(E,_,D,ce)=>Math.abs(E-D)+Math.abs(_-ce),V=(E,_,D,ce,me,Ce,oe,Le)=>{let Pe=0;return Pe+=I(E,_,D,ce),Pe+=I(D,ce,me,Ce),Pe+=I(me,Ce,oe,Le),Pe+i.bend*2},te=(E,_,D,ce,me,Ce,oe,Le,Pe,xe)=>{let _e=0;return _e+=I(E,_,D,ce),_e+=I(D,ce,me,Ce),_e+=I(me,Ce,oe,Le),_e+=I(oe,Le,Pe,xe),_e+i.bend*3},ae=(E,_,D,ce)=>{for(let me of E[1]===_[1]?j(E[1]):q(E[0]))if(me!==D&&me!==ce&&w(E,_,me,6))return!0;for(let me of b)if(w(E,_,me,2))return!0;return v(E,_)};function Te(E,_,D,ce){let me=Math.max(E.l,_.l),Ce=Math.min(E.r,_.r);if(Ce-me>24)for(let at of Ae){let ht=(me+Ce)/2+at;ht>me+8&&ht<Ce-8&&D(_.t>=E.b?[[ht,E.b],[ht,_.t]]:[[ht,E.t],[ht,_.b]])}let oe=Math.max(E.t,_.t),Le=Math.min(E.b,_.b);if(Le-oe>16)for(let at of[0,-10,10]){let ht=(oe+Le)/2+at;D(_.l>=E.r?[[E.r,ht],[_.l,ht]]:[[E.l,ht],[_.r,ht]])}let Pe=U.length,xe=L.length,_e=new Uint8Array(Ae.length*xe),Ue=new Uint8Array(Ae.length*xe),mt=new Uint8Array(Ae.length*Pe),ys=new Uint8Array(Ae.length*Pe),kt=(at,ht,_n,Kt)=>ce?(at[ht]||(at[ht]=ae(_n,Kt,E,_)?2:1),at[ht]===1):!0;Ae.forEach((at,ht)=>Ae.forEach((_n,Kt)=>{let _t=Y(E)+at,Dt=Y(_)+_n,Gt=ie(E)+at/3,$t=ie(_)+_n/3;L.forEach((We,Fn)=>{let yt=We>E.b?E.b:We<E.t?E.t:null,cn=We>_.b?_.b:We<_.t?_.t:null;yt!==null&&cn!==null&&V(_t,yt,_t,We,Dt,We,Dt,cn)<De.bc&&kt(_e,ht*xe+Fn,[_t,yt],[_t,We])&&kt(Ue,Kt*xe+Fn,[Dt,We],[Dt,cn])&&D([[_t,yt],[_t,We],[Dt,We],[Dt,cn]])}),U.forEach((We,Fn)=>{let yt=We>E.r?E.r:We<E.l?E.l:null,cn=We>_.r?_.r:We<_.l?_.l:null;yt!==null&&cn!==null&&V(yt,Gt,We,Gt,We,$t,cn,$t)<De.bc&&kt(mt,ht*Pe+Fn,[yt,Gt],[We,Gt])&&kt(ys,Kt*Pe+Fn,[We,$t],[cn,$t])&&D([[yt,Gt],[We,Gt],[We,$t],[cn,$t]])}),at===0&&_n===0&&U.forEach((We,Fn)=>L.forEach((yt,cn)=>{let F=We>E.r?E.r:We<E.l?E.l:null,se=yt>_.b?_.b:yt<_.t?_.t:null;F!==null&&se!==null&&te(F,Gt,We,Gt,We,yt,Dt,yt,Dt,se)<De.bc&&kt(mt,ht*Pe+Fn,[F,Gt],[We,Gt])&&kt(Ue,Kt*xe+cn,[Dt,yt],[Dt,se])&&D([[F,Gt],[We,Gt],[We,yt],[Dt,yt],[Dt,se]]);let ue=yt>E.b?E.b:yt<E.t?E.t:null,ge=We>_.r?_.r:We<_.l?_.l:null;ue!==null&&ge!==null&&te(_t,ue,_t,yt,We,yt,We,$t,ge,$t)<De.bc&&kt(_e,ht*xe+cn,[_t,ue],[_t,yt])&&kt(ys,Kt*Pe+Fn,[We,$t],[ge,$t])&&D([[_t,ue],[_t,yt],[We,yt],[We,$t],[ge,$t]])}));let ur=Y(E)<_.l?_.l:Y(E)>_.r?_.r:null,Zt=$t<E.t?E.t:$t>E.b?E.b:null;ur!==null&&Zt!==null&&D([[_t,Zt],[_t,$t],[ur,$t]]);let Zs=ie(E)<_.t?_.t:ie(E)>_.b?_.b:null,hr=Dt<E.l?E.l:Dt>E.r?E.r:null;Zs!==null&&hr!==null&&D([[hr,Gt],[Dt,Gt],[Dt,Zs]])}))}function be(E,_,D,ce){for(let me of Ae){let Ce=Y(E)+me,oe=ie(E)+me/3,Le=[[[Ce,E.t],[Ce,_.t]],[[E.r,oe],[_.r,oe]],[[Ce,E.b],[Ce,_.b]],[[E.l,oe],[_.l,oe]]];for(let Pe of Le)ce(D?[Pe[1],Pe[0]]:Pe)}}let ze=(E,_,D,ce)=>{let me=null;return De.bc=1/0,E(Ce=>{let oe=pe(Ce,_,D,De.bc,ce);oe<De.bc&&(De.bc=oe,me=Ce)},ce),me},Ie=[],ke=E=>u.some(_=>[_.l,_.r].some(D=>E.l<D+3&&E.r>D-3&&E.b>_.t&&E.t<_.b)||[_.t,_.b].some(D=>E.t<D+3&&E.b>D-3&&E.r>_.l&&E.l<_.r)),Be=E=>C.filter(([_,D])=>w(_,D,E,1)).length,Qe=E=>b.some(_=>E.l<_.r&&E.r>_.l&&E.t<_.b&&E.b>_.t),Ke=E=>k.filter(_=>E.l<_.r+3&&E.r>_.l-3&&E.t<_.b+3&&E.b>_.t-3).length,pt=E=>Ie.filter(_=>E.l<_.r+4&&E.r>_.l-4&&E.t<_.b+2&&E.b>_.t-2).length,P=E=>50*fe(E)+3*Be(E)+(ke(E)?1:0)+(Qe(E)?5:0)+5*Ke(E)+5*pt(E),B=E=>Be(E)>0||ke(E)||Qe(E)||Ke(E)>0||pt(E)>0,W=[];(t.links??[]).forEach((E,_)=>{let D=E.id??`link-${_}`,ce=g.get(E.aOn??E.a),me=g.get(E.bOn??E.b);if(ce===me){f.push(`link "${D}" joins "${E.aOn??E.a}" to itself: not drawn`),W.push({...E,id:D,points:[],routed:!1});return}let Ce=x(ce,me)?Pe=>be(ce,me,!1,Pe):x(me,ce)?Pe=>be(me,ce,!0,Pe):(Pe,xe)=>Te(ce,me,Pe,xe),oe=ze(Ce,ce,me,!0),Le=!0;if(oe||(oe=ze(Ce,ce,me,!1),Le=!1,f.push(`link "${D}": no clear route; drawn the least bad way`)),!oe){W.push({...E,id:D,points:[],routed:!1});return}for(let Pe=1;Pe<oe.length;Pe++)M(oe[Pe-1],oe[Pe]);W.push({...E,id:D,points:oe,routed:Le})});let he=[];for(let E=0;E<C.length;E++)for(let _=E+1;_<C.length;_++){let[D,ce]=C[E],[me,Ce]=C[_],oe=D[1]===ce[1],Le=me[1]===Ce[1];if(oe===Le)continue;let[Pe,xe]=oe?[[D,ce],[me,Ce]]:[[me,Ce],[D,ce]],_e=xe[0][0],Ue=Pe[0][1];_e>Math.min(Pe[0][0],Pe[1][0])&&_e<Math.max(Pe[0][0],Pe[1][0])&&Ue>Math.min(xe[0][1],xe[1][1])&&Ue<Math.max(xe[0][1],xe[1][1])&&he.push([_e,Ue])}let fe=E=>he.filter(([_,D])=>_>E.l-2&&_<E.r+2&&D>E.t-2&&D<E.b+2).length;for(let E of W){let _=E,D=E.points;if(!_.label||!D.length)continue;let ce=[];for(let xe=1;xe<D.length;xe++)ce.push([D[xe-1],D[xe]]);let me=xe=>Math.abs(xe[0][0]-xe[1][0])+Math.abs(xe[0][1]-xe[1][1]);ce.sort((xe,_e)=>me(_e)-me(xe));let Ce=e(_.label,"label")+6,oe=null,Le=null,Pe=1/0;for(let[xe,_e]of ce){let Ue=(xe[0]+_e[0])/2,mt=(xe[1]+_e[1])/2,ys=xe[1]===_e[1]?[0,-.3,.3,-.15,.15].flatMap(kt=>{let at=Ue+kt*Math.abs(xe[0]-_e[0]);return[[at,mt-6,"middle"],[at,mt+15,"middle"]]}):[0,-.3,.3].flatMap(kt=>{let at=mt+4+kt*Math.abs(xe[1]-_e[1]);return[[Ue+7,at,"start"],[Ue-7,at,"end"],[Ue+24,at,"start"],[Ue-24,at,"end"]]});for(let[kt,at,ht]of ys){let _n=ht==="middle"?kt-Ce/2:ht==="end"?kt-Ce:kt,Kt={l:_n,r:_n+Ce,t:at-11,b:at+3};if(!B(Kt)){oe=[kt,at,ht,Kt];break}let _t=P(Kt);_t<Pe&&(Pe=_t,Le=[kt,at,ht,Kt])}if(oe)break}if(!oe&&Le&&(oe=Le),!oe){let[xe,_e]=ce[0],Ue=(xe[0]+_e[0])/2,mt=(xe[1]+_e[1])/2-6;oe=[Ue,mt,"middle",{l:Ue-Ce/2,r:Ue+Ce/2,t:mt-11,b:mt+3}]}Ie.push(oe[3]),E.at={x:a(oe[0]),y:a(oe[1]),anchor:oe[2],box:oe[3],text:_.label}}let X=[],ne=[];for(let E of[...S,...Ie,...h.map(_=>_.title)])X.push(E.l,E.r),ne.push(E.t,E.b);for(let E of W)for(let _ of E.points)X.push(_[0]),ne.push(_[1]);let ye=i.margin,$e={l:Math.min(...X)-ye,t:Math.min(...ne)-ye,r:Math.max(...X)+ye,b:Math.max(...ne)+ye};return{cards:y,panels:h,links:W,bounds:$e,options:i,warnings:f}}function Ef(t,e,s){let r=o=>e>=o.l&&e<=o.r&&s>=o.t&&s<=o.b,i=t.cards.find(o=>r(o.rect));return i?i.id:[...t.panels].sort((o,n)=>n.depth-o.depth).find(o=>r(o.rect))?.id}function Kh(t,e,s,r={}){let i=a=>{let f=Hr(a,e,r);return Math.max(f.bounds.r-f.bounds.l,(f.bounds.b-f.bounds.t)*s)},o=t,n=i(t);for(let a=0;a<12;a++){let f,p=n;for(let c of Gh(o)){if(Xa(c).length)continue;let l=i(c);l<p-.5&&(p=l,f=c)}if(!f)break;o=f,n=p}return o}function*Gh(t){let e=t.panels??[],s=(n,a)=>n[0]>=a[0]&&n[2]<=a[2]&&n[1]>=a[1]&&n[3]<=a[3],r=(n,a)=>n.every((f,p)=>f===a[p]),i=(n,a=-1)=>{let f=-1;return e.forEach((p,c)=>{c===a||!s(n,p.cells)||a>=0&&c>a&&r(p.cells,e[a].cells)||(f<0||s(p.cells,e[f].cells)&&(!r(p.cells,e[f].cells)||c>f))&&(f=c)}),f},o=n=>{let a=[];return e.forEach((f,p)=>{i(f.cells,p)===n&&a.push({range:[...f.cells],panel:p})}),t.cards.forEach((f,p)=>{let c=[f.cell[0],f.cell[1],f.cell[0],f.cell[1]];i(c)===n&&a.push({range:c,card:p})}),a};for(let n of[-1,...e.map((a,f)=>f)]){let a=o(n);if(n>=0&&!a.some(l=>l.panel!==void 0))continue;let f=l=>[l.range[1],l.range[3]],p=[];for(let l of[...a].sort((d,m)=>d.range[1]-m.range[1]||d.range[0]-m.range[0])){let d=p.find(m=>m.some(h=>f(h)[0]<=f(l)[1]&&f(l)[0]<=f(h)[1]));d?d.push(l):p.push([l])}let c=Math.max(...a.map(l=>l.range[3]));for(let l of p){l.sort((d,m)=>d.range[0]-m.range[0]);for(let d=1;d<l.length;d++){let m=l.slice(d),h=l[0].range[0],y=c+1,g=Math.min(...m.map($=>$.range[1])),k=Math.max(...m.map($=>$.range[3]))-g+1,u=t.cards.map($=>({...$,cell:[...$.cell]})),b=e.map($=>({...$,cells:[...$.cells]}));for(let $ of u)$.cell[1]>c&&($.cell[1]+=k);let x=new Set;for(let $=n;$>=0&&!x.has($);$=i(e[$].cells,$))x.add($);b.forEach(($,v)=>{$.cells[1]>c?($.cells[1]+=k,$.cells[3]+=k):(x.has(v)||$.cells[1]<=c&&$.cells[3]>c)&&($.cells[3]+=k)});let w=h;for(let $ of m){let v=w-$.range[0],O=y+($.range[1]-g)-$.range[1],C=A=>A[0]>=$.range[0]&&A[0]<=$.range[2]&&A[1]>=$.range[1]&&A[1]<=$.range[3];t.cards.forEach((A,R)=>{C([A.cell[0],A.cell[1]])&&(u[R].cell=[A.cell[0]+v,A.cell[1]+O])}),e.forEach((A,R)=>{s(A.cells,$.range)&&(b[R].cells=[A.cells[0]+v,A.cells[1]+O,A.cells[2]+v,A.cells[3]+O])}),w+=$.range[2]-$.range[0]+1}e.forEach(($,v)=>{let O=t.cards.map((C,A)=>s([C.cell[0],C.cell[1],C.cell[0],C.cell[1]],$.cells)?u[A].cell:void 0).filter(C=>!!C);O.length&&(b[v].cells=[Math.min(...O.map(C=>C[0])),Math.min(...O.map(C=>C[1])),Math.max(...O.map(C=>C[0])),Math.max(...O.map(C=>C[1]))])}),yield{cards:u,panels:b,links:t.links}}}}}function Qa(t,e=()=>!0){let s=t.layout.items.filter(v=>e(v.id)),r=t.layout.catalog,i=!t.layout.items.some(v=>v.type==="node"),o=v=>i?!v.children.some(O=>e(O.id)):v.type==="node"&&!v.children.some(O=>O.type==="node"&&e(O.id)),n=s.filter(o),a=v=>{let O=[];for(let C=v;C;C=C.parent)O.unshift(C);return O},f=new Map(n.map(v=>[v.id,a(v)])),p=(v,O)=>{let C=f.get(v.id),A=f.get(O.id),R=0;for(;R<C.length&&R<A.length&&C[R]===A[R];)R++;return[C[R].box,A[R].box]},c=1e-6,l=(v,O)=>{let[C,A]=p(v,O);return C.y1<=A.y0+c&&C.x0<A.x1-c&&A.x0<C.x1-c},d=(v,O)=>{let[C,A]=p(v,O);return C.x1<=A.x0+c&&C.y0<A.y1-c&&A.y0<C.y1-c},m=(v,O)=>{let C=new Map,A=[];for(let R of[...n].sort((M,T)=>O(M)-O(T))){let M=0;for(let T of A)C.get(T.id)+1>M&&v(T,R)&&(M=C.get(T.id)+1);C.set(R.id,M),A.push(R)}return C},h=m(l,v=>v.box.y0),y=m(d,v=>v.box.x0),g=Math.min(...n.map(v=>v.box.x1-v.box.x0))/2;for(let v of n)if(!v.parent)for(let O of n)O.parent&&O.box.x0<=v.box.x0+g&&y.set(v.id,Math.max(y.get(v.id),y.get(O.id)));let k=new Map;for(let v of n)k.set(v.id,[y.get(v.id),h.get(v.id)]);let u=new Map;for(let v of n){let O=k.get(v.id),C=u.get(String(O));if(C!==void 0&&C!==v.id){for(let[,A]of k)A[0]>O[0]&&A!==O&&A[0]++;O[0]++,u.clear();for(let A of n)u.set(String(k.get(A.id)),A.id)}else u.set(String(O),v.id)}let b=n.map(v=>{if(v.region){let A=v.region;return{id:v.id,label:A.label??v.id,sub:void 0,role:A.role??Ot(r,A.kind)?.role??"grey",ghost:A.ghost||void 0,cell:k.get(v.id)}}let O=v.node,C=Tn(r,O.asset);return{id:v.id,label:O.label??v.id,sub:O.sub,role:O.role??C.role,ghost:O.ghost||void 0,cell:k.get(v.id)}}),x=[];for(let v of s){if(o(v))continue;let O=[],C=S=>{for(let N of S.children){let z=k.get(N.id);z&&O.push(z),C(N)}};if(C(v),!O.length)continue;let A=O.map(S=>S[0]),R=O.map(S=>S[1]),M=v.type==="region"?v.region.label:v.node.label??v.id,T=v.type==="region"?v.region.role??Ot(r,v.region.kind)?.role:v.node.role??Tn(r,v.node.asset).role;x.push({id:v.id,label:M,sub:v.type==="node"?v.node.sub:void 0,role:T,cells:[Math.min(...A),Math.min(...R),Math.max(...A),Math.max(...R)]})}let w=new Set([...b.map(v=>v.id),...x.map(v=>v.id)]),$=[];for(let v of t.routes){if(!e(v.id))continue;let O=wn(v.raw.from).id,C=wn(v.raw.to).id;if(!w.has(O)||!w.has(C))continue;let A=typeof v.raw.label=="string"?v.raw.label:v.raw.label?.text;$.push({id:v.id,a:O,b:C,kind:v.kind,label:A})}return{cards:b,panels:x,links:$}}var qs={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},Nf=`
|
|
288
290
|
.blk .card-name{font-size:13px;font-weight:600;fill:var(--ink)}
|
|
289
291
|
.blk .card-sub{font-size:10px;fill:var(--ink);opacity:.75}
|
|
290
292
|
.blk.ghost .card-name,.blk.ghost .card-sub{fill:var(--muted)}
|
|
291
|
-
`;function Ec(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[Fs.W,Fs.D,Fs.H],role:"grey",draw(e,s,r){let i=t(r.id),o=e.blockFaces(s);if(!i)return o;let n=s.z1-s.z0;return o+=e.faceText(s.x0+.2,s.y1,s.z0+(i.sub?n*.52:n*.34),i.label,"card-name",wt.lbl,"left","start"),i.sub&&(o+=e.faceText(s.x0+.2,s.y1,s.z0+n*.14,i.sub,"card-sub",wt.sub,"left","start")),o}}}function cd(t){let e=new Map(t.cards.map(s=>[s.id,{label:s.label,sub:s.sub}]));return{regions:{panel:{shape:"slab",pad:Fs.PAD,z:[Fs.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:Ec(s=>e.get(s))},defaultNode:"card"}}function pd(t,e={}){let s=Fs,{prect:r,parentIx:i,cardAt:o}=Wi(t,{W:s.W,H:s.D,GX:s.GX,GY:s.GY,PAD:s.PAD,TITLE:0,CH:s.CH}),n=t.panels??[],a=u=>Math.round(u*1e3)/1e3,m=u=>(u.cells[2]-u.cells[0]+1)*(u.cells[3]-u.cells[1]+1),p=u=>{let y=-1;return n.forEach((g,x)=>{let h=g.cells;u.cell[0]>=h[0]&&u.cell[0]<=h[2]&&u.cell[1]>=h[1]&&u.cell[1]<=h[3]&&(y<0||m(g)<=m(n[y]))&&(y=x)}),y},c=n.map((u,y)=>{let g=r[y],x=i[y]>=0?r[i[y]]:{l:0,t:0};return{id:u.id,kind:"panel",label:u.label,role:u.role,at:[a(g.l-x.l),a(g.t-x.t)],size:[a(g.r-g.l),a(g.b-g.t)],regions:[],nodes:[]}}),l=[],f=[];c.forEach((u,y)=>i[y]>=0?c[i[y]].regions.push(u):l.push(u));for(let u of t.cards){let[y,g]=o(t.cards.indexOf(u)),x=p(u),h=x>=0?r[x]:{l:0,t:0},b={id:u.id,asset:"card",role:u.role,ghost:u.ghost||void 0,at:[a(y-h.l),a(g-h.t)],size:[s.W,s.D,s.H]};(x>=0?c[x].nodes:f).push(b)}for(let u of c)u.regions.length||delete u.regions,u.nodes.length||delete u.nodes;let d=(t.links??[]).map((u,y)=>({id:u.id??`link-${y}`,from:u.aOn??u.a,to:u.bOn??u.b,kind:u.kind,label:u.label}));return{isodiag:1,title:e.title,kinds:e.kinds,roles:e.roles,scenes:[{id:"board",title:e.title??"board",regions:l,nodes:f,routes:d}]}}var Jd={};co(Jd,{APPEARS:()=>hd,BASE_FIELDS:()=>Vc,BINS:()=>vd,BIN_MS:()=>Rn,CARD:()=>vt,DUAL_VIEW_CSS:()=>Wd,IDLES:()=>yd,MAX_ZOOM:()=>Da,MIN_ZOOM:()=>Fa,P3:()=>st,SEGMENT_NAME:()=>Va,SEVERITIES:()=>mn,TIMELINE_VERSION:()=>Sd,activityOf:()=>Hc,attr:()=>Wn,binNext:()=>Ha,binStart:()=>sr,buildLayer:()=>no,cardMotion:()=>gd,clamp:()=>Ss,cls:()=>wd,crumbs:()=>Ur,dualView:()=>Ud,ease:()=>to,escapeName:()=>Za,extent:()=>Ba,findGaps:()=>Wa,fitWithOverlay:()=>xd,flatCss:()=>qd,flatSvg:()=>nl,formatScope:()=>Md,gapKey:()=>ir,gapLabel:()=>rr,h:()=>me,hasSegment:()=>Ad,highlights:()=>Qi,isZone:()=>Nd,isoVars:()=>kd,join:()=>Pd,kindOf:()=>Gr,legend:()=>qc,levelOf:()=>Jt,markConnectors:()=>il,md:()=>fs,measureIn:()=>sl,memorySource:()=>jd,modeFor:()=>Yc,morphSvgs:()=>Zd,mountTimeline:()=>Dd,n:()=>zc,nameOf:()=>Zr,node:()=>bd,offsetAt:()=>tn,overlayPaint:()=>md,parentOf:()=>Od,prefixAt:()=>$s,prune:()=>jc,pts:()=>Ji,rangeOf:()=>Xi,readTime:()=>Kc,rectOf:()=>Vd,renderPage:()=>$d,rewrite:()=>Cc,scope:()=>_c,scopePattern:()=>Ka,scopeRules:()=>Ga,scopeSelector:()=>Lc,searchFor:()=>Yr,severities:()=>Td,stepData:()=>Bc,storedMode:()=>Yd,ticks:()=>Ja,timeScale:()=>Hr,toCSV:()=>Qa,toJSON:()=>Xa,unite:()=>qa,viewToggle:()=>Hd,viewport:()=>dd,within:()=>un});function th(t,e,s){let i=(a,m,p,c,l)=>Math.min((a-48)/(p-m),...c===void 0||l===void 0?[]:[[l-c,12],[l-m,30],[p-c,30]].map(([f,d])=>f>0?(a-d)/f:1/0)),o=Math.min(Da,Math.max(Fa,Math.min(i(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),i(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)))),n=(a,m,p,c,l)=>{let f=(m+p)/2;if(c===void 0||l===void 0)return f;let d=l-(a/2-6)/o,u=c+(a/2-6)/o;return d>u?(d+u)/2:Math.max(d,Math.min(u,f))};return{k:o,cx:n(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),cy:n(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)}}var Fa=.1,Da=8;function dd(t,e){let s,r,i=!1,o=0,n=0,a=0,m=0,p=0,c=!1,l=()=>{let v=t.getBoundingClientRect();return{w:Math.max(1,v.width),h:Math.max(1,v.height)}},f=(v=s)=>{let T=l();return Math.min(T.w/v.w,T.h/v.h)},d=v=>{o++;try{v()}finally{o--}};function u(){let v=e.svg();if(!v||!s)return;o||(i=!0);let T=l(),R=f(),O=T.w/R,I=T.h/R;s={x:s.x+(s.w-O)/2,y:s.y+(s.h-I)/2,w:O,h:I},v.setAttribute("viewBox",`${s.x.toFixed(2)} ${s.y.toFixed(2)} ${s.w.toFixed(2)} ${s.h.toFixed(2)}`),n=R,e.onApply(R),a&&Math.abs(R/a-1)>.02&&(cancelAnimationFrame(m),m=requestAnimationFrame(()=>{m=0,e.onRezoom()}))}let y=(v,T)=>{let R=t.getBoundingClientRect(),O=f();return{x:s.x+(v-R.left)/O,y:s.y+(T-R.top)/O}};function g(v,T,R){if(!s)return;let O=f(),I=Math.min(Da,Math.max(Fa,O*v)),M=t.getBoundingClientRect(),A=T??M.left+M.width/2,P=R??M.top+M.height/2,j=y(A,P),F=l();s={x:j.x-(A-M.left)/I,y:j.y-(P-M.top)/I,w:F.w/I,h:F.h/I},u()}function x(v=r,T){if(!v)return;let R=l(),{k:O,cx:I,cy:M}=th(R,v,T),A={x:I-R.w/O/2,y:M-R.h/O/2,w:R.w/O,h:R.h/O};if(s&&Math.abs(A.w/s.w-1)<.001&&Math.abs(A.h/s.h-1)<.001&&Math.abs(A.x-s.x)<A.w*.001&&Math.abs(A.y-s.y)<A.h*.001){u();return}s=A,u()}function h(){for(let v=0,T="";v<4;v++){let R=e.itemsBox()??r;if(!R)return;let O=[R.x,R.y,R.w,R.h].map(M=>Math.round(M)).join();if(O===T)break;T=O;let I=Math.max(24,Math.min(R.w,R.h)*.06);if(d(()=>x({x:R.x-I,y:R.y-I,w:R.w+I*2,h:R.h+I*2},e.alsoBox?.())),!e.marksShowing()||!a||Math.abs(f()/a-1)<=.02)break;cancelAnimationFrame(m),m=0,e.onRezoom()}i=!1}function b(){if(i||!e.svg()||!s)return;let v=t.getBoundingClientRect();v.width<2||v.height<2||h()}function w(){if(!s)return;let v=f();g(1/v)}function k(){return new Promise(v=>{let T=0,R=n,O=()=>{if(c){v();return}let I=!!(m||p)||n!==R;R=n,T=I?0:T+1,T>=2?v():requestAnimationFrame(O)};requestAnimationFrame(O)})}let $=new ResizeObserver(()=>{if(!(!s||c)){if(i&&n){let v=l(),T=s.x+s.w/2,R=s.y+s.h/2;s={x:T-v.w/n/2,y:R-v.h/n/2,w:v.w/n,h:v.h/n}}i||(cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=0,c||b()})),d(u)}});return $.observe(t),{get view(){return s},set view(v){s=v},get full(){return r},set full(v){r=v},get moved(){return i},get zoom(){return n},painted(v){a=v},size:l,scale:f,quietly:d,applyView:u,toSvg:y,zoomAt:g,fit:x,fitItems:h,autoFit:b,actual:w,settled:k,dispose(){cancelAnimationFrame(p),cancelAnimationFrame(m),$.disconnect(),c=!0}}}var At="http://www.w3.org/2000/svg",vt={half:2.4,h:3.2,t:.25,above:1.4,lift:3.8,fan:.32,gap:.3},st=(t,e,s)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],Ji=t=>t.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" ");function md(t,e){function s(o,n,a){let m=t.k(),p=(l,f,d,u,y="")=>{let g=o.createElementNS(At,"g");g.setAttribute("class",`live-badge ${d.cls} ${y}`.trim());let x=8/m,h=o.createElementNS(At,"circle");if(h.setAttribute("cx",String(l)),h.setAttribute("cy",String(f)),h.setAttribute("r",String(x)),g.append(h),"g"in d){let w=o.createElementNS(At,"text");w.setAttribute("x",String(l)),w.setAttribute("y",String(f)),w.style.fontSize=`${(10/m).toFixed(2)}px`,w.textContent=d.g,g.append(w)}else{let w=o.createElementNS(At,"use");w.setAttribute("href",t.iconHref(d.icon));let k=11/m;w.setAttribute("x",String(l-k/2)),w.setAttribute("y",String(f-k/2)),w.setAttribute("width",String(k)),w.setAttribute("height",String(k)),g.append(w)}let b=o.createElementNS(At,"title");b.textContent=u,g.append(b),n(g)},c=(l,f)=>{for(let d of t.outlinesFor(l)){if(d.kind!=="poly")continue;let u=o.createElementNS(At,"polygon");u.setAttribute("class",f),u.setAttribute("points",d.points.map(([y,g])=>`${y.toFixed(1)},${g.toFixed(1)}`).join(" ")),n(u)}};for(let l of a){let f=t.boxOf(l.at);if(f){if(l.outline&&c(l.at,l.outline),l.badge)p(f.x,f.y,l.badge,l.title);else if(l.hit){let d=o.createElementNS(At,"title");d.textContent=l.title;let u=o.createElementNS(At,"rect");u.setAttribute("class","live-hit"),u.setAttribute("x",String(f.x)),u.setAttribute("y",String(f.y)),u.setAttribute("width",String(f.w)),u.setAttribute("height",String(f.h)),u.append(d),n(u)}if((l.beside??[]).forEach((d,u)=>p(f.x+18*(u+1)/m,f.y,d.glyph,d.title)),l.dot&&p(f.x,f.y+f.h,l.dot.glyph,l.dot.title),l.tag){let d=o.createElementNS(At,"text");d.setAttribute("class",`live-life ${l.tag.cls}`),d.setAttribute("x",String(f.x+f.w)),d.setAttribute("y",String(f.y+f.h)),d.style.fontSize=`${(9/m).toFixed(2)}px`,d.textContent=l.tag.text,n(d)}}}}function r(o,n,a){for(let m of a){let p=o.createElementNS(At,"g");p.setAttribute("class",`live-extra${m.cls}`);for(let[b,w]of m.data)p.setAttribute(b,w);let{x:c,y:l,w:f,hgt:d,k:u}=m.rect,y=o.createElementNS(At,"rect");y.setAttribute("x",String(c)),y.setAttribute("y",String(l)),y.setAttribute("width",String(f)),y.setAttribute("height",String(d)),y.setAttribute("rx",String(6/u));let g=o.createElementNS(At,"text");g.setAttribute("x",String(c+8/u)),g.setAttribute("y",String(l+13/u)),g.style.fontSize=`${(11/u).toFixed(2)}px`,g.textContent=m.line1;let x=o.createElementNS(At,"text");x.setAttribute("class","sub"),x.setAttribute("x",String(c+8/u)),x.setAttribute("y",String(l+27/u)),x.style.fontSize=`${(9/u).toFixed(2)}px`,x.textContent=m.line2;let h=o.createElementNS(At,"title");h.textContent=m.title,p.append(y,g,x,h),n(p)}}function i(o,n,a){let m=[];for(let p of a){let c=p.over,l=(c.x0+c.x1)/2,f=(c.y0+c.y1)/2,d=0,u={x0:0,y0:0,x1:0,y1:0};for(let C=0;C<6;C++){let G=c.z1+vt.above+d,Z=G+vt.h,Q=[st(l-vt.half,f+vt.t,G),st(l+vt.half,f+vt.t,G),st(l+vt.half,f-vt.t,Z),st(l-vt.half,f+vt.t,Z)];if(u={x0:Math.min(...Q.map(z=>z[0])),y0:Math.min(...Q.map(z=>z[1])),x1:Math.max(...Q.map(z=>z[0])),y1:Math.max(...Q.map(z=>z[1]))},!ja(u,m))break;d+=vt.lift}m.push(u);let y=c.z1+vt.above+d,g=y+vt.h,x=l-vt.half,h=l+vt.half,b=f+vt.t,w=f-vt.t,k=o.createElementNS(At,"g");k.setAttribute("class",`${e}-card${p.cls}`);for(let[C,G]of p.data)k.setAttribute(C,G);let[$,v]=st(l,f,c.z1+.15),T=`${$.toFixed(1)}px ${v.toFixed(1)}px`;k.style.transformOrigin=T;let R=o.createElementNS(At,"g");R.setAttribute("class",`${e}-float`),R.style.transformOrigin=T;let O=[];for(let C=Math.min(p.count-1,3);C>=1;C--){let G=C*vt.fan,Z=w-(C-1)*(2*vt.t+vt.gap)-vt.gap,Q=Z-2*vt.t,z=x+G,D=h+G,V=y+G,W=g+G,de=(ce,H)=>{let ne=o.createElementNS(At,"polygon");ne.setAttribute("class",`${e}-face stacked ${ce}`),ne.setAttribute("points",Ji(H)),R.append(ne)};de("s-top",[st(z,Q,W),st(D,Q,W),st(D,Z,W),st(z,Z,W)]),de("s-side",[st(D,Q,V),st(D,Z,V),st(D,Z,W),st(D,Q,W)]),de("s-front",[st(z,Z,V),st(D,Z,V),st(D,Z,W),st(z,Z,W)]),O.push({x0:z,x1:D,y0:Q,y1:Z,z0:V,z1:W})}let I=o.createElementNS(At,"polygon");I.setAttribute("class",`${e}-tail`),I.setAttribute("points",Ji([st(l-.5,b,y+.05),st(l+.5,b,y+.05),st(l,f,c.z1+.15)]));let M=(C,G)=>{let Z=o.createElementNS(At,"polygon");return Z.setAttribute("class",C),Z.setAttribute("points",Ji(G)),Z},A=M(`${e}-face front`,[st(x,b,y),st(h,b,y),st(h,b,g),st(x,b,g)]);R.append(I,M(`${e}-face top`,[st(x,w,g),st(h,w,g),st(h,b,g),st(x,b,g)]),M(`${e}-face side`,[st(h,w,y),st(h,b,y),st(h,b,g),st(h,w,g)]),A);let[P,j]=st(x,b,g),F=40,Y=o.createElementNS(At,"g");Y.setAttribute("transform",`matrix(${(Ct*lt/F).toFixed(4)} ${(.5*lt/F).toFixed(4)} 0 ${(lt/F).toFixed(4)} ${P.toFixed(1)} ${j.toFixed(1)})`);let J=(C,G,Z,Q)=>{let z=o.createElementNS(At,"text");return z.setAttribute("class",C),z.setAttribute("x",String(G)),z.setAttribute("y",String(Z)),z.textContent=Q,z};if(Y.append(J(`${e}-mark`,34,98,p.mark),J(`${e}-who`,70,52,p.who),J(`${e}-age`,70,82,p.age)),p.line!==void 0&&Y.append(J(`${e}-q`,12,118,p.line)),p.count>1){let C=o.createElementNS(At,"circle");C.setAttribute("class",`${e}-count-bg`),C.setAttribute("cx","178"),C.setAttribute("cy","14"),C.setAttribute("r","15"),Y.append(C,J(`${e}-count`,178,14,String(p.count)))}R.append(Y);let U=o.createElementNS(At,"title");U.textContent=p.title,k.append(R,U),t.onCard?.(k,{cx:l,cy:f,tipZ:c.z1+.15,card:{x0:x,x1:h,y0:w,y1:b,z0:y,z1:g},panes:O.reverse()}),n(k)}}return{paintMarks:s,paintGhosts:r,paintCards:i}}var hd=[["scale","Scale"],["spin","Spin"],["dissolve","Dissolve"],["inflate","Inflate"]],yd=[["none","None"],["jiggle","Jiggle"],["pirouette","Pirouette"],["glow","Glow"],["breathe","Breathe"]];function nh(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0)%1e3/1e3}var Nc=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),ud=t=>t<0?0:t>1?1:t*t*t,Rc=Math.PI*2,Ic={appear:{scale:420,spin:760,dissolve:520,inflate:640},disappear:{scale:320,spin:600,dissolve:420,inflate:420},period:{jiggle:4200,pirouette:6400,glow:3200,breathe:4400}},Nn={windup:220,turn:980,land:260};function gd(t,e,{prefix:s,key:r,alt:i}){let o={...e},n=1,a=new Map,m=new WeakSet,p=0,c=0,l=new WeakMap,f=new WeakMap;function d(I){p=0;for(let[M,A]of a){if(!M.isConnected){a.delete(M);continue}let P;if(A.repeat){if(P=(I+(A.offset??0))%A.repeat/A.dur,P>1){m.has(M)&&(t.restore(M),m.delete(M),M.style.removeProperty("transform"));continue}}else if(P=(I-A.start)/A.dur,P>=1){u(M,A);continue}let j=A.frame(Math.max(0,P));t.spin(M,j.theta,j.lift),m.add(M),f.set(M,j),j.scale!==1?M.style.transform=`scale(${j.scale.toFixed(4)})`:M.style.removeProperty("transform"),c++}a.size&&(p=requestAnimationFrame(d))}function u(I,M){a.delete(I),m.has(I)&&(t.restore(I),m.delete(I)),I.style.removeProperty("transform"),M.done?.()}function y(I){let M=a.get(I.card);M&&u(I.card,M),a.set(I.card,I),p||(p=requestAnimationFrame(d))}let g=8,x=0,h=I=>(x++,I.finally(()=>{x--}));function b(I){return!o.enabled||x>=g?Promise.resolve():h(k(I))}function w(I){return!o.enabled||x>=g?Promise.resolve():h($(I))}function k(I){let M=Ic.appear[o.appear]/n;if(o.appear==="spin")return new Promise(j=>y({card:I,start:performance.now(),dur:M,frame:F=>({theta:(1-Nc(F))*Rc,lift:0,scale:Math.max(.001,Nc(F))}),done:j}));let A=o.appear==="scale"?[{transform:"scale(0)"},{transform:"scale(1)"}]:o.appear==="dissolve"?[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}]:[{transform:"scale(0)",easing:"cubic-bezier(.3,0,.4,1)"},{transform:"scale(1.16)",offset:.55,easing:"ease-in-out"},{transform:"scale(.95)",offset:.78,easing:"ease-in-out"},{transform:"scale(1)"}];return I.animate(A,{duration:M,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function $(I){let M=Ic.disappear[o.appear]/n;if(o.appear==="spin")return new Promise(j=>y({card:I,start:performance.now(),dur:M,frame:F=>({theta:ud(F)*Rc,lift:0,scale:Math.max(.001,1-ud(F))}),done:()=>{I.style.transform="scale(0)",j()}}));let A=o.appear==="scale"?[{transform:"scale(1)"},{transform:"scale(0)"}]:o.appear==="dissolve"?[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}]:[{transform:"scale(1)"},{transform:"scale(1.08)",offset:.3},{transform:"scale(0)"}];return I.animate(A,{duration:M,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function v(I){l.get(I)?.cancel(),l.delete(I);let M=a.get(I);M?.repeat&&u(I,M)}function T(I,M){if(v(I),!o.enabled||o.idle==="none"||I.classList.contains("still"))return;let A=I.getAttribute(r)??I.getAttribute(i)??"",P=(M??Ic.period[o.idle])/n,j=nh(A)*P;if(o.idle==="pirouette"){let C=(Nn.windup+Nn.turn+Nn.land)/n,G=Nn.windup/(Nn.windup+Nn.turn+Nn.land),Z=(Nn.windup+Nn.turn)/(Nn.windup+Nn.turn+Nn.land);y({card:I,start:0,dur:C,repeat:P,offset:j,frame:Q=>{if(Q<G)return{theta:-.35*Math.sin(Q/G*Math.PI/2),lift:0,scale:1};if(Q<Z){let D=(Q-G)/(Z-G);return{theta:-.35*(1-D)+Nc(D)*Rc,lift:.9*Math.sin(D*Math.PI),scale:1}}let z=(Q-Z)/(1-Z);return{theta:0,lift:0,scale:1-.04*Math.sin(z*Math.PI)}}});return}let F=I.querySelector(`.${s}-float`)??I,Y=t.amber(),J=o.idle==="jiggle"?[{transform:"scale(1)",offset:0},{transform:"scale(1.07)",offset:.04},{transform:"scale(.97)",offset:.08},{transform:"scale(1.02)",offset:.11},{transform:"scale(1)",offset:.14},{transform:"scale(1)",offset:1}]:o.idle==="glow"?[{filter:`drop-shadow(0 0 0px ${Y})`},{filter:`drop-shadow(0 0 7px ${Y})`},{filter:`drop-shadow(0 0 0px ${Y})`}]:[{transform:"scale(1)"},{transform:"scale(1.035)"},{transform:"scale(1)"}],U=F.animate(J,{duration:P,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});U.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+j)%P,l.set(I,U)}function R(I,M,A,P,j=!1){j&&(P=!1);for(let[Y,J]of M)!I.has(Y)&&!j&&b(J),!l.has(J)&&!a.get(J)?.repeat&&T(J);if(!o.enabled||!P)return;let F=t.leavingLayer();if(F)for(let[Y,J]of A){let U=I.get(Y);!U||M.has(Y)||(v(U),U.setAttribute("class",`${s}-leaving${J?" expired":""}`),U.removeAttribute(i),F.append(U),w(U).then(()=>U.remove()))}}function O(I){for(let[M,A]of[...a])u(M,A);p&&cancelAnimationFrame(p),p=0;for(let M of document.getAnimations())M.effect?.target?.closest?.(`.live-layer, .${s}-leaving-layer`)&&M.cancel();t.leavingLayer()?.replaceChildren()}return{get settings(){return{...o}},set(I,M){let A=o;if(o={...o,...I},(!o.enabled||A.idle!==o.idle||A.enabled!==o.enabled)&&(O(void 0),o.enabled))for(let P of M)T(P)},update:R,appear:b,disappear:w,startIdle:T,stopIdle:v,stopAll:O,async preview(I){o.enabled&&await Promise.all(I.map(async M=>{if(v(M),await b(M),o.idle!=="none"&&!M.classList.contains("still")){let A=o.idle==="pirouette"?1800:1400;T(M,A),await new Promise(P=>setTimeout(P,A*2.2/n)),v(M)}else await new Promise(A=>setTimeout(A,700/n));await w(M);for(let A of M.getAnimations())A.cancel();M.style.removeProperty("transform"),T(M)}))},get stats(){return{jobs:a.size,raf:!!p,frames:c,effects:x}},setSpeed(I){n=I},lastFrame:I=>f.get(I)}}var zc=t=>String(Math.round(t*100)/100),bd=(t,e={},...s)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?zc(i):i]),children:s});function Cc(t,e){if(typeof t=="string")return t;let s=t.attrs.map(([r,i])=>{if(r==="id")return[r,e+i];let o=i.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1").replace(/url\(\s*(['"]?)#/g,(n,a)=>`url(${a}#${e}`);return(r==="href"||r==="xlink:href")&&o.startsWith("#")&&!o.startsWith(`#${e}`)&&(o=`#${e}${o.slice(1)}`),[r,o]});return{name:t.name,attrs:s,children:t.children.map(r=>Cc(r,e))}}function jc(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(s=>jc(s,e)).filter(s=>s!==void 0)}}var wd=t=>(t.attrs.find(e=>e[0]==="class")?.[1]??"").split(/\s+/),Wn=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1];function Ba(t){let e=[],s=[],r=n=>{if(typeof n=="string")return;let a=Wn(n,"transform");if(a&&/matrix/.test(a))return;let m=Wn(n,"points");if(m)for(let p of m.trim().split(/\s+/)){let[c,l]=p.split(",").map(Number);Number.isFinite(c)&&Number.isFinite(l)&&(e.push(c),s.push(l))}if(n.name==="rect"){let p=Number(Wn(n,"x")),c=Number(Wn(n,"y")),l=Number(Wn(n,"width")),f=Number(Wn(n,"height"));[p,c,l,f].every(Number.isFinite)&&(e.push(p,p+l),s.push(c,c+f))}if(n.name==="circle"){let p=Number(Wn(n,"cx")),c=Number(Wn(n,"cy")),l=Number(Wn(n,"r"));[p,c,l].every(Number.isFinite)&&(e.push(p-l,p+l),s.push(c-l,c+l))}n.children.forEach(r)};if(t.forEach(r),!e.length)return;let i=Math.min(...e),o=Math.min(...s);return{x:i,y:o,w:Math.max(...e)-i,h:Math.max(...s)-o}}var qa=(t,e)=>{if(!e)return t;let s=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:s,y:r,w:Math.max(t.x+t.w,e.x+e.w)-s,h:Math.max(t.y+t.h,e.y+e.h)-r}};function xd(t,e,s){let r=a=>Math.min((e.width-e.pad*2)/a.w,(e.height-e.pad*2)/a.h),i=r(t),o=s(i),n=qa(t,Ba(o));return i=r(n),o=s(i),n=qa(t,Ba(o)),i=r(n),{k:i,box:n,live:o}}var kd=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function sh(t){let e=[],s=0,r=t.replace(/\/\*[\s\S]*?\*\//g,"");for(;s<r.length;){let i=r.indexOf("{",s);if(i<0)break;let o=1,n=i+1;for(;n<r.length&&o;)r[n]==="{"?o++:r[n]==="}"&&o--,n++;e.push([r.slice(s,i).trim(),r.slice(i+1,n-1)]),s=n}return e}function rh(t){let e=[],s=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("||o==="["?s++:o===")"||o==="]"?s--:o===","&&!s&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e.filter(Boolean)}function Lc(t,e,s){let r=/^:root((?:\[[^\]]*\]|:not\([^)]*\))*)(.*)$/.exec(t),i=s.replace(/^\./,"");if(r){let o=r[1],n=r[2].trim();return`${o?`.${i}${o} `:""}${e}${n?" "+n:""}`}if(/^(html|body|\*)\b/.test(t)||/^[a-z]+$/.test(t)&&!/^(svg|g|text|path|polygon|rect|circle|line)$/.test(t))throw new Error(`the canvas's CSS can't style the page: "${t}"`);return`${e} ${t}`}function _c(t,e,s){let r="";for(let[i,o]of sh(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
|
|
292
|
-
`;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${
|
|
293
|
-
`;continue}if(i.startsWith("@"))throw new Error(`the canvas's CSS has an at-rule it can't scope: ${i}`);r+=`${
|
|
294
|
-
`}return r}var
|
|
295
|
-
<button class="pbtn small" type="button" data-a="grid" aria-pressed="${
|
|
293
|
+
`;function Xc(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[qs.W,qs.D,qs.H],role:"grey",draw(e,s,r){let i=t(r.id),o=e.blockFaces(s);if(!i)return o;let n=s.z1-s.z0;return o+=e.faceText(s.x0+.2,s.y1,s.z0+(i.sub?n*.52:n*.34),i.label,"card-name",wt.lbl,"left","start"),i.sub&&(o+=e.faceText(s.x0+.2,s.y1,s.z0+n*.14,i.sub,"card-sub",wt.sub,"left","start")),o}}}function Rf(t){let e=new Map(t.cards.map(s=>[s.id,{label:s.label,sub:s.sub}]));return{regions:{panel:{shape:"slab",pad:qs.PAD,z:[qs.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:Xc(s=>e.get(s))},defaultNode:"card"}}function If(t,e={}){let s=qs,{prect:r,parentIx:i,cardAt:o}=no(t,{W:s.W,H:s.D,GX:s.GX,GY:s.GY,PAD:s.PAD,TITLE:0,CH:s.CH}),n=t.panels??[],a=h=>Math.round(h*1e3)/1e3,f=h=>(h.cells[2]-h.cells[0]+1)*(h.cells[3]-h.cells[1]+1),p=h=>{let y=-1;return n.forEach((g,k)=>{let u=g.cells;h.cell[0]>=u[0]&&h.cell[0]<=u[2]&&h.cell[1]>=u[1]&&h.cell[1]<=u[3]&&(y<0||f(g)<=f(n[y]))&&(y=k)}),y},c=n.map((h,y)=>{let g=r[y],k=i[y]>=0?r[i[y]]:{l:0,t:0};return{id:h.id,kind:"panel",label:h.label,role:h.role,at:[a(g.l-k.l),a(g.t-k.t)],size:[a(g.r-g.l),a(g.b-g.t)],regions:[],nodes:[]}}),l=[],d=[];c.forEach((h,y)=>i[y]>=0?c[i[y]].regions.push(h):l.push(h));for(let h of t.cards){let[y,g]=o(t.cards.indexOf(h)),k=p(h),u=k>=0?r[k]:{l:0,t:0},b={id:h.id,asset:"card",role:h.role,ghost:h.ghost||void 0,at:[a(y-u.l),a(g-u.t)],size:[s.W,s.D,s.H]};(k>=0?c[k].nodes:d).push(b)}for(let h of c)h.regions.length||delete h.regions,h.nodes.length||delete h.nodes;let m=(t.links??[]).map((h,y)=>({id:h.id??`link-${y}`,from:h.aOn??h.a,to:h.bOn??h.b,kind:h.kind,label:h.label}));return{isodiag:1,title:e.title,kinds:e.kinds,roles:e.roles,scenes:[{id:"board",title:e.title??"board",regions:l,nodes:d,routes:m}]}}var Pm={};yo(Pm,{APPEARS:()=>_f,BASE_FIELDS:()=>mp,BINS:()=>Qf,BIN_MS:()=>Cn,CARD:()=>Mt,DUAL_VIEW_CSS:()=>Mm,IDLES:()=>Ff,MAX_ZOOM:()=>tl,MIN_ZOOM:()=>el,P3:()=>st,PLAY_CSS:()=>Jf,SEGMENT_NAME:()=>al,SEVERITIES:()=>un,TIMELINE_VERSION:()=>Xf,activityOf:()=>wp,attr:()=>Qn,binNext:()=>ml,binStart:()=>lr,buildLayer:()=>lo,cardMotion:()=>Df,clamp:()=>Ps,cls:()=>qf,crumbs:()=>Jr,dualView:()=>$m,ease:()=>ao,escapeName:()=>pl,extent:()=>nl,findGaps:()=>ul,fitWithOverlay:()=>Vf,flatCss:()=>gm,flatSvg:()=>xl,formatScope:()=>em,gapKey:()=>pr,gapLabel:()=>cr,h:()=>re,hasSegment:()=>sm,highlights:()=>io,isZone:()=>om,isoVars:()=>Kf,join:()=>tm,kindOf:()=>Yr,legend:()=>dp,levelOf:()=>Jt,markConnectors:()=>Sl,md:()=>Sn,measureIn:()=>kl,memorySource:()=>dm,modeFor:()=>bp,morphSvgs:()=>km,mountPlayer:()=>Wf,mountTimeline:()=>hm,n:()=>np,nameOf:()=>Wr,node:()=>Bf,offsetAt:()=>nn,overlayPaint:()=>jf,pageClock:()=>fp,parentOf:()=>nm,prefixAt:()=>Ms,prune:()=>rp,pts:()=>so,rangeOf:()=>ro,readTime:()=>up,rectOf:()=>bm,renderPage:()=>Zf,rewrite:()=>sp,scope:()=>op,scopePattern:()=>ll,scopeRules:()=>cl,scopeSelector:()=>ip,searchFor:()=>Xr,severities:()=>rm,stepData:()=>pp,storedMode:()=>Sm,ticks:()=>hl,timeScale:()=>Qr,toCSV:()=>gl,toJSON:()=>yl,transport:()=>rl,unite:()=>sl,viewToggle:()=>vm,viewport:()=>Cf,within:()=>hn});function Zh(t,e,s){let i=(a,f,p,c,l)=>Math.min((a-48)/(p-f),...c===void 0||l===void 0?[]:[[l-c,12],[l-f,30],[p-c,30]].map(([d,m])=>d>0?(a-m)/d:1/0)),o=Math.min(tl,Math.max(el,Math.min(i(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),i(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)))),n=(a,f,p,c,l)=>{let d=(f+p)/2;if(c===void 0||l===void 0)return d;let m=l-(a/2-6)/o,h=c+(a/2-6)/o;return m>h?(m+h)/2:Math.max(m,Math.min(h,d))};return{k:o,cx:n(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),cy:n(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)}}var el=.1,tl=8;function Cf(t,e){let s,r,i=!1,o=0,n=0,a=0,f=0,p=0,c=!1,l=()=>{let v=t.getBoundingClientRect();return{w:Math.max(1,v.width),h:Math.max(1,v.height)}},d=(v=s)=>{let O=l();return Math.min(O.w/v.w,O.h/v.h)},m=v=>{o++;try{v()}finally{o--}};function h(){let v=e.svg();if(!v||!s)return;o||(i=!0);let O=l(),C=d(),A=O.w/C,R=O.h/C;s={x:s.x+(s.w-A)/2,y:s.y+(s.h-R)/2,w:A,h:R},v.setAttribute("viewBox",`${s.x.toFixed(2)} ${s.y.toFixed(2)} ${s.w.toFixed(2)} ${s.h.toFixed(2)}`),n=C,e.onApply(C),a&&Math.abs(C/a-1)>.02&&(cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=0,e.onRezoom()}))}let y=(v,O)=>{let C=t.getBoundingClientRect(),A=d();return{x:s.x+(v-C.left)/A,y:s.y+(O-C.top)/A}};function g(v,O,C){if(!s)return;let A=d(),R=Math.min(tl,Math.max(el,A*v)),M=t.getBoundingClientRect(),T=O??M.left+M.width/2,S=C??M.top+M.height/2,N=y(T,S),z=l();s={x:N.x-(T-M.left)/R,y:N.y-(S-M.top)/R,w:z.w/R,h:z.h/R},h()}function k(v=r,O){if(!v)return;let C=l(),{k:A,cx:R,cy:M}=Zh(C,v,O),T={x:R-C.w/A/2,y:M-C.h/A/2,w:C.w/A,h:C.h/A};if(s&&Math.abs(T.w/s.w-1)<.001&&Math.abs(T.h/s.h-1)<.001&&Math.abs(T.x-s.x)<T.w*.001&&Math.abs(T.y-s.y)<T.h*.001){h();return}s=T,h()}function u(){for(let v=0,O="";v<4;v++){let C=e.itemsBox()??r;if(!C)return;let A=[C.x,C.y,C.w,C.h].map(M=>Math.round(M)).join();if(A===O)break;O=A;let R=Math.max(24,Math.min(C.w,C.h)*.06);if(m(()=>k({x:C.x-R,y:C.y-R,w:C.w+R*2,h:C.h+R*2},e.alsoBox?.())),!e.marksShowing()||!a||Math.abs(d()/a-1)<=.02)break;cancelAnimationFrame(f),f=0,e.onRezoom()}i=!1}function b(){if(i||!e.svg()||!s)return;let v=t.getBoundingClientRect();v.width<2||v.height<2||u()}function x(){if(!s)return;let v=d();g(1/v)}function w(){return new Promise(v=>{let O=0,C=n,A=()=>{if(c){v();return}let R=!!(f||p)||n!==C;C=n,O=R?0:O+1,O>=2?v():requestAnimationFrame(A)};requestAnimationFrame(A)})}let $=new ResizeObserver(()=>{if(!(!s||c)){if(i&&n){let v=l(),O=s.x+s.w/2,C=s.y+s.h/2;s={x:O-v.w/n/2,y:C-v.h/n/2,w:v.w/n,h:v.h/n}}i||(cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=0,c||b()})),m(h)}});return $.observe(t),{get view(){return s},set view(v){s=v},get full(){return r},set full(v){r=v},get moved(){return i},get zoom(){return n},painted(v){a=v},size:l,scale:d,quietly:m,applyView:h,toSvg:y,zoomAt:g,fit:k,fitItems:u,autoFit:b,actual:x,settled:w,dispose(){cancelAnimationFrame(p),cancelAnimationFrame(f),$.disconnect(),c=!0}}}var Tt="http://www.w3.org/2000/svg",Mt={half:2.4,h:3.2,t:.25,above:1.4,lift:3.8,fan:.32,gap:.3},st=(t,e,s)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],so=t=>t.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" ");function jf(t,e){function s(o,n,a){let f=t.k(),p=(l,d,m,h,y="")=>{let g=o.createElementNS(Tt,"g");g.setAttribute("class",`live-badge ${m.cls} ${y}`.trim());let k=8/f,u=o.createElementNS(Tt,"circle");if(u.setAttribute("cx",String(l)),u.setAttribute("cy",String(d)),u.setAttribute("r",String(k)),g.append(u),"g"in m){let x=o.createElementNS(Tt,"text");x.setAttribute("x",String(l)),x.setAttribute("y",String(d)),x.style.fontSize=`${(10/f).toFixed(2)}px`,x.textContent=m.g,g.append(x)}else{let x=o.createElementNS(Tt,"use");x.setAttribute("href",t.iconHref(m.icon));let w=11/f;x.setAttribute("x",String(l-w/2)),x.setAttribute("y",String(d-w/2)),x.setAttribute("width",String(w)),x.setAttribute("height",String(w)),g.append(x)}let b=o.createElementNS(Tt,"title");b.textContent=h,g.append(b),n(g)},c=(l,d)=>{for(let m of t.outlinesFor(l)){if(m.kind!=="poly")continue;let h=o.createElementNS(Tt,"polygon");h.setAttribute("class",d),h.setAttribute("points",m.points.map(([y,g])=>`${y.toFixed(1)},${g.toFixed(1)}`).join(" ")),n(h)}};for(let l of a){let d=t.boxOf(l.at);if(d){if(l.outline&&c(l.at,l.outline),l.badge)p(d.x,d.y,l.badge,l.title);else if(l.hit){let m=o.createElementNS(Tt,"title");m.textContent=l.title;let h=o.createElementNS(Tt,"rect");h.setAttribute("class","live-hit"),h.setAttribute("x",String(d.x)),h.setAttribute("y",String(d.y)),h.setAttribute("width",String(d.w)),h.setAttribute("height",String(d.h)),h.append(m),n(h)}if((l.beside??[]).forEach((m,h)=>p(d.x+18*(h+1)/f,d.y,m.glyph,m.title)),l.dot&&p(d.x,d.y+d.h,l.dot.glyph,l.dot.title),l.tag){let m=o.createElementNS(Tt,"text");m.setAttribute("class",`live-life ${l.tag.cls}`),m.setAttribute("x",String(d.x+d.w)),m.setAttribute("y",String(d.y+d.h)),m.style.fontSize=`${(9/f).toFixed(2)}px`,m.textContent=l.tag.text,n(m)}}}}function r(o,n,a){for(let f of a){let p=o.createElementNS(Tt,"g");p.setAttribute("class",`live-extra${f.cls}`);for(let[b,x]of f.data)p.setAttribute(b,x);let{x:c,y:l,w:d,hgt:m,k:h}=f.rect,y=o.createElementNS(Tt,"rect");y.setAttribute("x",String(c)),y.setAttribute("y",String(l)),y.setAttribute("width",String(d)),y.setAttribute("height",String(m)),y.setAttribute("rx",String(6/h));let g=o.createElementNS(Tt,"text");g.setAttribute("x",String(c+8/h)),g.setAttribute("y",String(l+13/h)),g.style.fontSize=`${(11/h).toFixed(2)}px`,g.textContent=f.line1;let k=o.createElementNS(Tt,"text");k.setAttribute("class","sub"),k.setAttribute("x",String(c+8/h)),k.setAttribute("y",String(l+27/h)),k.style.fontSize=`${(9/h).toFixed(2)}px`,k.textContent=f.line2;let u=o.createElementNS(Tt,"title");u.textContent=f.title,p.append(y,g,k,u),n(p)}}function i(o,n,a){let f=[];for(let p of a){let c=p.over,l=(c.x0+c.x1)/2,d=(c.y0+c.y1)/2,m=0,h={x0:0,y0:0,x1:0,y1:0};for(let L=0;L<6;L++){let U=c.z1+Mt.above+m,H=U+Mt.h,ee=[st(l-Mt.half,d+Mt.t,U),st(l+Mt.half,d+Mt.t,U),st(l+Mt.half,d-Mt.t,H),st(l-Mt.half,d+Mt.t,H)];if(h={x0:Math.min(...ee.map(j=>j[0])),y0:Math.min(...ee.map(j=>j[1])),x1:Math.max(...ee.map(j=>j[0])),y1:Math.max(...ee.map(j=>j[1]))},!Ja(h,f))break;m+=Mt.lift}f.push(h);let y=c.z1+Mt.above+m,g=y+Mt.h,k=l-Mt.half,u=l+Mt.half,b=d+Mt.t,x=d-Mt.t,w=o.createElementNS(Tt,"g");w.setAttribute("class",`${e}-card${p.cls}`);for(let[L,U]of p.data)w.setAttribute(L,U);let[$,v]=st(l,d,c.z1+.15),O=`${$.toFixed(1)}px ${v.toFixed(1)}px`;w.style.transformOrigin=O;let C=o.createElementNS(Tt,"g");C.setAttribute("class",`${e}-float`),C.style.transformOrigin=O;let A=[];for(let L=Math.min(p.count-1,3);L>=1;L--){let U=L*Mt.fan,H=x-(L-1)*(2*Mt.t+Mt.gap)-Mt.gap,ee=H-2*Mt.t,j=k+U,q=u+U,G=y+U,Q=g+U,le=(pe,Y)=>{let ie=o.createElementNS(Tt,"polygon");ie.setAttribute("class",`${e}-face stacked ${pe}`),ie.setAttribute("points",so(Y)),C.append(ie)};le("s-top",[st(j,ee,Q),st(q,ee,Q),st(q,H,Q),st(j,H,Q)]),le("s-side",[st(q,ee,G),st(q,H,G),st(q,H,Q),st(q,ee,Q)]),le("s-front",[st(j,H,G),st(q,H,G),st(q,H,Q),st(j,H,Q)]),A.push({x0:j,x1:q,y0:ee,y1:H,z0:G,z1:Q})}let R=o.createElementNS(Tt,"polygon");R.setAttribute("class",`${e}-tail`),R.setAttribute("points",so([st(l-.5,b,y+.05),st(l+.5,b,y+.05),st(l,d,c.z1+.15)]));let M=(L,U)=>{let H=o.createElementNS(Tt,"polygon");return H.setAttribute("class",L),H.setAttribute("points",so(U)),H},T=M(`${e}-face front`,[st(k,b,y),st(u,b,y),st(u,b,g),st(k,b,g)]);C.append(R,M(`${e}-face top`,[st(k,x,g),st(u,x,g),st(u,b,g),st(k,b,g)]),M(`${e}-face side`,[st(u,x,y),st(u,b,y),st(u,b,g),st(u,x,g)]),T);let[S,N]=st(k,b,g),z=40,K=o.createElementNS(Tt,"g");K.setAttribute("transform",`matrix(${(Ct*lt/z).toFixed(4)} ${(.5*lt/z).toFixed(4)} 0 ${(lt/z).toFixed(4)} ${S.toFixed(1)} ${N.toFixed(1)})`);let J=(L,U,H,ee)=>{let j=o.createElementNS(Tt,"text");return j.setAttribute("class",L),j.setAttribute("x",String(U)),j.setAttribute("y",String(H)),j.textContent=ee,j};if(K.append(J(`${e}-mark`,34,98,p.mark),J(`${e}-who`,70,52,p.who),J(`${e}-age`,70,82,p.age)),p.line!==void 0&&K.append(J(`${e}-q`,12,118,p.line)),p.count>1){let L=o.createElementNS(Tt,"circle");L.setAttribute("class",`${e}-count-bg`),L.setAttribute("cx","178"),L.setAttribute("cy","14"),L.setAttribute("r","15"),K.append(L,J(`${e}-count`,178,14,String(p.count)))}C.append(K);let Z=o.createElementNS(Tt,"title");Z.textContent=p.title,w.append(C,Z),t.onCard?.(w,{cx:l,cy:d,tipZ:c.z1+.15,card:{x0:k,x1:u,y0:x,y1:b,z0:y,z1:g},panes:A.reverse()}),n(w)}}return{paintMarks:s,paintGhosts:r,paintCards:i}}var _f=[["scale","Scale"],["spin","Spin"],["dissolve","Dissolve"],["inflate","Inflate"]],Ff=[["none","None"],["jiggle","Jiggle"],["pirouette","Pirouette"],["glow","Glow"],["breathe","Breathe"]];function Uh(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0)%1e3/1e3}var Qc=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),Lf=t=>t<0?0:t>1?1:t*t*t,ep=Math.PI*2,tp={appear:{scale:420,spin:760,dissolve:520,inflate:640},disappear:{scale:320,spin:600,dissolve:420,inflate:420},period:{jiggle:4200,pirouette:6400,glow:3200,breathe:4400}},zn={windup:220,turn:980,land:260};function Df(t,e,{prefix:s,key:r,alt:i}){let o={...e},n=1,a=new Map,f=new WeakSet,p=0,c=0,l=new WeakMap,d=new WeakMap;function m(R){p=0;for(let[M,T]of a){if(!M.isConnected){a.delete(M);continue}let S;if(T.repeat){if(S=(R+(T.offset??0))%T.repeat/T.dur,S>1){f.has(M)&&(t.restore(M),f.delete(M),M.style.removeProperty("transform"));continue}}else if(S=(R-T.start)/T.dur,S>=1){h(M,T);continue}let N=T.frame(Math.max(0,S));t.spin(M,N.theta,N.lift),f.add(M),d.set(M,N),N.scale!==1?M.style.transform=`scale(${N.scale.toFixed(4)})`:M.style.removeProperty("transform"),c++}a.size&&(p=requestAnimationFrame(m))}function h(R,M){a.delete(R),f.has(R)&&(t.restore(R),f.delete(R)),R.style.removeProperty("transform"),M.done?.()}function y(R){let M=a.get(R.card);M&&h(R.card,M),a.set(R.card,R),p||(p=requestAnimationFrame(m))}let g=8,k=0,u=R=>(k++,R.finally(()=>{k--}));function b(R){return!o.enabled||k>=g?Promise.resolve():u(w(R))}function x(R){return!o.enabled||k>=g?Promise.resolve():u($(R))}function w(R){let M=tp.appear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:M,frame:z=>({theta:(1-Qc(z))*ep,lift:0,scale:Math.max(.001,Qc(z))}),done:N}));let T=o.appear==="scale"?[{transform:"scale(0)"},{transform:"scale(1)"}]:o.appear==="dissolve"?[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}]:[{transform:"scale(0)",easing:"cubic-bezier(.3,0,.4,1)"},{transform:"scale(1.16)",offset:.55,easing:"ease-in-out"},{transform:"scale(.95)",offset:.78,easing:"ease-in-out"},{transform:"scale(1)"}];return R.animate(T,{duration:M,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function $(R){let M=tp.disappear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:M,frame:z=>({theta:Lf(z)*ep,lift:0,scale:Math.max(.001,1-Lf(z))}),done:()=>{R.style.transform="scale(0)",N()}}));let T=o.appear==="scale"?[{transform:"scale(1)"},{transform:"scale(0)"}]:o.appear==="dissolve"?[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}]:[{transform:"scale(1)"},{transform:"scale(1.08)",offset:.3},{transform:"scale(0)"}];return R.animate(T,{duration:M,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function v(R){l.get(R)?.cancel(),l.delete(R);let M=a.get(R);M?.repeat&&h(R,M)}function O(R,M){if(v(R),!o.enabled||o.idle==="none"||R.classList.contains("still"))return;let T=R.getAttribute(r)??R.getAttribute(i)??"",S=(M??tp.period[o.idle])/n,N=Uh(T)*S;if(o.idle==="pirouette"){let L=(zn.windup+zn.turn+zn.land)/n,U=zn.windup/(zn.windup+zn.turn+zn.land),H=(zn.windup+zn.turn)/(zn.windup+zn.turn+zn.land);y({card:R,start:0,dur:L,repeat:S,offset:N,frame:ee=>{if(ee<U)return{theta:-.35*Math.sin(ee/U*Math.PI/2),lift:0,scale:1};if(ee<H){let q=(ee-U)/(H-U);return{theta:-.35*(1-q)+Qc(q)*ep,lift:.9*Math.sin(q*Math.PI),scale:1}}let j=(ee-H)/(1-H);return{theta:0,lift:0,scale:1-.04*Math.sin(j*Math.PI)}}});return}let z=R.querySelector(`.${s}-float`)??R,K=t.amber(),J=o.idle==="jiggle"?[{transform:"scale(1)",offset:0},{transform:"scale(1.07)",offset:.04},{transform:"scale(.97)",offset:.08},{transform:"scale(1.02)",offset:.11},{transform:"scale(1)",offset:.14},{transform:"scale(1)",offset:1}]:o.idle==="glow"?[{filter:`drop-shadow(0 0 0px ${K})`},{filter:`drop-shadow(0 0 7px ${K})`},{filter:`drop-shadow(0 0 0px ${K})`}]:[{transform:"scale(1)"},{transform:"scale(1.035)"},{transform:"scale(1)"}],Z=z.animate(J,{duration:S,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});Z.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+N)%S,l.set(R,Z)}function C(R,M,T,S,N=!1){N&&(S=!1);for(let[K,J]of M)!R.has(K)&&!N&&b(J),!l.has(J)&&!a.get(J)?.repeat&&O(J);if(!o.enabled||!S)return;let z=t.leavingLayer();if(z)for(let[K,J]of T){let Z=R.get(K);!Z||M.has(K)||(v(Z),Z.setAttribute("class",`${s}-leaving${J?" expired":""}`),Z.removeAttribute(i),z.append(Z),x(Z).then(()=>Z.remove()))}}function A(R){for(let[M,T]of[...a])h(M,T);p&&cancelAnimationFrame(p),p=0;for(let M of document.getAnimations())M.effect?.target?.closest?.(`.live-layer, .${s}-leaving-layer`)&&M.cancel();t.leavingLayer()?.replaceChildren()}return{get settings(){return{...o}},set(R,M){let T=o;if(o={...o,...R},(!o.enabled||T.idle!==o.idle||T.enabled!==o.enabled)&&(A(void 0),o.enabled))for(let S of M)O(S)},update:C,appear:b,disappear:x,startIdle:O,stopIdle:v,stopAll:A,async preview(R){o.enabled&&await Promise.all(R.map(async M=>{if(v(M),await b(M),o.idle!=="none"&&!M.classList.contains("still")){let T=o.idle==="pirouette"?1800:1400;O(M,T),await new Promise(S=>setTimeout(S,T*2.2/n)),v(M)}else await new Promise(T=>setTimeout(T,700/n));await x(M);for(let T of M.getAnimations())T.cancel();M.style.removeProperty("transform"),O(M)}))},get stats(){return{jobs:a.size,raf:!!p,frames:c,effects:k}},setSpeed(R){n=R},lastFrame:R=>d.get(R)}}var np=t=>String(Math.round(t*100)/100),Bf=(t,e={},...s)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?np(i):i]),children:s});function sp(t,e){if(typeof t=="string")return t;let s=t.attrs.map(([r,i])=>{if(r==="id")return[r,e+i];let o=i.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1").replace(/url\(\s*(['"]?)#/g,(n,a)=>`url(${a}#${e}`);return(r==="href"||r==="xlink:href")&&o.startsWith("#")&&!o.startsWith(`#${e}`)&&(o=`#${e}${o.slice(1)}`),[r,o]});return{name:t.name,attrs:s,children:t.children.map(r=>sp(r,e))}}function rp(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(s=>rp(s,e)).filter(s=>s!==void 0)}}var qf=t=>(t.attrs.find(e=>e[0]==="class")?.[1]??"").split(/\s+/),Qn=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1];function nl(t){let e=[],s=[],r=n=>{if(typeof n=="string")return;let a=Qn(n,"transform");if(a&&/matrix/.test(a))return;let f=Qn(n,"points");if(f)for(let p of f.trim().split(/\s+/)){let[c,l]=p.split(",").map(Number);Number.isFinite(c)&&Number.isFinite(l)&&(e.push(c),s.push(l))}if(n.name==="rect"){let p=Number(Qn(n,"x")),c=Number(Qn(n,"y")),l=Number(Qn(n,"width")),d=Number(Qn(n,"height"));[p,c,l,d].every(Number.isFinite)&&(e.push(p,p+l),s.push(c,c+d))}if(n.name==="circle"){let p=Number(Qn(n,"cx")),c=Number(Qn(n,"cy")),l=Number(Qn(n,"r"));[p,c,l].every(Number.isFinite)&&(e.push(p-l,p+l),s.push(c-l,c+l))}n.children.forEach(r)};if(t.forEach(r),!e.length)return;let i=Math.min(...e),o=Math.min(...s);return{x:i,y:o,w:Math.max(...e)-i,h:Math.max(...s)-o}}var sl=(t,e)=>{if(!e)return t;let s=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:s,y:r,w:Math.max(t.x+t.w,e.x+e.w)-s,h:Math.max(t.y+t.h,e.y+e.h)-r}};function Vf(t,e,s){let r=a=>Math.min((e.width-e.pad*2)/a.w,(e.height-e.pad*2)/a.h),i=r(t),o=s(i),n=sl(t,nl(o));return i=r(n),o=s(i),n=sl(t,nl(o)),i=r(n),{k:i,box:n,live:o}}var Kf=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function Hh(t){let e=[],s=0,r=t.replace(/\/\*[\s\S]*?\*\//g,"");for(;s<r.length;){let i=r.indexOf("{",s);if(i<0)break;let o=1,n=i+1;for(;n<r.length&&o;)r[n]==="{"?o++:r[n]==="}"&&o--,n++;e.push([r.slice(s,i).trim(),r.slice(i+1,n-1)]),s=n}return e}function Yh(t){let e=[],s=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("||o==="["?s++:o===")"||o==="]"?s--:o===","&&!s&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e.filter(Boolean)}function ip(t,e,s){let r=/^:root((?:\[[^\]]*\]|:not\([^)]*\))*)(.*)$/.exec(t),i=s.replace(/^\./,"");if(r){let o=r[1],n=r[2].trim();return`${o?`.${i}${o} `:""}${e}${n?" "+n:""}`}if(/^(html|body|\*)\b/.test(t)||/^[a-z]+$/.test(t)&&!/^(svg|g|text|path|polygon|rect|circle|line)$/.test(t))throw new Error(`the canvas's CSS can't style the page: "${t}"`);return`${e} ${t}`}function op(t,e,s){let r="";for(let[i,o]of Hh(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
|
|
294
|
+
`;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${op(o,e,s)}}
|
|
295
|
+
`;continue}if(i.startsWith("@"))throw new Error(`the canvas's CSS has an at-rule it can't scope: ${i}`);r+=`${Yh(i).map(n=>ip(n,e,s)).join(",")}{${o.replace(/\banimation:\s*([a-z][\w-]*)/g,"animation:iso-$1")}}
|
|
296
|
+
`}return r}var ap=["<","script"].join("");function Sn(t){return t?vt(t).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>").replace(/(^|[^*])\*([^*\s][^*]*)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,s,r)=>/^(https?:|#|\.{0,2}\/)/.test(r.replace(/&/g,"&"))?`<a href="${r}">${s}</a>`:s):""}var lp=t=>(t??"").split(/\n\s*\n/).filter(Boolean).map(e=>`<p class="sec-sub">${Sn(e.trim())}</p>`).join(""),Gf=(t,e)=>!!e.motion&&vs(e,e.motion,{kinds:t.theme.kinds}).ok;function cp(t,e){return Gf(t,e)?vs(e,e.motion,{kinds:t.theme.kinds}).beats.map(s=>({n:s.index+1,num:s.index+1,kind:"control",color:s.say?.color??Hn(t.theme,t.theme.kinds.control?.color??"control"),heading:s.say?.title??s.name,caption:s.say?.text??"",command:s.say?.code??"",phases:[],pulses:[],lit:[],duration:s.end-s.start})):e.steps.steps}function pp(t){return JSON.stringify({scenes:t.scenes.map(e=>{let s=Gf(t,e),r=cp(t,e),i=s?e.motion:e.steps.steps.length?Va(e):void 0;return{id:e.id,loop:e.raw.loop??!0,dim:e.raw.dim??"flows",vis:e.steps.vis,steps:r.map(({focus:o,...n})=>({...n,caption:Sn(n.caption)})),assemble:e.assemble,grid:!!e.grid.show,source:Ji(e),...i?{doc:i}:{},...s?{own:s}:{}}})})}function dp(t,e){let s=t.theme,r=e.raw.legend;if(r===!1)return"";let i=Array.isArray(r)?r:e.steps.kindsUsed.filter(a=>e.routes.some(f=>f.kind===a)||e.steps.steps.some(f=>f.phases.some(p=>p.some(c=>c.kind===a)))),o=a=>`<span><i${a.box?' class="box"':""} style="${a.swatch}"></i>${a.label}</span>`,n=i.map(a=>{let f=Ot(t.catalog,a)?.legend;if(f)return o(f);let p=s.kinds[a];return p?`<span><i style="${`border-color:${Hn(s,p.color)}${p.dash==="dashed"?";border-top-style:dashed":p.dash==="dotted"?";border-top-style:dotted":""}`}"></i>${Sn(p.legend)}</span>`:""});if(!Array.isArray(r)){let a=new Set(e.layout.items.map(f=>f.region?.kind));for(let[f,p]of Object.entries(t.catalog.regions))p.legend?.auto&&a.has(f)&&n.push(o(p.legend))}return n.join("")}function Wh(t,e){let s=cp(t,e),r=`<div class="tools">
|
|
297
|
+
<button class="pbtn small" type="button" data-a="grid" aria-pressed="${e.grid.show?"true":"false"}" title="Show the floor grid">Grid</button>
|
|
296
298
|
<button class="pbtn small" type="button" data-a="assemble" title="Draw the diagram again, piece by piece">Assemble</button>
|
|
297
|
-
</div>`;if(!
|
|
299
|
+
</div>`;if(!s.length)return`<div class="player">${r}</div>`;let i=s[0];return`<div class="player">
|
|
298
300
|
<div class="ctrls">
|
|
299
301
|
<button class="pbtn icon" type="button" data-a="prev" aria-label="Previous step">\u2039</button>
|
|
300
302
|
<button class="pbtn primary" type="button" data-a="play" aria-label="Play">\u25B6 Play</button>
|
|
301
303
|
<button class="pbtn icon" type="button" data-a="next" aria-label="Next step">\u203A</button>
|
|
302
304
|
</div>
|
|
303
|
-
${
|
|
305
|
+
${r}
|
|
304
306
|
<div class="cap" aria-live="polite">
|
|
305
|
-
<div class="cap-h"><span class="num" style="background:${
|
|
306
|
-
<p class="cap-t">${
|
|
307
|
-
<pre class="cap-c">${
|
|
307
|
+
<div class="cap-h"><span class="num" style="background:${i.color}">${i.num}</span><span class="h">${vt(i.heading)}</span><span class="cnt">1 / ${s.length}</span></div>
|
|
308
|
+
<p class="cap-t">${Sn(i.caption)}</p>
|
|
309
|
+
<pre class="cap-c">${vt(i.command)}</pre>
|
|
308
310
|
<div class="prog"><i></i></div>
|
|
309
311
|
</div>
|
|
310
312
|
<div class="dots"></div>
|
|
311
|
-
</div>`}function
|
|
312
|
-
<section class="scene" id="scene-${
|
|
313
|
-
<h2>${
|
|
314
|
-
${
|
|
313
|
+
</div>`}function Jh(t,e){let s=cp(t,e);return s.length?`<details class="steps"><summary>All ${s.length} steps as text</summary><ol>${s.map(r=>`<li value="${r.num}"><b>${vt(r.heading)}.</b> ${Sn(r.caption)}${r.command?`<br><code>${vt(r.command)}</code>`:""}</li>`).join("")}</ol></details>`:""}function Zf(t,e={}){let s=t.doc,r=s.title??s.scenes[0]?.title??"Diagram",i=(s.pills??[]).map(n=>`<span class="pill">${Sn(n)}</span>`).join(""),o=t.scenes.map(n=>`
|
|
314
|
+
<section class="scene" id="scene-${vt(n.id)}">
|
|
315
|
+
<h2>${vt(n.raw.title)}</h2>
|
|
316
|
+
${lp(n.raw.caption)}
|
|
315
317
|
<div class="figure" tabindex="-1">
|
|
316
318
|
<div class="scroller">${n.grid.show?n.rendered.svg.replace("<svg ",'<svg class="show-grid" '):n.rendered.svg}</div>
|
|
317
|
-
${
|
|
318
|
-
<div class="legend">${
|
|
319
|
+
${Wh(t,n)}
|
|
320
|
+
<div class="legend">${dp(t,n)}</div>
|
|
319
321
|
</div>
|
|
320
|
-
${
|
|
321
|
-
${n.raw.after?`<div class="after">${
|
|
322
|
+
${Jh(t,n)}
|
|
323
|
+
${n.raw.after?`<div class="after">${lp(n.raw.after)}</div>`:""}
|
|
322
324
|
</section>`).join(`
|
|
323
325
|
`);return`<!doctype html>
|
|
324
326
|
<html lang="en">
|
|
325
327
|
<head>
|
|
326
328
|
<meta charset="utf-8">
|
|
327
329
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
328
|
-
<title>${
|
|
329
|
-
${s.lede?`<meta name="description" content="${
|
|
330
|
+
<title>${vt(r)}</title>
|
|
331
|
+
${s.lede?`<meta name="description" content="${vt(s.lede)}">`:""}
|
|
330
332
|
<style>
|
|
331
|
-
${
|
|
333
|
+
${aa(t.theme)}${Ur(t.catalog)}${Ya}
|
|
332
334
|
</style>
|
|
333
335
|
${e.extraHead??""}
|
|
334
336
|
</head>
|
|
@@ -336,17 +338,17 @@ ${e.extraHead??""}
|
|
|
336
338
|
<div class="wrap">
|
|
337
339
|
<header class="page">
|
|
338
340
|
<div>
|
|
339
|
-
<h1>${
|
|
340
|
-
${s.lede?`<p class="lede">${
|
|
341
|
+
<h1>${vt(r)}</h1>
|
|
342
|
+
${s.lede?`<p class="lede">${Sn(s.lede)}</p>`:""}
|
|
341
343
|
</div>
|
|
342
344
|
<div class="pills">${i}<button class="theme" id="themeBtn" type="button">Theme</button></div>
|
|
343
345
|
</header>
|
|
344
346
|
${o}
|
|
345
|
-
${s.after?
|
|
346
|
-
${s.footer?`<footer>${
|
|
347
|
+
${s.after?lp(s.after):""}
|
|
348
|
+
${s.footer?`<footer>${Sn(s.footer)}</footer>`:""}
|
|
347
349
|
</div>
|
|
348
|
-
${
|
|
349
|
-
${
|
|
350
|
+
${ap} type="application/json" id="diagram-steps">${pp(t).replace(/</g,"\\u003c")}<\/script>
|
|
351
|
+
${ap}>
|
|
350
352
|
(function(){
|
|
351
353
|
var root=document.documentElement, m=/theme=(light|dark)/.exec(location.hash);
|
|
352
354
|
try{var t=localStorage.getItem('diagram-theme'); if(t) root.dataset.theme=t;}catch(e){}
|
|
@@ -358,14 +360,49 @@ ${Fc}>
|
|
|
358
360
|
});
|
|
359
361
|
})();
|
|
360
362
|
<\/script>
|
|
361
|
-
${e.runtime?`${
|
|
363
|
+
${e.runtime?`${ap}>${e.runtime}<\/script>`:""}
|
|
362
364
|
${e.extraBody??""}
|
|
363
365
|
</body>
|
|
364
366
|
</html>
|
|
365
|
-
`}function me(t,e=null,...s){let r=document.createElement(t);for(let[i,o]of Object.entries(e??{}))if(!(o==null||o===!1))if(i==="class")r.className=String(o);else if(i==="on")for(let[n,a]of Object.entries(o))r.addEventListener(n,a);else r.setAttribute(i,o===!0?"":String(o));for(let i of s)i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}var Sd=1,Va="(?:[^/:%\\s]|%[0-9A-F]{2})+",mn=["debug","info","notice","warning","error"],vd=["1m","1h","1d"],Rn={"1m":6e4,"1h":36e5,"1d":864e5},Ka=t=>`^(?:(?:${t.kinds.join("|")}):(?:${Va})(?:/(?:${t.kinds.join("|")}):(?:${Va}))*)?$`;function Ga(t){let e=new RegExp(Ka(t)),s=o=>e.test(o);function r(o){if(!e.test(o))throw new Error(`not a scope path: ${JSON.stringify(o)}`);return o===""?[]:o.split("/").map(n=>{let a=n.indexOf(":");return{kind:n.slice(0,a),name:decodeURIComponent(n.slice(a+1))}})}function i(o){let n="";for(let a of r(o)){if(!t.parents[a.kind].includes(n))return!1;n=a.kind}return!0}return{isScope:s,parseScope:r,wellNested:i}}var Za=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),Md=t=>t.map(e=>`${e.kind}:${Za(e.name)}`).join("/"),Pd=(t,e,s)=>(t?`${t}/`:"")+`${e}:${Za(s)}`,Jt=t=>t===""?0:t.split("/").length;function $s(t,e){return e<=0?"":(t===""?[]:t.split("/")).slice(0,e).join("/")}var Od=t=>$s(t,Jt(t)-1),un=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),Ad=(t,e)=>t!==""&&t.split("/").includes(e),Gr=t=>t===""?"fleet":t.slice(t.lastIndexOf("/")+1).split(":")[0],Zr=t=>t===""?"all hosts":decodeURIComponent(t.slice(t.lastIndexOf("/")+1).split(":").slice(1).join(":"));function Ur(t){let e=[{scope:"",label:"all hosts",kind:"fleet"}];for(let s=1;s<=Jt(t);s++){let r=$s(t,s);e.push({scope:r,label:Zr(r),kind:Gr(r)})}return e}var Vc=["kind","source","severity","scope","since","before"];function ah(t){let e=[],s=0;for(;s<t.length;){for(;s<t.length&&/\s/.test(t[s]);)s++;if(s>=t.length)break;let r=!1;t[s]==="-"&&s+1<t.length&&!/\s/.test(t[s+1])&&(r=!0,s++);let i=/^(attr\.[a-z][a-z0-9_]*|[a-z]+):/.exec(t.slice(s)),o;i&&(o=i[1],s+=i[0].length);let n="",a=!1;if(t[s]==='"'){let m=t.indexOf('"',s+1);n=t.slice(s+1,m<0?t.length:m),a=!0,s=m<0?t.length:m+1}else{let m=s;for(;s<t.length&&!/\s/.test(t[s]);)s++;n=t.slice(m,s)}e.push({neg:r,raw:n,quoted:a,field:o})}return e}var lh=/^(\d+)(s|m|h|d|w)$/,ch={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function Kc(t,e){let s=lh.exec(t);if(s)return e-Number(s[1])*ch[s[2]];let r=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?)?(Z|[+-]\d{2}:?\d{2})?$/.exec(t);if(!r)return;let[,i,o,n,a="0",m="0",p="0",c="0",l]=r;if(l){let d=Date.parse(t.replace(" ","T"));return Number.isNaN(d)?void 0:d}let f=new Date(+i,+o-1,+n,+a,+m,+p,+c.padEnd(3,"0")).getTime();return Number.isNaN(f)?void 0:f}function ph(t,e,s=Date.now()){let r=[],i=[];for(let o of ah(e??"")){let n=p=>{let c=o.field?`${o.field}:${o.raw}`:o.raw;p&&i.push(`${JSON.stringify(c)}: ${p}; searched as text`),c&&r.push({neg:o.neg,value:c})};if(!o.field){n();continue}if(!(t.includes(o.field)||o.field.startsWith("attr."))){n(`no field ${o.field}`);continue}if(!o.raw){n(`${o.field}: needs a value`);continue}let m=o.field;if(m==="severity"){let p=/^(>=|<=|>|<|=)?(.*)$/.exec(o.raw);if(!mn.includes(p[2])){n(`no severity ${p[2]} (${mn.join(", ")})`);continue}r.push({neg:o.neg,field:m,op:p[1]??"=",value:p[2]})}else if(m==="since"||m==="before"){let p=Kc(o.raw,s);if(p===void 0){n(`can't read the time ${o.raw} (15m, 2h, 3d, 1w, or a date like 2026-11-20 or 2026-11-20T09:30)`);continue}if(o.neg){n(`-${m} isn't allowed (use ${m==="since"?"before":"since"})`);continue}r.push({neg:!1,field:m,value:o.raw,time:p})}else r.push({neg:o.neg,field:m,value:o.raw})}return{terms:r,warnings:i}}var Ua=t=>mn.indexOf(t),fh={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function dh(t,e){switch(t.field){case void 0:return{field:"text",value:t.value};case"kind":case"source":return t.value.endsWith("*")?{field:t.field,value:t.value.slice(0,-1),prefix:!0}:{field:t.field,value:t.value};case"severity":return{field:"severity",op:fh[t.op??"="],value:t.value};case"scope":return{field:"scope",value:t.value,from:e.topKinds.some(s=>t.value.startsWith(`${s}:`))?"top":"segments"};case"since":case"before":return;default:return e.links.includes(t.field)?{field:"link",link:t.field,value:t.value}:{field:"attr",key:t.field.slice(5),value:t.value}}}function mh(t,e){let s=[],r=new Map;for(let i of e.terms){let o=dh(i,t);if(!o)continue;if(i.neg){s.push({not:!0,any:[o]});continue}if(o.field==="text"||o.field==="severity"){s.push({any:[o]});continue}let n=o.field==="link"?`link.${o.link}`:o.field==="attr"?`attr.${o.key}`:o.field,a=r.get(n);if(a)a.any.push(o);else{let m={any:[o]};r.set(n,m),s.push(m)}}return{all:s}}function uh(t,e,s,r){switch(e.field){case"text":{let i=e.value.toLowerCase();if(s.summary.toLowerCase().includes(i)||s.kind.toLowerCase().includes(i)||s.source.toLowerCase().includes(i)||s.scope.toLowerCase().includes(i))return!0;for(let[o,n]of Object.entries(s.attrs))if(typeof n=="string"&&!r.has(`${s.source}.${o}`)&&n.toLowerCase().includes(i))return!0;return!1}case"kind":case"source":{let i=s[e.field];return e.prefix?i.startsWith(e.value):i===e.value}case"severity":{let i=Ua(s.severity),o=Ua(e.value);return e.op==="ge"?i>=o:e.op==="gt"?i>o:e.op==="le"?i<=o:e.op==="lt"?i<o:i===o}case"scope":return e.from==="top"?un(s.scope,e.value):`/${s.scope}/`.includes(`/${e.value}/`);case"link":return t.linkMatch?.(String(e.link),e.value,s)??s.links[e.link]===e.value;case"attr":{let i=s.attrs[e.key];return i!=null&&String(i).toLowerCase()===e.value.toLowerCase()}}}function Yr(t){let e=[...Vc,...t.links],s=(a,m=Date.now())=>ph(e,a,m),r=a=>mh(t,a);function i(a,m,p,c){let l=s(a,m);return{where:r(l),...Xi(l,p,c),warnings:l.warnings}}function o(a,m=[]){let p=new Set(m),c=a?.all??[];return c.length?l=>c.every(f=>f.any.some(d=>uh(t,d,l,p))!==!!f.not):()=>!0}return{FIELDS:e,parseSearch:s,toAst:r,compileSearch:i,matchAst:o,matcher:(a,m=[])=>o(r(a),m)}}function Xi(t,e,s){for(let r of t.terms)r.field==="since"&&(e=Math.max(e,r.time)),r.field==="before"&&(s=Math.min(s,r.time));return{from:e,to:Math.max(e,s)}}function Qi(t,e){let s=e.toLowerCase(),r=[];for(let o of t.terms){if(o.neg||o.field||!o.value)continue;let n=o.value.toLowerCase();for(let a=s.indexOf(n);a>=0;a=s.indexOf(n,a+n.length))r.push([a,a+n.length])}r.sort((o,n)=>o[0]-n[0]);let i=[];for(let o of r){let n=i[i.length-1];n&&o[0]<=n[1]?n[1]=Math.max(n[1],o[1]):i.push([...o])}return i}var Td=t=>mn.filter(e=>Ua(e)>=Ua(t));var Ed=new Map,Ya=new Map;function tn(t,e){if(!t||t==="UTC")return 0;let s=`${t}|${Math.floor(e/(15*6e4))}`,r=Ya.get(s);if(r!==void 0)return r;let i=Ed.get(t);if(!i){try{i=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}catch{return 0}Ed.set(t,i)}let o={};for(let m of i.formatToParts(new Date(e)))m.type!=="literal"&&(o[m.type]=Number(m.value));let n=Date.UTC(o.year,o.month-1,o.day,o.hour%24,o.minute,o.second),a=Math.round((n-Math.floor(e/1e3)*1e3)/6e4)*6e4;return Ya.size>5e4&&Ya.clear(),Ya.set(s,a),a}var Nd=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function sr(t,e,s){if(e==="1m")return Math.floor(t/6e4)*6e4;let r=tn(s,t);if(e==="1h")return r%36e5===0?Math.floor(t/36e5)*36e5:Math.floor((t+r)/36e5)*36e5-r;let i=Math.floor((t+r)/864e5)*864e5,o=i-tn(s,i-r);return o>t?o=i-864e5-tn(s,i-864e5-r):Ha(o,s)<=t&&(o=Ha(o,s)),o}function Ha(t,e,s="1d"){if(s==="1m")return t+6e4;if(s==="1h")return t+36e5;let r=tn(e,t),i=Math.floor((t+r)/864e5)*864e5+864e5;return i-tn(e,i-r)}var Ds=6e4,Bs=36e5,In=864e5;function Wa(t,e,s,r={}){let i=Math.max((r.minFrac??.15)*(s-e),r.minMs??10*Ds),o=t.filter(([m,p])=>p>=e&&m<s).map(([m,p])=>[Math.max(e,m),Math.min(s,Math.max(m,p))]).sort((m,p)=>m[0]-p[0]),n=[];if(!o.length)return n;let a=e;for(let[m,p]of o)m-a>i&&n.push({from:a,to:m}),a=Math.max(a,p);return s-a>i&&n.push({from:a,to:s}),n}function rr(t){if(t>=In){let e=Math.floor(t/In),s=Math.round((t-e*In)/Bs);return s?`${e} d ${s} h`:`${e} d`}if(t>=Bs){let e=Math.floor(t/Bs),s=Math.round((t-e*Bs)/Ds);return s&&e<10?`${e} h ${s} min`:`${e} h`}return`${Math.max(1,Math.round(t/Ds))} min`}var ir=t=>`${t.from}-${t.to}`;function Hr(t,e,s,r=[],i={}){let o=i.cut??24,n=Math.max(1,s),a=Math.max(1,e-t),m=r.filter(b=>b.to>t&&b.from<e).map(b=>({from:Math.max(t,b.from),to:Math.min(e,b.to),w:i.weights?.get(ir(b))??0})).sort((b,w)=>b.from-w.from),p=m.reduce((b,w)=>b+(w.to-w.from)*(1-w.w),0),c=m.reduce((b,w)=>b+(1-w.w)*o,0),l=(n-c)/Math.max(1,a-p);if(!(l>0)||c>n*.6)return Hr(t,e,s,[],i);let f=[[t,0]],d=0,u=t,y=[];for(let b of m){d+=(b.from-u)*l,f.push([b.from,d]);let w=(1-b.w)*o+b.w*l*(b.to-b.from);y.push({from:b.from,to:b.to,x0:d,x1:d+w,weight:b.w}),d+=w,f.push([b.to,d]),u=b.to}f.push([e,d+(e-u)*l]);let g=b=>{if(b<=t)return(b-t)*l;if(b>=e)return f[f.length-1][1]+(b-e)*l;let w=0,k=f.length-1;for(;k-w>1;){let O=w+k>>1;f[O][0]<=b?w=O:k=O}let[$,v]=f[w],[T,R]=f[k];return T===$?v:v+(b-$)/(T-$)*(R-v)},x=b=>y.find(w=>w.weight<1&&b>w.x0&&b<w.x1);return{t0:t,t1:e,width:n,cuts:y,x:g,t:b=>{let w=x(b);if(w)return b-w.x0<w.x1-b?w.from:w.to;if(b<=0)return t+b/l;let k=0,$=f.length-1;if(b>=f[$][1])return e+(b-f[$][1])/l;for(;$-k>1;){let I=k+$>>1;f[I][1]<=b?k=I:$=I}let[v,T]=f[k],[R,O]=f[$];return O===T?v:v+(b-T)/(O-T)*(R-v)},cutAt:x,msPerPx:1/l}}var Gc=[1e3,5e3,15e3,3e4,Ds,5*Ds,15*Ds,30*Ds,Bs,3*Bs,6*Bs,12*Bs,In,2*In,7*In,14*In,28*In];function Ja(t,e,s=80){let r=Gc.find(m=>m/t.msPerPx>=s)??Gc[Gc.length-1],i=[],o=m=>{let p=new Date(m+tn(e,m)),c=String(p.getUTCHours()).padStart(2,"0"),l=String(p.getUTCMinutes()).padStart(2,"0"),f=String(p.getUTCSeconds()).padStart(2,"0"),d=`${p.getUTCDate()} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][p.getUTCMonth()]}`,u=c==="00"&&l==="00"&&f==="00";return r>=In||u?{label:d,major:!0}:{label:r<Ds?`${c}:${l}:${f}`:`${c}:${l}`,major:!1}},n=[],a=t.t0;for(let m of t.cuts)m.weight<1&&(n.push([a,m.from]),a=m.to);n.push([a,t.t1]);for(let[m,p]of n){let c=f=>f-tn(e,f-tn(e,f)),l=Math.ceil((m+tn(e,m))/r)*r;r>=7*In&&(l=Math.ceil((m+tn(e,m))/In)*In);for(let f=0,d=c(l);d<p&&f<2e3;f++,l+=r,d=c(l)){if(d<m)continue;let u=t.x(d),y=i[i.length-1];(!y||u-y.x>=s*.6)&&i.push({t:d,x:u,...o(d)})}}return i}var hh=["id","time","t","dur","scope","source","kind","severity","summary"],yh=t=>{if(t==null)return"";let e=typeof t=="string"&&/^[=+\-@\t\r]/.test(t)?`'${t}`:String(t);return/[",\n\r]/.test(e)?`"${e.replace(/"/g,'""')}"`:e},Rd=(t,e)=>e.size?{...t,attrs:Object.fromEntries(Object.entries(t.attrs).filter(([s])=>!e.has(`${t.source}.${s}`)))}:t;function Xa(t,e=[]){let s=new Set(e);return JSON.stringify(t.map(r=>Rd(r,s)),null,2)+`
|
|
366
|
-
|
|
367
|
+
`}function fp(){let t=globalThis;return{now:()=>performance.now(),next(e){let s={},r=()=>{s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer),e()};return s.raf=t.requestAnimationFrame?.(r),s.timer=setTimeout(r,s.raf===void 0?16:100),s},cancel(e){let s=e;s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer)}}}var Xh=400;function rl(t,e={}){let s=e.clock??fp(),r=t,i=0,o=b(e.rate??1),n=e.loop??!1,a=!1,f=!0,p=!1,c=(e.ambient??r.ambient)==="on",l=c?0:"off",d,m=0,h=r.beatAt(0),y=!1,g=0,k,u={};function b(N){if(!(Number.isFinite(N)&&N>0))throw new Error("rate is a number over 0");return N}let x=N=>Math.max(0,Math.min(r.duration,N));function w(N,...z){for(let K of[...u[N]??[]])K(...z)}let $=()=>f&&!p&&(a||c&&r.loops);function v(){$()?d===void 0&&(m=s.now(),d=s.next(A)):d!==void 0&&(s.cancel(d),d=void 0)}function O(N,z){let K=g;for(let J of r.beats)if(!(J.start<=N||J.start>z||J.index===h?.index)&&(h=J,y=!0,w("beat",J,"play"),g!==K))return!1;return!0}function C(N){if(!a){w("time",i,"ambient");return}let z=i,K=i+N,J=g;if(k!==void 0&&K>=k){if(i=k,!O(z,i))return;k=void 0,a=!1,w("time",i,"play"),g===J&&w("pause");return}if(K<r.duration){i=K,O(z,i)&&w("time",i,"play");return}if(n){if(!O(z,r.duration)||(i=K%r.duration,c&&(l=i),h=void 0,w("loop"),g!==J))return;let Z=r.beatAt(0);if(Z&&(h=Z,w("beat",Z,"play"),g!==J||!O(Z.start,i)))return;w("time",i,"play");return}i=r.duration,O(z,i)&&(a=!1,w("time",i,"play"),g===J&&(w("pause"),g===J&&w("end")))}function A(){d=void 0;let N=s.now(),z=Math.max(0,N-m)*o;m=N,c&&l!=="off"&&(l+=z),C(z),d===void 0&&$()&&(d=s.next(A))}function R(N,z=!1){let K=r.beatAt(i);g++;let J=g,Z=K?.name!==h?.name||K?.index!==h?.index;h=K,!(K&&(Z||z)&&(y=!0,w("beat",K,N),g!==J))&&w("time",i,N)}function M(N,z={}){if(p||!Number.isFinite(N))return;let K=x(N);c&&l!=="off"&&(l=z.join?K:l+K-i),i=K,m=s.now(),k!==void 0&&i>=k&&(k=void 0),R("seek"),v()}function T(){p||(i=0,c&&(l=0),k=void 0,m=s.now(),R("seek",!0),v())}let S={get timeline(){return r},get duration(){return r.duration},get time(){return i},get ambientTime(){return l},get playing(){return a},get beat(){return h},get cue(){return r.cues(i)},get rate(){return o},set rate(N){let z=b(N);z!==o&&(o=z,w("rate",z))},get loop(){return n},set loop(N){n=N},get ambient(){return c},set ambient(N){p||N===c||(c=N,c&&l==="off"&&(l=h?.start??0),v(),w("ambient",c),w("time",i,"ambient"))},get active(){return f},set active(N){N!==f&&(f=N,v())},state:()=>r.at(i,{ambient:l}),play(N={}){p||a||r.duration<=0||(i>=r.duration&&N.until===void 0&&T(),k=N.until!==void 0&&N.until>i&&N.until<=r.duration?N.until:void 0,!(N.until!==void 0&&k===void 0)&&(a=!0,m=s.now(),v(),w("play"),a&&!y&&h&&(y=!0,w("beat",h,"play"))))},pause(){a&&(a=!1,k=void 0,g++,v(),w("pause"))},toggle(){a?S.pause():S.play()},seek:M,seekBeat(N){let z=typeof N=="number"?r.beats[N]?.start:r.beats.find(K=>K.name===N)?.start;return z===void 0?!1:(M(z),!0)},next(){let N=r.beats.find(z=>z.start>i);M(N?N.start:r.duration)},prev(){let N=[...r.beats].reverse().find(z=>z.start<i-Xh);M(N?N.start:0)},restart:T,rebind(N){if(p||!N.ok)return!1;k=void 0;let z=r.beatAt(i),K=z?(i-z.start)/Math.max(1,z.end-z.start):0,J=l==="off"?0:l-i,Z=r;if(r=N,z){let L=N.beats.find(U=>U.name===z.name);if(L)i=L.start+K*(L.end-L.start);else{let U=Z.beats.filter(H=>H.index<z.index).reverse().map(H=>N.beats.find(ee=>ee.name===H.name)).find(Boolean);i=U?U.start:0}}return i=x(i),c&&l!=="off"&&(l=i+J),m=s.now(),R("rebind"),v(),!0},on(N,z){let K=u[N]??=new Set;return K.add(z),()=>{K.delete(z)}},dispose(){p=!0,g++,a=!1,d!==void 0&&s.cancel(d),d=void 0;for(let N of Object.keys(u))u[N].clear()}};return v(),S}function re(t,e=null,...s){let r=document.createElement(t);for(let[i,o]of Object.entries(e??{}))if(!(o==null||o===!1))if(i==="class")r.className=String(o);else if(i==="on")for(let[n,a]of Object.entries(o))r.addEventListener(n,a);else r.setAttribute(i,o===!0?"":String(o));for(let i of s)i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}var ol=new Map;function Uf(){let t,e=.35;for(let[s,r]of ol)r.wants&&r.seen>=e&&(r.seen>e||!t)&&(t=s,e=r.seen);for(let[s,r]of ol)r.wants&&r.auto(s===t)}var Hf=t=>{let e=new DOMParser().parseFromString(t,"image/svg+xml");if(e.documentElement.localName!=="svg")throw new Error("the drawing is not SVG");return document.importNode(e.documentElement,!0)},il=t=>{let e=Math.round(t/1e3);return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`},Yf={ok:!0,diags:[],duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}};function Qh(t){let e={...t.camera?{camera:t.camera}:{},...t.variants?{variants:t.variants}:{}};for(let s of["items","labels","routes"]){let r=Object.entries(t[s]??{}).filter(([,i])=>i.opacity===0).map(([i])=>[i,{opacity:0}]);r.length&&(e[s]=Object.fromEntries(r))}return e}function Wf(t,e){if(e.timeline&&!e.timeline.ok)throw new Error(`the motion has faults: ${e.timeline.diags.map(V=>`${V.path}: ${V.message}`).join("; ")}`);let s=e.scene,r=Hf(s.rendered.svg),i,o,n=!1,a=!1,f=rl(e.timeline??Yf,{loop:e.loop,rate:e.rate,ambient:e.ambient,clock:e.clock}),p=e.controls??!0,c=e.reducedMotion==="respect"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,l=c,d=(V,te,ae,Te)=>re("button",{type:"button",class:`iso-play-btn ${V}`,"aria-label":te,title:te,on:{click:Te}},ae),m=re("div",{class:"iso-play-stage"},r),h=d("back","Back","\u2039",()=>le(()=>Y(Math.max(0,G()-1)))),y=d("play","Play","\u25B6",()=>ie()),g=d("next","Next","\u203A",()=>le(()=>Y(Math.min(f.timeline.beats.length-1,G()+1)))),k=d("again","Reset","\u21BA",()=>le(()=>{pe(),f.restart()})),u=d("ambient","Ambient motion","\u223F",()=>{Q(),f.ambient=!f.ambient,ee()}),b=re("input",{type:"range",class:"iso-play-bar",min:0,step:1,"aria-label":"Time",on:{input:(()=>le(()=>{pe(),f.seek(Number(b.value))}))}}),x=re("span",{class:"iso-play-time"}),w=re("div",{class:"iso-play-dots"}),$=re("span",{class:"iso-play-num"}),v=re("span",{class:"iso-play-title"}),O=re("span",{class:"iso-play-chapter"}),C=re("span",{class:"iso-play-count"}),A=re("div",{class:"iso-play-text"}),R=re("pre",{class:"iso-play-code"}),M=re("dl",{class:"iso-play-facts"}),T=re("div",{class:"iso-play-say","aria-live":"polite"},re("div",{class:"iso-play-head"},$,v,O,C),A,R,M),S=re("details",{class:"iso-play-list"}),N=re("div",{class:"iso-play-row"},h,y,g,k,u,b,x),z=re("div",{class:"iso-play",role:"group","aria-roledescription":"animated diagram","aria-label":e.label??"Diagram",tabindex:p?0:void 0,"data-mode":e.mode??"light"},m,p&&N,p&&w,p&&T,p&&S);t.append(z);let K=[];function J(){let V=f.timeline.beats,te=V.length>0,ae=V.some(ze=>ze.say);K=[],w.replaceChildren();let Te,be;for(let ze of V){(!Te||ze.say?.chapter!==be)&&(Te=re("span",{class:"iso-play-group",role:"group","aria-label":ze.say?.chapter,title:ze.say?.chapter}),w.append(Te),be=ze.say?.chapter);let Ie=re("button",{type:"button",class:"iso-play-dot","aria-label":`Step ${ze.index+1}: ${ze.say?.title??ze.name}`,title:ze.say?.title??ze.name,on:{click:(()=>le(()=>Y(ze.index)))}});Te.append(Ie),K.push(Ie)}S.replaceChildren(re("summary",null,`All ${V.length} steps as text`),re("ol",null,...V.map(ze=>re("li",null,...Z(ze)))));for(let ze of[h,g,w])ze.hidden=!te;T.hidden=!ae,S.hidden=!ae,u.hidden=!f.timeline.loops,b.max=String(Math.round(f.duration));for(let ze of[y,k,b,x])ze.hidden=f.duration<=0;L=void 0}function Z(V){let te=V.say,ae=[re("b",null,te?.title??V.name)];if(te?.text){let Te=re("div",null);Te.innerHTML=Sn(te.text),ae.push(Te)}return te?.code&&ae.push(re("code",null,te.code)),te?.facts?.length&&ae.push(re("span",null,te.facts.map(([Te,be])=>`${Te}: ${be}`).join(" \xB7 "))),ae}let L;function U(V){let te=String((V?.index??-1)+1);for(let ae of r.querySelectorAll("[data-badge]"))ae.classList.toggle("on",ae.getAttribute("data-badge")===te),e.steps&&(ae.getAttribute("data-badge")===te||l?ae.removeAttribute("opacity"):ae.setAttribute("opacity","0.14"));if(e.steps)for(let ae of r.querySelectorAll("[data-step]"))ae.setAttribute("visibility",ae.getAttribute("data-step")===te&&!l?"visible":"hidden")}function H(){let V=f.beat;if(V===L||(L=V,U(V),!p))return;let te=V?.say;$.textContent=V?String(V.index+1):"",$.style.backgroundColor=te?.color??"",v.textContent=te?.title??V?.name??"",O.textContent=te?.chapter??"",C.textContent=V?`${V.index+1} / ${f.timeline.beats.length}`:"",A.innerHTML=Sn(te?.text),R.textContent=te?.code??"",M.replaceChildren(...(te?.facts??[]).flatMap(([ae,Te])=>[re("dt",null,ae),re("dd",null,Te)])),R.hidden=!te?.code,M.hidden=!te?.facts?.length,K.forEach((ae,Te)=>{ae.classList.toggle("on",Te===V?.index),ae.classList.toggle("done",V!==void 0&&Te<V.index),Te===V?.index?ae.setAttribute("aria-current","step"):ae.removeAttribute("aria-current")})}function ee(){let V=i!==void 0?f.timeline.at(i,{ambient:i}):l?Qh(f.timeline.at(f.duration,{ambient:"off"})):f.state();Ia(r,V,s.rendered,{styles:"cssom"}),z.dataset.time=String(Math.round(i??f.time)),i!==void 0?U(f.timeline.beatAt(i)):H(),p&&(b.value=String(Math.round(f.time)),b.setAttribute("aria-valuetext",`${il(f.time)} of ${il(f.duration)}${f.beat?`, ${f.beat.say?.title??f.beat.name}`:""}`),x.textContent=`${il(f.time)} / ${il(f.duration)}`)}function j(){let V=q();y.textContent=V?"\u275A\u275A":"\u25B6",y.setAttribute("aria-label",V?"Pause":"Play"),y.title=V?"Pause":"Play",u.setAttribute("aria-pressed",String(f.ambient)),T.setAttribute("aria-live",V?"off":"polite"),z.dataset.playing=String(V)}let q=()=>f.playing&&o===void 0,G=()=>f.beat?.index??0;function Q(){l&&(l=!1,L=void 0)}function le(V){Q(),n=!0,V(),j(),ee()}function pe(){o=void 0,f.pause()}function Y(V){let te=f.timeline.beats[V];if(!te||a)return;f.pause(),f.seek(te.start,{join:!0});let ae=f.timeline.beats[V+1]?.start??1/0;o=Math.max(te.start,Math.min(te.end,ae,f.duration)-1),f.play({until:o})}function ie(){Q(),q()?(n=!0,pe()):(n=!1,o=void 0,f.pause(),f.play()),j(),ee()}f.on("time",ee),f.on("play",j),f.on("ambient",j),f.on("pause",()=>{o=void 0,j()}),z.addEventListener("keydown",V=>{let te=V.key,ae=V.target;V.altKey||V.ctrlKey||V.metaKey||ae===b||(te==="ArrowRight"||te==="ArrowLeft"?(V.preventDefault(),(te==="ArrowRight"?g:h).click()):te==="Home"?(V.preventDefault(),k.click()):(te===" "||te==="k")&&ae===z&&(V.preventDefault(),ie()))});let Ae=V=>{let te=V.target.closest?.("[data-go]"),ae=V.key;!te||V.type==="keydown"&&ae!=="Enter"&&ae!==" "||(V.preventDefault(),V.stopPropagation(),le(()=>Y(Number(te.getAttribute("data-go"))-1)))};m.addEventListener("click",Ae),m.addEventListener("keydown",Ae);let De={seen:0,wants:e.autoplay==="visible"&&!c,auto(V){V?!n&&!q()&&(o=void 0,f.play()):q()&&(o=void 0,f.pause())}};ol.set(z,De);let I=typeof IntersectionObserver=="function"?new IntersectionObserver(V=>{for(let te of V)De.seen=te.isIntersecting?te.intersectionRatio:0,i===void 0&&(f.active=te.isIntersecting);Uf()},{threshold:[0,.2,.35,.5,.7,.9,1]}):void 0;return I?.observe(z),J(),j(),ee(),e.autoplay===!0&&!c&&f.play(),{root:z,transport:f,step:V=>le(()=>Y(V)),set(V,te=Yf,ae){if(a||!te.ok)return!1;let Te=Hf(V.rendered.svg);return s=V,r.replaceWith(Te),r=Te,ae&&(z.dataset.mode=ae),o!==void 0&&pe(),f.rebind(te),J(),j(),ee(),!0},freeze(V){i=V,f.pause(),f.active=!1,z.classList.add("frozen"),ee()},dispose(){a=!0,I?.disconnect(),ol.delete(z),f.dispose(),z.remove(),Uf()}}}var Jf=`
|
|
368
|
+
.iso-play{--ip-ink:#1c2026;--ip-muted:#68707c;--ip-line:#dfe3e8;--ip-bg:#fff;--ip-code:#f2f4f7;--ip-focus:#2a64d6;container:iso-play/inline-size;display:block;color:var(--ip-ink);background:var(--ip-bg);font:14px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;border-radius:10px}
|
|
369
|
+
.iso-play[data-mode="dark"]{--ip-ink:#e6e9ee;--ip-muted:#98a1ae;--ip-line:#333a44;--ip-bg:#15181d;--ip-code:#1f242b;--ip-focus:#7aa7ff;color-scheme:dark}
|
|
370
|
+
.iso-play:focus-visible,.iso-play button:focus-visible,.iso-play input:focus-visible,.iso-play summary:focus-visible{outline:2px solid var(--ip-focus);outline-offset:2px}
|
|
371
|
+
.iso-play [hidden]{display:none}
|
|
372
|
+
.iso-play-stage svg{display:block;width:100%;height:auto}
|
|
373
|
+
.iso-play-stage [data-go]{cursor:pointer}
|
|
374
|
+
.iso-play-row{display:flex;align-items:center;gap:6px;padding:8px 12px 4px}
|
|
375
|
+
.iso-play-btn{font:inherit;min-width:32px;height:32px;padding:0 8px;border:1px solid var(--ip-line);border-radius:8px;background:none;color:inherit;cursor:pointer}
|
|
376
|
+
.iso-play-btn:hover{border-color:var(--ip-muted)}
|
|
377
|
+
.iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}
|
|
378
|
+
.iso-play-btn.ambient[aria-pressed="false"]{color:var(--ip-muted);text-decoration:line-through}
|
|
379
|
+
.iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}
|
|
380
|
+
.iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
|
|
381
|
+
.iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}
|
|
382
|
+
.iso-play-group{display:inline-flex;gap:0}
|
|
383
|
+
.iso-play-dot{width:24px;height:24px;padding:0;border:0;background:none;cursor:pointer;display:grid;place-items:center}
|
|
384
|
+
.iso-play-dot::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--ip-line)}
|
|
385
|
+
.iso-play-dot.done::before{background:var(--ip-muted)}
|
|
386
|
+
.iso-play-dot.on::before{background:var(--ip-ink);width:11px;height:11px}
|
|
387
|
+
.iso-play-say{padding:4px 12px 10px;min-height:5.2em}
|
|
388
|
+
.iso-play-head{display:flex;align-items:baseline;gap:8px;font-weight:700}
|
|
389
|
+
.iso-play-num{flex:none;display:inline-grid;place-items:center;min-width:22px;height:22px;border-radius:11px;background:var(--ip-ink);color:var(--ip-bg);font-size:11px;align-self:center}
|
|
390
|
+
.iso-play-chapter,.iso-play-count{color:var(--ip-muted);font-size:12px;font-weight:500}
|
|
391
|
+
.iso-play-count{margin-left:auto;white-space:nowrap}
|
|
392
|
+
.iso-play-text{max-width:80ch}
|
|
393
|
+
.iso-play-text a{color:inherit}
|
|
394
|
+
.iso-play-code{margin:6px 0 0;padding:6px 10px;border-radius:8px;background:var(--ip-code);font:12px/1.5 ui-monospace,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
|
|
395
|
+
.iso-play-facts{display:flex;flex-wrap:wrap;gap:2px 16px;margin:6px 0 0;font-size:12px}
|
|
396
|
+
.iso-play-facts dt{color:var(--ip-muted)}
|
|
397
|
+
.iso-play-facts dd{margin:0 8px 0 -10px;font-weight:600}
|
|
398
|
+
.iso-play-list{padding:0 12px 10px;font-size:13px}
|
|
399
|
+
.iso-play-list summary{color:var(--ip-muted);cursor:pointer}
|
|
400
|
+
.iso-play.frozen>:not(.iso-play-stage){display:none}
|
|
401
|
+
@container iso-play (max-width:420px){.iso-play-time{display:none}.iso-play-row{flex-wrap:wrap}.iso-play-bar{flex-basis:100%;order:9}}
|
|
402
|
+
`;var Xf=1,al="(?:[^/:%\\s]|%[0-9A-F]{2})+",un=["debug","info","notice","warning","error"],Qf=["1m","1h","1d"],Cn={"1m":6e4,"1h":36e5,"1d":864e5},ll=t=>`^(?:(?:${t.kinds.join("|")}):(?:${al})(?:/(?:${t.kinds.join("|")}):(?:${al}))*)?$`;function cl(t){let e=new RegExp(ll(t)),s=o=>e.test(o);function r(o){if(!e.test(o))throw new Error(`not a scope path: ${JSON.stringify(o)}`);return o===""?[]:o.split("/").map(n=>{let a=n.indexOf(":");return{kind:n.slice(0,a),name:decodeURIComponent(n.slice(a+1))}})}function i(o){let n="";for(let a of r(o)){if(!t.parents[a.kind].includes(n))return!1;n=a.kind}return!0}return{isScope:s,parseScope:r,wellNested:i}}var pl=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),em=t=>t.map(e=>`${e.kind}:${pl(e.name)}`).join("/"),tm=(t,e,s)=>(t?`${t}/`:"")+`${e}:${pl(s)}`,Jt=t=>t===""?0:t.split("/").length;function Ms(t,e){return e<=0?"":(t===""?[]:t.split("/")).slice(0,e).join("/")}var nm=t=>Ms(t,Jt(t)-1),hn=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),sm=(t,e)=>t!==""&&t.split("/").includes(e),Yr=t=>t===""?"fleet":t.slice(t.lastIndexOf("/")+1).split(":")[0],Wr=t=>t===""?"all hosts":decodeURIComponent(t.slice(t.lastIndexOf("/")+1).split(":").slice(1).join(":"));function Jr(t){let e=[{scope:"",label:"all hosts",kind:"fleet"}];for(let s=1;s<=Jt(t);s++){let r=Ms(t,s);e.push({scope:r,label:Wr(r),kind:Yr(r)})}return e}var mp=["kind","source","severity","scope","since","before"];function ey(t){let e=[],s=0;for(;s<t.length;){for(;s<t.length&&/\s/.test(t[s]);)s++;if(s>=t.length)break;let r=!1;t[s]==="-"&&s+1<t.length&&!/\s/.test(t[s+1])&&(r=!0,s++);let i=/^(attr\.[a-z][a-z0-9_]*|[a-z]+):/.exec(t.slice(s)),o;i&&(o=i[1],s+=i[0].length);let n="",a=!1;if(t[s]==='"'){let f=t.indexOf('"',s+1);n=t.slice(s+1,f<0?t.length:f),a=!0,s=f<0?t.length:f+1}else{let f=s;for(;s<t.length&&!/\s/.test(t[s]);)s++;n=t.slice(f,s)}e.push({neg:r,raw:n,quoted:a,field:o})}return e}var ty=/^(\d+)(s|m|h|d|w)$/,ny={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function up(t,e){let s=ty.exec(t);if(s)return e-Number(s[1])*ny[s[2]];let r=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?)?(Z|[+-]\d{2}:?\d{2})?$/.exec(t);if(!r)return;let[,i,o,n,a="0",f="0",p="0",c="0",l]=r;if(l){let m=Date.parse(t.replace(" ","T"));return Number.isNaN(m)?void 0:m}let d=new Date(+i,+o-1,+n,+a,+f,+p,+c.padEnd(3,"0")).getTime();return Number.isNaN(d)?void 0:d}function sy(t,e,s=Date.now()){let r=[],i=[];for(let o of ey(e??"")){let n=p=>{let c=o.field?`${o.field}:${o.raw}`:o.raw;p&&i.push(`${JSON.stringify(c)}: ${p}; searched as text`),c&&r.push({neg:o.neg,value:c})};if(!o.field){n();continue}if(!(t.includes(o.field)||o.field.startsWith("attr."))){n(`no field ${o.field}`);continue}if(!o.raw){n(`${o.field}: needs a value`);continue}let f=o.field;if(f==="severity"){let p=/^(>=|<=|>|<|=)?(.*)$/.exec(o.raw);if(!un.includes(p[2])){n(`no severity ${p[2]} (${un.join(", ")})`);continue}r.push({neg:o.neg,field:f,op:p[1]??"=",value:p[2]})}else if(f==="since"||f==="before"){let p=up(o.raw,s);if(p===void 0){n(`can't read the time ${o.raw} (15m, 2h, 3d, 1w, or a date like 2026-11-20 or 2026-11-20T09:30)`);continue}if(o.neg){n(`-${f} isn't allowed (use ${f==="since"?"before":"since"})`);continue}r.push({neg:!1,field:f,value:o.raw,time:p})}else r.push({neg:o.neg,field:f,value:o.raw})}return{terms:r,warnings:i}}var dl=t=>un.indexOf(t),ry={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function iy(t,e){switch(t.field){case void 0:return{field:"text",value:t.value};case"kind":case"source":return t.value.endsWith("*")?{field:t.field,value:t.value.slice(0,-1),prefix:!0}:{field:t.field,value:t.value};case"severity":return{field:"severity",op:ry[t.op??"="],value:t.value};case"scope":return{field:"scope",value:t.value,from:e.topKinds.some(s=>t.value.startsWith(`${s}:`))?"top":"segments"};case"since":case"before":return;default:return e.links.includes(t.field)?{field:"link",link:t.field,value:t.value}:{field:"attr",key:t.field.slice(5),value:t.value}}}function oy(t,e){let s=[],r=new Map;for(let i of e.terms){let o=iy(i,t);if(!o)continue;if(i.neg){s.push({not:!0,any:[o]});continue}if(o.field==="text"||o.field==="severity"){s.push({any:[o]});continue}let n=o.field==="link"?`link.${o.link}`:o.field==="attr"?`attr.${o.key}`:o.field,a=r.get(n);if(a)a.any.push(o);else{let f={any:[o]};r.set(n,f),s.push(f)}}return{all:s}}function ay(t,e,s,r){switch(e.field){case"text":{let i=e.value.toLowerCase();if(s.summary.toLowerCase().includes(i)||s.kind.toLowerCase().includes(i)||s.source.toLowerCase().includes(i)||s.scope.toLowerCase().includes(i))return!0;for(let[o,n]of Object.entries(s.attrs))if(typeof n=="string"&&!r.has(`${s.source}.${o}`)&&n.toLowerCase().includes(i))return!0;return!1}case"kind":case"source":{let i=s[e.field];return e.prefix?i.startsWith(e.value):i===e.value}case"severity":{let i=dl(s.severity),o=dl(e.value);return e.op==="ge"?i>=o:e.op==="gt"?i>o:e.op==="le"?i<=o:e.op==="lt"?i<o:i===o}case"scope":return e.from==="top"?hn(s.scope,e.value):`/${s.scope}/`.includes(`/${e.value}/`);case"link":return t.linkMatch?.(String(e.link),e.value,s)??s.links[e.link]===e.value;case"attr":{let i=s.attrs[e.key];return i!=null&&String(i).toLowerCase()===e.value.toLowerCase()}}}function Xr(t){let e=[...mp,...t.links],s=(a,f=Date.now())=>sy(e,a,f),r=a=>oy(t,a);function i(a,f,p,c){let l=s(a,f);return{where:r(l),...ro(l,p,c),warnings:l.warnings}}function o(a,f=[]){let p=new Set(f),c=a?.all??[];return c.length?l=>c.every(d=>d.any.some(m=>ay(t,m,l,p))!==!!d.not):()=>!0}return{FIELDS:e,parseSearch:s,toAst:r,compileSearch:i,matchAst:o,matcher:(a,f=[])=>o(r(a),f)}}function ro(t,e,s){for(let r of t.terms)r.field==="since"&&(e=Math.max(e,r.time)),r.field==="before"&&(s=Math.min(s,r.time));return{from:e,to:Math.max(e,s)}}function io(t,e){let s=e.toLowerCase(),r=[];for(let o of t.terms){if(o.neg||o.field||!o.value)continue;let n=o.value.toLowerCase();for(let a=s.indexOf(n);a>=0;a=s.indexOf(n,a+n.length))r.push([a,a+n.length])}r.sort((o,n)=>o[0]-n[0]);let i=[];for(let o of r){let n=i[i.length-1];n&&o[0]<=n[1]?n[1]=Math.max(n[1],o[1]):i.push([...o])}return i}var rm=t=>un.filter(e=>dl(e)>=dl(t));var im=new Map,fl=new Map;function nn(t,e){if(!t||t==="UTC")return 0;let s=`${t}|${Math.floor(e/(15*6e4))}`,r=fl.get(s);if(r!==void 0)return r;let i=im.get(t);if(!i){try{i=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}catch{return 0}im.set(t,i)}let o={};for(let f of i.formatToParts(new Date(e)))f.type!=="literal"&&(o[f.type]=Number(f.value));let n=Date.UTC(o.year,o.month-1,o.day,o.hour%24,o.minute,o.second),a=Math.round((n-Math.floor(e/1e3)*1e3)/6e4)*6e4;return fl.size>5e4&&fl.clear(),fl.set(s,a),a}var om=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function lr(t,e,s){if(e==="1m")return Math.floor(t/6e4)*6e4;let r=nn(s,t);if(e==="1h")return r%36e5===0?Math.floor(t/36e5)*36e5:Math.floor((t+r)/36e5)*36e5-r;let i=Math.floor((t+r)/864e5)*864e5,o=i-nn(s,i-r);return o>t?o=i-864e5-nn(s,i-864e5-r):ml(o,s)<=t&&(o=ml(o,s)),o}function ml(t,e,s="1d"){if(s==="1m")return t+6e4;if(s==="1h")return t+36e5;let r=nn(e,t),i=Math.floor((t+r)/864e5)*864e5+864e5;return i-nn(e,i-r)}var Vs=6e4,Ks=36e5,jn=864e5;function ul(t,e,s,r={}){let i=Math.max((r.minFrac??.15)*(s-e),r.minMs??10*Vs),o=t.filter(([f,p])=>p>=e&&f<s).map(([f,p])=>[Math.max(e,f),Math.min(s,Math.max(f,p))]).sort((f,p)=>f[0]-p[0]),n=[];if(!o.length)return n;let a=e;for(let[f,p]of o)f-a>i&&n.push({from:a,to:f}),a=Math.max(a,p);return s-a>i&&n.push({from:a,to:s}),n}function cr(t){if(t>=jn){let e=Math.floor(t/jn),s=Math.round((t-e*jn)/Ks);return s?`${e} d ${s} h`:`${e} d`}if(t>=Ks){let e=Math.floor(t/Ks),s=Math.round((t-e*Ks)/Vs);return s&&e<10?`${e} h ${s} min`:`${e} h`}return`${Math.max(1,Math.round(t/Vs))} min`}var pr=t=>`${t.from}-${t.to}`;function Qr(t,e,s,r=[],i={}){let o=i.cut??24,n=Math.max(1,s),a=Math.max(1,e-t),f=r.filter(b=>b.to>t&&b.from<e).map(b=>({from:Math.max(t,b.from),to:Math.min(e,b.to),w:i.weights?.get(pr(b))??0})).sort((b,x)=>b.from-x.from),p=f.reduce((b,x)=>b+(x.to-x.from)*(1-x.w),0),c=f.reduce((b,x)=>b+(1-x.w)*o,0),l=(n-c)/Math.max(1,a-p);if(!(l>0)||c>n*.6)return Qr(t,e,s,[],i);let d=[[t,0]],m=0,h=t,y=[];for(let b of f){m+=(b.from-h)*l,d.push([b.from,m]);let x=(1-b.w)*o+b.w*l*(b.to-b.from);y.push({from:b.from,to:b.to,x0:m,x1:m+x,weight:b.w}),m+=x,d.push([b.to,m]),h=b.to}d.push([e,m+(e-h)*l]);let g=b=>{if(b<=t)return(b-t)*l;if(b>=e)return d[d.length-1][1]+(b-e)*l;let x=0,w=d.length-1;for(;w-x>1;){let A=x+w>>1;d[A][0]<=b?x=A:w=A}let[$,v]=d[x],[O,C]=d[w];return O===$?v:v+(b-$)/(O-$)*(C-v)},k=b=>y.find(x=>x.weight<1&&b>x.x0&&b<x.x1);return{t0:t,t1:e,width:n,cuts:y,x:g,t:b=>{let x=k(b);if(x)return b-x.x0<x.x1-b?x.from:x.to;if(b<=0)return t+b/l;let w=0,$=d.length-1;if(b>=d[$][1])return e+(b-d[$][1])/l;for(;$-w>1;){let R=w+$>>1;d[R][1]<=b?w=R:$=R}let[v,O]=d[w],[C,A]=d[$];return A===O?v:v+(b-O)/(A-O)*(C-v)},cutAt:k,msPerPx:1/l}}var hp=[1e3,5e3,15e3,3e4,Vs,5*Vs,15*Vs,30*Vs,Ks,3*Ks,6*Ks,12*Ks,jn,2*jn,7*jn,14*jn,28*jn];function hl(t,e,s=80){let r=hp.find(f=>f/t.msPerPx>=s)??hp[hp.length-1],i=[],o=f=>{let p=new Date(f+nn(e,f)),c=String(p.getUTCHours()).padStart(2,"0"),l=String(p.getUTCMinutes()).padStart(2,"0"),d=String(p.getUTCSeconds()).padStart(2,"0"),m=`${p.getUTCDate()} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][p.getUTCMonth()]}`,h=c==="00"&&l==="00"&&d==="00";return r>=jn||h?{label:m,major:!0}:{label:r<Vs?`${c}:${l}:${d}`:`${c}:${l}`,major:!1}},n=[],a=t.t0;for(let f of t.cuts)f.weight<1&&(n.push([a,f.from]),a=f.to);n.push([a,t.t1]);for(let[f,p]of n){let c=d=>d-nn(e,d-nn(e,d)),l=Math.ceil((f+nn(e,f))/r)*r;r>=7*jn&&(l=Math.ceil((f+nn(e,f))/jn)*jn);for(let d=0,m=c(l);m<p&&d<2e3;d++,l+=r,m=c(l)){if(m<f)continue;let h=t.x(m),y=i[i.length-1];(!y||h-y.x>=s*.6)&&i.push({t:m,x:h,...o(m)})}}return i}var ly=["id","time","t","dur","scope","source","kind","severity","summary"],cy=t=>{if(t==null)return"";let e=typeof t=="string"&&/^[=+\-@\t\r]/.test(t)?`'${t}`:String(t);return/[",\n\r]/.test(e)?`"${e.replace(/"/g,'""')}"`:e},am=(t,e)=>e.size?{...t,attrs:Object.fromEntries(Object.entries(t.attrs).filter(([s])=>!e.has(`${t.source}.${s}`)))}:t;function yl(t,e=[]){let s=new Set(e);return JSON.stringify(t.map(r=>am(r,s)),null,2)+`
|
|
403
|
+
`}function gl(t,e=[]){let s=new Set(e),r=t.map(f=>am(f,s)),i=[...new Set(r.flatMap(f=>Object.keys(f.attrs)))].sort(),o=[...new Set(r.flatMap(f=>Object.keys(f.links)))].sort(),n=[...ly,...i.map(f=>`attr.${f}`),...o.map(f=>`link.${f}`)],a=r.map(f=>[f.id,new Date(f.t).toISOString(),f.t,f.dur,f.scope,f.source,f.kind,f.severity,f.summary,...i.map(p=>f.attrs[p]),...o.map(p=>f.links[p])].map(cy).join(","));return[n.join(","),...a].join(`\r
|
|
367
404
|
`)+`\r
|
|
368
|
-
`}var gh=864e5,Jn=36e5,el=(t,e)=>t.t-e.t||(t.id<e.id?-1:t.id>e.id?1:0);function ds(t,e){let s=0,r=t.length;for(;s<r;){let i=s+r>>1;t[i].t<e?s=i+1:r=i}return s}var Cd=(t,e)=>{t.min=Math.min(t.min,e.min),t.max=Math.max(t.max,e.max),t.sum+=e.sum,t.count+=e.count};function Id(t,e,s){let r=[];for(let i of t){let o=sr(i.t,e,s),n=r[r.length-1];n&&n.t===o?Cd(n,i):r.push({t:o,min:i.min,max:i.max,sum:i.sum,count:i.count})}return r}function Zc(t,e,s,r){for(let n=ds(t,e.t);n<t.length&&t[n].t===e.t;n++)if(s(t[n])){t[n]=e;return}let i=t[t.length-1];if(!i||r(i,e)<=0){t.push(e);return}let o=ds(t,e.t);for(;o<t.length&&r(t[o],e)<0;)o++;t.splice(o,0,e)}function zd(t,e,s){for(let r=ds(t,e);r<t.length&&t[r].t===e;r++)if(s(t[r])){t.splice(r,1);return}}function jd(t,e,s={}){let r=t.catalog,{isScope:i}=Ga(e),{parseSearch:o,matchAst:n,toAst:a}=Yr(e),m=N=>Object.fromEntries(e.flags.filter(ee=>N?.[ee]).map(ee=>[ee,!0])),p=s.now??r.now,c=(r.names??[]).flatMap(N=>(N.aliases??[]).map(ee=>[ee,N.scope])).sort((N,ee)=>ee[0].length-N[0].length),l=new Map,f=N=>{if(!c.length)return N;let ee=l.get(N);if(ee===void 0){let ye=c.find(([ke])=>un(N,ke));ee=ye?ye[1]+N.slice(ye[0].length):N,l.set(N,ee)}return ee},d=new Map((r.names??[]).map(N=>[N.scope,N])),u=N=>c.length?{...N,scope:f(N.scope)}:N,y=N=>`${N.source}\0${N.id}`,g=t.events.map(u).sort(el),x=new Map;for(let N of g)x.set(y(N),N);let h=g.filter(N=>N.dur!==void 0&&!N.open),b=h.reduce((N,ee)=>Math.max(N,ee.dur),0),w=new Map;for(let N of g)N.open&&w.set(y(N),N);let k=new Map,$=new Set,v=N=>{for(let ee=Jt(N);ee>=1;ee--){let ye=$s(N,ee);if($.has(ye))break;$.add(ye)}},T=new Map;for(let N of r.sources)for(let ee of N.series)T.set(ee.name,ee.type);let R=r.sources.flatMap(N=>(N.sensitive??[]).map(ee=>`${N.name}.${ee}`)),O=new Map;for(let N of r.sources)O.set(N.name,{events:N.defaultRetention.events,rollups:{...N.defaultRetention.rollups},setBy:"default"});for(let N of r.retention)O.set(N.source,{events:N.events,rollups:{...N.rollups},setBy:N.setBy});let I=new Map;for(let N of r.sources)for(let ee of N.series)I.set(ee.name,N.name);function M(N){let ee=f(N.scope),ye=`${N.series}\0${ee}`,ke=k.get(ye);ke||(ke={series:N.series,scope:ee,fine:[],cache:new Map},k.set(ye,ke),v(ee));let Ve="value"in N?{t:N.t,min:N.value,max:N.value,sum:N.value,count:1}:{t:N.t,min:N.min,max:N.max,sum:N.sum,count:N.count};Zc(ke.fine,Ve,we=>we.t===Ve.t,(we,Ue)=>we.t-Ue.t),ke.cache.clear()}for(let N of g)v(N.scope);for(let N of t.metrics)M(N);let A=new Map,P=new Set,j=(N,ee)=>{P.add(N.source);let ye=A.get(N.scope);ye||A.set(N.scope,ye=new Map);let ke=ye.get(N.source);ke||ye.set(N.source,ke=new Map);let Ve=Math.floor(N.t/Jn)*Jn,we=ke.get(Ve);if(we||ke.set(Ve,we={t:Ve,count:0,severity:{},kinds:{},first:1/0,last:-1/0}),we.count+=ee,ee>0)we.first=Math.min(we.first,N.t),we.last=Math.max(we.last,N.t);else if(N.t===we.first||N.t===we.last){we.first=1/0,we.last=-1/0;for(let Ue=ds(g,Ve);Ue<g.length&&g[Ue].t<Ve+Jn;Ue++){let Le=g[Ue];Le.scope===N.scope&&Le.source===N.source&&(we.first=Math.min(we.first,Le.t),we.last=Math.max(we.last,Le.t))}}we.severity[N.severity]=(we.severity[N.severity]??0)+ee,we.kinds[N.kind]=(we.kinds[N.kind]??0)+ee,we.severity[N.severity]===0&&delete we.severity[N.severity],we.kinds[N.kind]===0&&delete we.kinds[N.kind],we.count||ke.delete(Ve)};for(let N of g)j(N,1);let F=(N,ee,ye)=>{let ke=`${ee}|${ye??""}`,Ve=N.cache.get(ke);return Ve||(Ve=ee==="1d"?Id(F(N,"1h",ye),"1d",ye):Id(N.fine,ee,ye),N.cache.set(ke,Ve)),Ve},Y=N=>N===null?-1/0:p-N*gh,J=N=>Y(O.get(N)?.events??null),U=(N,ee)=>{let ye=O.get(N);return Y(ye?ee?ye.rollups[ee]:ye.events:null)};function C(N){let ee=[];for(let ye of new Set(N)){let ke=O.get(ye);if(!ke)continue;let Ve=g.find($e=>$e.source===ye&&$e.t>=J(ye))?.t,we=$e=>{let S=1/0;for(let B of k.values())if(I.get(B.series)===ye){let K=($e?F(B,$e):B.fine).find(ae=>ae.t>=U(ye,$e));K&&K.t<S&&(S=K.t)}return S===1/0?void 0:S},Ue=[Ve,we()].filter($e=>$e!==void 0),Le={};for(let $e of["1m","1h","1d"]){let S=we($e)??(Ve!==void 0&&Ve>=U(ye,$e)?Ve:void 0);S!==void 0&&(Le[$e]=Math.max(S,U(ye,$e)))}ee.push({source:ye,events:ke.events,rollups:{...ke.rollups},setBy:ke.setBy,keptFrom:{...Ue.length?{events:Math.min(...Ue)}:{},rollups:Le}})}return ee}function G(N){let ee=N.where,ye={from:N.from,to:N.to},ke=[];if(!ee&&N.q){let K=o(N.q,p);ee=a(K),ye=Xi(K,N.from,N.to),ke=K.warnings}let Ve=n(ee,R),we=N.filters??{},Ue=we.source?.length?new Set(we.source):void 0,Le=we.kind?.length?new Set(we.kind):void 0,$e=we.severity?.length?new Set(we.severity):void 0,S=we.scope?.length?we.scope:void 0;return{test:K=>un(K.scope,N.scope)&&(!Ue||Ue.has(K.source))&&(!Le||Le.has(K.kind))&&(!$e||$e.has(K.severity))&&(!S||S.some(ae=>un(K.scope,ae)))&&K.t>=J(K.source)&&Ve(K),range:ye,warnings:ke}}function Z(N){let ee=Jt(N.scope),ye=ee+N.depth,ke=new Map,Ve=$e=>{let S=ke.get($e);return S===void 0&&!ke.has($e)&&(S=un($e,N.scope)?Jt($e)>=ye?$s($e,ye):$e:void 0,ke.set($e,S)),S},we=$e=>{let S=0,B=Jt($e)+1;for(let K of $)Jt(K)===B&&un(K,$e)&&S++;return S},Ue=new Map,Le=$e=>{let S=Ue.get($e);if(!S){let B=Jt($e)-ee,K=d.get($e);S={scope:$e,label:K?.label??Zr($e),kind:Gr($e),...m(K),depth:B,...B<N.depth?{own:!0}:{},children:we($e),count:0},Ue.set($e,S)}return S};for(let $e of $)Jt($e)===ye&&un($e,N.scope)&&Le($e);return ye===0&&Le(""),{at:Ve,add:Le,rows:Ue}}let Q=N=>[...N.values()].sort((ee,ye)=>ee.scope===ye.scope?0:ee.scope<ye.scope?-1:1);function z(N,ee){let ye=[];for(let ke=ds(h,N-b);ke<h.length&&h[ke].t<N;ke++)h[ke].t+h[ke].dur>N&&ye.push(h[ke]);for(let ke of w.values())ke.t<N&&p>N&&ye.push(ke);for(let ke=ds(g,N);ke<g.length&&g[ke].t<ee;ke++)ye.push(g[ke]);return ye}function D(N,ee,ye,ke){let Ve=N.series?new Set(N.series):void 0,we=new Map;for(let Le of k.values()){if(Ve&&!Ve.has(Le.series))continue;let $e=ee(Le.scope);if($e===void 0)continue;let S=I.get(Le.series)??"",B=U(S,N.bin),K=N.bin?F(Le,N.bin,N.tz):Le.fine;for(let ae=ds(K,N.bin?sr(ye,N.bin,N.tz):ye);ae<K.length&&K[ae].t<ke;ae++){let le=K[ae];if(le.t<B)continue;let fe=`${Le.series}\0${$e}\0${le.t}`,se=we.get(fe);se?Cd(se,le):we.set(fe,{series:Le.series,scope:$e,t:le.t,bin:N.bin??"1m",min:le.min,max:le.max,sum:le.sum,count:le.count})}}let Ue=[...we.values()].sort((Le,$e)=>Le.t-$e.t||(Le.series<$e.series?-1:1)||(Le.scope<$e.scope?-1:1));return N.bin?Ue:Ue.map(Le=>({series:Le.series,scope:Le.scope,t:Le.t,value:Le.count===1||T.get(Le.series)!=="gauge"?Le.sum:Le.sum/Le.count}))}let V=N=>`${N.t}:${N.id}`,W=(N,ee)=>{let ye=ee.indexOf(":"),ke=Number(ee.slice(0,ye)),Ve=ee.slice(ye+1);return N.t>ke||N.t===ke&&N.id>Ve};function de(N){if(N.bin!=="1h"&&N.bin!=="1d"||(N.where?.all.length??0)||N.q||N.filters?.kind?.length||N.filters?.severity?.length||N.filters?.scope?.length||tn(N.tz,N.from)%Jn||tn(N.tz,N.to)%Jn)return;let ee=N.filters?.source?.length?new Set(N.filters.source):void 0,ye=te=>Math.max(N.from,J(te)),{at:ke,add:Ve,rows:we}=Z(N),Ue=new Set,Le=new Map,$e=0,S=(te,xe)=>{let he=sr(xe,N.bin,N.tz),Ie=`${te}\0${he}`,E=Le.get(Ie);return E||(E={scope:te,t:he,bin:N.bin,count:0,severity:{},kinds:{}},Le.set(Ie,E)),E},B=(te,xe,he)=>{let Ie=Ve(te);Ie.count+=he,$e+=he,(Ie.first===void 0||xe<Ie.first)&&(Ie.first=xe),(Ie.last===void 0||xe>Ie.last)&&(Ie.last=xe)},K=Math.floor(N.to/Jn)*Jn;for(let[te,xe]of A){let he=ke(te);if(he!==void 0)for(let[Ie,E]of xe){if(ee&&!ee.has(Ie))continue;let q=Math.ceil(ye(Ie)/Jn)*Jn;for(let[_,re]of E){if(_<q||_>=K)continue;B(he,re.first,re.count),re.last>(we.get(he).last??-1/0)&&(we.get(he).last=re.last),Ue.add(Ie);let pe=S(he,_);pe.count+=re.count;for(let[Te,Pe]of Object.entries(re.severity))pe.severity[Te]=(pe.severity[Te]??0)+Pe;for(let[Te,Pe]of Object.entries(re.kinds))pe.kinds[Te]=(pe.kinds[Te]??0)+Pe}}}let ae=te=>un(te.scope,N.scope)&&(!ee||ee.has(te.source))&&te.t>=J(te.source)&&ke(te.scope)!==void 0,le=te=>{let xe=ke(te.scope);B(xe,te.t,1),Ue.add(te.source);let he=S(xe,te.t);he.count++,he.severity[te.severity]=(he.severity[te.severity]??0)+1,he.kinds[te.kind]=(he.kinds[te.kind]??0)+1};for(let te of P){if(ee&&!ee.has(te))continue;let xe=ye(te),he=Math.ceil(xe/Jn)*Jn,Ie=he>=K?[[xe,N.to]]:[[xe,he],[K,N.to]];for(let[E,q]of Ie)for(let _=ds(g,E);_<g.length&&g[_].t<q;_++){let re=g[_];re.source===te&&ae(re)&&le(re)}}let fe=Rn[N.bin],se=[];for(let te=ds(h,N.from-b);te<h.length&&h[te].t<N.from;te++){let xe=h[te];xe.t+xe.dur>N.from&&ae(xe)&&(B(ke(xe.scope),xe.t,1),Ue.add(xe.source),xe.dur>=fe&&se.length<5e3&&se.push(xe))}for(let te of w.values())te.t<N.from&&p>N.from&&ae(te)&&(B(ke(te.scope),te.t,1),Ue.add(te.source),se.length<5e3&&se.push(te));for(let te=ds(h,N.from);te<h.length&&h[te].t<N.to&&se.length<5e3;te++)h[te].dur>=fe&&ae(h[te])&&se.push(h[te]);for(let te of w.values())te.t>=N.from&&te.t<N.to&&se.length<5e3&&ae(te)&&se.push(te);let ge=D(N,ke,N.from,N.to);for(let te of ge){let xe=I.get(te.series);xe&&Ue.add(xe)}let Se=[...Le.values()].sort((te,xe)=>te.t-xe.t||(te.scope<xe.scope?-1:1));return{timeline:1,type:"result",rows:Q(we),bins:Se,spans:se,metrics:ge,total:$e,retention:C(Ue)}}async function ce(N){if(!i(N.scope))throw new Error(`not a scope path: ${JSON.stringify(N.scope)}`);let ee=de(N);if(ee)return ee;let{test:ye,range:ke,warnings:Ve}=G(N),{at:we,add:Ue,rows:Le}=Z(N),$e=new Set,S=[];for(let ge of z(ke.from,ke.to)){if(!ye(ge))continue;let Se=we(ge.scope);if(Se===void 0)continue;let te=Ue(Se);te.count++,(te.first===void 0||ge.t<te.first)&&(te.first=ge.t),(te.last===void 0||ge.t>te.last)&&(te.last=ge.t),$e.add(ge.source),S.push(ge)}S.sort(el);let B=D(N,we,ke.from,ke.to);for(let ge of B){let Se=I.get(ge.series);Se&&$e.add(Se)}let K={timeline:1,type:"result",total:S.length,...Ve.length?{warnings:Ve}:{}};if(N.bin){let ge=Rn[N.bin],Se=new Map,te=[];for(let he of S){if((he.open||he.dur!==void 0&&he.dur>=ge)&&te.length<5e3&&te.push(he),he.t<ke.from)continue;let Ie=we(he.scope),E=sr(he.t,N.bin,N.tz),q=`${Ie}\0${E}`,_=Se.get(q);_||(_={scope:Ie,t:E,bin:N.bin,count:0,severity:{},kinds:{}},Se.set(q,_)),_.count++,_.severity[he.severity]=(_.severity[he.severity]??0)+1,_.kinds[he.kind]=(_.kinds[he.kind]??0)+1}let xe=[...Se.values()].sort((he,Ie)=>he.t-Ie.t||(he.scope<Ie.scope?-1:1));return{...K,rows:Q(Le),bins:xe,spans:te,metrics:B,retention:C($e)}}let ae=Math.min(1e4,Math.max(1,N.limit??2e3)),le=N.cursor?S.findIndex(ge=>W(ge,N.cursor)):0,fe=le<0?[]:S.slice(le,le+ae),se=le>=0&&le+ae<S.length;return{...K,rows:Q(Le),events:fe,metrics:B,retention:C($e),...se?{next:V(fe[fe.length-1])}:{}}}let H=new Set,ne=N=>mn.includes(N),Ee=0;function qe(N){let ee=y(N),ye=x.get(ee);ye&&(zd(g,ye.t,ke=>ke===ye),j(ye,-1),ye.dur!==void 0&&!ye.open&&zd(h,ye.t,ke=>ke===ye),w.delete(ee)),x.set(ee,N),j(N,1),Zc(g,N,()=>!1,el),N.open?w.set(ee,N):N.dur!==void 0&&(Zc(h,N,()=>!1,el),b=Math.max(b,N.dur)),v(N.scope)}return{async catalog(){return{...r,now:p,retention:C(r.sources.map(N=>N.name))}},query:ce,subscribe(N,ee){let ye={q:N,on:ee};return H.add(ye),()=>{H.delete(ye)}},...s.stateAt?{stateAt:(N,ee)=>s.stateAt(N,ee)}:{},append(N,ee=[],ye){ye!==void 0&&(p=Math.max(p,ye));let ke=new Set($),Ve=N.map(u);for(let we of Ve){if(!ne(we.severity))throw new Error(`not a severity: ${we.severity}`);qe(we)}for(let we of ee)M(we);Ee++;for(let we of H){let{test:Ue}=G(we.q),{at:Le}=Z(we.q),$e=Ve.filter(fe=>Ue(fe)&&Le(fe.scope)!==void 0),S=we.q.series?new Set(we.q.series):void 0,B=ee.filter(fe=>un(f(fe.scope),we.q.scope)&&(!S||S.has(fe.series))).map(fe=>({...fe,scope:Le(f(fe.scope))})),K=[...$].filter(fe=>!ke.has(fe)),ae=Jt(we.q.scope)+we.q.depth,le=K.filter(fe=>Jt(fe)===ae&&un(fe,we.q.scope)).map(fe=>({scope:fe,label:d.get(fe)?.label??Zr(fe),kind:Gr(fe),depth:we.q.depth,children:0,count:0}));we.on({timeline:1,type:"batch",events:$e,metrics:B,...le.length?{rows:le}:{},now:p,resume:String(Ee)})}},setRetention(N,ee){O.set(N,{events:ee.events,rollups:{...ee.rollups},setBy:"user"})},get now(){return p},get size(){let N=0;for(let ee of k.values())N+=ee.fine.length;return{events:g.length,samples:N}}}}var Ld="http://www.w3.org/2000/svg",or=22,tl=38,ms=26,bh=210,wh=24,eo=6e4,ar=36e5,xn=864e5,_d={"15m":15*eo,"1h":ar,"1d":xn,"1w":7*xn},Fd=t=>mn.indexOf(t),xh={debug:"dot",info:"circle",notice:"square",warning:"triangle",error:"diamond"},yt=(t,e,s)=>{let r=document.createElementNS(Ld,t);for(let[i,o]of Object.entries(e))o!==void 0&&r.setAttribute(i,String(o));if(s){let i=document.createElementNS(Ld,"title");i.textContent=s,r.append(i)}return r},nn=(t,e)=>{try{return new Intl.DateTimeFormat(void 0,{timeZone:e,dateStyle:"medium",timeStyle:"medium"}).format(t)}catch{return new Date(t).toISOString()}},Uc=t=>t<1e3?`${Math.round(t)} ms`:t<eo?`${(t/1e3).toFixed(1)} s`:rr(t),kh=(t,e)=>e==="bytes"?t>=1e9?`${(t/1e9).toFixed(1)} GB`:t>=1e6?`${(t/1e6).toFixed(1)} MB`:t>=1e3?`${(t/1e3).toFixed(1)} kB`:`${Math.round(t)} B`:`${Math.round(t*10)/10}${e==="count"?"":` ${e}`}`;function Yc(t,e){if(t<=3*ar)return{kind:"single"};for(let s of["1m","1h","1d"])if(t/Rn[s]<=e/2)return{kind:"binned",bin:s};return{kind:"binned",bin:"1d"}}function Hc(t,e,s){let r=[];for(let n of t.events??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);for(let n of t.spans??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);let i=e.kind==="binned"?Rn[e.bin]:eo;for(let n of t.bins??[])n.count&&r.push([n.t,n.t+Rn[n.bin]]);let o=new Map;for(let n of t.metrics){let a="value"in n?n.value:n.sum,m=`${n.series}|${n.scope}`,p=(s?.get(n.series)??"counter")==="counter"?a!==0:o.get(m)!==a;o.set(m,a),p&&r.push([n.t,n.t+i])}return r}function Dd(t,e){let s=e.tz??Intl.DateTimeFormat().resolvedOptions().timeZone,r=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,i=e.motion??!r;t.classList.add(...e.rootClass??[],"tlx");let{parseSearch:o,compileSearch:n}=Yr(e.catalog),a=(L="system")=>{t.style.colorScheme=L==="system"?"light dark":L,L==="system"?delete t.dataset.theme:t.dataset.theme=L};a(e.theme),t.setAttribute("role","region"),t.setAttribute("aria-label","Timeline");let m,p="",c=1,l="",f={},d=!1,u=e.collapseGaps??!0,y={t0:0,t1:xn},g,x="",h={from:0,to:0,mode:{kind:"single"},key:""},b,w,k,$,v=!0,T=0,R=0,O=!1,I,M=[],A=[],P=-1,j=new Set,F=new Map,Y=[],J=Hr(0,xn,800),U=new Map,C=[],G=me("nav",{class:"tlx-crumbs","aria-label":"Scope"}),Z=me("div",{class:"segmented tlx-quick",role:"group","aria-label":"Range"});for(let L of["15m","1h","1d","1w","run"]){let X=me("button",{type:"button",class:"seg","data-v":L,title:L==="run"?"The latest run":`The last ${L}`},L==="run"?"this run":L);X.addEventListener("click",()=>Vs(L)),Z.append(X)}let Q=me("button",{type:"button",class:"btn sm tlx-live","aria-pressed":"false",title:"Follow what happens now"},"Live"),z=me("button",{type:"button",class:"btn sm quiet tlx-now",hidden:!0,title:"Back to the live edge"},"Back to now"),D=me("button",{type:"button",class:"btn sm quiet tlx-fit",title:"Everything in this scope"},"Fit"),V=me("input",{type:"checkbox",class:"tlx-gaps"});V.checked=u;let W=!0,de=me("input",{type:"checkbox",class:"tlx-quiet"});de.checked=W;let ce=me("input",{type:"search",class:"input tlx-q",placeholder:"Search: words, kind:\u2026, source:\u2026, severity:>=warning, -kind:\u2026","aria-label":"Search the timeline",spellcheck:"false"}),H=me("span",{class:"tlx-hits",role:"status","aria-live":"polite"}),ne=me("button",{type:"button",class:"btn sm quiet tlx-prev",title:"Previous hit (\u21E7N)","aria-label":"Previous hit"},"\u2039"),Ee=me("button",{type:"button",class:"btn sm quiet tlx-next",title:"Next hit (N)","aria-label":"Next hit"},"\u203A"),qe=me("div",{class:"tlx-facets",role:"group","aria-label":"Sources"}),N=me("select",{class:"input tlx-sev","aria-label":"Severity"},me("option",{value:""},"every severity"),...mn.slice(1).map(L=>me("option",{value:L},`${L} and above`))),ee=me("select",{class:"input tlx-views","aria-label":"Saved views",hidden:!e.views},me("option",{value:""},"Saved views\u2026")),ye=me("button",{type:"button",class:"btn sm quiet tlx-save",hidden:!e.saveView,title:"Save this view"},"Save view"),ke=me("div",{class:"tlx-warn",role:"status",hidden:!0}),Ve=me("div",{class:"tlx-status",role:"status"}),we=me("span",{class:"tlx-canvas-note"}),Ue=me("div",{class:"tlx-labels"}),Le=me("div",{class:"tlx-lanes",tabindex:"0",role:"application","aria-label":"Timeline lanes: drag to pan, wheel to zoom, drag the axis to choose a range, click it to move the playhead. Keys: \u2190 \u2192 pan, + \u2212 zoom, N next hit"}),$e=yt("svg",{class:"tlx-svg"});Le.append($e);let S=me("div",{class:"tlx-scroll"},me("div",{class:"tlx-grid"},Ue,Le)),B=me("section",{class:"tlx-table",hidden:!0,"aria-label":"The events in the chosen range"}),K=me("aside",{class:"tlx-detail",hidden:!0,"aria-label":"The event"});t.replaceChildren(me("div",{class:"tlx-bar"},G,me("span",{class:"spacer"}),Z,Q,z,D,me("label",{class:"tlx-gaps-label",title:"Draw long empty stretches as narrow breaks"},V,"Collapse gaps"),me("label",{class:"tlx-gaps-label",title:"Hide the rows with nothing in this range"},de,"Hide quiet rows")),me("div",{class:"tlx-bar"},ce,H,ne,Ee,N,ee,ye),qe,ke,me("div",{class:"tlx-body"},S,K),me("div",{class:"tlx-foot"},Ve,me("span",{class:"spacer"}),we),B);let ae=()=>Math.max(200,Le.clientWidth||800),le=()=>{let L=(Oe,Ye)=>(Oe.own?-1:0)-(Ye.own?-1:0)||Oe.scope.localeCompare(Ye.scope,void 0,{numeric:!0}),oe=(g?.rows??[]).filter(Oe=>!W||Oe.count>0||Oe.own||(g?.rows.length??0)<=1).sort(L).map(Oe=>({kind:"row",row:Oe})),ue=new Set(g?.metrics.map(Oe=>Oe.series)??[]);for(let Oe of[...ue].sort()){let Ye=U.get(Oe);oe.push({kind:"metric",series:Oe,unit:Ye?.unit??"count",type:Ye?.type??"counter",title:Ye?.title??Oe})}return oe},fe=(L,X)=>m?.names?.find(oe=>oe.scope===L)?.label??X,se=L=>L.kind==="metric"?tl:or,ge=()=>Yc(y.t1-y.t0,ae()),Se=()=>m?.now??Date.now();function te(){return{timeline:1,type:"view",name:"",scope:p,depth:c,range:{from:Math.round(y.t0),to:Math.round(y.t1)},...l?{q:l}:{},...Object.keys(f).length?{filters:f}:{},...d?{live:d}:{},...u?{}:{collapseGaps:!1},...W?{}:{quietRows:!0}}}function xe(L){L.scope!==void 0&&(p=L.scope),L.depth!==void 0&&(c=L.depth),l=L.q??"",ce.value=l,f=L.filters??{},N.value=f.severity?.length?f.severity[0]:"",u=L.collapseGaps??e.collapseGaps??!0,V.checked=u,W=!L.quietRows,de.checked=W,j.clear(),F.clear();let X=L.range;X&&"last"in X?Vs(X.last,!1):X&&(y={t0:X.from,t1:X.to}),Tt(!!L.live,!1)}let he=()=>{let L=te();if(e.onViewChange?.(L),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(L))}`)}catch{}},Ie=()=>{if(!e.urlState)return;let L=/#timeline=(.+)$/.exec(location.hash);if(L)try{return JSON.parse(decodeURIComponent(L[1]))}catch{return}};function E(L,X,oe,ue={}){let Oe=n(l,Se(),L,X);M=Oe.warnings;let Ye=l?[]:f.source?[...U].filter(([,pt])=>f.source.includes(pt.source)).map(([pt])=>pt):void 0;return{timeline:1,type:"query",scope:p,depth:c,from:Oe.from,to:Oe.to,tz:s,...oe.kind==="binned"?{bin:oe.bin}:{},...l?{q:l,where:Oe.where}:{},...Object.keys(f).length?{filters:f}:{},...Ye?{series:Ye}:{},...ue}}let q=()=>JSON.stringify([p,c,l,f,ge()]);async function _(L=!1){let X=ge(),oe=q(),ue=y.t1-y.t0;if(!L&&g&&oe===h.key&&y.t0>=h.from&&y.t1<=h.to){pe();return}if(R){O=!0;return}R++;let Oe=y.t0-ue/2,Ye=Math.min(y.t1+ue/2,Math.max(y.t1,Se()+ue*.1));try{let pt=await e.source.query(E(Oe,Ye,X,X.kind==="single"?{limit:1e4}:{}));X.kind==="single"&&pt.next&&(pt=await e.source.query(E(Oe,Ye,{kind:"binned",bin:"1m"}))),g=pt,x=oe,h={from:Oe,to:Ye,mode:X,key:oe}}catch(pt){Ve.textContent=`The history couldn't be read: ${String(pt?.message??pt)}`}finally{R--}pe(),he(),O&&(O=!1,_())}function re(){let L=ae(),X=ge();if(Y=[],u&&g){let oe=new Map([...U].map(([ue,Oe])=>[ue,Oe.type]));Y=Wa(Hc(g,X,oe),y.t0,Math.min(y.t1,Math.max(y.t0,Se())),{minFrac:.15,minMs:10*eo}),X.kind==="binned"&&(Y=Y.filter(ue=>ue.to-ue.from>=2*Rn[X.bin])),Y=Y.filter(ue=>!(j.has(ir(ue))&&(F.get(ir(ue))??1)>=1))}J=Hr(y.t0,y.t1,L,Y,{cut:wh,weights:F})}let pe=()=>{T||(T=requestAnimationFrame(Te))};function Te(){T=0,re();let L=ae(),X=le(),oe=h.mode,ue=[],Oe=ms;for(let ie of X)ue.push(Oe),Oe+=se(ie);let Ye=Math.max(Oe,ms+or);$e.setAttribute("width",String(L)),$e.setAttribute("height",String(Ye)),$e.setAttribute("viewBox",`0 0 ${L} ${Ye}`);let pt=S.scrollTop-200,Qn=S.scrollTop+(S.clientHeight||600)+200,Be=[],De=J.x;Be.push(yt("rect",{class:"tlx-axis",x:0,y:0,width:L,height:ms}));let Xt=(g?.retention??[]).map(ie=>({r:ie,from:oe.kind==="binned"?ie.keptFrom.rollups[oe.bin]??ie.keptFrom.events:ie.keptFrom.events,days:oe.kind==="binned"?ie.rollups[oe.bin]:ie.events})).filter(ie=>ie.from!==void 0);if(Xt.length){let ie=Math.min(...Xt.map(Ae=>Ae.from));ie>y.t0&&Be.push(yt("rect",{class:"tlx-notkept",x:Math.max(0,De(y.t0)),y:ms,width:Math.max(0,De(ie)-Math.max(0,De(y.t0))),height:Ye-ms},`Nothing kept before ${nn(ie,s)}: ${Xt.map(Ae=>`${Ae.r.source} ${Ae.days===null?"kept until deleted":`kept ${Ae.days} days`}`).join(", ")}`))}let yn=Se();yn<y.t1&&Be.push(yt("rect",{class:"tlx-future",x:De(yn),y:ms,width:L-De(yn),height:Ye-ms}));for(let ie of Ja(J,s,90)){Be.push(yt("line",{class:`tlx-tick${ie.major?" major":""}`,x1:ie.x,x2:ie.x,y1:ms-6,y2:Ye}));let Ae=yt("text",{class:"tlx-ticklabel",x:ie.x+3,y:16});Ae.textContent=ie.label,Be.push(Ae)}$&&Be.push(yt("rect",{class:"tlx-brush",x:De($.from),y:0,width:Math.max(1,De($.to)-De($.from)),height:Ye}));let ao=oe.kind==="single"?(g?.events??[]).filter(ie=>ie.dur!==void 0||ie.open):g?.spans??[],mm=oe.kind==="single"?(g?.events??[]).filter(ie=>ie.dur===void 0&&!ie.open):[],cp=new Map;X.forEach((ie,Ae)=>{ie.kind==="row"&&cp.set(ie.row.scope,Ae)});let lo=ie=>{let Ae=Jt(p)+c,tt=Jt(ie)>=Ae?$s(ie,Ae):ie;return cp.get(tt)},ni=ie=>ue[ie]+se(X[ie])>=pt&&ue[ie]<=Qn;if(X.forEach((ie,Ae)=>{ni(Ae)&&Be.push(yt("rect",{class:`tlx-lane${Ae%2?" odd":""}${ie.kind==="metric"?" metric":""}`,x:0,y:ue[Ae],width:L,height:se(ie)}))}),oe.kind==="binned"){let ie=new Map;for(let Ae of g?.bins??[]){let tt=lo(Ae.scope);tt!==void 0&&ie.set(tt,Math.max(ie.get(tt)??0,Ae.count))}for(let Ae of g?.bins??[]){let tt=lo(Ae.scope);if(tt===void 0||!ni(tt))continue;let ft=De(Ae.t),it=De(Ae.t+Rn[Ae.bin]);if(it<0||ft>L)continue;let $t=[...mn].reverse().find(kn=>(Ae.severity[kn]??0)>0)??"info",Ut=Math.max(2,(or-8)*Math.sqrt(Ae.count)/Math.sqrt(ie.get(tt)||1));Be.push(yt("rect",{class:"tlx-countbar",x:ft,y:ue[tt]+or-3-Ut,width:Math.max(1,it-ft-.5),height:Ut,"data-t":Ae.t},`${nn(Ae.t,s)}: ${Ae.count} event${Ae.count===1?"":"s"}${$t!=="info"&&$t!=="debug"?`, the worst ${$t}`:""}`)),($t==="warning"||$t==="error")&&Be.push(yt("rect",{class:`tlx-heat sev-${$t}`,x:ft,y:ue[tt]+or-($t==="error"?4:3),width:Math.max(1,it-ft-.5),height:$t==="error"?3:2}))}}for(let ie of ao){let Ae=lo(ie.scope);if(Ae===void 0||!ni(Ae))continue;let tt=ie.open?yn:ie.t+(ie.dur??0),ft=De(ie.t),it=De(tt);if(it<-2||ft>L+2)continue;let $t=`tlx-span sev-${ie.severity}${ie.open?" open":""}${k?.id===ie.id?" selected":""}`,Ut=`${ie.summary} \xB7 ${nn(ie.t,s)}${ie.open?", still going":`, ${Uc(tt-ie.t)}`}`,kn=ue[Ae]+5,Os=oe.kind==="binned"?4:8,$n=ft;for(let Ln of J.cuts)Ln.weight>=1||Ln.x1<=ft||Ln.x0>=it||(Ln.x0>$n&&Be.push(yt("rect",{class:$t,x:$n,y:kn,width:Math.max(1,Ln.x0-$n),height:Os,rx:2,"data-id":ie.id},Ut)),Be.push(yt("path",{class:`${$t} through`,d:`M${Ln.x0} ${kn+Os/2} H${Ln.x1}`,"data-id":ie.id},`${Ut} (lasted through the break)`)),$n=Ln.x1);it>$n&&Be.push(yt("rect",{class:$t,x:Math.max(-2,$n),y:kn,width:Math.max(2,Math.min(L+2,it)-Math.max(-2,$n)),height:Os,rx:2,"data-id":ie.id},Ut))}let pp=new Map;for(let ie of mm){let Ae=lo(ie.scope);if(Ae===void 0||!ni(Ae))continue;let tt=De(ie.t);if(tt<-6||tt>L+6||tt-(pp.get(Ae)??-1/0)<3)continue;pp.set(Ae,tt);let ft=ue[Ae]+or/2+2,it=4,$t=xh[ie.severity],Ut=$t==="diamond"?`M${tt} ${ft-it-1} l${it+1} ${it+1} l${-it-1} ${it+1} l${-it-1} ${-it-1} z`:$t==="triangle"?`M${tt} ${ft-it-1} l${it+1} ${2*it+1} h${-2*it-2} z`:$t==="square"?`M${tt-it+.5} ${ft-it+.5} h${2*it-1} v${2*it-1} h${-2*it+1} z`:"",kn=`${nn(ie.t,s)} \xB7 ${ie.summary}`,Os=`tlx-mark sev-${ie.severity}${k?.id===ie.id?" selected":""}${P>=0&&A[P]?.id===ie.id?" hit":""}`;Be.push(Ut?yt("path",{class:Os,d:Ut,"data-id":ie.id},kn):yt("circle",{class:Os,cx:tt,cy:ft,r:$t==="dot"?2.5:it,"data-id":ie.id},kn))}X.forEach((ie,Ae)=>{if(ie.kind!=="metric"||!ni(Ae))return;let tt=new Map;for(let mt of g?.metrics??[]){if(mt.series!==ie.series)continue;let Yt="value"in mt?{min:mt.value,max:mt.value,sum:mt.value,count:1}:{min:mt.min,max:mt.max,sum:mt.sum,count:mt.count},Bt=tt.get(mt.t);Bt?(Bt.min=Math.min(Bt.min,Yt.min),Bt.max=Math.max(Bt.max,Yt.max),Bt.sum+=Yt.sum,Bt.count+=Yt.count):tt.set(mt.t,{...Yt})}let ft=[...tt].sort((mt,Yt)=>mt[0]-Yt[0]);if(!ft.length)return;let it=oe.kind==="binned"?Rn[oe.bin]:eo,$t=mt=>ie.type==="gauge"?mt.sum/Math.max(1,mt.count):mt.sum,Ut=Math.max(1e-9,...ft.map(([,mt])=>ie.type==="gauge"?mt.max:$t(mt))),kn=ue[Ae]+tl-4,Os=tl-10,$n=mt=>kn-mt/Ut*Os;if(ie.type==="gauge"){let mt=ft.map(([Yt,Bt])=>`${De(Yt)},${$n(Bt.max)}`).join(" ")+" "+[...ft].reverse().map(([Yt,Bt])=>`${De(Yt)},${$n(Bt.min)}`).join(" ");Be.push(yt("polygon",{class:"tlx-band",points:mt})),Be.push(yt("polyline",{class:"tlx-line",points:ft.map(([Yt,Bt])=>`${De(Yt+it/2)},${$n($t(Bt))}`).join(" ")}))}else{let mt="",Yt=-1/0;for(let[Bt,um]of ft){let hm=De(Bt),fp=De(Bt+it),dp=$n($t(um));mt+=Bt>Yt?`M${hm} ${kn} V${dp} H${fp}`:` V${dp} H${fp}`,Yt=Bt+it;let mp=ft.find(([ym])=>ym>Bt);(!mp||mp[0]>Yt)&&(mt+=` V${kn} Z`)}Be.push(yt("path",{class:"tlx-area",d:mt}))}let Ln=yt("text",{class:"tlx-peak",x:4,y:ue[Ae]+11});Ln.textContent=`peak ${kh(Ut,ie.unit)}${ie.type==="counter"?` per ${oe.kind==="binned"?oe.bin:"1m"}`:""}`,Be.push(Ln)});for(let ie of J.cuts){if(ie.weight>=1)continue;let Ae=it=>{let $t=`M${it} 0`;for(let Ut=0;Ut<Ye;Ut+=8)$t+=` L${it+(Ut/8%2?-3:3)} ${Ut+8}`;return $t},tt=yt("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":ie.from,"data-to":ie.to,"aria-label":`A break of ${rr(ie.to-ie.from)} with nothing shown, from ${nn(ie.from,s)} to ${nn(ie.to,s)}: press to open it`},`${rr(ie.to-ie.from)} with nothing here: ${nn(ie.from,s)} to ${nn(ie.to,s)} (click to open)`);tt.append(yt("rect",{class:"tlx-cut-bg",x:ie.x0,y:0,width:ie.x1-ie.x0,height:Ye})),tt.append(yt("path",{class:"tlx-cut-edge",d:Ae(ie.x0+3)}),yt("path",{class:"tlx-cut-edge",d:Ae(ie.x1-3)}));let ft=yt("text",{class:"tlx-cut-label",x:(ie.x0+ie.x1)/2,y:15,"text-anchor":"middle"});ft.textContent=rr(ie.to-ie.from),tt.append(ft),Be.push(tt)}if(b!==void 0){let ie=De(b);Be.push(yt("line",{class:"tlx-playhead",x1:ie,x2:ie,y1:0,y2:Ye})),Be.push(yt("path",{class:"tlx-handle",d:`M${ie-6} 0 h12 v8 l-6 7 l-6 -7 z`},`the playhead: ${nn(b,s)}`))}$e.replaceChildren(...Be),Ue.replaceChildren(me("div",{class:"tlx-labelhead",style:`height:${ms}px`},ge().kind==="single"?"single events":`per ${ge().kind==="binned"?ge().bin:""}`),...X.map(ie=>{if(ie.kind==="metric")return me("div",{class:"tlx-rowlabel metric",style:`height:${tl}px`,title:`${ie.title} (${ie.type==="counter"?"sums":"min, max and mean"})`},ie.title);let Ae=ie.row,tt=me("div",{class:`tlx-rowlabel${Ae.own?" own":""}`,style:`height:${or}px`,"data-scope":Ae.scope,title:`${Ae.scope||"all hosts"} \xB7 ${Ae.count} event${Ae.count===1?"":"s"}`},me("span",{class:"tlx-kind"},e.catalog.flags.find(ft=>Ae[ft])??Ae.kind),me("span",{class:"tlx-name"},Ae.own?`${Ae.label} (itself)`:Ae.label),me("span",{class:"tlx-count"},String(Ae.count)));if(!Ae.own&&Ae.scope!==p){let ft=me("button",{type:"button",class:"tlx-drill",title:Ae.children?`Into ${Ae.label}: its ${Ae.children} part${Ae.children===1?"":"s"}`:`Into ${Ae.label}`,"aria-label":`Into ${Ae.label}`},"\u203A");ft.addEventListener("click",()=>dt(Ae.scope)),tt.append(ft)}return tt})),Ue.style.width=`${bh}px`,Pe()}function Pe(){G.replaceChildren(...Ur(p).flatMap((ue,Oe,Ye)=>{let pt=me("button",{type:"button",class:`tlx-crumb${Oe===Ye.length-1?" current":""}`,"aria-current":Oe===Ye.length-1?"location":void 0},fe(ue.scope,ue.label));return pt.addEventListener("click",()=>{ue.scope!==p&&(p=ue.scope,c=1,_(!0))}),Oe?[me("span",{class:"tlx-sep","aria-hidden":"true"},"/"),pt]:[pt]})),Q.setAttribute("aria-pressed",String(d)),Q.classList.toggle("on",d),z.hidden=!d||v;let L=ge(),X=g?.total??0,oe=(g?.retention??[]).filter(ue=>ue.events!==null).map(ue=>`${ue.source} kept ${ue.events} d`);Ve.textContent=`${nn(y.t0,s)} \u2013 ${nn(y.t1,s)} \xB7 ${L.kind==="single"?"single events":`bins of ${L.bin}`} \xB7 ${X} event${X===1?"":"s"}${Y.length?` \xB7 ${Y.length} break${Y.length===1?"":"s"}`:""}${oe.length?` \xB7 ${oe.slice(0,3).join(", ")}`:""}`,ke.hidden=!M.length,ke.textContent=M.join(" \xB7 "),H.textContent=l?A.length?`${P+1>0?`${P+1} of `:""}${A.length}${A.length>=2e3?"+":""} hit${A.length===1?"":"s"}`:`${X?`${X} hit${X===1?"":"s"}`:"no hits"}`:"";for(let ue of Z.querySelectorAll(".seg"))ue.classList.remove("on");we.textContent=b===void 0?"":w?(()=>{let ue=e.stamp?.(w)??{};return`Canvas: the state recorded at ${nn(Date.parse(ue.at??"")||b,s)}${ue.tag?` (${ue.tag})`:""}`})():"No state recorded here",we.classList.toggle("none",b!==void 0&&!w)}function rt(){qe.replaceChildren();for(let L of m?.sources??[]){let X=!f.source?.length||f.source.includes(L.name),oe=me("button",{type:"button",class:`tlx-chip${X?" on":""}${L.status==="not-yet"?" notyet":""}`,"aria-pressed":String(X&&L.status!=="not-yet"),disabled:L.status==="not-yet",title:L.status==="not-yet"?`${L.title}: not kept yet`:`${L.title}${Fe(L)}`},L.name);L.status!=="not-yet"&&oe.addEventListener("click",()=>Ce(L.name)),qe.append(oe)}}let Fe=L=>{let X=m?.retention.find(oe=>oe.source===L.name);return X?` (kept ${X.events===null?"until deleted":`${X.events} days`})`:""};function Ce(L){let X=(m?.sources??[]).filter(ue=>ue.status==="kept").map(ue=>ue.name),oe=f.source?.length?[...f.source]:[...X];oe=oe.includes(L)?oe.filter(ue=>ue!==L):[...oe,L],f={...f,...oe.length===X.length?{source:void 0}:{source:oe}},f.source||delete f.source,rt(),_(!0),We()}let Ke=0;ce.addEventListener("input",()=>{clearTimeout(Ke),Ke=setTimeout(()=>{l=ce.value.trim(),P=-1,_(!0),We()},250)}),ce.addEventListener("keydown",L=>{L.key==="Enter"&&(L.preventDefault(),clearTimeout(Ke),l=ce.value.trim(),_(!0).then(()=>We()).then(()=>gt(L.shiftKey?-1:1)))});async function We(){if(!l){A=[],P=-1,Pe();return}let L=y.t1-y.t0;A=(await e.source.query(E(y.t0-L*4,Math.max(y.t1+L*4,Se()),{kind:"single"},{limit:2e3}))).events??[],P=Math.min(P,A.length-1),Pe()}function gt(L){if(!A.length)return;let X=(y.t0+y.t1)/2;P<0?P=L>0?Math.max(0,A.findIndex(Oe=>Oe.t>=X)):Math.max(0,A.length-1-[...A].reverse().findIndex(Oe=>Oe.t<=X)):P=(P+L+A.length)%A.length;let oe=A[P],ue=Math.min(y.t1-y.t0,2*ar);y={t0:oe.t-ue/2,t1:oe.t+ue/2},v=!1,kt(oe),_()}ne.addEventListener("click",()=>gt(-1)),Ee.addEventListener("click",()=>gt(1)),N.addEventListener("change",()=>{let L=N.value;f={...f,...L?{severity:mn.filter(X=>Fd(X)>=Fd(L))}:{}},L||delete f.severity,_(!0),We()});async function Vs(L,X=!0){let oe=Se();if(L==="run"){let ue=await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:oe-30*xn,to:oe+1,filters:{kind:["run"]},limit:1e4}).catch(()=>{}),Oe=ue?.events?.[ue.events.length-1];y=Oe?{t0:Oe.t-(Oe.dur??ar)*.02,t1:(Oe.open?oe:Oe.t+(Oe.dur??ar))+(Oe.dur??ar)*.04}:{t0:oe-xn,t1:oe+xn*.02}}else y={t0:oe-_d[L],t1:oe+_d[L]*.02};v=!0,j.clear(),F.clear(),X&&_()}function Tt(L,X=!0){if(d=L,I?.(),I=void 0,L&&e.source.subscribe){let oe=0,ue=0;I=e.source.subscribe(E(Se()-ar,Se()+365*xn,{kind:"single"}),Oe=>{if(m&&(m.now=Math.max(m.now,Oe.now)),v){let pt=y.t1-y.t0;y={t0:Oe.now-pt*.98,t1:Oe.now+pt*.02}}let Ye=Date.now();Ye-oe>500?(oe=Ye,_(!0)):ue||(ue=setTimeout(()=>{ue=0,oe=Date.now(),_(!0)},500))}),v=!0}X&&(Pe(),he())}Q.addEventListener("click",()=>Tt(!d)),z.addEventListener("click",()=>{v=!0;let L=y.t1-y.t0,X=Se();y={t0:X-L*.98,t1:X+L*.02},_()}),D.addEventListener("click",()=>{ut()}),V.addEventListener("change",()=>{u=V.checked,j.clear(),F.clear(),pe(),he()}),de.addEventListener("change",()=>{W=de.checked,pe(),he()});function dt(L){let X=g?.rows.find(oe=>oe.scope===L);p=L,c=X&&X.children===0?0:1,$=void 0,B.hidden=!0,_(!0)}async function ut(){let L=Se(),oe=((await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:L-400*xn,to:L+1,bin:"1d",tz:s}).catch(()=>{}))?.bins??[]).map(Oe=>Oe.t),ue=oe.length?Math.min(...oe):L-7*xn;y={t0:ue,t1:L+(L-ue)*.02},v=!0,_()}let Cn=0;async function Kt(L){if(b=L,pe(),L===void 0){w=void 0;return}let X=++Cn,oe=e.source.stateAt?await e.source.stateAt(p,L).catch(()=>{}):void 0;X===Cn&&(w=oe,e.onPlayhead?.(L,oe),Pe())}async function _t(L,X){$={from:Math.min(L,X),to:Math.max(L,X)},pe();let oe=await e.source.query(E($.from,$.to,{kind:"single"},{limit:500})),ue=o(l),Oe=Be=>{let De=[],zt=0;for(let[Xt,yn]of Qi(ue,Be))De.push(Be.slice(zt,Xt),me("mark",null,Be.slice(Xt,yn))),zt=yn;return De.push(Be.slice(zt)),De},Ye=(oe.events??[]).map(Be=>{let De=me("tr",{"data-id":Be.id,tabindex:"0"},me("td",null,nn(Be.t,s)),me("td",null,Be.dur!==void 0?Uc(Be.dur):Be.open?"still going":""),me("td",null,Be.source),me("td",null,Be.kind),me("td",{class:`sev-${Be.severity}`},Be.severity),me("td",{class:"tlx-sum"},...Oe(Be.summary)),me("td",{class:"tlx-scope"},Be.scope));return De.addEventListener("click",()=>kt(Be)),De.addEventListener("keydown",zt=>{zt.key==="Enter"&&kt(Be)}),De}),pt=me("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");pt.addEventListener("click",()=>{$=void 0,B.hidden=!0,pe()});let Qn=Be=>{let De=me("button",{type:"button",class:"btn sm","data-export":Be},Be.toUpperCase());return De.addEventListener("click",()=>{Gt(Be)}),De};B.replaceChildren(me("div",{class:"tlx-table-head"},me("strong",null,`${oe.total} event${oe.total===1?"":"s"}`),me("span",null,` ${nn($.from,s)} \u2013 ${nn($.to,s)}${oe.total>500?" (the first 500 shown; the export has them all)":""}`),me("span",{class:"spacer"}),me("span",null,"Export: "),Qn("json"),Qn("csv"),pt),me("div",{class:"tlx-table-wrap"},me("table",null,me("thead",null,me("tr",null,...["When","Long","Source","Kind","Severity","What","Scope"].map(Be=>me("th",{scope:"col"},Be)))),me("tbody",null,...Ye)))),B.hidden=!1}async function Dt(){if(!$)return[];let L=[],X;do{let oe=await e.source.query(E($.from,$.to,{kind:"single"},{limit:1e4,...X?{cursor:X}:{}}));L.push(...oe.events??[]),X=oe.next}while(X&&L.length<2e5);return L}async function Gt(L){let X=await Dt(),oe=L==="json"?Xa(X,C):Qa(X,C),ue=`timeline-${new Date($.from).toISOString().slice(0,16).replace(/:/g,"")}.${L}`,Oe=L==="json"?"application/json":"text/csv";if(e.onExport){e.onExport(ue,oe,Oe);return}let Ye=me("a",{href:`data:${Oe};charset=utf-8,${encodeURIComponent(oe)}`,download:ue});document.body.append(Ye),Ye.click(),Ye.remove()}function kt(L){if(k=L,pe(),!L){K.hidden=!0;return}let X=m?.sources.find(De=>De.name===L.source),oe=new Set(X?.sensitive??[]),ue=o(l),Oe=De=>{let zt=[],Xt=0;for(let[yn,ao]of Qi(ue,De))zt.push(De.slice(Xt,yn),me("mark",null,De.slice(yn,ao))),Xt=ao;return zt.push(De.slice(Xt)),zt},Ye=(De,zt)=>{if(!zt)return null;let Xt=me("button",{type:"button",class:"btn sm"},De);return Xt.addEventListener("click",zt),Xt},pt=Object.entries(L.attrs).map(([De,zt])=>{if(!oe.has(De))return me("tr",null,me("th",{scope:"row"},De),me("td",null,...Oe(String(zt))));let Xt=me("button",{type:"button",class:"btn sm quiet",title:"This can name a remote host, a folder or free text"},"Show"),yn=me("td",{class:"tlx-sensitive"},"hidden ",Xt);return Xt.addEventListener("click",()=>yn.replaceChildren(String(zt))),me("tr",null,me("th",{scope:"row"},De),yn)}),Qn=me("button",{type:"button",class:"btn sm quiet tlx-close","aria-label":"Close"},"\xD7");Qn.addEventListener("click",()=>kt(void 0));let Be=Ur(L.scope).slice(1).map(De=>{let zt=me("button",{type:"button",class:"tlx-crumb"},fe(De.scope,De.label));return zt.addEventListener("click",()=>dt(De.scope)),zt});K.replaceChildren(me("div",{class:"tlx-detail-head"},me("strong",null,L.kind),Qn),me("p",{class:`tlx-sev sev-${L.severity}`},`${L.severity} \xB7 ${X?.title??L.source}`),me("p",{class:"tlx-sum"},...Oe(L.summary)),me("p",null,nn(L.t,s),L.dur!==void 0?` \xB7 ${Uc(L.dur)}${L.open?" so far":""}`:L.open?" \xB7 still going":""),me("p",{class:"tlx-crumbs small"},...Be),...pt.length?[me("table",{class:"tlx-attrs"},me("tbody",null,...pt))]:[],me("div",{class:"tlx-links"},...(e.actions?.(L)??[]).map(([De,zt])=>Ye(De,zt)))),K.hidden=!1}function cr(L,X){let oe=ir({from:L,to:X});if(!Y.find(pt=>pt.from===L&&pt.to===X))return;if(j.add(oe),!i){F.set(oe,1),pe();return}let Oe=performance.now(),Ye=pt=>{let Qn=Math.min(1,(pt-Oe)/260);F.set(oe,1-(1-Qn)**3),Te(),Qn<1&&requestAnimationFrame(Ye)};requestAnimationFrame(Ye)}let Zt,Ks=L=>L.clientX-$e.getBoundingClientRect().left;$e.addEventListener("pointerdown",L=>{let X=Ks(L),oe=L.clientY-$e.getBoundingClientRect().top,ue=L.target.closest?.(".tlx-cut");if(ue){L.preventDefault(),cr(Number(ue.getAttribute("data-from")),Number(ue.getAttribute("data-to")));return}$e.setPointerCapture(L.pointerId),Zt={kind:oe<ms||L.shiftKey?"brush":L.target.classList.contains("tlx-handle")?"scrub":"pan",x0:X,t0:J.t(X),v0:y,moved:!1},L.preventDefault(),Le.focus({preventScroll:!0})}),$e.addEventListener("pointermove",L=>{if(!Zt)return;let X=Ks(L);if(Math.abs(X-Zt.x0)>3&&(Zt.moved=!0),!!Zt.moved)if(Zt.kind==="pan"){let oe=(Zt.x0-X)*J.msPerPx;y={t0:Zt.v0.t0+oe,t1:Zt.v0.t1+oe},v=!1,_()}else Zt.kind==="scrub"?Kt(J.t(X)):($={from:Math.min(Zt.t0,J.t(X)),to:Math.max(Zt.t0,J.t(X))},pe())}),$e.addEventListener("pointerup",L=>{let X=Zt;if(Zt=void 0,!X)return;let oe=Ks(L);if(X.kind==="brush"&&X.moved){_t(X.t0,J.t(oe));return}if(X.kind==="brush"&&!X.moved){Kt(J.t(oe));return}if(X.kind==="pan"&&!X.moved){let ue=L.target.closest?.("[data-id]")?.getAttribute("data-id"),Oe=ue?[...g?.events??[],...g?.spans??[]].find(Ye=>Ye.id===ue):void 0;Oe?(kt(Oe),Kt(Oe.t)):Kt(J.t(oe))}}),$e.addEventListener("keydown",L=>{let X=L.target.closest?.(".tlx-cut");X&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),cr(Number(X.getAttribute("data-from")),Number(X.getAttribute("data-to"))))}),$e.addEventListener("wheel",L=>{L.preventDefault();let X=Ks(L);if(L.shiftKey||Math.abs(L.deltaX)>Math.abs(L.deltaY)){let oe=(L.shiftKey?L.deltaY:L.deltaX)*J.msPerPx;y={t0:y.t0+oe,t1:y.t1+oe},v=!1}else pr(J.t(X),Math.exp(L.deltaY*.0015),X/ae());_()},{passive:!1});function pr(L,X,oe=.5){let ue=Math.min(400*xn,Math.max(1e4,(y.t1-y.t0)*X));y={t0:L-oe*ue,t1:L+(1-oe)*ue},j.clear(),F.clear(),X<1&&(v=d&&y.t1>=Se())}Le.addEventListener("keydown",L=>{let X=y.t1-y.t0;if(L.key==="ArrowLeft"||L.key==="ArrowRight"){let oe=X*.15*(L.key==="ArrowLeft"?-1:1);y={t0:y.t0+oe,t1:y.t1+oe},v=!1}else if(L.key==="+"||L.key==="=")pr((y.t0+y.t1)/2,.6);else if(L.key==="-"||L.key==="_")pr((y.t0+y.t1)/2,1/.6);else if(L.key==="n"||L.key==="N"){gt(L.shiftKey?-1:1),L.preventDefault();return}else if(L.key==="Escape")kt(void 0),$=void 0,B.hidden=!0;else return;L.preventDefault(),_()}),t.addEventListener("keydown",L=>{L.key==="/"&&document.activeElement!==ce&&!L.target.closest("input, select, textarea")&&(L.preventDefault(),ce.focus())}),S.addEventListener("scroll",()=>pe(),{passive:!0}),ye.addEventListener("click",async()=>{let L=`${Ur(p).slice(-1)[0].label}${l?`: ${l}`:""}`.slice(0,80);await e.saveView?.({...te(),name:L}),await jn()});let Je=[];async function jn(){e.views&&(Je=await e.views(),ee.replaceChildren(me("option",{value:""},"Saved views\u2026"),...Je.map((L,X)=>me("option",{value:String(X)},L.name))))}ee.addEventListener("change",()=>{let L=Je[Number(ee.value)];L&&(xe(L),rt(),_(!0)),ee.value=""});let ht=typeof ResizeObserver=="function"?new ResizeObserver(()=>pe()):void 0;ht?.observe(Le);let ln=(async()=>{m=await e.source.catalog(),C=m.sources.flatMap(ue=>(ue.sensitive??[]).map(Oe=>`${ue.name}.${Oe}`));for(let ue of m.sources)for(let Oe of ue.series)U.set(Oe.name,{unit:Oe.unit,type:Oe.type,title:Oe.title,source:ue.name});p=m.hosts.length===1?`host:${m.hosts[0].replace(/[%/:\s]/g,ue=>`%${ue.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}`:"";let X=m.now;y={t0:X-xn,t1:X+xn*.02};let oe=Ie()??e.view;oe&&xe(oe),rt(),await jn(),await _(!0),l&&await We()})();return{el:t,ready:ln,get view(){return te()},setView(L){return xe(L),rt(),_(!0)},setRange(L,X){return y={t0:L,t1:X},v=!1,_()},setPlayhead:Kt,setLive:Tt,setTheme:a,refresh:()=>_(!0),internal:{get result(){return g},get mode(){return ge()},get scale(){return J},get gaps(){return Y},get playState(){return w},get hits(){return A},get selected(){return k},get follow(){return v},openCut:cr,showTable:_t,rangeEvents:Dt,exportRange:Gt,select:kt,stepHit:gt,drill:dt,findHits:We,paint:Te,lines:le},dispose(){I?.(),ht?.disconnect(),T&&cancelAnimationFrame(T),t.replaceChildren()}}}var $h={arrow:{d:"M0,0 L10,5 L0,10 z",refX:9},open:{d:"M0,0 L10,5 L0,10 L3,5 z",refX:9},diamond:{d:"M0,5 L5,1.5 L10,5 L5,8.5 z",refX:1}},sn=t=>(Math.round(t*10)/10).toString(),Bd=t=>(t??"link").replace(/[^\w-]/g,"_");function nl(t,e){let{id:s}=e,r=e.styles??{},i=t.options,o=t.bounds,n=new Map,a=(d,u)=>{let y=r[d]??{},g=u==="start"?y.start??"none":y.end??"arrow";if(g!=="none")return(n.get(d)??n.set(d,new Set).get(d)).add(g),`url(#${s}-mk-${d}-${g})`},m="",p="",c="",l="";for(let d of[...t.panels].sort((u,y)=>u.depth-y.depth)){let u=d.rect,y=d.label?ve("text",{class:"pl",x:d.titleAt[0],y:d.titleAt[1]},St(d.label)+(d.sub?ve("tspan",{class:"pls",dx:10},St(d.sub)):"")):"";m+=ve("g",{class:`panel k-${d.role??"grey"}`,"data-id":d.id},ve("rect",{class:"face",x:sn(u.l),y:sn(u.t),width:sn(u.r-u.l),height:sn(u.b-u.t),rx:i.panelRx})+y)}for(let d of t.links){if(!d.points.length)continue;let u=Bd(d.kind);p+=ve("path",{class:`conn k-${u}`,d:"M"+d.points.map(y=>`${sn(y[0])},${sn(y[1])}`).join(" L"),"data-id":d.id,"data-a":d.a,"data-b":d.b,"marker-start":a(u,"start"),"marker-end":a(u,"end")}),d.at&&(l+=ve("text",{class:`cl k-${u}`,x:d.at.x,y:d.at.y,"text-anchor":d.at.anchor==="start"?void 0:d.at.anchor,"data-for":d.id},St(d.at.text)))}for(let d of t.cards){let u=d.rect;c+=ve("g",{class:`card k-${d.role??"grey"}${d.ghost?" ghost":""}`,"data-id":d.id,tabindex:0,role:"button","aria-label":d.sub?`${d.label}: ${d.sub}`:d.label},ve("rect",{class:"face",x:sn(u.l),y:sn(u.t),width:i.W,height:i.H,rx:i.cardRx})+ve("text",{class:"lt",x:sn(u.l+14),y:sn(u.t+24)},St(d.label))+(d.sub?ve("text",{class:"st",x:sn(u.l+14),y:sn(u.t+42)},St(d.sub)):""))}let f="";for(let[d,u]of n)for(let y of u){let g=$h[y];f+=ve("marker",{id:`${s}-mk-${d}-${y}`,viewBox:"0 0 10 10",refX:g.refX,refY:5,markerWidth:5.4,markerHeight:5.4,orient:"auto-start-reverse"},ve("path",{d:g.d,class:`mk k-${d}`}))}return ve("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flat",viewBox:`${sn(o.l)} ${sn(o.t)} ${sn(o.r-o.l)} ${sn(o.b-o.t)}`,role:"img","aria-label":e.title??"drawing, flat view","data-view":"2d"},(f?ve("defs",{},f):"")+ve("g",{class:"panels"},m)+ve("g",{class:"conns"},p)+ve("g",{class:"cards"},c)+ve("g",{class:"labels"},l))}function qd(t={}){let e=r=>r?r.startsWith("#")||r.includes("(")?r:`var(--${r})`:"var(--ink)",s=`
|
|
405
|
+
`}var py=864e5,es=36e5,bl=(t,e)=>t.t-e.t||(t.id<e.id?-1:t.id>e.id?1:0);function ms(t,e){let s=0,r=t.length;for(;s<r;){let i=s+r>>1;t[i].t<e?s=i+1:r=i}return s}var pm=(t,e)=>{t.min=Math.min(t.min,e.min),t.max=Math.max(t.max,e.max),t.sum+=e.sum,t.count+=e.count};function lm(t,e,s){let r=[];for(let i of t){let o=lr(i.t,e,s),n=r[r.length-1];n&&n.t===o?pm(n,i):r.push({t:o,min:i.min,max:i.max,sum:i.sum,count:i.count})}return r}function yp(t,e,s,r){for(let n=ms(t,e.t);n<t.length&&t[n].t===e.t;n++)if(s(t[n])){t[n]=e;return}let i=t[t.length-1];if(!i||r(i,e)<=0){t.push(e);return}let o=ms(t,e.t);for(;o<t.length&&r(t[o],e)<0;)o++;t.splice(o,0,e)}function cm(t,e,s){for(let r=ms(t,e);r<t.length&&t[r].t===e;r++)if(s(t[r])){t.splice(r,1);return}}function dm(t,e,s={}){let r=t.catalog,{isScope:i}=cl(e),{parseSearch:o,matchAst:n,toAst:a}=Xr(e),f=I=>Object.fromEntries(e.flags.filter(V=>I?.[V]).map(V=>[V,!0])),p=s.now??r.now,c=(r.names??[]).flatMap(I=>(I.aliases??[]).map(V=>[V,I.scope])).sort((I,V)=>V[0].length-I[0].length),l=new Map,d=I=>{if(!c.length)return I;let V=l.get(I);if(V===void 0){let te=c.find(([ae])=>hn(I,ae));V=te?te[1]+I.slice(te[0].length):I,l.set(I,V)}return V},m=new Map((r.names??[]).map(I=>[I.scope,I])),h=I=>c.length?{...I,scope:d(I.scope)}:I,y=I=>`${I.source}\0${I.id}`,g=t.events.map(h).sort(bl),k=new Map;for(let I of g)k.set(y(I),I);let u=g.filter(I=>I.dur!==void 0&&!I.open),b=u.reduce((I,V)=>Math.max(I,V.dur),0),x=new Map;for(let I of g)I.open&&x.set(y(I),I);let w=new Map,$=new Set,v=I=>{for(let V=Jt(I);V>=1;V--){let te=Ms(I,V);if($.has(te))break;$.add(te)}},O=new Map;for(let I of r.sources)for(let V of I.series)O.set(V.name,V.type);let C=r.sources.flatMap(I=>(I.sensitive??[]).map(V=>`${I.name}.${V}`)),A=new Map;for(let I of r.sources)A.set(I.name,{events:I.defaultRetention.events,rollups:{...I.defaultRetention.rollups},setBy:"default"});for(let I of r.retention)A.set(I.source,{events:I.events,rollups:{...I.rollups},setBy:I.setBy});let R=new Map;for(let I of r.sources)for(let V of I.series)R.set(V.name,I.name);function M(I){let V=d(I.scope),te=`${I.series}\0${V}`,ae=w.get(te);ae||(ae={series:I.series,scope:V,fine:[],cache:new Map},w.set(te,ae),v(V));let Te="value"in I?{t:I.t,min:I.value,max:I.value,sum:I.value,count:1}:{t:I.t,min:I.min,max:I.max,sum:I.sum,count:I.count};yp(ae.fine,Te,be=>be.t===Te.t,(be,ze)=>be.t-ze.t),ae.cache.clear()}for(let I of g)v(I.scope);for(let I of t.metrics)M(I);let T=new Map,S=new Set,N=(I,V)=>{S.add(I.source);let te=T.get(I.scope);te||T.set(I.scope,te=new Map);let ae=te.get(I.source);ae||te.set(I.source,ae=new Map);let Te=Math.floor(I.t/es)*es,be=ae.get(Te);if(be||ae.set(Te,be={t:Te,count:0,severity:{},kinds:{},first:1/0,last:-1/0}),be.count+=V,V>0)be.first=Math.min(be.first,I.t),be.last=Math.max(be.last,I.t);else if(I.t===be.first||I.t===be.last){be.first=1/0,be.last=-1/0;for(let ze=ms(g,Te);ze<g.length&&g[ze].t<Te+es;ze++){let Ie=g[ze];Ie.scope===I.scope&&Ie.source===I.source&&(be.first=Math.min(be.first,Ie.t),be.last=Math.max(be.last,Ie.t))}}be.severity[I.severity]=(be.severity[I.severity]??0)+V,be.kinds[I.kind]=(be.kinds[I.kind]??0)+V,be.severity[I.severity]===0&&delete be.severity[I.severity],be.kinds[I.kind]===0&&delete be.kinds[I.kind],be.count||ae.delete(Te)};for(let I of g)N(I,1);let z=(I,V,te)=>{let ae=`${V}|${te??""}`,Te=I.cache.get(ae);return Te||(Te=V==="1d"?lm(z(I,"1h",te),"1d",te):lm(I.fine,V,te),I.cache.set(ae,Te)),Te},K=I=>I===null?-1/0:p-I*py,J=I=>K(A.get(I)?.events??null),Z=(I,V)=>{let te=A.get(I);return K(te?V?te.rollups[V]:te.events:null)};function L(I){let V=[];for(let te of new Set(I)){let ae=A.get(te);if(!ae)continue;let Te=g.find(ke=>ke.source===te&&ke.t>=J(te))?.t,be=ke=>{let Be=1/0;for(let Qe of w.values())if(R.get(Qe.series)===te){let Ke=(ke?z(Qe,ke):Qe.fine).find(pt=>pt.t>=Z(te,ke));Ke&&Ke.t<Be&&(Be=Ke.t)}return Be===1/0?void 0:Be},ze=[Te,be()].filter(ke=>ke!==void 0),Ie={};for(let ke of["1m","1h","1d"]){let Be=be(ke)??(Te!==void 0&&Te>=Z(te,ke)?Te:void 0);Be!==void 0&&(Ie[ke]=Math.max(Be,Z(te,ke)))}V.push({source:te,events:ae.events,rollups:{...ae.rollups},setBy:ae.setBy,keptFrom:{...ze.length?{events:Math.min(...ze)}:{},rollups:Ie}})}return V}function U(I){let V=I.where,te={from:I.from,to:I.to},ae=[];if(!V&&I.q){let Ke=o(I.q,p);V=a(Ke),te=ro(Ke,I.from,I.to),ae=Ke.warnings}let Te=n(V,C),be=I.filters??{},ze=be.source?.length?new Set(be.source):void 0,Ie=be.kind?.length?new Set(be.kind):void 0,ke=be.severity?.length?new Set(be.severity):void 0,Be=be.scope?.length?be.scope:void 0;return{test:Ke=>hn(Ke.scope,I.scope)&&(!ze||ze.has(Ke.source))&&(!Ie||Ie.has(Ke.kind))&&(!ke||ke.has(Ke.severity))&&(!Be||Be.some(pt=>hn(Ke.scope,pt)))&&Ke.t>=J(Ke.source)&&Te(Ke),range:te,warnings:ae}}function H(I){let V=Jt(I.scope),te=V+I.depth,ae=new Map,Te=ke=>{let Be=ae.get(ke);return Be===void 0&&!ae.has(ke)&&(Be=hn(ke,I.scope)?Jt(ke)>=te?Ms(ke,te):ke:void 0,ae.set(ke,Be)),Be},be=ke=>{let Be=0,Qe=Jt(ke)+1;for(let Ke of $)Jt(Ke)===Qe&&hn(Ke,ke)&&Be++;return Be},ze=new Map,Ie=ke=>{let Be=ze.get(ke);if(!Be){let Qe=Jt(ke)-V,Ke=m.get(ke);Be={scope:ke,label:Ke?.label??Wr(ke),kind:Yr(ke),...f(Ke),depth:Qe,...Qe<I.depth?{own:!0}:{},children:be(ke),count:0},ze.set(ke,Be)}return Be};for(let ke of $)Jt(ke)===te&&hn(ke,I.scope)&&Ie(ke);return te===0&&Ie(""),{at:Te,add:Ie,rows:ze}}let ee=I=>[...I.values()].sort((V,te)=>V.scope===te.scope?0:V.scope<te.scope?-1:1);function j(I,V){let te=[];for(let ae=ms(u,I-b);ae<u.length&&u[ae].t<I;ae++)u[ae].t+u[ae].dur>I&&te.push(u[ae]);for(let ae of x.values())ae.t<I&&p>I&&te.push(ae);for(let ae=ms(g,I);ae<g.length&&g[ae].t<V;ae++)te.push(g[ae]);return te}function q(I,V,te,ae){let Te=I.series?new Set(I.series):void 0,be=new Map;for(let Ie of w.values()){if(Te&&!Te.has(Ie.series))continue;let ke=V(Ie.scope);if(ke===void 0)continue;let Be=R.get(Ie.series)??"",Qe=Z(Be,I.bin),Ke=I.bin?z(Ie,I.bin,I.tz):Ie.fine;for(let pt=ms(Ke,I.bin?lr(te,I.bin,I.tz):te);pt<Ke.length&&Ke[pt].t<ae;pt++){let P=Ke[pt];if(P.t<Qe)continue;let B=`${Ie.series}\0${ke}\0${P.t}`,W=be.get(B);W?pm(W,P):be.set(B,{series:Ie.series,scope:ke,t:P.t,bin:I.bin??"1m",min:P.min,max:P.max,sum:P.sum,count:P.count})}}let ze=[...be.values()].sort((Ie,ke)=>Ie.t-ke.t||(Ie.series<ke.series?-1:1)||(Ie.scope<ke.scope?-1:1));return I.bin?ze:ze.map(Ie=>({series:Ie.series,scope:Ie.scope,t:Ie.t,value:Ie.count===1||O.get(Ie.series)!=="gauge"?Ie.sum:Ie.sum/Ie.count}))}let G=I=>`${I.t}:${I.id}`,Q=(I,V)=>{let te=V.indexOf(":"),ae=Number(V.slice(0,te)),Te=V.slice(te+1);return I.t>ae||I.t===ae&&I.id>Te};function le(I){if(I.bin!=="1h"&&I.bin!=="1d"||(I.where?.all.length??0)||I.q||I.filters?.kind?.length||I.filters?.severity?.length||I.filters?.scope?.length||nn(I.tz,I.from)%es||nn(I.tz,I.to)%es)return;let V=I.filters?.source?.length?new Set(I.filters.source):void 0,te=X=>Math.max(I.from,J(X)),{at:ae,add:Te,rows:be}=H(I),ze=new Set,Ie=new Map,ke=0,Be=(X,ne)=>{let ye=lr(ne,I.bin,I.tz),$e=`${X}\0${ye}`,E=Ie.get($e);return E||(E={scope:X,t:ye,bin:I.bin,count:0,severity:{},kinds:{}},Ie.set($e,E)),E},Qe=(X,ne,ye)=>{let $e=Te(X);$e.count+=ye,ke+=ye,($e.first===void 0||ne<$e.first)&&($e.first=ne),($e.last===void 0||ne>$e.last)&&($e.last=ne)},Ke=Math.floor(I.to/es)*es;for(let[X,ne]of T){let ye=ae(X);if(ye!==void 0)for(let[$e,E]of ne){if(V&&!V.has($e))continue;let _=Math.ceil(te($e)/es)*es;for(let[D,ce]of E){if(D<_||D>=Ke)continue;Qe(ye,ce.first,ce.count),ce.last>(be.get(ye).last??-1/0)&&(be.get(ye).last=ce.last),ze.add($e);let me=Be(ye,D);me.count+=ce.count;for(let[Ce,oe]of Object.entries(ce.severity))me.severity[Ce]=(me.severity[Ce]??0)+oe;for(let[Ce,oe]of Object.entries(ce.kinds))me.kinds[Ce]=(me.kinds[Ce]??0)+oe}}}let pt=X=>hn(X.scope,I.scope)&&(!V||V.has(X.source))&&X.t>=J(X.source)&&ae(X.scope)!==void 0,P=X=>{let ne=ae(X.scope);Qe(ne,X.t,1),ze.add(X.source);let ye=Be(ne,X.t);ye.count++,ye.severity[X.severity]=(ye.severity[X.severity]??0)+1,ye.kinds[X.kind]=(ye.kinds[X.kind]??0)+1};for(let X of S){if(V&&!V.has(X))continue;let ne=te(X),ye=Math.ceil(ne/es)*es,$e=ye>=Ke?[[ne,I.to]]:[[ne,ye],[Ke,I.to]];for(let[E,_]of $e)for(let D=ms(g,E);D<g.length&&g[D].t<_;D++){let ce=g[D];ce.source===X&&pt(ce)&&P(ce)}}let B=Cn[I.bin],W=[];for(let X=ms(u,I.from-b);X<u.length&&u[X].t<I.from;X++){let ne=u[X];ne.t+ne.dur>I.from&&pt(ne)&&(Qe(ae(ne.scope),ne.t,1),ze.add(ne.source),ne.dur>=B&&W.length<5e3&&W.push(ne))}for(let X of x.values())X.t<I.from&&p>I.from&&pt(X)&&(Qe(ae(X.scope),X.t,1),ze.add(X.source),W.length<5e3&&W.push(X));for(let X=ms(u,I.from);X<u.length&&u[X].t<I.to&&W.length<5e3;X++)u[X].dur>=B&&pt(u[X])&&W.push(u[X]);for(let X of x.values())X.t>=I.from&&X.t<I.to&&W.length<5e3&&pt(X)&&W.push(X);let he=q(I,ae,I.from,I.to);for(let X of he){let ne=R.get(X.series);ne&&ze.add(ne)}let fe=[...Ie.values()].sort((X,ne)=>X.t-ne.t||(X.scope<ne.scope?-1:1));return{timeline:1,type:"result",rows:ee(be),bins:fe,spans:W,metrics:he,total:ke,retention:L(ze)}}async function pe(I){if(!i(I.scope))throw new Error(`not a scope path: ${JSON.stringify(I.scope)}`);let V=le(I);if(V)return V;let{test:te,range:ae,warnings:Te}=U(I),{at:be,add:ze,rows:Ie}=H(I),ke=new Set,Be=[];for(let he of j(ae.from,ae.to)){if(!te(he))continue;let fe=be(he.scope);if(fe===void 0)continue;let X=ze(fe);X.count++,(X.first===void 0||he.t<X.first)&&(X.first=he.t),(X.last===void 0||he.t>X.last)&&(X.last=he.t),ke.add(he.source),Be.push(he)}Be.sort(bl);let Qe=q(I,be,ae.from,ae.to);for(let he of Qe){let fe=R.get(he.series);fe&&ke.add(fe)}let Ke={timeline:1,type:"result",total:Be.length,...Te.length?{warnings:Te}:{}};if(I.bin){let he=Cn[I.bin],fe=new Map,X=[];for(let ye of Be){if((ye.open||ye.dur!==void 0&&ye.dur>=he)&&X.length<5e3&&X.push(ye),ye.t<ae.from)continue;let $e=be(ye.scope),E=lr(ye.t,I.bin,I.tz),_=`${$e}\0${E}`,D=fe.get(_);D||(D={scope:$e,t:E,bin:I.bin,count:0,severity:{},kinds:{}},fe.set(_,D)),D.count++,D.severity[ye.severity]=(D.severity[ye.severity]??0)+1,D.kinds[ye.kind]=(D.kinds[ye.kind]??0)+1}let ne=[...fe.values()].sort((ye,$e)=>ye.t-$e.t||(ye.scope<$e.scope?-1:1));return{...Ke,rows:ee(Ie),bins:ne,spans:X,metrics:Qe,retention:L(ke)}}let pt=Math.min(1e4,Math.max(1,I.limit??2e3)),P=I.cursor?Be.findIndex(he=>Q(he,I.cursor)):0,B=P<0?[]:Be.slice(P,P+pt),W=P>=0&&P+pt<Be.length;return{...Ke,rows:ee(Ie),events:B,metrics:Qe,retention:L(ke),...W?{next:G(B[B.length-1])}:{}}}let Y=new Set,ie=I=>un.includes(I),Ae=0;function De(I){let V=y(I),te=k.get(V);te&&(cm(g,te.t,ae=>ae===te),N(te,-1),te.dur!==void 0&&!te.open&&cm(u,te.t,ae=>ae===te),x.delete(V)),k.set(V,I),N(I,1),yp(g,I,()=>!1,bl),I.open?x.set(V,I):I.dur!==void 0&&(yp(u,I,()=>!1,bl),b=Math.max(b,I.dur)),v(I.scope)}return{async catalog(){return{...r,now:p,retention:L(r.sources.map(I=>I.name))}},query:pe,subscribe(I,V){let te={q:I,on:V};return Y.add(te),()=>{Y.delete(te)}},...s.stateAt?{stateAt:(I,V)=>s.stateAt(I,V)}:{},append(I,V=[],te){te!==void 0&&(p=Math.max(p,te));let ae=new Set($),Te=I.map(h);for(let be of Te){if(!ie(be.severity))throw new Error(`not a severity: ${be.severity}`);De(be)}for(let be of V)M(be);Ae++;for(let be of Y){let{test:ze}=U(be.q),{at:Ie}=H(be.q),ke=Te.filter(B=>ze(B)&&Ie(B.scope)!==void 0),Be=be.q.series?new Set(be.q.series):void 0,Qe=V.filter(B=>hn(d(B.scope),be.q.scope)&&(!Be||Be.has(B.series))).map(B=>({...B,scope:Ie(d(B.scope))})),Ke=[...$].filter(B=>!ae.has(B)),pt=Jt(be.q.scope)+be.q.depth,P=Ke.filter(B=>Jt(B)===pt&&hn(B,be.q.scope)).map(B=>({scope:B,label:m.get(B)?.label??Wr(B),kind:Yr(B),depth:be.q.depth,children:0,count:0}));be.on({timeline:1,type:"batch",events:ke,metrics:Qe,...P.length?{rows:P}:{},now:p,resume:String(Ae)})}},setRetention(I,V){A.set(I,{events:V.events,rollups:{...V.rollups},setBy:"user"})},get now(){return p},get size(){let I=0;for(let V of w.values())I+=V.fine.length;return{events:g.length,samples:I}}}}var fm="http://www.w3.org/2000/svg",dr=22,wl=38,us=26,dy=210,fy=24,oo=6e4,fr=36e5,vn=864e5,mm={"15m":15*oo,"1h":fr,"1d":vn,"1w":7*vn},um=t=>un.indexOf(t),my={debug:"dot",info:"circle",notice:"square",warning:"triangle",error:"diamond"},gt=(t,e,s)=>{let r=document.createElementNS(fm,t);for(let[i,o]of Object.entries(e))o!==void 0&&r.setAttribute(i,String(o));if(s){let i=document.createElementNS(fm,"title");i.textContent=s,r.append(i)}return r},sn=(t,e)=>{try{return new Intl.DateTimeFormat(void 0,{timeZone:e,dateStyle:"medium",timeStyle:"medium"}).format(t)}catch{return new Date(t).toISOString()}},gp=t=>t<1e3?`${Math.round(t)} ms`:t<oo?`${(t/1e3).toFixed(1)} s`:cr(t),uy=(t,e)=>e==="bytes"?t>=1e9?`${(t/1e9).toFixed(1)} GB`:t>=1e6?`${(t/1e6).toFixed(1)} MB`:t>=1e3?`${(t/1e3).toFixed(1)} kB`:`${Math.round(t)} B`:`${Math.round(t*10)/10}${e==="count"?"":` ${e}`}`;function bp(t,e){if(t<=3*fr)return{kind:"single"};for(let s of["1m","1h","1d"])if(t/Cn[s]<=e/2)return{kind:"binned",bin:s};return{kind:"binned",bin:"1d"}}function wp(t,e,s){let r=[];for(let n of t.events??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);for(let n of t.spans??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);let i=e.kind==="binned"?Cn[e.bin]:oo;for(let n of t.bins??[])n.count&&r.push([n.t,n.t+Cn[n.bin]]);let o=new Map;for(let n of t.metrics){let a="value"in n?n.value:n.sum,f=`${n.series}|${n.scope}`,p=(s?.get(n.series)??"counter")==="counter"?a!==0:o.get(f)!==a;o.set(f,a),p&&r.push([n.t,n.t+i])}return r}function hm(t,e){let s=e.tz??Intl.DateTimeFormat().resolvedOptions().timeZone,r=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,i=e.motion??!r;t.classList.add(...e.rootClass??[],"tlx");let{parseSearch:o,compileSearch:n}=Xr(e.catalog),a=(F="system")=>{t.style.colorScheme=F==="system"?"light dark":F,F==="system"?delete t.dataset.theme:t.dataset.theme=F};a(e.theme),t.setAttribute("role","region"),t.setAttribute("aria-label","Timeline");let f,p="",c=1,l="",d={},m=!1,h=e.collapseGaps??!0,y={t0:0,t1:vn},g,k="",u={from:0,to:0,mode:{kind:"single"},key:""},b,x,w,$,v=!0,O=0,C=0,A=!1,R,M=[],T=[],S=-1,N=new Set,z=new Map,K=[],J=Qr(0,vn,800),Z=new Map,L=[],U=re("nav",{class:"tlx-crumbs","aria-label":"Scope"}),H=re("div",{class:"segmented tlx-quick",role:"group","aria-label":"Range"});for(let F of["15m","1h","1d","1w","run"]){let se=re("button",{type:"button",class:"seg","data-v":F,title:F==="run"?"The latest run":`The last ${F}`},F==="run"?"this run":F);se.addEventListener("click",()=>ys(F)),H.append(se)}let ee=re("button",{type:"button",class:"btn sm tlx-live","aria-pressed":"false",title:"Follow what happens now"},"Live"),j=re("button",{type:"button",class:"btn sm quiet tlx-now",hidden:!0,title:"Back to the live edge"},"Back to now"),q=re("button",{type:"button",class:"btn sm quiet tlx-fit",title:"Everything in this scope"},"Fit"),G=re("input",{type:"checkbox",class:"tlx-gaps"});G.checked=h;let Q=!0,le=re("input",{type:"checkbox",class:"tlx-quiet"});le.checked=Q;let pe=re("input",{type:"search",class:"input tlx-q",placeholder:"Search: words, kind:\u2026, source:\u2026, severity:>=warning, -kind:\u2026","aria-label":"Search the timeline",spellcheck:"false"}),Y=re("span",{class:"tlx-hits",role:"status","aria-live":"polite"}),ie=re("button",{type:"button",class:"btn sm quiet tlx-prev",title:"Previous hit (\u21E7N)","aria-label":"Previous hit"},"\u2039"),Ae=re("button",{type:"button",class:"btn sm quiet tlx-next",title:"Next hit (N)","aria-label":"Next hit"},"\u203A"),De=re("div",{class:"tlx-facets",role:"group","aria-label":"Sources"}),I=re("select",{class:"input tlx-sev","aria-label":"Severity"},re("option",{value:""},"every severity"),...un.slice(1).map(F=>re("option",{value:F},`${F} and above`))),V=re("select",{class:"input tlx-views","aria-label":"Saved views",hidden:!e.views},re("option",{value:""},"Saved views\u2026")),te=re("button",{type:"button",class:"btn sm quiet tlx-save",hidden:!e.saveView,title:"Save this view"},"Save view"),ae=re("div",{class:"tlx-warn",role:"status",hidden:!0}),Te=re("div",{class:"tlx-status",role:"status"}),be=re("span",{class:"tlx-canvas-note"}),ze=re("div",{class:"tlx-labels"}),Ie=re("div",{class:"tlx-lanes",tabindex:"0",role:"application","aria-label":"Timeline lanes: drag to pan, wheel to zoom, drag the axis to choose a range, click it to move the playhead. Keys: \u2190 \u2192 pan, + \u2212 zoom, N next hit"}),ke=gt("svg",{class:"tlx-svg"});Ie.append(ke);let Be=re("div",{class:"tlx-scroll"},re("div",{class:"tlx-grid"},ze,Ie)),Qe=re("section",{class:"tlx-table",hidden:!0,"aria-label":"The events in the chosen range"}),Ke=re("aside",{class:"tlx-detail",hidden:!0,"aria-label":"The event"});t.replaceChildren(re("div",{class:"tlx-bar"},U,re("span",{class:"spacer"}),H,ee,j,q,re("label",{class:"tlx-gaps-label",title:"Draw long empty stretches as narrow breaks"},G,"Collapse gaps"),re("label",{class:"tlx-gaps-label",title:"Hide the rows with nothing in this range"},le,"Hide quiet rows")),re("div",{class:"tlx-bar"},pe,Y,ie,Ae,I,V,te),De,ae,re("div",{class:"tlx-body"},Be,Ke),re("div",{class:"tlx-foot"},Te,re("span",{class:"spacer"}),be),Qe);let pt=()=>Math.max(200,Ie.clientWidth||800),P=()=>{let F=(Me,He)=>(Me.own?-1:0)-(He.own?-1:0)||Me.scope.localeCompare(He.scope,void 0,{numeric:!0}),ue=(g?.rows??[]).filter(Me=>!Q||Me.count>0||Me.own||(g?.rows.length??0)<=1).sort(F).map(Me=>({kind:"row",row:Me})),ge=new Set(g?.metrics.map(Me=>Me.series)??[]);for(let Me of[...ge].sort()){let He=Z.get(Me);ue.push({kind:"metric",series:Me,unit:He?.unit??"count",type:He?.type??"counter",title:He?.title??Me})}return ue},B=(F,se)=>f?.names?.find(ue=>ue.scope===F)?.label??se,W=F=>F.kind==="metric"?wl:dr,he=()=>bp(y.t1-y.t0,pt()),fe=()=>f?.now??Date.now();function X(){return{timeline:1,type:"view",name:"",scope:p,depth:c,range:{from:Math.round(y.t0),to:Math.round(y.t1)},...l?{q:l}:{},...Object.keys(d).length?{filters:d}:{},...m?{live:m}:{},...h?{}:{collapseGaps:!1},...Q?{}:{quietRows:!0}}}function ne(F){F.scope!==void 0&&(p=F.scope),F.depth!==void 0&&(c=F.depth),l=F.q??"",pe.value=l,d=F.filters??{},I.value=d.severity?.length?d.severity[0]:"",h=F.collapseGaps??e.collapseGaps??!0,G.checked=h,Q=!F.quietRows,le.checked=Q,N.clear(),z.clear();let se=F.range;se&&"last"in se?ys(se.last,!1):se&&(y={t0:se.from,t1:se.to}),kt(!!F.live,!1)}let ye=()=>{let F=X();if(e.onViewChange?.(F),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(F))}`)}catch{}},$e=()=>{if(!e.urlState)return;let F=/#timeline=(.+)$/.exec(location.hash);if(F)try{return JSON.parse(decodeURIComponent(F[1]))}catch{return}};function E(F,se,ue,ge={}){let Me=n(l,fe(),F,se);M=Me.warnings;let He=l?[]:d.source?[...Z].filter(([,dt])=>d.source.includes(dt.source)).map(([dt])=>dt):void 0;return{timeline:1,type:"query",scope:p,depth:c,from:Me.from,to:Me.to,tz:s,...ue.kind==="binned"?{bin:ue.bin}:{},...l?{q:l,where:Me.where}:{},...Object.keys(d).length?{filters:d}:{},...He?{series:He}:{},...ge}}let _=()=>JSON.stringify([p,c,l,d,he()]);async function D(F=!1){let se=he(),ue=_(),ge=y.t1-y.t0;if(!F&&g&&ue===u.key&&y.t0>=u.from&&y.t1<=u.to){me();return}if(C){A=!0;return}C++;let Me=y.t0-ge/2,He=Math.min(y.t1+ge/2,Math.max(y.t1,fe()+ge*.1));try{let dt=await e.source.query(E(Me,He,se,se.kind==="single"?{limit:1e4}:{}));se.kind==="single"&&dt.next&&(dt=await e.source.query(E(Me,He,{kind:"binned",bin:"1m"}))),g=dt,k=ue,u={from:Me,to:He,mode:se,key:ue}}catch(dt){Te.textContent=`The history couldn't be read: ${String(dt?.message??dt)}`}finally{C--}me(),ye(),A&&(A=!1,D())}function ce(){let F=pt(),se=he();if(K=[],h&&g){let ue=new Map([...Z].map(([ge,Me])=>[ge,Me.type]));K=ul(wp(g,se,ue),y.t0,Math.min(y.t1,Math.max(y.t0,fe())),{minFrac:.15,minMs:10*oo}),se.kind==="binned"&&(K=K.filter(ge=>ge.to-ge.from>=2*Cn[se.bin])),K=K.filter(ge=>!(N.has(pr(ge))&&(z.get(pr(ge))??1)>=1))}J=Qr(y.t0,y.t1,F,K,{cut:fy,weights:z})}let me=()=>{O||(O=requestAnimationFrame(Ce))};function Ce(){O=0,ce();let F=pt(),se=P(),ue=u.mode,ge=[],Me=us;for(let de of se)ge.push(Me),Me+=W(de);let He=Math.max(Me,us+dr);ke.setAttribute("width",String(F)),ke.setAttribute("height",String(He)),ke.setAttribute("viewBox",`0 0 ${F} ${He}`);let dt=Be.scrollTop-200,ns=Be.scrollTop+(Be.clientHeight||600)+200,Ve=[],qe=J.x;Ve.push(gt("rect",{class:"tlx-axis",x:0,y:0,width:F,height:us}));let Xt=(g?.retention??[]).map(de=>({r:de,from:ue.kind==="binned"?de.keptFrom.rollups[ue.bin]??de.keptFrom.events:de.keptFrom.events,days:ue.kind==="binned"?de.rollups[ue.bin]:de.events})).filter(de=>de.from!==void 0);if(Xt.length){let de=Math.min(...Xt.map(Oe=>Oe.from));de>y.t0&&Ve.push(gt("rect",{class:"tlx-notkept",x:Math.max(0,qe(y.t0)),y:us,width:Math.max(0,qe(de)-Math.max(0,qe(y.t0))),height:He-us},`Nothing kept before ${sn(de,s)}: ${Xt.map(Oe=>`${Oe.r.source} ${Oe.days===null?"kept until deleted":`kept ${Oe.days} days`}`).join(", ")}`))}let gn=fe();gn<y.t1&&Ve.push(gt("rect",{class:"tlx-future",x:qe(gn),y:us,width:F-qe(gn),height:He-us}));for(let de of hl(J,s,90)){Ve.push(gt("line",{class:`tlx-tick${de.major?" major":""}`,x1:de.x,x2:de.x,y1:us-6,y2:He}));let Oe=gt("text",{class:"tlx-ticklabel",x:de.x+3,y:16});Oe.textContent=de.label,Ve.push(Oe)}$&&Ve.push(gt("rect",{class:"tlx-brush",x:qe($.from),y:0,width:Math.max(1,qe($.to)-qe($.from)),height:He}));let uo=ue.kind==="single"?(g?.events??[]).filter(de=>de.dur!==void 0||de.open):g?.spans??[],qm=ue.kind==="single"?(g?.events??[]).filter(de=>de.dur===void 0&&!de.open):[],Ip=new Map;se.forEach((de,Oe)=>{de.kind==="row"&&Ip.set(de.row.scope,Oe)});let ho=de=>{let Oe=Jt(p)+c,tt=Jt(de)>=Oe?Ms(de,Oe):de;return Ip.get(tt)},oi=de=>ge[de]+W(se[de])>=dt&&ge[de]<=ns;if(se.forEach((de,Oe)=>{oi(Oe)&&Ve.push(gt("rect",{class:`tlx-lane${Oe%2?" odd":""}${de.kind==="metric"?" metric":""}`,x:0,y:ge[Oe],width:F,height:W(de)}))}),ue.kind==="binned"){let de=new Map;for(let Oe of g?.bins??[]){let tt=ho(Oe.scope);tt!==void 0&&de.set(tt,Math.max(de.get(tt)??0,Oe.count))}for(let Oe of g?.bins??[]){let tt=ho(Oe.scope);if(tt===void 0||!oi(tt))continue;let ft=qe(Oe.t),it=qe(Oe.t+Cn[Oe.bin]);if(it<0||ft>F)continue;let St=[...un].reverse().find(Mn=>(Oe.severity[Mn]??0)>0)??"info",Ut=Math.max(2,(dr-8)*Math.sqrt(Oe.count)/Math.sqrt(de.get(tt)||1));Ve.push(gt("rect",{class:"tlx-countbar",x:ft,y:ge[tt]+dr-3-Ut,width:Math.max(1,it-ft-.5),height:Ut,"data-t":Oe.t},`${sn(Oe.t,s)}: ${Oe.count} event${Oe.count===1?"":"s"}${St!=="info"&&St!=="debug"?`, the worst ${St}`:""}`)),(St==="warning"||St==="error")&&Ve.push(gt("rect",{class:`tlx-heat sev-${St}`,x:ft,y:ge[tt]+dr-(St==="error"?4:3),width:Math.max(1,it-ft-.5),height:St==="error"?3:2}))}}for(let de of uo){let Oe=ho(de.scope);if(Oe===void 0||!oi(Oe))continue;let tt=de.open?gn:de.t+(de.dur??0),ft=qe(de.t),it=qe(tt);if(it<-2||ft>F+2)continue;let St=`tlx-span sev-${de.severity}${de.open?" open":""}${w?.id===de.id?" selected":""}`,Ut=`${de.summary} \xB7 ${sn(de.t,s)}${de.open?", still going":`, ${gp(tt-de.t)}`}`,Mn=ge[Oe]+5,Es=ue.kind==="binned"?4:8,Pn=ft;for(let Dn of J.cuts)Dn.weight>=1||Dn.x1<=ft||Dn.x0>=it||(Dn.x0>Pn&&Ve.push(gt("rect",{class:St,x:Pn,y:Mn,width:Math.max(1,Dn.x0-Pn),height:Es,rx:2,"data-id":de.id},Ut)),Ve.push(gt("path",{class:`${St} through`,d:`M${Dn.x0} ${Mn+Es/2} H${Dn.x1}`,"data-id":de.id},`${Ut} (lasted through the break)`)),Pn=Dn.x1);it>Pn&&Ve.push(gt("rect",{class:St,x:Math.max(-2,Pn),y:Mn,width:Math.max(2,Math.min(F+2,it)-Math.max(-2,Pn)),height:Es,rx:2,"data-id":de.id},Ut))}let zp=new Map;for(let de of qm){let Oe=ho(de.scope);if(Oe===void 0||!oi(Oe))continue;let tt=qe(de.t);if(tt<-6||tt>F+6||tt-(zp.get(Oe)??-1/0)<3)continue;zp.set(Oe,tt);let ft=ge[Oe]+dr/2+2,it=4,St=my[de.severity],Ut=St==="diamond"?`M${tt} ${ft-it-1} l${it+1} ${it+1} l${-it-1} ${it+1} l${-it-1} ${-it-1} z`:St==="triangle"?`M${tt} ${ft-it-1} l${it+1} ${2*it+1} h${-2*it-2} z`:St==="square"?`M${tt-it+.5} ${ft-it+.5} h${2*it-1} v${2*it-1} h${-2*it+1} z`:"",Mn=`${sn(de.t,s)} \xB7 ${de.summary}`,Es=`tlx-mark sev-${de.severity}${w?.id===de.id?" selected":""}${S>=0&&T[S]?.id===de.id?" hit":""}`;Ve.push(Ut?gt("path",{class:Es,d:Ut,"data-id":de.id},Mn):gt("circle",{class:Es,cx:tt,cy:ft,r:St==="dot"?2.5:it,"data-id":de.id},Mn))}se.forEach((de,Oe)=>{if(de.kind!=="metric"||!oi(Oe))return;let tt=new Map;for(let ut of g?.metrics??[]){if(ut.series!==de.series)continue;let Ht="value"in ut?{min:ut.value,max:ut.value,sum:ut.value,count:1}:{min:ut.min,max:ut.max,sum:ut.sum,count:ut.count},Bt=tt.get(ut.t);Bt?(Bt.min=Math.min(Bt.min,Ht.min),Bt.max=Math.max(Bt.max,Ht.max),Bt.sum+=Ht.sum,Bt.count+=Ht.count):tt.set(ut.t,{...Ht})}let ft=[...tt].sort((ut,Ht)=>ut[0]-Ht[0]);if(!ft.length)return;let it=ue.kind==="binned"?Cn[ue.bin]:oo,St=ut=>de.type==="gauge"?ut.sum/Math.max(1,ut.count):ut.sum,Ut=Math.max(1e-9,...ft.map(([,ut])=>de.type==="gauge"?ut.max:St(ut))),Mn=ge[Oe]+wl-4,Es=wl-10,Pn=ut=>Mn-ut/Ut*Es;if(de.type==="gauge"){let ut=ft.map(([Ht,Bt])=>`${qe(Ht)},${Pn(Bt.max)}`).join(" ")+" "+[...ft].reverse().map(([Ht,Bt])=>`${qe(Ht)},${Pn(Bt.min)}`).join(" ");Ve.push(gt("polygon",{class:"tlx-band",points:ut})),Ve.push(gt("polyline",{class:"tlx-line",points:ft.map(([Ht,Bt])=>`${qe(Ht+it/2)},${Pn(St(Bt))}`).join(" ")}))}else{let ut="",Ht=-1/0;for(let[Bt,Vm]of ft){let Km=qe(Bt),Cp=qe(Bt+it),jp=Pn(St(Vm));ut+=Bt>Ht?`M${Km} ${Mn} V${jp} H${Cp}`:` V${jp} H${Cp}`,Ht=Bt+it;let Lp=ft.find(([Gm])=>Gm>Bt);(!Lp||Lp[0]>Ht)&&(ut+=` V${Mn} Z`)}Ve.push(gt("path",{class:"tlx-area",d:ut}))}let Dn=gt("text",{class:"tlx-peak",x:4,y:ge[Oe]+11});Dn.textContent=`peak ${uy(Ut,de.unit)}${de.type==="counter"?` per ${ue.kind==="binned"?ue.bin:"1m"}`:""}`,Ve.push(Dn)});for(let de of J.cuts){if(de.weight>=1)continue;let Oe=it=>{let St=`M${it} 0`;for(let Ut=0;Ut<He;Ut+=8)St+=` L${it+(Ut/8%2?-3:3)} ${Ut+8}`;return St},tt=gt("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":de.from,"data-to":de.to,"aria-label":`A break of ${cr(de.to-de.from)} with nothing shown, from ${sn(de.from,s)} to ${sn(de.to,s)}: press to open it`},`${cr(de.to-de.from)} with nothing here: ${sn(de.from,s)} to ${sn(de.to,s)} (click to open)`);tt.append(gt("rect",{class:"tlx-cut-bg",x:de.x0,y:0,width:de.x1-de.x0,height:He})),tt.append(gt("path",{class:"tlx-cut-edge",d:Oe(de.x0+3)}),gt("path",{class:"tlx-cut-edge",d:Oe(de.x1-3)}));let ft=gt("text",{class:"tlx-cut-label",x:(de.x0+de.x1)/2,y:15,"text-anchor":"middle"});ft.textContent=cr(de.to-de.from),tt.append(ft),Ve.push(tt)}if(b!==void 0){let de=qe(b);Ve.push(gt("line",{class:"tlx-playhead",x1:de,x2:de,y1:0,y2:He})),Ve.push(gt("path",{class:"tlx-handle",d:`M${de-6} 0 h12 v8 l-6 7 l-6 -7 z`},`the playhead: ${sn(b,s)}`))}ke.replaceChildren(...Ve),ze.replaceChildren(re("div",{class:"tlx-labelhead",style:`height:${us}px`},he().kind==="single"?"single events":`per ${he().kind==="binned"?he().bin:""}`),...se.map(de=>{if(de.kind==="metric")return re("div",{class:"tlx-rowlabel metric",style:`height:${wl}px`,title:`${de.title} (${de.type==="counter"?"sums":"min, max and mean"})`},de.title);let Oe=de.row,tt=re("div",{class:`tlx-rowlabel${Oe.own?" own":""}`,style:`height:${dr}px`,"data-scope":Oe.scope,title:`${Oe.scope||"all hosts"} \xB7 ${Oe.count} event${Oe.count===1?"":"s"}`},re("span",{class:"tlx-kind"},e.catalog.flags.find(ft=>Oe[ft])??Oe.kind),re("span",{class:"tlx-name"},Oe.own?`${Oe.label} (itself)`:Oe.label),re("span",{class:"tlx-count"},String(Oe.count)));if(!Oe.own&&Oe.scope!==p){let ft=re("button",{type:"button",class:"tlx-drill",title:Oe.children?`Into ${Oe.label}: its ${Oe.children} part${Oe.children===1?"":"s"}`:`Into ${Oe.label}`,"aria-label":`Into ${Oe.label}`},"\u203A");ft.addEventListener("click",()=>at(Oe.scope)),tt.append(ft)}return tt})),ze.style.width=`${dy}px`,oe()}function oe(){U.replaceChildren(...Jr(p).flatMap((ge,Me,He)=>{let dt=re("button",{type:"button",class:`tlx-crumb${Me===He.length-1?" current":""}`,"aria-current":Me===He.length-1?"location":void 0},B(ge.scope,ge.label));return dt.addEventListener("click",()=>{ge.scope!==p&&(p=ge.scope,c=1,D(!0))}),Me?[re("span",{class:"tlx-sep","aria-hidden":"true"},"/"),dt]:[dt]})),ee.setAttribute("aria-pressed",String(m)),ee.classList.toggle("on",m),j.hidden=!m||v;let F=he(),se=g?.total??0,ue=(g?.retention??[]).filter(ge=>ge.events!==null).map(ge=>`${ge.source} kept ${ge.events} d`);Te.textContent=`${sn(y.t0,s)} \u2013 ${sn(y.t1,s)} \xB7 ${F.kind==="single"?"single events":`bins of ${F.bin}`} \xB7 ${se} event${se===1?"":"s"}${K.length?` \xB7 ${K.length} break${K.length===1?"":"s"}`:""}${ue.length?` \xB7 ${ue.slice(0,3).join(", ")}`:""}`,ae.hidden=!M.length,ae.textContent=M.join(" \xB7 "),Y.textContent=l?T.length?`${S+1>0?`${S+1} of `:""}${T.length}${T.length>=2e3?"+":""} hit${T.length===1?"":"s"}`:`${se?`${se} hit${se===1?"":"s"}`:"no hits"}`:"";for(let ge of H.querySelectorAll(".seg"))ge.classList.remove("on");be.textContent=b===void 0?"":x?(()=>{let ge=e.stamp?.(x)??{};return`Canvas: the state recorded at ${sn(Date.parse(ge.at??"")||b,s)}${ge.tag?` (${ge.tag})`:""}`})():"No state recorded here",be.classList.toggle("none",b!==void 0&&!x)}function Le(){De.replaceChildren();for(let F of f?.sources??[]){let se=!d.source?.length||d.source.includes(F.name),ue=re("button",{type:"button",class:`tlx-chip${se?" on":""}${F.status==="not-yet"?" notyet":""}`,"aria-pressed":String(se&&F.status!=="not-yet"),disabled:F.status==="not-yet",title:F.status==="not-yet"?`${F.title}: not kept yet`:`${F.title}${Pe(F)}`},F.name);F.status!=="not-yet"&&ue.addEventListener("click",()=>xe(F.name)),De.append(ue)}}let Pe=F=>{let se=f?.retention.find(ue=>ue.source===F.name);return se?` (kept ${se.events===null?"until deleted":`${se.events} days`})`:""};function xe(F){let se=(f?.sources??[]).filter(ge=>ge.status==="kept").map(ge=>ge.name),ue=d.source?.length?[...d.source]:[...se];ue=ue.includes(F)?ue.filter(ge=>ge!==F):[...ue,F],d={...d,...ue.length===se.length?{source:void 0}:{source:ue}},d.source||delete d.source,Le(),D(!0),Ue()}let _e=0;pe.addEventListener("input",()=>{clearTimeout(_e),_e=setTimeout(()=>{l=pe.value.trim(),S=-1,D(!0),Ue()},250)}),pe.addEventListener("keydown",F=>{F.key==="Enter"&&(F.preventDefault(),clearTimeout(_e),l=pe.value.trim(),D(!0).then(()=>Ue()).then(()=>mt(F.shiftKey?-1:1)))});async function Ue(){if(!l){T=[],S=-1,oe();return}let F=y.t1-y.t0;T=(await e.source.query(E(y.t0-F*4,Math.max(y.t1+F*4,fe()),{kind:"single"},{limit:2e3}))).events??[],S=Math.min(S,T.length-1),oe()}function mt(F){if(!T.length)return;let se=(y.t0+y.t1)/2;S<0?S=F>0?Math.max(0,T.findIndex(Me=>Me.t>=se)):Math.max(0,T.length-1-[...T].reverse().findIndex(Me=>Me.t<=se)):S=(S+F+T.length)%T.length;let ue=T[S],ge=Math.min(y.t1-y.t0,2*fr);y={t0:ue.t-ge/2,t1:ue.t+ge/2},v=!1,$t(ue),D()}ie.addEventListener("click",()=>mt(-1)),Ae.addEventListener("click",()=>mt(1)),I.addEventListener("change",()=>{let F=I.value;d={...d,...F?{severity:un.filter(se=>um(se)>=um(F))}:{}},F||delete d.severity,D(!0),Ue()});async function ys(F,se=!0){let ue=fe();if(F==="run"){let ge=await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:ue-30*vn,to:ue+1,filters:{kind:["run"]},limit:1e4}).catch(()=>{}),Me=ge?.events?.[ge.events.length-1];y=Me?{t0:Me.t-(Me.dur??fr)*.02,t1:(Me.open?ue:Me.t+(Me.dur??fr))+(Me.dur??fr)*.04}:{t0:ue-vn,t1:ue+vn*.02}}else y={t0:ue-mm[F],t1:ue+mm[F]*.02};v=!0,N.clear(),z.clear(),se&&D()}function kt(F,se=!0){if(m=F,R?.(),R=void 0,F&&e.source.subscribe){let ue=0,ge=0;R=e.source.subscribe(E(fe()-fr,fe()+365*vn,{kind:"single"}),Me=>{if(f&&(f.now=Math.max(f.now,Me.now)),v){let dt=y.t1-y.t0;y={t0:Me.now-dt*.98,t1:Me.now+dt*.02}}let He=Date.now();He-ue>500?(ue=He,D(!0)):ge||(ge=setTimeout(()=>{ge=0,ue=Date.now(),D(!0)},500))}),v=!0}se&&(oe(),ye())}ee.addEventListener("click",()=>kt(!m)),j.addEventListener("click",()=>{v=!0;let F=y.t1-y.t0,se=fe();y={t0:se-F*.98,t1:se+F*.02},D()}),q.addEventListener("click",()=>{ht()}),G.addEventListener("change",()=>{h=G.checked,N.clear(),z.clear(),me(),ye()}),le.addEventListener("change",()=>{Q=le.checked,me(),ye()});function at(F){let se=g?.rows.find(ue=>ue.scope===F);p=F,c=se&&se.children===0?0:1,$=void 0,Qe.hidden=!0,D(!0)}async function ht(){let F=fe(),ue=((await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:F-400*vn,to:F+1,bin:"1d",tz:s}).catch(()=>{}))?.bins??[]).map(Me=>Me.t),ge=ue.length?Math.min(...ue):F-7*vn;y={t0:ge,t1:F+(F-ge)*.02},v=!0,D()}let _n=0;async function Kt(F){if(b=F,me(),F===void 0){x=void 0;return}let se=++_n,ue=e.source.stateAt?await e.source.stateAt(p,F).catch(()=>{}):void 0;se===_n&&(x=ue,e.onPlayhead?.(F,ue),oe())}async function _t(F,se){$={from:Math.min(F,se),to:Math.max(F,se)},me();let ue=await e.source.query(E($.from,$.to,{kind:"single"},{limit:500})),ge=o(l),Me=Ve=>{let qe=[],zt=0;for(let[Xt,gn]of io(ge,Ve))qe.push(Ve.slice(zt,Xt),re("mark",null,Ve.slice(Xt,gn))),zt=gn;return qe.push(Ve.slice(zt)),qe},He=(ue.events??[]).map(Ve=>{let qe=re("tr",{"data-id":Ve.id,tabindex:"0"},re("td",null,sn(Ve.t,s)),re("td",null,Ve.dur!==void 0?gp(Ve.dur):Ve.open?"still going":""),re("td",null,Ve.source),re("td",null,Ve.kind),re("td",{class:`sev-${Ve.severity}`},Ve.severity),re("td",{class:"tlx-sum"},...Me(Ve.summary)),re("td",{class:"tlx-scope"},Ve.scope));return qe.addEventListener("click",()=>$t(Ve)),qe.addEventListener("keydown",zt=>{zt.key==="Enter"&&$t(Ve)}),qe}),dt=re("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");dt.addEventListener("click",()=>{$=void 0,Qe.hidden=!0,me()});let ns=Ve=>{let qe=re("button",{type:"button",class:"btn sm","data-export":Ve},Ve.toUpperCase());return qe.addEventListener("click",()=>{Gt(Ve)}),qe};Qe.replaceChildren(re("div",{class:"tlx-table-head"},re("strong",null,`${ue.total} event${ue.total===1?"":"s"}`),re("span",null,` ${sn($.from,s)} \u2013 ${sn($.to,s)}${ue.total>500?" (the first 500 shown; the export has them all)":""}`),re("span",{class:"spacer"}),re("span",null,"Export: "),ns("json"),ns("csv"),dt),re("div",{class:"tlx-table-wrap"},re("table",null,re("thead",null,re("tr",null,...["When","Long","Source","Kind","Severity","What","Scope"].map(Ve=>re("th",{scope:"col"},Ve)))),re("tbody",null,...He)))),Qe.hidden=!1}async function Dt(){if(!$)return[];let F=[],se;do{let ue=await e.source.query(E($.from,$.to,{kind:"single"},{limit:1e4,...se?{cursor:se}:{}}));F.push(...ue.events??[]),se=ue.next}while(se&&F.length<2e5);return F}async function Gt(F){let se=await Dt(),ue=F==="json"?yl(se,L):gl(se,L),ge=`timeline-${new Date($.from).toISOString().slice(0,16).replace(/:/g,"")}.${F}`,Me=F==="json"?"application/json":"text/csv";if(e.onExport){e.onExport(ge,ue,Me);return}let He=re("a",{href:`data:${Me};charset=utf-8,${encodeURIComponent(ue)}`,download:ge});document.body.append(He),He.click(),He.remove()}function $t(F){if(w=F,me(),!F){Ke.hidden=!0;return}let se=f?.sources.find(qe=>qe.name===F.source),ue=new Set(se?.sensitive??[]),ge=o(l),Me=qe=>{let zt=[],Xt=0;for(let[gn,uo]of io(ge,qe))zt.push(qe.slice(Xt,gn),re("mark",null,qe.slice(gn,uo))),Xt=uo;return zt.push(qe.slice(Xt)),zt},He=(qe,zt)=>{if(!zt)return null;let Xt=re("button",{type:"button",class:"btn sm"},qe);return Xt.addEventListener("click",zt),Xt},dt=Object.entries(F.attrs).map(([qe,zt])=>{if(!ue.has(qe))return re("tr",null,re("th",{scope:"row"},qe),re("td",null,...Me(String(zt))));let Xt=re("button",{type:"button",class:"btn sm quiet",title:"This can name a remote host, a folder or free text"},"Show"),gn=re("td",{class:"tlx-sensitive"},"hidden ",Xt);return Xt.addEventListener("click",()=>gn.replaceChildren(String(zt))),re("tr",null,re("th",{scope:"row"},qe),gn)}),ns=re("button",{type:"button",class:"btn sm quiet tlx-close","aria-label":"Close"},"\xD7");ns.addEventListener("click",()=>$t(void 0));let Ve=Jr(F.scope).slice(1).map(qe=>{let zt=re("button",{type:"button",class:"tlx-crumb"},B(qe.scope,qe.label));return zt.addEventListener("click",()=>at(qe.scope)),zt});Ke.replaceChildren(re("div",{class:"tlx-detail-head"},re("strong",null,F.kind),ns),re("p",{class:`tlx-sev sev-${F.severity}`},`${F.severity} \xB7 ${se?.title??F.source}`),re("p",{class:"tlx-sum"},...Me(F.summary)),re("p",null,sn(F.t,s),F.dur!==void 0?` \xB7 ${gp(F.dur)}${F.open?" so far":""}`:F.open?" \xB7 still going":""),re("p",{class:"tlx-crumbs small"},...Ve),...dt.length?[re("table",{class:"tlx-attrs"},re("tbody",null,...dt))]:[],re("div",{class:"tlx-links"},...(e.actions?.(F)??[]).map(([qe,zt])=>He(qe,zt)))),Ke.hidden=!1}function ur(F,se){let ue=pr({from:F,to:se});if(!K.find(dt=>dt.from===F&&dt.to===se))return;if(N.add(ue),!i){z.set(ue,1),me();return}let Me=performance.now(),He=dt=>{let ns=Math.min(1,(dt-Me)/260);z.set(ue,1-(1-ns)**3),Ce(),ns<1&&requestAnimationFrame(He)};requestAnimationFrame(He)}let Zt,Zs=F=>F.clientX-ke.getBoundingClientRect().left;ke.addEventListener("pointerdown",F=>{let se=Zs(F),ue=F.clientY-ke.getBoundingClientRect().top,ge=F.target.closest?.(".tlx-cut");if(ge){F.preventDefault(),ur(Number(ge.getAttribute("data-from")),Number(ge.getAttribute("data-to")));return}ke.setPointerCapture(F.pointerId),Zt={kind:ue<us||F.shiftKey?"brush":F.target.classList.contains("tlx-handle")?"scrub":"pan",x0:se,t0:J.t(se),v0:y,moved:!1},F.preventDefault(),Ie.focus({preventScroll:!0})}),ke.addEventListener("pointermove",F=>{if(!Zt)return;let se=Zs(F);if(Math.abs(se-Zt.x0)>3&&(Zt.moved=!0),!!Zt.moved)if(Zt.kind==="pan"){let ue=(Zt.x0-se)*J.msPerPx;y={t0:Zt.v0.t0+ue,t1:Zt.v0.t1+ue},v=!1,D()}else Zt.kind==="scrub"?Kt(J.t(se)):($={from:Math.min(Zt.t0,J.t(se)),to:Math.max(Zt.t0,J.t(se))},me())}),ke.addEventListener("pointerup",F=>{let se=Zt;if(Zt=void 0,!se)return;let ue=Zs(F);if(se.kind==="brush"&&se.moved){_t(se.t0,J.t(ue));return}if(se.kind==="brush"&&!se.moved){Kt(J.t(ue));return}if(se.kind==="pan"&&!se.moved){let ge=F.target.closest?.("[data-id]")?.getAttribute("data-id"),Me=ge?[...g?.events??[],...g?.spans??[]].find(He=>He.id===ge):void 0;Me?($t(Me),Kt(Me.t)):Kt(J.t(ue))}}),ke.addEventListener("keydown",F=>{let se=F.target.closest?.(".tlx-cut");se&&(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),ur(Number(se.getAttribute("data-from")),Number(se.getAttribute("data-to"))))}),ke.addEventListener("wheel",F=>{F.preventDefault();let se=Zs(F);if(F.shiftKey||Math.abs(F.deltaX)>Math.abs(F.deltaY)){let ue=(F.shiftKey?F.deltaY:F.deltaX)*J.msPerPx;y={t0:y.t0+ue,t1:y.t1+ue},v=!1}else hr(J.t(se),Math.exp(F.deltaY*.0015),se/pt());D()},{passive:!1});function hr(F,se,ue=.5){let ge=Math.min(400*vn,Math.max(1e4,(y.t1-y.t0)*se));y={t0:F-ue*ge,t1:F+(1-ue)*ge},N.clear(),z.clear(),se<1&&(v=m&&y.t1>=fe())}Ie.addEventListener("keydown",F=>{let se=y.t1-y.t0;if(F.key==="ArrowLeft"||F.key==="ArrowRight"){let ue=se*.15*(F.key==="ArrowLeft"?-1:1);y={t0:y.t0+ue,t1:y.t1+ue},v=!1}else if(F.key==="+"||F.key==="=")hr((y.t0+y.t1)/2,.6);else if(F.key==="-"||F.key==="_")hr((y.t0+y.t1)/2,1/.6);else if(F.key==="n"||F.key==="N"){mt(F.shiftKey?-1:1),F.preventDefault();return}else if(F.key==="Escape")$t(void 0),$=void 0,Qe.hidden=!0;else return;F.preventDefault(),D()}),t.addEventListener("keydown",F=>{F.key==="/"&&document.activeElement!==pe&&!F.target.closest("input, select, textarea")&&(F.preventDefault(),pe.focus())}),Be.addEventListener("scroll",()=>me(),{passive:!0}),te.addEventListener("click",async()=>{let F=`${Jr(p).slice(-1)[0].label}${l?`: ${l}`:""}`.slice(0,80);await e.saveView?.({...X(),name:F}),await Fn()});let We=[];async function Fn(){e.views&&(We=await e.views(),V.replaceChildren(re("option",{value:""},"Saved views\u2026"),...We.map((F,se)=>re("option",{value:String(se)},F.name))))}V.addEventListener("change",()=>{let F=We[Number(V.value)];F&&(ne(F),Le(),D(!0)),V.value=""});let yt=typeof ResizeObserver=="function"?new ResizeObserver(()=>me()):void 0;yt?.observe(Ie);let cn=(async()=>{f=await e.source.catalog(),L=f.sources.flatMap(ge=>(ge.sensitive??[]).map(Me=>`${ge.name}.${Me}`));for(let ge of f.sources)for(let Me of ge.series)Z.set(Me.name,{unit:Me.unit,type:Me.type,title:Me.title,source:ge.name});p=f.hosts.length===1?`host:${f.hosts[0].replace(/[%/:\s]/g,ge=>`%${ge.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}`:"";let se=f.now;y={t0:se-vn,t1:se+vn*.02};let ue=$e()??e.view;ue&&ne(ue),Le(),await Fn(),await D(!0),l&&await Ue()})();return{el:t,ready:cn,get view(){return X()},setView(F){return ne(F),Le(),D(!0)},setRange(F,se){return y={t0:F,t1:se},v=!1,D()},setPlayhead:Kt,setLive:kt,setTheme:a,refresh:()=>D(!0),internal:{get result(){return g},get mode(){return he()},get scale(){return J},get gaps(){return K},get playState(){return x},get hits(){return T},get selected(){return w},get follow(){return v},openCut:ur,showTable:_t,rangeEvents:Dt,exportRange:Gt,select:$t,stepHit:mt,drill:at,findHits:Ue,paint:Ce,lines:P},dispose(){R?.(),yt?.disconnect(),O&&cancelAnimationFrame(O),t.replaceChildren()}}}var hy={arrow:{d:"M0,0 L10,5 L0,10 z",refX:9},open:{d:"M0,0 L10,5 L0,10 L3,5 z",refX:9},diamond:{d:"M0,5 L5,1.5 L10,5 L5,8.5 z",refX:1}},rn=t=>(Math.round(t*10)/10).toString(),ym=t=>(t??"link").replace(/[^\w-]/g,"_");function xl(t,e){let{id:s}=e,r=e.styles??{},i=t.options,o=t.bounds,n=new Map,a=(m,h)=>{let y=r[m]??{},g=h==="start"?y.start??"none":y.end??"arrow";if(g!=="none")return(n.get(m)??n.set(m,new Set).get(m)).add(g),`url(#${s}-mk-${m}-${g})`},f="",p="",c="",l="";for(let m of[...t.panels].sort((h,y)=>h.depth-y.depth)){let h=m.rect,y=m.label?Se("text",{class:"pl",x:m.titleAt[0],y:m.titleAt[1]},vt(m.label)+(m.sub?Se("tspan",{class:"pls",dx:10},vt(m.sub)):"")):"";f+=Se("g",{class:`panel k-${m.role??"grey"}`,"data-id":m.id},Se("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:rn(h.r-h.l),height:rn(h.b-h.t),rx:i.panelRx})+y)}for(let m of t.links){if(!m.points.length)continue;let h=ym(m.kind);p+=Se("path",{class:`conn k-${h}`,d:"M"+m.points.map(y=>`${rn(y[0])},${rn(y[1])}`).join(" L"),"data-id":m.id,"data-a":m.a,"data-b":m.b,"marker-start":a(h,"start"),"marker-end":a(h,"end")}),m.at&&(l+=Se("text",{class:`cl k-${h}`,x:m.at.x,y:m.at.y,"text-anchor":m.at.anchor==="start"?void 0:m.at.anchor,"data-for":m.id},vt(m.at.text)))}for(let m of t.cards){let h=m.rect;c+=Se("g",{class:`card k-${m.role??"grey"}${m.ghost?" ghost":""}`,"data-id":m.id,tabindex:0,role:"button","aria-label":m.sub?`${m.label}: ${m.sub}`:m.label},Se("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:i.W,height:i.H,rx:i.cardRx})+Se("text",{class:"lt",x:rn(h.l+14),y:rn(h.t+24)},vt(m.label))+(m.sub?Se("text",{class:"st",x:rn(h.l+14),y:rn(h.t+42)},vt(m.sub)):""))}let d="";for(let[m,h]of n)for(let y of h){let g=hy[y];d+=Se("marker",{id:`${s}-mk-${m}-${y}`,viewBox:"0 0 10 10",refX:g.refX,refY:5,markerWidth:5.4,markerHeight:5.4,orient:"auto-start-reverse"},Se("path",{d:g.d,class:`mk k-${m}`}))}return Se("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flat",viewBox:`${rn(o.l)} ${rn(o.t)} ${rn(o.r-o.l)} ${rn(o.b-o.t)}`,role:"img","aria-label":e.title??"drawing, flat view","data-view":"2d"},(d?Se("defs",{},d):"")+Se("g",{class:"panels"},f)+Se("g",{class:"conns"},p)+Se("g",{class:"cards"},c)+Se("g",{class:"labels"},l))}function gm(t={}){let e=r=>r?r.startsWith("#")||r.includes("(")?r:`var(--${r})`:"var(--ink)",s=`
|
|
369
406
|
.flat{font-family:inherit}
|
|
370
407
|
.flat .card{cursor:pointer;outline:none}
|
|
371
408
|
.flat .card .face{fill:hsl(var(--h) var(--s) var(--l-top));stroke:hsl(var(--h) var(--s) var(--l-edge) / .55);stroke-width:1}
|
|
@@ -383,8 +420,8 @@ ${e.extraBody??""}
|
|
|
383
420
|
.flat .panel.sel .face{stroke:var(--accent,#2f6fd6);stroke-width:2}
|
|
384
421
|
.flat .conn.hot{stroke-width:3}
|
|
385
422
|
.flat .conn.dim,.flat .cl.dim{opacity:.3}
|
|
386
|
-
`;for(let[r,i]of Object.entries(t)){let o=
|
|
387
|
-
`}return s}var Sh={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function sl(t){let e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class","flat"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-10000px;top:0;width:10px;height:10px;visibility:hidden",t.appendChild(s);let r={};for(let[n,[a,m]]of Object.entries(Sh)){let p=document.createElementNS(e,"g");a&&p.setAttribute("class",a);let c=document.createElementNS(e,"text");c.setAttribute("class",m),p.appendChild(c),s.appendChild(p),r[n]=c}let i=new Map,o=((n,a)=>{let m=a+"\0"+n,p=i.get(m);return p===void 0&&(r[a].textContent=n,p=r[a].getComputedTextLength(),i.set(m,p)),p});return o.dispose=()=>s.remove(),o}var Vd=(t,e)=>t.cards.find(s=>s.id===e)?.rect??t.panels.find(s=>s.id===e)?.rect;var qs="http://www.w3.org/2000/svg";function il(t,e,s){let r=new Map((s?.links??[]).map((i,o)=>[i.id??`link-${o}`,i]));for(let i of e.routes){let o=r.get(i.id),n=o?.a??bn(i.raw.from).id,a=o?.b??bn(i.raw.to).id;for(let m of t.querySelectorAll(`[data-id="${CSS.escape(i.id)}"]`))m.setAttribute("data-a",n),m.setAttribute("data-b",a)}}var vh=(t="auto")=>t==="always"||t==="auto"&&!(typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);function Zd(t,e,s,r,i={}){let o=i.duration??600;if(!o||!vh(i.motion))return;let n=no(t,e,s,r);t.appendChild(n.svg),n.at(0);let a=0,m=!1,p,c=new Promise(u=>p=u),l=()=>{m||(m=!0,cancelAnimationFrame(a),n.svg.remove(),p())},f=performance.now(),d=u=>{if(m)return;let y=Math.min(1,(u-f)/o);n.at(y),y<1?a=requestAnimationFrame(d):l()};return a=requestAnimationFrame(d),{done:c,finish:l}}var Ss=t=>Math.max(0,Math.min(1,t)),to=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function rl(t){let e=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],r=[e,...e.querySelectorAll("*")];return s.forEach((i,o)=>{let n=getComputedStyle(i),a=r[o];a.removeAttribute("class"),a.removeAttribute("tabindex");for(let m of["fill","fill-opacity","stroke","stroke-width","stroke-dasharray","stroke-opacity","opacity","font-size","font-weight","font-family","letter-spacing","paint-order","stroke-linejoin","text-anchor"])a.style.setProperty(m,n.getPropertyValue(m))}),e}var Wc=(t,e)=>{let s=t.getBoundingClientRect();return{x:s.left-e.left,y:s.top-e.top,w:s.width,h:s.height}},Kd=t=>{let e=Math.min(...t.map(o=>o.x)),s=Math.min(...t.map(o=>o.y)),r=Math.max(...t.map(o=>o.x+o.w)),i=Math.max(...t.map(o=>o.y+o.h));return{x:e,y:s,w:r-e,h:i-s}},Mh=(t,e)=>{let s=t.getScreenCTM();return`matrix(${s.a} ${s.b} ${s.c} ${s.d} ${s.e-e.left} ${s.f-e.top})`},Gd=(t,e,s)=>{let r=1+(e.w/Math.max(t.w,1e-6)-1)*s,i=1+(e.h/Math.max(t.h,1e-6)-1)*s,o=(e.x-t.x*(e.w/Math.max(t.w,1e-6)))*s,n=(e.y-t.y*(e.h/Math.max(t.h,1e-6)))*s;return`matrix(${r} 0 0 ${i} ${o} ${n})`};function Ph(t,e){let s=t.querySelector("polygon.top");if(!s)return;let r=s.getScreenCTM(),i=[];for(let o=0;o<s.points.numberOfItems;o++){let n=s.points.getItem(o);i.push([r.a*n.x+r.c*n.y+r.e-e.left,r.b*n.x+r.d*n.y+r.f-e.top])}return i.length===4?{pts:i,fill:getComputedStyle(s).fill}:void 0}function no(t,e,s,r){let i=t.getBoundingClientRect(),o=document.createElementNS(qs,"svg");o.setAttribute("class","dual-morph"),o.setAttribute("aria-hidden","true"),o.style.cssText=`position:absolute;left:0;top:0;width:${i.width}px;height:${Math.max(i.height,e.getBoundingClientRect().height,s.getBoundingClientRect().height)}px;overflow:visible;pointer-events:none`;let n=k=>{let $=document.createElementNS(qs,"g");return $.setAttribute("transform",Mh(k,i)),$},a=k=>k.hasAttribute("data-a")||k.hasAttribute("data-for"),m=k=>{let $=new Map;for(let v of k.querySelectorAll("[data-id]")){if(a(v)||v.parentElement?.closest("[data-id]")||v.closest(".overlay"))continue;let T=v.getAttribute("data-id");($.get(T)??$.set(T,[]).get(T)).push(v)}return $},p=m(e),c=m(s),l=document.createElementNS(qs,"g"),f=document.createElementNS(qs,"g"),d=n(e),u=n(s);for(let k of e.querySelectorAll("[data-a],[data-for]"))k.closest(".overlay")||d.appendChild(rl(k));for(let k of s.querySelectorAll("[data-a],[data-for]"))k.closest(".overlay")||u.appendChild(rl(k));l.appendChild(d),f.appendChild(u);let y=[...u.querySelectorAll("path")].map(k=>{let $=k.getTotalLength?.()??0;return{p:k,len:$}}),g=[...u.children].filter(k=>k.tagName.toLowerCase()==="text"),x=[...(r==="2d"?p:c).keys()],h=[],b=document.createElementNS(qs,"g");for(let k of new Set([...x,...p.keys(),...c.keys()])){let $=p.get(k),v=c.get(k),T={};if($){T.a=Kd($.map(j=>Wc(j,i)));let A=document.createElementNS(qs,"g"),P=n(e);for(let j of $)P.appendChild(rl(j));A.appendChild(P),T.src=A}if(v){T.b=Kd(v.map(j=>Wc(j,i)));let A=document.createElementNS(qs,"g"),P=n(s);for(let j of v)P.appendChild(rl(j));A.appendChild(P),T.dst=A}let R=r==="3d"?$?.[0]:v?.[0],O=r==="3d"?v?.[0]:$?.[0],I=R?Ph(R,i):void 0,M=O?.querySelector("rect.face");if(I&&M){let A=Wc(M,i),P=[[A.x,A.y],[A.x+A.w,A.y],[A.x+A.w,A.y+A.h],[A.x,A.y+A.h]],j=I.pts.reduce((C,G,Z)=>G[0]<I.pts[C][0]?Z:C,0),F=[...I.pts.slice(j),...I.pts.slice(0,j)],Y=[F[0],F[1],F[2],F[3]],J=getComputedStyle(M).fill,U=document.createElementNS(qs,"polygon");T.face=U,T.faceFrom=r==="3d"?Y:P,T.faceTo=r==="3d"?P:Y,T.faceFill=r==="3d"?[I.fill,J]:[J,I.fill]}T.src&&b.appendChild(T.src),T.face&&b.appendChild(T.face),T.dst&&b.appendChild(T.dst),h.push(T)}o.append(l,b,f);let w=(k,$,v)=>`color-mix(in srgb, ${k} ${Math.round((1-v)*100)}%, ${$})`;return{svg:o,at(k){let $=Ss(k/.2),v=to(Ss((k-.2)/.6)),T=Ss((k-.8)/.2);l.setAttribute("opacity",String(1-$));for(let{p:R,len:O}of y)R.style.strokeDasharray=`${O} ${O}`,R.style.strokeDashoffset=String(O*(1-T));f.setAttribute("opacity",String(T>0?1:0));for(let R of g)R.style.opacity=String(T);for(let R of h)if(R.src&&(R.src.setAttribute("transform",R.a&&R.b?Gd(R.a,R.b,v):""),R.src.setAttribute("opacity",String(R.b?1-Ss(v/(R.face?.35:.6)):1-v))),R.dst&&(R.dst.setAttribute("transform",R.a&&R.b?Gd(R.b,R.a,1-v):""),R.dst.setAttribute("opacity",String(R.a?Ss((v-(R.face?.65:.4))/(R.face?.35:.6)):v))),R.face){let O=R.faceFrom.map((I,M)=>[I[0]+(R.faceTo[M][0]-I[0])*v,I[1]+(R.faceTo[M][1]-I[1])*v]);R.face.setAttribute("points",O.map(I=>I.join(",")).join(" ")),R.face.style.fill=w(R.faceFill[0],R.faceFill[1],v),R.face.setAttribute("opacity",String(v<.08?v/.08:v>.92?(1-v)/.08:1))}}}}var Oh=0;function Ud(t,e,s={}){let r=`dv${++Oh}`,i=document.createElement("div");i.className="dual-view",i.style.position="relative",t.appendChild(i);let o=document.createElement("div"),n=document.createElement("div");o.className="dual-3d",n.className="dual-2d",i.append(o,n),o.innerHTML=e.rendered.svg;let a=o.querySelector("svg");a.setAttribute("data-view","3d");let m=s.board??_a(e);il(a,e,m);let p=new Set(e.routes.map(O=>O.id));for(let O of a.querySelectorAll("g[data-id]")){let I=O.getAttribute("data-id");p.has(I)||O.hasAttribute("tabindex")||!O.querySelector("polygon")||(O.setAttribute("tabindex","0"),O.setAttribute("role","button"),O.setAttribute("aria-label",I))}let c=sl(n),l=Kr(m,c,s.flat);c.dispose(),n.innerHTML=nl(l,{id:r,title:s.title,styles:s.styles});let f=n.querySelector("svg");for(let O of[a,f])O.style.display="block",O.style.width="100%",O.style.height="auto";s.title&&a.setAttribute("aria-label",s.title);let d=s.mode??"3d",u,y=O=>O==="3d"?o:n,g=O=>O==="3d"?a:f,x=O=>{o.hidden=O!=="3d",n.hidden=O!=="2d";for(let I of[o,n])I.style.cssText="";i.style.height="",i.dataset.mode=O};x(d);let h=()=>{for(let O of[a,f]){for(let I of O.querySelectorAll("[data-id]"))I.classList.toggle("sel",!!u&&I.getAttribute("data-id")===u);for(let I of O.querySelectorAll("[data-a]")){let M=!!u&&(I.getAttribute("data-a")===u||I.getAttribute("data-b")===u);I.classList.toggle("hot",M),I.classList.toggle("dim",!!u&&!M),O.querySelector(`[data-for="${CSS.escape(I.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!u&&!M)}}},b=O=>{u=O,h()},w=O=>{let I=O.target.closest?.("[data-id]");if(!I||!i.contains(I)||I.hasAttribute("data-a"))return;let M=I.getAttribute("data-id");b(M),s.onSelect?.(M)},k=O=>{(O.key==="Enter"||O.key===" ")&&O.target.matches?.("[data-id][tabindex]")&&(O.preventDefault(),w(O))};i.addEventListener("click",w),i.addEventListener("keydown",k);let $,v=()=>{if(!$)return;cancelAnimationFrame($.frame),$.layer.remove();let O=$;$=void 0,d=O.to,x(d),h(),O.done()},T=O=>{!O||!u||g(d).querySelector(`[data-id="${CSS.escape(u)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return $?$.to:d},layout:l,root:i,morph:O=>{let I=i.contains(document.activeElement);if($&&v(),O===d)return T(I),Promise.resolve();let M=s.motion??"auto";return M==="never"||M==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(s.duration??600)?(d=O,x(d),h(),T(I),Promise.resolve()):new Promise(P=>{let j=d,F=i.getBoundingClientRect().height;o.hidden=!1,n.hidden=!1;for(let Q of[o,n])Q.style.cssText="position:absolute;left:0;top:0;right:0;visibility:hidden";let Y=y(O).getBoundingClientRect().height;i.style.height=`${F}px`;let J=no(i,g(j),g(O),j);i.appendChild(J.svg);let U=s.duration??600,C=performance.now(),G={frame:0,layer:J.svg,to:O,done:()=>{T(I),P()}},Z=Q=>{if($!==G)return;let z=Math.min(1,(Q-C)/U);J.at(z),i.style.height=`${F+(Y-F)*to(Ss((z-.2)/.6))}px`,z<1?G.frame=requestAnimationFrame(Z):v()};$=G,G.frame=requestAnimationFrame(Z)})},select:b,get selected(){return u},svgOf:g,destroy(){$&&v(),i.removeEventListener("click",w),i.removeEventListener("keydown",k),i.remove()}}}function Yd(t="iso-view"){try{let e=localStorage.getItem(t);return e==="2d"||e==="3d"?e:void 0}catch{return}}function Hd(t,e,s={}){let r=s.storageKey??"iso-view",i=Array.isArray(e)?e:[e],o=document.createElement("div");o.className="view-switch",o.setAttribute("role","group"),o.setAttribute("aria-label","Drawing view");let n=["3d","2d"].map((m,p)=>{let c=document.createElement("button");return c.type="button",c.dataset.mode=m,c.textContent=(s.labels??["3D","2D"])[p],c.addEventListener("click",()=>{try{localStorage.setItem(r,m)}catch{}a(m);for(let l of i)l.morph(m)}),o.appendChild(c),c}),a=m=>n.forEach(p=>p.setAttribute("aria-pressed",String(p.dataset.mode===m)));return a(i[0]?.mode??"3d"),t.appendChild(o),o}var Wd=`
|
|
423
|
+
`;for(let[r,i]of Object.entries(t)){let o=ym(r),n=e(i.color);s+=`.flat .conn.k-${o}{stroke:${n}${i.dash?`;stroke-dasharray:${i.dash}`:""}${i.width?`;stroke-width:${i.width}`:""}} .flat .mk.k-${o}{fill:${n}} .flat .cl.k-${o}{fill:${n}}
|
|
424
|
+
`}return s}var yy={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function kl(t){let e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class","flat"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-10000px;top:0;width:10px;height:10px;visibility:hidden",t.appendChild(s);let r={};for(let[n,[a,f]]of Object.entries(yy)){let p=document.createElementNS(e,"g");a&&p.setAttribute("class",a);let c=document.createElementNS(e,"text");c.setAttribute("class",f),p.appendChild(c),s.appendChild(p),r[n]=c}let i=new Map,o=((n,a)=>{let f=a+"\0"+n,p=i.get(f);return p===void 0&&(r[a].textContent=n,p=r[a].getComputedTextLength(),i.set(f,p)),p});return o.dispose=()=>s.remove(),o}var bm=(t,e)=>t.cards.find(s=>s.id===e)?.rect??t.panels.find(s=>s.id===e)?.rect;var Gs="http://www.w3.org/2000/svg";function Sl(t,e,s){let r=new Map((s?.links??[]).map((i,o)=>[i.id??`link-${o}`,i]));for(let i of e.routes){let o=r.get(i.id),n=o?.a??wn(i.raw.from).id,a=o?.b??wn(i.raw.to).id;for(let f of t.querySelectorAll(`[data-id="${CSS.escape(i.id)}"]`))f.setAttribute("data-a",n),f.setAttribute("data-b",a)}}var gy=(t="auto")=>t==="always"||t==="auto"&&!(typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);function km(t,e,s,r,i={}){let o=i.duration??600;if(!o||!gy(i.motion))return;let n=lo(t,e,s,r);t.appendChild(n.svg),n.at(0);let a=0,f=!1,p,c=new Promise(h=>p=h),l=()=>{f||(f=!0,cancelAnimationFrame(a),n.svg.remove(),p())},d=performance.now(),m=h=>{if(f)return;let y=Math.min(1,(h-d)/o);n.at(y),y<1?a=requestAnimationFrame(m):l()};return a=requestAnimationFrame(m),{done:c,finish:l}}var Ps=t=>Math.max(0,Math.min(1,t)),ao=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function $l(t){let e=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],r=[e,...e.querySelectorAll("*")];return s.forEach((i,o)=>{let n=getComputedStyle(i),a=r[o];a.removeAttribute("class"),a.removeAttribute("tabindex");for(let f of["fill","fill-opacity","stroke","stroke-width","stroke-dasharray","stroke-opacity","opacity","font-size","font-weight","font-family","letter-spacing","paint-order","stroke-linejoin","text-anchor"])a.style.setProperty(f,n.getPropertyValue(f))}),e}var xp=(t,e)=>{let s=t.getBoundingClientRect();return{x:s.left-e.left,y:s.top-e.top,w:s.width,h:s.height}},wm=t=>{let e=Math.min(...t.map(o=>o.x)),s=Math.min(...t.map(o=>o.y)),r=Math.max(...t.map(o=>o.x+o.w)),i=Math.max(...t.map(o=>o.y+o.h));return{x:e,y:s,w:r-e,h:i-s}},by=(t,e)=>{let s=t.getScreenCTM();return`matrix(${s.a} ${s.b} ${s.c} ${s.d} ${s.e-e.left} ${s.f-e.top})`},xm=(t,e,s)=>{let r=1+(e.w/Math.max(t.w,1e-6)-1)*s,i=1+(e.h/Math.max(t.h,1e-6)-1)*s,o=(e.x-t.x*(e.w/Math.max(t.w,1e-6)))*s,n=(e.y-t.y*(e.h/Math.max(t.h,1e-6)))*s;return`matrix(${r} 0 0 ${i} ${o} ${n})`};function wy(t,e){let s=t.querySelector("polygon.top");if(!s)return;let r=s.getScreenCTM(),i=[];for(let o=0;o<s.points.numberOfItems;o++){let n=s.points.getItem(o);i.push([r.a*n.x+r.c*n.y+r.e-e.left,r.b*n.x+r.d*n.y+r.f-e.top])}return i.length===4?{pts:i,fill:getComputedStyle(s).fill}:void 0}function lo(t,e,s,r){let i=t.getBoundingClientRect(),o=document.createElementNS(Gs,"svg");o.setAttribute("class","dual-morph"),o.setAttribute("aria-hidden","true"),o.style.cssText=`position:absolute;left:0;top:0;width:${i.width}px;height:${Math.max(i.height,e.getBoundingClientRect().height,s.getBoundingClientRect().height)}px;overflow:visible;pointer-events:none`;let n=w=>{let $=document.createElementNS(Gs,"g");return $.setAttribute("transform",by(w,i)),$},a=w=>w.hasAttribute("data-a")||w.hasAttribute("data-for"),f=w=>{let $=new Map;for(let v of w.querySelectorAll("[data-id]")){if(a(v)||v.parentElement?.closest("[data-id]")||v.closest(".overlay"))continue;let O=v.getAttribute("data-id");($.get(O)??$.set(O,[]).get(O)).push(v)}return $},p=f(e),c=f(s),l=document.createElementNS(Gs,"g"),d=document.createElementNS(Gs,"g"),m=n(e),h=n(s);for(let w of e.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||m.appendChild($l(w));for(let w of s.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||h.appendChild($l(w));l.appendChild(m),d.appendChild(h);let y=[...h.querySelectorAll("path")].map(w=>{let $=w.getTotalLength?.()??0;return{p:w,len:$}}),g=[...h.children].filter(w=>w.tagName.toLowerCase()==="text"),k=[...(r==="2d"?p:c).keys()],u=[],b=document.createElementNS(Gs,"g");for(let w of new Set([...k,...p.keys(),...c.keys()])){let $=p.get(w),v=c.get(w),O={};if($){O.a=wm($.map(N=>xp(N,i)));let T=document.createElementNS(Gs,"g"),S=n(e);for(let N of $)S.appendChild($l(N));T.appendChild(S),O.src=T}if(v){O.b=wm(v.map(N=>xp(N,i)));let T=document.createElementNS(Gs,"g"),S=n(s);for(let N of v)S.appendChild($l(N));T.appendChild(S),O.dst=T}let C=r==="3d"?$?.[0]:v?.[0],A=r==="3d"?v?.[0]:$?.[0],R=C?wy(C,i):void 0,M=A?.querySelector("rect.face");if(R&&M){let T=xp(M,i),S=[[T.x,T.y],[T.x+T.w,T.y],[T.x+T.w,T.y+T.h],[T.x,T.y+T.h]],N=R.pts.reduce((L,U,H)=>U[0]<R.pts[L][0]?H:L,0),z=[...R.pts.slice(N),...R.pts.slice(0,N)],K=[z[0],z[1],z[2],z[3]],J=getComputedStyle(M).fill,Z=document.createElementNS(Gs,"polygon");O.face=Z,O.faceFrom=r==="3d"?K:S,O.faceTo=r==="3d"?S:K,O.faceFill=r==="3d"?[R.fill,J]:[J,R.fill]}O.src&&b.appendChild(O.src),O.face&&b.appendChild(O.face),O.dst&&b.appendChild(O.dst),u.push(O)}o.append(l,b,d);let x=(w,$,v)=>`color-mix(in srgb, ${w} ${Math.round((1-v)*100)}%, ${$})`;return{svg:o,at(w){let $=Ps(w/.2),v=ao(Ps((w-.2)/.6)),O=Ps((w-.8)/.2);l.setAttribute("opacity",String(1-$));for(let{p:C,len:A}of y)C.style.strokeDasharray=`${A} ${A}`,C.style.strokeDashoffset=String(A*(1-O));d.setAttribute("opacity",String(O>0?1:0));for(let C of g)C.style.opacity=String(O);for(let C of u)if(C.src&&(C.src.setAttribute("transform",C.a&&C.b?xm(C.a,C.b,v):""),C.src.setAttribute("opacity",String(C.b?1-Ps(v/(C.face?.35:.6)):1-v))),C.dst&&(C.dst.setAttribute("transform",C.a&&C.b?xm(C.b,C.a,1-v):""),C.dst.setAttribute("opacity",String(C.a?Ps((v-(C.face?.65:.4))/(C.face?.35:.6)):v))),C.face){let A=C.faceFrom.map((R,M)=>[R[0]+(C.faceTo[M][0]-R[0])*v,R[1]+(C.faceTo[M][1]-R[1])*v]);C.face.setAttribute("points",A.map(R=>R.join(",")).join(" ")),C.face.style.fill=x(C.faceFill[0],C.faceFill[1],v),C.face.setAttribute("opacity",String(v<.08?v/.08:v>.92?(1-v)/.08:1))}}}}var xy=0;function $m(t,e,s={}){let r=`dv${++xy}`,i=document.createElement("div");i.className="dual-view",i.style.position="relative",t.appendChild(i);let o=document.createElement("div"),n=document.createElement("div");o.className="dual-3d",n.className="dual-2d",i.append(o,n),o.innerHTML=e.rendered.svg;let a=o.querySelector("svg");a.setAttribute("data-view","3d");let f=s.board??Qa(e);Sl(a,e,f);let p=new Set(e.routes.map(A=>A.id));for(let A of a.querySelectorAll("g[data-id]")){let R=A.getAttribute("data-id");p.has(R)||A.hasAttribute("tabindex")||!A.querySelector("polygon")||(A.setAttribute("tabindex","0"),A.setAttribute("role","button"),A.setAttribute("aria-label",R))}let c=kl(n),l=Hr(f,c,s.flat);c.dispose(),n.innerHTML=xl(l,{id:r,title:s.title,styles:s.styles});let d=n.querySelector("svg");for(let A of[a,d])A.style.display="block",A.style.width="100%",A.style.height="auto";s.title&&a.setAttribute("aria-label",s.title);let m=s.mode??"3d",h,y=A=>A==="3d"?o:n,g=A=>A==="3d"?a:d,k=A=>{o.hidden=A!=="3d",n.hidden=A!=="2d";for(let R of[o,n])R.style.cssText="";i.style.height="",i.dataset.mode=A};k(m);let u=()=>{for(let A of[a,d]){for(let R of A.querySelectorAll("[data-id]"))R.classList.toggle("sel",!!h&&R.getAttribute("data-id")===h);for(let R of A.querySelectorAll("[data-a]")){let M=!!h&&(R.getAttribute("data-a")===h||R.getAttribute("data-b")===h);R.classList.toggle("hot",M),R.classList.toggle("dim",!!h&&!M),A.querySelector(`[data-for="${CSS.escape(R.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!h&&!M)}}},b=A=>{h=A,u()},x=A=>{let R=A.target.closest?.("[data-id]");if(!R||!i.contains(R)||R.hasAttribute("data-a"))return;let M=R.getAttribute("data-id");b(M),s.onSelect?.(M)},w=A=>{(A.key==="Enter"||A.key===" ")&&A.target.matches?.("[data-id][tabindex]")&&(A.preventDefault(),x(A))};i.addEventListener("click",x),i.addEventListener("keydown",w);let $,v=()=>{if(!$)return;cancelAnimationFrame($.frame),$.layer.remove();let A=$;$=void 0,m=A.to,k(m),u(),A.done()},O=A=>{!A||!h||g(m).querySelector(`[data-id="${CSS.escape(h)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return $?$.to:m},layout:l,root:i,morph:A=>{let R=i.contains(document.activeElement);if($&&v(),A===m)return O(R),Promise.resolve();let M=s.motion??"auto";return M==="never"||M==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(s.duration??600)?(m=A,k(m),u(),O(R),Promise.resolve()):new Promise(S=>{let N=m,z=i.getBoundingClientRect().height;o.hidden=!1,n.hidden=!1;for(let ee of[o,n])ee.style.cssText="position:absolute;left:0;top:0;right:0;visibility:hidden";let K=y(A).getBoundingClientRect().height;i.style.height=`${z}px`;let J=lo(i,g(N),g(A),N);i.appendChild(J.svg);let Z=s.duration??600,L=performance.now(),U={frame:0,layer:J.svg,to:A,done:()=>{O(R),S()}},H=ee=>{if($!==U)return;let j=Math.min(1,(ee-L)/Z);J.at(j),i.style.height=`${z+(K-z)*ao(Ps((j-.2)/.6))}px`,j<1?U.frame=requestAnimationFrame(H):v()};$=U,U.frame=requestAnimationFrame(H)})},select:b,get selected(){return h},svgOf:g,destroy(){$&&v(),i.removeEventListener("click",x),i.removeEventListener("keydown",w),i.remove()}}}function Sm(t="iso-view"){try{let e=localStorage.getItem(t);return e==="2d"||e==="3d"?e:void 0}catch{return}}function vm(t,e,s={}){let r=s.storageKey??"iso-view",i=Array.isArray(e)?e:[e],o=document.createElement("div");o.className="view-switch",o.setAttribute("role","group"),o.setAttribute("aria-label","Drawing view");let n=["3d","2d"].map((f,p)=>{let c=document.createElement("button");return c.type="button",c.dataset.mode=f,c.textContent=(s.labels??["3D","2D"])[p],c.addEventListener("click",()=>{try{localStorage.setItem(r,f)}catch{}a(f);for(let l of i)l.morph(f)}),o.appendChild(c),c}),a=f=>n.forEach(p=>p.setAttribute("aria-pressed",String(p.dataset.mode===f)));return a(i[0]?.mode??"3d"),t.appendChild(o),o}var Mm=`
|
|
388
425
|
.view-switch{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface);font:600 12px/1 system-ui,sans-serif;box-shadow:0 1px 4px rgba(0,0,0,.12)}
|
|
389
426
|
.view-switch button{font:inherit;border:0;background:none;color:var(--ink);padding:6px 10px;cursor:pointer}
|
|
390
427
|
.view-switch button+button{border-left:1px solid var(--line)}
|
|
@@ -394,7 +431,7 @@ ${e.extraBody??""}
|
|
|
394
431
|
.dual-view .blk.sel polygon{stroke:var(--accent,#2f6fd6);stroke-width:2.4}
|
|
395
432
|
.dual-view [data-a].dim{opacity:.3}
|
|
396
433
|
.dual-view [data-a].hot path{stroke-width:3.4}
|
|
397
|
-
`;var
|
|
398
|
-
`},vm:{shape:"block",pad:.6,z:[0,.45],floor:!0,role:"sandbox",labelStyle:"face",legend:{label:"Sandbox VM",swatch:"border-color:hsl(170 35% 40%);background:hsl(170 40% 50% / .2)",box:!0,auto:!0}},platform:{shape:"block",pad:.6,z:[0,.7],floor:!0,role:"server",labelStyle:"face-right"},cloud:{shape:"cloud",pad:.8,z:[0,.2],floor:!0,role:"cloud",labelStyle:"floor"},zone:{shape:"zone",pad:.5,z:[0,.005],floor:!1,role:"grey",labelStyle:"floor"},tunnel:{shape:"tunnel",pad:0,z:[0,.8],floor:!1,role:"socket",labelStyle:"none",legend:{label:"Tailscale tunnel",swatch:"border-color:hsl(205 70% 50%);border-top-width:9px;opacity:.35",box:!1,auto:!1}}},Xn={regions:Jc,nodes:so,defaultNode:"block"};var Qd=nr(Xn),em=Vr(Xn);var nm=al,ot={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}},Lt={type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},zn={type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},Rt={type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},ro=Object.prototype.hasOwnProperty,Me={type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},Ne={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},It=new RegExp("^[A-Za-z][A-Za-z0-9_-]*$","u"),_e={type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},hn={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},Xc={enum:["n","e","s","w"]},Ze={type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},tm={properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Mt={type:"array",items:{type:"number"},minItems:2,maxItems:2},Qc={enum:["start","center","end"]},He={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function Ms(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Ms.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.in!==void 0){let l=t.in;if(typeof l=="string"){if(!It.test(l)){let f={instancePath:e+"/in",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/in",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}if(t.at!==void 0){let l=t.at;if(Array.isArray(l)){if(l.length>2){let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}if(l.length<2){let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}let f=l.length;for(let d=0;d<f;d++){let u=l[d];if(typeof u!="number"){let y={instancePath:e+"/at/"+d,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:u};n===null?n=[y]:n.push(y),a++}}}else{let f={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:l};n===null?n=[f]:n.push(f),a++}}if(t["right-of"]!==void 0){let l=t["right-of"];if(typeof l=="string"){if(!It.test(l)){let f={instancePath:e+"/right-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/right-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}if(t["left-of"]!==void 0){let l=t["left-of"];if(typeof l=="string"){if(!It.test(l)){let f={instancePath:e+"/left-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/left-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}if(t.below!==void 0){let l=t.below;if(typeof l=="string"){if(!It.test(l)){let f={instancePath:e+"/below",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/below",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}if(t.behind!==void 0){let l=t.behind;if(typeof l=="string"){if(!It.test(l)){let f={instancePath:e+"/behind",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/behind",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l!="number"){let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:tm.properties.gap.type,parentSchema:tm.properties.gap,data:l};n===null?n=[f]:n.push(f),a++}}if(t.align!==void 0){let l=t.align;if(!(l==="start"||l==="center"||l==="end")){let f={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:Qc.enum},message:"must be equal to one of the allowed values",schema:Qc.enum,parentSchema:Qc,data:l};n===null?n=[f]:n.push(f),a++}}if(t.shift!==void 0){let l=t.shift;if(Array.isArray(l)){if(l.length>2){let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}if(l.length<2){let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}let f=l.length;for(let d=0;d<f;d++){let u=l[d];if(typeof u!="number"){let y={instancePath:e+"/shift/"+d,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:u};n===null?n=[y]:n.push(y),a++}}}else{let f={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:l};n===null?n=[f]:n.push(f),a++}}if(t.appears!==void 0){let l=t.appears,f=a,d=!1,u=a;if(typeof l!="string"){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var p=u===a;d=d||p;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var p=y===a;if(d=d||p,d)a=f,n!==null&&(f?n.length=f:n=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:l};n===null?n=[g]:n.push(g),a++}}if(t.disappears!==void 0){let l=t.disappears,f=a,d=!1,u=a;if(typeof l!="string"){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var c=u===a;d=d||c;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var c=y===a;if(d=d||c,d)a=f,n!==null&&(f?n.length=f:n=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:l};n===null?n=[g]:n.push(g),a++}}}return Ms.errors=n,a===0}Ms.evaluated={props:{in:!0,at:!0,"right-of":!0,"left-of":!0,below:!0,behind:!0,gap:!0,align:!0,shift:!0,appears:!0,disappears:!0},dynamicProps:!1,dynamicItems:!1};var Nt={type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},Xe={anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},Wr=new RegExp("^[a-z][a-z0-9-]*$","u");function Ps(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Ps.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1){let l={instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t){let f=a;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l,propertyName:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l,propertyName:l};n===null?n=[d]:n.push(d),a++}var p=f===a;if(!p){let d={instancePath:e,schemaPath:"#/propertyNames",keyword:"propertyNames",params:{propertyName:l},message:"property name must be valid",schema:Nt.propertyNames,parentSchema:Nt,data:t};n===null?n=[d]:n.push(d),a++}}for(let l in t){let f=t[l];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Object.keys(f).length<1){let d={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt.additionalProperties,data:f};n===null?n=[d]:n.push(d),a++}for(let d in f)if(!(d==="role"||d==="ghost"||d==="label"||d==="sub"||d==="face"||d==="deco")){let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Nt.additionalProperties,data:f};n===null?n=[u]:n.push(u),a++}if(f.role!==void 0){let d=f.role;if(typeof d!="string"){let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/role",schemaPath:"#/additionalProperties/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.role.type,parentSchema:Nt.additionalProperties.properties.role,data:d};n===null?n=[u]:n.push(u),a++}}if(f.ghost!==void 0){let d=f.ghost;if(typeof d!="boolean"){let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/ghost",schemaPath:"#/additionalProperties/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Nt.additionalProperties.properties.ghost.type,parentSchema:Nt.additionalProperties.properties.ghost,data:d};n===null?n=[u]:n.push(u),a++}}if(f.label!==void 0){let d=f.label;if(typeof d!="string"){let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/label",schemaPath:"#/additionalProperties/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.label.type,parentSchema:Nt.additionalProperties.properties.label,data:d};n===null?n=[u]:n.push(u),a++}}if(f.sub!==void 0){let d=f.sub;if(typeof d!="string"){let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/sub",schemaPath:"#/additionalProperties/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.sub.type,parentSchema:Nt.additionalProperties.properties.sub,data:d};n===null?n=[u]:n.push(u),a++}}if(f.face!==void 0){let d=f.face;if(typeof d=="string"){if(!Wr.test(d)){let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Nt.additionalProperties.properties.face,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.face.type,parentSchema:Nt.additionalProperties.properties.face,data:d};n===null?n=[u]:n.push(u),a++}}if(f.deco!==void 0){let d=f.deco;if(Array.isArray(d)){let u=d.length;for(let y=0;y<u;y++){let g=d[y],x=a,h=!1,b=a;if(!(g==="envelope"||g==="bubble"||g==="file-lines"||g==="ghost"||g==="terminal")){let k={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Xe.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Xe.anyOf[0].enum,parentSchema:Xe.anyOf[0],data:g};n===null?n=[k]:n.push(k),a++}var c=b===a;h=h||c;let w=a;if(g&&typeof g=="object"&&!Array.isArray(g)){if(Object.keys(g).length>1){let k={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Xe.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}if(Object.keys(g).length<1){let k={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Xe.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}for(let k in g)if(!(k==="terminal"||k==="icon"||k==="screen")){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties",schema:!1,parentSchema:Xe.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.terminal!==void 0){let k=g.terminal;if(!(typeof k=="number"&&!(k%1)&&!isNaN(k))){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Xe.anyOf[1].properties.terminal.type,parentSchema:Xe.anyOf[1].properties.terminal,data:k};n===null?n=[$]:n.push($),a++}if(typeof k=="number"){if(k>8||isNaN(k)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Xe.anyOf[1].properties.terminal,data:k};n===null?n=[$]:n.push($),a++}if(k<1||isNaN(k)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Xe.anyOf[1].properties.terminal,data:k};n===null?n=[$]:n.push($),a++}}}if(g.icon!==void 0){let k=g.icon;if(typeof k=="string"){if(!Wr.test(k)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Xe.anyOf[1].properties.icon,data:k};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.anyOf[1].properties.icon.type,parentSchema:Xe.anyOf[1].properties.icon,data:k};n===null?n=[$]:n.push($),a++}}if(g.screen!==void 0){let k=g.screen;if(typeof k=="string"){if(!Wr.test(k)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Xe.anyOf[1].properties.screen,data:k};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.anyOf[1].properties.screen.type,parentSchema:Xe.anyOf[1].properties.screen,data:k};n===null?n=[$]:n.push($),a++}}}else{let k={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Xe.anyOf[1].type,parentSchema:Xe.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}var c=w===a;if(h=h||c,h)a=x,n!==null&&(x?n.length=x:n=null);else{let k={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Xe.anyOf,parentSchema:Xe,data:g};n===null?n=[k]:n.push(k),a++}}}else{let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco",schemaPath:"#/additionalProperties/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Nt.additionalProperties.properties.deco.type,parentSchema:Nt.additionalProperties.properties.deco,data:d};n===null?n=[u]:n.push(u),a++}}}else{let d={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.additionalProperties.type,parentSchema:Nt.additionalProperties,data:f};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.type,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}return Ps.errors=n,a===0}Ps.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var et={type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},ep={validate:us};function us(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=us.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),Ms(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?Ms.errors:n.concat(Ms.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:et.required,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}if(t.id!==void 0){let c=t.id;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}if(t.asset!==void 0){let c=t.asset;if(typeof c!="string"){let l={instancePath:e+"/asset",schemaPath:"#/properties/asset/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.asset.type,parentSchema:et.properties.asset,data:c};n===null?n=[l]:n.push(l),a++}}if(t.role!==void 0){let c=t.role;if(typeof c!="string"){let l={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.role.type,parentSchema:et.properties.role,data:c};n===null?n=[l]:n.push(l),a++}}if(t.label!==void 0){let c=t.label;if(typeof c!="string"){let l={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.label.type,parentSchema:et.properties.label,data:c};n===null?n=[l]:n.push(l),a++}}if(t.sub!==void 0){let c=t.sub;if(typeof c!="string"){let l={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.sub.type,parentSchema:et.properties.sub,data:c};n===null?n=[l]:n.push(l),a++}}if(t.size!==void 0){let c=t.size;if(Array.isArray(c)){if(c.length>3){let f={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:hn,data:c};n===null?n=[f]:n.push(f),a++}if(c.length<2){let f={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:hn,data:c};n===null?n=[f]:n.push(f),a++}let l=c.length;for(let f=0;f<l;f++){let d=c[f];if(typeof d=="number"){if(d<=0||isNaN(d)){let u={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:hn.items,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:hn.items.type,parentSchema:hn.items,data:d};n===null?n=[u]:n.push(u),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:hn.type,parentSchema:hn,data:c};n===null?n=[l]:n.push(l),a++}}if(t.z!==void 0){let c=t.z;if(typeof c!="number"){let l={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.z.type,parentSchema:et.properties.z,data:c};n===null?n=[l]:n.push(l),a++}}if(t.deco!==void 0){let c=t.deco;if(Array.isArray(c)){let l=c.length;for(let f=0;f<l;f++){let d=c[f],u=a,y=!1,g=a;if(!(d==="envelope"||d==="bubble"||d==="file-lines"||d==="ghost"||d==="terminal")){let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Xe.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Xe.anyOf[0].enum,parentSchema:Xe.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var p=g===a;y=y||p;let x=a;if(d&&typeof d=="object"&&!Array.isArray(d)){if(Object.keys(d).length>1){let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Xe.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(Object.keys(d).length<1){let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Xe.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}for(let h in d)if(!(h==="terminal"||h==="icon"||h==="screen")){let b={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h},message:"must NOT have additional properties",schema:!1,parentSchema:Xe.anyOf[1],data:d};n===null?n=[b]:n.push(b),a++}if(d.terminal!==void 0){let h=d.terminal;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h))){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Xe.anyOf[1].properties.terminal.type,parentSchema:Xe.anyOf[1].properties.terminal,data:h};n===null?n=[b]:n.push(b),a++}if(typeof h=="number"){if(h>8||isNaN(h)){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Xe.anyOf[1].properties.terminal,data:h};n===null?n=[b]:n.push(b),a++}if(h<1||isNaN(h)){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Xe.anyOf[1].properties.terminal,data:h};n===null?n=[b]:n.push(b),a++}}}if(d.icon!==void 0){let h=d.icon;if(typeof h=="string"){if(!Wr.test(h)){let b={instancePath:e+"/deco/"+f+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Xe.anyOf[1].properties.icon,data:h};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+f+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.anyOf[1].properties.icon.type,parentSchema:Xe.anyOf[1].properties.icon,data:h};n===null?n=[b]:n.push(b),a++}}if(d.screen!==void 0){let h=d.screen;if(typeof h=="string"){if(!Wr.test(h)){let b={instancePath:e+"/deco/"+f+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Xe.anyOf[1].properties.screen,data:h};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+f+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.anyOf[1].properties.screen.type,parentSchema:Xe.anyOf[1].properties.screen,data:h};n===null?n=[b]:n.push(b),a++}}}else{let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Xe.anyOf[1].type,parentSchema:Xe.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var p=x===a;if(y=y||p,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Xe.anyOf,parentSchema:Xe,data:d};n===null?n=[h]:n.push(h),a++}}}else{let l={instancePath:e+"/deco",schemaPath:"#/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.deco.type,parentSchema:et.properties.deco,data:c};n===null?n=[l]:n.push(l),a++}}if(t.ghost!==void 0){let c=t.ghost;if(typeof c!="boolean"){let l={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:et.properties.ghost.type,parentSchema:et.properties.ghost,data:c};n===null?n=[l]:n.push(l),a++}}if(t.face!==void 0){let c=t.face;if(typeof c=="string"){if(!Wr.test(c)){let l={instancePath:e+"/face",schemaPath:"#/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.face.type,parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}if(t.facing!==void 0){let c=t.facing;if(typeof c!="number"){let l={instancePath:e+"/facing",schemaPath:"#/properties/facing/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.facing.type,parentSchema:et.properties.facing,data:c};n===null?n=[l]:n.push(l),a++}}if(t["label-at"]!==void 0){let c=t["label-at"];if(c&&typeof c=="object"&&!Array.isArray(c)){for(let l in c)if(!(l==="side"||l==="dx"||l==="dy")){let f={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:et.properties["label-at"],data:c};n===null?n=[f]:n.push(f),a++}if(c.side!==void 0){let l=c.side;if(!(l==="above"||l==="right"||l==="left"||l==="below")){let f={instancePath:e+"/label-at/side",schemaPath:"#/properties/label-at/properties/side/enum",keyword:"enum",params:{allowedValues:et.properties["label-at"].properties.side.enum},message:"must be equal to one of the allowed values",schema:et.properties["label-at"].properties.side.enum,parentSchema:et.properties["label-at"].properties.side,data:l};n===null?n=[f]:n.push(f),a++}}if(c.dx!==void 0){let l=c.dx;if(typeof l!="number"){let f={instancePath:e+"/label-at/dx",schemaPath:"#/properties/label-at/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dx.type,parentSchema:et.properties["label-at"].properties.dx,data:l};n===null?n=[f]:n.push(f),a++}}if(c.dy!==void 0){let l=c.dy;if(typeof l!="number"){let f={instancePath:e+"/label-at/dy",schemaPath:"#/properties/label-at/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dy.type,parentSchema:et.properties["label-at"].properties.dy,data:l};n===null?n=[f]:n.push(f),a++}}}else{let l={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.properties["label-at"].type,parentSchema:et.properties["label-at"],data:c};n===null?n=[l]:n.push(l),a++}}if(t.motion!==void 0){let c=t.motion;if(c&&typeof c=="object"&&!Array.isArray(c)){if(Object.keys(c).length<1){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}for(let l in c)if(!(l==="style"||l==="out"||l==="easing"||l==="from"||l==="delay"||l==="duration")){let f={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:c};n===null?n=[f]:n.push(f),a++}if(c.style!==void 0){let l=c.style;if(!(l==="edge"||l==="drop"||l==="rise"||l==="fly"||l==="pop"||l==="scatter"||l==="build"||l==="fade")){let f={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:l};n===null?n=[f]:n.push(f),a++}}if(c.out!==void 0){let l=c.out;if(!(l==="explode"||l==="lift-off"||l==="sink"||l==="scatter"||l==="fly-out"||l==="collapse"||l==="fade"||l==="reverse")){let f={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:l};n===null?n=[f]:n.push(f),a++}}if(c.easing!==void 0){let l=c.easing;if(!(l==="linear"||l==="ease"||l==="ease-in"||l==="ease-out"||l==="settle"||l==="spring"||l==="bounce")){let f={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:l};n===null?n=[f]:n.push(f),a++}}if(c.from!==void 0){let l=c.from;if(!(l==="left"||l==="right"||l==="top"||l==="bottom")){let f={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:l};n===null?n=[f]:n.push(f),a++}}if(c.delay!==void 0){let l=c.delay;if(typeof l=="number"){if(l<0||isNaN(l)){let f={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:l};n===null?n=[f]:n.push(f),a++}}if(c.duration!==void 0){let l=c.duration;if(typeof l=="number"){if(l<=0||isNaN(l)){let f={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:l};n===null?n=[f]:n.push(f),a++}}}else{let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}}if(t.variants!==void 0&&(Ps(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ps.errors:n.concat(Ps.errors),a=n.length)),t.nodes!==void 0){let c=t.nodes;if(Array.isArray(c)){let l=c.length;for(let f=0;f<l;f++)ep.validate(c[f],{instancePath:e+"/nodes/"+f,parentData:c,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(n=n===null?ep.validate.errors:n.concat(ep.validate.errors),a=n.length)}else{let l={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.nodes.type,parentSchema:et.properties.nodes,data:c};n===null?n=[l]:n.push(l),a++}}for(let c in t)if(c!=="id"&&c!=="asset"&&c!=="role"&&c!=="label"&&c!=="sub"&&c!=="size"&&c!=="z"&&c!=="deco"&&c!=="ghost"&&c!=="face"&&c!=="facing"&&c!=="label-at"&&c!=="motion"&&c!=="variants"&&c!=="nodes"&&c!=="in"&&c!=="at"&&c!=="right-of"&&c!=="left-of"&&c!=="below"&&c!=="behind"&&c!=="gap"&&c!=="align"&&c!=="shift"&&c!=="appears"&&c!=="disappears"){let l={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:c},message:"must NOT have unevaluated properties",schema:!1,parentSchema:et,data:t};n===null?n=[l]:n.push(l),a++}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.type,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}return us.errors=n,a===0}us.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var tp={validate:lr};function lr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=lr.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),Ms(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?Ms.errors:n.concat(Ms.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:_e.required,parentSchema:_e,data:t};n===null?n=[p]:n.push(p),a++}if(t.kind===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'",schema:_e.required,parentSchema:_e,data:t};n===null?n=[p]:n.push(p),a++}if(t.id!==void 0){let p=t.id;if(typeof p=="string"){if(!It.test(p)){let c={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kind!==void 0){let p=t.kind;if(!(p==="slab"||p==="pad"||p==="fence"||p==="vm"||p==="cloud"||p==="zone"||p==="platform"||p==="tunnel")){let c={instancePath:e+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:_e.properties.kind.enum},message:"must be equal to one of the allowed values",schema:_e.properties.kind.enum,parentSchema:_e.properties.kind,data:p};n===null?n=[c]:n.push(c),a++}}if(t.label!==void 0){let p=t.label;if(typeof p!="string"){let c={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.properties.label.type,parentSchema:_e.properties.label,data:p};n===null?n=[c]:n.push(c),a++}}if(t["label-style"]!==void 0){let p=t["label-style"];if(!(p==="face"||p==="face-right"||p==="floor"||p==="none")){let c={instancePath:e+"/label-style",schemaPath:"#/properties/label-style/enum",keyword:"enum",params:{allowedValues:_e.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:_e.properties["label-style"].enum,parentSchema:_e.properties["label-style"],data:p};n===null?n=[c]:n.push(c),a++}}if(t.ghost!==void 0){let p=t.ghost;if(typeof p!="boolean"){let c={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:_e.properties.ghost.type,parentSchema:_e.properties.ghost,data:p};n===null?n=[c]:n.push(c),a++}}if(t.role!==void 0){let p=t.role;if(typeof p!="string"){let c={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.properties.role.type,parentSchema:_e.properties.role,data:p};n===null?n=[c]:n.push(c),a++}}if(t.size!==void 0){let p=t.size;if(Array.isArray(p)){if(p.length>3){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:hn,data:p};n===null?n=[l]:n.push(l),a++}if(p.length<2){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:hn,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++){let f=p[l];if(typeof f=="number"){if(f<=0||isNaN(f)){let d={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:hn.items,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:hn.items.type,parentSchema:hn.items,data:f};n===null?n=[d]:n.push(d),a++}}}else{let c={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:hn.type,parentSchema:hn,data:p};n===null?n=[c]:n.push(c),a++}}if(t.padding!==void 0){let p=t.padding;if(typeof p=="number"){if(p<0||isNaN(p)){let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:_e.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/type",keyword:"type",params:{type:"number"},message:"must be number",schema:_e.properties.padding.type,parentSchema:_e.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}if(t.height!==void 0){let p=t.height;if(typeof p=="number"){if(p<=0||isNaN(p)){let c={instancePath:e+"/height",schemaPath:"#/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:_e.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/height",schemaPath:"#/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:_e.properties.height.type,parentSchema:_e.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}if(t.z!==void 0){let p=t.z;if(typeof p!="number"){let c={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:_e.properties.z.type,parentSchema:_e.properties.z,data:p};n===null?n=[c]:n.push(c),a++}}if(t.flow!==void 0){let p=t.flow;if(!(p==="row"||p==="column")){let c={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:_e.properties.flow.enum},message:"must be equal to one of the allowed values",schema:_e.properties.flow.enum,parentSchema:_e.properties.flow,data:p};n===null?n=[c]:n.push(c),a++}}if(t.gate!==void 0){let p=t.gate;if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.side===void 0){let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/required",keyword:"required",params:{missingProperty:"side"},message:"must have required property 'side'",schema:_e.properties.gate.required,parentSchema:_e.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="side"||c==="at"||c==="width"||c==="height"||c==="node")){let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:_e.properties.gate,data:p};n===null?n=[l]:n.push(l),a++}if(p.side!==void 0){let c=p.side;if(!(c==="n"||c==="e"||c==="s"||c==="w")){let l={instancePath:e+"/gate/side",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues:Xc.enum},message:"must be equal to one of the allowed values",schema:Xc.enum,parentSchema:Xc,data:c};n===null?n=[l]:n.push(l),a++}}if(p.at!==void 0){let c=p.at;if(typeof c=="number"){if(c>1||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/maximum",keyword:"maximum",params:{comparison:"<=",limit:1},message:"must be <= 1",schema:1,parentSchema:_e.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}if(c<0||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:_e.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/type",keyword:"type",params:{type:"number"},message:"must be number",schema:_e.properties.gate.properties.at.type,parentSchema:_e.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}if(p.width!==void 0){let c=p.width;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:_e.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/type",keyword:"type",params:{type:"number"},message:"must be number",schema:_e.properties.gate.properties.width.type,parentSchema:_e.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}if(p.height!==void 0){let c=p.height;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:_e.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:_e.properties.gate.properties.height.type,parentSchema:_e.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}if(p.node!==void 0){let c=p.node;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/type",keyword:"type",params:{type:"object"},message:"must be object",schema:_e.properties.gate.type,parentSchema:_e.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}}if(t.around!==void 0){let p=t.around;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let f=p[l];if(typeof f=="string"){if(!It.test(f)){let d={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:f};n===null?n=[d]:n.push(d),a++}}}else{let c={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:_e.properties.around.type,parentSchema:_e.properties.around,data:p};n===null?n=[c]:n.push(c),a++}}if(t.regions!==void 0){let p=t.regions;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)tp.validate(p[l],{instancePath:e+"/regions/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?tp.validate.errors:n.concat(tp.validate.errors),a=n.length)}else{let c={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:_e.properties.regions.type,parentSchema:_e.properties.regions,data:p};n===null?n=[c]:n.push(c),a++}}if(t.motion!==void 0){let p=t.motion;if(p&&typeof p=="object"&&!Array.isArray(p)){if(Object.keys(p).length<1){let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="style"||c==="out"||c==="easing"||c==="from"||c==="delay"||c==="duration")){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:p};n===null?n=[l]:n.push(l),a++}if(p.style!==void 0){let c=p.style;if(!(c==="edge"||c==="drop"||c==="rise"||c==="fly"||c==="pop"||c==="scatter"||c==="build"||c==="fade")){let l={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:c};n===null?n=[l]:n.push(l),a++}}if(p.out!==void 0){let c=p.out;if(!(c==="explode"||c==="lift-off"||c==="sink"||c==="scatter"||c==="fly-out"||c==="collapse"||c==="fade"||c==="reverse")){let l={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:c};n===null?n=[l]:n.push(l),a++}}if(p.easing!==void 0){let c=p.easing;if(!(c==="linear"||c==="ease"||c==="ease-in"||c==="ease-out"||c==="settle"||c==="spring"||c==="bounce")){let l={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:c};n===null?n=[l]:n.push(l),a++}}if(p.from!==void 0){let c=p.from;if(!(c==="left"||c==="right"||c==="top"||c==="bottom")){let l={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:c};n===null?n=[l]:n.push(l),a++}}if(p.delay!==void 0){let c=p.delay;if(typeof c=="number"){if(c<0||isNaN(c)){let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}if(p.duration!==void 0){let c=p.duration;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}}if(t.variants!==void 0&&(Ps(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ps.errors:n.concat(Ps.errors),a=n.length)),t.nodes!==void 0){let p=t.nodes;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)us(p[l],{instancePath:e+"/nodes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?us.errors:n.concat(us.errors),a=n.length)}else{let c={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:_e.properties.nodes.type,parentSchema:_e.properties.nodes,data:p};n===null?n=[c]:n.push(c),a++}}for(let p in t)if(p!=="id"&&p!=="kind"&&p!=="label"&&p!=="label-style"&&p!=="ghost"&&p!=="role"&&p!=="size"&&p!=="padding"&&p!=="height"&&p!=="z"&&p!=="flow"&&p!=="gate"&&p!=="around"&&p!=="regions"&&p!=="motion"&&p!=="variants"&&p!=="nodes"&&p!=="in"&&p!=="at"&&p!=="right-of"&&p!=="left-of"&&p!=="below"&&p!=="behind"&&p!=="gap"&&p!=="align"&&p!=="shift"&&p!=="appears"&&p!=="disappears"){let c={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:p},message:"must NOT have unevaluated properties",schema:!1,parentSchema:_e,data:t};n===null?n=[c]:n.push(c),a++}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:_e.type,parentSchema:_e,data:t};n===null?n=[p]:n.push(p),a++}return lr.errors=n,a===0}lr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var je={type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},vs={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},np=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function Jr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Jr.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:je.required,parentSchema:je,data:t};n===null?n=[d]:n.push(d),a++}if(t.from===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'",schema:je.required,parentSchema:je,data:t};n===null?n=[d]:n.push(d),a++}if(t.to===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'",schema:je.required,parentSchema:je,data:t};n===null?n=[d]:n.push(d),a++}for(let d in t)if(!ro.call(je.properties,d)){let u={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:je,data:t};n===null?n=[u]:n.push(u),a++}if(t.id!==void 0){let d=t.id;if(typeof d=="string"){if(!It.test(d)){let u={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:d};n===null?n=[u]:n.push(u),a++}}if(t.from!==void 0){let d=t.from;if(typeof d=="string"){if(!np.test(d)){let u={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:vs,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:vs.type,parentSchema:vs,data:d};n===null?n=[u]:n.push(u),a++}}if(t.to!==void 0){let d=t.to;if(typeof d=="string"){if(!np.test(d)){let u={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:vs,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:vs.type,parentSchema:vs,data:d};n===null?n=[u]:n.push(u),a++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let u={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.kind.type,parentSchema:je.properties.kind,data:d};n===null?n=[u]:n.push(u),a++}}if(t.via!==void 0){let d=t.via;if(Array.isArray(d)){let u=d.length;for(let y=0;y<u;y++){let g=d[y],x=a,h=!1,b=a;if(Array.isArray(g)){if(g.length>2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Mt,data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Mt,data:g};n===null?n=[$]:n.push($),a++}let k=g.length;for(let $=0;$<k;$++){let v=g[$];if(typeof v!="number"){let T={instancePath:e+"/via/"+y+"/"+$,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:v};n===null?n=[T]:n.push(T),a++}}}else{let k={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:g};n===null?n=[k]:n.push(k),a++}var p=b===a;h=h||p;let w=a;if(typeof g=="string"){if(!np.test(g)){let k={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:vs,data:g};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:vs.type,parentSchema:vs,data:g};n===null?n=[k]:n.push(k),a++}var p=w===a;if(h=h||p,h)a=x,n!==null&&(x?n.length=x:n=null);else{let k={instancePath:e+"/via/"+y,schemaPath:"#/properties/via/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.via.items.anyOf,parentSchema:je.properties.via.items,data:g};n===null?n=[k]:n.push(k),a++}}}else{let u={instancePath:e+"/via",schemaPath:"#/properties/via/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.via.type,parentSchema:je.properties.via,data:d};n===null?n=[u]:n.push(u),a++}}if(t.points!==void 0){let d=t.points;if(Array.isArray(d)){let u=d.length;for(let y=0;y<u;y++){let g=d[y];if(Array.isArray(g)){if(g.length>3){let h={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.points.items,data:g};n===null?n=[h]:n.push(h),a++}if(g.length<2){let h={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.points.items,data:g};n===null?n=[h]:n.push(h),a++}let x=g.length;for(let h=0;h<x;h++){let b=g[h];if(typeof b!="number"){let w={instancePath:e+"/points/"+y+"/"+h,schemaPath:"#/properties/points/items/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.points.items.items.type,parentSchema:je.properties.points.items.items,data:b};n===null?n=[w]:n.push(w),a++}}}else{let x={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.items.type,parentSchema:je.properties.points.items,data:g};n===null?n=[x]:n.push(x),a++}}}else{let u={instancePath:e+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.type,parentSchema:je.properties.points,data:d};n===null?n=[u]:n.push(u),a++}}if(t.lane!==void 0){let d=t.lane;if(typeof d!="number"){let u={instancePath:e+"/lane",schemaPath:"#/properties/lane/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.lane.type,parentSchema:je.properties.lane,data:d};n===null?n=[u]:n.push(u),a++}}if(t.arrow!==void 0){let d=t.arrow;if(typeof d!="boolean"){let u={instancePath:e+"/arrow",schemaPath:"#/properties/arrow/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.arrow.type,parentSchema:je.properties.arrow,data:d};n===null?n=[u]:n.push(u),a++}}if(t.cross!==void 0){let d=t.cross;if(typeof d!="boolean"){let u={instancePath:e+"/cross",schemaPath:"#/properties/cross/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.cross.type,parentSchema:je.properties.cross,data:d};n===null?n=[u]:n.push(u),a++}}if(t.label!==void 0){let d=t.label,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[0].type,parentSchema:je.properties.label.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var c=g===a;y=y||c;let x=a;if(d&&typeof d=="object"&&!Array.isArray(d)){if(d.text===void 0){let h={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:je.properties.label.anyOf[1].required,parentSchema:je.properties.label.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}for(let h in d)if(!(h==="text"||h==="along"||h==="side"||h==="at"||h==="dir"||h==="anchor")){let b={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h},message:"must NOT have additional properties",schema:!1,parentSchema:je.properties.label.anyOf[1],data:d};n===null?n=[b]:n.push(b),a++}if(d.text!==void 0){let h=d.text;if(typeof h!="string"){let b={instancePath:e+"/label/text",schemaPath:"#/properties/label/anyOf/1/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[1].properties.text.type,parentSchema:je.properties.label.anyOf[1].properties.text,data:h};n===null?n=[b]:n.push(b),a++}}if(d.along!==void 0){let h=d.along;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:je.properties.label.anyOf[1].properties.along.type,parentSchema:je.properties.label.anyOf[1].properties.along,data:h};n===null?n=[b]:n.push(b),a++}if(typeof h=="number"&&(h<1||isNaN(h))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:je.properties.label.anyOf[1].properties.along,data:h};n===null?n=[b]:n.push(b),a++}}if(d.side!==void 0){let h=d.side;if(!(h==="left"||h==="right")){let b={instancePath:e+"/label/side",schemaPath:"#/properties/label/anyOf/1/properties/side/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.side.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.side.enum,parentSchema:je.properties.label.anyOf[1].properties.side,data:h};n===null?n=[b]:n.push(b),a++}}if(d.at!==void 0){let h=d.at;if(Array.isArray(h)){if(h.length>3){let w={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.label.anyOf[1].properties.at,data:h};n===null?n=[w]:n.push(w),a++}if(h.length<2){let w={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.label.anyOf[1].properties.at,data:h};n===null?n=[w]:n.push(w),a++}let b=h.length;for(let w=0;w<b;w++){let k=h[w];if(typeof k!="number"){let $={instancePath:e+"/label/at/"+w,schemaPath:"#/properties/label/anyOf/1/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.label.anyOf[1].properties.at.items.type,parentSchema:je.properties.label.anyOf[1].properties.at.items,data:k};n===null?n=[$]:n.push($),a++}}}else{let b={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.label.anyOf[1].properties.at.type,parentSchema:je.properties.label.anyOf[1].properties.at,data:h};n===null?n=[b]:n.push(b),a++}}if(d.dir!==void 0){let h=d.dir;if(!(h==="x"||h==="y")){let b={instancePath:e+"/label/dir",schemaPath:"#/properties/label/anyOf/1/properties/dir/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.dir.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.dir.enum,parentSchema:je.properties.label.anyOf[1].properties.dir,data:h};n===null?n=[b]:n.push(b),a++}}if(d.anchor!==void 0){let h=d.anchor;if(!(h==="start"||h==="middle"||h==="end")){let b={instancePath:e+"/label/anchor",schemaPath:"#/properties/label/anyOf/1/properties/anchor/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.anchor.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.anchor.enum,parentSchema:je.properties.label.anyOf[1].properties.anchor,data:h};n===null?n=[b]:n.push(b),a++}}}else{let h={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.properties.label.anyOf[1].type,parentSchema:je.properties.label.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var c=x===a;if(y=y||c,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.label.anyOf,parentSchema:je.properties.label,data:d};n===null?n=[h]:n.push(h),a++}}if(t.appears!==void 0){let d=t.appears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var l=g===a;y=y||l;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var l=x===a;if(y=y||l,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}if(t.disappears!==void 0){let d=t.disappears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var f=g===a;y=y||f;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var f=x===a;if(y=y||f,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.type,parentSchema:je,data:t};n===null?n=[d]:n.push(d),a++}return Jr.errors=n,a===0}Jr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var at={type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}};function Xr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Xr.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){for(let d in t)if(!ro.call(at.properties,d)){let u={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:at,data:t};n===null?n=[u]:n.push(u),a++}if(t.floor!==void 0){let d=t.floor;if(typeof d!="string"){let u={instancePath:e+"/floor",schemaPath:"#/properties/floor/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.floor.type,parentSchema:at.properties.floor,data:d};n===null?n=[u]:n.push(u),a++}}if(t.face!==void 0){let d=t.face;if(typeof d!="string"){let u={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.face.type,parentSchema:at.properties.face,data:d};n===null?n=[u]:n.push(u),a++}}if(t.label!==void 0){let d=t.label;if(typeof d!="string"){let u={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.label.type,parentSchema:at.properties.label,data:d};n===null?n=[u]:n.push(u),a++}}if(t.sub!==void 0){let d=t.sub;if(typeof d!="string"){let u={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.sub.type,parentSchema:at.properties.sub,data:d};n===null?n=[u]:n.push(u),a++}}if(t.at!==void 0){let d=t.at,u=a,y=!1,g=a;if(Array.isArray(d)){if(d.length>2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Mt,data:d};n===null?n=[b]:n.push(b),a++}if(d.length<2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Mt,data:d};n===null?n=[b]:n.push(b),a++}let h=d.length;for(let b=0;b<h;b++){let w=d[b];if(typeof w!="number"){let k={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:d};n===null?n=[h]:n.push(h),a++}var c=g===a;if(y=y||c,c)var p=!0;let x=a;if(Array.isArray(d)){if(d.length>3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:at.properties.at.anyOf[1],data:d};n===null?n=[b]:n.push(b),a++}if(d.length<3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:3},message:"must NOT have fewer than 3 items",schema:3,parentSchema:at.properties.at.anyOf[1],data:d};n===null?n=[b]:n.push(b),a++}let h=d.length;for(let b=0;b<h;b++){let w=d[b];if(typeof w!="number"){let k={instancePath:e+"/at/"+b,schemaPath:"#/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:at.properties.at.anyOf[1].items.type,parentSchema:at.properties.at.anyOf[1].items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:at.properties.at.anyOf[1].type,parentSchema:at.properties.at.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var c=x===a;if(y=y||c,c&&p!==!0&&(p=!0),y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:at.properties.at.anyOf,parentSchema:at.properties.at,data:d};n===null?n=[h]:n.push(h),a++}}if(t.on!==void 0){let d=t.on;if(typeof d=="string"){if(!It.test(d)){let u={instancePath:e+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:d};n===null?n=[u]:n.push(u),a++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let u={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.kind.type,parentSchema:at.properties.kind,data:d};n===null?n=[u]:n.push(u),a++}}if(t.dir!==void 0){let d=t.dir;if(!(d==="x"||d==="y")){let u={instancePath:e+"/dir",schemaPath:"#/properties/dir/enum",keyword:"enum",params:{allowedValues:at.properties.dir.enum},message:"must be equal to one of the allowed values",schema:at.properties.dir.enum,parentSchema:at.properties.dir,data:d};n===null?n=[u]:n.push(u),a++}}if(t.anchor!==void 0){let d=t.anchor;if(!(d==="start"||d==="middle"||d==="end")){let u={instancePath:e+"/anchor",schemaPath:"#/properties/anchor/enum",keyword:"enum",params:{allowedValues:at.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:at.properties.anchor.enum,parentSchema:at.properties.anchor,data:d};n===null?n=[u]:n.push(u),a++}}if(t.dx!==void 0){let d=t.dx;if(typeof d!="number"){let u={instancePath:e+"/dx",schemaPath:"#/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:at.properties.dx.type,parentSchema:at.properties.dx,data:d};n===null?n=[u]:n.push(u),a++}}if(t.dy!==void 0){let d=t.dy;if(typeof d!="number"){let u={instancePath:e+"/dy",schemaPath:"#/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:at.properties.dy.type,parentSchema:at.properties.dy,data:d};n===null?n=[u]:n.push(u),a++}}if(t.appears!==void 0){let d=t.appears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var l=g===a;y=y||l;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var l=x===a;if(y=y||l,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}if(t.disappears!==void 0){let d=t.disappears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var f=g===a;y=y||f;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var f=x===a;if(y=y||f,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:at.type,parentSchema:at,data:t};n===null?n=[d]:n.push(d),a++}return Xr.errors=n,a===0}Xr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var be={type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}},ol={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},Ft={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function Qr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Qr.evaluated;m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0);let p=a,c=!1,l=a,f=a,d=!1,u=a;if(typeof t!="string"){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:t};n===null?n=[$]:n.push($),a++}var g=u===a;d=d||g;let y=a;if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length>1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}if(Object.keys(t).length<1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}for(let $ in t){let v=t[$];if(typeof v!="string"){let T={instancePath:e+"/"+$.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:v};n===null?n=[T]:n.push(T),a++}}}else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var g=y===a;if(d=d||g,g)var x=!0;if(d)a=f,n!==null&&(f?n.length=f:n=null);else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:t};n===null?n=[$]:n.push($),a++}var w=l===a;c=c||w;let h=a;if(Array.isArray(t)){let $=t.length;for(let v=0;v<$;v++){let T=t[v],R=a,O=!1,I=a;if(typeof T!="string"){let A={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:T};n===null?n=[A]:n.push(A),a++}var b=I===a;O=O||b;let M=a;if(T&&typeof T=="object"&&!Array.isArray(T)){if(Object.keys(T).length>1){let A={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:T};n===null?n=[A]:n.push(A),a++}if(Object.keys(T).length<1){let A={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:T};n===null?n=[A]:n.push(A),a++}for(let A in T){let P=T[A];if(typeof P!="string"){let j={instancePath:e+"/"+v+"/"+A.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:P};n===null?n=[j]:n.push(j),a++}}}else{let A={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:T};n===null?n=[A]:n.push(A),a++}var b=M===a;if(O=O||b,O)a=R,n!==null&&(R?n.length=R:n=null);else{let A={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:T};n===null?n=[A]:n.push(A),a++}}}else{let $={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ol.anyOf[1].type,parentSchema:ol.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var w=h===a;if(c=c||w,w)var k=!0;if(c)a=p,n!==null&&(p?n.length=p:n=null);else{let $={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ol.anyOf,parentSchema:ol,data:t};n===null?n=[$]:n.push($),a++}return Qr.errors=n,m.props=x,m.items=k,a===0}Qr.evaluated={dynamicProps:!0,dynamicItems:!0};function ei(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=ei.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.heading===void 0){let f={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:be.required,parentSchema:be,data:t};n===null?n=[f]:n.push(f),a++}for(let f in t)if(!ro.call(be.properties,f)){let d={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:be,data:t};n===null?n=[d]:n.push(d),a++}if(t.id!==void 0){let f=t.id;if(typeof f=="string"){if(!It.test(f)){let d={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:f};n===null?n=[d]:n.push(d),a++}}if(t.number!==void 0){let f=t.number;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f))){let d={instancePath:e+"/number",schemaPath:"#/properties/number/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:be.properties.number.type,parentSchema:be.properties.number,data:f};n===null?n=[d]:n.push(d),a++}if(typeof f=="number"&&(f<1||isNaN(f))){let d={instancePath:e+"/number",schemaPath:"#/properties/number/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:be.properties.number,data:f};n===null?n=[d]:n.push(d),a++}}if(t.kind!==void 0){let f=t.kind;if(typeof f!="string"){let d={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.kind.type,parentSchema:be.properties.kind,data:f};n===null?n=[d]:n.push(d),a++}}if(t.heading!==void 0){let f=t.heading;if(typeof f!="string"){let d={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.heading.type,parentSchema:be.properties.heading,data:f};n===null?n=[d]:n.push(d),a++}}if(t.caption!==void 0){let f=t.caption;if(typeof f!="string"){let d={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.caption.type,parentSchema:be.properties.caption,data:f};n===null?n=[d]:n.push(d),a++}}if(t.command!==void 0){let f=t.command;if(typeof f!="string"){let d={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.command.type,parentSchema:be.properties.command,data:f};n===null?n=[d]:n.push(d),a++}}if(t.animate!==void 0){let f=t.animate;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++)Qr(f[u],{instancePath:e+"/animate/"+u,parentData:f,parentDataProperty:u,rootData:i,dynamicAnchors:o})||(n=n===null?Qr.errors:n.concat(Qr.errors),a=n.length)}else{let d={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.animate.type,parentSchema:be.properties.animate,data:f};n===null?n=[d]:n.push(d),a++}}if(t.pulse!==void 0){let f=t.pulse;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/pulse/"+u,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/pulse/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.pulse.type,parentSchema:be.properties.pulse,data:f};n===null?n=[d]:n.push(d),a++}}if(t.highlight!==void 0){let f=t.highlight;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/highlight/"+u,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/highlight/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.highlight.type,parentSchema:be.properties.highlight,data:f};n===null?n=[d]:n.push(d),a++}}if(t.focus!==void 0){let f=t.focus;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/focus/"+u,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/focus/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.focus.type,parentSchema:be.properties.focus,data:f};n===null?n=[d]:n.push(d),a++}}if(t.show!==void 0){let f=t.show;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/show/"+u,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/show/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.show.type,parentSchema:be.properties.show,data:f};n===null?n=[d]:n.push(d),a++}}if(t.hide!==void 0){let f=t.hide;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/hide/"+u,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/hide/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.hide.type,parentSchema:be.properties.hide,data:f};n===null?n=[d]:n.push(d),a++}}if(t.say!==void 0){let f=t.say;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.at===void 0){let g={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:be.properties.say.items.required,parentSchema:be.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}if(y.text===void 0){let g={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:be.properties.say.items.required,parentSchema:be.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}for(let g in y)if(!(g==="at"||g==="text"||g==="kind"||g==="dx"||g==="dy"||g==="anchor")){let x={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:be.properties.say.items,data:y};n===null?n=[x]:n.push(x),a++}if(y.at!==void 0){let g=y.at,x=a,h=!1,b=a;if(typeof g=="string"){if(!It.test(g)){let k={instancePath:e+"/say/"+u+"/at",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:g};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/say/"+u+"/at",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:g};n===null?n=[k]:n.push(k),a++}var p=b===a;h=h||p;let w=a;if(Array.isArray(g)){if(g.length>3){let $={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:be.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:be.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}let k=g.length;for(let $=0;$<k;$++){let v=g[$];if(typeof v!="number"){let T={instancePath:e+"/say/"+u+"/at/"+$,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:be.properties.say.items.properties.at.anyOf[1].items,data:v};n===null?n=[T]:n.push(T),a++}}}else{let k={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.say.items.properties.at.anyOf[1].type,parentSchema:be.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}var p=w===a;if(h=h||p,h)a=x,n!==null&&(x?n.length=x:n=null);else{let k={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:be.properties.say.items.properties.at.anyOf,parentSchema:be.properties.say.items.properties.at,data:g};n===null?n=[k]:n.push(k),a++}}if(y.text!==void 0){let g=y.text;if(typeof g!="string"){let x={instancePath:e+"/say/"+u+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.say.items.properties.text.type,parentSchema:be.properties.say.items.properties.text,data:g};n===null?n=[x]:n.push(x),a++}}if(y.kind!==void 0){let g=y.kind;if(typeof g!="string"){let x={instancePath:e+"/say/"+u+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.say.items.properties.kind.type,parentSchema:be.properties.say.items.properties.kind,data:g};n===null?n=[x]:n.push(x),a++}}if(y.dx!==void 0){let g=y.dx;if(typeof g!="number"){let x={instancePath:e+"/say/"+u+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.say.items.properties.dx.type,parentSchema:be.properties.say.items.properties.dx,data:g};n===null?n=[x]:n.push(x),a++}}if(y.dy!==void 0){let g=y.dy;if(typeof g!="number"){let x={instancePath:e+"/say/"+u+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.say.items.properties.dy.type,parentSchema:be.properties.say.items.properties.dy,data:g};n===null?n=[x]:n.push(x),a++}}if(y.anchor!==void 0){let g=y.anchor;if(!(g==="start"||g==="middle"||g==="end")){let x={instancePath:e+"/say/"+u+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:be.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:be.properties.say.items.properties.anchor.enum,parentSchema:be.properties.say.items.properties.anchor,data:g};n===null?n=[x]:n.push(x),a++}}}else{let g={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:be.properties.say.items.type,parentSchema:be.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.say.type,parentSchema:be.properties.say,data:f};n===null?n=[d]:n.push(d),a++}}if(t.mark!==void 0){let f=t.mark;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(y&&typeof y=="object"&&!Array.isArray(y)){for(let g in y)if(!(g==="on"||g==="at")){let x={instancePath:e+"/mark/"+u,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:be.properties.mark.items,data:y};n===null?n=[x]:n.push(x),a++}if(y.on!==void 0){let g=y.on;if(typeof g=="string"){if(!It.test(g)){let x={instancePath:e+"/mark/"+u+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:g};n===null?n=[x]:n.push(x),a++}}else{let x={instancePath:e+"/mark/"+u+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:g};n===null?n=[x]:n.push(x),a++}}if(y.at!==void 0){let g=y.at;if(Array.isArray(g)){if(g.length>3){let h={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:be.properties.mark.items.properties.at,data:g};n===null?n=[h]:n.push(h),a++}if(g.length<2){let h={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:be.properties.mark.items.properties.at,data:g};n===null?n=[h]:n.push(h),a++}let x=g.length;for(let h=0;h<x;h++){let b=g[h];if(typeof b!="number"){let w={instancePath:e+"/mark/"+u+"/at/"+h,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.mark.items.properties.at.items.type,parentSchema:be.properties.mark.items.properties.at.items,data:b};n===null?n=[w]:n.push(w),a++}}}else{let x={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.mark.items.properties.at.type,parentSchema:be.properties.mark.items.properties.at,data:g};n===null?n=[x]:n.push(x),a++}}}else{let g={instancePath:e+"/mark/"+u,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:be.properties.mark.items.type,parentSchema:be.properties.mark.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.mark.type,parentSchema:be.properties.mark,data:f};n===null?n=[d]:n.push(d),a++}}if(t.badge!==void 0){let f=t.badge,d=a,u=!1,y=a;if(typeof f!="boolean"){let h={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:be.properties.badge.anyOf[0].type,parentSchema:be.properties.badge.anyOf[0],data:f};n===null?n=[h]:n.push(h),a++}var c=y===a;u=u||c;let g=a;if(typeof f=="string"){if(!It.test(f)){let h={instancePath:e+"/badge",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:f};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/badge",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:f};n===null?n=[h]:n.push(h),a++}var c=g===a;u=u||c;let x=a;if(Array.isArray(f)){if(f.length>3){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:be.properties.badge.anyOf[2],data:f};n===null?n=[b]:n.push(b),a++}if(f.length<2){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:be.properties.badge.anyOf[2],data:f};n===null?n=[b]:n.push(b),a++}let h=f.length;for(let b=0;b<h;b++){let w=f[b];if(typeof w!="number"){let k={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.badge.anyOf[2].items.type,parentSchema:be.properties.badge.anyOf[2].items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.badge.anyOf[2].type,parentSchema:be.properties.badge.anyOf[2],data:f};n===null?n=[h]:n.push(h),a++}var c=x===a;if(u=u||c,u)a=d,n!==null&&(d?n.length=d:n=null);else{let h={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:be.properties.badge.anyOf,parentSchema:be.properties.badge,data:f};n===null?n=[h]:n.push(h),a++}}if(t.duration!==void 0){let f=t.duration,d=a,u=!1,y=a;if(f!=="auto"){let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/0/const",keyword:"const",params:{allowedValue:"auto"},message:"must be equal to constant",schema:"auto",parentSchema:be.properties.duration.anyOf[0],data:f};n===null?n=[x]:n.push(x),a++}var l=y===a;u=u||l;let g=a;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f))){let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:be.properties.duration.anyOf[1].type,parentSchema:be.properties.duration.anyOf[1],data:f};n===null?n=[x]:n.push(x),a++}if(typeof f=="number"&&(f<500||isNaN(f))){let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:500},message:"must be >= 500",schema:500,parentSchema:be.properties.duration.anyOf[1],data:f};n===null?n=[x]:n.push(x),a++}var l=g===a;if(u=u||l,u)a=d,n!==null&&(d?n.length=d:n=null);else{let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:be.properties.duration.anyOf,parentSchema:be.properties.duration,data:f};n===null?n=[x]:n.push(x),a++}}}else{let f={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:be.type,parentSchema:be,data:t};n===null?n=[f]:n.push(f),a++}return ei.errors=n,a===0}ei.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ti(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=ti.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:Me.required,parentSchema:Me,data:t};n===null?n=[l]:n.push(l),a++}if(t.title===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'",schema:Me.required,parentSchema:Me,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t)if(!ro.call(Me.properties,l)){let f={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Me,data:t};n===null?n=[f]:n.push(f),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!It.test(l)){let f={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[f]:n.push(f),a++}}if(t.title!==void 0){let l=t.title;if(typeof l!="string"){let f={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.title.type,parentSchema:Me.properties.title,data:l};n===null?n=[f]:n.push(f),a++}}if(t.ants!==void 0){let l=t.ants,f=a,d=!1,u=a;if(typeof l!="boolean"){let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.ants.anyOf[0].type,parentSchema:Me.properties.ants.anyOf[0],data:l};n===null?n=[x]:n.push(x),a++}var p=u===a;d=d||p;let y=a;if(Array.isArray(l)){let x=l.length;for(let h=0;h<x;h++){let b=l[h];if(typeof b!="string"){let w={instancePath:e+"/ants/"+h,schemaPath:"#/properties/ants/anyOf/1/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.ants.anyOf[1].items.type,parentSchema:Me.properties.ants.anyOf[1].items,data:b};n===null?n=[w]:n.push(w),a++}}}else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.ants.anyOf[1].type,parentSchema:Me.properties.ants.anyOf[1],data:l};n===null?n=[x]:n.push(x),a++}var p=y===a;d=d||p;let g=a;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let x in l)if(!(x==="ids"||x==="speed"||x==="dash")){let h={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x},message:"must NOT have additional properties",schema:!1,parentSchema:Me.properties.ants.anyOf[2],data:l};n===null?n=[h]:n.push(h),a++}if(l.ids!==void 0){let x=l.ids;if(Array.isArray(x)){let h=x.length;for(let b=0;b<h;b++){let w=x[b];if(typeof w!="string"){let k={instancePath:e+"/ants/ids/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/ids/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.ants.anyOf[2].properties.ids.items.type,parentSchema:Me.properties.ants.anyOf[2].properties.ids.items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/ants/ids",schemaPath:"#/properties/ants/anyOf/2/properties/ids/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.ants.anyOf[2].properties.ids.type,parentSchema:Me.properties.ants.anyOf[2].properties.ids,data:x};n===null?n=[h]:n.push(h),a++}}if(l.speed!==void 0){let x=l.speed;if(typeof x!="number"){let h={instancePath:e+"/ants/speed",schemaPath:"#/properties/ants/anyOf/2/properties/speed/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Me.properties.ants.anyOf[2].properties.speed.type,parentSchema:Me.properties.ants.anyOf[2].properties.speed,data:x};n===null?n=[h]:n.push(h),a++}}if(l.dash!==void 0){let x=l.dash;if(Array.isArray(x)){if(x.length>2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Me.properties.ants.anyOf[2].properties.dash,data:x};n===null?n=[b]:n.push(b),a++}if(x.length<2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Me.properties.ants.anyOf[2].properties.dash,data:x};n===null?n=[b]:n.push(b),a++}let h=x.length;for(let b=0;b<h;b++){let w=x[b];if(typeof w=="number"){if(w<=0||isNaN(w)){let k={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Me.properties.ants.anyOf[2].properties.dash.items,data:w};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Me.properties.ants.anyOf[2].properties.dash.items.type,parentSchema:Me.properties.ants.anyOf[2].properties.dash.items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.ants.anyOf[2].properties.dash.type,parentSchema:Me.properties.ants.anyOf[2].properties.dash,data:x};n===null?n=[h]:n.push(h),a++}}}else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Me.properties.ants.anyOf[2].type,parentSchema:Me.properties.ants.anyOf[2],data:l};n===null?n=[x]:n.push(x),a++}var p=g===a;if(d=d||p,d)a=f,n!==null&&(f?n.length=f:n=null);else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Me.properties.ants.anyOf,parentSchema:Me.properties.ants,data:l};n===null?n=[x]:n.push(x),a++}}if(t.motion!==void 0){let l=t.motion;if(!(l&&typeof l=="object"&&!Array.isArray(l))){let f={instancePath:e+"/motion",schemaPath:"#/properties/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Me.properties.motion.type,parentSchema:Me.properties.motion,data:l};n===null?n=[f]:n.push(f),a++}}if(t.caption!==void 0){let l=t.caption;if(typeof l!="string"){let f={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.caption.type,parentSchema:Me.properties.caption,data:l};n===null?n=[f]:n.push(f),a++}}if(t.aria!==void 0){let l=t.aria;if(typeof l!="string"){let f={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.aria.type,parentSchema:Me.properties.aria,data:l};n===null?n=[f]:n.push(f),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l=="number"){if(l<=0||isNaN(l)){let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Me.properties.gap,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Me.properties.gap.type,parentSchema:Me.properties.gap,data:l};n===null?n=[f]:n.push(f),a++}}if(t.flow!==void 0){let l=t.flow;if(!(l==="row"||l==="column")){let f={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:Me.properties.flow.enum},message:"must be equal to one of the allowed values",schema:Me.properties.flow.enum,parentSchema:Me.properties.flow,data:l};n===null?n=[f]:n.push(f),a++}}if(t.regions!==void 0){let l=t.regions;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)lr(l[d],{instancePath:e+"/regions/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?lr.errors:n.concat(lr.errors),a=n.length)}else{let f={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.regions.type,parentSchema:Me.properties.regions,data:l};n===null?n=[f]:n.push(f),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)us(l[d],{instancePath:e+"/nodes/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?us.errors:n.concat(us.errors),a=n.length)}else{let f={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.nodes.type,parentSchema:Me.properties.nodes,data:l};n===null?n=[f]:n.push(f),a++}}if(t.routes!==void 0){let l=t.routes;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)Jr(l[d],{instancePath:e+"/routes/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?Jr.errors:n.concat(Jr.errors),a=n.length)}else{let f={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.routes.type,parentSchema:Me.properties.routes,data:l};n===null?n=[f]:n.push(f),a++}}if(t.notes!==void 0){let l=t.notes;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)Xr(l[d],{instancePath:e+"/notes/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?Xr.errors:n.concat(Xr.errors),a=n.length)}else{let f={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.notes.type,parentSchema:Me.properties.notes,data:l};n===null?n=[f]:n.push(f),a++}}if(t.steps!==void 0){let l=t.steps;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)ei(l[d],{instancePath:e+"/steps/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?ei.errors:n.concat(ei.errors),a=n.length)}else{let f={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.steps.type,parentSchema:Me.properties.steps,data:l};n===null?n=[f]:n.push(f),a++}}if(t.legend!==void 0){let l=t.legend,f=a,d=!1,u=a;if(l!=="auto"){let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:Me.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Me.properties.legend.anyOf[0].enum,parentSchema:Me.properties.legend.anyOf[0],data:l};n===null?n=[x]:n.push(x),a++}var c=u===a;d=d||c;let y=a;if(l!==!1){let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/1/const",keyword:"const",params:{allowedValue:!1},message:"must be equal to constant",schema:!1,parentSchema:Me.properties.legend.anyOf[1],data:l};n===null?n=[x]:n.push(x),a++}var c=y===a;d=d||c;let g=a;if(Array.isArray(l)){let x=l.length;for(let h=0;h<x;h++){let b=l[h];if(typeof b!="string"){let w={instancePath:e+"/legend/"+h,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.legend.anyOf[2].items.type,parentSchema:Me.properties.legend.anyOf[2].items,data:b};n===null?n=[w]:n.push(w),a++}}}else{let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.legend.anyOf[2].type,parentSchema:Me.properties.legend.anyOf[2],data:l};n===null?n=[x]:n.push(x),a++}var c=g===a;if(d=d||c,d)a=f,n!==null&&(f?n.length=f:n=null);else{let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Me.properties.legend.anyOf,parentSchema:Me.properties.legend,data:l};n===null?n=[x]:n.push(x),a++}}if(t.badges!==void 0){let l=t.badges;if(typeof l!="boolean"){let f={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.badges.type,parentSchema:Me.properties.badges,data:l};n===null?n=[f]:n.push(f),a++}}if(t.grid!==void 0){let l=t.grid;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let f in l)if(!(f==="snap"||f==="show"||f==="step")){let d={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:l};n===null?n=[d]:n.push(d),a++}if(l.snap!==void 0){let f=l.snap;if(typeof f=="number"){if(f<=0||isNaN(f)){let d={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:f};n===null?n=[d]:n.push(d),a++}}if(l.show!==void 0){let f=l.show;if(typeof f!="boolean"){let d={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:f};n===null?n=[d]:n.push(d),a++}}if(l.step!==void 0){let f=l.step;if(typeof f=="number"){if(f<=0||isNaN(f)){let d={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:f};n===null?n=[d]:n.push(d),a++}}}else{let f={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:l};n===null?n=[f]:n.push(f),a++}}if(t.assemble!==void 0){let l=t.assemble;if(typeof l!="boolean"){let f={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.assemble.type,parentSchema:Me.properties.assemble,data:l};n===null?n=[f]:n.push(f),a++}}if(t.loop!==void 0){let l=t.loop;if(typeof l!="boolean"){let f={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.loop.type,parentSchema:Me.properties.loop,data:l};n===null?n=[f]:n.push(f),a++}}if(t.dim!==void 0){let l=t.dim;if(!(l==="flows"||l==="all")){let f={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:Me.properties.dim.enum},message:"must be equal to one of the allowed values",schema:Me.properties.dim.enum,parentSchema:Me.properties.dim,data:l};n===null?n=[f]:n.push(f),a++}}if(t.after!==void 0){let l=t.after;if(typeof l!="string"){let f={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.after.type,parentSchema:Me.properties.after,data:l};n===null?n=[f]:n.push(f),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Me.type,parentSchema:Me,data:t};n===null?n=[l]:n.push(l),a++}return ti.errors=n,a===0}ti.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function al(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=al.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.isodiag===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"isodiag"},message:"must have required property 'isodiag'",schema:ot.required,parentSchema:ot,data:t};n===null?n=[p]:n.push(p),a++}if(t.scenes===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scenes"},message:"must have required property 'scenes'",schema:ot.required,parentSchema:ot,data:t};n===null?n=[p]:n.push(p),a++}for(let p in t)if(!ro.call(ot.properties,p)){let c={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:ot,data:t};n===null?n=[c]:n.push(c),a++}if(t.isodiag!==void 0){let p=t.isodiag;if(p!==1){let c={instancePath:e+"/isodiag",schemaPath:"#/properties/isodiag/const",keyword:"const",params:{allowedValue:1},message:"must be equal to constant",schema:1,parentSchema:ot.properties.isodiag,data:p};n===null?n=[c]:n.push(c),a++}}if(t.title!==void 0){let p=t.title;if(typeof p!="string"){let c={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.title.type,parentSchema:ot.properties.title,data:p};n===null?n=[c]:n.push(c),a++}}if(t.lede!==void 0){let p=t.lede;if(typeof p!="string"){let c={instancePath:e+"/lede",schemaPath:"#/properties/lede/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.lede.type,parentSchema:ot.properties.lede,data:p};n===null?n=[c]:n.push(c),a++}}if(t.pills!==void 0){let p=t.pills;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let f=p[l];if(typeof f!="string"){let d={instancePath:e+"/pills/"+l,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.pills.items.type,parentSchema:ot.properties.pills.items,data:f};n===null?n=[d]:n.push(d),a++}}}else{let c={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ot.properties.pills.type,parentSchema:ot.properties.pills,data:p};n===null?n=[c]:n.push(c),a++}}if(t.theme!==void 0){let p=t.theme;if(typeof p!="string"){let c={instancePath:e+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.theme.type,parentSchema:ot.properties.theme,data:p};n===null?n=[c]:n.push(c),a++}}if(t.roles!==void 0){let p=t.roles;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){if(l.h===void 0){let f={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"h"},message:"must have required property 'h'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[f]:n.push(f),a++}if(l.s===void 0){let f={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"s"},message:"must have required property 's'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[f]:n.push(f),a++}for(let f in l)if(!(f==="h"||f==="s"||f==="top"||f==="tint")){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}if(l.h!==void 0){let f=l.h;if(typeof f=="number"){if(f>360||isNaN(f)){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/maximum",keyword:"maximum",params:{comparison:"<=",limit:360},message:"must be <= 360",schema:360,parentSchema:Lt.properties.h,data:f};n===null?n=[d]:n.push(d),a++}if(f<0||isNaN(f)){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.h,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.h.type,parentSchema:Lt.properties.h,data:f};n===null?n=[d]:n.push(d),a++}}if(l.s!==void 0){let f=l.s;if(typeof f=="number"){if(f>100||isNaN(f)){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.s,data:f};n===null?n=[d]:n.push(d),a++}if(f<0||isNaN(f)){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.s,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.s.type,parentSchema:Lt.properties.s,data:f};n===null?n=[d]:n.push(d),a++}}if(l.top!==void 0){let f=l.top;if(typeof f!="string"){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/top",schemaPath:"#/$defs/role/properties/top/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Lt.properties.top.type,parentSchema:Lt.properties.top,data:f};n===null?n=[d]:n.push(d),a++}}if(l.tint!==void 0){let f=l.tint;if(typeof f=="number"){if(f>100||isNaN(f)){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.tint,data:f};n===null?n=[d]:n.push(d),a++}if(f<0||isNaN(f)){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.tint,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.tint.type,parentSchema:Lt.properties.tint,data:f};n===null?n=[d]:n.push(d),a++}}}else{let f={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Lt.type,parentSchema:Lt,data:l};n===null?n=[f]:n.push(f),a++}}else{let c={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.properties.roles.type,parentSchema:ot.properties.roles,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kinds!==void 0){let p=t.kinds;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let f in l)if(!(f==="legend"||f==="like"||f==="color"||f==="dash")){let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:zn,data:l};n===null?n=[d]:n.push(d),a++}if(l.legend!==void 0){let f=l.legend;if(typeof f!="string"){let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/legend",schemaPath:"#/$defs/kindDef/properties/legend/type",keyword:"type",params:{type:"string"},message:"must be string",schema:zn.properties.legend.type,parentSchema:zn.properties.legend,data:f};n===null?n=[d]:n.push(d),a++}}if(l.like!==void 0){let f=l.like;if(typeof f!="string"){let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/like",schemaPath:"#/$defs/kindDef/properties/like/type",keyword:"type",params:{type:"string"},message:"must be string",schema:zn.properties.like.type,parentSchema:zn.properties.like,data:f};n===null?n=[d]:n.push(d),a++}}if(l.color!==void 0){let f=l.color;if(typeof f!="string"){let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/color",schemaPath:"#/$defs/kindDef/properties/color/type",keyword:"type",params:{type:"string"},message:"must be string",schema:zn.properties.color.type,parentSchema:zn.properties.color,data:f};n===null?n=[d]:n.push(d),a++}}if(l.dash!==void 0){let f=l.dash;if(!(f==="solid"||f==="dashed"||f==="dotted")){let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:zn.properties.dash.enum},message:"must be equal to one of the allowed values",schema:zn.properties.dash.enum,parentSchema:zn.properties.dash,data:f};n===null?n=[d]:n.push(d),a++}}}else{let f={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:zn.type,parentSchema:zn,data:l};n===null?n=[f]:n.push(f),a++}}else{let c={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.properties.kinds.type,parentSchema:ot.properties.kinds,data:p};n===null?n=[c]:n.push(c),a++}}if(t.after!==void 0){let p=t.after;if(typeof p!="string"){let c={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.after.type,parentSchema:ot.properties.after,data:p};n===null?n=[c]:n.push(c),a++}}if(t.grid!==void 0){let p=t.grid;if(p&&typeof p=="object"&&!Array.isArray(p)){for(let c in p)if(!(c==="snap"||c==="show"||c==="step")){let l={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:p};n===null?n=[l]:n.push(l),a++}if(p.snap!==void 0){let c=p.snap;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}if(p.show!==void 0){let c=p.show;if(typeof c!="boolean"){let l={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:c};n===null?n=[l]:n.push(l),a++}}if(p.step!==void 0){let c=p.step;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:p};n===null?n=[c]:n.push(c),a++}}if(t.assemble!==void 0){let p=t.assemble;if(typeof p!="boolean"){let c={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ot.properties.assemble.type,parentSchema:ot.properties.assemble,data:p};n===null?n=[c]:n.push(c),a++}}if(t.footer!==void 0){let p=t.footer;if(typeof p!="string"){let c={instancePath:e+"/footer",schemaPath:"#/properties/footer/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.footer.type,parentSchema:ot.properties.footer,data:p};n===null?n=[c]:n.push(c),a++}}if(t.scenes!==void 0){let p=t.scenes;if(Array.isArray(p)){if(p.length<1){let l={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:ot.properties.scenes,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++)ti(p[l],{instancePath:e+"/scenes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?ti.errors:n.concat(ti.errors),a=n.length)}else{let c={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ot.properties.scenes.type,parentSchema:ot.properties.scenes,data:p};n===null?n=[c]:n.push(c),a++}}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.type,parentSchema:ot,data:t};n===null?n=[p]:n.push(p),a++}return al.errors=n,a===0}al.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Ch(t){let e=JSON.stringify(t),s=2166136261;for(let r=0;r<e.length;r++)s^=e.charCodeAt(r),s=Math.imul(s,16777619)>>>0;return s.toString(16)+":"+e.length}var jh=new Map([["2893d8cc:12893",nm]]);function sp(t){let e=jh.get(Ch(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var rp={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}};var op=[];function sm(t){op.includes(t)||op.push(t)}function ip(t){for(let e of op){let s=e(t);if(s!==void 0)return s}return t?"this item":"the file"}function cl(t){return t===null?"nothing":Array.isArray(t)?"a list":typeof t=="object"?"a map":typeof t=="string"?`the text "${t}"`:`${typeof t} ${String(t)}`}var rm={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},io=new Map;function im(t,e){io.set(t,e)}var ap=new Map;function om(t,e){ap.set(t,(s,r)=>e(cl(s),r))}var lp=[];function am(t,e){lp.some(([s])=>s===t)||lp.push([t,e])}function _h(t){let e=t.parentSchema,s=Object.keys(e?.properties??{});e?.$ref&&io.has(e.$ref)&&s.push(...io.get(e.$ref).filter(r=>!s.includes(r)));for(let r of e?.allOf??[])r.$ref&&io.has(r.$ref)&&s.push(...io.get(r.$ref));return s}function ll(t,e){let s=t.propertyName??(t.keyword==="propertyNames"?t.params.propertyName:void 0);if(s!==void 0){let m=`${t.instancePath}/${s.replace(/~/g,"~0").replace(/\//g,"~1")}`,p=e.locate(m,{key:!0});return{severity:"error",message:`"${s}" can't be a name`,line:p.line,col:p.col,path:m,hint:"names are a lower-case letter, then lower-case letters, digits and -"}}let r=t.instancePath,i=t.message??"is not valid",o,n=e.locate(r),a=t.params;switch(t.keyword){case"required":i=`${ip(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let p=String(a.additionalProperty??a.unevaluatedProperty),c=_h(t),l=Vt(p,c);return i=`unknown key "${p}" in ${ip(r)}`+(l?` (did you mean "${l}"?)`:""),!l&&c.length&&(o=`known keys: ${c.join(", ")}`),/\s/.test(p)&&(o='inside { \u2026 } a comma starts a new key: put text with commas in quotes, e.g. label: "read once, at launch"'),n=e.locate(`${r}/${p}`,{key:!0}),{severity:"error",message:i,line:n.line,col:n.col,path:`${r}/${p}`,hint:o}}case"enum":{let p=a.allowedValues.map(String),c=typeof t.data=="string"?Vt(t.data,p):void 0,l=r.split("/").pop();i=`${cl(t.data)} is not a valid ${l&&!/^\d+$/.test(l)?`"${l}"`:"value"}`+(c?` (did you mean "${c}"?)`:""),o=`expected one of: ${p.join(", ")}`;break}case"const":i=ap.has(r)?ap.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${rm[String(a.type)]??a.type}, got ${cl(t.data)}`;break;case"pattern":let m=lp.find(([p])=>String(a.pattern).startsWith(p));m?{message:i,hint:o}=m[1](t.data):(i=`"${t.data}" is not a valid id`,o="ids start with a letter and use only letters, digits, - and _");break;case"minItems":case"maxItems":t.schema===2||t.parentSchema?.minItems===2?i=`expected a list of ${t.parentSchema.minItems===t.parentSchema.maxItems?t.parentSchema.minItems:`${t.parentSchema.minItems} to ${t.parentSchema.maxItems}`} numbers, got ${t.data.length}`:i=`list ${t.message}`;break;case"false schema":{let p=r.split("/").pop()??"",c=r.split("/").slice(0,-1).join("/");i=`"${p.replace(/~1/g,"/").replace(/~0/g,"~")}" can't be set on ${ip(c)}`,n=e.locate(r,{key:!0});break}case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":i=`${t.data} is out of range: ${t.message}`;break}return{severity:"error",message:i,line:n.line,col:n.col,path:r,hint:o}}function lm(t,e){let s=t.filter(n=>n.keyword==="anyOf"),r=new Set,i=[];for(let n of s){let a=n.schemaPath.replace(/\/anyOf$/,"/anyOf/"),m=t.filter(l=>l!==n&&l.schemaPath.startsWith(a)&&l.instancePath.startsWith(n.instancePath));if(m.forEach(l=>r.add(l)),r.add(n),s.some(l=>l!==n&&n.schemaPath.startsWith(l.schemaPath.replace(/\/anyOf$/,"/anyOf/"))&&l.instancePath===n.instancePath))continue;let p=m.filter(l=>l.instancePath.length>n.instancePath.length&&l.keyword!=="anyOf"),c=m.find(l=>l.keyword==="enum"&&l.instancePath===n.instancePath&&typeof n.data=="string");if(c)i.push(ll(c,e));else if(p.length)i.push(...p.map(l=>ll(l,e)));else{let l=m.filter(f=>f.instancePath===n.instancePath&&f.keyword!=="type"&&f.keyword!=="anyOf");if(l.length&&typeof n.data=="object"&&n.data!==null)i.push(...l.map(f=>ll(f,e)));else{let f=[...new Set(m.filter(u=>u.keyword==="type").map(u=>rm[String(u.params.type)]??""))].filter(Boolean),d=e.locate(n.instancePath);i.push({severity:"error",message:`${cl(n.data)} is not allowed here`+(f.length?`; expected ${f.join(" or ")}`:""),line:d.line,col:d.col,path:n.instancePath})}}}for(let n of t)r.has(n)||i.push(ll(n,e));let o=new Set;return i.filter(n=>{let a=`${n.path}|${n.message}`;return o.has(a)?!1:(o.add(a),!0)}).sort((n,a)=>n.line-a.line||n.col-a.col)}var cm=sp(rp),Fh=Object.keys(rp.$defs.placement.properties);im("#/$defs/placement",Fh);om("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var Dh={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};sm(t=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(t);return e?Dh[e[1].replace(/s$/,"")]??"this item":void 0});am("^[A-Za-z][A-Za-z0-9_-]*(",t=>({message:`"${t}" is not a node reference`,hint:"write an id, optionally with a side: worker, worker.e (sides: n, e, s, w, top)"}));function pm(t){return t.data==null||typeof t.data!="object"||Array.isArray(t.data)?[{severity:"error",message:'the file must be a YAML map with "isodiag: 1" and "scenes:"',line:1,col:1,path:""}]:cm(t.data)?[]:lm(cm.errors??[],t)}var oo=class extends Error{diags;constructor(e){super(e.filter(s=>s.severity==="error").map(s=>`line ${s.line}: ${s.message}`).join(`
|
|
399
|
-
`)),this.name="CompileError",this.diags=e}};function
|
|
400
|
-
`));return
|
|
434
|
+
`;var Bm={};yo(Bm,{BASE_CSS:()=>Tm,CompileError:()=>mo,DRAWING_CSS:()=>Am,NODE_ASSETS:()=>co,REGION_KINDS:()=>kp,compile:()=>Al,getAsset:()=>Om,renderSvg:()=>Dm,systems:()=>ts});var ky={name:"volume",description:"Stored data that is kept: a drum with two bands (a volume, a room's history, an archive).",size:[1.8,1.8,1.3],role:"folder",draw(t,e){let[s,r]=Hs(e),i=Math.min(e.x1-e.x0,e.y1-e.y0)/2,o=(c,l)=>[s+i*Math.cos(c*Math.PI/180),r+i*Math.sin(c*Math.PI/180),l],n=(c,l,d)=>Array.from({length:13},(m,h)=>o(c+(l-c)*h/12,d)),a=(c,l,d)=>t.poly([...n(c,l,e.z0),...n(c,l,e.z1).reverse()],d),f=e.z1-e.z0,p=c=>n(-45,135,c).slice(1).map((l,d,m)=>t.line3(d?m[d-1]:o(-45,c),l,"det")).join("");return a(45,135,"lft")+a(-45,45,"rgt")+p(e.z0+f*.36)+p(e.z0+f*.68)+t.poly(Array.from({length:32},(c,l)=>o(l*360/32,e.z1)),"top")}},$y={name:"orb",description:"An agent: a white sphere with two eyes, on a small plate.",size:[1.5,1.5,1.6],role:"lead",cls:"orb",draw(t,e){t.def("orbG",Se("radialGradient",{id:"orbG",cx:"0.36",cy:"0.30",r:"0.80"},Se("stop",{offset:"0",style:"stop-color:#ffffff"})+Se("stop",{offset:"0.62",style:"stop-color:#f6f6f4"})+Se("stop",{offset:"1",style:"stop-color:#cfd0d6"})));let s=Li(e),[r,i]=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1),o=23,n=i-o+3;t.bounds.add([r-o,n-o]),t.bounds.add([r+o,n+o]);let a=(f,p,c,l)=>Se("rect",{class:"eye",x:r+f-c/2,y:n+p-l/2,width:c,height:l,rx:c/2,transform:`rotate(-24 ${(r+f).toFixed(1)} ${(n+p).toFixed(1)})`});return t.blockFaces(s)+Se("ellipse",{class:"shade",cx:r,cy:i+1,rx:o*.8,ry:o*.3})+Se("circle",{class:"ball",cx:r,cy:n,r:o})+a(3,-7,6.4,13.5)+a(14,-12,5.4,10.5)},label(t,e,s){let[r,i]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+1.95);return{x:r,y:i-26+(s?0:14),anchor:"middle"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.8,26]},Sy={name:"person",description:"A human: body and head on a small plate. The label sits to the right.",size:[1.5,1.5,1.6],role:"person",cls:"person",draw(t,e){let s=Li(e),[r,i]=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1);t.bounds.add([r-13,i-50]);let o=n=>n.toFixed(1);return t.blockFaces(s)+Se("path",{class:"body",d:`M${o(r-13)},${o(i-4)} C${o(r-13)},${o(i-34)} ${o(r+13)},${o(i-34)} ${o(r+13)},${o(i-4)} Q${o(r)},${o(i+4)} ${o(r-13)},${o(i-4)}z`})+Se("circle",{class:"head",cx:r,cy:i-40,r:10})},label(t){let[e,s]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0);return{x:e+30,y:s+2,anchor:"start"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.9,26]},vy={name:"screen",description:"An upright screen or terminal panel. `face`: terminal, chat, desktop, tiles, or one the host registers. `facing`: turn in degrees.",size:[1.64,.3,1.75],role:"term",draw(t,e,s){let[r,i]=Hs(e),o=(e.x1-e.x0)/2,n=e.z1-e.z0,a=.14,f=(s.facing??0)*Math.PI/180,p=Math.cos(f),c=Math.sin(f),l=Math.sin(f)*a,d=-Math.cos(f)*a,m=[r-p*o,i-c*o],h=[r+p*o,i+c*o],y=e.z0,g=e.z1,k=t.poly([[h[0],h[1],y],[h[0]+l,h[1]+d,y],[h[0]+l,h[1]+d,g],[h[0],h[1],g]],"rgt")+t.poly([[m[0],m[1],g],[h[0],h[1],g],[h[0]+l,h[1]+d,g],[m[0]+l,m[1]+d,g]],"top")+t.poly([[m[0],m[1],y],[h[0],h[1],y],[h[0],h[1],g],[m[0],m[1],g]],"lft"),u=Ne(m[0],m[1],g),b=Ne(h[0],h[1],g),x=2*o*lt,w=n*lt,$=[(b[0]-u[0])/x,(b[1]-u[1])/x,0,1,u[0],u[1]],v=tr(s.face??"terminal")??di;return k+=t.onMatrix($,x,w,(O,C)=>fi(O,C)+v(O,C),"scr"),k}},My={name:"monitor",description:"A block with a screen painted on its front-left face. `face` as for screen.",size:[2.4,.8,1.8],role:"term",draw(t,e,s){let r=tr(s.face??"terminal")??di;return t.blockFaces(e)+t.onFace(e,"left",(i,o)=>fi(i,o)+r(i,o),"scr")}},Py={name:"cloud",description:"A cloud lying on the floor: the internet, or a hosted service.",size:[3,2.4,.3],role:"cloud",draw:(t,e)=>Er(t,e)},co={block:an("block","A box. Size and colour role are free; add decorations with `deco`.",[2.4,2.4,1.6],"grey"),session:an("session","An agent session: a box with terminal lines (`deco: [terminal: 4]`; add an icon the host registers with `icon: NAME`).",[2.6,2.6,1.8],"work",[{terminal:4}]),terminal:an("terminal","A box with terminal lines on its front.",[1.6,1.2,.8],"term",[{terminal:2}]),server:an("server","A service or daemon: a low box with two terminal lines.",[3,2.2,.9],"doz",[{terminal:2}]),chat:an("chat","A chat server or room: a box with a chat bubble on top.",[3.6,4.4,1.3],"chat",["bubble"]),mailbox:an("mailbox","A room or inbox: terminal lines and an envelope on top.",[2.4,2.4,1.6],"mail",[{terminal:3},"envelope"]),file:an("file","A file or document: a low box with lines on top.",[1.6,1.6,.6],"file",["file-lines"]),folder:an("folder","A folder or directory: a flat box.",[1.6,1.6,.5],"folder"),key:an("key","A secret: a low box with a key on top.",[1.6,1.6,.6],"key",[],(t,e)=>$o(t,e)),socket:an("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(t,e)=>So(t,e)),gate:an("gate","A gate or proxy: a narrow upright slab, usually set in a fence wall.",[.3,2,1.1],"gate"),placeholder:an("placeholder","A placeholder value: a small low box with lines.",[1.2,1,.45],"placeholder",["file-lines"]),orb:$y,person:Sy,screen:vy,monitor:My,cloud:Py,volume:ky};function Om(t){return co[t??"block"]}var Oy="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",kp={slab:{shape:"slab",pad:1.2,z:[-.8,.35],floor:!0,role:"slab",labelStyle:"face"},pad:{shape:"block",pad:.6,z:[0,.2],floor:!0,role:"pad",labelStyle:"floor"},fence:{shape:"walled",pad:.7,z:[0,.8],floor:!1,role:"fence",labelStyle:"face",legend:{label:"Fence",swatch:Oy,box:!0,auto:!0},css:`.fz{fill:var(--fence-text)!important;opacity:1!important}
|
|
435
|
+
`},vm:{shape:"block",pad:.6,z:[0,.45],floor:!0,role:"sandbox",labelStyle:"face",legend:{label:"Sandbox VM",swatch:"border-color:hsl(170 35% 40%);background:hsl(170 40% 50% / .2)",box:!0,auto:!0}},platform:{shape:"block",pad:.6,z:[0,.7],floor:!0,role:"server",labelStyle:"face-right"},cloud:{shape:"cloud",pad:.8,z:[0,.2],floor:!0,role:"cloud",labelStyle:"floor"},zone:{shape:"zone",pad:.5,z:[0,.005],floor:!1,role:"grey",labelStyle:"floor"},tunnel:{shape:"tunnel",pad:0,z:[0,.8],floor:!1,role:"socket",labelStyle:"none",legend:{label:"Tailscale tunnel",swatch:"border-color:hsl(205 70% 50%);border-top-width:9px;opacity:.35",box:!1,auto:!1}}},ts={regions:kp,nodes:co,defaultNode:"block"};var Am=ar(ts),Tm=Ur(ts);var Nm=Ml,rt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}},Lt={type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},Ln={type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},Rt={type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},po=Object.prototype.hasOwnProperty,ve={type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},Ee={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},It=new RegExp("^[A-Za-z][A-Za-z0-9_-]*$","u"),Fe={type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},yn={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},$p={enum:["n","e","s","w"]},Ze={type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},Em={properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Pt={type:"array",items:{type:"number"},minItems:2,maxItems:2},Sp={enum:["start","center","end"]},Ye={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function As(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=As.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.in!==void 0){let l=t.in;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/in",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/in",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.at!==void 0){let l=t.at;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/at/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t["right-of"]!==void 0){let l=t["right-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t["left-of"]!==void 0){let l=t["left-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.below!==void 0){let l=t.below;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/below",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/below",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.behind!==void 0){let l=t.behind;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l!="number"){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Em.properties.gap.type,parentSchema:Em.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.align!==void 0){let l=t.align;if(!(l==="start"||l==="center"||l==="end")){let d={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:Sp.enum},message:"must be equal to one of the allowed values",schema:Sp.enum,parentSchema:Sp,data:l};n===null?n=[d]:n.push(d),a++}}if(t.shift!==void 0){let l=t.shift;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/shift/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.appears!==void 0){let l=t.appears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var p=h===a;m=m||p;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var p=y===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:l};n===null?n=[g]:n.push(g),a++}}if(t.disappears!==void 0){let l=t.disappears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var c=h===a;m=m||c;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var c=y===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:l};n===null?n=[g]:n.push(g),a++}}}return As.errors=n,a===0}As.evaluated={props:{in:!0,at:!0,"right-of":!0,"left-of":!0,below:!0,behind:!0,gap:!0,align:!0,shift:!0,appears:!0,disappears:!0},dynamicProps:!1,dynamicItems:!1};var Nt={type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},Je={anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},ei=new RegExp("^[a-z][a-z0-9-]*$","u");function Ts(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=Ts.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1){let l={instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t){let d=a;if(typeof l=="string"){if(!It.test(l)){let m={instancePath:e,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}var p=d===a;if(!p){let m={instancePath:e,schemaPath:"#/propertyNames",keyword:"propertyNames",params:{propertyName:l},message:"property name must be valid",schema:Nt.propertyNames,parentSchema:Nt,data:t};n===null?n=[m]:n.push(m),a++}}for(let l in t){let d=t[l];if(d&&typeof d=="object"&&!Array.isArray(d)){if(Object.keys(d).length<1){let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}for(let m in d)if(!(m==="role"||m==="ghost"||m==="label"||m==="sub"||m==="face"||m==="deco")){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[h]:n.push(h),a++}if(d.role!==void 0){let m=d.role;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/role",schemaPath:"#/additionalProperties/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.role.type,parentSchema:Nt.additionalProperties.properties.role,data:m};n===null?n=[h]:n.push(h),a++}}if(d.ghost!==void 0){let m=d.ghost;if(typeof m!="boolean"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/ghost",schemaPath:"#/additionalProperties/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Nt.additionalProperties.properties.ghost.type,parentSchema:Nt.additionalProperties.properties.ghost,data:m};n===null?n=[h]:n.push(h),a++}}if(d.label!==void 0){let m=d.label;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/label",schemaPath:"#/additionalProperties/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.label.type,parentSchema:Nt.additionalProperties.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(d.sub!==void 0){let m=d.sub;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/sub",schemaPath:"#/additionalProperties/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.sub.type,parentSchema:Nt.additionalProperties.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(d.face!==void 0){let m=d.face;if(typeof m=="string"){if(!ei.test(m)){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.face.type,parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(d.deco!==void 0){let m=d.deco;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(!(g==="envelope"||g==="bubble"||g==="file-lines"||g==="ghost"||g==="terminal")){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Je.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Je.anyOf[0].enum,parentSchema:Je.anyOf[0],data:g};n===null?n=[w]:n.push(w),a++}var c=b===a;u=u||c;let x=a;if(g&&typeof g=="object"&&!Array.isArray(g)){if(Object.keys(g).length>1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}if(Object.keys(g).length<1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}for(let w in g)if(!(w==="terminal"||w==="icon"||w==="screen")){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties",schema:!1,parentSchema:Je.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.terminal!==void 0){let w=g.terminal;if(!(typeof w=="number"&&!(w%1)&&!isNaN(w))){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].properties.terminal.type,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(typeof w=="number"){if(w>8||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(w<1||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}}}if(g.icon!==void 0){let w=g.icon;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.icon.type,parentSchema:Je.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}if(g.screen!==void 0){let w=g.screen;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.screen.type,parentSchema:Je.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}}else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var c=x===a;if(u=u||c,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco",schemaPath:"#/additionalProperties/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Nt.additionalProperties.properties.deco.type,parentSchema:Nt.additionalProperties.properties.deco,data:m};n===null?n=[h]:n.push(h),a++}}}else{let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.additionalProperties.type,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.type,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}return Ts.errors=n,a===0}Ts.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var et={type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},vp={validate:hs};function hs(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=hs.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:et.required,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}if(t.id!==void 0){let c=t.id;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}if(t.asset!==void 0){let c=t.asset;if(typeof c!="string"){let l={instancePath:e+"/asset",schemaPath:"#/properties/asset/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.asset.type,parentSchema:et.properties.asset,data:c};n===null?n=[l]:n.push(l),a++}}if(t.role!==void 0){let c=t.role;if(typeof c!="string"){let l={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.role.type,parentSchema:et.properties.role,data:c};n===null?n=[l]:n.push(l),a++}}if(t.label!==void 0){let c=t.label;if(typeof c!="string"){let l={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.label.type,parentSchema:et.properties.label,data:c};n===null?n=[l]:n.push(l),a++}}if(t.sub!==void 0){let c=t.sub;if(typeof c!="string"){let l={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.sub.type,parentSchema:et.properties.sub,data:c};n===null?n=[l]:n.push(l),a++}}if(t.size!==void 0){let c=t.size;if(Array.isArray(c)){if(c.length>3){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}if(c.length<2){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}let l=c.length;for(let d=0;d<l;d++){let m=c[d];if(typeof m=="number"){if(m<=0||isNaN(m)){let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:c};n===null?n=[l]:n.push(l),a++}}if(t.z!==void 0){let c=t.z;if(typeof c!="number"){let l={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.z.type,parentSchema:et.properties.z,data:c};n===null?n=[l]:n.push(l),a++}}if(t.deco!==void 0){let c=t.deco;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++){let m=c[d],h=a,y=!1,g=a;if(!(m==="envelope"||m==="bubble"||m==="file-lines"||m==="ghost"||m==="terminal")){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Je.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Je.anyOf[0].enum,parentSchema:Je.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var p=g===a;y=y||p;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(Object.keys(m).length>1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(Object.keys(m).length<1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="terminal"||u==="icon"||u==="screen")){let b={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:Je.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.terminal!==void 0){let u=m.terminal;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].properties.terminal.type,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"){if(u>8||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(u<1||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}}}if(m.icon!==void 0){let u=m.icon;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.icon.type,parentSchema:Je.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}if(m.screen!==void 0){let u=m.screen;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.screen.type,parentSchema:Je.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var p=k===a;if(y=y||p,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:m};n===null?n=[u]:n.push(u),a++}}}else{let l={instancePath:e+"/deco",schemaPath:"#/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.deco.type,parentSchema:et.properties.deco,data:c};n===null?n=[l]:n.push(l),a++}}if(t.ghost!==void 0){let c=t.ghost;if(typeof c!="boolean"){let l={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:et.properties.ghost.type,parentSchema:et.properties.ghost,data:c};n===null?n=[l]:n.push(l),a++}}if(t.face!==void 0){let c=t.face;if(typeof c=="string"){if(!ei.test(c)){let l={instancePath:e+"/face",schemaPath:"#/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.face.type,parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}if(t.facing!==void 0){let c=t.facing;if(typeof c!="number"){let l={instancePath:e+"/facing",schemaPath:"#/properties/facing/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.facing.type,parentSchema:et.properties.facing,data:c};n===null?n=[l]:n.push(l),a++}}if(t["label-at"]!==void 0){let c=t["label-at"];if(c&&typeof c=="object"&&!Array.isArray(c)){for(let l in c)if(!(l==="side"||l==="dx"||l==="dy")){let d={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:et.properties["label-at"],data:c};n===null?n=[d]:n.push(d),a++}if(c.side!==void 0){let l=c.side;if(!(l==="above"||l==="right"||l==="left"||l==="below")){let d={instancePath:e+"/label-at/side",schemaPath:"#/properties/label-at/properties/side/enum",keyword:"enum",params:{allowedValues:et.properties["label-at"].properties.side.enum},message:"must be equal to one of the allowed values",schema:et.properties["label-at"].properties.side.enum,parentSchema:et.properties["label-at"].properties.side,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dx!==void 0){let l=c.dx;if(typeof l!="number"){let d={instancePath:e+"/label-at/dx",schemaPath:"#/properties/label-at/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dx.type,parentSchema:et.properties["label-at"].properties.dx,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dy!==void 0){let l=c.dy;if(typeof l!="number"){let d={instancePath:e+"/label-at/dy",schemaPath:"#/properties/label-at/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dy.type,parentSchema:et.properties["label-at"].properties.dy,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.properties["label-at"].type,parentSchema:et.properties["label-at"],data:c};n===null?n=[l]:n.push(l),a++}}if(t.motion!==void 0){let c=t.motion;if(c&&typeof c=="object"&&!Array.isArray(c)){if(Object.keys(c).length<1){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}for(let l in c)if(!(l==="style"||l==="out"||l==="easing"||l==="from"||l==="delay"||l==="duration")){let d={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:c};n===null?n=[d]:n.push(d),a++}if(c.style!==void 0){let l=c.style;if(!(l==="edge"||l==="drop"||l==="rise"||l==="fly"||l==="pop"||l==="scatter"||l==="build"||l==="fade")){let d={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:l};n===null?n=[d]:n.push(d),a++}}if(c.out!==void 0){let l=c.out;if(!(l==="explode"||l==="lift-off"||l==="sink"||l==="scatter"||l==="fly-out"||l==="collapse"||l==="fade"||l==="reverse")){let d={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:l};n===null?n=[d]:n.push(d),a++}}if(c.easing!==void 0){let l=c.easing;if(!(l==="linear"||l==="ease"||l==="ease-in"||l==="ease-out"||l==="settle"||l==="spring"||l==="bounce")){let d={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:l};n===null?n=[d]:n.push(d),a++}}if(c.from!==void 0){let l=c.from;if(!(l==="left"||l==="right"||l==="top"||l==="bottom")){let d={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:l};n===null?n=[d]:n.push(d),a++}}if(c.delay!==void 0){let l=c.delay;if(typeof l=="number"){if(l<0||isNaN(l)){let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}if(c.duration!==void 0){let l=c.duration;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let c=t.nodes;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++)vp.validate(c[d],{instancePath:e+"/nodes/"+d,parentData:c,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?vp.validate.errors:n.concat(vp.validate.errors),a=n.length)}else{let l={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.nodes.type,parentSchema:et.properties.nodes,data:c};n===null?n=[l]:n.push(l),a++}}for(let c in t)if(c!=="id"&&c!=="asset"&&c!=="role"&&c!=="label"&&c!=="sub"&&c!=="size"&&c!=="z"&&c!=="deco"&&c!=="ghost"&&c!=="face"&&c!=="facing"&&c!=="label-at"&&c!=="motion"&&c!=="variants"&&c!=="nodes"&&c!=="in"&&c!=="at"&&c!=="right-of"&&c!=="left-of"&&c!=="below"&&c!=="behind"&&c!=="gap"&&c!=="align"&&c!=="shift"&&c!=="appears"&&c!=="disappears"){let l={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:c},message:"must NOT have unevaluated properties",schema:!1,parentSchema:et,data:t};n===null?n=[l]:n.push(l),a++}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.type,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}return hs.errors=n,a===0}hs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Mp={validate:mr};function mr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=mr.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:Fe.required,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}if(t.kind===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'",schema:Fe.required,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}if(t.id!==void 0){let p=t.id;if(typeof p=="string"){if(!It.test(p)){let c={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kind!==void 0){let p=t.kind;if(!(p==="slab"||p==="pad"||p==="fence"||p==="vm"||p==="cloud"||p==="zone"||p==="platform"||p==="tunnel")){let c={instancePath:e+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Fe.properties.kind.enum},message:"must be equal to one of the allowed values",schema:Fe.properties.kind.enum,parentSchema:Fe.properties.kind,data:p};n===null?n=[c]:n.push(c),a++}}if(t.label!==void 0){let p=t.label;if(typeof p!="string"){let c={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Fe.properties.label.type,parentSchema:Fe.properties.label,data:p};n===null?n=[c]:n.push(c),a++}}if(t["label-style"]!==void 0){let p=t["label-style"];if(!(p==="face"||p==="face-right"||p==="floor"||p==="none")){let c={instancePath:e+"/label-style",schemaPath:"#/properties/label-style/enum",keyword:"enum",params:{allowedValues:Fe.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:Fe.properties["label-style"].enum,parentSchema:Fe.properties["label-style"],data:p};n===null?n=[c]:n.push(c),a++}}if(t.ghost!==void 0){let p=t.ghost;if(typeof p!="boolean"){let c={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Fe.properties.ghost.type,parentSchema:Fe.properties.ghost,data:p};n===null?n=[c]:n.push(c),a++}}if(t.role!==void 0){let p=t.role;if(typeof p!="string"){let c={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Fe.properties.role.type,parentSchema:Fe.properties.role,data:p};n===null?n=[c]:n.push(c),a++}}if(t.size!==void 0){let p=t.size;if(Array.isArray(p)){if(p.length>3){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}if(p.length<2){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:p};n===null?n=[c]:n.push(c),a++}}if(t.padding!==void 0){let p=t.padding;if(typeof p=="number"){if(p<0||isNaN(p)){let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Fe.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.padding.type,parentSchema:Fe.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}if(t.height!==void 0){let p=t.height;if(typeof p=="number"){if(p<=0||isNaN(p)){let c={instancePath:e+"/height",schemaPath:"#/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/height",schemaPath:"#/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.height.type,parentSchema:Fe.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}if(t.z!==void 0){let p=t.z;if(typeof p!="number"){let c={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.z.type,parentSchema:Fe.properties.z,data:p};n===null?n=[c]:n.push(c),a++}}if(t.flow!==void 0){let p=t.flow;if(!(p==="row"||p==="column")){let c={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:Fe.properties.flow.enum},message:"must be equal to one of the allowed values",schema:Fe.properties.flow.enum,parentSchema:Fe.properties.flow,data:p};n===null?n=[c]:n.push(c),a++}}if(t.gate!==void 0){let p=t.gate;if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.side===void 0){let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/required",keyword:"required",params:{missingProperty:"side"},message:"must have required property 'side'",schema:Fe.properties.gate.required,parentSchema:Fe.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="side"||c==="at"||c==="width"||c==="height"||c==="node")){let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Fe.properties.gate,data:p};n===null?n=[l]:n.push(l),a++}if(p.side!==void 0){let c=p.side;if(!(c==="n"||c==="e"||c==="s"||c==="w")){let l={instancePath:e+"/gate/side",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues:$p.enum},message:"must be equal to one of the allowed values",schema:$p.enum,parentSchema:$p,data:c};n===null?n=[l]:n.push(l),a++}}if(p.at!==void 0){let c=p.at;if(typeof c=="number"){if(c>1||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/maximum",keyword:"maximum",params:{comparison:"<=",limit:1},message:"must be <= 1",schema:1,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}if(c<0||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.at.type,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}if(p.width!==void 0){let c=p.width;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.width.type,parentSchema:Fe.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}if(p.height!==void 0){let c=p.height;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.height.type,parentSchema:Fe.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}if(p.node!==void 0){let c=p.node;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Fe.properties.gate.type,parentSchema:Fe.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}}if(t.around!==void 0){let p=t.around;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.around.type,parentSchema:Fe.properties.around,data:p};n===null?n=[c]:n.push(c),a++}}if(t.regions!==void 0){let p=t.regions;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)Mp.validate(p[l],{instancePath:e+"/regions/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?Mp.validate.errors:n.concat(Mp.validate.errors),a=n.length)}else{let c={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.regions.type,parentSchema:Fe.properties.regions,data:p};n===null?n=[c]:n.push(c),a++}}if(t.motion!==void 0){let p=t.motion;if(p&&typeof p=="object"&&!Array.isArray(p)){if(Object.keys(p).length<1){let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="style"||c==="out"||c==="easing"||c==="from"||c==="delay"||c==="duration")){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:p};n===null?n=[l]:n.push(l),a++}if(p.style!==void 0){let c=p.style;if(!(c==="edge"||c==="drop"||c==="rise"||c==="fly"||c==="pop"||c==="scatter"||c==="build"||c==="fade")){let l={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:c};n===null?n=[l]:n.push(l),a++}}if(p.out!==void 0){let c=p.out;if(!(c==="explode"||c==="lift-off"||c==="sink"||c==="scatter"||c==="fly-out"||c==="collapse"||c==="fade"||c==="reverse")){let l={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:c};n===null?n=[l]:n.push(l),a++}}if(p.easing!==void 0){let c=p.easing;if(!(c==="linear"||c==="ease"||c==="ease-in"||c==="ease-out"||c==="settle"||c==="spring"||c==="bounce")){let l={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:c};n===null?n=[l]:n.push(l),a++}}if(p.from!==void 0){let c=p.from;if(!(c==="left"||c==="right"||c==="top"||c==="bottom")){let l={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:c};n===null?n=[l]:n.push(l),a++}}if(p.delay!==void 0){let c=p.delay;if(typeof c=="number"){if(c<0||isNaN(c)){let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}if(p.duration!==void 0){let c=p.duration;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let p=t.nodes;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)hs(p[l],{instancePath:e+"/nodes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let c={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.nodes.type,parentSchema:Fe.properties.nodes,data:p};n===null?n=[c]:n.push(c),a++}}for(let p in t)if(p!=="id"&&p!=="kind"&&p!=="label"&&p!=="label-style"&&p!=="ghost"&&p!=="role"&&p!=="size"&&p!=="padding"&&p!=="height"&&p!=="z"&&p!=="flow"&&p!=="gate"&&p!=="around"&&p!=="regions"&&p!=="motion"&&p!=="variants"&&p!=="nodes"&&p!=="in"&&p!=="at"&&p!=="right-of"&&p!=="left-of"&&p!=="below"&&p!=="behind"&&p!=="gap"&&p!=="align"&&p!=="shift"&&p!=="appears"&&p!=="disappears"){let c={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:p},message:"must NOT have unevaluated properties",schema:!1,parentSchema:Fe,data:t};n===null?n=[c]:n.push(c),a++}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Fe.type,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}return mr.errors=n,a===0}mr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var je={type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Os={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},Pp=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function ti(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ti.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.from===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.to===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}for(let m in t)if(!po.call(je.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:je,data:t};n===null?n=[h]:n.push(h),a++}if(t.id!==void 0){let m=t.id;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}if(t.from!==void 0){let m=t.from;if(typeof m=="string"){if(!Pp.test(m)){let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.to!==void 0){let m=t.to;if(typeof m=="string"){if(!Pp.test(m)){let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.kind.type,parentSchema:je.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.via!==void 0){let m=t.via;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(Array.isArray(g)){if(g.length>2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let v=g[$];if(typeof v!="number"){let O={instancePath:e+"/via/"+y+"/"+$,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:v};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(typeof g=="string"){if(!Pp.test(g)){let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/via/"+y,schemaPath:"#/properties/via/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.via.items.anyOf,parentSchema:je.properties.via.items,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/via",schemaPath:"#/properties/via/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.via.type,parentSchema:je.properties.via,data:m};n===null?n=[h]:n.push(h),a++}}if(t.points!==void 0){let m=t.points;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y];if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/points/"+y+"/"+u,schemaPath:"#/properties/points/items/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.points.items.items.type,parentSchema:je.properties.points.items.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.items.type,parentSchema:je.properties.points.items,data:g};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.type,parentSchema:je.properties.points,data:m};n===null?n=[h]:n.push(h),a++}}if(t.lane!==void 0){let m=t.lane;if(typeof m!="number"){let h={instancePath:e+"/lane",schemaPath:"#/properties/lane/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.lane.type,parentSchema:je.properties.lane,data:m};n===null?n=[h]:n.push(h),a++}}if(t.arrow!==void 0){let m=t.arrow;if(typeof m!="boolean"){let h={instancePath:e+"/arrow",schemaPath:"#/properties/arrow/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.arrow.type,parentSchema:je.properties.arrow,data:m};n===null?n=[h]:n.push(h),a++}}if(t.cross!==void 0){let m=t.cross;if(typeof m!="boolean"){let h={instancePath:e+"/cross",schemaPath:"#/properties/cross/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.cross.type,parentSchema:je.properties.cross,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[0].type,parentSchema:je.properties.label.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;y=y||c;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(m.text===void 0){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:je.properties.label.anyOf[1].required,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="text"||u==="along"||u==="side"||u==="at"||u==="dir"||u==="anchor")){let b={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.text!==void 0){let u=m.text;if(typeof u!="string"){let b={instancePath:e+"/label/text",schemaPath:"#/properties/label/anyOf/1/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[1].properties.text.type,parentSchema:je.properties.label.anyOf[1].properties.text,data:u};n===null?n=[b]:n.push(b),a++}}if(m.along!==void 0){let u=m.along;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:je.properties.label.anyOf[1].properties.along.type,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"&&(u<1||isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}}if(m.side!==void 0){let u=m.side;if(!(u==="left"||u==="right")){let b={instancePath:e+"/label/side",schemaPath:"#/properties/label/anyOf/1/properties/side/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.side.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.side.enum,parentSchema:je.properties.label.anyOf[1].properties.side,data:u};n===null?n=[b]:n.push(b),a++}}if(m.at!==void 0){let u=m.at;if(Array.isArray(u)){if(u.length>3){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}if(u.length<2){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}let b=u.length;for(let x=0;x<b;x++){let w=u[x];if(typeof w!="number"){let $={instancePath:e+"/label/at/"+x,schemaPath:"#/properties/label/anyOf/1/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.label.anyOf[1].properties.at.items.type,parentSchema:je.properties.label.anyOf[1].properties.at.items,data:w};n===null?n=[$]:n.push($),a++}}}else{let b={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.label.anyOf[1].properties.at.type,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[b]:n.push(b),a++}}if(m.dir!==void 0){let u=m.dir;if(!(u==="x"||u==="y")){let b={instancePath:e+"/label/dir",schemaPath:"#/properties/label/anyOf/1/properties/dir/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.dir.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.dir.enum,parentSchema:je.properties.label.anyOf[1].properties.dir,data:u};n===null?n=[b]:n.push(b),a++}}if(m.anchor!==void 0){let u=m.anchor;if(!(u==="start"||u==="middle"||u==="end")){let b={instancePath:e+"/label/anchor",schemaPath:"#/properties/label/anyOf/1/properties/anchor/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.anchor.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.anchor.enum,parentSchema:je.properties.label.anyOf[1].properties.anchor,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.properties.label.anyOf[1].type,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.label.anyOf,parentSchema:je.properties.label,data:m};n===null?n=[u]:n.push(u),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.type,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}return ti.errors=n,a===0}ti.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var ot={type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}};function ni(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ni.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){for(let m in t)if(!po.call(ot.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:ot,data:t};n===null?n=[h]:n.push(h),a++}if(t.floor!==void 0){let m=t.floor;if(typeof m!="string"){let h={instancePath:e+"/floor",schemaPath:"#/properties/floor/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.floor.type,parentSchema:ot.properties.floor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.face!==void 0){let m=t.face;if(typeof m!="string"){let h={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.face.type,parentSchema:ot.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label;if(typeof m!="string"){let h={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.label.type,parentSchema:ot.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(t.sub!==void 0){let m=t.sub;if(typeof m!="string"){let h={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.sub.type,parentSchema:ot.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(t.at!==void 0){let m=t.at,h=a,y=!1,g=a;if(Array.isArray(m)){if(m.length>2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}if(m.length<2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;if(y=y||c,c)var p=!0;let k=a;if(Array.isArray(m)){if(m.length>3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.length<3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:3},message:"must NOT have fewer than 3 items",schema:3,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.at.anyOf[1].items.type,parentSchema:ot.properties.at.anyOf[1].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ot.properties.at.anyOf[1].type,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,c&&p!==!0&&(p=!0),y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ot.properties.at.anyOf,parentSchema:ot.properties.at,data:m};n===null?n=[u]:n.push(u),a++}}if(t.on!==void 0){let m=t.on;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.kind.type,parentSchema:ot.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dir!==void 0){let m=t.dir;if(!(m==="x"||m==="y")){let h={instancePath:e+"/dir",schemaPath:"#/properties/dir/enum",keyword:"enum",params:{allowedValues:ot.properties.dir.enum},message:"must be equal to one of the allowed values",schema:ot.properties.dir.enum,parentSchema:ot.properties.dir,data:m};n===null?n=[h]:n.push(h),a++}}if(t.anchor!==void 0){let m=t.anchor;if(!(m==="start"||m==="middle"||m==="end")){let h={instancePath:e+"/anchor",schemaPath:"#/properties/anchor/enum",keyword:"enum",params:{allowedValues:ot.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:ot.properties.anchor.enum,parentSchema:ot.properties.anchor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dx!==void 0){let m=t.dx;if(typeof m!="number"){let h={instancePath:e+"/dx",schemaPath:"#/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.dx.type,parentSchema:ot.properties.dx,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dy!==void 0){let m=t.dy;if(typeof m!="number"){let h={instancePath:e+"/dy",schemaPath:"#/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.dy.type,parentSchema:ot.properties.dy,data:m};n===null?n=[h]:n.push(h),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.type,parentSchema:ot,data:t};n===null?n=[m]:n.push(m),a++}return ni.errors=n,a===0}ni.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var we={type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}},vl={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},Ft={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function si(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=si.evaluated;f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0);let p=a,c=!1,l=a,d=a,m=!1,h=a;if(typeof t!="string"){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:t};n===null?n=[$]:n.push($),a++}var g=h===a;m=m||g;let y=a;if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length>1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}if(Object.keys(t).length<1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}for(let $ in t){let v=t[$];if(typeof v!="string"){let O={instancePath:e+"/"+$.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:v};n===null?n=[O]:n.push(O),a++}}}else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var g=y===a;if(m=m||g,g)var k=!0;if(m)a=d,n!==null&&(d?n.length=d:n=null);else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:t};n===null?n=[$]:n.push($),a++}var x=l===a;c=c||x;let u=a;if(Array.isArray(t)){let $=t.length;for(let v=0;v<$;v++){let O=t[v],C=a,A=!1,R=a;if(typeof O!="string"){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:O};n===null?n=[T]:n.push(T),a++}var b=R===a;A=A||b;let M=a;if(O&&typeof O=="object"&&!Array.isArray(O)){if(Object.keys(O).length>1){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}if(Object.keys(O).length<1){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}for(let T in O){let S=O[T];if(typeof S!="string"){let N={instancePath:e+"/"+v+"/"+T.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:S};n===null?n=[N]:n.push(N),a++}}}else{let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}var b=M===a;if(A=A||b,A)a=C,n!==null&&(C?n.length=C:n=null);else{let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:O};n===null?n=[T]:n.push(T),a++}}}else{let $={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:vl.anyOf[1].type,parentSchema:vl.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var x=u===a;if(c=c||x,x)var w=!0;if(c)a=p,n!==null&&(p?n.length=p:n=null);else{let $={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:vl.anyOf,parentSchema:vl,data:t};n===null?n=[$]:n.push($),a++}return si.errors=n,f.props=k,f.items=w,a===0}si.evaluated={dynamicProps:!0,dynamicItems:!0};function ri(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ri.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.heading===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:we.required,parentSchema:we,data:t};n===null?n=[d]:n.push(d),a++}for(let d in t)if(!po.call(we.properties,d)){let m={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:we,data:t};n===null?n=[m]:n.push(m),a++}if(t.id!==void 0){let d=t.id;if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}if(t.number!==void 0){let d=t.number;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.properties.number.type,parentSchema:we.properties.number,data:d};n===null?n=[m]:n.push(m),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.properties.number,data:d};n===null?n=[m]:n.push(m),a++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let m={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.kind.type,parentSchema:we.properties.kind,data:d};n===null?n=[m]:n.push(m),a++}}if(t.heading!==void 0){let d=t.heading;if(typeof d!="string"){let m={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.heading.type,parentSchema:we.properties.heading,data:d};n===null?n=[m]:n.push(m),a++}}if(t.caption!==void 0){let d=t.caption;if(typeof d!="string"){let m={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.caption.type,parentSchema:we.properties.caption,data:d};n===null?n=[m]:n.push(m),a++}}if(t.command!==void 0){let d=t.command;if(typeof d!="string"){let m={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.command.type,parentSchema:we.properties.command,data:d};n===null?n=[m]:n.push(m),a++}}if(t.animate!==void 0){let d=t.animate;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++)si(d[h],{instancePath:e+"/animate/"+h,parentData:d,parentDataProperty:h,rootData:i,dynamicAnchors:o})||(n=n===null?si.errors:n.concat(si.errors),a=n.length)}else{let m={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.animate.type,parentSchema:we.properties.animate,data:d};n===null?n=[m]:n.push(m),a++}}if(t.pulse!==void 0){let d=t.pulse;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.pulse.type,parentSchema:we.properties.pulse,data:d};n===null?n=[m]:n.push(m),a++}}if(t.highlight!==void 0){let d=t.highlight;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.highlight.type,parentSchema:we.properties.highlight,data:d};n===null?n=[m]:n.push(m),a++}}if(t.focus!==void 0){let d=t.focus;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.focus.type,parentSchema:we.properties.focus,data:d};n===null?n=[m]:n.push(m),a++}}if(t.show!==void 0){let d=t.show;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.show.type,parentSchema:we.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(t.hide!==void 0){let d=t.hide;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.hide.type,parentSchema:we.properties.hide,data:d};n===null?n=[m]:n.push(m),a++}}if(t.say!==void 0){let d=t.say;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.at===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:we.properties.say.items.required,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}if(y.text===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:we.properties.say.items.required,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}for(let g in y)if(!(g==="at"||g==="text"||g==="kind"||g==="dx"||g==="dy"||g==="anchor")){let k={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:we.properties.say.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.at!==void 0){let g=y.at,k=a,u=!1,b=a;if(typeof g=="string"){if(!It.test(g)){let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(Array.isArray(g)){if(g.length>3){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let v=g[$];if(typeof v!="number"){let O={instancePath:e+"/say/"+h+"/at/"+$,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:we.properties.say.items.properties.at.anyOf[1].items,data:v};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.say.items.properties.at.anyOf[1].type,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.say.items.properties.at.anyOf,parentSchema:we.properties.say.items.properties.at,data:g};n===null?n=[w]:n.push(w),a++}}if(y.text!==void 0){let g=y.text;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.say.items.properties.text.type,parentSchema:we.properties.say.items.properties.text,data:g};n===null?n=[k]:n.push(k),a++}}if(y.kind!==void 0){let g=y.kind;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.say.items.properties.kind.type,parentSchema:we.properties.say.items.properties.kind,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dx!==void 0){let g=y.dx;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.dx.type,parentSchema:we.properties.say.items.properties.dx,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dy!==void 0){let g=y.dy;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.dy.type,parentSchema:we.properties.say.items.properties.dy,data:g};n===null?n=[k]:n.push(k),a++}}if(y.anchor!==void 0){let g=y.anchor;if(!(g==="start"||g==="middle"||g==="end")){let k={instancePath:e+"/say/"+h+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:we.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:we.properties.say.items.properties.anchor.enum,parentSchema:we.properties.say.items.properties.anchor,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.properties.say.items.type,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.say.type,parentSchema:we.properties.say,data:d};n===null?n=[m]:n.push(m),a++}}if(t.mark!==void 0){let d=t.mark;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){for(let g in y)if(!(g==="on"||g==="at")){let k={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:we.properties.mark.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.on!==void 0){let g=y.on;if(typeof g=="string"){if(!It.test(g)){let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:g};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:g};n===null?n=[k]:n.push(k),a++}}if(y.at!==void 0){let g=y.at;if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/mark/"+h+"/at/"+u,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.mark.items.properties.at.items.type,parentSchema:we.properties.mark.items.properties.at.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.mark.items.properties.at.type,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.properties.mark.items.type,parentSchema:we.properties.mark.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.mark.type,parentSchema:we.properties.mark,data:d};n===null?n=[m]:n.push(m),a++}}if(t.badge!==void 0){let d=t.badge,m=a,h=!1,y=a;if(typeof d!="boolean"){let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:we.properties.badge.anyOf[0].type,parentSchema:we.properties.badge.anyOf[0],data:d};n===null?n=[u]:n.push(u),a++}var c=y===a;h=h||c;let g=a;if(typeof d=="string"){if(!It.test(d)){let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[u]:n.push(u),a++}var c=g===a;h=h||c;let k=a;if(Array.isArray(d)){if(d.length>3){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}if(d.length<2){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}let u=d.length;for(let b=0;b<u;b++){let x=d[b];if(typeof x!="number"){let w={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.badge.anyOf[2].items.type,parentSchema:we.properties.badge.anyOf[2].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.badge.anyOf[2].type,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[u]:n.push(u),a++}var c=k===a;if(h=h||c,h)a=m,n!==null&&(m?n.length=m:n=null);else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.badge.anyOf,parentSchema:we.properties.badge,data:d};n===null?n=[u]:n.push(u),a++}}if(t.duration!==void 0){let d=t.duration,m=a,h=!1,y=a;if(d!=="auto"){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/0/const",keyword:"const",params:{allowedValue:"auto"},message:"must be equal to constant",schema:"auto",parentSchema:we.properties.duration.anyOf[0],data:d};n===null?n=[k]:n.push(k),a++}var l=y===a;h=h||l;let g=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.properties.duration.anyOf[1].type,parentSchema:we.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}if(typeof d=="number"&&(d<500||isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:500},message:"must be >= 500",schema:500,parentSchema:we.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}var l=g===a;if(h=h||l,h)a=m,n!==null&&(m?n.length=m:n=null);else{let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.duration.anyOf,parentSchema:we.properties.duration,data:d};n===null?n=[k]:n.push(k),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.type,parentSchema:we,data:t};n===null?n=[d]:n.push(d),a++}return ri.errors=n,a===0}ri.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ii(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ii.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:ve.required,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}if(t.title===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'",schema:ve.required,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t)if(!po.call(ve.properties,l)){let d={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:ve,data:t};n===null?n=[d]:n.push(d),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.title!==void 0){let l=t.title;if(typeof l!="string"){let d={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.title.type,parentSchema:ve.properties.title,data:l};n===null?n=[d]:n.push(d),a++}}if(t.ants!==void 0){let l=t.ants,d=a,m=!1,h=a;if(typeof l!="boolean"){let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.ants.anyOf[0].type,parentSchema:ve.properties.ants.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var p=h===a;m=m||p;let y=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/ants/"+u,schemaPath:"#/properties/ants/anyOf/1/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.ants.anyOf[1].items.type,parentSchema:ve.properties.ants.anyOf[1].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[1].type,parentSchema:ve.properties.ants.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var p=y===a;m=m||p;let g=a;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let k in l)if(!(k==="ids"||k==="speed"||k==="dash")){let u={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties",schema:!1,parentSchema:ve.properties.ants.anyOf[2],data:l};n===null?n=[u]:n.push(u),a++}if(l.ids!==void 0){let k=l.ids;if(Array.isArray(k)){let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x!="string"){let w={instancePath:e+"/ants/ids/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/ids/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.ants.anyOf[2].properties.ids.items.type,parentSchema:ve.properties.ants.anyOf[2].properties.ids.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/ids",schemaPath:"#/properties/ants/anyOf/2/properties/ids/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[2].properties.ids.type,parentSchema:ve.properties.ants.anyOf[2].properties.ids,data:k};n===null?n=[u]:n.push(u),a++}}if(l.speed!==void 0){let k=l.speed;if(typeof k!="number"){let u={instancePath:e+"/ants/speed",schemaPath:"#/properties/ants/anyOf/2/properties/speed/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.ants.anyOf[2].properties.speed.type,parentSchema:ve.properties.ants.anyOf[2].properties.speed,data:k};n===null?n=[u]:n.push(u),a++}}if(l.dash!==void 0){let k=l.dash;if(Array.isArray(k)){if(k.length>2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}if(k.length<2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x=="number"){if(x<=0||isNaN(x)){let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:ve.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.ants.anyOf[2].properties.dash.items.type,parentSchema:ve.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[2].properties.dash.type,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[u]:n.push(u),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.properties.ants.anyOf[2].type,parentSchema:ve.properties.ants.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var p=g===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ve.properties.ants.anyOf,parentSchema:ve.properties.ants,data:l};n===null?n=[k]:n.push(k),a++}}if(t.motion!==void 0){let l=t.motion;if(!(l&&typeof l=="object"&&!Array.isArray(l))){let d={instancePath:e+"/motion",schemaPath:"#/properties/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.properties.motion.type,parentSchema:ve.properties.motion,data:l};n===null?n=[d]:n.push(d),a++}}if(t.caption!==void 0){let l=t.caption;if(typeof l!="string"){let d={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.caption.type,parentSchema:ve.properties.caption,data:l};n===null?n=[d]:n.push(d),a++}}if(t.aria!==void 0){let l=t.aria;if(typeof l!="string"){let d={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.aria.type,parentSchema:ve.properties.aria,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:ve.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.gap.type,parentSchema:ve.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.flow!==void 0){let l=t.flow;if(!(l==="row"||l==="column")){let d={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:ve.properties.flow.enum},message:"must be equal to one of the allowed values",schema:ve.properties.flow.enum,parentSchema:ve.properties.flow,data:l};n===null?n=[d]:n.push(d),a++}}if(t.regions!==void 0){let l=t.regions;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)mr(l[m],{instancePath:e+"/regions/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?mr.errors:n.concat(mr.errors),a=n.length)}else{let d={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.regions.type,parentSchema:ve.properties.regions,data:l};n===null?n=[d]:n.push(d),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)hs(l[m],{instancePath:e+"/nodes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let d={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.nodes.type,parentSchema:ve.properties.nodes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.routes!==void 0){let l=t.routes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ti(l[m],{instancePath:e+"/routes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ti.errors:n.concat(ti.errors),a=n.length)}else{let d={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.routes.type,parentSchema:ve.properties.routes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.notes!==void 0){let l=t.notes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ni(l[m],{instancePath:e+"/notes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ni.errors:n.concat(ni.errors),a=n.length)}else{let d={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.notes.type,parentSchema:ve.properties.notes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.steps!==void 0){let l=t.steps;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ri(l[m],{instancePath:e+"/steps/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ri.errors:n.concat(ri.errors),a=n.length)}else{let d={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.steps.type,parentSchema:ve.properties.steps,data:l};n===null?n=[d]:n.push(d),a++}}if(t.legend!==void 0){let l=t.legend,d=a,m=!1,h=a;if(l!=="auto"){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:ve.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:ve.properties.legend.anyOf[0].enum,parentSchema:ve.properties.legend.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var c=h===a;m=m||c;let y=a;if(l!==!1){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/1/const",keyword:"const",params:{allowedValue:!1},message:"must be equal to constant",schema:!1,parentSchema:ve.properties.legend.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var c=y===a;m=m||c;let g=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/legend/"+u,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.legend.anyOf[2].items.type,parentSchema:ve.properties.legend.anyOf[2].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.legend.anyOf[2].type,parentSchema:ve.properties.legend.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var c=g===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ve.properties.legend.anyOf,parentSchema:ve.properties.legend,data:l};n===null?n=[k]:n.push(k),a++}}if(t.badges!==void 0){let l=t.badges;if(typeof l!="boolean"){let d={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.badges.type,parentSchema:ve.properties.badges,data:l};n===null?n=[d]:n.push(d),a++}}if(t.grid!==void 0){let l=t.grid;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="snap"||d==="show"||d==="step")){let m={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:l};n===null?n=[m]:n.push(m),a++}if(l.snap!==void 0){let d=l.snap;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}if(l.show!==void 0){let d=l.show;if(typeof d!="boolean"){let m={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(l.step!==void 0){let d=l.step;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.assemble!==void 0){let l=t.assemble;if(typeof l!="boolean"){let d={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.assemble.type,parentSchema:ve.properties.assemble,data:l};n===null?n=[d]:n.push(d),a++}}if(t.loop!==void 0){let l=t.loop;if(typeof l!="boolean"){let d={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.loop.type,parentSchema:ve.properties.loop,data:l};n===null?n=[d]:n.push(d),a++}}if(t.dim!==void 0){let l=t.dim;if(!(l==="flows"||l==="all")){let d={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:ve.properties.dim.enum},message:"must be equal to one of the allowed values",schema:ve.properties.dim.enum,parentSchema:ve.properties.dim,data:l};n===null?n=[d]:n.push(d),a++}}if(t.after!==void 0){let l=t.after;if(typeof l!="string"){let d={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.after.type,parentSchema:ve.properties.after,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.type,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}return ii.errors=n,a===0}ii.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Ml(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=Ml.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.isodiag===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"isodiag"},message:"must have required property 'isodiag'",schema:rt.required,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}if(t.scenes===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scenes"},message:"must have required property 'scenes'",schema:rt.required,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}for(let p in t)if(!po.call(rt.properties,p)){let c={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:rt,data:t};n===null?n=[c]:n.push(c),a++}if(t.isodiag!==void 0){let p=t.isodiag;if(p!==1){let c={instancePath:e+"/isodiag",schemaPath:"#/properties/isodiag/const",keyword:"const",params:{allowedValue:1},message:"must be equal to constant",schema:1,parentSchema:rt.properties.isodiag,data:p};n===null?n=[c]:n.push(c),a++}}if(t.title!==void 0){let p=t.title;if(typeof p!="string"){let c={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.title.type,parentSchema:rt.properties.title,data:p};n===null?n=[c]:n.push(c),a++}}if(t.lede!==void 0){let p=t.lede;if(typeof p!="string"){let c={instancePath:e+"/lede",schemaPath:"#/properties/lede/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.lede.type,parentSchema:rt.properties.lede,data:p};n===null?n=[c]:n.push(c),a++}}if(t.pills!==void 0){let p=t.pills;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d!="string"){let m={instancePath:e+"/pills/"+l,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.pills.items.type,parentSchema:rt.properties.pills.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:rt.properties.pills.type,parentSchema:rt.properties.pills,data:p};n===null?n=[c]:n.push(c),a++}}if(t.theme!==void 0){let p=t.theme;if(typeof p!="string"){let c={instancePath:e+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.theme.type,parentSchema:rt.properties.theme,data:p};n===null?n=[c]:n.push(c),a++}}if(t.roles!==void 0){let p=t.roles;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){if(l.h===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"h"},message:"must have required property 'h'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}if(l.s===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"s"},message:"must have required property 's'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}for(let d in l)if(!(d==="h"||d==="s"||d==="top"||d==="tint")){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Lt,data:l};n===null?n=[m]:n.push(m),a++}if(l.h!==void 0){let d=l.h;if(typeof d=="number"){if(d>360||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/maximum",keyword:"maximum",params:{comparison:"<=",limit:360},message:"must be <= 360",schema:360,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.h.type,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}if(l.s!==void 0){let d=l.s;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.s.type,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}if(l.top!==void 0){let d=l.top;if(typeof d!="string"){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/top",schemaPath:"#/$defs/role/properties/top/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Lt.properties.top.type,parentSchema:Lt.properties.top,data:d};n===null?n=[m]:n.push(m),a++}}if(l.tint!==void 0){let d=l.tint;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.tint.type,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Lt.type,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.properties.roles.type,parentSchema:rt.properties.roles,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kinds!==void 0){let p=t.kinds;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="legend"||d==="like"||d==="color"||d==="dash")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Ln,data:l};n===null?n=[m]:n.push(m),a++}if(l.legend!==void 0){let d=l.legend;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/legend",schemaPath:"#/$defs/kindDef/properties/legend/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ln.properties.legend.type,parentSchema:Ln.properties.legend,data:d};n===null?n=[m]:n.push(m),a++}}if(l.like!==void 0){let d=l.like;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/like",schemaPath:"#/$defs/kindDef/properties/like/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ln.properties.like.type,parentSchema:Ln.properties.like,data:d};n===null?n=[m]:n.push(m),a++}}if(l.color!==void 0){let d=l.color;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/color",schemaPath:"#/$defs/kindDef/properties/color/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ln.properties.color.type,parentSchema:Ln.properties.color,data:d};n===null?n=[m]:n.push(m),a++}}if(l.dash!==void 0){let d=l.dash;if(!(d==="solid"||d==="dashed"||d==="dotted")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:Ln.properties.dash.enum},message:"must be equal to one of the allowed values",schema:Ln.properties.dash.enum,parentSchema:Ln.properties.dash,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ln.type,parentSchema:Ln,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.properties.kinds.type,parentSchema:rt.properties.kinds,data:p};n===null?n=[c]:n.push(c),a++}}if(t.after!==void 0){let p=t.after;if(typeof p!="string"){let c={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.after.type,parentSchema:rt.properties.after,data:p};n===null?n=[c]:n.push(c),a++}}if(t.grid!==void 0){let p=t.grid;if(p&&typeof p=="object"&&!Array.isArray(p)){for(let c in p)if(!(c==="snap"||c==="show"||c==="step")){let l={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:p};n===null?n=[l]:n.push(l),a++}if(p.snap!==void 0){let c=p.snap;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}if(p.show!==void 0){let c=p.show;if(typeof c!="boolean"){let l={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:c};n===null?n=[l]:n.push(l),a++}}if(p.step!==void 0){let c=p.step;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:p};n===null?n=[c]:n.push(c),a++}}if(t.assemble!==void 0){let p=t.assemble;if(typeof p!="boolean"){let c={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:rt.properties.assemble.type,parentSchema:rt.properties.assemble,data:p};n===null?n=[c]:n.push(c),a++}}if(t.footer!==void 0){let p=t.footer;if(typeof p!="string"){let c={instancePath:e+"/footer",schemaPath:"#/properties/footer/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.footer.type,parentSchema:rt.properties.footer,data:p};n===null?n=[c]:n.push(c),a++}}if(t.treatment!==void 0){let p=t.treatment;if(p!=="mono"){let c={instancePath:e+"/treatment",schemaPath:"#/properties/treatment/enum",keyword:"enum",params:{allowedValues:rt.properties.treatment.enum},message:"must be equal to one of the allowed values",schema:rt.properties.treatment.enum,parentSchema:rt.properties.treatment,data:p};n===null?n=[c]:n.push(c),a++}}if(t.scenes!==void 0){let p=t.scenes;if(Array.isArray(p)){if(p.length<1){let l={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:rt.properties.scenes,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++)ii(p[l],{instancePath:e+"/scenes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?ii.errors:n.concat(ii.errors),a=n.length)}else{let c={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:rt.properties.scenes.type,parentSchema:rt.properties.scenes,data:p};n===null?n=[c]:n.push(c),a++}}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.type,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}return Ml.errors=n,a===0}Ml.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Ay(t){let e=JSON.stringify(t),s=2166136261;for(let r=0;r<e.length;r++)s^=e.charCodeAt(r),s=Math.imul(s,16777619)>>>0;return s.toString(16)+":"+e.length}var Ty=new Map([["28016100:13106",Nm]]);function Op(t){let e=Ty.get(Ay(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var Ap={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}};var Ep=[];function Rm(t){Ep.includes(t)||Ep.push(t)}function Tp(t){for(let e of Ep){let s=e(t);if(s!==void 0)return s}return t?"this item":"the file"}function Ol(t){return t===null?"nothing":Array.isArray(t)?"a list":typeof t=="object"?"a map":typeof t=="string"?`the text "${t}"`:`${typeof t} ${String(t)}`}var Im={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},fo=new Map;function zm(t,e){fo.set(t,e)}var Np=new Map;function Cm(t,e){Np.set(t,(s,r)=>e(Ol(s),r))}var Rp=[];function jm(t,e){Rp.some(([s])=>s===t)||Rp.push([t,e])}function Ny(t){let e=t.parentSchema,s=Object.keys(e?.properties??{});e?.$ref&&fo.has(e.$ref)&&s.push(...fo.get(e.$ref).filter(r=>!s.includes(r)));for(let r of e?.allOf??[])r.$ref&&fo.has(r.$ref)&&s.push(...fo.get(r.$ref));return s}function Pl(t,e){let s=t.propertyName??(t.keyword==="propertyNames"?t.params.propertyName:void 0);if(s!==void 0){let f=`${t.instancePath}/${s.replace(/~/g,"~0").replace(/\//g,"~1")}`,p=e.locate(f,{key:!0});return{severity:"error",message:`"${s}" can't be a name`,line:p.line,col:p.col,path:f,hint:"names are a lower-case letter, then lower-case letters, digits and -"}}let r=t.instancePath,i=t.message??"is not valid",o,n=e.locate(r),a=t.params;switch(t.keyword){case"required":i=`${Tp(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let p=String(a.additionalProperty??a.unevaluatedProperty),c=Ny(t),l=Vt(p,c);return i=`unknown key "${p}" in ${Tp(r)}`+(l?` (did you mean "${l}"?)`:""),!l&&c.length&&(o=`known keys: ${c.join(", ")}`),/\s/.test(p)&&(o='inside { \u2026 } a comma starts a new key: put text with commas in quotes, e.g. label: "read once, at launch"'),n=e.locate(`${r}/${p}`,{key:!0}),{severity:"error",message:i,line:n.line,col:n.col,path:`${r}/${p}`,hint:o}}case"enum":{let p=a.allowedValues.map(String),c=typeof t.data=="string"?Vt(t.data,p):void 0,l=r.split("/").pop();i=`${Ol(t.data)} is not a valid ${l&&!/^\d+$/.test(l)?`"${l}"`:"value"}`+(c?` (did you mean "${c}"?)`:""),o=`expected one of: ${p.join(", ")}`;break}case"const":i=Np.has(r)?Np.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${Im[String(a.type)]??a.type}, got ${Ol(t.data)}`;break;case"pattern":let f=Rp.find(([p])=>String(a.pattern).startsWith(p));f?{message:i,hint:o}=f[1](t.data):(i=`"${t.data}" is not a valid id`,o="ids start with a letter and use only letters, digits, - and _");break;case"minItems":case"maxItems":t.schema===2||t.parentSchema?.minItems===2?i=`expected a list of ${t.parentSchema.minItems===t.parentSchema.maxItems?t.parentSchema.minItems:`${t.parentSchema.minItems} to ${t.parentSchema.maxItems}`} numbers, got ${t.data.length}`:i=`list ${t.message}`;break;case"false schema":{let p=r.split("/").pop()??"",c=r.split("/").slice(0,-1).join("/");i=`"${p.replace(/~1/g,"/").replace(/~0/g,"~")}" can't be set on ${Tp(c)}`,n=e.locate(r,{key:!0});break}case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":i=`${t.data} is out of range: ${t.message}`;break}return{severity:"error",message:i,line:n.line,col:n.col,path:r,hint:o}}function Lm(t,e){let s=t.filter(n=>n.keyword==="anyOf"),r=new Set,i=[];for(let n of s){let a=n.schemaPath.replace(/\/anyOf$/,"/anyOf/"),f=t.filter(l=>l!==n&&l.schemaPath.startsWith(a)&&l.instancePath.startsWith(n.instancePath));if(f.forEach(l=>r.add(l)),r.add(n),s.some(l=>l!==n&&n.schemaPath.startsWith(l.schemaPath.replace(/\/anyOf$/,"/anyOf/"))&&l.instancePath===n.instancePath))continue;let p=f.filter(l=>l.instancePath.length>n.instancePath.length&&l.keyword!=="anyOf"),c=f.find(l=>l.keyword==="enum"&&l.instancePath===n.instancePath&&typeof n.data=="string");if(c)i.push(Pl(c,e));else if(p.length)i.push(...p.map(l=>Pl(l,e)));else{let l=f.filter(d=>d.instancePath===n.instancePath&&d.keyword!=="type"&&d.keyword!=="anyOf");if(l.length&&typeof n.data=="object"&&n.data!==null)i.push(...l.map(d=>Pl(d,e)));else{let d=[...new Set(f.filter(h=>h.keyword==="type").map(h=>Im[String(h.params.type)]??""))].filter(Boolean),m=e.locate(n.instancePath);i.push({severity:"error",message:`${Ol(n.data)} is not allowed here`+(d.length?`; expected ${d.join(" or ")}`:""),line:m.line,col:m.col,path:n.instancePath})}}}for(let n of t)r.has(n)||i.push(Pl(n,e));let o=new Set;return i.filter(n=>{let a=`${n.path}|${n.message}`;return o.has(a)?!1:(o.add(a),!0)}).sort((n,a)=>n.line-a.line||n.col-a.col)}var _m=Op(Ap),Ry=Object.keys(Ap.$defs.placement.properties);zm("#/$defs/placement",Ry);Cm("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var Iy={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};Rm(t=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(t);return e?Iy[e[1].replace(/s$/,"")]??"this item":void 0});jm("^[A-Za-z][A-Za-z0-9_-]*(",t=>({message:`"${t}" is not a node reference`,hint:"write an id, optionally with a side: worker, worker.e (sides: n, e, s, w, top)"}));function Fm(t){return t.data==null||typeof t.data!="object"||Array.isArray(t.data)?[{severity:"error",message:'the file must be a YAML map with "isodiag: 1" and "scenes:"',line:1,col:1,path:""}]:_m(t.data)?[]:Lm(_m.errors??[],t)}var mo=class extends Error{diags;constructor(e){super(e.filter(s=>s.severity==="error").map(s=>`line ${s.line}: ${s.message}`).join(`
|
|
436
|
+
`)),this.name="CompileError",this.diags=e}};function Al(t,e,s={}){if(s.font&&!s.resolveVars)throw new Error("font: a self-contained drawing's (resolveVars)");let r=bo(s.font,()=>Cy(t,e,s)),i=s.font&&{sans:s.font.sans,mono:s.font.mono??Qi.mono};if(!r.ok&&s.strict==="throw")throw new mo(r.diags);if(!r.ok&&s.strict&&(r.scenes=[]),s.stepMs!==void 0)for(let a of r.scenes)for(let f of a.steps.steps)f.duration=s.stepMs;if(s.treatment!==void 0&&s.treatment!=="mono"&&s.treatment!=="none")throw new Error(`treatment: there is "mono" (and "none"), and no ${JSON.stringify(s.treatment)}`);let o=(s.treatment??r.doc?.treatment)==="mono";if(s.treatment==="mono"&&!s.resolveVars)throw new Error("treatment: a self-contained drawing's (resolveVars)");let n=r.theme;if(s.resolveVars)for(let a of r.scenes){let f=s.mode??"light",p=ar(ts)+eo+to;if(o){zy(a,n,f,p,s.mono,i);continue}let c={mode:f,theme:r.theme,css:p,fonts:i};a.rendered.svg=Zr(a.rendered.svg,c),a.rendered.variants&&(a.rendered.variants=Object.fromEntries(Object.entries(a.rendered.variants).map(([l,d])=>[l,Zr(d,c)]))),a.rendered.inks={surface:r.theme[c.mode].surface??r.theme.light.surface,control:r.theme[c.mode].control??r.theme.light.control,kinds:Object.fromEntries(Object.entries(r.theme.kinds).map(([l,d])=>[l,r.theme[c.mode][d.color]??d.color]))}}if(s.font)for(let a of r.scenes){let f=s.font.name,p=c=>c.replace("<svg ",`<svg data-font="${f.replace(/[^\w-]/g,"")}" `);a.rendered.svg=p(a.rendered.svg),a.rendered.variants&&(a.rendered.variants=Object.fromEntries(Object.entries(a.rendered.variants).map(([c,l])=>[c,p(l)])))}return s.resolveVars&&o&&n&&(r.theme={...n,kinds:Object.fromEntries(Object.entries(n.kinds).map(([a,f])=>{let p=r.scenes.map(c=>c.rendered.mono?.kinds[a]?.dash).find(c=>c&&c.length>1);return[a,p?{...f,ants:[p[0],p[1]]}:f]}))}),r}function zy(t,e,s,r,i,o){let n=[t.rendered.svg,...Object.values(t.rendered.variants??{})],a=Ua(n.join(""),e,s,[...t.routes.map(p=>p.kind),...t.steps.kindsUsed],i),f=p=>Za(Zr(p,{mode:s,theme:a.theme,css:r+a.css,fonts:o}),a.look,t.id);t.rendered.svg=f(t.rendered.svg),t.rendered.variants&&(t.rendered.variants=Object.fromEntries(Object.entries(t.rendered.variants).map(([p,c])=>[p,f(c)]))),t.rendered.inks={surface:a.look.paper,control:a.look.ink,kinds:Object.fromEntries(Object.keys(e.kinds).map(p=>[p,a.look.ink]))},t.rendered.mono=a.look;for(let p of a.look.warnings)t.rendered.warnings.push({path:"",message:`black and white: ${p}`})}function Cy(t,e,s){let r=ca(t),i=[...r.diags];if(i.some(c=>c.severity==="error"))return{ok:!1,diags:i,catalog:ts,scenes:[]};let o=Fm(r);i.push(...o);let n=r.data;if(o.length){try{let c=_s(Tr(e),n.roles??{},n.kinds??{}),l=o.map(d=>d.path);(Array.isArray(n.scenes)?n.scenes:[]).forEach((d,m)=>{try{let h=Nr(d,`/scenes/${m}`,r,c,ts,n.roles??{});i.push(...h.diags.filter(y=>!l.some(g=>y.path===g||y.path.startsWith(g+"/"))))}catch{}})}catch{}return i.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!1,diags:i,catalog:ts,scenes:[]}}let a=Wa(n,e,ts,r,t,{snap:s.snap},i),f=0,p=(c,l,d)=>{let m=r.locate(c);a.diags.push({severity:"error",message:l,line:m.line,col:m.col,path:c,...d?{hint:d}:{}}),f++};return a.scenes.forEach((c,l)=>{_a(c,a.theme);let d=c.raw.ants,m=Ss(c.raw)?.ids,h=c.routes.map(u=>u.id);if((m??[]).forEach((u,b)=>{h.includes(u)||p(`/scenes/${l}/ants${Array.isArray(d)?"":"/ids"}/${b}`,`no connector "${u}" in this scene`,h.length?`its connectors: ${h.slice(0,8).join(", ")}${h.length>8?", \u2026":""}`:void 0)}),!c.raw.motion)return;let y={isomotion:1,...c.raw.motion},g=`/scenes/${l}/motion`,k=vs(c,y,{kinds:a.theme.kinds}).diags;for(let u of k){let b=r.locate(g+u.path);a.diags.push({severity:u.severity,message:u.message,line:b.line,col:b.col,path:g+u.path,...u.hint?{hint:u.hint}:{}})}f+=k.length,k.length||(c.motion=y)}),f&&(a.ok=!1,a.diags.sort((c,l)=>c.line-l.line||c.col-l.col)),a}function Dm(t,e){let s=Al(t,e.theme,{mode:e.mode??"light",resolveVars:!0,strict:"throw",treatment:e.treatment,mono:e.mono}),r=s.theme.kinds,i=e.scene===void 0?s.scenes[0]:typeof e.scene=="number"?s.scenes[e.scene]:s.scenes.find(f=>f.id===e.scene);if(!i)throw new Error(`no scene ${JSON.stringify(e.scene)} (there ${s.scenes.length===1?"is":"are"} ${s.scenes.map(f=>f.id).join(", ")})`);let o=e.ants===void 0?Ss(i.raw):e.ants===!0?Ss(i.raw)??{}:e.ants||void 0;if(e.t===void 0)return o?Fa(i,{...o,by:e.ambient==="off"?"none":"smil",kinds:r}):i.rendered.svg;if(e.ants)throw new Error("ants: at a moment they are its motion document's");let n=e.motion??i.motion;if(!n)throw new Error("t: this scene has no motion");let a=vs(i,n,{kinds:r});if(!a.ok)throw new Error(a.diags.map(f=>`${f.path}: ${f.message}${f.hint?` (${f.hint})`:""}`).join(`
|
|
437
|
+
`));return Ki(i,a.at(e.t,e.ambient===void 0?{}:{ambient:e.ambient}))}export{Dd as core,zf as objects,Bm as systems,Pm as viewer};
|