@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.
Files changed (78) hide show
  1. package/README.md +3 -1
  2. package/iso-editor.js +230 -193
  3. package/iso-remotion.js +353 -0
  4. package/iso-render.js +184 -147
  5. package/iso-systems.js +183 -146
  6. package/isometric-diagram.js +389 -0
  7. package/js/iso-core/arimo.js +5 -0
  8. package/js/iso-core/arimo.json +1 -0
  9. package/js/iso-core/index.js +8 -2
  10. package/js/iso-core/kernel.js +13 -2
  11. package/js/iso-core/mono.js +242 -0
  12. package/js/iso-editor/ui/canvas.js +23 -1
  13. package/js/iso-objects/ants.js +1 -1
  14. package/js/iso-objects/index.js +10 -2
  15. package/js/iso-objects/mono-paint.js +96 -0
  16. package/js/iso-objects/motion-doc.js +0 -79
  17. package/js/iso-objects/motion-entry.js +4 -2
  18. package/js/iso-objects/motion-schema.js +83 -0
  19. package/js/iso-objects/motion.js +9 -4
  20. package/js/iso-objects/timeline.js +60 -16
  21. package/js/iso-systems/compile.js +34 -3
  22. package/js/iso-systems/render.js +1 -1
  23. package/js/iso-systems/schema.json +1 -0
  24. package/js/iso-viewer/index.js +6 -0
  25. package/js/iso-viewer/page.js +40 -17
  26. package/js/iso-viewer/play.js +340 -0
  27. package/js/iso-viewer/player.js +147 -162
  28. package/js/iso-viewer/transport.js +289 -0
  29. package/package.json +61 -2
  30. package/src/iso-core/arimo.json +1 -0
  31. package/src/iso-core/arimo.ts +6 -0
  32. package/src/iso-core/index.ts +2 -1
  33. package/src/iso-core/kernel.ts +11 -1
  34. package/src/iso-core/mono.ts +306 -0
  35. package/src/iso-core/theme.ts +2 -1
  36. package/src/iso-editor/ui/canvas.ts +14 -1
  37. package/src/iso-objects/ants.ts +2 -2
  38. package/src/iso-objects/index.ts +5 -3
  39. package/src/iso-objects/mono-paint.ts +97 -0
  40. package/src/iso-objects/motion-doc.ts +0 -52
  41. package/src/iso-objects/motion-entry.ts +4 -3
  42. package/src/iso-objects/motion-schema.ts +55 -0
  43. package/src/iso-objects/motion.ts +6 -5
  44. package/src/iso-objects/scene.ts +3 -0
  45. package/src/iso-objects/timeline.ts +71 -15
  46. package/src/iso-objects/types.ts +2 -0
  47. package/src/iso-systems/compile.ts +37 -4
  48. package/src/iso-systems/render.ts +5 -1
  49. package/src/iso-systems/schema.json +1 -0
  50. package/src/iso-viewer/index.ts +4 -0
  51. package/src/iso-viewer/page.ts +28 -12
  52. package/src/iso-viewer/play.ts +280 -0
  53. package/src/iso-viewer/player.ts +133 -134
  54. package/src/iso-viewer/transport.ts +272 -0
  55. package/types/iso-core/arimo.d.ts +2 -0
  56. package/types/iso-core/index.d.ts +2 -1
  57. package/types/iso-core/kernel.d.ts +9 -0
  58. package/types/iso-core/mono.d.ts +61 -0
  59. package/types/iso-core/theme.d.ts +2 -0
  60. package/types/iso-objects/ants.d.ts +1 -0
  61. package/types/iso-objects/index.d.ts +5 -3
  62. package/types/iso-objects/mono-paint.d.ts +20 -0
  63. package/types/iso-objects/motion-doc.d.ts +0 -594
  64. package/types/iso-objects/motion-entry.d.ts +4 -3
  65. package/types/iso-objects/motion-schema.d.ts +594 -0
  66. package/types/iso-objects/motion.d.ts +4 -2
  67. package/types/iso-objects/scene.d.ts +3 -0
  68. package/types/iso-objects/timeline.d.ts +26 -3
  69. package/types/iso-objects/types.d.ts +2 -0
  70. package/types/iso-systems/compile.d.ts +8 -0
  71. package/types/iso-systems/render.d.ts +4 -0
  72. package/types/iso-viewer/index.d.ts +4 -0
  73. package/types/iso-viewer/play.d.ts +37 -0
  74. package/types/iso-viewer/transport.d.ts +73 -0
  75. package/types/player/isometric-diagram.d.ts +24 -0
  76. package/types/remotion/entry.d.ts +2 -0
  77. package/types/remotion/frames.d.ts +70 -0
  78. package/types/remotion/index.d.ts +39 -0
@@ -0,0 +1,389 @@
1
+ var Pn=Symbol.for("yaml.alias"),On=Symbol.for("yaml.document"),$t=Symbol.for("yaml.map"),Fr=Symbol.for("yaml.pair"),mt=Symbol.for("yaml.scalar"),Kt=Symbol.for("yaml.seq"),nt=Symbol.for("yaml.node.type"),St=s=>!!s&&typeof s=="object"&&s[nt]===Pn,Et=s=>!!s&&typeof s=="object"&&s[nt]===On,at=s=>!!s&&typeof s=="object"&&s[nt]===$t,xe=s=>!!s&&typeof s=="object"&&s[nt]===Fr,he=s=>!!s&&typeof s=="object"&&s[nt]===mt,ot=s=>!!s&&typeof s=="object"&&s[nt]===Kt;function Me(s){if(s&&typeof s=="object")switch(s[nt]){case $t:case Kt:return!0}return!1}function ve(s){if(s&&typeof s=="object")switch(s[nt]){case Pn:case $t:case mt:case Kt:return!0}return!1}var An=s=>(he(s)||Me(s))&&!!s.anchor;var lt=Symbol("break visit"),$a=Symbol("skip children"),It=Symbol("remove node");function jt(s,e){let n=Sa(e);Et(s)?xs(null,s.contents,n,Object.freeze([s]))===It&&(s.contents=null):xs(null,s,n,Object.freeze([]))}jt.BREAK=lt;jt.SKIP=$a;jt.REMOVE=It;function xs(s,e,n,r){let i=va(s,e,n,r);if(ve(i)||xe(i))return Pa(s,r,i),xs(s,i,n,r);if(typeof i!="symbol"){if(Me(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let t=xs(o,e.items[o],n,r);if(typeof t=="number")o=t-1;else{if(t===lt)return lt;t===It&&(e.items.splice(o,1),o-=1)}}}else if(xe(e)){r=Object.freeze(r.concat(e));let o=xs("key",e.key,n,r);if(o===lt)return lt;o===It&&(e.key=null);let t=xs("value",e.value,n,r);if(t===lt)return lt;t===It&&(e.value=null)}}return i}async function Mn(s,e){let n=Sa(e);Et(s)?await $s(null,s.contents,n,Object.freeze([s]))===It&&(s.contents=null):await $s(null,s,n,Object.freeze([]))}Mn.BREAK=lt;Mn.SKIP=$a;Mn.REMOVE=It;async function $s(s,e,n,r){let i=await va(s,e,n,r);if(ve(i)||xe(i))return Pa(s,r,i),$s(s,i,n,r);if(typeof i!="symbol"){if(Me(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let t=await $s(o,e.items[o],n,r);if(typeof t=="number")o=t-1;else{if(t===lt)return lt;t===It&&(e.items.splice(o,1),o-=1)}}}else if(xe(e)){r=Object.freeze(r.concat(e));let o=await $s("key",e.key,n,r);if(o===lt)return lt;o===It&&(e.key=null);let t=await $s("value",e.value,n,r);if(t===lt)return lt;t===It&&(e.value=null)}}return i}function Sa(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function va(s,e,n,r){if(typeof n=="function")return n(s,e,r);if(at(e))return n.Map?.(s,e,r);if(ot(e))return n.Seq?.(s,e,r);if(xe(e))return n.Pair?.(s,e,r);if(he(e))return n.Scalar?.(s,e,r);if(St(e))return n.Alias?.(s,e,r)}function Pa(s,e,n){let r=e[e.length-1];if(Me(r))r.items[s]=n;else if(xe(r))s==="key"?r.key=n:r.value=n;else if(Et(r))r.contents=n;else{let i=St(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var Fl={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Zl=s=>s.replace(/[!,[\]{}]/g,e=>Fl[e]),Rt=class s{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,n)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,t]=r;return this.tags[o]=t,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(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 t=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let t=e.slice(2,-1);return t==="!"||t==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),t)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(t){return n(String(t)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+Zl(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&ve(e.contents)){let o={};jt(e.contents,(t,a)=>{ve(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,t]of r)o==="!!"&&t==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(t)))&&n.push(`%TAG ${o} ${t}`);return n.join(`
2
+ `)}};Rt.defaultYaml={explicit:!1,version:"1.2"};Rt.defaultTags={"!!":"tag:yaml.org,2002:"};function Nn(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(n)}return!0}function Zr(s){let e=new Set;return jt(s,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function Vr(s,e){for(let n=1;;++n){let r=`${s}${n}`;if(!e.has(r))return r}}function Oa(s,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=Zr(s));let t=Vr(e,i);return i.add(t),t},setAnchors:()=>{for(let o of n){let t=r.get(o);if(typeof t=="object"&&t.anchor&&(he(t.node)||Me(t.node)))t.node.anchor=t.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}function es(s,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let t=r[i],a=es(s,r,String(i),t);a===void 0?delete r[i]:a!==t&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),t=es(s,r,i,o);t===void 0?r.delete(i):t!==o&&r.set(i,t)}else if(r instanceof Set)for(let i of Array.from(r)){let o=es(s,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 t=es(s,r,i,o);t===void 0?delete r[i]:t!==o&&(r[i]=t)}return s.call(e,n,r)}function Je(s,e,n){if(Array.isArray(s))return s.map((r,i)=>Je(r,String(i),n));if(s&&typeof s.toJSON=="function"){if(!n||!An(s))return s.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(s,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=s.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof s=="bigint"&&!n?.keep?Number(s):s}var ts=class{constructor(e){Object.defineProperty(this,nt,{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:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!Et(e))throw new TypeError("A document argument is required");let t={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Je(this,"",t);if(typeof i=="function")for(let{count:m,res:c}of t.anchors.values())i(c,m);return typeof o=="function"?es(o,{"":a},"",a):a}};var Ft=class extends ts{constructor(e){super(Pn),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],jt(e,{Node:(o,t)=>{(St(t)||An(t))&&r.push(t)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}if(i&&n){let{anchors:o,doc:t,maxAliasCount:a}=n,m=o.get(i);if(m||(Je(i,null,n),m=o.get(i)),m?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(m.count+=1,m.aliasCount===0&&(m.aliasCount=zn(t,i,o)),m.count*m.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}}return i}toJSON(e,n){if(!n)return{source:this.source};let r=this.resolve(n.doc,n);if(!r){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return n.anchors.get(r).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(Nn(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 zn(s,e,n){if(St(e)){let r=e.resolve(s),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Me(e)){let r=0;for(let i of e.items){let o=zn(s,i,n);o>r&&(r=o)}return r}else if(xe(e)){let r=zn(s,e.key,n),i=zn(s,e.value,n);return Math.max(r,i)}return 1}var Tn=s=>!s||typeof s!="function"&&typeof s!="object",se=class extends ts{constructor(e){super(mt),this.value=e}toJSON(e,n){return n?.keep?this.value:Je(this.value,e,n)}toString(){return String(this.value)}};se.BLOCK_FOLDED="BLOCK_FOLDED";se.BLOCK_LITERAL="BLOCK_LITERAL";se.PLAIN="PLAIN";se.QUOTE_DOUBLE="QUOTE_DOUBLE";se.QUOTE_SINGLE="QUOTE_SINGLE";var Vl="tag:yaml.org,2002:";function Yl(s,e,n){if(e){let r=n.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 n.find(r=>r.identify?.(s)&&!r.format)}function Zt(s,e,n){if(Et(s)&&(s=s.contents),ve(s))return s;if(xe(s)){let p=n.schema[$t].createNode?.(n.schema,null,n);return p.items.push(s),p}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:t,sourceObjects:a}=n,m;if(r&&s&&typeof s=="object"){if(m=a.get(s),m)return m.anchor??(m.anchor=i(s)),new Ft(m.anchor);m={anchor:null,node:null},a.set(s,m)}e?.startsWith("!!")&&(e=Vl+e.slice(2));let c=Yl(s,e,t.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let p=new se(s);return m&&(m.node=p),p}c=s instanceof Map?t[$t]:Symbol.iterator in Object(s)?t[Kt]:t[$t]}o&&(o(c),delete n.onTagObj);let l=c?.createNode?c.createNode(n.schema,s,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,s,n):new se(s);return e?l.tag=e:c.default||(l.tag=c.tag),m&&(m.node=l),l}function Vs(s,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let t=[];t[o]=r,r=t}else r=new Map([[o,r]])}return Zt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var vs=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Ss=class extends ts{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>ve(r)||xe(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(vs(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(Me(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,Vs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(Me(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&he(o)?o.value:o:Me(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!xe(n))return!1;let r=n.value;return r==null||e&&he(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return Me(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(Me(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,Vs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var Aa=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function gt(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Ct=(s,e,n)=>s.endsWith(`
3
+ `)?gt(n,e):n.includes(`
4
+ `)?`
5
+ `+gt(n,e):(s.endsWith(" ")?"":" ")+n;var Yr="flow",En="block",Ys="quoted";function Us(s,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:t,onOverflow:a}={}){if(!i||i<0)return s;i<o&&(o=0);let m=Math.max(1+o,1+i-e.length);if(s.length<=m)return s;let c=[],l={},p=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?c.push(0):p=i-r);let f,d,h=!1,g=-1,y=-1,x=-1;n===En&&(g=Ma(s,g,e.length),g!==-1&&(p=g+m));for(let b;b=s[g+=1];){if(n===Ys&&b==="\\"){switch(y=g,s[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}x=g}if(b===`
6
+ `)n===En&&(g=Ma(s,g,e.length)),p=g+e.length+m,f=void 0;else{if(b===" "&&d&&d!==" "&&d!==`
7
+ `&&d!==" "){let k=s[g+1];k&&k!==" "&&k!==`
8
+ `&&k!==" "&&(f=g)}if(g>=p)if(f)c.push(f),p=f+m,f=void 0;else if(n===Ys){for(;d===" "||d===" ";)d=b,b=s[g+=1],h=!0;let k=g>x+1?g-2:y-1;if(l[k])return s;c.push(k),l[k]=!0,p=k+m,f=void 0}else h=!0}d=b}if(h&&a&&a(),c.length===0)return s;t&&t();let u=s.slice(0,c[0]);for(let b=0;b<c.length;++b){let k=c[b],w=c[b+1]||s.length;k===0?u=`
9
+ ${e}${s.slice(0,w)}`:(n===Ys&&l[k]&&(u+=`${s[k]}\\`),u+=`
10
+ ${e}${s.slice(k+1,w)}`)}return u}function Ma(s,e,n){let r=e,i=e+1,o=s[i];for(;o===" "||o===" ";)if(e<i+n)o=s[++e];else{do o=s[++e];while(o&&o!==`
11
+ `);r=e,i=e+1,o=s[i]}return r}var jn=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Rn=s=>/^(%|---|\.\.\.)/m.test(s);function Ul(s,e,n){if(!e||e<0)return!1;let r=e-n,i=s.length;if(i<=r)return!1;for(let o=0,t=0;o<i;++o)if(s[o]===`
12
+ `){if(o-t>r)return!0;if(t=o+1,i-t<=r)return!1}return!0}function Gs(s,e){let n=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Rn(s)?" ":""),t="",a=0;for(let m=0,c=n[m];c;c=n[++m])if(c===" "&&n[m+1]==="\\"&&n[m+2]==="n"&&(t+=n.slice(a,m)+"\\ ",m+=1,a=m,c="\\"),c==="\\")switch(n[m+1]){case"u":{t+=n.slice(a,m);let l=n.substr(m+2,4);switch(l){case"0000":t+="\\0";break;case"0007":t+="\\a";break;case"000b":t+="\\v";break;case"001b":t+="\\e";break;case"0085":t+="\\N";break;case"00a0":t+="\\_";break;case"2028":t+="\\L";break;case"2029":t+="\\P";break;default:l.substr(0,2)==="00"?t+="\\x"+l.substr(2):t+=n.substr(m,6)}m+=5,a=m+1}break;case"n":if(r||n[m+2]==='"'||n.length<i)m+=1;else{for(t+=n.slice(a,m)+`
13
+
14
+ `;n[m+2]==="\\"&&n[m+3]==="n"&&n[m+4]!=='"';)t+=`
15
+ `,m+=2;t+=o,n[m+2]===" "&&(t+="\\"),m+=1,a=m+1}break;default:m+=1}return t=a?t+n.slice(a):n,r?t:Us(t,o,Ys,jn(e,!1))}function Ur(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(s))return Gs(s,e);let n=e.indent||(Rn(s)?" ":""),r="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
17
+ ${n}`)+"'";return e.implicitKey?r:Us(r,n,Yr,jn(e,!1))}function Ps(s,e){let{singleQuote:n}=e.options,r;if(n===!1)r=Gs;else{let i=s.includes('"'),o=s.includes("'");i&&!o?r=Ur:o&&!i?r=Gs:r=n?Ur:Gs}return r(s,e)}var Gr;try{Gr=new RegExp(`(^|(?<!
18
+ ))
19
+ +(?!
20
+ |$)`,"g")}catch{Gr=/\n+(?!\n|$)/g}function In({comment:s,type:e,value:n},r,i,o){let{blockQuote:t,commentString:a,lineWidth:m}=r.options;if(!t||/\n[\t ]+$/.test(n))return Ps(n,r);let c=r.indent||(r.forceBlockIndent||Rn(n)?" ":""),l=t==="literal"?!0:t==="folded"||e===se.BLOCK_FOLDED?!1:e===se.BLOCK_LITERAL?!0:!Ul(n,m,c.length);if(!n)return l?`|
21
+ `:`>
22
+ `;let p,f;for(f=n.length;f>0;--f){let w=n[f-1];if(w!==`
23
+ `&&w!==" "&&w!==" ")break}let d=n.substring(f),h=d.indexOf(`
24
+ `);h===-1?p="-":n===d||h!==d.length-1?(p="+",o&&o()):p="",d&&(n=n.slice(0,-d.length),d[d.length-1]===`
25
+ `&&(d=d.slice(0,-1)),d=d.replace(Gr,`$&${c}`));let g=!1,y,x=-1;for(y=0;y<n.length;++y){let w=n[y];if(w===" ")g=!0;else if(w===`
26
+ `)x=y;else break}let u=n.substring(0,x<y?x+1:y);u&&(n=n.substring(u.length),u=u.replace(/\n+/g,`$&${c}`));let k=(g?c?"2":"1":"")+p;if(s&&(k+=" "+a(s.replace(/ ?[\r\n]+/g," ")),i&&i()),!l){let w=n.replace(/\n+/g,`
27
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),v=!1,I=jn(r,!0);t!=="folded"&&e!==se.BLOCK_FOLDED&&(I.onOverflow=()=>{v=!0});let z=Us(`${u}${w}${d}`,c,En,I);if(!v)return`>${k}
28
+ ${c}${z}`}return n=n.replace(/\n+/g,`$&${c}`),`|${k}
29
+ ${c}${u}${n}${d}`}function Gl(s,e,n,r){let{type:i,value:o}=s,{actualString:t,implicitKey:a,indent:m,indentStep:c,inFlow:l}=e;if(a&&o.includes(`
30
+ `)||l&&/[[\]{},]/.test(o))return Ps(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||l||!o.includes(`
31
+ `)?Ps(o,e):In(s,e,n,r);if(!a&&!l&&i!==se.PLAIN&&o.includes(`
32
+ `))return In(s,e,n,r);if(Rn(o)){if(m==="")return e.forceBlockIndent=!0,In(s,e,n,r);if(a&&m===c)return Ps(o,e)}let p=o.replace(/\n+/g,`$&
33
+ ${m}`);if(t){let f=g=>g.default&&g.tag!=="tag:yaml.org,2002:str"&&g.test?.test(p),{compat:d,tags:h}=e.doc.schema;if(h.some(f)||d?.some(f))return Ps(o,e)}return a?p:Us(p,m,Yr,jn(e,!1))}function fs(s,e,n,r){let{implicitKey:i,inFlow:o}=e,t=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==se.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(t.value)&&(a=se.QUOTE_DOUBLE);let m=l=>{switch(l){case se.BLOCK_FOLDED:case se.BLOCK_LITERAL:return i||o?Ps(t.value,e):In(t,e,n,r);case se.QUOTE_DOUBLE:return Gs(t.value,e);case se.QUOTE_SINGLE:return Ur(t.value,e);case se.PLAIN:return Gl(t,e,n,r);default:return null}},c=m(a);if(c===null){let{defaultKeyType:l,defaultStringType:p}=e.options,f=i&&l||p;if(c=m(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}function Cn(s,e){let n=Object.assign({blockQuote:!0,commentString:Aa,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},s.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:s,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Wl(s,e){if(e.tag){let i=s.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(he(e)){r=e.value;let i=s.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(t=>t.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=s.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Hl(s,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(he(s)||Me(s))&&s.anchor;o&&Nn(o)&&(n.add(o),i.push(`&${o}`));let t=s.tag??(e.default?null:e.tag);return t&&i.push(r.directives.tagString(t)),i.join(" ")}function Vt(s,e,n,r){if(xe(s))return s.toString(e,n,r);if(St(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i,o=ve(s)?s:e.doc.createNode(s,{onTagObj:m=>i=m});i??(i=Wl(e.doc.schema.tags,o));let t=Hl(o,i,e);t.length>0&&(e.indentAtStart=(e.indentAtStart??0)+t.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):he(o)?fs(o,e,n,r):o.toString(e,n,r);return t?he(o)||a[0]==="{"||a[0]==="["?`${t} ${a}`:`${t}
34
+ ${e.indent}${a}`:a}function Na({key:s,value:e},n,r,i){let{allNullValues:o,doc:t,indent:a,indentStep:m,options:{commentString:c,indentSeq:l,simpleKeys:p}}=n,f=ve(s)&&s.comment||null;if(p){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Me(s)||!ve(s)&&typeof s=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let d=!p&&(!s||f&&e==null&&!n.inFlow||Me(s)||(he(s)?s.type===se.BLOCK_FOLDED||s.type===se.BLOCK_LITERAL:typeof s=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!d&&(p||!o),indent:a+m});let h=!1,g=!1,y=Vt(s,n,()=>h=!0,()=>g=!0);if(!d&&!n.inFlow&&y.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(n.inFlow){if(o||e==null)return h&&r&&r(),y===""?"?":d?`? ${y}`:y}else if(o&&!p||e==null&&d)return y=`? ${y}`,f&&!h?y+=Ct(y,n.indent,c(f)):g&&i&&i(),y;h&&(f=null),d?(f&&(y+=Ct(y,n.indent,c(f))),y=`? ${y}
35
+ ${a}:`):(y=`${y}:`,f&&(y+=Ct(y,n.indent,c(f))));let x,u,b;ve(e)?(x=!!e.spaceBefore,u=e.commentBefore,b=e.comment):(x=!1,u=null,b=null,e&&typeof e=="object"&&(e=t.createNode(e))),n.implicitKey=!1,!d&&!f&&he(e)&&(n.indentAtStart=y.length+1),g=!1,!l&&m.length>=2&&!n.inFlow&&!d&&ot(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let k=!1,w=Vt(e,n,()=>k=!0,()=>g=!0),v=" ";if(f||x||u){if(v=x?`
36
+ `:"",u){let I=c(u);v+=`
37
+ ${gt(I,n.indent)}`}w===""&&!n.inFlow?v===`
38
+ `&&b&&(v=`
39
+
40
+ `):v+=`
41
+ ${n.indent}`}else if(!d&&Me(e)){let I=w[0],z=w.indexOf(`
42
+ `),B=z!==-1,T=n.inFlow??e.flow??e.items.length===0;if(B||!T){let L=!1;if(B&&(I==="&"||I==="!")){let P=w.indexOf(" ");I==="&"&&P!==-1&&P<z&&w[P+1]==="!"&&(P=w.indexOf(" ",P+1)),(P===-1||z<P)&&(L=!0)}L||(v=`
43
+ ${n.indent}`)}}else(w===""||w[0]===`
44
+ `)&&(v="");return y+=v+w,n.inFlow?k&&r&&r():b&&!k?y+=Ct(y,n.indent,c(b)):g&&i&&i(),y}function Ln(s,e){(s==="debug"||s==="warn")&&console.warn(e)}var _n="<<",vt={identify:s=>s===_n||typeof s=="symbol"&&s.description===_n,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new se(Symbol(_n)),{addToJSMap:Hr}),stringify:()=>_n},za=(s,e)=>(vt.identify(e)||he(e)&&(!e.type||e.type===se.PLAIN)&&vt.identify(e.value))&&s?.doc.schema.tags.some(n=>n.tag===vt.tag&&n.default);function Hr(s,e,n){let r=Ta(s,n);if(ot(r))for(let i of r.items)Wr(s,e,i);else if(Array.isArray(r))for(let i of r)Wr(s,e,i);else Wr(s,e,r)}function Wr(s,e,n){let r=Ta(s,n);if(!at(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,s,Map);for(let[o,t]of i)e instanceof Map?e.has(o)||e.set(o,t):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:t,writable:!0,enumerable:!0,configurable:!0});return e}function Ta(s,e){return s&&St(e)?e.resolve(s.doc,s):e}function Dn(s,e,{key:n,value:r}){if(ve(n)&&n.addToJSMap)n.addToJSMap(s,e,r);else if(za(s,n))Hr(s,e,r);else{let i=Je(n,"",s);if(e instanceof Map)e.set(i,Je(r,i,s));else if(e instanceof Set)e.add(i);else{let o=Jl(n,i,s),t=Je(r,o,s);o in e?Object.defineProperty(e,o,{value:t,writable:!0,enumerable:!0,configurable:!0}):e[o]=t}}return e}function Jl(s,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ve(s)&&n?.doc){let r=Cn(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=s.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Ln(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Os(s,e,n){let r=Zt(s,void 0,n),i=Zt(e,void 0,n);return new Be(r,i)}var Be=class s{constructor(e,n=null){Object.defineProperty(this,nt,{value:Fr}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return ve(n)&&(n=n.clone(e)),ve(r)&&(r=r.clone(e)),new s(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return Dn(n,r,this)}toString(e,n,r){return e?.doc?Na(this,e,n,r):JSON.stringify(this)}};function qn(s,e,n){return(e.inFlow??s.flow?Ql:Xl)(s,e,n)}function Xl({comment:s,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:t,onComment:a}){let{indent:m,options:{commentString:c}}=n,l=Object.assign({},n,{indent:o,type:null}),p=!1,f=[];for(let h=0;h<e.length;++h){let g=e[h],y=null;if(ve(g))!p&&g.spaceBefore&&f.push(""),Bn(n,f,g.commentBefore,p),g.comment&&(y=g.comment);else if(xe(g)){let u=ve(g.key)?g.key:null;u&&(!p&&u.spaceBefore&&f.push(""),Bn(n,f,u.commentBefore,p))}p=!1;let x=Vt(g,l,()=>y=null,()=>p=!0);y&&(x+=Ct(x,o,c(y))),p&&y&&(p=!1),f.push(r+x)}let d;if(f.length===0)d=i.start+i.end;else{d=f[0];for(let h=1;h<f.length;++h){let g=f[h];d+=g?`
45
+ ${m}${g}`:`
46
+ `}}return s?(d+=`
47
+ `+gt(c(s),m),a&&a()):p&&t&&t(),d}function Ql({items:s},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:t,options:{commentString:a}}=e;r+=o;let m=Object.assign({},e,{indent:r,inFlow:!0,type:null}),c=!1,l=0,p=[];for(let h=0;h<s.length;++h){let g=s[h],y=null;if(ve(g))g.spaceBefore&&p.push(""),Bn(e,p,g.commentBefore,!1),g.comment&&(y=g.comment);else if(xe(g)){let u=ve(g.key)?g.key:null;u&&(u.spaceBefore&&p.push(""),Bn(e,p,u.commentBefore,!1),u.comment&&(c=!0));let b=ve(g.value)?g.value:null;b?(b.comment&&(y=b.comment),b.commentBefore&&(c=!0)):g.value==null&&u?.comment&&(y=u.comment)}y&&(c=!0);let x=Vt(g,m,()=>y=null);c||(c=p.length>l||x.includes(`
48
+ `)),h<s.length-1?x+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=p.reduce((u,b)=>u+b.length+2,2)+(x.length+2)>e.options.lineWidth)),c&&(x+=",")),y&&(x+=Ct(x,r,a(y))),p.push(x),l=p.length}let{start:f,end:d}=n;if(p.length===0)return f+d;if(!c){let h=p.reduce((g,y)=>g+y.length+2,2);c=e.options.lineWidth>0&&h>e.options.lineWidth}if(c){let h=f;for(let g of p)h+=g?`
49
+ ${o}${i}${g}`:`
50
+ `;return`${h}
51
+ ${i}${d}`}else return`${f}${t}${p.join(" ")}${t}${d}`}function Bn({indent:s,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=gt(e(r),s);n.push(o.trimStart())}}function ss(s,e){let n=he(e)?e.value:e;for(let r of s)if(xe(r)&&(r.key===e||r.key===n||he(r.key)&&r.key.value===n))return r}var Ue=class extends Ss{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super($t,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,t=new this(e),a=(m,c)=>{if(typeof o=="function")c=o.call(n,m,c);else if(Array.isArray(o)&&!o.includes(m))return;(c!==void 0||i)&&t.items.push(Os(m,c,r))};if(n instanceof Map)for(let[m,c]of n)a(m,c);else if(n&&typeof n=="object")for(let m of Object.keys(n))a(m,n[m]);return typeof e.sortMapEntries=="function"&&t.items.sort(e.sortMapEntries),t}add(e,n){let r;xe(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Be(e,e?.value):r=new Be(e.key,e.value);let i=ss(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);he(i.value)&&Tn(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let t=this.items.findIndex(a=>o(r,a)<0);t===-1?this.items.push(r):this.items.splice(t,0,r)}else this.items.push(r)}delete(e){let n=ss(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=ss(this.items,e)?.value;return(!n&&he(i)?i.value:i)??void 0}has(e){return!!ss(this.items,e)}set(e,n){this.add(new Be(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)Dn(n,i,o);return i}toString(e,n,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})),qn(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};var Pt={collection:"map",default:!0,nodeClass:Ue,tag:"tag:yaml.org,2002:map",resolve(s,e){return at(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,n)=>Ue.from(s,e,n)};var tt=class extends Ss{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Kt,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Kn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=Kn(e);if(typeof r!="number")return;let i=this.items[r];return!n&&he(i)?i.value:i}has(e){let n=Kn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=Kn(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];he(i)&&Tn(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(Je(o,String(i++),n));return r}toString(e,n,r){return e?qn(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let t=0;for(let a of n){if(typeof i=="function"){let m=n instanceof Set?a:String(t++);a=i.call(n,m,a)}o.items.push(Zt(a,void 0,r))}}return o}};function Kn(s){let e=he(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Ot={collection:"seq",default:!0,nodeClass:tt,tag:"tag:yaml.org,2002:seq",resolve(s,e){return ot(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,n)=>tt.from(s,e,n)};var ns={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,n,r){return e=Object.assign({actualString:!0},e),fs(s,e,n,r)}};var ds={identify:s=>s==null,createNode:()=>new se(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new se(null),stringify:({source:s},e)=>typeof s=="string"&&ds.test.test(s)?s:e.options.nullStr};var Ws={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new se(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},n){if(s&&Ws.test.test(s)){let r=s[0]==="t"||s[0]==="T";if(e===r)return s}return e?n.options.trueStr:n.options.falseStr}};function st({format:s,minFractionDigits:e,tag:n,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(!s&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let t=o.indexOf(".");t<0&&(t=o.length,o+=".");let a=e-(o.length-t-1);for(;a-- >0;)o+="0"}return o}var Fn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:st},Zn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():st(s)}},Vn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new se(parseFloat(s)),n=s.indexOf(".");return n!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-n-1),e},stringify:st};var Yn=s=>typeof s=="bigint"||Number.isInteger(s),Jr=(s,e,n,{intAsBigInt:r})=>r?BigInt(s):parseInt(s.substring(e),n);function Ea(s,e,n){let{value:r}=s;return Yn(r)&&r>=0?n+r.toString(e):st(s)}var Un={identify:s=>Yn(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,n)=>Jr(s,2,8,n),stringify:s=>Ea(s,8,"0o")},Gn={identify:Yn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,n)=>Jr(s,0,10,n),stringify:st},Wn={identify:s=>Yn(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,n)=>Jr(s,2,16,n),stringify:s=>Ea(s,16,"0x")};var Ia=[Pt,Ot,ns,ds,Ws,Un,Gn,Wn,Fn,Zn,Vn];function ja(s){return typeof s=="bigint"||Number.isInteger(s)}var Hn=({value:s})=>JSON.stringify(s),ep=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Hn},{identify:s=>s==null,createNode:()=>new se(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Hn},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:Hn},{identify:ja,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:n})=>n?BigInt(s):parseInt(s,10),stringify:({value:s})=>ja(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Hn}],tp={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Ra=[Pt,Ot].concat(ep,tp);var Hs={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof atob=="function"){let n=atob(s.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:n},r,i,o){if(!n)return"";let t=n,a;if(typeof btoa=="function"){let m="";for(let c=0;c<t.length;++c)m+=String.fromCharCode(t[c]);a=btoa(m)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=se.BLOCK_LITERAL),e!==se.QUOTE_DOUBLE){let m=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),c=Math.ceil(a.length/m),l=new Array(c);for(let p=0,f=0;p<c;++p,f+=m)l[p]=a.substr(f,m);a=l.join(e===se.BLOCK_LITERAL?`
52
+ `:" ")}return fs({comment:s,type:e,value:a},r,i,o)}};function Xr(s,e){if(ot(s))for(let n=0;n<s.items.length;++n){let r=s.items[n];if(!xe(r)){if(at(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Be(new se(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
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}s.items[n]=xe(r)?r:new Be(r)}}else e("Expected a sequence for this tag");return s}function Qr(s,e,n){let{replacer:r}=n,i=new tt(s);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let t of e){typeof r=="function"&&(t=r.call(e,String(o++),t));let a,m;if(Array.isArray(t))if(t.length===2)a=t[0],m=t[1];else throw new TypeError(`Expected [key, value] tuple: ${t}`);else if(t&&t instanceof Object){let c=Object.keys(t);if(c.length===1)a=c[0],m=t[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=t;i.items.push(Os(a,m,n))}return i}var Js={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Xr,createNode:Qr};var As=class s extends tt{constructor(){super(),this.add=Ue.prototype.add.bind(this),this.delete=Ue.prototype.delete.bind(this),this.get=Ue.prototype.get.bind(this),this.has=Ue.prototype.has.bind(this),this.set=Ue.prototype.set.bind(this),this.tag=s.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,t;if(xe(i)?(o=Je(i.key,"",n),t=Je(i.value,o,n)):o=Je(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,t)}return r}static from(e,n,r){let i=Qr(e,n,r),o=new this;return o.items=i.items,o}};As.tag="tag:yaml.org,2002:omap";var Xs={collection:"seq",identify:s=>s instanceof Map,nodeClass:As,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let n=Xr(s,e),r=[];for(let{key:i}of n.items)he(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new As,n)},createNode:(s,e,n)=>As.from(s,e,n)};function Ca({value:s,source:e},n){return e&&(s?ei:ti).test.test(e)?e:s?n.options.trueStr:n.options.falseStr}var ei={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new se(!0),stringify:Ca},ti={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new se(!1),stringify:Ca};var La={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:st},_a={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():st(s)}},Da={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new se(parseFloat(s.replace(/_/g,""))),n=s.indexOf(".");if(n!==-1){let r=s.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:st};var Qs=s=>typeof s=="bigint"||Number.isInteger(s);function Jn(s,e,n,{intAsBigInt:r}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),r){switch(n){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let t=BigInt(s);return i==="-"?BigInt(-1)*t:t}let o=parseInt(s,n);return i==="-"?-1*o:o}function si(s,e,n){let{value:r}=s;if(Qs(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return st(s)}var Ba={identify:Qs,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,n)=>Jn(s,2,2,n),stringify:s=>si(s,2,"0b")},qa={identify:Qs,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,n)=>Jn(s,1,8,n),stringify:s=>si(s,8,"0")},Ka={identify:Qs,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,n)=>Jn(s,0,10,n),stringify:st},Fa={identify:Qs,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,n)=>Jn(s,2,16,n),stringify:s=>si(s,16,"0x")};var Ms=class s extends Ue{constructor(e){super(e),this.tag=s.tag}add(e){let n;xe(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Be(e.key,null):n=new Be(e,null),ss(this.items,n.key)||this.items.push(n)}get(e,n){let r=ss(this.items,e);return!n&&xe(r)?he(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=ss(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Be(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let t of n)typeof i=="function"&&(t=i.call(n,t,t)),o.items.push(Os(t,null,r));return o}};Ms.tag="tag:yaml.org,2002:set";var en={collection:"map",identify:s=>s instanceof Set,nodeClass:Ms,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,n)=>Ms.from(s,e,n),resolve(s,e){if(at(s)){if(s.hasAllNullValues(!0))return Object.assign(new Ms,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function ni(s,e){let n=s[0],r=n==="-"||n==="+"?s.substring(1):s,i=t=>e?BigInt(t):Number(t),o=r.replace(/_/g,"").split(":").reduce((t,a)=>t*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function Za(s){let{value:e}=s,n=t=>t;if(typeof e=="bigint")n=t=>BigInt(t);else if(isNaN(e)||!isFinite(e))return st(s);let r="";e<0&&(r="-",e*=n(-1));let i=n(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(t=>String(t).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Xn={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:n})=>ni(s,n),stringify:Za},Qn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>ni(s,!1),stringify:Za},Ns={identify:s=>s 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(s){let e=s.match(Ns.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,t,a]=e.map(Number),m=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,i,o||0,t||0,a||0,m),l=e[8];if(l&&l!=="Z"){let p=ni(l,!1);Math.abs(p)<30&&(p*=60),c-=6e4*p}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var ri=[Pt,Ot,ns,ds,ei,ti,Ba,qa,Ka,Fa,La,_a,Da,Hs,vt,Xs,Js,en,Xn,Qn,Ns];var Va=new Map([["core",Ia],["failsafe",[Pt,Ot,ns]],["json",Ra],["yaml11",ri],["yaml-1.1",ri]]),Ya={binary:Hs,bool:Ws,float:Vn,floatExp:Zn,floatNaN:Fn,floatTime:Qn,int:Gn,intHex:Wn,intOct:Un,intTime:Xn,map:Pt,merge:vt,null:ds,omap:Xs,pairs:Js,seq:Ot,set:en,timestamp:Ns},Ua={"tag:yaml.org,2002:binary":Hs,"tag:yaml.org,2002:merge":vt,"tag:yaml.org,2002:omap":Xs,"tag:yaml.org,2002:pairs":Js,"tag:yaml.org,2002:set":en,"tag:yaml.org,2002:timestamp":Ns};function er(s,e,n){let r=Va.get(e);if(r&&!s)return n&&!r.includes(vt)?r.concat(vt):r.slice();let i=r;if(!i)if(Array.isArray(s))i=[];else{let o=Array.from(Va.keys()).filter(t=>t!=="yaml11").map(t=>JSON.stringify(t)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(s))for(let o of s)i=i.concat(o);else typeof s=="function"&&(i=s(i.slice()));return n&&(i=i.concat(vt)),i.reduce((o,t)=>{let a=typeof t=="string"?Ya[t]:t;if(!a){let m=JSON.stringify(t),c=Object.keys(Ya).map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown custom tag ${m}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}var sp=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,tn=class s{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:t,toStringDefaults:a}){this.compat=Array.isArray(e)?er(e,"compat"):e?er(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Ua:{},this.tags=er(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,$t,{value:Pt}),Object.defineProperty(this,mt,{value:ns}),Object.defineProperty(this,Kt,{value:Ot}),this.sortMapEntries=typeof t=="function"?t:t===!0?sp:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function Ga(s,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&s.directives){let m=s.directives.toString(s);m?(n.push(m),r=!0):s.directives.docStart&&(r=!0)}r&&n.push("---");let i=Cn(s,e),{commentString:o}=i.options;if(s.commentBefore){n.length!==1&&n.unshift("");let m=o(s.commentBefore);n.unshift(gt(m,""))}let t=!1,a=null;if(s.contents){if(ve(s.contents)){if(s.contents.spaceBefore&&r&&n.push(""),s.contents.commentBefore){let l=o(s.contents.commentBefore);n.push(gt(l,""))}i.forceBlockIndent=!!s.comment,a=s.contents.comment}let m=a?void 0:()=>t=!0,c=Vt(s.contents,i,()=>a=null,m);a&&(c+=Ct(c,"",o(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Vt(s.contents,i));if(s.directives?.docEnd)if(s.comment){let m=o(s.comment);m.includes(`
55
+ `)?(n.push("..."),n.push(gt(m,""))):n.push(`... ${m}`)}else n.push("...");else{let m=s.comment;m&&t&&(m=m.replace(/^\n+/,"")),m&&((!t||a)&&n[n.length-1]!==""&&n.push(""),n.push(gt(o(m),"")))}return n.join(`
56
+ `)+`
57
+ `}var rs=class s{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,nt,{value:On});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=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:t}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(t=this.directives.yaml.version)):this.directives=new Rt({version:t}),this.setSchema(t,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(s.prototype,{[nt]:{value:On}});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=ve(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){zs(this.contents)&&this.contents.add(e)}addIn(e,n){zs(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=Zr(this);e.anchor=!n||r.has(n)?Vr(n||"a",r):n}return new Ft(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let y=u=>typeof u=="number"||u instanceof String||u instanceof Number,x=n.filter(y).map(String);x.length>0&&(n=n.concat(x)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:t,flow:a,keepUndefined:m,onTagObj:c,tag:l}=r??{},{onAnchor:p,setAnchors:f,sourceObjects:d}=Oa(this,t||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:m??!1,onAnchor:p,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},g=Zt(e,l,h);return a&&Me(g)&&(g.flow=!0),f(),g}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new Be(i,o)}delete(e){return zs(this.contents)?this.contents.delete(e):!1}deleteIn(e){return vs(e)?this.contents==null?!1:(this.contents=null,!0):zs(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Me(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return vs(e)?!n&&he(this.contents)?this.contents.value:this.contents:Me(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Me(this.contents)?this.contents.has(e):!1}hasIn(e){return vs(e)?this.contents!==void 0:Me(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Vs(this.schema,[e],n):zs(this.contents)&&this.contents.set(e,n)}setIn(e,n){vs(e)?this.contents=n:this.contents==null?this.contents=Vs(this.schema,Array.from(e),n):zs(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Rt({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 Rt({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(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new tn(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:t}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},m=Je(this.contents,n??"",a);if(typeof o=="function")for(let{count:c,res:l}of a.anchors.values())o(l,c);return typeof t=="function"?es(t,{"":m},"",m):m}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Ga(this,e)}};function zs(s){if(Me(s))return!0;throw new Error("Expected a YAML collection as document contents")}var sn=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},At=class extends sn{constructor(e,n,r){super("YAMLParseError",e,n,r)}},nn=class extends sn{constructor(e,n,r){super("YAMLWarning",e,n,r)}},ii=(s,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,t=s.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&t.length>80){let a=Math.min(o-39,t.length-79);t="\u2026"+t.substring(a),o-=a-1}if(t.length>80&&(t=t.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(t.substring(0,o))){let a=s.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
58
+ `),t=a+t}if(/[^ ]/.test(t)){let a=1,m=n.linePos[1];m?.line===r&&m.col>i&&(a=Math.max(1,Math.min(m.col-i,80-o)));let c=" ".repeat(o)+"^".repeat(a);n.message+=`:
59
+
60
+ ${t}
61
+ ${c}
62
+ `}};function Lt(s,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:t,startOnNewline:a}){let m=!1,c=a,l=a,p="",f="",d=!1,h=!1,g=null,y=null,x=null,u=null,b=null,k=null,w=null;for(let z of s)switch(h&&(z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&o(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),g&&(c&&z.type!=="comment"&&z.type!=="newline"&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),z.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&z.source.includes(" ")&&(g=z),l=!0;break;case"comment":{l||o(z,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let B=z.source.substring(1)||" ";p?p+=f+B:p=B,f="",c=!1;break}case"newline":c?p?p+=z.source:(!k||n!=="seq-item-ind")&&(m=!0):f+=z.source,c=!0,d=!0,(y||x)&&(u=z),l=!0;break;case"anchor":y&&o(z,"MULTIPLE_ANCHORS","A node can have at most one anchor"),z.source.endsWith(":")&&o(z.offset+z.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=z,w??(w=z.offset),c=!1,l=!1,h=!0;break;case"tag":{x&&o(z,"MULTIPLE_TAGS","A node can have at most one tag"),x=z,w??(w=z.offset),c=!1,l=!1,h=!0;break}case n:(y||x)&&o(z,"BAD_PROP_ORDER",`Anchors and tags must be after the ${z.source} indicator`),k&&o(z,"UNEXPECTED_TOKEN",`Unexpected ${z.source} in ${e??"collection"}`),k=z,c=n==="seq-item-ind"||n==="explicit-key-ind",l=!1;break;case"comma":if(e){b&&o(z,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=z,c=!1,l=!1;break}default:o(z,"UNEXPECTED_TOKEN",`Unexpected ${z.type} token`),c=!1,l=!1}let v=s[s.length-1],I=v?v.offset+v.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"),g&&(c&&g.indent<=t||r?.type==="block-map"||r?.type==="block-seq")&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:k,spaceBefore:m,comment:p,hasNewline:d,anchor:y,tag:x,newlineAfterProp:u,end:I,start:w??I}}function is(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
63
+ `))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(is(e.key)||is(e.value))return!0}return!1;default:return!0}}function rn(s,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===s&&(r.source==="]"||r.source==="}")&&is(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function tr(s,e,n){let{uniqueKeys:r}=s.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,t)=>o===t||he(o)&&he(t)&&o.value===t.value;return e.some(o=>i(o.key,n))}var Wa="All mapping items must start at the same column";function Ha({composeNode:s,composeEmptyNode:e},n,r,i,o){let t=o?.nodeClass??Ue,a=new t(n.schema);n.atRoot&&(n.atRoot=!1);let m=r.offset,c=null;for(let l of r.items){let{start:p,key:f,sep:d,value:h}=l,g=Lt(p,{indicator:"explicit-key-ind",next:f??d?.[0],offset:m,onError:i,parentIndent:r.indent,startOnNewline:!0}),y=!g.found;if(y){if(f&&(f.type==="block-seq"?i(m,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&i(m,"BAD_INDENT",Wa)),!g.anchor&&!g.tag&&!d){c=g.end,g.comment&&(a.comment?a.comment+=`
64
+ `+g.comment:a.comment=g.comment);continue}(g.newlineAfterProp||is(f))&&i(f??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else g.found?.indent!==r.indent&&i(m,"BAD_INDENT",Wa);n.atKey=!0;let x=g.end,u=f?s(n,f,g,i):e(n,x,p,null,g,i);n.schema.compat&&rn(r.indent,f,i),n.atKey=!1,tr(n,a.items,u)&&i(x,"DUPLICATE_KEY","Map keys must be unique");let b=Lt(d??[],{indicator:"map-value-ind",next:h,offset:u.range[2],onError:i,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(m=b.end,b.found){y&&(h?.type==="block-map"&&!b.hasNewline&&i(m,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&g.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 k=h?s(n,h,b,i):e(n,m,d,null,b,i);n.schema.compat&&rn(r.indent,h,i),m=k.range[2];let w=new Be(u,k);n.options.keepSourceTokens&&(w.srcToken=l),a.items.push(w)}else{y&&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 k=new Be(u);n.options.keepSourceTokens&&(k.srcToken=l),a.items.push(k)}}return c&&c<m&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,m,c??m],a}function Ja({composeNode:s,composeEmptyNode:e},n,r,i,o){let t=o?.nodeClass??tt,a=new t(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let m=r.offset,c=null;for(let{start:l,value:p}of r.items){let f=Lt(l,{indicator:"seq-item-ind",next:p,offset:m,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||p)p?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(m,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}let d=p?s(n,p,f,i):e(n,f.end,l,null,f,i);n.schema.compat&&rn(r.indent,p,i),m=d.range[2],a.items.push(d)}return a.range=[r.offset,m,c??m],a}function _t(s,e,n,r){let i="";if(s){let o=!1,t="";for(let a of s){let{source:m,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let l=m.substring(1)||" ";i?i+=t+l:i=l,t="";break}case"newline":i&&(t+=m),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=m.length}}return{comment:i,offset:e}}var ai="Block collections are not allowed within flow collections",oi=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Xa({composeNode:s,composeEmptyNode:e},n,r,i,o){let t=r.start.source==="{",a=t?"flow map":"flow sequence",m=o?.nodeClass??(t?Ue:tt),c=new m(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let p=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let x=r.items[y],{start:u,key:b,sep:k,value:w}=x,v=Lt(u,{flow:a,indicator:"explicit-key-ind",next:b??k?.[0],offset:p,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!k&&!w){y===0&&v.comma?i(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&i(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),v.comment&&(c.comment?c.comment+=`
66
+ `+v.comment:c.comment=v.comment),p=v.end;continue}!t&&n.options.strict&&is(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)v.comma&&i(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(v.comma||i(v.start,"MISSING_CHAR",`Missing , between ${a} items`),v.comment){let I="";e:for(let z of u)switch(z.type){case"comma":case"space":break;case"comment":I=z.source.substring(1);break e;default:break e}if(I){let z=c.items[c.items.length-1];xe(z)&&(z=z.value??z.key),z.comment?z.comment+=`
67
+ `+I:z.comment=I,v.comment=v.comment.substring(I.length+1)}}if(!t&&!k&&!v.found){let I=w?s(n,w,v,i):e(n,v.end,k,null,v,i);c.items.push(I),p=I.range[2],oi(w)&&i(I.range,"BLOCK_IN_FLOW",ai)}else{n.atKey=!0;let I=v.end,z=b?s(n,b,v,i):e(n,I,u,null,v,i);oi(b)&&i(z.range,"BLOCK_IN_FLOW",ai),n.atKey=!1;let B=Lt(k??[],{flow:a,indicator:"map-value-ind",next:w,offset:z.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(B.found){if(!t&&!v.found&&n.options.strict){if(k)for(let P of k){if(P===B.found)break;if(P.type==="newline"){i(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<B.found.offset-1024&&i(B.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(B.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let T=w?s(n,w,B,i):B.found?e(n,B.end,k,null,B,i):null;T?oi(w)&&i(T.range,"BLOCK_IN_FLOW",ai):B.comment&&(z.comment?z.comment+=`
68
+ `+B.comment:z.comment=B.comment);let L=new Be(z,T);if(n.options.keepSourceTokens&&(L.srcToken=x),t){let P=c;tr(n,P.items,z)&&i(I,"DUPLICATE_KEY","Map keys must be unique"),P.items.push(L)}else{let P=new Ue(n.schema);P.flow=!0,P.items.push(L);let A=(T??z).range;P.range=[z.range[0],A[1],A[2]],c.items.push(P)}p=T?T.range[2]:B.end}}let f=t?"}":"]",[d,...h]=r.end,g=p;if(d?.source===f)g=d.offset+d.source.length;else{let y=a[0].toUpperCase()+a.substring(1),x=l?`${y} must end with a ${f}`:`${y} in block collection must be sufficiently indented and end with a ${f}`;i(p,l?"MISSING_CHAR":"BAD_INDENT",x),d&&d.source.length!==1&&h.unshift(d)}if(h.length>0){let y=_t(h,g,n.options.strict,i);y.comment&&(c.comment?c.comment+=`
69
+ `+y.comment:c.comment=y.comment),c.range=[r.offset,g,y.offset]}else c.range=[r.offset,g,g];return c}function li(s,e,n,r,i,o){let t=n.type==="block-map"?Ha(s,e,n,r,o):n.type==="block-seq"?Ja(s,e,n,r,o):Xa(s,e,n,r,o),a=t.constructor;return i==="!"||i===a.tagName?(t.tag=a.tagName,t):(i&&(t.tag=i),t)}function Qa(s,e,n,r,i){let o=r.tag,t=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:d}=r,h=f&&o?f.offset>o.offset?f:o:f??o;h&&(!d||d.offset<h.offset)&&i(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!t||t==="!"||t===Ue.tagName&&a==="map"||t===tt.tagName&&a==="seq")return li(s,e,n,i,t);let m=e.schema.tags.find(f=>f.tag===t&&f.collection===a);if(!m){let f=e.schema.knownTags[t];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),m=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,!0),li(s,e,n,i,t)}let c=li(s,e,n,i,t,m),l=m.resolve?.(c,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??c,p=ve(l)?l:new se(l);return p.range=c.range,p.tag=t,m?.format&&(p.format=m.format),p}function pi(s,e,n){let r=e.offset,i=np(e,s.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?se.BLOCK_FOLDED:se.BLOCK_LITERAL,t=e.source?rp(e.source):[],a=t.length;for(let g=t.length-1;g>=0;--g){let y=t[g][1];if(y===""||y==="\r")a=g;else break}if(a===0){let g=i.chomp==="+"&&t.length>0?`
70
+ `.repeat(Math.max(1,t.length-1)):"",y=r+i.length;return e.source&&(y+=e.source.length),{value:g,type:o,comment:i.comment,range:[r,y,y]}}let m=e.indent+i.indent,c=e.offset+i.length,l=0;for(let g=0;g<a;++g){let[y,x]=t[g];if(x===""||x==="\r")i.indent===0&&y.length>m&&(m=y.length);else{y.length<m&&n(c+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(m=y.length),l=g,m===0&&!s.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=y.length+x.length+1}for(let g=t.length-1;g>=a;--g)t[g][0].length>m&&(a=g+1);let p="",f="",d=!1;for(let g=0;g<l;++g)p+=t[g][0].slice(m)+`
71
+ `;for(let g=l;g<a;++g){let[y,x]=t[g];c+=y.length+x.length+1;let u=x[x.length-1]==="\r";if(u&&(x=x.slice(0,-1)),x&&y.length<m){let k=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-x.length-(u?2:1),"BAD_INDENT",k),y=""}o===se.BLOCK_LITERAL?(p+=f+y.slice(m)+x,f=`
72
+ `):y.length>m||x[0]===" "?(f===" "?f=`
73
+ `:!d&&f===`
74
+ `&&(f=`
75
+
76
+ `),p+=f+y.slice(m)+x,f=`
77
+ `,d=!0):x===""?f===`
78
+ `?p+=`
79
+ `:f=`
80
+ `:(p+=f+x,f=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let g=a;g<t.length;++g)p+=`
81
+ `+t[g][0].slice(m);p[p.length-1]!==`
82
+ `&&(p+=`
83
+ `);break;default:p+=`
84
+ `}let h=r+i.length+e.source.length;return{value:p,type:o,comment:i.comment,range:[r,h,h]}}function np({offset:s,props:e},n,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],t=0,a="",m=-1;for(let f=1;f<i.length;++f){let d=i[f];if(!a&&(d==="-"||d==="+"))a=d;else{let h=Number(d);!t&&h?t=h:m===-1&&(m=s+f)}}m!==-1&&r(m,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,l="",p=i.length;for(let f=1;f<e.length;++f){let d=e[f];switch(d.type){case"space":c=!0;case"newline":p+=d.source.length;break;case"comment":n&&!c&&r(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),p+=d.source.length,l=d.source.substring(1);break;case"error":r(d,"UNEXPECTED_TOKEN",d.message),p+=d.source.length;break;default:{let h=`Unexpected token in block scalar header: ${d.type}`;r(d,"UNEXPECTED_TOKEN",h);let g=d.source;g&&typeof g=="string"&&(p+=g.length)}}}return{mode:o,indent:t,chomp:a,comment:l,length:p}}function rp(s){let e=s.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let t=1;t<e.length;t+=2)o.push([e[t],e[t+1]]);return o}function ci(s,e,n){let{offset:r,type:i,source:o,end:t}=s,a,m,c=(f,d,h)=>n(r+f,d,h);switch(i){case"scalar":a=se.PLAIN,m=ip(o,c);break;case"single-quoted-scalar":a=se.QUOTE_SINGLE,m=ap(o,c);break;case"double-quoted-scalar":a=se.QUOTE_DOUBLE,m=op(o,c);break;default:return n(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let l=r+o.length,p=_t(t,l,e,n);return{value:m,type:a,comment:p.comment,range:[r,l,p.offset]}}function ip(s,e){let n="";switch(s[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${s[0]}`;break}case"@":case"`":{n=`reserved character ${s[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),eo(s)}function ap(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),eo(s.slice(1,-1)).replace(/''/g,"'")}function eo(s){let e=/(.*?)\r?\n/sy,n=e.exec(s);if(!n)return s;let r,i;try{r=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=n[1].replace(r,""),t=" ",a=e.lastIndex;for(;n=e.exec(s);){let c=n[1].replace(i,"");c===""?t===`
85
+ `?o+=t:t=`
86
+ `:(o+=t+c,t=" "),a=e.lastIndex}let m=/[ \t]*(.*)/sy;return m.lastIndex=a,n=m.exec(s),o+t+(n?.[1]??"")}function op(s,e){let n="";for(let r=1;r<s.length-1;++r){let i=s[r];if(!(i==="\r"&&s[r+1]===`
87
+ `))if(i===`
88
+ `){let{fold:o,offset:t}=lp(s,r);n+=o,r=t}else if(i==="\\"){let o=s[++r],t=pp[o];if(t)n+=t;else if(o===`
89
+ `)for(o=s[r+1];o===" "||o===" ";)o=s[++r+1];else if(o==="\r"&&s[r+1]===`
90
+ `)for(o=s[++r+1];o===" "||o===" ";)o=s[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=cp(s,r+1,a,e),r+=a}else{let a=s.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,t=s[r+1];for(;t===" "||t===" ";)t=s[++r+1];t!==`
91
+ `&&!(t==="\r"&&s[r+2]===`
92
+ `)&&(n+=r>o?s.slice(o,r+1):i)}else n+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),n}function lp(s,e){let n="",r=s[e+1];for(;(r===" "||r===" "||r===`
93
+ `||r==="\r")&&!(r==="\r"&&s[e+2]!==`
94
+ `);)r===`
95
+ `&&(n+=`
96
+ `),e+=1,r=s[e+1];return n||(n=" "),{fold:n,offset:e}}var pp={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 cp(s,e,n,r){let i=s.substr(e,n),t=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(t)}catch{let a=s.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function fi(s,e,n,r){let{value:i,type:o,comment:t,range:a}=e.type==="block-scalar"?pi(s,e,r):ci(e,s.options.strict,r),m=n?s.directives.tagName(n.source,p=>r(n,"TAG_RESOLVE_FAILED",p)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[mt]:m?c=fp(s.schema,i,m,n,r):e.type==="scalar"?c=dp(s,i,e,r):c=s.schema[mt];let l;try{let p=c.resolve(i,f=>r(n??e,"TAG_RESOLVE_FAILED",f),s.options);l=he(p)?p:new se(p)}catch(p){let f=p instanceof Error?p.message:String(p);r(n??e,"TAG_RESOLVE_FAILED",f),l=new se(i)}return l.range=a,l.source=i,o&&(l.type=o),m&&(l.tag=m),c.format&&(l.format=c.format),t&&(l.comment=t),l}function fp(s,e,n,r,i){if(n==="!")return s[mt];let o=[];for(let a of s.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let t=s.knownTags[n];return t&&!t.collection?(s.tags.push(Object.assign({},t,{default:!1,test:void 0})),t):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),s[mt])}function dp({atKey:s,directives:e,schema:n},r,i,o){let t=n.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(r))||n[mt];if(n.compat){let a=n.compat.find(m=>m.default&&m.test?.test(r))??n[mt];if(t.tag!==a.tag){let m=e.tagString(t.tag),c=e.tagString(a.tag),l=`Value may be parsed as either ${m} or ${c}`;o(i,"TAG_RESOLVE_FAILED",l,!0)}}return t}function to(s,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++r];i?.type==="space";)s+=i.source.length,i=e[++r];break}}return s}var mp={composeNode:di,composeEmptyNode:sr};function di(s,e,n,r){let i=s.atKey,{spaceBefore:o,comment:t,anchor:a,tag:m}=n,c,l=!0;switch(e.type){case"alias":c=up(s,e,r),(a||m)&&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":c=fi(s,e,m,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Qa(mp,s,e,n,r),a&&(c.anchor=a.source.substring(1))}catch(p){let f=p instanceof Error?p.message:String(p);r(e,"RESOURCE_EXHAUSTION",f)}break;default:{let p=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",p),l=!1}}return c??(c=sr(s,e.offset,void 0,null,n,r)),a&&c.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&s.options.stringKeys&&(!he(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&r(m??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),t&&(e.type==="scalar"&&e.source===""?c.comment=t:c.commentBefore=t),s.options.keepSourceTokens&&l&&(c.srcToken=e),c}function sr(s,e,n,r,{spaceBefore:i,comment:o,anchor:t,tag:a,end:m},c){let l={type:"scalar",offset:to(e,n,r),indent:-1,source:""},p=fi(s,l,a,c);return t&&(p.anchor=t.source.substring(1),p.anchor===""&&c(t,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(p.spaceBefore=!0),o&&(p.comment=o,p.range[2]=m),p}function up({options:s},{offset:e,source:n,end:r},i){let o=new Ft(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let t=e+n.length,a=_t(r,t,s.strict,i);return o.range=[e,t,a.offset],a.comment&&(o.comment=a.comment),o}function so(s,e,{offset:n,start:r,value:i,end:o},t){let a=Object.assign({_directives:e},s),m=new rs(void 0,a),c={atKey:!1,atRoot:!0,directives:m.directives,options:m.options,schema:m.schema},l=Lt(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:t,parentIndent:0,startOnNewline:!0});l.found&&(m.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!l.hasNewline&&t(l.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),m.contents=i?di(c,i,l,t):sr(c,l.end,r,null,l,t);let p=m.contents.range[2],f=_t(o,p,!1,t);return f.comment&&(m.comment=f.comment),m.range=[n,p,f.offset],m}function an(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:n}=s;return[e,e+(typeof n=="string"?n.length:1)]}function no(s){let e="",n=!1,r=!1;for(let i=0;i<s.length;++i){let o=s[i];switch(o[0]){case"#":e+=(e===""?"":r?`
98
+
99
+ `:`
100
+ `)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":s[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var on=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let t=an(n);o?this.warnings.push(new nn(t,r,i)):this.errors.push(new At(t,r,i))},this.directives=new Rt({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=no(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
101
+ ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(Me(o)&&!o.flow&&o.items.length>0){let t=o.items[0];xe(t)&&(t=t.key);let a=t.commentBefore;t.commentBefore=a?`${r}
102
+ ${a}`:r}else{let t=o.commentBefore;o.commentBefore=t?`${r}
103
+ ${t}`:r}}if(n){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:no(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=an(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=so(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new At(an(e),"UNEXPECTED_TOKEN",n);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 At(an(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=_t(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
104
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new At(an(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-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 rs(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};var mi=Symbol("break visit"),hp=Symbol("skip children"),ro=Symbol("remove item");function ms(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),io(Object.freeze([]),s,e)}ms.BREAK=mi;ms.SKIP=hp;ms.REMOVE=ro;ms.itemAtPath=(s,e)=>{let n=s;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};ms.parentCollection=(s,e)=>{let n=ms.itemAtPath(s,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function io(s,e,n){let r=n(e,s);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let t=0;t<o.items.length;++t){let a=io(Object.freeze(s.concat([[i,t]])),o.items[t],n);if(typeof a=="number")t=a-1;else{if(a===mi)return mi;a===ro&&(o.items.splice(t,1),t-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,s))}}return typeof r=="function"?r(e,s):r}var ui="\uFEFF",hi="",yi="",nr="";function ao(s){switch(s){case ui:return"byte-order-mark";case hi:return"doc-mode";case yi:return"flow-error-end";case nr:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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(s[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 Mt(s){switch(s){case void 0:case" ":case`
107
+ `:case"\r":case" ":return!0;default:return!1}}var oo=new Set("0123456789ABCDEFabcdef"),gp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),rr=new Set(",[]{}"),bp=new Set(` ,[]{}
108
+ \r `),gi=s=>!s||bp.has(s),ln=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,n=!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=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
109
+ `?!0:n==="\r"?this.buffer[e+1]===`
110
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
111
+ `||!i&&!this.atEnd)return e+r+1}return n===`
112
+ `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Mt(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]===ui&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield hi,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 n=this.peek(3);if((n==="---"||n==="...")&&Mt(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Mt(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Mt(n)){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 n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);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(gi),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>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("..."))&&Mt(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield yi,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(gi),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let t=this.charAt(1);if(this.flowKey||Mt(t)||t===",")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),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
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&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Mt(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
116
+ `:e=o,n=0;break;case"\r":{let t=this.buffer[o+1];if(!t&&!this.atEnd)return this.setNext("block-scalar");if(t===`
117
+ `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n: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
+ `,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
+ `;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,t=this.buffer[o];t==="\r"&&(t=this.buffer[--o]);let a=o;for(;t===" ";)t=this.buffer[--o];if(t===`
120
+ `&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield nr,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Mt(o)||e&&rr.has(o))break;n=r}else if(Mt(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
121
+ `?(r+=1,i=`
122
+ `,o=this.buffer[r+1]):n=r),o==="#"||e&&rr.has(o))break;if(i===`
123
+ `){let t=this.continueScalar(r+1);if(t===-1)break;r=Math.max(r,t-2)}}else{if(e&&rr.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield nr,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(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(gi),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Mt(r)||n&&rr.has(r)){n?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,n=this.buffer[e];for(;!Mt(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(gp.has(n))n=this.buffer[++e];else if(n==="%"&&oo.has(this.buffer[e+1])&&oo.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
124
+ `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
125
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};var us=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};function as(s,e){for(let n=0;n<s.length;++n)if(s[n].type===e)return!0;return!1}function lo(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function co(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ir(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Ts(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function ar(s,e){if(e.length<1e5)Array.prototype.push.apply(s,e);else for(let n=0;n<e.length;++n)s.push(e[n])}function po(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!as(e.start,"explicit-key-ind")&&!as(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,co(e.value)?e.value.end?ar(e.value.end,e.sep):e.value.end=e.sep:ar(e.start,e.sep),delete e.sep)}var pn=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 ln,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=ao(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&po(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,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:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&lo(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.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":{lo(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 n=this.startBlockValue(e);n?this.stack.push(n):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 n=ir(this.peek(2)),r=Ts(n),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 n=this.source.indexOf(`
126
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
127
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.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 n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ar(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let t=[];for(let a=0;a<n.sep.length;++a){let m=n.sep[a];switch(m.type){case"newline":t.push(a);break;case"space":break;case"comment":m.indent>e.indent&&(t.length=0);break;default:t.length=0}}t.length>=2&&(o=n.sep.splice(t[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(as(n.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(co(n.key)&&!as(n.sep,"newline")){let t=Ts(n.start),a=n.key,m=n.sep;m.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:a,sep:m}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(as(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let t=Ts(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):as(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let t=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:t,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(t):(Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!0);return}default:{let t=this.startBlockValue(e);if(t){if(t.type==="block-seq"){if(!n.explicitKey&&n.sep&&!as(n.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(t);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.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 n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ar(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||as(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.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 n=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":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{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=ir(r),o=Ts(i);po(e);let t=e.end.splice(1,e.end.length);t.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:t}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
128
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
129
+ `,n)+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 n=ir(e),r=Ts(n);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 n=ir(e),r=Ts(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!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 wp(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new us||null,prettyErrors:e}}function or(s,e={}){let{lineCounter:n,prettyErrors:r}=wp(e),i=new pn(n?.addNewLine),o=new on(e),t=null;for(let a of o.compose(i.parse(s),!0,s.length))if(!t)t=a;else if(t.options.logLevel!=="silent"){t.errors.push(new At(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(t.errors.forEach(ii(s,n)),t.warnings.forEach(ii(s,n))),t}function bi(s,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=or(s,n);if(!i)return null;if(i.warnings.forEach(o=>Ln(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},n))}function fo(s){return s.split("/").slice(1).map(e=>{let n=e.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(n)?Number(n):n})}function mo(s){let e=new us,n=or(s,{lineCounter:e,prettyErrors:!1,uniqueKeys:!0}),r=[],i=m=>{let c=e.linePos(m);return{line:c.line,col:c.col}};for(let m of n.errors){let c=i(m.pos[0]),l=m.message.split(`
130
+ `)[0],p=/Nested mappings|Implicit keys|mapping values/i.test(l)?`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(l)?"a key is written twice in the same map":void 0;r.push({severity:"error",message:`YAML: ${l}`,line:c.line,col:c.col,path:"",hint:p})}for(let m of n.warnings){let c=i(m.pos[0]);r.push({severity:"warning",message:`YAML: ${m.message.split(`
131
+ `)[0]}`,line:c.line,col:c.col,path:""})}function o(m,c={}){let l=fo(m),p=n.contents,f={line:1,col:1},d=h=>{let g=h?.range;g&&(f=i(g[0]))};d(p);for(let h=0;h<l.length;h++){let g=l[h];if(at(p)){let y=p.items.find(x=>xe(x)&&he(x.key)&&String(x.key.value)===String(g));if(!y)break;if(c.key&&h===l.length-1)return d(y.key),f;d(y.key),p=y.value,p&&d(p)}else if(ot(p)&&typeof g=="number"){if(p=p.items[g],!p)break;d(p)}else break}return f}function t(m){let c=n.contents;for(let d of fo(m)){if(at(c)){let h=c.items.find(g=>xe(g)&&he(g.key)&&String(g.key.value)===String(d));if(!h)return;c=h.value}else if(ot(c)&&typeof d=="number")c=c.items[d];else return;if(!c)return}let l=c.range;if(!l)return;let p=e.linePos(Math.max(l[0],l[1]-1)).line,f=s.split(/\r?\n/);for(;p>e.linePos(l[0]).line&&/^\s*(#.*)?$/.test(f[p-1]??"");)p--;return{start:e.linePos(l[0]).line,end:p}}let a=null;return n.errors.length||(a=n.toJS({maxAliasCount:100})),{data:a,locate:o,span:t,diags:r}}var ho=pr,Pe={$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}]}}}}},Ge={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"}}},bt={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"]}}},Ke={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"}}},cn=Object.prototype.hasOwnProperty,H={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_-]*$"},Fe=new RegExp("^[A-Za-z][A-Za-z0-9_-]*$","u"),me={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"}}}},pt={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},wi={enum:["n","e","s","w"]},ye={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"}}},uo={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"}}},Ie={type:"array",items:{type:"number"},minItems:2,maxItems:2},ki={enum:["start","center","end"]},we={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function Ut(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=Ut.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),s&&typeof s=="object"&&!Array.isArray(s)){if(s.in!==void 0){let p=s.in;if(typeof p=="string"){if(!Fe.test(p)){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:ee,data:p};t===null?t=[f]:t.push(f),a++}}else{let f={instancePath:e+"/in",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:p};t===null?t=[f]:t.push(f),a++}}if(s.at!==void 0){let p=s.at;if(Array.isArray(p)){if(p.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:Ie,data:p};t===null?t=[d]:t.push(d),a++}if(p.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:Ie,data:p};t===null?t=[d]:t.push(d),a++}let f=p.length;for(let d=0;d<f;d++){let h=p[d];if(typeof h!="number"){let g={instancePath:e+"/at/"+d,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ie.items.type,parentSchema:Ie.items,data:h};t===null?t=[g]:t.push(g),a++}}}else{let f={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Ie.type,parentSchema:Ie,data:p};t===null?t=[f]:t.push(f),a++}}if(s["right-of"]!==void 0){let p=s["right-of"];if(typeof p=="string"){if(!Fe.test(p)){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:ee,data:p};t===null?t=[f]:t.push(f),a++}}else{let f={instancePath:e+"/right-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:p};t===null?t=[f]:t.push(f),a++}}if(s["left-of"]!==void 0){let p=s["left-of"];if(typeof p=="string"){if(!Fe.test(p)){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:ee,data:p};t===null?t=[f]:t.push(f),a++}}else{let f={instancePath:e+"/left-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:p};t===null?t=[f]:t.push(f),a++}}if(s.below!==void 0){let p=s.below;if(typeof p=="string"){if(!Fe.test(p)){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:ee,data:p};t===null?t=[f]:t.push(f),a++}}else{let f={instancePath:e+"/below",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:p};t===null?t=[f]:t.push(f),a++}}if(s.behind!==void 0){let p=s.behind;if(typeof p=="string"){if(!Fe.test(p)){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:ee,data:p};t===null?t=[f]:t.push(f),a++}}else{let f={instancePath:e+"/behind",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:p};t===null?t=[f]:t.push(f),a++}}if(s.gap!==void 0){let p=s.gap;if(typeof p!="number"){let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:uo.properties.gap.type,parentSchema:uo.properties.gap,data:p};t===null?t=[f]:t.push(f),a++}}if(s.align!==void 0){let p=s.align;if(!(p==="start"||p==="center"||p==="end")){let f={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:ki.enum},message:"must be equal to one of the allowed values",schema:ki.enum,parentSchema:ki,data:p};t===null?t=[f]:t.push(f),a++}}if(s.shift!==void 0){let p=s.shift;if(Array.isArray(p)){if(p.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:Ie,data:p};t===null?t=[d]:t.push(d),a++}if(p.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:Ie,data:p};t===null?t=[d]:t.push(d),a++}let f=p.length;for(let d=0;d<f;d++){let h=p[d];if(typeof h!="number"){let g={instancePath:e+"/shift/"+d,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ie.items.type,parentSchema:Ie.items,data:h};t===null?t=[g]:t.push(g),a++}}}else{let f={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Ie.type,parentSchema:Ie,data:p};t===null?t=[f]:t.push(f),a++}}if(s.appears!==void 0){let p=s.appears,f=a,d=!1,h=a;if(typeof p!="string"){let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.anyOf[0].type,parentSchema:we.anyOf[0],data:p};t===null?t=[y]:t.push(y),a++}var c=h===a;d=d||c;let g=a;if(!(typeof p=="number"&&!(p%1)&&!isNaN(p))){let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.anyOf[1].type,parentSchema:we.anyOf[1],data:p};t===null?t=[y]:t.push(y),a++}if(typeof p=="number"&&(p<1||isNaN(p))){let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.anyOf[1],data:p};t===null?t=[y]:t.push(y),a++}var c=g===a;if(d=d||c,d)a=f,t!==null&&(f?t.length=f:t=null);else{let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.anyOf,parentSchema:we,data:p};t===null?t=[y]:t.push(y),a++}}if(s.disappears!==void 0){let p=s.disappears,f=a,d=!1,h=a;if(typeof p!="string"){let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.anyOf[0].type,parentSchema:we.anyOf[0],data:p};t===null?t=[y]:t.push(y),a++}var l=h===a;d=d||l;let g=a;if(!(typeof p=="number"&&!(p%1)&&!isNaN(p))){let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.anyOf[1].type,parentSchema:we.anyOf[1],data:p};t===null?t=[y]:t.push(y),a++}if(typeof p=="number"&&(p<1||isNaN(p))){let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.anyOf[1],data:p};t===null?t=[y]:t.push(y),a++}var l=g===a;if(d=d||l,d)a=f,t!==null&&(f?t.length=f:t=null);else{let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.anyOf,parentSchema:we,data:p};t===null?t=[y]:t.push(y),a++}}}return Ut.errors=t,a===0}Ut.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 qe={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"}}}}},ke={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"}}}]},Es=new RegExp("^[a-z][a-z0-9-]*$","u");function Gt(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=Gt.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),s&&typeof s=="object"&&!Array.isArray(s)){if(Object.keys(s).length<1){let p={instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:qe,data:s};t===null?t=[p]:t.push(p),a++}for(let p in s){let f=a;if(typeof p=="string"){if(!Fe.test(p)){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:ee,data:p,propertyName:p};t===null?t=[d]:t.push(d),a++}}else{let d={instancePath:e,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:p,propertyName:p};t===null?t=[d]:t.push(d),a++}var c=f===a;if(!c){let d={instancePath:e,schemaPath:"#/propertyNames",keyword:"propertyNames",params:{propertyName:p},message:"property name must be valid",schema:qe.propertyNames,parentSchema:qe,data:s};t===null?t=[d]:t.push(d),a++}}for(let p in s){let f=s[p];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Object.keys(f).length<1){let d={instancePath:e+"/"+p.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:qe.additionalProperties,data:f};t===null?t=[d]:t.push(d),a++}for(let d in f)if(!(d==="role"||d==="ghost"||d==="label"||d==="sub"||d==="face"||d==="deco")){let h={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:qe.additionalProperties,data:f};t===null?t=[h]:t.push(h),a++}if(f.role!==void 0){let d=f.role;if(typeof d!="string"){let h={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/role",schemaPath:"#/additionalProperties/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.additionalProperties.properties.role.type,parentSchema:qe.additionalProperties.properties.role,data:d};t===null?t=[h]:t.push(h),a++}}if(f.ghost!==void 0){let d=f.ghost;if(typeof d!="boolean"){let h={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/ghost",schemaPath:"#/additionalProperties/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:qe.additionalProperties.properties.ghost.type,parentSchema:qe.additionalProperties.properties.ghost,data:d};t===null?t=[h]:t.push(h),a++}}if(f.label!==void 0){let d=f.label;if(typeof d!="string"){let h={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/label",schemaPath:"#/additionalProperties/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.additionalProperties.properties.label.type,parentSchema:qe.additionalProperties.properties.label,data:d};t===null?t=[h]:t.push(h),a++}}if(f.sub!==void 0){let d=f.sub;if(typeof d!="string"){let h={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/sub",schemaPath:"#/additionalProperties/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.additionalProperties.properties.sub.type,parentSchema:qe.additionalProperties.properties.sub,data:d};t===null?t=[h]:t.push(h),a++}}if(f.face!==void 0){let d=f.face;if(typeof d=="string"){if(!Es.test(d)){let h={instancePath:e+"/"+p.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:qe.additionalProperties.properties.face,data:d};t===null?t=[h]:t.push(h),a++}}else{let h={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.additionalProperties.properties.face.type,parentSchema:qe.additionalProperties.properties.face,data:d};t===null?t=[h]:t.push(h),a++}}if(f.deco!==void 0){let d=f.deco;if(Array.isArray(d)){let h=d.length;for(let g=0;g<h;g++){let y=d[g],x=a,u=!1,b=a;if(!(y==="envelope"||y==="bubble"||y==="file-lines"||y==="ghost"||y==="terminal")){let w={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:ke.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:ke.anyOf[0].enum,parentSchema:ke.anyOf[0],data:y};t===null?t=[w]:t.push(w),a++}var l=b===a;u=u||l;let k=a;if(y&&typeof y=="object"&&!Array.isArray(y)){if(Object.keys(y).length>1){let w={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:ke.anyOf[1],data:y};t===null?t=[w]:t.push(w),a++}if(Object.keys(y).length<1){let w={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:ke.anyOf[1],data:y};t===null?t=[w]:t.push(w),a++}for(let w in y)if(!(w==="terminal"||w==="icon"||w==="screen")){let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties",schema:!1,parentSchema:ke.anyOf[1],data:y};t===null?t=[v]:t.push(v),a++}if(y.terminal!==void 0){let w=y.terminal;if(!(typeof w=="number"&&!(w%1)&&!isNaN(w))){let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:ke.anyOf[1].properties.terminal.type,parentSchema:ke.anyOf[1].properties.terminal,data:w};t===null?t=[v]:t.push(v),a++}if(typeof w=="number"){if(w>8||isNaN(w)){let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:ke.anyOf[1].properties.terminal,data:w};t===null?t=[v]:t.push(v),a++}if(w<1||isNaN(w)){let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:ke.anyOf[1].properties.terminal,data:w};t===null?t=[v]:t.push(v),a++}}}if(y.icon!==void 0){let w=y.icon;if(typeof w=="string"){if(!Es.test(w)){let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g+"/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:ke.anyOf[1].properties.icon,data:w};t===null?t=[v]:t.push(v),a++}}else{let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.anyOf[1].properties.icon.type,parentSchema:ke.anyOf[1].properties.icon,data:w};t===null?t=[v]:t.push(v),a++}}if(y.screen!==void 0){let w=y.screen;if(typeof w=="string"){if(!Es.test(w)){let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g+"/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:ke.anyOf[1].properties.screen,data:w};t===null?t=[v]:t.push(v),a++}}else{let v={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.anyOf[1].properties.screen.type,parentSchema:ke.anyOf[1].properties.screen,data:w};t===null?t=[v]:t.push(v),a++}}}else{let w={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ke.anyOf[1].type,parentSchema:ke.anyOf[1],data:y};t===null?t=[w]:t.push(w),a++}var l=k===a;if(u=u||l,u)a=x,t!==null&&(x?t.length=x:t=null);else{let w={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+g,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ke.anyOf,parentSchema:ke,data:y};t===null?t=[w]:t.push(w),a++}}}else{let h={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco",schemaPath:"#/additionalProperties/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:qe.additionalProperties.properties.deco.type,parentSchema:qe.additionalProperties.properties.deco,data:d};t===null?t=[h]:t.push(h),a++}}}else{let d={instancePath:e+"/"+p.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object",schema:qe.additionalProperties.type,parentSchema:qe.additionalProperties,data:f};t===null?t=[d]:t.push(d),a++}}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:qe.type,parentSchema:qe,data:s};t===null?t=[p]:t.push(p),a++}return Gt.errors=t,a===0}Gt.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Se={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"}}},xi={validate:Dt};function Dt(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=Dt.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),Ut(s,{instancePath:e,parentData:n,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(t=t===null?Ut.errors:t.concat(Ut.errors),a=t.length),s&&typeof s=="object"&&!Array.isArray(s)){if(s.id===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:Se.required,parentSchema:Se,data:s};t===null?t=[l]:t.push(l),a++}if(s.id!==void 0){let l=s.id;if(typeof l=="string"){if(!Fe.test(l)){let p={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};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:l};t===null?t=[p]:t.push(p),a++}}if(s.asset!==void 0){let l=s.asset;if(typeof l!="string"){let p={instancePath:e+"/asset",schemaPath:"#/properties/asset/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Se.properties.asset.type,parentSchema:Se.properties.asset,data:l};t===null?t=[p]:t.push(p),a++}}if(s.role!==void 0){let l=s.role;if(typeof l!="string"){let p={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Se.properties.role.type,parentSchema:Se.properties.role,data:l};t===null?t=[p]:t.push(p),a++}}if(s.label!==void 0){let l=s.label;if(typeof l!="string"){let p={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Se.properties.label.type,parentSchema:Se.properties.label,data:l};t===null?t=[p]:t.push(p),a++}}if(s.sub!==void 0){let l=s.sub;if(typeof l!="string"){let p={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Se.properties.sub.type,parentSchema:Se.properties.sub,data:l};t===null?t=[p]:t.push(p),a++}}if(s.size!==void 0){let l=s.size;if(Array.isArray(l)){if(l.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:pt,data:l};t===null?t=[f]:t.push(f),a++}if(l.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:pt,data:l};t===null?t=[f]:t.push(f),a++}let p=l.length;for(let f=0;f<p;f++){let d=l[f];if(typeof d=="number"){if(d<=0||isNaN(d)){let h={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:pt.items,data:d};t===null?t=[h]:t.push(h),a++}}else{let h={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:pt.items.type,parentSchema:pt.items,data:d};t===null?t=[h]:t.push(h),a++}}}else{let p={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:pt.type,parentSchema:pt,data:l};t===null?t=[p]:t.push(p),a++}}if(s.z!==void 0){let l=s.z;if(typeof l!="number"){let p={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Se.properties.z.type,parentSchema:Se.properties.z,data:l};t===null?t=[p]:t.push(p),a++}}if(s.deco!==void 0){let l=s.deco;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++){let d=l[f],h=a,g=!1,y=a;if(!(d==="envelope"||d==="bubble"||d==="file-lines"||d==="ghost"||d==="terminal")){let u={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:ke.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:ke.anyOf[0].enum,parentSchema:ke.anyOf[0],data:d};t===null?t=[u]:t.push(u),a++}var c=y===a;g=g||c;let x=a;if(d&&typeof d=="object"&&!Array.isArray(d)){if(Object.keys(d).length>1){let u={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:ke.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}if(Object.keys(d).length<1){let u={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:ke.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}for(let u in d)if(!(u==="terminal"||u==="icon"||u==="screen")){let b={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:ke.anyOf[1],data:d};t===null?t=[b]:t.push(b),a++}if(d.terminal!==void 0){let u=d.terminal;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){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:ke.anyOf[1].properties.terminal.type,parentSchema:ke.anyOf[1].properties.terminal,data:u};t===null?t=[b]:t.push(b),a++}if(typeof u=="number"){if(u>8||isNaN(u)){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:ke.anyOf[1].properties.terminal,data:u};t===null?t=[b]:t.push(b),a++}if(u<1||isNaN(u)){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:ke.anyOf[1].properties.terminal,data:u};t===null?t=[b]:t.push(b),a++}}}if(d.icon!==void 0){let u=d.icon;if(typeof u=="string"){if(!Es.test(u)){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:ke.anyOf[1].properties.icon,data:u};t===null?t=[b]:t.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:ke.anyOf[1].properties.icon.type,parentSchema:ke.anyOf[1].properties.icon,data:u};t===null?t=[b]:t.push(b),a++}}if(d.screen!==void 0){let u=d.screen;if(typeof u=="string"){if(!Es.test(u)){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:ke.anyOf[1].properties.screen,data:u};t===null?t=[b]:t.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:ke.anyOf[1].properties.screen.type,parentSchema:ke.anyOf[1].properties.screen,data:u};t===null?t=[b]:t.push(b),a++}}}else{let u={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ke.anyOf[1].type,parentSchema:ke.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}var c=x===a;if(g=g||c,g)a=h,t!==null&&(h?t.length=h:t=null);else{let u={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ke.anyOf,parentSchema:ke,data:d};t===null?t=[u]:t.push(u),a++}}}else{let p={instancePath:e+"/deco",schemaPath:"#/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Se.properties.deco.type,parentSchema:Se.properties.deco,data:l};t===null?t=[p]:t.push(p),a++}}if(s.ghost!==void 0){let l=s.ghost;if(typeof l!="boolean"){let p={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Se.properties.ghost.type,parentSchema:Se.properties.ghost,data:l};t===null?t=[p]:t.push(p),a++}}if(s.face!==void 0){let l=s.face;if(typeof l=="string"){if(!Es.test(l)){let p={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:Se.properties.face,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Se.properties.face.type,parentSchema:Se.properties.face,data:l};t===null?t=[p]:t.push(p),a++}}if(s.facing!==void 0){let l=s.facing;if(typeof l!="number"){let p={instancePath:e+"/facing",schemaPath:"#/properties/facing/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Se.properties.facing.type,parentSchema:Se.properties.facing,data:l};t===null?t=[p]:t.push(p),a++}}if(s["label-at"]!==void 0){let l=s["label-at"];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let p in l)if(!(p==="side"||p==="dx"||p==="dy")){let f={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:Se.properties["label-at"],data:l};t===null?t=[f]:t.push(f),a++}if(l.side!==void 0){let p=l.side;if(!(p==="above"||p==="right"||p==="left"||p==="below")){let f={instancePath:e+"/label-at/side",schemaPath:"#/properties/label-at/properties/side/enum",keyword:"enum",params:{allowedValues:Se.properties["label-at"].properties.side.enum},message:"must be equal to one of the allowed values",schema:Se.properties["label-at"].properties.side.enum,parentSchema:Se.properties["label-at"].properties.side,data:p};t===null?t=[f]:t.push(f),a++}}if(l.dx!==void 0){let p=l.dx;if(typeof p!="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:Se.properties["label-at"].properties.dx.type,parentSchema:Se.properties["label-at"].properties.dx,data:p};t===null?t=[f]:t.push(f),a++}}if(l.dy!==void 0){let p=l.dy;if(typeof p!="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:Se.properties["label-at"].properties.dy.type,parentSchema:Se.properties["label-at"].properties.dy,data:p};t===null?t=[f]:t.push(f),a++}}}else{let p={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Se.properties["label-at"].type,parentSchema:Se.properties["label-at"],data:l};t===null?t=[p]:t.push(p),a++}}if(s.motion!==void 0){let l=s.motion;if(l&&typeof l=="object"&&!Array.isArray(l)){if(Object.keys(l).length<1){let p={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:ye,data:l};t===null?t=[p]:t.push(p),a++}for(let p in l)if(!(p==="style"||p==="out"||p==="easing"||p==="from"||p==="delay"||p==="duration")){let f={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:ye,data:l};t===null?t=[f]:t.push(f),a++}if(l.style!==void 0){let p=l.style;if(!(p==="edge"||p==="drop"||p==="rise"||p==="fly"||p==="pop"||p==="scatter"||p==="build"||p==="fade")){let f={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:ye.properties.style.enum},message:"must be equal to one of the allowed values",schema:ye.properties.style.enum,parentSchema:ye.properties.style,data:p};t===null?t=[f]:t.push(f),a++}}if(l.out!==void 0){let p=l.out;if(!(p==="explode"||p==="lift-off"||p==="sink"||p==="scatter"||p==="fly-out"||p==="collapse"||p==="fade"||p==="reverse")){let f={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:ye.properties.out.enum},message:"must be equal to one of the allowed values",schema:ye.properties.out.enum,parentSchema:ye.properties.out,data:p};t===null?t=[f]:t.push(f),a++}}if(l.easing!==void 0){let p=l.easing;if(!(p==="linear"||p==="ease"||p==="ease-in"||p==="ease-out"||p==="settle"||p==="spring"||p==="bounce")){let f={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:ye.properties.easing.enum},message:"must be equal to one of the allowed values",schema:ye.properties.easing.enum,parentSchema:ye.properties.easing,data:p};t===null?t=[f]:t.push(f),a++}}if(l.from!==void 0){let p=l.from;if(!(p==="left"||p==="right"||p==="top"||p==="bottom")){let f={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:ye.properties.from.enum},message:"must be equal to one of the allowed values",schema:ye.properties.from.enum,parentSchema:ye.properties.from,data:p};t===null?t=[f]:t.push(f),a++}}if(l.delay!==void 0){let p=l.delay;if(typeof p=="number"){if(p<0||isNaN(p)){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:ye.properties.delay,data:p};t===null?t=[f]:t.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:ye.properties.delay.type,parentSchema:ye.properties.delay,data:p};t===null?t=[f]:t.push(f),a++}}if(l.duration!==void 0){let p=l.duration;if(typeof p=="number"){if(p<=0||isNaN(p)){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:ye.properties.duration,data:p};t===null?t=[f]:t.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:ye.properties.duration.type,parentSchema:ye.properties.duration,data:p};t===null?t=[f]:t.push(f),a++}}}else{let p={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ye.type,parentSchema:ye,data:l};t===null?t=[p]:t.push(p),a++}}if(s.variants!==void 0&&(Gt(s.variants,{instancePath:e+"/variants",parentData:s,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(t=t===null?Gt.errors:t.concat(Gt.errors),a=t.length)),s.nodes!==void 0){let l=s.nodes;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++)xi.validate(l[f],{instancePath:e+"/nodes/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(t=t===null?xi.validate.errors:t.concat(xi.validate.errors),a=t.length)}else{let p={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Se.properties.nodes.type,parentSchema:Se.properties.nodes,data:l};t===null?t=[p]:t.push(p),a++}}for(let l in s)if(l!=="id"&&l!=="asset"&&l!=="role"&&l!=="label"&&l!=="sub"&&l!=="size"&&l!=="z"&&l!=="deco"&&l!=="ghost"&&l!=="face"&&l!=="facing"&&l!=="label-at"&&l!=="motion"&&l!=="variants"&&l!=="nodes"&&l!=="in"&&l!=="at"&&l!=="right-of"&&l!=="left-of"&&l!=="below"&&l!=="behind"&&l!=="gap"&&l!=="align"&&l!=="shift"&&l!=="appears"&&l!=="disappears"){let p={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:l},message:"must NOT have unevaluated properties",schema:!1,parentSchema:Se,data:s};t===null?t=[p]:t.push(p),a++}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Se.type,parentSchema:Se,data:s};t===null?t=[l]:t.push(l),a++}return Dt.errors=t,a===0}Dt.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var $i={validate:hs};function hs(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=hs.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),Ut(s,{instancePath:e,parentData:n,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(t=t===null?Ut.errors:t.concat(Ut.errors),a=t.length),s&&typeof s=="object"&&!Array.isArray(s)){if(s.id===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:me.required,parentSchema:me,data:s};t===null?t=[c]:t.push(c),a++}if(s.kind===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'",schema:me.required,parentSchema:me,data:s};t===null?t=[c]:t.push(c),a++}if(s.id!==void 0){let c=s.id;if(typeof c=="string"){if(!Fe.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};t===null?t=[l]:t.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};t===null?t=[l]:t.push(l),a++}}if(s.kind!==void 0){let c=s.kind;if(!(c==="slab"||c==="pad"||c==="fence"||c==="vm"||c==="cloud"||c==="zone"||c==="platform"||c==="tunnel")){let l={instancePath:e+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:me.properties.kind.enum},message:"must be equal to one of the allowed values",schema:me.properties.kind.enum,parentSchema:me.properties.kind,data:c};t===null?t=[l]:t.push(l),a++}}if(s.label!==void 0){let c=s.label;if(typeof c!="string"){let l={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:me.properties.label.type,parentSchema:me.properties.label,data:c};t===null?t=[l]:t.push(l),a++}}if(s["label-style"]!==void 0){let c=s["label-style"];if(!(c==="face"||c==="face-right"||c==="floor"||c==="none")){let l={instancePath:e+"/label-style",schemaPath:"#/properties/label-style/enum",keyword:"enum",params:{allowedValues:me.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:me.properties["label-style"].enum,parentSchema:me.properties["label-style"],data:c};t===null?t=[l]:t.push(l),a++}}if(s.ghost!==void 0){let c=s.ghost;if(typeof c!="boolean"){let l={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:me.properties.ghost.type,parentSchema:me.properties.ghost,data:c};t===null?t=[l]:t.push(l),a++}}if(s.role!==void 0){let c=s.role;if(typeof c!="string"){let l={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:me.properties.role.type,parentSchema:me.properties.role,data:c};t===null?t=[l]:t.push(l),a++}}if(s.size!==void 0){let c=s.size;if(Array.isArray(c)){if(c.length>3){let p={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:pt,data:c};t===null?t=[p]:t.push(p),a++}if(c.length<2){let p={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:pt,data:c};t===null?t=[p]:t.push(p),a++}let l=c.length;for(let p=0;p<l;p++){let f=c[p];if(typeof f=="number"){if(f<=0||isNaN(f)){let d={instancePath:e+"/size/"+p,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:pt.items,data:f};t===null?t=[d]:t.push(d),a++}}else{let d={instancePath:e+"/size/"+p,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:pt.items.type,parentSchema:pt.items,data:f};t===null?t=[d]:t.push(d),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:pt.type,parentSchema:pt,data:c};t===null?t=[l]:t.push(l),a++}}if(s.padding!==void 0){let c=s.padding;if(typeof c=="number"){if(c<0||isNaN(c)){let l={instancePath:e+"/padding",schemaPath:"#/properties/padding/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:me.properties.padding,data:c};t===null?t=[l]:t.push(l),a++}}else{let l={instancePath:e+"/padding",schemaPath:"#/properties/padding/type",keyword:"type",params:{type:"number"},message:"must be number",schema:me.properties.padding.type,parentSchema:me.properties.padding,data:c};t===null?t=[l]:t.push(l),a++}}if(s.height!==void 0){let c=s.height;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/height",schemaPath:"#/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:me.properties.height,data:c};t===null?t=[l]:t.push(l),a++}}else{let l={instancePath:e+"/height",schemaPath:"#/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:me.properties.height.type,parentSchema:me.properties.height,data:c};t===null?t=[l]:t.push(l),a++}}if(s.z!==void 0){let c=s.z;if(typeof c!="number"){let l={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:me.properties.z.type,parentSchema:me.properties.z,data:c};t===null?t=[l]:t.push(l),a++}}if(s.flow!==void 0){let c=s.flow;if(!(c==="row"||c==="column")){let l={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:c};t===null?t=[l]:t.push(l),a++}}if(s.gate!==void 0){let c=s.gate;if(c&&typeof c=="object"&&!Array.isArray(c)){if(c.side===void 0){let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/required",keyword:"required",params:{missingProperty:"side"},message:"must have required property 'side'",schema:me.properties.gate.required,parentSchema:me.properties.gate,data:c};t===null?t=[l]:t.push(l),a++}for(let l in c)if(!(l==="side"||l==="at"||l==="width"||l==="height"||l==="node")){let p={instancePath:e+"/gate",schemaPath:"#/properties/gate/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:me.properties.gate,data:c};t===null?t=[p]:t.push(p),a++}if(c.side!==void 0){let l=c.side;if(!(l==="n"||l==="e"||l==="s"||l==="w")){let p={instancePath:e+"/gate/side",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues:wi.enum},message:"must be equal to one of the allowed values",schema:wi.enum,parentSchema:wi,data:l};t===null?t=[p]:t.push(p),a++}}if(c.at!==void 0){let l=c.at;if(typeof l=="number"){if(l>1||isNaN(l)){let p={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/maximum",keyword:"maximum",params:{comparison:"<=",limit:1},message:"must be <= 1",schema:1,parentSchema:me.properties.gate.properties.at,data:l};t===null?t=[p]:t.push(p),a++}if(l<0||isNaN(l)){let p={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:me.properties.gate.properties.at,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/type",keyword:"type",params:{type:"number"},message:"must be number",schema:me.properties.gate.properties.at.type,parentSchema:me.properties.gate.properties.at,data:l};t===null?t=[p]:t.push(p),a++}}if(c.width!==void 0){let l=c.width;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:me.properties.gate.properties.width,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/type",keyword:"type",params:{type:"number"},message:"must be number",schema:me.properties.gate.properties.width.type,parentSchema:me.properties.gate.properties.width,data:l};t===null?t=[p]:t.push(p),a++}}if(c.height!==void 0){let l=c.height;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:me.properties.gate.properties.height,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:me.properties.gate.properties.height.type,parentSchema:me.properties.gate.properties.height,data:l};t===null?t=[p]:t.push(p),a++}}if(c.node!==void 0){let l=c.node;if(typeof l=="string"){if(!Fe.test(l)){let p={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:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:l};t===null?t=[p]:t.push(p),a++}}}else{let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/type",keyword:"type",params:{type:"object"},message:"must be object",schema:me.properties.gate.type,parentSchema:me.properties.gate,data:c};t===null?t=[l]:t.push(l),a++}}if(s.around!==void 0){let c=s.around;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++){let f=c[p];if(typeof f=="string"){if(!Fe.test(f)){let d={instancePath:e+"/around/"+p,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:f};t===null?t=[d]:t.push(d),a++}}else{let d={instancePath:e+"/around/"+p,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:f};t===null?t=[d]:t.push(d),a++}}}else{let l={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:me.properties.around.type,parentSchema:me.properties.around,data:c};t===null?t=[l]:t.push(l),a++}}if(s.regions!==void 0){let c=s.regions;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++)$i.validate(c[p],{instancePath:e+"/regions/"+p,parentData:c,parentDataProperty:p,rootData:i,dynamicAnchors:o})||(t=t===null?$i.validate.errors:t.concat($i.validate.errors),a=t.length)}else{let l={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:c};t===null?t=[l]:t.push(l),a++}}if(s.motion!==void 0){let c=s.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:ye,data:c};t===null?t=[l]:t.push(l),a++}for(let l in c)if(!(l==="style"||l==="out"||l==="easing"||l==="from"||l==="delay"||l==="duration")){let p={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:ye,data:c};t===null?t=[p]:t.push(p),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 p={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:ye.properties.style.enum},message:"must be equal to one of the allowed values",schema:ye.properties.style.enum,parentSchema:ye.properties.style,data:l};t===null?t=[p]:t.push(p),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 p={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:ye.properties.out.enum},message:"must be equal to one of the allowed values",schema:ye.properties.out.enum,parentSchema:ye.properties.out,data:l};t===null?t=[p]:t.push(p),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 p={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:ye.properties.easing.enum},message:"must be equal to one of the allowed values",schema:ye.properties.easing.enum,parentSchema:ye.properties.easing,data:l};t===null?t=[p]:t.push(p),a++}}if(c.from!==void 0){let l=c.from;if(!(l==="left"||l==="right"||l==="top"||l==="bottom")){let p={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:ye.properties.from.enum},message:"must be equal to one of the allowed values",schema:ye.properties.from.enum,parentSchema:ye.properties.from,data:l};t===null?t=[p]:t.push(p),a++}}if(c.delay!==void 0){let l=c.delay;if(typeof l=="number"){if(l<0||isNaN(l)){let p={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:ye.properties.delay,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ye.properties.delay.type,parentSchema:ye.properties.delay,data:l};t===null?t=[p]:t.push(p),a++}}if(c.duration!==void 0){let l=c.duration;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:ye.properties.duration,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ye.properties.duration.type,parentSchema:ye.properties.duration,data:l};t===null?t=[p]:t.push(p),a++}}}else{let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ye.type,parentSchema:ye,data:c};t===null?t=[l]:t.push(l),a++}}if(s.variants!==void 0&&(Gt(s.variants,{instancePath:e+"/variants",parentData:s,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(t=t===null?Gt.errors:t.concat(Gt.errors),a=t.length)),s.nodes!==void 0){let c=s.nodes;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++)Dt(c[p],{instancePath:e+"/nodes/"+p,parentData:c,parentDataProperty:p,rootData:i,dynamicAnchors:o})||(t=t===null?Dt.errors:t.concat(Dt.errors),a=t.length)}else{let l={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:c};t===null?t=[l]:t.push(l),a++}}for(let c in s)if(c!=="id"&&c!=="kind"&&c!=="label"&&c!=="label-style"&&c!=="ghost"&&c!=="role"&&c!=="size"&&c!=="padding"&&c!=="height"&&c!=="z"&&c!=="flow"&&c!=="gate"&&c!=="around"&&c!=="regions"&&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:me,data:s};t===null?t=[l]:t.push(l),a++}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:me.type,parentSchema:me,data:s};t===null?t=[c]:t.push(c),a++}return hs.errors=t,a===0}hs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var re={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"}}},Yt={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},Si=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function Is(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=Is.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),s&&typeof s=="object"&&!Array.isArray(s)){if(s.id===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:re.required,parentSchema:re,data:s};t===null?t=[d]:t.push(d),a++}if(s.from===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'",schema:re.required,parentSchema:re,data:s};t===null?t=[d]:t.push(d),a++}if(s.to===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'",schema:re.required,parentSchema:re,data:s};t===null?t=[d]:t.push(d),a++}for(let d in s)if(!cn.call(re.properties,d)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:re,data:s};t===null?t=[h]:t.push(h),a++}if(s.id!==void 0){let d=s.id;if(typeof d=="string"){if(!Fe.test(d)){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:d};t===null?t=[h]:t.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:d};t===null?t=[h]:t.push(h),a++}}if(s.from!==void 0){let d=s.from;if(typeof d=="string"){if(!Si.test(d)){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:Yt,data:d};t===null?t=[h]:t.push(h),a++}}else{let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Yt.type,parentSchema:Yt,data:d};t===null?t=[h]:t.push(h),a++}}if(s.to!==void 0){let d=s.to;if(typeof d=="string"){if(!Si.test(d)){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:Yt,data:d};t===null?t=[h]:t.push(h),a++}}else{let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Yt.type,parentSchema:Yt,data:d};t===null?t=[h]:t.push(h),a++}}if(s.kind!==void 0){let d=s.kind;if(typeof d!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:re.properties.kind.type,parentSchema:re.properties.kind,data:d};t===null?t=[h]:t.push(h),a++}}if(s.via!==void 0){let d=s.via;if(Array.isArray(d)){let h=d.length;for(let g=0;g<h;g++){let y=d[g],x=a,u=!1,b=a;if(Array.isArray(y)){if(y.length>2){let v={instancePath:e+"/via/"+g,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Ie,data:y};t===null?t=[v]:t.push(v),a++}if(y.length<2){let v={instancePath:e+"/via/"+g,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Ie,data:y};t===null?t=[v]:t.push(v),a++}let w=y.length;for(let v=0;v<w;v++){let I=y[v];if(typeof I!="number"){let z={instancePath:e+"/via/"+g+"/"+v,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ie.items.type,parentSchema:Ie.items,data:I};t===null?t=[z]:t.push(z),a++}}}else{let w={instancePath:e+"/via/"+g,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Ie.type,parentSchema:Ie,data:y};t===null?t=[w]:t.push(w),a++}var c=b===a;u=u||c;let k=a;if(typeof y=="string"){if(!Si.test(y)){let w={instancePath:e+"/via/"+g,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:Yt,data:y};t===null?t=[w]:t.push(w),a++}}else{let w={instancePath:e+"/via/"+g,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Yt.type,parentSchema:Yt,data:y};t===null?t=[w]:t.push(w),a++}var c=k===a;if(u=u||c,u)a=x,t!==null&&(x?t.length=x:t=null);else{let w={instancePath:e+"/via/"+g,schemaPath:"#/properties/via/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:re.properties.via.items.anyOf,parentSchema:re.properties.via.items,data:y};t===null?t=[w]:t.push(w),a++}}}else{let h={instancePath:e+"/via",schemaPath:"#/properties/via/type",keyword:"type",params:{type:"array"},message:"must be array",schema:re.properties.via.type,parentSchema:re.properties.via,data:d};t===null?t=[h]:t.push(h),a++}}if(s.points!==void 0){let d=s.points;if(Array.isArray(d)){let h=d.length;for(let g=0;g<h;g++){let y=d[g];if(Array.isArray(y)){if(y.length>3){let u={instancePath:e+"/points/"+g,schemaPath:"#/properties/points/items/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:re.properties.points.items,data:y};t===null?t=[u]:t.push(u),a++}if(y.length<2){let u={instancePath:e+"/points/"+g,schemaPath:"#/properties/points/items/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:re.properties.points.items,data:y};t===null?t=[u]:t.push(u),a++}let x=y.length;for(let u=0;u<x;u++){let b=y[u];if(typeof b!="number"){let k={instancePath:e+"/points/"+g+"/"+u,schemaPath:"#/properties/points/items/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:re.properties.points.items.items.type,parentSchema:re.properties.points.items.items,data:b};t===null?t=[k]:t.push(k),a++}}}else{let x={instancePath:e+"/points/"+g,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"array"},message:"must be array",schema:re.properties.points.items.type,parentSchema:re.properties.points.items,data:y};t===null?t=[x]:t.push(x),a++}}}else{let h={instancePath:e+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array",schema:re.properties.points.type,parentSchema:re.properties.points,data:d};t===null?t=[h]:t.push(h),a++}}if(s.lane!==void 0){let d=s.lane;if(typeof d!="number"){let h={instancePath:e+"/lane",schemaPath:"#/properties/lane/type",keyword:"type",params:{type:"number"},message:"must be number",schema:re.properties.lane.type,parentSchema:re.properties.lane,data:d};t===null?t=[h]:t.push(h),a++}}if(s.arrow!==void 0){let d=s.arrow;if(typeof d!="boolean"){let h={instancePath:e+"/arrow",schemaPath:"#/properties/arrow/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:re.properties.arrow.type,parentSchema:re.properties.arrow,data:d};t===null?t=[h]:t.push(h),a++}}if(s.cross!==void 0){let d=s.cross;if(typeof d!="boolean"){let h={instancePath:e+"/cross",schemaPath:"#/properties/cross/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:re.properties.cross.type,parentSchema:re.properties.cross,data:d};t===null?t=[h]:t.push(h),a++}}if(s.label!==void 0){let d=s.label,h=a,g=!1,y=a;if(typeof d!="string"){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:re.properties.label.anyOf[0].type,parentSchema:re.properties.label.anyOf[0],data:d};t===null?t=[u]:t.push(u),a++}var l=y===a;g=g||l;let x=a;if(d&&typeof d=="object"&&!Array.isArray(d)){if(d.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:re.properties.label.anyOf[1].required,parentSchema:re.properties.label.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}for(let u in d)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:re.properties.label.anyOf[1],data:d};t===null?t=[b]:t.push(b),a++}if(d.text!==void 0){let u=d.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:re.properties.label.anyOf[1].properties.text.type,parentSchema:re.properties.label.anyOf[1].properties.text,data:u};t===null?t=[b]:t.push(b),a++}}if(d.along!==void 0){let u=d.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:re.properties.label.anyOf[1].properties.along.type,parentSchema:re.properties.label.anyOf[1].properties.along,data:u};t===null?t=[b]:t.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:re.properties.label.anyOf[1].properties.along,data:u};t===null?t=[b]:t.push(b),a++}}if(d.side!==void 0){let u=d.side;if(!(u==="left"||u==="right")){let b={instancePath:e+"/label/side",schemaPath:"#/properties/label/anyOf/1/properties/side/enum",keyword:"enum",params:{allowedValues:re.properties.label.anyOf[1].properties.side.enum},message:"must be equal to one of the allowed values",schema:re.properties.label.anyOf[1].properties.side.enum,parentSchema:re.properties.label.anyOf[1].properties.side,data:u};t===null?t=[b]:t.push(b),a++}}if(d.at!==void 0){let u=d.at;if(Array.isArray(u)){if(u.length>3){let k={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:re.properties.label.anyOf[1].properties.at,data:u};t===null?t=[k]:t.push(k),a++}if(u.length<2){let k={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:re.properties.label.anyOf[1].properties.at,data:u};t===null?t=[k]:t.push(k),a++}let b=u.length;for(let k=0;k<b;k++){let w=u[k];if(typeof w!="number"){let v={instancePath:e+"/label/at/"+k,schemaPath:"#/properties/label/anyOf/1/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:re.properties.label.anyOf[1].properties.at.items.type,parentSchema:re.properties.label.anyOf[1].properties.at.items,data:w};t===null?t=[v]:t.push(v),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:re.properties.label.anyOf[1].properties.at.type,parentSchema:re.properties.label.anyOf[1].properties.at,data:u};t===null?t=[b]:t.push(b),a++}}if(d.dir!==void 0){let u=d.dir;if(!(u==="x"||u==="y")){let b={instancePath:e+"/label/dir",schemaPath:"#/properties/label/anyOf/1/properties/dir/enum",keyword:"enum",params:{allowedValues:re.properties.label.anyOf[1].properties.dir.enum},message:"must be equal to one of the allowed values",schema:re.properties.label.anyOf[1].properties.dir.enum,parentSchema:re.properties.label.anyOf[1].properties.dir,data:u};t===null?t=[b]:t.push(b),a++}}if(d.anchor!==void 0){let u=d.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:re.properties.label.anyOf[1].properties.anchor.enum},message:"must be equal to one of the allowed values",schema:re.properties.label.anyOf[1].properties.anchor.enum,parentSchema:re.properties.label.anyOf[1].properties.anchor,data:u};t===null?t=[b]:t.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:re.properties.label.anyOf[1].type,parentSchema:re.properties.label.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}var l=x===a;if(g=g||l,g)a=h,t!==null&&(h?t.length=h:t=null);else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:re.properties.label.anyOf,parentSchema:re.properties.label,data:d};t===null?t=[u]:t.push(u),a++}}if(s.appears!==void 0){let d=s.appears,h=a,g=!1,y=a;if(typeof d!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.anyOf[0].type,parentSchema:we.anyOf[0],data:d};t===null?t=[u]:t.push(u),a++}var p=y===a;g=g||p;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.anyOf[1].type,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}var p=x===a;if(g=g||p,g)a=h,t!==null&&(h?t.length=h:t=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.anyOf,parentSchema:we,data:d};t===null?t=[u]:t.push(u),a++}}if(s.disappears!==void 0){let d=s.disappears,h=a,g=!1,y=a;if(typeof d!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.anyOf[0].type,parentSchema:we.anyOf[0],data:d};t===null?t=[u]:t.push(u),a++}var f=y===a;g=g||f;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.anyOf[1].type,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}var f=x===a;if(g=g||f,g)a=h,t!==null&&(h?t.length=h:t=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.anyOf,parentSchema:we,data:d};t===null?t=[u]:t.push(u),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:re.type,parentSchema:re,data:s};t===null?t=[d]:t.push(d),a++}return Is.errors=t,a===0}Is.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Ae={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 js(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=js.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),s&&typeof s=="object"&&!Array.isArray(s)){for(let d in s)if(!cn.call(Ae.properties,d)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Ae,data:s};t===null?t=[h]:t.push(h),a++}if(s.floor!==void 0){let d=s.floor;if(typeof d!="string"){let h={instancePath:e+"/floor",schemaPath:"#/properties/floor/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ae.properties.floor.type,parentSchema:Ae.properties.floor,data:d};t===null?t=[h]:t.push(h),a++}}if(s.face!==void 0){let d=s.face;if(typeof d!="string"){let h={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ae.properties.face.type,parentSchema:Ae.properties.face,data:d};t===null?t=[h]:t.push(h),a++}}if(s.label!==void 0){let d=s.label;if(typeof d!="string"){let h={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ae.properties.label.type,parentSchema:Ae.properties.label,data:d};t===null?t=[h]:t.push(h),a++}}if(s.sub!==void 0){let d=s.sub;if(typeof d!="string"){let h={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ae.properties.sub.type,parentSchema:Ae.properties.sub,data:d};t===null?t=[h]:t.push(h),a++}}if(s.at!==void 0){let d=s.at,h=a,g=!1,y=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:Ie,data:d};t===null?t=[b]:t.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:Ie,data:d};t===null?t=[b]:t.push(b),a++}let u=d.length;for(let b=0;b<u;b++){let k=d[b];if(typeof k!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ie.items.type,parentSchema:Ie.items,data:k};t===null?t=[w]:t.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Ie.type,parentSchema:Ie,data:d};t===null?t=[u]:t.push(u),a++}var l=y===a;if(g=g||l,l)var c=!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:Ae.properties.at.anyOf[1],data:d};t===null?t=[b]:t.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:Ae.properties.at.anyOf[1],data:d};t===null?t=[b]:t.push(b),a++}let u=d.length;for(let b=0;b<u;b++){let k=d[b];if(typeof k!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ae.properties.at.anyOf[1].items.type,parentSchema:Ae.properties.at.anyOf[1].items,data:k};t===null?t=[w]:t.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:Ae.properties.at.anyOf[1].type,parentSchema:Ae.properties.at.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}var l=x===a;if(g=g||l,l&&c!==!0&&(c=!0),g)a=h,t!==null&&(h?t.length=h:t=null);else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ae.properties.at.anyOf,parentSchema:Ae.properties.at,data:d};t===null?t=[u]:t.push(u),a++}}if(s.on!==void 0){let d=s.on;if(typeof d=="string"){if(!Fe.test(d)){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:d};t===null?t=[h]:t.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:d};t===null?t=[h]:t.push(h),a++}}if(s.kind!==void 0){let d=s.kind;if(typeof d!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ae.properties.kind.type,parentSchema:Ae.properties.kind,data:d};t===null?t=[h]:t.push(h),a++}}if(s.dir!==void 0){let d=s.dir;if(!(d==="x"||d==="y")){let h={instancePath:e+"/dir",schemaPath:"#/properties/dir/enum",keyword:"enum",params:{allowedValues:Ae.properties.dir.enum},message:"must be equal to one of the allowed values",schema:Ae.properties.dir.enum,parentSchema:Ae.properties.dir,data:d};t===null?t=[h]:t.push(h),a++}}if(s.anchor!==void 0){let d=s.anchor;if(!(d==="start"||d==="middle"||d==="end")){let h={instancePath:e+"/anchor",schemaPath:"#/properties/anchor/enum",keyword:"enum",params:{allowedValues:Ae.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:Ae.properties.anchor.enum,parentSchema:Ae.properties.anchor,data:d};t===null?t=[h]:t.push(h),a++}}if(s.dx!==void 0){let d=s.dx;if(typeof d!="number"){let h={instancePath:e+"/dx",schemaPath:"#/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ae.properties.dx.type,parentSchema:Ae.properties.dx,data:d};t===null?t=[h]:t.push(h),a++}}if(s.dy!==void 0){let d=s.dy;if(typeof d!="number"){let h={instancePath:e+"/dy",schemaPath:"#/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ae.properties.dy.type,parentSchema:Ae.properties.dy,data:d};t===null?t=[h]:t.push(h),a++}}if(s.appears!==void 0){let d=s.appears,h=a,g=!1,y=a;if(typeof d!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.anyOf[0].type,parentSchema:we.anyOf[0],data:d};t===null?t=[u]:t.push(u),a++}var p=y===a;g=g||p;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.anyOf[1].type,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}var p=x===a;if(g=g||p,g)a=h,t!==null&&(h?t.length=h:t=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.anyOf,parentSchema:we,data:d};t===null?t=[u]:t.push(u),a++}}if(s.disappears!==void 0){let d=s.disappears,h=a,g=!1,y=a;if(typeof d!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.anyOf[0].type,parentSchema:we.anyOf[0],data:d};t===null?t=[u]:t.push(u),a++}var f=y===a;g=g||f;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.anyOf[1].type,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.anyOf[1],data:d};t===null?t=[u]:t.push(u),a++}var f=x===a;if(g=g||f,g)a=h,t!==null&&(h?t.length=h:t=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.anyOf,parentSchema:we,data:d};t===null?t=[u]:t.push(u),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ae.type,parentSchema:Ae,data:s};t===null?t=[d]:t.push(d),a++}return js.errors=t,a===0}js.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Z={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}]}}},lr={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},We={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function Rs(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=Rs.evaluated;m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0);let c=a,l=!1,p=a,f=a,d=!1,h=a;if(typeof s!="string"){let v={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:We.anyOf[0].type,parentSchema:We.anyOf[0],data:s};t===null?t=[v]:t.push(v),a++}var y=h===a;d=d||y;let g=a;if(s&&typeof s=="object"&&!Array.isArray(s)){if(Object.keys(s).length>1){let v={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:We.anyOf[1],data:s};t===null?t=[v]:t.push(v),a++}if(Object.keys(s).length<1){let v={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:We.anyOf[1],data:s};t===null?t=[v]:t.push(v),a++}for(let v in s){let I=s[v];if(typeof I!="string"){let z={instancePath:e+"/"+v.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:We.anyOf[1].additionalProperties.type,parentSchema:We.anyOf[1].additionalProperties,data:I};t===null?t=[z]:t.push(z),a++}}}else{let v={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:We.anyOf[1].type,parentSchema:We.anyOf[1],data:s};t===null?t=[v]:t.push(v),a++}var y=g===a;if(d=d||y,y)var x=!0;if(d)a=f,t!==null&&(f?t.length=f:t=null);else{let v={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:We.anyOf,parentSchema:We,data:s};t===null?t=[v]:t.push(v),a++}var k=p===a;l=l||k;let u=a;if(Array.isArray(s)){let v=s.length;for(let I=0;I<v;I++){let z=s[I],B=a,T=!1,L=a;if(typeof z!="string"){let A={instancePath:e+"/"+I,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:We.anyOf[0].type,parentSchema:We.anyOf[0],data:z};t===null?t=[A]:t.push(A),a++}var b=L===a;T=T||b;let P=a;if(z&&typeof z=="object"&&!Array.isArray(z)){if(Object.keys(z).length>1){let A={instancePath:e+"/"+I,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:We.anyOf[1],data:z};t===null?t=[A]:t.push(A),a++}if(Object.keys(z).length<1){let A={instancePath:e+"/"+I,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:We.anyOf[1],data:z};t===null?t=[A]:t.push(A),a++}for(let A in z){let S=z[A];if(typeof S!="string"){let O={instancePath:e+"/"+I+"/"+A.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:We.anyOf[1].additionalProperties.type,parentSchema:We.anyOf[1].additionalProperties,data:S};t===null?t=[O]:t.push(O),a++}}}else{let A={instancePath:e+"/"+I,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:We.anyOf[1].type,parentSchema:We.anyOf[1],data:z};t===null?t=[A]:t.push(A),a++}var b=P===a;if(T=T||b,T)a=B,t!==null&&(B?t.length=B:t=null);else{let A={instancePath:e+"/"+I,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:We.anyOf,parentSchema:We,data:z};t===null?t=[A]:t.push(A),a++}}}else{let v={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:lr.anyOf[1].type,parentSchema:lr.anyOf[1],data:s};t===null?t=[v]:t.push(v),a++}var k=u===a;if(l=l||k,k)var w=!0;if(l)a=c,t!==null&&(c?t.length=c:t=null);else{let v={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:lr.anyOf,parentSchema:lr,data:s};t===null?t=[v]:t.push(v),a++}return Rs.errors=t,m.props=x,m.items=w,a===0}Rs.evaluated={dynamicProps:!0,dynamicItems:!0};function Cs(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=Cs.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),s&&typeof s=="object"&&!Array.isArray(s)){if(s.heading===void 0){let f={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:Z.required,parentSchema:Z,data:s};t===null?t=[f]:t.push(f),a++}for(let f in s)if(!cn.call(Z.properties,f)){let d={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:Z,data:s};t===null?t=[d]:t.push(d),a++}if(s.id!==void 0){let f=s.id;if(typeof f=="string"){if(!Fe.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:ee,data:f};t===null?t=[d]:t.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:f};t===null?t=[d]:t.push(d),a++}}if(s.number!==void 0){let f=s.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:Z.properties.number.type,parentSchema:Z.properties.number,data:f};t===null?t=[d]:t.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:Z.properties.number,data:f};t===null?t=[d]:t.push(d),a++}}if(s.kind!==void 0){let f=s.kind;if(typeof f!="string"){let d={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Z.properties.kind.type,parentSchema:Z.properties.kind,data:f};t===null?t=[d]:t.push(d),a++}}if(s.heading!==void 0){let f=s.heading;if(typeof f!="string"){let d={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Z.properties.heading.type,parentSchema:Z.properties.heading,data:f};t===null?t=[d]:t.push(d),a++}}if(s.caption!==void 0){let f=s.caption;if(typeof f!="string"){let d={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Z.properties.caption.type,parentSchema:Z.properties.caption,data:f};t===null?t=[d]:t.push(d),a++}}if(s.command!==void 0){let f=s.command;if(typeof f!="string"){let d={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Z.properties.command.type,parentSchema:Z.properties.command,data:f};t===null?t=[d]:t.push(d),a++}}if(s.animate!==void 0){let f=s.animate;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++)Rs(f[h],{instancePath:e+"/animate/"+h,parentData:f,parentDataProperty:h,rootData:i,dynamicAnchors:o})||(t=t===null?Rs.errors:t.concat(Rs.errors),a=t.length)}else{let d={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.animate.type,parentSchema:Z.properties.animate,data:f};t===null?t=[d]:t.push(d),a++}}if(s.pulse!==void 0){let f=s.pulse;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++){let g=f[h];if(typeof g=="string"){if(!Fe.test(g)){let y={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:g};t===null?t=[y]:t.push(y),a++}}else{let y={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:g};t===null?t=[y]:t.push(y),a++}}}else{let d={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.pulse.type,parentSchema:Z.properties.pulse,data:f};t===null?t=[d]:t.push(d),a++}}if(s.highlight!==void 0){let f=s.highlight;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++){let g=f[h];if(typeof g=="string"){if(!Fe.test(g)){let y={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:g};t===null?t=[y]:t.push(y),a++}}else{let y={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:g};t===null?t=[y]:t.push(y),a++}}}else{let d={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.highlight.type,parentSchema:Z.properties.highlight,data:f};t===null?t=[d]:t.push(d),a++}}if(s.focus!==void 0){let f=s.focus;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++){let g=f[h];if(typeof g=="string"){if(!Fe.test(g)){let y={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:g};t===null?t=[y]:t.push(y),a++}}else{let y={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:g};t===null?t=[y]:t.push(y),a++}}}else{let d={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.focus.type,parentSchema:Z.properties.focus,data:f};t===null?t=[d]:t.push(d),a++}}if(s.show!==void 0){let f=s.show;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++){let g=f[h];if(typeof g=="string"){if(!Fe.test(g)){let y={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:g};t===null?t=[y]:t.push(y),a++}}else{let y={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:g};t===null?t=[y]:t.push(y),a++}}}else{let d={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.show.type,parentSchema:Z.properties.show,data:f};t===null?t=[d]:t.push(d),a++}}if(s.hide!==void 0){let f=s.hide;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++){let g=f[h];if(typeof g=="string"){if(!Fe.test(g)){let y={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:g};t===null?t=[y]:t.push(y),a++}}else{let y={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:g};t===null?t=[y]:t.push(y),a++}}}else{let d={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.hide.type,parentSchema:Z.properties.hide,data:f};t===null?t=[d]:t.push(d),a++}}if(s.say!==void 0){let f=s.say;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++){let g=f[h];if(g&&typeof g=="object"&&!Array.isArray(g)){if(g.at===void 0){let y={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:Z.properties.say.items.required,parentSchema:Z.properties.say.items,data:g};t===null?t=[y]:t.push(y),a++}if(g.text===void 0){let y={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:Z.properties.say.items.required,parentSchema:Z.properties.say.items,data:g};t===null?t=[y]:t.push(y),a++}for(let y in g)if(!(y==="at"||y==="text"||y==="kind"||y==="dx"||y==="dy"||y==="anchor")){let x={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties",schema:!1,parentSchema:Z.properties.say.items,data:g};t===null?t=[x]:t.push(x),a++}if(g.at!==void 0){let y=g.at,x=a,u=!1,b=a;if(typeof y=="string"){if(!Fe.test(y)){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:y};t===null?t=[w]:t.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:y};t===null?t=[w]:t.push(w),a++}var c=b===a;u=u||c;let k=a;if(Array.isArray(y)){if(y.length>3){let v={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:Z.properties.say.items.properties.at.anyOf[1],data:y};t===null?t=[v]:t.push(v),a++}if(y.length<2){let v={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:Z.properties.say.items.properties.at.anyOf[1],data:y};t===null?t=[v]:t.push(v),a++}let w=y.length;for(let v=0;v<w;v++){let I=y[v];if(typeof I!="number"){let z={instancePath:e+"/say/"+h+"/at/"+v,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Z.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:Z.properties.say.items.properties.at.anyOf[1].items,data:I};t===null?t=[z]:t.push(z),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:Z.properties.say.items.properties.at.anyOf[1].type,parentSchema:Z.properties.say.items.properties.at.anyOf[1],data:y};t===null?t=[w]:t.push(w),a++}var c=k===a;if(u=u||c,u)a=x,t!==null&&(x?t.length=x:t=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:Z.properties.say.items.properties.at.anyOf,parentSchema:Z.properties.say.items.properties.at,data:y};t===null?t=[w]:t.push(w),a++}}if(g.text!==void 0){let y=g.text;if(typeof y!="string"){let x={instancePath:e+"/say/"+h+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Z.properties.say.items.properties.text.type,parentSchema:Z.properties.say.items.properties.text,data:y};t===null?t=[x]:t.push(x),a++}}if(g.kind!==void 0){let y=g.kind;if(typeof y!="string"){let x={instancePath:e+"/say/"+h+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Z.properties.say.items.properties.kind.type,parentSchema:Z.properties.say.items.properties.kind,data:y};t===null?t=[x]:t.push(x),a++}}if(g.dx!==void 0){let y=g.dx;if(typeof y!="number"){let x={instancePath:e+"/say/"+h+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Z.properties.say.items.properties.dx.type,parentSchema:Z.properties.say.items.properties.dx,data:y};t===null?t=[x]:t.push(x),a++}}if(g.dy!==void 0){let y=g.dy;if(typeof y!="number"){let x={instancePath:e+"/say/"+h+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Z.properties.say.items.properties.dy.type,parentSchema:Z.properties.say.items.properties.dy,data:y};t===null?t=[x]:t.push(x),a++}}if(g.anchor!==void 0){let y=g.anchor;if(!(y==="start"||y==="middle"||y==="end")){let x={instancePath:e+"/say/"+h+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:Z.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:Z.properties.say.items.properties.anchor.enum,parentSchema:Z.properties.say.items.properties.anchor,data:y};t===null?t=[x]:t.push(x),a++}}}else{let y={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Z.properties.say.items.type,parentSchema:Z.properties.say.items,data:g};t===null?t=[y]:t.push(y),a++}}}else{let d={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.say.type,parentSchema:Z.properties.say,data:f};t===null?t=[d]:t.push(d),a++}}if(s.mark!==void 0){let f=s.mark;if(Array.isArray(f)){let d=f.length;for(let h=0;h<d;h++){let g=f[h];if(g&&typeof g=="object"&&!Array.isArray(g)){for(let y in g)if(!(y==="on"||y==="at")){let x={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties",schema:!1,parentSchema:Z.properties.mark.items,data:g};t===null?t=[x]:t.push(x),a++}if(g.on!==void 0){let y=g.on;if(typeof y=="string"){if(!Fe.test(y)){let x={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:y};t===null?t=[x]:t.push(x),a++}}else{let x={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:y};t===null?t=[x]:t.push(x),a++}}if(g.at!==void 0){let y=g.at;if(Array.isArray(y)){if(y.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:Z.properties.mark.items.properties.at,data:y};t===null?t=[u]:t.push(u),a++}if(y.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:Z.properties.mark.items.properties.at,data:y};t===null?t=[u]:t.push(u),a++}let x=y.length;for(let u=0;u<x;u++){let b=y[u];if(typeof b!="number"){let k={instancePath:e+"/mark/"+h+"/at/"+u,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Z.properties.mark.items.properties.at.items.type,parentSchema:Z.properties.mark.items.properties.at.items,data:b};t===null?t=[k]:t.push(k),a++}}}else{let x={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.mark.items.properties.at.type,parentSchema:Z.properties.mark.items.properties.at,data:y};t===null?t=[x]:t.push(x),a++}}}else{let y={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Z.properties.mark.items.type,parentSchema:Z.properties.mark.items,data:g};t===null?t=[y]:t.push(y),a++}}}else{let d={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Z.properties.mark.type,parentSchema:Z.properties.mark,data:f};t===null?t=[d]:t.push(d),a++}}if(s.badge!==void 0){let f=s.badge,d=a,h=!1,g=a;if(typeof f!="boolean"){let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Z.properties.badge.anyOf[0].type,parentSchema:Z.properties.badge.anyOf[0],data:f};t===null?t=[u]:t.push(u),a++}var l=g===a;h=h||l;let y=a;if(typeof f=="string"){if(!Fe.test(f)){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:f};t===null?t=[u]:t.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:f};t===null?t=[u]:t.push(u),a++}var l=y===a;h=h||l;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:Z.properties.badge.anyOf[2],data:f};t===null?t=[b]:t.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:Z.properties.badge.anyOf[2],data:f};t===null?t=[b]:t.push(b),a++}let u=f.length;for(let b=0;b<u;b++){let k=f[b];if(typeof k!="number"){let w={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Z.properties.badge.anyOf[2].items.type,parentSchema:Z.properties.badge.anyOf[2].items,data:k};t===null?t=[w]:t.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:Z.properties.badge.anyOf[2].type,parentSchema:Z.properties.badge.anyOf[2],data:f};t===null?t=[u]:t.push(u),a++}var l=x===a;if(h=h||l,h)a=d,t!==null&&(d?t.length=d:t=null);else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Z.properties.badge.anyOf,parentSchema:Z.properties.badge,data:f};t===null?t=[u]:t.push(u),a++}}if(s.duration!==void 0){let f=s.duration,d=a,h=!1,g=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:Z.properties.duration.anyOf[0],data:f};t===null?t=[x]:t.push(x),a++}var p=g===a;h=h||p;let y=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:Z.properties.duration.anyOf[1].type,parentSchema:Z.properties.duration.anyOf[1],data:f};t===null?t=[x]:t.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:Z.properties.duration.anyOf[1],data:f};t===null?t=[x]:t.push(x),a++}var p=y===a;if(h=h||p,h)a=d,t!==null&&(d?t.length=d:t=null);else{let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Z.properties.duration.anyOf,parentSchema:Z.properties.duration,data:f};t===null?t=[x]:t.push(x),a++}}}else{let f={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Z.type,parentSchema:Z,data:s};t===null?t=[f]:t.push(f),a++}return Cs.errors=t,a===0}Cs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Ls(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=Ls.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),s&&typeof s=="object"&&!Array.isArray(s)){if(s.id===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:H.required,parentSchema:H,data:s};t===null?t=[p]:t.push(p),a++}if(s.title===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'",schema:H.required,parentSchema:H,data:s};t===null?t=[p]:t.push(p),a++}for(let p in s)if(!cn.call(H.properties,p)){let f={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:H,data:s};t===null?t=[f]:t.push(f),a++}if(s.id!==void 0){let p=s.id;if(typeof p=="string"){if(!Fe.test(p)){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:ee,data:p};t===null?t=[f]:t.push(f),a++}}else{let f={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ee.type,parentSchema:ee,data:p};t===null?t=[f]:t.push(f),a++}}if(s.title!==void 0){let p=s.title;if(typeof p!="string"){let f={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:H.properties.title.type,parentSchema:H.properties.title,data:p};t===null?t=[f]:t.push(f),a++}}if(s.ants!==void 0){let p=s.ants,f=a,d=!1,h=a;if(typeof p!="boolean"){let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:H.properties.ants.anyOf[0].type,parentSchema:H.properties.ants.anyOf[0],data:p};t===null?t=[x]:t.push(x),a++}var c=h===a;d=d||c;let g=a;if(Array.isArray(p)){let x=p.length;for(let u=0;u<x;u++){let b=p[u];if(typeof b!="string"){let k={instancePath:e+"/ants/"+u,schemaPath:"#/properties/ants/anyOf/1/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:H.properties.ants.anyOf[1].items.type,parentSchema:H.properties.ants.anyOf[1].items,data:b};t===null?t=[k]:t.push(k),a++}}}else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:H.properties.ants.anyOf[1].type,parentSchema:H.properties.ants.anyOf[1],data:p};t===null?t=[x]:t.push(x),a++}var c=g===a;d=d||c;let y=a;if(p&&typeof p=="object"&&!Array.isArray(p)){for(let x in p)if(!(x==="ids"||x==="speed"||x==="dash")){let u={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x},message:"must NOT have additional properties",schema:!1,parentSchema:H.properties.ants.anyOf[2],data:p};t===null?t=[u]:t.push(u),a++}if(p.ids!==void 0){let x=p.ids;if(Array.isArray(x)){let u=x.length;for(let b=0;b<u;b++){let k=x[b];if(typeof k!="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:H.properties.ants.anyOf[2].properties.ids.items.type,parentSchema:H.properties.ants.anyOf[2].properties.ids.items,data:k};t===null?t=[w]:t.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:H.properties.ants.anyOf[2].properties.ids.type,parentSchema:H.properties.ants.anyOf[2].properties.ids,data:x};t===null?t=[u]:t.push(u),a++}}if(p.speed!==void 0){let x=p.speed;if(typeof x!="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:H.properties.ants.anyOf[2].properties.speed.type,parentSchema:H.properties.ants.anyOf[2].properties.speed,data:x};t===null?t=[u]:t.push(u),a++}}if(p.dash!==void 0){let x=p.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:H.properties.ants.anyOf[2].properties.dash,data:x};t===null?t=[b]:t.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:H.properties.ants.anyOf[2].properties.dash,data:x};t===null?t=[b]:t.push(b),a++}let u=x.length;for(let b=0;b<u;b++){let k=x[b];if(typeof k=="number"){if(k<=0||isNaN(k)){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:H.properties.ants.anyOf[2].properties.dash.items,data:k};t===null?t=[w]:t.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:H.properties.ants.anyOf[2].properties.dash.items.type,parentSchema:H.properties.ants.anyOf[2].properties.dash.items,data:k};t===null?t=[w]:t.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:H.properties.ants.anyOf[2].properties.dash.type,parentSchema:H.properties.ants.anyOf[2].properties.dash,data:x};t===null?t=[u]:t.push(u),a++}}}else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/type",keyword:"type",params:{type:"object"},message:"must be object",schema:H.properties.ants.anyOf[2].type,parentSchema:H.properties.ants.anyOf[2],data:p};t===null?t=[x]:t.push(x),a++}var c=y===a;if(d=d||c,d)a=f,t!==null&&(f?t.length=f:t=null);else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:H.properties.ants.anyOf,parentSchema:H.properties.ants,data:p};t===null?t=[x]:t.push(x),a++}}if(s.motion!==void 0){let p=s.motion;if(!(p&&typeof p=="object"&&!Array.isArray(p))){let f={instancePath:e+"/motion",schemaPath:"#/properties/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:H.properties.motion.type,parentSchema:H.properties.motion,data:p};t===null?t=[f]:t.push(f),a++}}if(s.caption!==void 0){let p=s.caption;if(typeof p!="string"){let f={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:H.properties.caption.type,parentSchema:H.properties.caption,data:p};t===null?t=[f]:t.push(f),a++}}if(s.aria!==void 0){let p=s.aria;if(typeof p!="string"){let f={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:H.properties.aria.type,parentSchema:H.properties.aria,data:p};t===null?t=[f]:t.push(f),a++}}if(s.gap!==void 0){let p=s.gap;if(typeof p=="number"){if(p<=0||isNaN(p)){let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:H.properties.gap,data:p};t===null?t=[f]:t.push(f),a++}}else{let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:H.properties.gap.type,parentSchema:H.properties.gap,data:p};t===null?t=[f]:t.push(f),a++}}if(s.flow!==void 0){let p=s.flow;if(!(p==="row"||p==="column")){let f={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:H.properties.flow.enum},message:"must be equal to one of the allowed values",schema:H.properties.flow.enum,parentSchema:H.properties.flow,data:p};t===null?t=[f]:t.push(f),a++}}if(s.regions!==void 0){let p=s.regions;if(Array.isArray(p)){let f=p.length;for(let d=0;d<f;d++)hs(p[d],{instancePath:e+"/regions/"+d,parentData:p,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(t=t===null?hs.errors:t.concat(hs.errors),a=t.length)}else{let f={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:H.properties.regions.type,parentSchema:H.properties.regions,data:p};t===null?t=[f]:t.push(f),a++}}if(s.nodes!==void 0){let p=s.nodes;if(Array.isArray(p)){let f=p.length;for(let d=0;d<f;d++)Dt(p[d],{instancePath:e+"/nodes/"+d,parentData:p,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(t=t===null?Dt.errors:t.concat(Dt.errors),a=t.length)}else{let f={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:H.properties.nodes.type,parentSchema:H.properties.nodes,data:p};t===null?t=[f]:t.push(f),a++}}if(s.routes!==void 0){let p=s.routes;if(Array.isArray(p)){let f=p.length;for(let d=0;d<f;d++)Is(p[d],{instancePath:e+"/routes/"+d,parentData:p,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(t=t===null?Is.errors:t.concat(Is.errors),a=t.length)}else{let f={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:H.properties.routes.type,parentSchema:H.properties.routes,data:p};t===null?t=[f]:t.push(f),a++}}if(s.notes!==void 0){let p=s.notes;if(Array.isArray(p)){let f=p.length;for(let d=0;d<f;d++)js(p[d],{instancePath:e+"/notes/"+d,parentData:p,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(t=t===null?js.errors:t.concat(js.errors),a=t.length)}else{let f={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:H.properties.notes.type,parentSchema:H.properties.notes,data:p};t===null?t=[f]:t.push(f),a++}}if(s.steps!==void 0){let p=s.steps;if(Array.isArray(p)){let f=p.length;for(let d=0;d<f;d++)Cs(p[d],{instancePath:e+"/steps/"+d,parentData:p,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(t=t===null?Cs.errors:t.concat(Cs.errors),a=t.length)}else{let f={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:H.properties.steps.type,parentSchema:H.properties.steps,data:p};t===null?t=[f]:t.push(f),a++}}if(s.legend!==void 0){let p=s.legend,f=a,d=!1,h=a;if(p!=="auto"){let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:H.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:H.properties.legend.anyOf[0].enum,parentSchema:H.properties.legend.anyOf[0],data:p};t===null?t=[x]:t.push(x),a++}var l=h===a;d=d||l;let g=a;if(p!==!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:H.properties.legend.anyOf[1],data:p};t===null?t=[x]:t.push(x),a++}var l=g===a;d=d||l;let y=a;if(Array.isArray(p)){let x=p.length;for(let u=0;u<x;u++){let b=p[u];if(typeof b!="string"){let k={instancePath:e+"/legend/"+u,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:H.properties.legend.anyOf[2].items.type,parentSchema:H.properties.legend.anyOf[2].items,data:b};t===null?t=[k]:t.push(k),a++}}}else{let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:H.properties.legend.anyOf[2].type,parentSchema:H.properties.legend.anyOf[2],data:p};t===null?t=[x]:t.push(x),a++}var l=y===a;if(d=d||l,d)a=f,t!==null&&(f?t.length=f:t=null);else{let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:H.properties.legend.anyOf,parentSchema:H.properties.legend,data:p};t===null?t=[x]:t.push(x),a++}}if(s.badges!==void 0){let p=s.badges;if(typeof p!="boolean"){let f={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:H.properties.badges.type,parentSchema:H.properties.badges,data:p};t===null?t=[f]:t.push(f),a++}}if(s.grid!==void 0){let p=s.grid;if(p&&typeof p=="object"&&!Array.isArray(p)){for(let f in p)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:Ke,data:p};t===null?t=[d]:t.push(d),a++}if(p.snap!==void 0){let f=p.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:Ke.properties.snap,data:f};t===null?t=[d]:t.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:Ke.properties.snap.type,parentSchema:Ke.properties.snap,data:f};t===null?t=[d]:t.push(d),a++}}if(p.show!==void 0){let f=p.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:Ke.properties.show.type,parentSchema:Ke.properties.show,data:f};t===null?t=[d]:t.push(d),a++}}if(p.step!==void 0){let f=p.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:Ke.properties.step,data:f};t===null?t=[d]:t.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:Ke.properties.step.type,parentSchema:Ke.properties.step,data:f};t===null?t=[d]:t.push(d),a++}}}else{let f={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ke.type,parentSchema:Ke,data:p};t===null?t=[f]:t.push(f),a++}}if(s.assemble!==void 0){let p=s.assemble;if(typeof p!="boolean"){let f={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:H.properties.assemble.type,parentSchema:H.properties.assemble,data:p};t===null?t=[f]:t.push(f),a++}}if(s.loop!==void 0){let p=s.loop;if(typeof p!="boolean"){let f={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:H.properties.loop.type,parentSchema:H.properties.loop,data:p};t===null?t=[f]:t.push(f),a++}}if(s.dim!==void 0){let p=s.dim;if(!(p==="flows"||p==="all")){let f={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:H.properties.dim.enum},message:"must be equal to one of the allowed values",schema:H.properties.dim.enum,parentSchema:H.properties.dim,data:p};t===null?t=[f]:t.push(f),a++}}if(s.after!==void 0){let p=s.after;if(typeof p!="string"){let f={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:H.properties.after.type,parentSchema:H.properties.after,data:p};t===null?t=[f]:t.push(f),a++}}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:H.type,parentSchema:H,data:s};t===null?t=[p]:t.push(p),a++}return Ls.errors=t,a===0}Ls.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function pr(s,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=s,dynamicAnchors:o={}}={}){let t=null,a=0,m=pr.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),s&&typeof s=="object"&&!Array.isArray(s)){if(s.isodiag===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"isodiag"},message:"must have required property 'isodiag'",schema:Pe.required,parentSchema:Pe,data:s};t===null?t=[c]:t.push(c),a++}if(s.scenes===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scenes"},message:"must have required property 'scenes'",schema:Pe.required,parentSchema:Pe,data:s};t===null?t=[c]:t.push(c),a++}for(let c in s)if(!cn.call(Pe.properties,c)){let l={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Pe,data:s};t===null?t=[l]:t.push(l),a++}if(s.isodiag!==void 0){let c=s.isodiag;if(c!==1){let l={instancePath:e+"/isodiag",schemaPath:"#/properties/isodiag/const",keyword:"const",params:{allowedValue:1},message:"must be equal to constant",schema:1,parentSchema:Pe.properties.isodiag,data:c};t===null?t=[l]:t.push(l),a++}}if(s.title!==void 0){let c=s.title;if(typeof c!="string"){let l={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.title.type,parentSchema:Pe.properties.title,data:c};t===null?t=[l]:t.push(l),a++}}if(s.lede!==void 0){let c=s.lede;if(typeof c!="string"){let l={instancePath:e+"/lede",schemaPath:"#/properties/lede/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.lede.type,parentSchema:Pe.properties.lede,data:c};t===null?t=[l]:t.push(l),a++}}if(s.pills!==void 0){let c=s.pills;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++){let f=c[p];if(typeof f!="string"){let d={instancePath:e+"/pills/"+p,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.pills.items.type,parentSchema:Pe.properties.pills.items,data:f};t===null?t=[d]:t.push(d),a++}}}else{let l={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.pills.type,parentSchema:Pe.properties.pills,data:c};t===null?t=[l]:t.push(l),a++}}if(s.theme!==void 0){let c=s.theme;if(typeof c!="string"){let l={instancePath:e+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.theme.type,parentSchema:Pe.properties.theme,data:c};t===null?t=[l]:t.push(l),a++}}if(s.roles!==void 0){let c=s.roles;if(c&&typeof c=="object"&&!Array.isArray(c))for(let l in c){let p=c[l];if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.h===void 0){let f={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"h"},message:"must have required property 'h'",schema:Ge.required,parentSchema:Ge,data:p};t===null?t=[f]:t.push(f),a++}if(p.s===void 0){let f={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"s"},message:"must have required property 's'",schema:Ge.required,parentSchema:Ge,data:p};t===null?t=[f]:t.push(f),a++}for(let f in p)if(!(f==="h"||f==="s"||f==="top"||f==="tint")){let d={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:Ge,data:p};t===null?t=[d]:t.push(d),a++}if(p.h!==void 0){let f=p.h;if(typeof f=="number"){if(f>360||isNaN(f)){let d={instancePath:e+"/roles/"+l.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:Ge.properties.h,data:f};t===null?t=[d]:t.push(d),a++}if(f<0||isNaN(f)){let d={instancePath:e+"/roles/"+l.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:Ge.properties.h,data:f};t===null?t=[d]:t.push(d),a++}}else{let d={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ge.properties.h.type,parentSchema:Ge.properties.h,data:f};t===null?t=[d]:t.push(d),a++}}if(p.s!==void 0){let f=p.s;if(typeof f=="number"){if(f>100||isNaN(f)){let d={instancePath:e+"/roles/"+l.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:Ge.properties.s,data:f};t===null?t=[d]:t.push(d),a++}if(f<0||isNaN(f)){let d={instancePath:e+"/roles/"+l.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:Ge.properties.s,data:f};t===null?t=[d]:t.push(d),a++}}else{let d={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ge.properties.s.type,parentSchema:Ge.properties.s,data:f};t===null?t=[d]:t.push(d),a++}}if(p.top!==void 0){let f=p.top;if(typeof f!="string"){let d={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/top",schemaPath:"#/$defs/role/properties/top/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ge.properties.top.type,parentSchema:Ge.properties.top,data:f};t===null?t=[d]:t.push(d),a++}}if(p.tint!==void 0){let f=p.tint;if(typeof f=="number"){if(f>100||isNaN(f)){let d={instancePath:e+"/roles/"+l.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:Ge.properties.tint,data:f};t===null?t=[d]:t.push(d),a++}if(f<0||isNaN(f)){let d={instancePath:e+"/roles/"+l.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:Ge.properties.tint,data:f};t===null?t=[d]:t.push(d),a++}}else{let d={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ge.properties.tint.type,parentSchema:Ge.properties.tint,data:f};t===null?t=[d]:t.push(d),a++}}}else{let f={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ge.type,parentSchema:Ge,data:p};t===null?t=[f]:t.push(f),a++}}else{let l={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.properties.roles.type,parentSchema:Pe.properties.roles,data:c};t===null?t=[l]:t.push(l),a++}}if(s.kinds!==void 0){let c=s.kinds;if(c&&typeof c=="object"&&!Array.isArray(c))for(let l in c){let p=c[l];if(p&&typeof p=="object"&&!Array.isArray(p)){for(let f in p)if(!(f==="legend"||f==="like"||f==="color"||f==="dash")){let d={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:bt,data:p};t===null?t=[d]:t.push(d),a++}if(p.legend!==void 0){let f=p.legend;if(typeof f!="string"){let d={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/legend",schemaPath:"#/$defs/kindDef/properties/legend/type",keyword:"type",params:{type:"string"},message:"must be string",schema:bt.properties.legend.type,parentSchema:bt.properties.legend,data:f};t===null?t=[d]:t.push(d),a++}}if(p.like!==void 0){let f=p.like;if(typeof f!="string"){let d={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/like",schemaPath:"#/$defs/kindDef/properties/like/type",keyword:"type",params:{type:"string"},message:"must be string",schema:bt.properties.like.type,parentSchema:bt.properties.like,data:f};t===null?t=[d]:t.push(d),a++}}if(p.color!==void 0){let f=p.color;if(typeof f!="string"){let d={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/color",schemaPath:"#/$defs/kindDef/properties/color/type",keyword:"type",params:{type:"string"},message:"must be string",schema:bt.properties.color.type,parentSchema:bt.properties.color,data:f};t===null?t=[d]:t.push(d),a++}}if(p.dash!==void 0){let f=p.dash;if(!(f==="solid"||f==="dashed"||f==="dotted")){let d={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:bt.properties.dash.enum},message:"must be equal to one of the allowed values",schema:bt.properties.dash.enum,parentSchema:bt.properties.dash,data:f};t===null?t=[d]:t.push(d),a++}}}else{let f={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:bt.type,parentSchema:bt,data:p};t===null?t=[f]:t.push(f),a++}}else{let l={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.properties.kinds.type,parentSchema:Pe.properties.kinds,data:c};t===null?t=[l]:t.push(l),a++}}if(s.after!==void 0){let c=s.after;if(typeof c!="string"){let l={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.after.type,parentSchema:Pe.properties.after,data:c};t===null?t=[l]:t.push(l),a++}}if(s.grid!==void 0){let c=s.grid;if(c&&typeof c=="object"&&!Array.isArray(c)){for(let l in c)if(!(l==="snap"||l==="show"||l==="step")){let p={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Ke,data:c};t===null?t=[p]:t.push(p),a++}if(c.snap!==void 0){let l=c.snap;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ke.properties.snap,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ke.properties.snap.type,parentSchema:Ke.properties.snap,data:l};t===null?t=[p]:t.push(p),a++}}if(c.show!==void 0){let l=c.show;if(typeof l!="boolean"){let p={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Ke.properties.show.type,parentSchema:Ke.properties.show,data:l};t===null?t=[p]:t.push(p),a++}}if(c.step!==void 0){let l=c.step;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ke.properties.step,data:l};t===null?t=[p]:t.push(p),a++}}else{let p={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ke.properties.step.type,parentSchema:Ke.properties.step,data:l};t===null?t=[p]:t.push(p),a++}}}else{let l={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ke.type,parentSchema:Ke,data:c};t===null?t=[l]:t.push(l),a++}}if(s.assemble!==void 0){let c=s.assemble;if(typeof c!="boolean"){let l={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Pe.properties.assemble.type,parentSchema:Pe.properties.assemble,data:c};t===null?t=[l]:t.push(l),a++}}if(s.footer!==void 0){let c=s.footer;if(typeof c!="string"){let l={instancePath:e+"/footer",schemaPath:"#/properties/footer/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.footer.type,parentSchema:Pe.properties.footer,data:c};t===null?t=[l]:t.push(l),a++}}if(s.treatment!==void 0){let c=s.treatment;if(c!=="mono"){let l={instancePath:e+"/treatment",schemaPath:"#/properties/treatment/enum",keyword:"enum",params:{allowedValues:Pe.properties.treatment.enum},message:"must be equal to one of the allowed values",schema:Pe.properties.treatment.enum,parentSchema:Pe.properties.treatment,data:c};t===null?t=[l]:t.push(l),a++}}if(s.scenes!==void 0){let c=s.scenes;if(Array.isArray(c)){if(c.length<1){let p={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:Pe.properties.scenes,data:c};t===null?t=[p]:t.push(p),a++}let l=c.length;for(let p=0;p<l;p++)Ls(c[p],{instancePath:e+"/scenes/"+p,parentData:c,parentDataProperty:p,rootData:i,dynamicAnchors:o})||(t=t===null?Ls.errors:t.concat(Ls.errors),a=t.length)}else{let l={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.scenes.type,parentSchema:Pe.properties.scenes,data:c};t===null?t=[l]:t.push(l),a++}}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.type,parentSchema:Pe,data:s};t===null?t=[c]:t.push(c),a++}return pr.errors=t,a===0}pr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function xp(s){let e=JSON.stringify(s),n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16)+":"+e.length}var $p=new Map([["28016100:13106",ho]]);function vi(s){let e=$p.get(xp(s));if(!e)throw new Error(`schema not precompiled into the page: ${s.$id??s.title??"?"}`);return e}var Pi={$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}]}}}}};function vp(s,e){let n=s.length,r=e.length;if(!n)return r;if(!r)return n;let i=Array.from({length:n+1},(o,t)=>[t,...Array(r).fill(0)]);for(let o=0;o<=r;o++)i[0][o]=o;for(let o=1;o<=n;o++)for(let t=1;t<=r;t++){let a=s[o-1]===e[t-1]?0:1;i[o][t]=Math.min(i[o-1][t]+1,i[o][t-1]+1,i[o-1][t-1]+a),o>1&&t>1&&s[o-1]===e[t-2]&&s[o-2]===e[t-1]&&(i[o][t]=Math.min(i[o][t],i[o-2][t-2]+1))}return i[n][r]}function Qe(s,e){let n,r=1/0,i=s.toLowerCase();for(let t of e){let a=vp(i,t.toLowerCase());a<r&&(r=a,n=t)}if(n===void 0)return;let o=Math.max(1,Math.min(3,Math.floor(Math.max(s.length,n.length)/3)));return r<=o?n:void 0}var Ai=[];function yo(s){Ai.includes(s)||Ai.push(s)}function Oi(s){for(let e of Ai){let n=e(s);if(n!==void 0)return n}return s?"this item":"the file"}function fr(s){return s===null?"nothing":Array.isArray(s)?"a list":typeof s=="object"?"a map":typeof s=="string"?`the text "${s}"`:`${typeof s} ${String(s)}`}var go={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},fn=new Map;function bo(s,e){fn.set(s,e)}var Mi=new Map;function wo(s,e){Mi.set(s,(n,r)=>e(fr(n),r))}var Ni=[];function ko(s,e){Ni.some(([n])=>n===s)||Ni.push([s,e])}function Pp(s){let e=s.parentSchema,n=Object.keys(e?.properties??{});e?.$ref&&fn.has(e.$ref)&&n.push(...fn.get(e.$ref).filter(r=>!n.includes(r)));for(let r of e?.allOf??[])r.$ref&&fn.has(r.$ref)&&n.push(...fn.get(r.$ref));return n}function cr(s,e){let n=s.propertyName??(s.keyword==="propertyNames"?s.params.propertyName:void 0);if(n!==void 0){let m=`${s.instancePath}/${n.replace(/~/g,"~0").replace(/\//g,"~1")}`,c=e.locate(m,{key:!0});return{severity:"error",message:`"${n}" can't be a name`,line:c.line,col:c.col,path:m,hint:"names are a lower-case letter, then lower-case letters, digits and -"}}let r=s.instancePath,i=s.message??"is not valid",o,t=e.locate(r),a=s.params;switch(s.keyword){case"required":i=`${Oi(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let c=String(a.additionalProperty??a.unevaluatedProperty),l=Pp(s),p=Qe(c,l);return i=`unknown key "${c}" in ${Oi(r)}`+(p?` (did you mean "${p}"?)`:""),!p&&l.length&&(o=`known keys: ${l.join(", ")}`),/\s/.test(c)&&(o='inside { \u2026 } a comma starts a new key: put text with commas in quotes, e.g. label: "read once, at launch"'),t=e.locate(`${r}/${c}`,{key:!0}),{severity:"error",message:i,line:t.line,col:t.col,path:`${r}/${c}`,hint:o}}case"enum":{let c=a.allowedValues.map(String),l=typeof s.data=="string"?Qe(s.data,c):void 0,p=r.split("/").pop();i=`${fr(s.data)} is not a valid ${p&&!/^\d+$/.test(p)?`"${p}"`:"value"}`+(l?` (did you mean "${l}"?)`:""),o=`expected one of: ${c.join(", ")}`;break}case"const":i=Mi.has(r)?Mi.get(r)(s.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${go[String(a.type)]??a.type}, got ${fr(s.data)}`;break;case"pattern":let m=Ni.find(([c])=>String(a.pattern).startsWith(c));m?{message:i,hint:o}=m[1](s.data):(i=`"${s.data}" is not a valid id`,o="ids start with a letter and use only letters, digits, - and _");break;case"minItems":case"maxItems":s.schema===2||s.parentSchema?.minItems===2?i=`expected a list of ${s.parentSchema.minItems===s.parentSchema.maxItems?s.parentSchema.minItems:`${s.parentSchema.minItems} to ${s.parentSchema.maxItems}`} numbers, got ${s.data.length}`:i=`list ${s.message}`;break;case"false schema":{let c=r.split("/").pop()??"",l=r.split("/").slice(0,-1).join("/");i=`"${c.replace(/~1/g,"/").replace(/~0/g,"~")}" can't be set on ${Oi(l)}`,t=e.locate(r,{key:!0});break}case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":i=`${s.data} is out of range: ${s.message}`;break}return{severity:"error",message:i,line:t.line,col:t.col,path:r,hint:o}}function xo(s,e){let n=s.filter(t=>t.keyword==="anyOf"),r=new Set,i=[];for(let t of n){let a=t.schemaPath.replace(/\/anyOf$/,"/anyOf/"),m=s.filter(p=>p!==t&&p.schemaPath.startsWith(a)&&p.instancePath.startsWith(t.instancePath));if(m.forEach(p=>r.add(p)),r.add(t),n.some(p=>p!==t&&t.schemaPath.startsWith(p.schemaPath.replace(/\/anyOf$/,"/anyOf/"))&&p.instancePath===t.instancePath))continue;let c=m.filter(p=>p.instancePath.length>t.instancePath.length&&p.keyword!=="anyOf"),l=m.find(p=>p.keyword==="enum"&&p.instancePath===t.instancePath&&typeof t.data=="string");if(l)i.push(cr(l,e));else if(c.length)i.push(...c.map(p=>cr(p,e)));else{let p=m.filter(f=>f.instancePath===t.instancePath&&f.keyword!=="type"&&f.keyword!=="anyOf");if(p.length&&typeof t.data=="object"&&t.data!==null)i.push(...p.map(f=>cr(f,e)));else{let f=[...new Set(m.filter(h=>h.keyword==="type").map(h=>go[String(h.params.type)]??""))].filter(Boolean),d=e.locate(t.instancePath);i.push({severity:"error",message:`${fr(t.data)} is not allowed here`+(f.length?`; expected ${f.join(" or ")}`:""),line:d.line,col:d.col,path:t.instancePath})}}}for(let t of s)r.has(t)||i.push(cr(t,e));let o=new Set;return i.filter(t=>{let a=`${t.path}|${t.message}`;return o.has(a)?!1:(o.add(a),!0)}).sort((t,a)=>t.line-a.line||t.col-a.col)}var $o=vi(Pi),Op=Object.keys(Pi.$defs.placement.properties);bo("#/$defs/placement",Op);wo("/isodiag",s=>`"isodiag" must be 1 (the format version), got ${s}`);var Ap={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};yo(s=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(s);return e?Ap[e[1].replace(/s$/,"")]??"this item":void 0});ko("^[A-Za-z][A-Za-z0-9_-]*(",s=>({message:`"${s}" is not a node reference`,hint:"write an id, optionally with a side: worker, worker.e (sides: n, e, s, w, top)"}));function So(s){return s.data==null||typeof s.data!="object"||Array.isArray(s.data)?[{severity:"error",message:'the file must be a YAML map with "isodiag: 1" and "scenes:"',line:1,col:1,path:""}]:$o(s.data)?[]:xo($o.errors??[],s)}var ct=(s,e)=>e!==void 0&&Object.hasOwn(s.regions,e)?s.regions[e]:void 0,dn=(s,e)=>s.nodes[e??s.defaultNode],ys=(s,e)=>dn(s,e)??s.nodes[s.defaultNode],vo=s=>Object.values(s.regions).find(e=>e.shape==="walled")?.z[1]??.8,Po=s=>Object.values(s.regions).map(e=>e.css??"").join("");var os=.16,zi=["right-of","left-of","below","behind"];function mr(s,e,n,r,i,o={},t){let a=[],m=(P,A,S,O=!1,M="error")=>{let C=n.locate(P,{key:O});a.push({severity:M,message:A,line:C.line,col:C.col,path:P,hint:S})},c=[],l=new Map,p=[],f=new Map,d=new Set([...Object.keys(r.roles),...Object.keys(o)]);function h(P,A){let S=l.get(P.id);if(S){let O=n.locate(S.path+"/id");return m(P.path+"/id",`duplicate id "${P.id}" (first used on line ${O.line})`),!1}return l.set(P.id,P),c.push(P),P.parent=A,A?A.children.push(P):p.push(P),!0}let g=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function y(P,A,S){let O={id:P.id,type:"node",path:A,children:[],box:g(),floor:0,node:P,appears:P.appears,disappears:P.disappears};h(O,S)&&(P.nodes??[]).forEach((M,C)=>y(M,`${A}/nodes/${C}`,O))}function x(P,A,S){let O={id:P.id,type:"region",path:A,children:[],box:g(),floor:0,region:P,appears:P.appears,disappears:P.disappears};h(O,S)&&((P.nodes??[]).forEach((M,C)=>y(M,`${A}/nodes/${C}`,O)),(P.regions??[]).forEach((M,C)=>x(M,`${A}/regions/${C}`,O)))}(s.regions??[]).forEach((P,A)=>x(P,`${e}/regions/${A}`,void 0)),(s.nodes??[]).forEach((P,A)=>y(P,`${e}/nodes/${A}`,void 0));let u=()=>l.keys(),b=()=>c.filter(P=>P.type==="region").map(P=>P.id);for(let P of[...c]){let A=P.node??P.region;if(A.in!==void 0){let O=l.get(A.in);if(!O){m(P.path+"/in",`unknown region "${A.in}"`+mn(A.in,b()));continue}if(O.type!=="region"){m(P.path+"/in",`"${A.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(P.parent&&P.parent!==O){m(P.path+"/in",`"${P.id}" is written inside "${P.parent.id}" but says in: ${A.in}; use one or the other`);continue}for(let M=O;M;M=M.parent)if(M===P){m(P.path+"/in",`"${P.id}" cannot be inside itself`);continue}P.parent||(p.splice(p.indexOf(P),1),P.parent=O,O.children.push(P))}if(P.node){let O=P.node.asset;O!==void 0&&!dn(i,O)&&m(P.path+"/asset",`unknown asset "${O}"`+mn(O,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let S=(P.node??P.region).role;S!==void 0&&!d.has(S)&&m(P.path+"/role",`unknown colour role "${S}"`+mn(S,d),`add it under "roles:" at the top of the file, or use one of: ${[...d].join(", ")}`)}for(let P of c){let A=P.region?.gate;if(!A?.node)continue;let S=l.get(A.node);if(!S){m(P.path+"/gate/node",`unknown node "${A.node}"`+mn(A.node,u()));continue}if(S.type!=="node"){m(P.path+"/gate/node",`"${A.node}" is a region; a gate is a node`);continue}S.placedBy=P.id;let O=S.node;(O.at||zi.some(M=>O[M]))&&m(S.path,`"${S.id}" is the gate of "${P.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let k=P=>P.gap??s.gap??2;function w(P){let A=P.node,S=ys(i,A.asset),O=A.size,M=S.size[0],C=S.size[1],V=S.size[2];if(O&&(M=O[0],C=O[1],O.length>2&&(V=O[2])),P.placedBy){let j=l.get(P.placedBy).region,N=j.gate,R=N.width??2,D=O?Math.min(M,C):.3;V=O&&O.length>2?V:N.height??(j.height??vo(i))+.3,N.side==="e"||N.side==="w"?(M=D,C=R):(M=R,C=D)}return[M,C,V]}function v(P,A,S,O,M){for(let q of A)z(q);let C=A.filter(q=>!q.placedBy),V=new Set(C),j=new Set,N=[],R=new Set,D=q=>{let Q=q.node??q.region,ze=[];for(let Ee of zi){let Ze=Q[Ee];if(Ze===void 0)continue;let U=l.get(Ze);if(!U){m(`${q.path}/${Ee}`,`unknown id "${Ze}"`+mn(Ze,u()));continue}if(U===q){m(`${q.path}/${Ee}`,`"${q.id}" cannot be placed ${Ee} itself`);continue}if(!V.has(U)){let fe=ge=>ge.parent?`"${ge.parent.id}"`:"the scene";m(`${q.path}/${Ee}`,`"${Ze}" is in ${fe(U)} but "${q.id}" is in ${fe(q)}; relative placement works between items in the same region`,U.placedBy?`"${Ze}" is a gate, placed by its ${l.get(U.placedBy)?.region?.kind??"region"}`:`place "${q.id}" relative to something in ${fe(q)}, or use "at:"`);continue}ze.push(U)}if(!ze.length&&!Q.at){let Ee=C.indexOf(q);Ee>0&&ze.push(C[Ee-1])}return ze},K=q=>{if(!j.has(q)){if(R.has(q)){m(q.path,`placement loop: "${q.id}" is placed relative to something placed relative to it`);return}R.add(q),D(q).forEach(K),R.delete(q),j.add(q),N.push(q)}};C.forEach(K);for(let q of N){let Q=q.node??q.region,ze=f.get(q),Ee=zi.find(Ze=>Q[Ze]!==void 0&&l.get(Q[Ze])&&V.has(l.get(Q[Ze])));if(Q.at&&Ee&&m(`${q.path}/at`,`"${q.id}" has both "at" and "${Ee}"; "at" wins`,void 0,!0,"warning"),Q.at)ze.x=Q.at[0],ze.y=Q.at[1];else if(Ee)I(ze,f.get(l.get(Q[Ee])),Ee,k(Q),Q.align??"center");else{let Ze=C.indexOf(q);Ze>0?I(ze,f.get(C[Ze-1]),O==="row"?"right-of":"below",k(Q),"center"):(ze.x=S,ze.y=S)}Q.shift&&(ze.x+=Q.shift[0],ze.y+=Q.shift[1])}if(M||!C.length)return{w:0,d:0};let G=1/0,ne=1/0,te=-1/0,J=-1/0;for(let q of C){let Q=f.get(q);G=Math.min(G,Q.x),ne=Math.min(ne,Q.y),te=Math.max(te,Q.x+Q.w),J=Math.max(J,Q.y+Q.d)}let pe=Math.min(0,G-S),ie=Math.min(0,ne-S);if(pe||ie)for(let q of C){let Q=f.get(q);Q.x-=pe,Q.y-=ie}return{w:te-pe+S,d:J-ie+S}}function I(P,A,S,O,M){let C=()=>{P.y=M==="start"?A.y:M==="end"?A.y+A.d-P.d:A.y+(A.d-P.d)/2},V=()=>{P.x=M==="start"?A.x:M==="end"?A.x+A.w-P.w:A.x+(A.w-P.w)/2};S==="right-of"?(P.x=A.x+A.w+O,C()):S==="left-of"?(P.x=A.x-O-P.w,C()):S==="below"?(P.y=A.y+A.d+O,V()):(P.y=A.y-O-P.d,V())}function z(P){if(P.type==="node"){let[N,R,D]=w(P);f.set(P,{x:0,y:0,w:N,d:R,h:D,z:P.node.z??0}),P.children.length&&v(P,P.children,0,"row",!0);return}let A=P.region,S=A.padding??ct(i,A.kind)?.pad,O=!!A.size,M=v(P,P.children,S,A.flow??"row",O),C=A.size?A.size[0]:Math.max(M.w,S*2+.5),V=A.size?A.size[1]:Math.max(M.d,S*2+.5);if(!A.size&&A.gate){let N=(A.gate.width??2)+1;A.gate.side==="e"||A.gate.side==="w"?V=Math.max(V,N):C=Math.max(C,N)}let j=A.size&&A.size.length>2?A.size[2]:A.height??ct(i,A.kind).z[1];f.set(P,{x:0,y:0,w:C,d:V,h:j,z:0})}v(void 0,p,0,s.flow??"row",!0);function B(P,A,S,O){let M=f.get(P),C=A+M.x,V=S+M.y;if(P.type==="region"){let j=ct(i,P.region.kind),[N]=j.z,R=j.floor,D=j.shape==="slab"&&ct(i,P.parent?.region?.kind)?.shape==="slab"?0:N,K=P.region.z??0,G=O+D+K,ne=O+M.h+K;P.box={x0:C,y0:V,z0:G,x1:C+M.w,y1:V+M.d,z1:ne},P.floor=R?ne:O}else{let j=O+M.z;P.box={x0:C,y0:V,z0:j,x1:C+M.w,y1:V+M.d,z1:j+M.h},P.floor=P.box.z1}for(let j of P.children)j.placedBy||B(j,C,V,P.floor)}for(let P of p)P.placedBy||B(P,0,0,0);if(t){let P=S=>Math.round(S/t)*t,A=S=>Math.round(S*1e9)/1e9;for(let S of c){if(S.placedBy)continue;let O=S.box,M=P(O.x0),C=P(O.x1),V=P(O.y0),j=P(O.y1);C-M<t&&(C=M+t),j-V<t&&(j=V+t),S.box={...O,x0:A(M),x1:A(C),y0:A(V),y1:A(j)};let N=S.node??S.region;N.at&&N.at.forEach((R,D)=>{let K=R/t;Math.abs(K-Math.round(K))>1e-6&&m(`${S.path}/at/${D}`,`${R} is not on the ${t} grid; it is drawn at ${A(P(R))}`,void 0,!1,"warning")})}}for(let P of c){let A=P.region?.gate;if(!A?.node)continue;let S=l.get(A.node);!S||S.placedBy!==P.id||(S.box=Ti(P,f.get(S).h,f.get(S).w,f.get(S).d),S.floor=S.box.z1)}for(let P of c){let A=P.children.filter(S=>!S.placedBy);for(let S=0;S<A.length;S++)for(let O=S+1;O<A.length;O++){let M=A[S],C=A[O];dr(M,i)||dr(C,i)||Oo(M.box,C.box)&&m(C.path,`"${C.id}" overlaps "${M.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(P.parent&&P.parent.type==="region"&&!P.placedBy){let S=P.parent.box,O=P.box,M=1e-6;(O.x0<S.x0-M||O.y0<S.y0-M||O.x1>S.x1+M||O.y1>S.y1+M)&&m(P.path,`"${P.id}" sticks out of region "${P.parent.id}"`,`make "${P.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let P=p.filter(A=>!A.placedBy);for(let A=0;A<P.length;A++)for(let S=A+1;S<P.length;S++){let O=P[A],M=P[S];Oo(O.box,M.box)&&!dr(O,i)&&!dr(M,i)&&m(M.path,`"${M.id}" overlaps "${O.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let T=new Set,L=a.filter(P=>{let A=P.path+P.message;return T.has(A)?!1:(T.add(A),!0)});return{items:c,byId:l,roots:p,diags:L,catalog:i}}var dr=(s,e)=>s.type==="region"&&["zone","tunnel"].includes(ct(e,s.region.kind)?.shape??"");function Ti(s,e,n,r){let i=s.region.gate,o=s.box,t=s.box.z0,a=i.at??.5,m=i.width??2;if(i.side==="w"||i.side==="e"){let p=i.side==="w"?o.x0+os/2:o.x1-os/2,f=o.y0+(o.y1-o.y0)*a;return{x0:p-n/2,x1:p+n/2,y0:f-m/2,y1:f+m/2,z0:t,z1:t+e}}let c=i.side==="n"?o.y0+os/2:o.y1-os/2,l=o.x0+(o.x1-o.x0)*a;return{x0:l-m/2,x1:l+m/2,y0:c-r/2,y1:c+r/2,z0:t,z1:t+e}}function Oo(s,e,n=1e-6){return s.x0<e.x1-n&&e.x0<s.x1-n&&s.y0<e.y1-n&&e.y0<s.y1-n}function mn(s,e){let n=Qe(s,e);return n?` (did you mean "${n}"?)`:""}function ur(s){let e=bi(s);for(let n of["light","dark","kinds","roles"])if(!e||typeof e[n]!="object")throw new Error(`theme: missing "${n}"`);return e}function _s(s,e={},n={}){let r={...s.kinds};for(let[i,o]of Object.entries(n)){let t=r[o.like??i]??r.control;r[i]={color:o.color??t.color,dash:o.dash??t.dash,legend:o.legend??t.legend}}return{...s,roles:{...s.roles,...e},kinds:r}}var Ao=s=>Object.entries(s).map(([e,n])=>`--${e}:${n}`).join(";");function Ds(s,e){return e in s.light?`var(--${e})`:e}function Mo(s){let e="";for(let[n,r]of Object.entries(s.roles))e+=`.k-${n}{--h:${r.h};--s:${r.s}%}`,r.top?e+=`.k-${n} .top{fill:${r.top}}`:r.tint&&(e+=`.k-${n} .top{fill:color-mix(in srgb,hsl(${r.h} ${Math.min(100,r.s+15)}% 50%) ${r.tint}%,var(--pad-top))}`),e+=`
132
+ `;for(let[n,r]of Object.entries(s.kinds)){let i=Ds(s,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-${n}{stroke:${i}${o}} .t-${n}{fill:${i}} .c-${n}{--c:${i}}
133
+ `}return{light:Ao(s.light),dark:Ao(s.dark),rest:e}}var No={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 Xe=34,ft=Math.cos(Math.PI/6),ae=(s,e,n=0)=>[(s-e)*ft*Xe,(s+e)*.5*Xe-n*Xe],Le=s=>{let e=Math.round(s*10)/10;return Object.is(e,-0)?"0":String(e)},un=s=>`${Le(s[0])},${Le(s[1])}`,gs=s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function le(s,e={},n){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${gs(typeof o=="number"?Le(o):o)}"`)}return n===void 0?`<${s}${r}/>`:`<${s}${r}>${n}</${s}>`}var He={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}},hr;function zo(s,e){let n=hr;hr=s;try{return e()}finally{hr=n}}function ls(s,e){let n=hr?.widths[e.key]??No[e.key],r=e.key.startsWith("mono")?.6:.58,i=0;for(let o of s)i+=n[o]??r;return(i+(e.spacing??0)*[...s].length)*e.size}var Ei=(s,e,n)=>[s[0]*e+s[2]*n+s[4],s[1]*e+s[3]*n+s[5]],Ii=s=>`matrix(${s.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function Np(s,e){if(e==="left"){let[i,o]=ae(s.x0,s.y1,s.z1);return{m:[ft,.5,0,1,i,o],w:(s.x1-s.x0)*Xe,h:(s.z1-s.z0)*Xe}}if(e==="right"){let[i,o]=ae(s.x1,s.y1,s.z1);return{m:[ft,-.5,0,1,i,o],w:(s.y1-s.y0)*Xe,h:(s.z1-s.z0)*Xe}}let[n,r]=ae(s.x0,s.y0,s.z1);return{m:[ft,.5,-ft,.5,n,r],w:(s.x1-s.x0)*Xe,h:(s.y1-s.y0)*Xe}}var ji=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,n,r,i){this.add([e,n]),this.add([e+r,n+i])}get empty(){return this.x0===1/0}},yr=class{bounds=new ji;texts=[];planes=[];planePolys=[];defs=new Map;poly(e,n,r={}){let i=e.map(o=>ae(o[0],o[1],o[2]));return i.forEach(o=>this.bounds.add(o)),le("polygon",{points:i.map(un).join(" "),class:n,...r})}line3(e,n,r,i={}){let o=ae(...e),t=ae(...n);return this.bounds.add(o),this.bounds.add(t),le("line",{x1:o[0],y1:o[1],x2:t[0],y2:t[1],class:r,...i})}blockFaces(e){let{x0:n,y0:r,x1:i,y1:o,z0:t,z1:a}=e;return this.poly([[n,o,t],[i,o,t],[i,o,a],[n,o,a]],"lft")+this.poly([[i,r,t],[i,o,t],[i,o,a],[i,r,a]],"rgt")+this.poly([[n,r,a],[i,r,a],[i,o,a],[n,o,a]],"top")}onFace(e,n,r,i){let o=Np(e,n);for(let[t,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(Ei(o.m,t,a));return le("g",{class:i,transform:Ii(o.m)},r(o.w,o.h))}onMatrix(e,n,r,i,o){for(let[t,a]of[[0,0],[n,0],[0,r],[n,r]])this.bounds.add(Ei(e,t,a));return le("g",{class:o,transform:Ii(e)},i(n,r))}text(e,n,r,i,o,t="middle",a={},m){let c=ls(r,o),p={x:t==="start"?e:t==="end"?e-c:e-c/2,y:n-o.size*.8,w:c,h:o.size*1.05,text:r,owner:m};return this.bounds.addRect(p.x-2,p.y-2,p.w+4,p.h+4),this.texts.push(p),le("text",{x:e,y:n,class:i,"text-anchor":t==="start"?void 0:t,...a},gs(r))}planeText(e,n,r,i,o="start",t={}){let a=ls(n,i),m=o==="start"?0:o==="end"?-a:-a/2,c=[[m,-i.size*.8],[m+a,-i.size*.8],[m,i.size*.25],[m+a,i.size*.25]].map(([f,d])=>Ei(e,f,d));c.forEach(f=>this.bounds.add(f));let l=c.map(f=>f[0]),p=c.map(f=>f[1]);return this.planePolys.push([c[0],c[1],c[3],c[2]]),this.planes.push({x:Math.min(...l),y:Math.min(...p),w:Math.max(...l)-Math.min(...l),h:Math.max(...p)-Math.min(...p)}),le("text",{transform:Ii(e),class:r,"text-anchor":o==="start"?void 0:o,...t},gs(n))}floorText(e,n,r,i,o,t="x",a="start",m={}){let[c,l]=ae(e,n,r),p=t==="x"?[ft,.5,-ft,.5,c,l]:[ft,-.5,ft,.5,c,l];return this.planeText(p,i,o,He.floor,a,m)}faceText(e,n,r,i,o,t,a="left",m="start",c={}){let[l,p]=ae(e,n,r),f=a==="left"?[ft,.5,0,1,l,p]:[ft,-.5,0,1,l,p];return this.planeText(f,i,o,t,m,c)}def(e,n){this.defs.set(e,n)}},hn=s=>[(s.x0+s.x1)/2,(s.y0+s.y1)/2,s.z1];function Ri(s,e,n){let r="";for(let i=0;i<n;i++){let o=e.z1-(e.z1-e.z0)*(.28+i*.2),t=(e.x1-e.x0)*(i===n-1?.35:.62-i*.1);r+=s.line3([e.x0+.35,e.y1,o],[e.x0+.35+t,e.y1,o],"det")}return r}function To(s,e){let r=e.z1,i=[e.x0+.55,e.y0+.55,r],o=[e.x1-.55,e.y0+.55,r],t=[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 s.poly([i,o,t,a],"det")+s.line3(i,m,"det")+s.line3(m,o,"det")}function Eo(s,e){let r=e.z1,i=s.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 t=e.y0+.55+(e.y1-e.y0-1.1)*o/3;i+=s.line3([e.x0+.55+.3,t,r],[e.x1-.55-.3-(o===2?.5:0),t,r],"det")}return i}function Io(s,e){let r=e.z1,i=(e.y0+e.y1)/2;return s.line3([e.x0+.3,i-.2,r],[e.x1-.3,i-.2,r],"det")+s.line3([e.x0+.3,i+.2,r],[e.x1-.3-.3,i+.2,r],"det")}function jo(s,e){let n=(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,t=[];for(let a=0;a<20;a++){let m=a/20*Math.PI*2;t.push([n-o*1.4+Math.cos(m)*o,r+Math.sin(m)*o,i])}return s.poly(t,"det")+s.line3([n-o*.4,r,i],[n+o*2.2,r,i],"det")+s.line3([n+o*1.7,r,i],[n+o*1.7,r+o*.8,i],"det")}function Ro(s,e){let n=(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,t=[];for(let a=0;a<24;a++){let m=a/24*Math.PI*2;t.push([n+Math.cos(m)*o,r+Math.sin(m)*o,i])}return s.poly(t,"det sock-hole")}var bs=(s,e,n,r,i,o=0)=>le("rect",{class:s,x:e,y:n,width:r,height:i,rx:o||void 0}),Ci={terminal(s,e){let n="",r=Math.max(2,Math.floor((e-12)/9));for(let i=0;i<r;i++){let o=10+i*9,t=(s-18)*[.7,.45,.6,.3,.55][i%5];n+=le("line",{class:"ln",x1:8,y1:o,x2:8+t,y2:o})}return n},chat(s,e){return[[6,.62,"w"],[.3,.58,"m"],[6,.46,"w"],[.42,.5,"m"]].map((r,i)=>{let o=(s-14)*r[1],t=r[0]===6?7:s-7-o;return bs(r[2],t,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(s,e){return bs("wall",5,5,s-10,e-10,2)+bs("bar",5,5,s-10,6)+bs("win",s*.5,13,s*.38,e*.42,2)},tiles(s,e){let t=(s-12-5)/3,a=(e-12-2.5*1)/2,m="";for(let c=0;c<2;c++)for(let l=0;l<3;l++){let p=6+l*(t+2.5),f=6+c*(a+2.5);m+=bs("t",p,f,t,a,1.5),[.3,.52,.74].forEach((d,h)=>{m+=le("line",{class:"ln",x1:p+2.5,y1:f+a*d,x2:p+2.5+(t-5)*[.8,.5,.65][(h+c+l)%3],y2:f+a*d})})}return m}};function Li(s,e){let n=s/2,r=e/2,i=Math.min(s,e)*.22;return bs("unk",s*.2,e*.2,s*.6,e*.6,2)+le("path",{class:"unk-q",d:`M${Le(n-i*.5)},${Le(r-i*.45)}a${Le(i*.5)},${Le(i*.5)} 0 1 1 ${Le(i*.5)},${Le(i*.55)}v${Le(i*.3)}`})+le("circle",{class:"unk-dot",cx:Le(n),cy:Le(r+i*.75),r:Le(Math.max(.8,i*.1))})}function _i(s,e){return bs("glass",3,3,s-6,e-6,3)}var Lo=Object.create(null),zp=[];var _o=()=>zp.join(""),Di=s=>Object.hasOwn(Lo,s)?Lo[s]:void 0,yn=s=>Object.hasOwn(Ci,s)?Ci[s]:void 0;function Tp(s,e){let n=(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),t=[[n-o,r-o,i],[n+o,r-o,i],[n+o,r+o,i],[n-o,r+o,i]];return s.poly(t,"ico-unknown")+s.line3([n-o*.3,r-o*.35,i],[n+o*.3,r-o*.35,i],"ico-unknown-q")+s.line3([n+o*.3,r-o*.35,i],[n,r+o*.1,i],"ico-unknown-q")+s.line3([n,r+o*.45,i],[n,r+o*.5,i],"ico-unknown-q")}function Ep(s,e,n){let r="";for(let i of n??[])i==="terminal"?r+=Ri(s,e,3):i==="envelope"?r+=To(s,e):i==="bubble"?r+=Eo(s,e):i==="file-lines"?r+=Io(s,e):typeof i=="object"&&(i.terminal&&(r+=Ri(s,e,i.terminal)),i.icon&&(r+=(Di(i.icon)??Tp)(s,e)));return r}var Ip=(s,e)=>(s.deco??e.deco??[]).filter(n=>n!=="ghost");function ut(s,e,n,r,i,o){let t={name:s,description:e,size:n,role:r,deco:i,draw:(a,m,c)=>a.blockFaces(m)+Ep(a,m,Ip(c,t))+(o?o(a,m):"")};return t}function Bi(s){let[e,n]=hn(s);return{x0:e-.75,y0:n-.75,x1:e+.75,y1:n+.75,z0:s.z0,z1:s.z0+.18}}function jp(s,e){let n=Math.max(8,Math.min(s,e)*.18),r=n*.55,i=r,o=r,t=s-r,a=e-r,m=(c,l,p,f)=>{let d=Math.hypot(p-c,f-l),h=Math.max(1,Math.round(d/(n*1.7))),g="";for(let y=1;y<=h;y++){let x=c+(p-c)*y/h,u=l+(f-l)*y/h,b=d/h/2*1.08;g+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${x.toFixed(1)},${u.toFixed(1)}`}return g};return`M${i.toFixed(1)},${o.toFixed(1)}`+m(i,o,t,o)+m(t,o,t,a)+m(t,a,i,a)+m(i,a,i,o)+"Z"}function gr(s,e){let n={...e,z0:e.z1},r=a=>{let[m,c]=ae(e.x0,e.y0,a);return[ft,.5,-ft,.5,m,c]},i=(e.x1-e.x0)*Xe,o=(e.y1-e.y0)*Xe,t=jp(i,o);return s.onMatrix(r(e.z0),i,o,()=>le("path",{d:t,class:"lft cloud-side"}))+s.onMatrix(r(e.z1),i,o,()=>le("path",{d:t,class:"top cloud-top"}))}function Rp(s){let e=[ae(s.x0,s.y0,s.z1),ae(s.x1,s.y0,s.z0),ae(s.x0,s.y1,s.z0),ae(s.x1,s.y1,s.z0),ae(s.x1,s.y1,s.z1),ae(s.x0,s.y0,s.z0)],n=e.map(i=>i[0]),r=e.map(i=>i[1]);return[Math.min(...n),Math.min(...r),Math.max(...n),Math.max(...r)]}function Cp(s,e){let r=s.x1<=e.x0+1e-6,i=e.x1<=s.x0+1e-6,o=s.y1<=e.y0+1e-6,t=e.y1<=s.y0+1e-6,a=s.z1<=e.z0+1e-6,m=e.z1<=s.z0+1e-6,c=r||o||a,l=i||t||m;return c&&!l?-1:l&&!c?1:0}function qi(s){let e=s.length,n=s.map(c=>Rp(c.box)),r=c=>c.box.x0+c.box.y0+c.box.z0*.01,i=s.map(()=>[]),o=new Array(e).fill(0);for(let c=0;c<e;c++)for(let l=c+1;l<e;l++){let p=n[c],f=n[l];if(p[2]<=f[0]||f[2]<=p[0]||p[3]<=f[1]||f[3]<=p[1])continue;let d=Cp(s[c].box,s[l].box);d<0?(i[c].push(l),o[l]++):d>0&&(i[l].push(c),o[c]++)}let t=[],a=s.map((c,l)=>l).filter(c=>!o[c]),m=new Array(e).fill(!1);for(;t.length<e;){if(!a.length){let l=s.map((p,f)=>f).filter(p=>!m[p]).sort((p,f)=>r(s[p])-r(s[f]));a.push(l[0]),o[l[0]]=0}a.sort((l,p)=>r(s[l])-r(s[p])||l-p);let c=a.shift();if(!m[c]){m[c]=!0,t.push(s[c]);for(let l of i[c])!m[l]&&--o[l]===0&&a.push(l)}}return t}function rt(s){return[ae(s.x0,s.y0,s.z1),ae(s.x1,s.y0,s.z1),ae(s.x1,s.y0,s.z0),ae(s.x1,s.y1,s.z0),ae(s.x0,s.y1,s.z0),ae(s.x0,s.y1,s.z1)]}function Ht(s){let e=s.map(o=>o[0]),n=s.map(o=>o[1]),r=Math.min(...e),i=Math.min(...n);return{x:r,y:i,w:Math.max(...e)-r,h:Math.max(...n)-i}}function br(s,e){let n=s,r=(a,m)=>{let c=[];for(let l=0;l<n.length;l++){let p=n[l],f=n[(l+1)%n.length],d=a(p),h=a(f);d&&c.push(p),d!==h&&c.push(m(p,f))}n=c},i=a=>(m,c)=>[a,m[1]+(c[1]-m[1])*(a-m[0])/(c[0]-m[0])],o=a=>(m,c)=>[m[0]+(c[0]-m[0])*(a-m[1])/(c[1]-m[1]),a];if(r(a=>a[0]>=e.x,i(e.x)),!n.length||(r(a=>a[0]<=e.x+e.w,i(e.x+e.w)),!n.length)||(r(a=>a[1]>=e.y,o(e.y)),!n.length)||(r(a=>a[1]<=e.y+e.h,o(e.y+e.h)),!n.length))return 0;let t=0;for(let a=0;a<n.length;a++){let m=n[a],c=n[(a+1)%n.length];t+=m[0]*c[1]-c[0]*m[1]}return Math.abs(t)/2}function Lp(s,e){let n=Math.min(s.x+s.w,e.x+e.w)-Math.max(s.x,e.x),r=Math.min(s.y+s.h,e.y+e.h)-Math.max(s.y,e.y);return n>0&&r>0?n*r:0}var Wt=64,kr=class{cells=new Map;n=0;add(e,n,r,i,o){for(let t=Math.floor(n/Wt);t<=Math.floor(i/Wt);t++)for(let a=Math.floor(r/Wt);a<=Math.floor(o/Wt);a++){let m=t*1048576+a,c=this.cells.get(m);c||this.cells.set(m,c=[]),c[c.length-1]!==e&&c.push(e)}}query(e,n,r,i){let o=new Set;for(let t=Math.floor(e/Wt);t<=Math.floor(r/Wt);t++)for(let a=Math.floor(n/Wt);a<=Math.floor(i/Wt);a++){let m=this.cells.get(t*1048576+a);if(m)for(let c of m)o.add(c)}return[...o].sort((t,a)=>t-a)}},Fi=s=>{let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let[o,t]of s)o<e&&(e=o),o>r&&(r=o),t<n&&(n=t),t>i&&(i=t);return[e,n,r,i]},xr=new WeakMap;function ps(s,e){let n=xr.get(s);for((!n||n.n>s.length)&&xr.set(s,n=new kr);n.n<s.length;n.n++){let[r,i,o,t]=e(s[n.n]);n.add(n.n,r,i,o,t)}return n}function Do(s){let e=xr.get(s);for((!e||e.n>s.length)&&xr.set(s,e=new kr);e.n<s.length;e.n++){let n=s[e.n].pts;for(let r=0;r+1<n.length;r++){let i=n[r],o=n[r+1],t=e.n*65536+r,a=Math.max(1,Math.ceil(Math.hypot(o[0]-i[0],o[1]-i[1])/(Wt/2)));for(let m=0;m<a;m++){let c=m/a,l=(m+1)/a,p=i[0]+(o[0]-i[0])*c,f=i[1]+(o[1]-i[1])*c,d=i[0]+(o[0]-i[0])*l,h=i[1]+(o[1]-i[1])*l;e.add(t,Math.min(p,d)-1,Math.min(f,h)-1,Math.max(p,d)+1,Math.max(f,h)+1)}}}return e}var Bt=(s,e,n,r,i)=>s.query(e,n,r,i),Bs=s=>Fi(s),wr=s=>[s.x,s.y,s.x+s.w,s.y+s.h];function Bo(s,e,n,[r,i,o,t]){let a=0,m=n-1;for(let c of[0,1]){let l=e[c]-s[c],p=c?i:r,f=c?t:o;if(Math.abs(l)<1e-12){if(s[c]<p||s[c]>f)return[1,0];continue}let d=(p-s[c])/l*n-.5,h=(f-s[c])/l*n-.5;d>h&&([d,h]=[h,d]),a=Math.max(a,Math.floor(d)-1),m=Math.min(m,Math.ceil(h)+1)}return[a,m]}var gn=class s{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let n=0;for(let r of Bt(ps(this.solids,Bs),...wr(e)))n+=br(this.solids[r],e);return n}hiddenPoly(e){let n=0;for(let r of Bt(ps(this.solids,Bs),...Fi(e)))n+=Ki(e,this.solids[r]);return n}costPoly(e,n=1/0){let r=Fi(e),i=0;for(let o of Bt(ps(this.polys,t=>Bs(t.poly)),...r))i+=Ki(e,this.polys[o].poly);for(let o of Bt(ps(this.rects,t=>wr(t.r)),...r))i+=br(e,this.rects[o].r)*2;for(let o of Bt(ps(this.slants,Bs),...r))i+=Ki(e,this.slants[o])*2;if(i>=n)return i;for(let o of Bt(Do(this.lines),...r)){if(i>=n)return i;let t=this.lines[Math.floor(o/65536)].pts,a=o%65536,m=t[a],c=t[a+1],l=Math.hypot(c[0]-m[0],c[1]-m[1]),p=Math.max(1,Math.ceil(l/4)),[f,d]=Bo(m,c,p,r);for(let h=f;h<=d;h++)Dp(e,[m[0]+(c[0]-m[0])*(h+.5)/p,m[1]+(c[1]-m[1])*(h+.5)/p])&&(i+=l/p*4*.6)}return i}cost(e,n,r=.6){let i=wr(e),o=0;for(let t of Bt(ps(this.polys,a=>Bs(a.poly)),...i)){let a=this.polys[t];o+=br(a.poly,e)*(a.owner===n?1.5:1)}for(let t of Bt(ps(this.rects,a=>wr(a.r)),...i)){let a=this.rects[t];(a.owner!==n||!n)&&(o+=Lp(a.r,e)*2)}for(let t of Bt(ps(this.slants,Bs),...i))o+=br(this.slants[t],e)*2;if(r){let t=-1,a=0;for(let m of Bt(Do(this.lines),...i)){let c=Math.floor(m/65536);c!==t&&(t>=0&&(o+=a*r),t=c,a=0);let l=this.lines[c].pts,p=m%65536,f=l[p],d=l[p+1],h=Math.hypot(d[0]-f[0],d[1]-f[1]),g=Math.max(1,Math.ceil(h/4)),[y,x]=Bo(f,d,g,i);for(let u=y;u<=x;u++){let b=f[0]+(d[0]-f[0])*(u+.5)/g,k=f[1]+(d[1]-f[1])*(u+.5)/g;b>=e.x&&b<=e.x+e.w&&k>=e.y&&k<=e.y+e.h&&(a+=h/g*4)}}t>=0&&(o+=a*r)}return o}fork(){let e=new s;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}},qo=14;function Vi(s,e,n,r){let i=Math.max(s.name?ls(s.name,He.lbl):0,s.sub?ls(s.sub,He.sub):0)+4,o=(s.name?1:0)+(s.sub?1:0),t=n-(s.name?11:9)-1,a=(o-1)*qo+(s.name?11:9)+4;return{x:r==="start"?e-2:r==="end"?e-i+2:e-i/2,y:t,w:i,h:a}}function Yi(s,e,n,r,i,o){let t=Ht(n),a=ae((e.x0+e.x1)/2,(e.y0+e.y1)/2,e.z1)[0],c=((s.name?1:0)+(s.sub?1:0)-1)*qo+4,l=t.y-6-c,p=t.y+Math.min(t.h,60)*.45,f=[];o&&f.push({...o,pen:0}),f.push({x:a,y:l,anchor:"middle",pen:o?20:0});for(let g of[12,24,40])f.push({x:a,y:l-g,anchor:"middle",pen:20+g});for(let g of[-30,30,-60,60])f.push({x:a+g,y:l-4,anchor:"middle",pen:30+Math.abs(g)});f.push({x:t.x+t.w+8,y:p,anchor:"start",pen:120}),f.push({x:t.x-8,y:p,anchor:"end",pen:120}),f.push({x:a,y:t.y+t.h+14,anchor:"middle",pen:300});let d,h=1/0;for(let g of f){let y=Vi(s,g.x,g.y,g.anchor),x=r.cost(y,i,.15)*2+g.pen;x<h&&(h=x,d={x:g.x,y:g.y,anchor:g.anchor,rect:y})}return d}function _p(s,e,n,r){return{x:(r==="start"?e:r==="end"?e-s:e-s/2)-2,y:n-14,w:s+4,h:28}}function Ko(s,e,n,r,i){let o=[{...r,pen:0}];for(let l of[-46,-66,-86,-106,-126,-146])for(let p of[0,-70,70,-140,140])o.push({x:e+p,y:n+l,anchor:"middle",pen:10+(-l-46)*.5+Math.abs(p)*.4});for(let l of[34,60,86])o.push({x:e,y:n+l,anchor:"middle",pen:60+l*.3});let t=r.x-e,a=r.y-n;for(let l of[-1,1])for(let p of[16,32,48])o.push({...r,y:n+a+l*p,x:e+t,pen:5+p});for(let l of[-1,1])for(let p of[30,60,90])for(let f of[0,16,-16])o.push({...r,x:e+t+l*p,y:n+a+f,pen:8+p*.6+Math.abs(f)});let m,c=1/0;for(let l of o){let p=_p(s,l.x,l.y,l.anchor),f=i.cost(p,void 0,.05)*3+l.pen;f<c&&(c=f,m={x:l.x,y:l.y,anchor:l.anchor,rect:p})}return m}var Fo=s=>{let e=0;for(let n=0;n<s.length;n++){let r=s[n],i=s[(n+1)%s.length];e+=r[0]*i[1]-i[0]*r[1]}return e/2},Zi=s=>Fo(s)<0?[...s].reverse():s;function Dp(s,e){let n=Zi(s);for(let r=0;r<n.length;r++){let i=n[r],o=n[(r+1)%n.length];if((o[0]-i[0])*(e[1]-i[1])-(o[1]-i[1])*(e[0]-i[0])<0)return!1}return!0}function Ki(s,e){let n=Zi(s),r=Zi(e);for(let i=0;i<r.length&&n.length;i++){let o=r[i],t=r[(i+1)%r.length],a=c=>(t[0]-o[0])*(c[1]-o[1])-(t[1]-o[1])*(c[0]-o[0]),m=n;n=[];for(let c=0;c<m.length;c++){let l=m[c],p=m[(c+1)%m.length],f=a(l),d=a(p);if(f>=0&&n.push(l),f>=0!=d>=0){let h=f/(f-d);n.push([l[0]+(p[0]-l[0])*h,l[1]+(p[1]-l[1])*h])}}}return n.length>=3?Math.abs(Fo(n)):0}var Jt=.2,$r=.05,Bp=.6,Sr=.25,vr={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function bn(s){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(s);return{id:e[1],side:e[2]}}var Zo=new WeakMap;function Or(s,e,n){let r=Zo.get(s);if(!r){r=[];for(let t of s.items){if(t.type!=="region"||!ct(s.catalog,t.region.kind)?.floor)continue;let a=0;for(let m=t.parent;m;m=m.parent)a++;r.push({r:t,d:a})}Zo.set(s,r)}let i=0,o=-1;for(let{r:t,d:a}of r){let m=t.box,c=1e-6;e>=m.x0-c&&e<=m.x1+c&&n>=m.y0-c&&n<=m.y1+c&&a>o&&(o=a,i=t.floor)}return i}function qp(s,e){let n=[(s.x0+s.x1)/2,(s.y0+s.y1)/2],r=[(e.x0+e.x1)/2,(e.y0+e.y1)/2],i=r[0]-n[0],o=r[1]-n[1],t=Math.max(e.x0-s.x1,s.x0-e.x1),a=Math.max(e.y0-s.y1,s.y0-e.y1);return t>0&&(a<=0||t>=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 Vo=5e5;function Yo(s,e,n,r,i,o){let t=[],a=(b,k,w,v="error")=>{let I=r.locate(b);t.push({severity:v,message:k,line:I.line,col:I.col,path:b,hint:w})},m=s.routes??[],c={left:Vo},l=0,p=()=>n.items.map(b=>b.id),f=new Map,d=[],h=[];m.forEach((b,k)=>{let w=`${e}/routes/${k}`;(f.has(b.id)||n.byId.has(b.id))&&a(w+"/id",`duplicate id "${b.id}"`),f.set(b.id,k);let v=b.kind??"send";i.has(v)||a(w+"/kind",`unknown flow kind "${v}"`+Ui(v,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let I={id:b.id,raw:b,path:w,kind:v,points:[]},z=(B,T)=>{let{id:L}=bn(B),P=n.byId.get(L);if(!P){a(`${w}/${T}`,`unknown node "${L}"`+Ui(L,p()));return}return P};I.from=z(b.from,"from"),I.to=z(b.to,"to"),d.push(I),h.push({r:I})});let g=new Map;for(let b of h){let{r:k}=b;if(!k.from||!k.to||k.raw.points)continue;let w=bn(k.raw.from).side,v=bn(k.raw.to).side,I=k.raw.via?.[0],z=k.raw.via?.[k.raw.via.length-1],B=(A,S)=>{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 O=n.byId.get(bn(A).id);if(O)return O.box}return S.box},T=(A,S,O)=>{let M=S??qp(A.box,O);return{node:A,side:M,explicit:!!S,p:[0,0],z:0}};b.a=T(k.from,w,B(I,k.to)),b.b=T(k.to,v,B(z,k.from));let L=B(I,k.to),P=B(z,k.from);for(let[A,S]of[[b.a,L],[b.b,P]]){let O=`${A.node.id}.${A.side}`;g.has(O)||g.set(O,[]),g.get(O).push({e:A,other:[(S.x0+S.x1)/2,(S.y0+S.y1)/2]})}}for(let[,b]of g){let k=b[0].e,w=k.node.box,v=k.side,I=v==="e"||v==="w"?1:0;b.sort((A,S)=>A.other[I]-S.other[I]);let z=I?w.y0:w.x0,B=I?w.y1:w.x1,T=(z+B)/2,L=Math.max(0,B-z-.3),P=b.length>1?Math.min(Bp,L/(b.length-1)):0;b.forEach((A,S)=>{let O=(S-(b.length-1)/2)*P,M=T+O,C=A.e.node.box.z0;if(v==="top"){A.e.p=[(w.x0+w.x1)/2,(w.y0+w.y1)/2],A.e.z=w.z1;return}let[V,j]=vr[v];A.e.p=I?[V>0?w.x1+$r:w.x0-$r,M]:[M,j>0?w.y1+$r:w.y0-$r],A.e.z=C})}let y=[];for(let b of n.items)b.type==="node"&&y.push(b.box);let x=[];for(let b of n.items.filter(k=>ct(n.catalog,k.region?.kind)?.shape==="walled")){let{x0:k,y0:w,x1:v,y1:I}=b.box,z=os,B=b.region.gate,T=[[{x0:k,y0:w,x1:v,y1:w+z,z0:0,z1:0},"n"],[{x0:k,y0:I-z,x1:v,y1:I,z0:0,z1:0},"s"],[{x0:k,y0:w,x1:k+z,y1:I,z0:0,z1:0},"w"],[{x0:v-z,y0:w,x1:v,y1:I,z0:0,z1:0},"e"]];for(let[L,P]of T)if(B&&B.side===P){if(B.node)continue;let A=B.at??.5,S=B.width??2;if(P==="e"||P==="w"){let O=w+(I-w)*A;x.push({...L,y1:O-S/2},{...L,y0:O+S/2})}else{let O=k+(v-k)*A;x.push({...L,x1:O-S/2},{...L,x0:O+S/2})}}else x.push(L)}let u=new Map;for(let b of h){let{r:k,a:w,b:v}=b;if(k.raw.points){k.points=k.raw.points.map(M=>[M[0],M[1],M.length>2?M[2]:Or(n,M[0],M[1])+.01]);continue}if(!w||!v)continue;let I=[];(k.raw.via??[]).forEach((M,C)=>{if(Array.isArray(M))if(o){let V=j=>Math.round(Math.round(j/o)*o*1e9)/1e9;M.forEach((j,N)=>{Math.abs(j/o-Math.round(j/o))>1e-6&&a(`${k.path}/via/${C}/${N}`,`${j} is not on the ${o} grid; it is drawn at ${V(j)}`,void 0,"warning")}),I.push({p:[V(M[0]),V(M[1])]})}else I.push({p:[M[0],M[1]]});else{let{id:V,side:j}=bn(M),N=n.byId.get(V);if(!N){a(`${k.path}/via/${C}`,`unknown node "${V}"`+Ui(V,p()));return}let R=j&&j!=="top"?j:"n",[D,K]=vr[R],G=N.box;I.push({p:[D?D>0?G.x1+.4:G.x0-.4:(G.x0+G.x1)/2,K?K>0?G.y1+.4:G.y0-.4:(G.y0+G.y1)/2]})}});let B=y.filter(M=>M!==w.node.box&&M!==v.node.box).concat(k.raw.cross?[]:x).filter(M=>!Pr(w.node.box,M)&&!Pr(v.node.box,M)&&!Pr(M,w.node.box)&&!Pr(M,v.node.box)),T=w.side==="top"?void 0:vr[w.side],L=v.side==="top"?void 0:vr[v.side],P=[w.p,...I.map(M=>M.p),v.p],A=[w.p],S=T,O=!0;for(let M=0;M+1<P.length;M++){let C=M+2===P.length,V=Fp(P[M],P[M+1],B,u,S,C&&L?[-L[0],-L[1]]:void 0,c);if(!V){O=!1;break}A.push(...V.slice(1));let j=A.length;if(j>=2){let N=Math.sign(A[j-1][0]-A[j-2][0]),R=Math.sign(A[j-1][1]-A[j-2][1]);S=[N,R]}}!O&&c.left<=0?(l++,A=[w.p,[v.p[0],w.p[1]],v.p]):O||(a(k.path,`no path found for route "${k.id}" from "${w.node.id}" to "${v.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),A=[w.p,[v.p[0],w.p[1]],v.p]),A=Gi(A);for(let M=0;M+1<A.length;M++)Kp(u,A[M],A[M+1]);k.points=Up(n,A,w,v)}return l&&a(e,`${l} of ${d.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${Vo.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:d,diags:t}}function Pr(s,e){return e.x0>=s.x0-1e-6&&e.x1<=s.x1+1e-6&&e.y0>=s.y0-1e-6&&e.y1<=s.y1+1e-6&&e.z0>=s.z1-1e-6}var Uo=(s,e)=>`${Math.round(s/Jt)},${Math.round(e/Jt)}`;function Kp(s,e,n){let r=Math.max(1,Math.round(Math.hypot(n[0]-e[0],n[1]-e[1])/Jt));for(let i=0;i<=r;i++){let o=Uo(e[0]+(n[0]-e[0])*i/r,e[1]+(n[1]-e[1])*i/r);s.set(o,(s.get(o)??0)+1)}}function Go(s,e,n){for(let r of n)if(s>r.x0-Sr&&s<r.x1+Sr&&e>r.y0-Sr&&e<r.y1+Sr)return!0;return!1}function Fp(s,e,n,r,i,o,t={left:1/0}){if((Math.abs(s[0]-e[0])<1e-6||Math.abs(s[1]-e[1])<1e-6)&&Yp(s,e,n)){let N=[Math.sign(e[0]-s[0]),Math.sign(e[1]-s[1])],R=!i||i[0]===N[0]&&i[1]===N[1],D=!o||o[0]===N[0]&&o[1]===N[1];if(R&&D)return[s,e]}if(t.left<=0)return null;let a=N=>Math.round((N-s[0])/Jt),m=N=>Math.round((N-s[1])/Jt),c=N=>s[0]+N*Jt,l=N=>s[1]+N*Jt,p=a(e[0]),f=m(e[1]),d=30,h=Math.min(0,p)-d,g=Math.max(0,p)+d,y=Math.min(0,f)-d,x=Math.max(0,f)+d,u=1.2,b=Jt,k=.06,w=[[1,0],[-1,0],[0,1],[0,-1]],v=g-h+1,I=x-y+1,z=(N,R)=>(N-h)*I+(R-y),B=new Int8Array(v*I).fill(-1),T=new Float64Array(v*I).fill(-1),L=new Float64Array(v*I*4).fill(1/0),P=(N,R)=>{let D=z(N,R);return B[D]<0&&(B[D]=Go(c(N),l(R),n)?1:0),B[D]===1},A=(N,R)=>{let D=z(N,R);return T[D]<0&&(T[D]=r.get(Uo(c(N),l(R)))??0),T[D]},S=Zp(),O=(N,R)=>(Math.abs(N-p)+Math.abs(R-f))*b,M=i?w.findIndex(N=>N[0]===i[0]&&N[1]===i[1]):-1;S.push({i:0,j:0,d:M,g:0,f:O(0,0),idx:0,hp:0});let C=(N,R)=>Math.abs(N)+Math.abs(R)<=2,V=(N,R)=>Math.abs(N-p)+Math.abs(R-f)<=2,j=0;for(;S.length()&&j++<2e5;){if(t.left--<=0)return null;let N=S.take();if(N.i===p&&N.j===f&&!(o&&N.d>=0&&(w[N.d][0]!==o[0]||w[N.d][1]!==o[1]))){let R=[];for(let D=N;D;D=D.prev)R.push([c(D.i),l(D.j)]);return R.reverse(),R[0]=s,Vp(Gi(R),e)}for(let R=0;R<4;R++){let D=w[R];if(N.d>=0&&D[0]===-w[N.d][0]&&D[1]===-w[N.d][1])continue;let K=N.i+D[0],G=N.j+D[1];if(K<h||K>g||G<y||G>x||!C(K,G)&&!V(K,G)&&P(K,G))continue;if((C(K,G)||V(K,G))&&P(K,G)&&!(K===p&&G===f)){let pe=C(K,G)?i:o&&[-o[0],-o[1]];if(!pe||(C(K,G)?D[0]!==pe[0]||D[1]!==pe[1]:D[0]!==o[0]||D[1]!==o[1]))continue}let ne=N.d>=0&&N.d!==R?u:0,te=N.g+b+ne+A(K,G)*k,J=z(K,G)*4+R;L[J]<=te||(L[J]=te,S.push({i:K,j:G,d:R,g:te,f:te+O(K,G),prev:N,idx:0,hp:0}))}}return null}function Zp(){let s=[],e=[],n=(t,a)=>t.f<a.f||t.f===a.f&&t.idx<a.idx,r=(t,a)=>{let m=e[t];e[t]=e[a],e[a]=m,e[t].hp=t,e[a].hp=a},i=t=>{for(;t>0;){let a=t-1>>1;if(!n(e[t],e[a]))break;r(t,a),t=a}},o=t=>{for(;;){let a=2*t+1,m=a+1,c=t;if(a<e.length&&n(e[a],e[c])&&(c=a),m<e.length&&n(e[m],e[c])&&(c=m),c===t)return;r(t,c),t=c}};return{length:()=>s.length,push(t){t.idx=s.length,s.push(t),t.hp=e.length,e.push(t),i(t.hp)},take(){let t=e[0],a=e.pop();e.length&&(e[0]=a,a.hp=0,o(0));let m=s.pop();return m!==t&&(s[t.idx]=m,m.idx=t.idx,i(m.hp)),t}}}function Vp(s,e){let n=s.map(o=>[o[0],o[1]]),r=n.length,i=n[r-1];if(r>=2){let o=n[r-2];Math.abs(o[1]-i[1])<1e-9?(o[1]=e[1],r>=3&&Math.abs(n[r-3][1]-i[1])<1e-9&&(n[r-3][1]=e[1])):Math.abs(o[0]-i[0])<1e-9&&(o[0]=e[0],r>=3&&Math.abs(n[r-3][0]-i[0])<1e-9&&(n[r-3][0]=e[0]))}return n[r-1]=e,Gi(n)}function Yp(s,e,n){let r=Math.max(1,Math.round(Math.hypot(e[0]-s[0],e[1]-s[1])/(Jt/2)));for(let i=2;i<r-1;i++)if(Go(s[0]+(e[0]-s[0])*i/r,s[1]+(e[1]-s[1])*i/r,n))return!1;return!0}function Gi(s){let e=[];for(let n of s){let r=e.length;if(!(r&&Math.abs(e[r-1][0]-n[0])<1e-6&&Math.abs(e[r-1][1]-n[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]-n[0])<1e-6||Math.abs(i[1]-o[1])<1e-6&&Math.abs(o[1]-n[1])<1e-6){e[r-1]=n;continue}}e.push(n)}}return e}function Up(s,e,n,r){let i=new Set,o=new Set;for(let c of s.items)c.type!=="region"||!ct(s.catalog,c.region.kind)?.floor||(i.add(c.box.x0),i.add(c.box.x1),o.add(c.box.y0),o.add(c.box.y1));let t=[],a=(c,l)=>Or(s,c,l)+.01;for(let c=0;c+1<e.length;c++){let[l,p]=e[c],[f,d]=e[c+1],h=[0,1];if(Math.abs(p-d)<1e-6)for(let g of i){let y=(g-l)/(f-l);y>1e-6&&y<1-1e-6&&h.push(y)}else for(let g of o){let y=(g-p)/(d-p);y>1e-6&&y<1-1e-6&&h.push(y)}h.sort((g,y)=>g-y);for(let g=0;g+1<h.length;g++){let y=h[g],x=h[g+1],u=(y+x)/2,b=a(l+(f-l)*u,p+(d-p)*u),k=[l+(f-l)*y,p+(d-p)*y,b],w=[l+(f-l)*x,p+(d-p)*x,b],v=t[t.length-1];v&&(Math.abs(v[0]-k[0])>1e-6||Math.abs(v[1]-k[1])>1e-6||Math.abs(v[2]-k[2])>1e-6)?t.push(k):v||t.push(k),t.push(w)}}t.length&&(t[0][2]=n.side==="top"?n.z:n.node.box.z0+.01,t[t.length-1][2]=r.side==="top"?r.z:r.node.box.z0+.01);let m=[];for(let c of t){let l=m.length;if(l>=2){let p=m[l-2],f=m[l-1],d=Math.abs(p[2]-f[2])<1e-9&&Math.abs(f[2]-c[2])<1e-9,h=Math.abs(p[0]-f[0])<1e-6&&Math.abs(f[0]-c[0])<1e-6||Math.abs(p[1]-f[1])<1e-6&&Math.abs(f[1]-c[1])<1e-6;if(d&&h){m[l-1]=c;continue}}m.push(c)}return m}function Ui(s,e){let n=Qe(s,e);return n?` (did you mean "${n}"?)`:""}var Ar=24;function Mr(s,e){let[n,r,i,o]=e,t=s.x+s.w/2,a=s.y+s.h/2,m=[["left",t-n],["right",n+i-t],["top",a-r],["bottom",r+o-a]];m.sort((l,p)=>l[1]-p[1]);let c=m[0][0];return c==="left"?{edge:c,dx:-(s.x+s.w-n)-Ar,dy:0}:c==="right"?{edge:c,dx:n+i-s.x+Ar,dy:0}:c==="top"?{edge:c,dx:0,dy:-(s.y+s.h-r)-Ar}:{edge:c,dx:0,dy:r+o-s.y+Ar}}function Wo(s,e,n){let r=k=>{let w=0;for(let v=k.parent;v;v=v.parent)w++;return w},i=k=>k.box.x0+k.box.y0+k.box.z0*.01,o=s.items.filter(k=>k.type==="region").sort((k,w)=>r(k)-r(w)||i(k)-i(w)),t=s.items.filter(k=>k.type==="node").sort((k,w)=>i(k)-i(w)||k.box.z0-w.box.z0),a=[],m=Math.min(90,400/Math.max(1,o.length)),c=650;o.forEach((k,w)=>{let v=Ht(rt(k.box));a.push({id:k.id,kind:"region",...Mr(v,n),delay:Math.round(w*m),dur:c,bbox:v})});let l=250+Math.round(m*o.length),p=Math.min(70,700/Math.max(1,t.length)),f=600;t.forEach((k,w)=>{let v=Ht(rt(k.box));a.push({id:k.id,kind:"node",...Mr(v,n),delay:Math.round(l+w*p),dur:f,bbox:v})});let d=t.length?l+(t.length-1)*p:l,h=Math.round(d+300),g=Math.min(30,300/Math.max(1,e.length)),y=400,x=e.filter(k=>k.points.length>=2).map((k,w)=>({id:k.id,delay:Math.round(h+w*g),dur:y})),u={delay:h+200,dur:400},b=Math.max(...a.map(k=>k.delay+k.dur),...x.map(k=>k.delay+k.dur),u.delay+u.dur);return{pieces:a,routes:x,labels:u,total:b}}var Xo=(s,e)=>e.role??ct(s,e.kind)?.role,Nr=(s,e)=>ct(s,e.region.kind)?.shape,ht=(s,e,n,r="item")=>n?le("g",{[`data-${r}`]:s,"data-part":e},n):"";function zr({scene:s,layout:e,routes:n,steps:r,theme:i,id:o,gridStep:t=1}){let a=new yr,m={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},c=new gn;c.budget.spots=Jo;let l=S=>r.vis[S]?{"data-vis":"1"}:{},p=e.items.filter(S=>S.type==="region"),f=S=>{let O=0;for(let M=S.parent;M;M=M.parent)O++;return O},d=e.catalog,h=p.filter(S=>Nr(d,S)!=="walled"&&Nr(d,S)!=="tunnel"),g=qi(h.map(S=>({box:S.box,r:S}))).map(S=>S.r).sort((S,O)=>f(S)-f(O));for(let S of g)m.base+=Wp(a,d,S,l(S.id),t);for(let S of p.filter(O=>Nr(d,O)==="walled")){for(let M of Ho(S))c.solids.push(rt(M));for(let[M,C]of Ho(S).entries())m.blocks.push({box:C,svg:ht(S.id,`wall-${M+1}`,le("g",{class:`blk k-${Xo(d,S.region)} wall${S.region.ghost?" ghost":""}`,"data-id":S.id,"data-dim":"1",...l(S.id)},a.blockFaces(C)))});let O=S.region.gate;if(O&&!O.node){let M=Ti(S,O.height??(S.region.height??.8)+.3,.3,.3);c.solids.push(rt(M)),m.blocks.push({box:M,svg:ht(S.id,"gate",le("g",{class:"blk k-gate","data-id":S.id,...l(S.id)},a.blockFaces(M)))})}S.region.label&&(S.region["label-style"]??"face")!=="none"&&(m.labels+=ht(S.id,"name",a.faceText(S.box.x0+.3,S.box.y1,S.box.z0+.13,S.region.label,"slabname sm fz",He.sm,"left","start",{"data-id":S.id,...l(S.id)})))}for(let S of p.filter(O=>Nr(d,O)==="tunnel"))m.air+=ht(S.id,"block",Jp(a,S,l(S.id)));let y=e.items.filter(S=>S.type==="node");for(let S of y){let O=S.node,M=ys(d,O.asset),C=O.ghost||(O.deco??[]).includes("ghost"),V=["blk",`k-${O.role??M.role}`,M.cls,C?"ghost":""].filter(Boolean).join(" ");m.blocks.push({box:S.box,svg:ht(S.id,"block",le("g",{class:V,"data-id":S.id,"data-dim":"1",...l(S.id)},M.draw(a,S.box,O)))}),c.polys.push({poly:rt(S.box),owner:S.id}),c.solids.push(rt(S.box))}let x=qi(m.blocks).map(S=>S.svg).join(""),u=new Set,b={};for(let S of n){if(S.points.length<2)continue;let O=S.points.map(V=>ae(V[0],V[1],V[2]));O.forEach(V=>a.bounds.add(V));let M="M"+O.map(un).join(" L");b[S.id]=M;let C=S.raw.arrow!==!1;C&&u.add(S.kind),m.flows+=ht(S.id,"line",le("g",{"data-hl":S.id,"data-id":S.id,...l(S.id)},le("path",{d:M,class:`flow f-${S.kind}`,"marker-end":C?`url(#ah-${o}-${S.kind})`:void 0})),"route"),c.lines.push({pts:O,owner:S.id})}for(let S of u)a.def(`ah-${o}-${S}`,le("marker",{id:`ah-${o}-${S}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},le("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${Ds(i,i.kinds[S]?.color??"control")}`})));for(let S of a.planePolys)c.slants.push(S);let k=y.filter(S=>S.node.label||S.node.sub).sort((S,O)=>(O.box.x1-O.box.x0)*(O.box.y1-O.box.y0)-(S.box.x1-S.box.x0)*(S.box.y1-S.box.y0));for(let S of k)m.labels+=ht(S.id,"label",Hp(a,d,S,c,l(S.id)));let w=[];for(let S of n)if(S.raw.label&&S.points.length>=2){let O=Xp(a,S,c,l(S.id),e);m.floor+=ht(S.id,"label",O.svg,"route"),O.warning&&w.push({path:`${S.path}/label`,message:O.warning}),c.budget.over&&!c.budget.told&&(c.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 (${Jo.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(s.notes??[]).forEach((S,O)=>{let M=ht(`${o}-note-${O}`,"note",Qp(a,S,e,n,`${o}-note-${O}`));S.floor?m.floor+=M:m.labels+=M});let v=[],I=new Map;for(let S of r.says){let O=I.get(S.step)??c.fork();I.set(S.step,O);let M=ls(S.text,He.say)+18,C=Ko(M,S.ax,S.ay,{x:S.x,y:S.y,anchor:S.anchor},O);O.rects.push({r:C.rect,owner:""}),v.push({step:S.step,...C.rect,text:S.text});let V=C.rect.x+2;a.bounds.addRect(C.rect.x,C.rect.y,C.rect.w,C.rect.h);let j=Ds(i,i.kinds[S.kind]?.color??"control");m.marks+=le("g",{class:"say","data-step":S.step},le("rect",{x:V,y:C.y-12,width:M,height:24,rx:12,style:`stroke:${j}`})+le("text",{x:V+M/2,y:C.y+4,"text-anchor":"middle",style:`fill:${j}`},gs(S.text)))}for(let S of r.marks){let[O,M]=ae(...S.p);a.bounds.addRect(O-12,M-12,24,24),m.marks+=le("g",{class:"xm","data-step":S.step,"data-hl":S.on},le("circle",{cx:O,cy:M,r:10})+le("path",{d:`M${Le(O-4.5)},${Le(M-4.5)} L${Le(O+4.5)},${Le(M+4.5)} M${Le(O+4.5)},${Le(M-4.5)} L${Le(O-4.5)},${Le(M+4.5)}`}))}for(let S of r.badges){let[O,M]=ae(...S.p);a.bounds.addRect(O-13,M-13,26,26),m.badges+=le("g",{class:`badge c-${S.kind}`,"data-go":S.step,"data-badge":S.step,tabindex:"0",role:"button","aria-label":`Step ${S.num}`},le("circle",{cx:O,cy:M,r:11.5})+le("text",{x:O,y:M+.5},String(S.num)))}let z=a.bounds,B=22,T=z.empty?[0,0,100,100]:[Math.floor(z.x0-B),Math.floor(z.y0-B),Math.ceil(z.x1-z.x0+B*2),Math.ceil(z.y1-z.y0+B*2)],L=[...a.defs.values()].join(""),P=(S,O)=>le("g",{class:"g-"+S},O);return{svg:le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:T.join(" "),role:"img","aria-label":s.aria??s.title,"data-scene":o},le("defs",{},L)+P("base",m.base)+P("floor",m.floor)+P("flows",m.flows)+P("blocks",x)+P("air",m.air)+P("labels",m.labels)+P("marks",m.marks)+P("badges",m.badges)+P("anim","")),viewBox:T,texts:a.texts,paths:b,warnings:w,callouts:v,assembly:Wo(e,n,T)}}function Gp(s,e){let n=s.z1+.002,r=1e-6,i=[],o=(t,a)=>{let m=ae(t[0],t[1],n),c=ae(a[0],a[1],n);i.push(`M${un(m)}L${un(c)}`)};for(let t=Math.ceil((s.x0+r)/e)*e;t<s.x1-r;t+=e)o([t,s.y0],[t,s.y1]);for(let t=Math.ceil((s.y0+r)/e)*e;t<s.y1-r;t+=e)o([s.x0,t],[s.x1,t]);return i.length?le("path",{class:"grid",d:i.join("")}):""}function Wp(s,e,n,r,i=1){let o=n.region,t=n.box,a=Xo(e,o),m=ct(e,o.kind),c=m?.shape,l={"data-id":n.id,"data-dim":"1",...r},p="";c==="cloud"?p=le("g",{class:`blk k-${a} cloud`,...l},gr(s,t)):c==="zone"?p=le("g",{class:`zone k-${a}`,...l},s.poly([[t.x0,t.y0,t.z1],[t.x1,t.y0,t.z1],[t.x1,t.y1,t.z1],[t.x0,t.y1,t.z1]])):p=le("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...l},s.blockFaces(t)+Gp(t,i)),p=ht(n.id,"block",p);let f=o["label-style"]??m?.labelStyle;if(o.label&&f!=="none")if(f==="face"){let d=t.z1-t.z0,h=u=>u.size*.73/Xe,g=c==="slab"&&.28+h(He.slabname)+.08>d,y=c==="slab"&&!g,x=y?t.z0+.28:g?t.z0+Math.max(.02,(d-h(He.sm))/2):t.z0+Math.min(.1,d*.25);p+=ht(n.id,"name",le("g",l,s.faceText(t.x0+(y?.6:.3),t.y1,x,o.label,y?"slabname":"slabname sm",y?He.slabname:He.sm,"left","start")))}else if(f==="face-right")p+=ht(n.id,"name",le("g",l,s.faceText(t.x1,t.y0+.6,t.z0+Math.max(.14,(t.z1-t.z0)*.2),o.label,"slabname",He.slabname,"right","end")));else{let d=c==="cloud"?"middle":"start",h=c==="cloud"?(t.x0+t.x1)/2:t.x0+.35,g=c==="cloud"?(t.y0+t.y1)/2:t.y1-.35;p+=ht(n.id,"name",le("g",l,s.floorText(h,g,t.z1+.01,o.label,"slabname sm","x",d)))}return p}function Ho(s){let{x0:e,y0:n,x1:r,y1:i,z0:o,z1:t}=s.box,a=os,m=s.region.gate,c=[],l=f=>{f.x1-f.x0>1e-6&&f.y1-f.y0>1e-6&&c.push({...f,z0:o,z1:t})},p=(f,d,h)=>{if(!m||m.side!==h)return[[f,d]];let g=m.at??.5,y=m.width??2,x=h==="e"||h==="w"?n+(i-n)*g:e+(r-e)*g;return[[f,x-y/2],[x+y/2,d]]};for(let[f,d]of p(e,r,"n"))l({x0:f,y0:n,x1:d,y1:n+a});for(let[f,d]of p(n+a,i-a,"w"))l({x0:e,y0:f,x1:e+a,y1:d});for(let[f,d]of p(n+a,i-a,"e"))l({x0:r-a,y0:f,x1:r,y1:d});for(let[f,d]of p(e,r,"s"))l({x0:f,y0:i-a,x1:d,y1:i});return c}function Hp(s,e,n,r,i){let o=n.node,t=ys(e,o.asset),a=n.box,m={name:o.label,sub:o.sub},c=o["label-at"],l;if(c){let f=Ht(rt(a)),d=c.side??"above",h=f.y+Math.min(f.h,60)*.45;d==="right"?l={x:f.x+f.w+8,y:h,anchor:"start"}:d==="left"?l={x:f.x-8,y:h,anchor:"end"}:d==="below"?l={x:f.x+f.w/2,y:f.y+f.h+14,anchor:"middle"}:l=Yi(m,a,rt(a),new gn,n.id),l={...l,x:l.x+(c.dx??0),y:l.y+(c.dy??0)}}else{let f=t.label?t.label(a,o,!!o.sub):void 0;l=Yi(m,a,rt(a),r,n.id,f)}r.rects.push({r:Vi(m,l.x,l.y,l.anchor),owner:""});let p="";return o.label&&(p+=s.text(l.x,l.y,o.label,"lbl",He.lbl,l.anchor,{},n.id)),o.sub&&(p+=s.text(l.x,o.label?l.y+14:l.y,o.sub,"sub mono",He.sub,l.anchor,{},n.id)),le("g",{"data-id":n.id,"data-dim":"1",...i},p)}function Jp(s,e,n){let{x0:r,y0:i,x1:o,y1:t,z0:a,z1:m}=e.box,c=s.blockFaces(e.box),l=o-r>=t-i,p=Math.max(1,Math.round((l?o-r:t-i)/1.6));for(let d=1;d<p;d++){let h=l?r+(o-r)*d/p:i+(t-i)*d/p;c+=s.poly(l?[[h,i,m],[h,t,m],[h,t,a]]:[[r,h,m],[o,h,m],[o,h,a]],"rib")}let f=e.region.label;return f&&e.region["label-style"]!=="none"&&(c+=l?s.faceText(r+.35,t,a+.14,f,"tunname",He.tunname,"left","start"):s.faceText(o,t-.35,a+.18,f,"tunname",He.tunname,"right","start")),le("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...n},c)}var Jo=2e4;function Xp(s,e,n,r,i){let o=typeof e.raw.label=="string"?{text:e.raw.label}:e.raw.label,t=`floor mono t-${e.kind}`,a={"data-hl":e.id,...r},m=He.floor;if(o.at){let u=o.at.length>2?o.at[2]:e.points[0][2];return{svg:s.floorText(o.at[0],o.at[1],u,o.text,t,o.dir??"x",o.anchor??"start",a)}}let c=e.points,l=[];for(let u=0;u+1<c.length;u++){let b=c[u],k=c[u+1];Math.abs(b[2]-k[2])>1e-6||l.push({i:u,len:Math.hypot(k[0]-b[0],k[1]-b[1])})}if(!l.length)return{svg:"",warning:`label "${o.text}" of route "${e.id}" was dropped: the route has no level segment`};let p=o.along?l.filter(u=>u.i===Math.min(o.along-1,c.length-2)):[...l].sort((u,b)=>b.len-u.len),f=.22,d=11/Xe,h=u=>{let b=ls(u,m)/Xe,k,w=1/0,v=0;e:for(let I of p.length?p:l){let z=c[I.i],B=c[I.i+1],T=z[2],L=Math.abs(z[1]-B[1])<1e-6,P=L?Math.min(z[0],B[0]):Math.min(z[1],B[1]),A=L?Math.max(z[0],B[0]):Math.max(z[1],B[1]),S=L?z[1]:z[0],O=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],M=[];for(let C=P+.3;C<=Math.max(P+.3,A-b-.2)+1e-9;C+=.4)M.push(C);for(let C=A-b-.2+.4;C<A+.5&&A-P<b+.5;C+=.6)M.push(C);for(let C of O)for(let V of M){if(w<=v*.5)break e;let j=C<0?S-f:S+f+d,N,R,D;if(L?(N=V,R=j,D=[ae(N,R-d,T),ae(N+b,R-d,T),ae(N+b,R,T),ae(N,R,T)]):(N=j,R=V+b,D=[ae(N-d,R,T),ae(N-d,R-b,T),ae(N,R-b,T),ae(N,R,T)]),(L?[[N,R-d],[N+b,R-d],[N+b,R],[N,R]]:[[N-d,R],[N-d,R-b],[N,R-b],[N,R]]).some(([pe,ie])=>Math.abs(Or(i,pe,ie)+.01-T)>.001)){v++;continue}let G=n.hiddenPoly(D),ne=G*50+v*.5,te=n.budget.spots-- >0;te||(n.budget.over=!0);let J=ne>=w?1/0:te?ne+n.costPoly(D,w-ne):ne;v++,J<w&&(w=J,k={x:N,y:R,z:T,dir:L?"x":"y",rect:Ht(D),poly:D,hidden:G})}}return k&&k.hidden<6?k:void 0},g=o.text,y=h(g),x;if(!y){let u=o.text.split(/(\s+)/);for(let b=u.length-1;b>0&&!y;b--){let k=u.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(k.length<6)break;let w=h(k);w&&(y=w,g=k)}x=y?`label of route "${e.id}" shortened to "${g}": no clear floor for the whole text`:`label "${o.text}" of route "${e.id}" was dropped: blocks cover every spot beside it`,y?x+='; give it "along", "side" or "at", or move the nodes apart':x+='; give it "at: [x, y]", or move the nodes apart'}return y?(n.slants.push(y.poly),{svg:s.floorText(y.x,y.y,y.z+.01,g,t,y.dir,"start",a),warning:x}):{svg:"",warning:x}}function Qp(s,e,n,r,i){let o=e.on?r.find(l=>l.id===e.on):void 0,t=e.on&&!o?n.byId.get(e.on):void 0,a=e.at,m={"data-id":i,"data-hl":o?.id,"data-dim":o?void 0:"1"},c=e.kind??o?.kind??"control";if(e.floor){let l=a&&a.length>2?a[2]:o?o.points[0][2]:t?t.floor:.36,[p,f]=a?[a[0],a[1]]:o?[o.points[0][0]+.35,o.points[0][1]-.25]:t?[t.box.x0+.3,t.box.y1-.3]:[0,0];return s.floorText(p,f,l+.01,e.floor,`floor mono t-${c}`,e.dir??"x",e.anchor??"start",m)}if(e.face){let l=t?.box,[p,f,d]=a?[a[0],a[1],a[2]??.45]:l?[l.x0+.3,l.y1,l.z0+.13]:[0,0,0];return s.faceText(p,f,d,e.face,"slabname sm",He.sm,"left",e.anchor??"start",m)}if(e.label||e.sub){let l=t?.box,p=a?[a[0],a[1],a[2]??.36]:l?[(l.x0+l.x1)/2,(l.y0+l.y1)/2,l.z1+.75]:[0,0,0],[f,d]=ae(p[0],p[1],p[2]),h=f+(e.dx??0),g=d-18+(e.dy??0),y=e.anchor??"middle",x="";return e.label&&(x+=s.text(h,g,e.label,"lbl",He.lbl,y)),e.sub&&(x+=s.text(h,e.label?g+14:g,e.sub,"sub mono",He.sub,y)),le("g",m,x)}return""}function ec(s){return Math.max(5600,Math.min(12500,2600+s.length*40))}function Qo(s,e,n,r,i,o){let t=[],a=(T,L,P,A="error")=>{let S=i.locate(T);t.push({severity:A,message:L,line:S.line,col:S.col,path:T,hint:P})},m=s.steps??[],c=new Set(Object.keys(o.kinds)),l=new Map(r.map(T=>[T.id,T])),p=()=>[...n.byId.keys(),...l.keys()],f=new Map;m.forEach((T,L)=>{T.id&&(f.has(T.id)&&a(`${e}/steps/${L}/id`,`duplicate step id "${T.id}"`),f.set(T.id,L+1))});let d=m.length,h=(T,L)=>{if(typeof T=="number"){if(T<1||T>d){a(L,`there is no step ${T}; this scene has ${d} step(s)`);return}return T}let P=f.get(T);return P===void 0&&a(L,`unknown step "${T}"`+wt(T,f.keys())),P},g=T=>Ds(o,o.kinds[T]?.color??"control"),y=[],x=T=>{y.includes(T)||y.push(T)};for(let T of r)x(T.kind);let u={},b=(T,L,P,A)=>{if(L===void 0&&P===void 0)return;let S=L!==void 0?h(L,A+"/appears"):1,O=P!==void 0?h(P,A+"/disappears"):d+1;u[T]=Array.from({length:d},(M,C)=>C+1>=(S??1)&&C+1<(O??d+1))};for(let T of n.items)b(T.id,T.appears,T.disappears,T.path);for(let T of r)b(T.id,T.raw.appears,T.raw.disappears,T.path);let k=[],w=[],v=[],I=[],z=()=>{for(let T of r){if(T.raw.appears!==void 0||T.raw.disappears!==void 0)continue;let L=[T.from,T.to].map(P=>P&&(u[P.id]??B(P)));L.some(Boolean)&&(u[T.id]=Array.from({length:d},(P,A)=>L.every(S=>!S||S[A])))}},B=T=>{for(let L=T.parent;L;L=L.parent)if(u[L.id])return u[L.id]};return m.forEach((T,L)=>{let P=L+1,A=`${e}/steps/${L}`,S=T.kind??"control";c.has(S)||a(A+"/kind",`unknown flow kind "${S}"`+wt(S,c)),x(S);let O=new Set,M=[];(T.animate??[]).forEach((N,R)=>{let D=Array.isArray(N)?N:[N],K=[];D.forEach((G,ne)=>{let te=Array.isArray(N)?`${A}/animate/${R}/${ne}`:`${A}/animate/${R}`,J,pe;if(typeof G=="string"){let Q=/^([^:\s]+)\s*(?::\s*(\S+))?$/.exec(G.trim());J=Q?Q[1]:G,pe=Q?.[2]}else{let Q=Object.entries(G)[0];J=Q[0],pe=Q[1]}let ie=l.get(J);if(!ie){a(te,`unknown route "${J}"`+wt(J,l.keys()));return}if(pe&&!c.has(pe)){a(te,`unknown flow kind "${pe}"`+wt(pe,c));return}let q=pe??ie.kind;x(q),K.push({route:J,kind:q,color:g(q)}),O.add(J),ie.from&&O.add(ie.from.id),ie.to&&O.add(ie.to.id)}),K.length&&M.push(K)});let C=[];(T.pulse??[]).forEach((N,R)=>{let D=n.byId.get(N);if(!D){a(`${A}/pulse/${R}`,`unknown node "${N}"`+wt(N,n.byId.keys()));return}let K,G,ne,te,J=D.node?dn(n.catalog,D.node.asset):void 0;if(J?.pulse)[K,G,ne,te]=J.pulse(D.box);else{let q=D.box;K=(q.x0+q.x1)/2,G=(q.y0+q.y1)/2,ne=q.z1,te=Math.max(22,Math.min(60,(q.x1-q.x0+q.y1-q.y0)*8.5))}let[pe,ie]=ae(K,G,ne);C.push([pe,ie,te*1.7,te*.98]),O.add(N)}),(T.highlight??[]).forEach((N,R)=>{!n.byId.has(N)&&!l.has(N)&&a(`${A}/highlight/${R}`,`unknown id "${N}"`+wt(N,p())),O.add(N)});for(let[N,R]of[["show",!0],["hide",!1]])(T[N]??[]).forEach((D,K)=>{if(!n.byId.has(D)&&!l.has(D)){a(`${A}/${N}/${K}`,`unknown id "${D}"`+wt(D,p()));return}let G=u[D]??(u[D]=Array(d).fill(!R));for(let ne=L;ne<d;ne++)G[ne]=R});if((T.say??[]).forEach((N,R)=>{let D,K;if(Array.isArray(N.at))[D,K]=ae(N.at[0],N.at[1],N.at[2]??.36);else{let ne=n.byId.get(N.at);if(!ne){a(`${A}/say/${R}/at`,`unknown node "${N.at}"`+wt(N.at,n.byId.keys()));return}let te=ne.box;[D,K]=ae((te.x0+te.x1)/2,(te.y0+te.y1)/2,te.z1+.75)}let G=N.kind??S;c.has(G)||a(`${A}/say/${R}/kind`,`unknown flow kind "${G}"`+wt(G,c)),w.push({step:P,x:D+(N.dx??0),y:K+(N.dy??(Array.isArray(N.at)?0:-46)),ax:D,ay:K,text:N.text,kind:G,anchor:N.anchor??"middle"})}),(T.mark??[]).forEach((N,R)=>{if(N.at){v.push({step:P,p:[N.at[0],N.at[1],N.at[2]??.36]});return}let D=N.on?l.get(N.on):void 0;if(!D){a(`${A}/mark/${R}`,N.on?`unknown route "${N.on}"`+wt(N.on,l.keys()):'a mark needs "on: ROUTE" or "at: [x, y]"');return}let K=D.points[D.points.length-1];v.push({step:P,p:[K[0],K[1],K[2]+.6],on:D.id}),O.add(D.id)}),s.badges&&T.badge!==!1){let N=Array.isArray(T.badge)?[T.badge[0],T.badge[1],T.badge[2]??.36]:void 0,R=typeof T.badge=="string"?T.badge:M[0]?.[0]?.route,D=R?l.get(R):void 0;if(!N)if(D)N=tc(D.points);else if(R&&n.byId.get(R)){let K=n.byId.get(R).box;N=[(K.x0+K.x1)/2,(K.y0+K.y1)/2,K.z1+.3]}else typeof T.badge=="string"&&a(`${A}/badge`,`unknown id "${T.badge}"`+wt(T.badge,p()));N&&I.push({step:P,num:T.number??P,kind:S,p:N})}for(let N of[...O])for(let R=n.byId.get(N)?.parent;R;R=R.parent)O.add(R.id);for(let N of n.items)N.region?.kind==="tunnel"&&(N.region.around??[]).some(R=>O.has(R))&&O.add(N.id);let V;if(T.focus?.length){let N=1/0,R=1/0,D=-1/0,K=-1/0;T.focus.forEach((G,ne)=>{let te=n.byId.get(G);if(!te){a(`${A}/focus/${ne}`,`unknown node or region "${G}"`+wt(G,n.byId.keys()));return}let J=te.box;for(let[pe,ie,q]of[[J.x0,J.y0,J.z1],[J.x1,J.y0,J.z0],[J.x0,J.y1,J.z0],[J.x1,J.y1,J.z0],[J.x1,J.y0,J.z1],[J.x0,J.y1,J.z1]]){let[Q,ze]=ae(pe,ie,q);N=Math.min(N,Q),R=Math.min(R,ze),D=Math.max(D,Q),K=Math.max(K,ze)}O.add(G)}),N<1/0&&(V=[Math.round(N-60),Math.round(R-70),Math.round(D+60),Math.round(K+40)])}let j=T.caption??"";k.push({n:P,num:T.number??P,kind:S,color:g(S),heading:T.heading,caption:j,command:T.command??"",phases:M,pulses:C,lit:[...O],duration:T.duration===void 0||T.duration==="auto"?ec(j):T.duration,...V?{focus:V}:{}})}),z(),{steps:k,says:w,marks:v,badges:I,vis:u,diags:t,kindsUsed:y}}function tc(s){let e=s.slice(1).map((r,i)=>Math.hypot(r[0]-s[i][0],r[1]-s[i][1],r[2]-s[i][2])),n=e.reduce((r,i)=>r+i,0)/2;for(let r=0;r<e.length;r++){if(n<=e[r]&&e[r]>0){let i=n/e[r],o=s[r],t=s[r+1];return[o[0]+(t[0]-o[0])*i,o[1]+(t[1]-o[1])*i,o[2]+(t[2]-o[2])*i]}n-=e[r]}return s[0]}function wt(s,e){let n=Qe(s,e);return n?` (did you mean "${n}"?)`:""}var sc=s=>({data:s,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function el(s,e,n,r=sc(s),i,o={},t=[]){let a=_s(ur(e),s.roles,s.kinds),m=[],c=new Map;return s.scenes.forEach((l,p)=>{let f=`/scenes/${p}`;if(c.has(l.id)){let u=r.locate(f+"/id");t.push({severity:"error",message:`duplicate scene id "${l.id}"`,line:u.line,col:u.col,path:f+"/id"})}c.set(l.id,p);let d={...s.grid,...l.grid,...o.snap?{snap:o.snap}:{}},h=mr(l,f,r,a,n,s.roles,d.snap);t.push(...h.diags);let g=Yo(l,f,h,r,new Set(Object.keys(a.kinds)),d.snap);t.push(...g.diags);let y=Qo(l,f,h,g.routes,r,a);t.push(...y.diags),t.push(...nc(l,f,n,r));let x=zr({scene:l,layout:h,routes:g.routes,steps:y,theme:a,id:l.id,gridStep:d.step??d.snap??1});for(let u of x.warnings){let b=r.locate(u.path);t.push({severity:"warning",message:u.message,line:b.line,col:b.col,path:u.path})}m.push({id:l.id,raw:l,layout:h,routes:g.routes,steps:y,rendered:x,grid:d,assemble:l.assemble??s.assemble??!1})}),t.sort((l,p)=>l.line-p.line||l.col-p.col),{ok:!t.some(l=>l.severity==="error"),diags:t,doc:s,theme:a,catalog:n,scenes:m,parsed:r,source:i}}function nc(s,e,n,r){let i=[],o=(a,m)=>{let c=r.locate(a);i.push({severity:"warning",message:m,line:c.line,col:c.col,path:a})},t=(a,m)=>{a.nodes?.forEach((c,l)=>{let p=`${m}/nodes/${l}`;(c.deco??ys(n,c.asset).deco??[]).forEach((f,d)=>{typeof f=="object"&&f.icon&&!Di(f.icon)&&o(c.deco?`${p}/deco/${d}/icon`:p,`node "${c.id}": no icon "${f.icon}" is registered here, so it is drawn as a placeholder`)}),c.face!==void 0&&!yn(c.face)&&o(`${p}/face`,`node "${c.id}": no screen face "${c.face}" is registered here, so it is drawn as a placeholder`)}),a.regions?.forEach((c,l)=>t(c,`${m}/regions/${l}`))};return t(s,e),i}var nl=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"]),rc=new Set("cursor pointer-events transition animation transform-box transform-origin user-select".split(" "));function ic(s,e){let n={classes:[],not:[],attrs:[],child:e},r=s,i=t=>{let a=t.exec(r);return a&&(r=r.slice(a[0].length)),a},o=i(/^[a-zA-Z][\w-]*/);for(o?n.tag=o[0]:i(/^\*/);r;){let t;if(t=i(/^\.([\w-]+)/))n.classes.push(t[1]);else if(t=i(/^:not\(\.([\w-]+)\)/))n.not.push(t[1]);else if(t=i(/^\[([\w-]+)(?:="([^"]*)")?\]/))n.attrs.push([t[1],t[2]]);else throw new Error(`resolve: a selector it doesn't know: ${s}`)}return n}function ac(s){let e=s.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 n=[];for(let r of e.matchAll(/([^{}]+)\{([^{}]*)\}/g)){let i=r[2].split(";").map(o=>o.trim()).filter(Boolean).map(o=>{let t=o.indexOf(":"),a=o.slice(0,t).trim(),m=o.slice(t+1).trim();return[a,m.replace(/\s*!important$/,""),/!important$/.test(m)]});for(let o of i)if(!o[0].startsWith("--")&&!nl.has(o[0])&&!rc.has(o[0]))throw new Error(`resolve: a property it doesn't know: ${o[0]}`);for(let o of r[1].split(",").map(t=>t.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(c=>ic(c.replace(/^>/,""),c.startsWith(">"))),m=a.reduce((c,l)=>c+10*(l.classes.length+l.not.length+l.attrs.length)+(l.tag?1:0),0);n.push({parts:a,spec:m,order:n.length,decls:i})}}return n}function oc(s){let e={name:"#root",attrs:[],children:[]},n=e;for(let r of s.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g)){if(r[4]!==void 0){n.children.push(r[4]);continue}if(r[1]===void 0){n=n.parent;continue}let i={name:r[1],attrs:[...r[2].matchAll(/([\w:-]+)="([^"]*)"/g)].map(o=>[o[1],o[2]]),children:[],parent:n};n.children.push(i),r[3]||(n=i)}return e.children[0]}var rl=s=>typeof s=="string"?s:`<${s.name}${s.attrs.map(([e,n])=>` ${e}="${n}"`).join("")}${s.children.length||s.name==="g"?`>${s.children.map(rl).join("")}</${s.name}>`:"/>"}`,wn=(s,e)=>s.attrs.find(n=>n[0]===e)?.[1],qs=(s,e,n)=>{let r=s.attrs.find(i=>i[0]===e);r?r[1]=n:s.attrs.push([e,n])},lc=s=>(wn(s,"class")??"").split(/\s+/).filter(Boolean);function pc(s,e){if(e.tag&&e.tag!==s.name)return!1;let n=lc(s);return e.classes.every(r=>n.includes(r))&&!e.not.some(r=>n.includes(r))&&e.attrs.every(([r,i])=>{let o=wn(s,r);return o!==void 0&&(i===void 0||o===i)})}function Wi(s,e,n=e.length-1){if(!pc(s,e[n]))return!1;if(n===0)return!0;let r=s.parent;if(e[n].child)return!!r&&r.name!=="#root"&&Wi(r,e,n-1);for(;r&&r.name!=="#root";r=r.parent)if(Wi(r,e,n-1))return!0;return!1}var cs=s=>s.endsWith("%")?parseFloat(s)/100:parseFloat(s);function cc(s,e,n,r){let i=(1-Math.abs(2*n-1))*e,o=(s%360+360)%360/60,t=i*(1-Math.abs(o%2-1)),a=n-i/2,[m,c,l]=o<1?[i,t,0]:o<2?[t,i,0]:o<3?[0,i,t]:o<4?[0,t,i]:o<5?[t,0,i]:[i,0,t];return[(m+a)*255,(c+a)*255,(l+a)*255,r]}function il(s,e){let n=[],r=0,i="";for(let o of s)o==="("&&r++,o===")"&&r--,o===e&&r===0?(n.push(i.trim()),i=""):i+=o;return[...n,i.trim()].filter(Boolean)}var tl={transparent:[0,0,0,0],black:[0,0,0,1],white:[255,255,255,1]};function Tr(s){let e=s.trim();if(Object.hasOwn(tl,e))return tl[e];let n=/^#([0-9a-f]{3,8})$/i.exec(e);if(n){let r=n[1].length<6?[...n[1]].map(i=>i+i).join(""):n[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(n=/^hsla?\((.*)\)$/.exec(e),n){let[r,i]=n[1].split("/").map(c=>c.trim()),[o,t,a,m]=r.split(/[\s,]+/);return cc(parseFloat(o),cs(t),cs(a),i!==void 0?cs(i):m!==void 0?cs(m):1)}if(n=/^rgba?\((.*)\)$/.exec(e),n){let[r,i,o,t]=n[1].split(/[\s,/]+/).filter(Boolean);return[cs(r),cs(i),cs(o),t===void 0?1:cs(t)]}if(n=/^color-mix\(in srgb\s*,(.*)\)$/.exec(e),n){let[r,i]=il(n[1],",").map(l=>{let p=/^(.*?)\s+([\d.]+)%$/.exec(l);return p?{c:Tr(p[1]),p:Number(p[2])/100}:{c:Tr(l),p:void 0}});if(!r?.c||!i?.c)return;let o=r.p??(i.p===void 0?.5:1-i.p),t=i.p??1-o,a=o+t,m=(r.c[3]*o+i.c[3]*t)/a,c=l=>m===0?0:(r.c[l]*r.c[3]*o+i.c[l]*i.c[3]*t)/a/m;return[c(0),c(1),c(2),m*Math.min(1,a)]}}var sl=s=>"#"+[s[0],s[1],s[2]].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join(""),fc=s=>String(Math.round(s*1e4)/1e4);function Hi(s,e,n=0){if(n>20)throw new Error(`resolve: a custom property in a loop: ${s}`);let r=s.indexOf("var(");if(r<0)return s;let i=0,o=r+3;do s[o]==="("&&i++,s[o]===")"&&i--,o++;while(i>0&&o<s.length);let[t,...a]=il(s.slice(r+4,o-1),","),m=e.get(t)??(a.length?a.join(","):void 0);if(m===void 0)throw new Error(`resolve: no value for ${t}`);return Hi(s.slice(0,r)+m+s.slice(o),e,n+1)}var dc=s=>new Map(s.split(";").filter(Boolean).map(e=>{let n=e.indexOf(":");return[e.slice(0,n).trim(),e.slice(n+1).trim()]})),Ji={sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"};function Er(s,e){let n=Mo(e.theme),r=e.fonts??Ji,i=ac(`.mono{font-family:${r.mono.replace(/"/g,"")}}
134
+ ${n.rest}
135
+ ${e.css}`),o=oc(s);qs(o,"font-family",r.sans.replace(/"/g,""));let t=(a,m)=>{let c=m,l=new Map,p=(h,g,y)=>{let x=l.get(h);(!x||y[0]>x.rank[0]||y[0]===x.rank[0]&&(y[1]>x.rank[1]||y[1]===x.rank[1]&&y[2]>=x.rank[2]))&&l.set(h,{v:g,rank:y})};for(let h of i)if(Wi(a,h.parts))for(let[g,y,x]of h.decls)p(g,y,[x?1:0,h.spec,h.order]);let f=wn(a,"style");if(f){for(let h of f.split(";").map(g=>g.trim()).filter(Boolean)){let g=h.indexOf(":");p(h.slice(0,g).trim(),h.slice(g+1).trim(),[0,1e6,0])}a.attrs=a.attrs.filter(h=>h[0]!=="style")}for(let[h,g]of l)h.startsWith("--")&&(c===m&&(c=new Map(m)),c.set(h,g.v));let d={};for(let[h,g]of l){if(!nl.has(h))continue;let y=Hi(g.v,c).trim();if(h==="fill"||h==="stroke"||h==="stop-color"){if(y==="none"||y==="currentColor"||y==="inherit"||y.startsWith("url(")){qs(a,h,y);continue}let x=Tr(y);if(!x)throw new Error(`resolve: a colour it doesn't know: ${y}`);qs(a,h,sl(x)),x[3]!==1&&(d[h==="stop-color"?"stop":h]=x[3])}else qs(a,h,h==="letter-spacing"||h==="font-size"||h==="stroke-width"?y:y.replace(/"/g,""))}for(let[h,g]of Object.entries(d))qs(a,`${h}-opacity`,fc(g*Number(wn(a,`${h}-opacity`)??1)));wn(a,"opacity")==="0"&&(qs(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 g=Hi(h[1],c),y=Tr(g);h[1]=y?sl(y):g}for(let h of a.children)typeof h!="string"&&t(h,c)};return t(o,dc(e.mode==="dark"?`${n.light};${n.dark}`:n.light)),rl(o)}var ol=s=>{if(s&&typeof s=="object"){Object.freeze(s);for(let e of Object.values(s))ol(e)}return s},Ir=[86,81,76],mc=["send","reply","token","blocked","user","event","control","planned"],dt=ol({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:mc,thresholds:Ir,darkWidthAdd:.4}),uc=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,hc=/^hsl\(\s*([+-]?(?:\d+\.?\d*|\.\d+))\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s*\)$/i;function yc(s){if(typeof s!="string")throw new Error(`mono: invalid colour "${String(s)}"`);let e=s.trim(),n=uc.exec(e);if(n){let i=n[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=hc.exec(e);if(r){let i=Number(r[1]),o=Number(r[2]),t=Number(r[3]);if(!Number.isFinite(i)||o<0||o>100||t<0||t>100)throw new Error(`mono: invalid colour "${s}"`);let a=(i%360+360)%360,m=o/100,c=t/100,l=m*Math.min(c,1-c),p=f=>{let d=(f+a/30)%12;return c-l*Math.max(-1,Math.min(d-3,9-d,1))};return[p(0),p(8),p(4)]}throw new Error(`mono: invalid colour "${s}"`)}function Xi(s){let[e,n,r]=yc(s),i=o=>o<=.04045?o/12.92:((o+.055)/1.055)**2.4;return .2126*i(e)+.7152*i(n)+.0722*i(r)}function Qi(s){let e=Xi(s);return e>216/24389?116*Math.cbrt(e)-16:24389/27*e}function ea(s,e){let n=Xi(s),r=Xi(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var gc=new Set(dt.patterns),bc=new Map(dt.kindOrder.map((s,e)=>[s,e])),wc=(s,e)=>s<e?-1:s>e?1:0,al=s=>[...new Set(s)].sort(wc),kc=s=>Math.round(s*100)/100;function xc(s){return s>=Ir[0]?0:s>=Ir[1]?1:s>=Ir[2]?2:3}function $c(s){if(s.roles)for(let[e,n]of Object.entries(s.roles)){if(n.step!==void 0&&(typeof n.step!="number"||!Number.isInteger(n.step)||n.step<0||n.step>3))throw new Error(`mono: invalid step "${String(n.step)}" for role "${e}"`);if(n.pattern!==void 0&&(typeof n.pattern!="string"||!gc.has(n.pattern)))throw new Error(`mono: invalid pattern "${String(n.pattern)}" for role "${e}"`)}if(s.kinds)for(let[e,n]of Object.entries(s.kinds)){if(n.dash!==void 0&&(!Array.isArray(n.dash)||!n.dash.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)))throw new Error(`mono: invalid dash "${String(n.dash)}" for kind "${e}"`);if(n.width!==void 0&&(typeof n.width!="number"||!Number.isFinite(n.width)||n.width<=0))throw new Error(`mono: invalid width "${String(n.width)}" for kind "${e}"`)}}function ll(s,e,n,r){if(e!=="light"&&e!=="dark")throw new Error(`mono: invalid mode "${String(e)}"`);r&&$c(r);let i=dt[e],o=[],t=s.light["l-top"],a=al(n?.roles??Object.keys(s.roles)),m=new Map,c=[[],[],[],[]];for(let y of a){let x=r?.roles?.[y]?.step,u;if(x!==void 0)u=x;else{let b=s.roles[y];if(!b)throw new Error(`mono: unknown role "${y}"`);if(typeof t!="string")throw new Error('mono: theme.light is missing "l-top"');u=xc(Qi(`hsl(${b.h} ${b.s}% ${t})`))}m.set(y,u),c[u].push(y)}let l=new Map;for(let y=0;y<c.length;y++){let x=c[y];for(let u=0;u<x.length;u++){let b=x[u],k=r?.roles?.[b]?.pattern;if(k!==void 0)l.set(b,k);else{let w=u%dt.patterns.length,v=dt.patterns[w];if(l.set(b,v),u>=dt.patterns.length){let I=x.slice(0,u).find(z=>l.get(z)===v);I!==void 0&&o.push(`role "${b}" wraps on step ${y} to pattern "${v}", matching "${I}"`)}}}}let p={};for(let y of a){let x=m.get(y),u=l.get(y),b=i.steps[x];p[y]={step:x,pattern:u,top:b.top,left:b.left,right:b.right,edge:b.edge}}let f=al(n?.kinds??Object.keys(s.kinds)),d=e==="dark"?dt.darkWidthAdd:0,h={},g=0;for(let y of f){let x=r?.kinds?.[y],u=bc.get(y),b;if(u!==void 0)b=u;else if(b=dt.kindOrder.length+g,g++,b>=dt.rhythms.length){let I=b%dt.rhythms.length;(!x||x.dash===void 0||x.width===void 0)&&o.push(`kind "${y}" exceeds the ${dt.rhythms.length} line rhythms; reusing rhythm ${I}`),b=I}let k=dt.rhythms[b],w=x?.dash!==void 0?[...x.dash]:[...k.dash],v=x?.width!==void 0?x.width:kc(k.width+d);h[y]={dash:w,width:v}}return{mode:e,paper:i.paper,ink:i.ink,roles:p,kinds:h,warnings:o}}var jr=s=>`${Math.round(parseInt(s.slice(1,3),16)/255*1e4)/100}%`,ta=(s,e,n)=>{let[r,i]=[s,e].map(t=>parseInt(t.slice(1,3),16)),o=Math.round(r+(i-r)*n).toString(16).padStart(2,"0");return`#${o}${o}${o}`};function Sc(s,e,n){let r=new Set([...s.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(n)].filter(i=>i in e.kinds)}}function vc(s,e){let n=dt[e.mode].steps,r=(c,l)=>e.roles[c]??n[l],i={};for(let[c,l]of Object.entries(s.light))i[c]=/%$/.test(l)?l:e.ink;let o=r("slab",0),t=r("pad",0);Object.assign(i,{bg:e.paper,surface:e.paper,on:e.paper,ink:e.ink,muted:ta(e.paper,e.ink,.72),line:ta(e.paper,e.ink,.3),"code-bg":ta(e.paper,e.ink,.06),"slab-top":o.top,"slab-l":o.left,"slab-r":o.right,"pad-top":t.top});let a=Object.fromEntries(Object.entries(s.roles).map(([c])=>[c,{h:0,s:0}])),m=Object.fromEntries(Object.entries(s.kinds).map(([c,l])=>[c,{...l,color:e.ink}]));return _s({...s,light:i,dark:i,roles:a,kinds:m})}function Pc(s){let e="";for(let[n,r]of Object.entries(s.roles))e+=`.k-${n}{--s:0%;--l-top:${jr(r.top)};--l-left:${jr(r.left)};--l-right:${jr(r.right)};--l-edge:${jr(r.edge)}}
136
+ `;for(let[n,r]of Object.entries(s.kinds))e+=`.flow.f-${n}{stroke-width:${r.width}${r.dash.length?`;stroke-dasharray:${r.dash.join(" ")}`:";stroke-dasharray:none"}}
137
+ `;return e}var Oc={hatch:{size:6,draw:(s,e)=>`<path d="M0,6L6,0M-1.5,1.5L1.5,-1.5M4.5,7.5L7.5,4.5" stroke="${s}" stroke-width="${e}" fill="none"/>`},"hatch-wide":{size:12,draw:(s,e)=>`<path d="M0,0L12,12M-3,9L3,15M9,-3L15,3" stroke="${s}" stroke-width="${e}" fill="none"/>`},dots:{size:8,draw:(s,e)=>`<circle cx="2" cy="2" r="${e+.2}" fill="${s}"/><circle cx="6" cy="6" r="${e+.2}" fill="${s}"/>`}},Ac=s=>Math.round(s*100)/100,Mc=(s,e)=>ea(s,e.ink)>=ea(s,e.paper)?e.ink:e.paper;function pl(s,e,n){let r=new Map,i=(m,c)=>{let l=`${n}-mono-${m}-${c.slice(1)}`,p=Oc[m],f=e.mode==="dark"?1.2:.9;return r.has(l)||r.set(l,`<pattern id="${l}" width="${p.size}" height="${p.size}" patternUnits="userSpaceOnUse">${p.draw(c,Ac(f))}</pattern>`),l},o=[],t="",a="";for(let m of s.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|[^<]+/g)){if(t+=m[0],m[0].startsWith("</")){o.pop();continue}if(m[1]===void 0)continue;let c=(/\sclass="([^"]*)"/.exec(m[2])?.[1]??"").split(/\s+/);o.length===1&&(a=c.find(g=>g.startsWith("g-"))??"");let l=c.find(g=>g.startsWith("k-"))?.slice(2)??o.at(-1);if(m[3]||o.push(c.includes("ghost")?"":l),!m[3]||m[1]!=="polygon"&&m[1]!=="path"||!l||!c.some(g=>g==="top"||g==="lft"||g==="rgt")||a==="g-base"&&!c.includes("rgt"))continue;let p=Object.hasOwn(e.roles,l)?e.roles[l].pattern:"none",f=/\sfill="(#[0-9a-f]{6})"/.exec(m[2])?.[1],d=/\s(points|d)="[^"]*"/.exec(m[2])?.[0];if(p==="none"||!f||!d)continue;let h=/\sfill-opacity="[^"]*"/.exec(m[2])?.[0]??"";t+=`<${m[1]}${d} class="mono-pattern" fill="url(#${i(p,Mc(f,e))})" stroke="none"${h}/>`}return t=t.replace(/#([0-9a-f]{6})\b/g,(m,c)=>c.slice(0,2)===c.slice(2,4)&&c.slice(2,4)===c.slice(4,6)?m:Nc(m)),r.size&&(t=t.replace(/<defs\/>|<defs>/,m=>m==="<defs/>"?`<defs>${[...r.values()].join("")}</defs>`:m+[...r.values()].join(""))),t}function Nc(s){let e=Qi(s),n=e>8?((e+16)/116)**3:e/(24389/27),r=n<=.0031308?n*12.92:1.055*n**(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 cl(s,e,n,r,i){let o=ll(e,n,Sc(s,e,r),i);return{look:o,theme:vc(e,o),css:Pc(o)}}var fl=29.09090909090909,zc={solid:[9,7],dashed:[7,6],dotted:[3,6]},Tc=["blocked","planned"];function dl(s,e={}){return(e.still??Tc).includes(s)?void 0:e.dash??e.kinds?.[s]?.ants??zc[e.kinds?.[s]?.dash??"solid"]}function Rr(s){let e=s?.ants;return e?e===!0?{}:Array.isArray(e)?{ids:e}:e:void 0}var gl=["edge","drop","rise","fly","pop","scatter","build","fade"],bl=["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],wl=["by-depth","by-layer","by-region","by-flow","as-listed","random"];var kt=s=>Math.round(s*100)/100||0,it=s=>Math.round(s*1e4)/1e4||0;function aa(s){let e=i=>{let o=0;for(let t=i.parent;t;t=t.parent)o++;return o},n=i=>{let o=[];for(let t=i;t;t=t.parent){let a=(t.region??t.node)?.motion;a&&o.unshift(a)}return o.length?Object.assign({},...o):void 0},r=new Set(s.layout.items.filter(i=>i.region&&s.layout.catalog&&s.rendered.svg.includes(`class="tunnel" data-id="${i.id}"`)).map(i=>i.id));return{viewBox:s.rendered.viewBox,pieces:s.layout.items.map(i=>{let o=i.box,t=ae((o.x0+o.x1)/2,(o.y0+o.y1)/2,o.z0),a=n(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:kt(o.x0+o.y0+o.z0*.01),bbox:Ht(rt(o)),foot:[kt(t[0]),kt(t[1])],base:[ae(o.x0,o.y1,o.z0),ae(o.x1,o.y1,o.z0),ae(o.x1,o.y0,o.z0)].map(m=>[kt(m[0]),kt(m[1])]),...a?{motion:a}:{}}}),routes:s.routes.filter(i=>s.rendered.paths[i.id]).map(i=>({id:i.id,path:s.rendered.paths[i.id],...Ec(i.raw)})),notes:Object.fromEntries((s.raw.notes??[]).map((i,o)=>[`${s.id}-note-${o}`,i.on])),intro:s.rendered.assembly}}var ml=s=>typeof s=="string"?s.split(".")[0]:void 0,Ec=s=>{let e=ml(s.from),n=ml(s.to);return{...e?{from:e}:{},...n?{to:n}:{}}},Cr=(s,e,n,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(m,c,l)=>3*m*l*(1-l)**2+3*c*l*l*(1-l)+l**3,t=0,a=1;for(let m=0;m<40;m++){let c=(t+a)/2;o(s,n,c)<i?t=c:a=c}return o(e,r,(t+a)/2)},sa={linear:s=>s,ease:Cr(.42,0,.58,1),"ease-in":Cr(.42,0,1,1),"ease-out":Cr(0,0,.58,1),settle:Cr(.16,.84,.3,1),spring:s=>s<=0?0:s>=1?1:1-Math.exp(-6*s)*Math.cos(9.5*s)*(1-s),bounce:s=>{if(s<=0)return 0;if(s>=1)return 1;let e=7.5625,n=2.75;return s<1/n?e*s*s:s<2/n?e*(s-1.5/n)**2+.75:s<2.5/n?e*(s-2.25/n)**2+.9375:e*(s-2.625/n)**2+.984375}};function ia(s){let e=s>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}var ul=s=>{let e=2166136261;for(let n=0;n<s.length;n++)e^=s.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0},Nt=s=>Math.max(0,Math.min(1,s)),Lr=24;function na(s,e,n){let[r,i,o,t]=e;return n==="left"?[-(s.x+s.w-r)-Lr,0]:n==="right"?[r+o-s.x+Lr,0]:n==="top"?[0,-(s.y+s.h-i)-Lr]:[0,i+t-s.y+Lr]}function Ic(s,e,n={}){let r=s.pieces,i=new Map(r.map(g=>[g.id,g])),o=(g,y)=>g.depth-y.depth||g.key-y.key;if(e==="as-listed")return[...r];if(e==="random"){let g=ia(n.seed??1);return r.map(y=>[g(),y]).sort((y,x)=>y[0]-x[0]).map(y=>y[1])}if(e==="by-layer")return[...r].sort((g,y)=>g.layer-y.layer||o(g,y));if(e==="by-depth")return[...r].sort((g,y)=>g.key-y.key||g.depth-y.depth);let t=new Map;for(let g of[...r].sort(o)){let y=t.get(g.parent)??[];y.push(g),t.set(g.parent,y)}let a=[],m=new Set,c=g=>{if(m.has(g.id))return;let y=g.parent?i.get(g.parent):void 0;y&&c(y),m.add(g.id),a.push(g)};if(e==="by-region"){let g=y=>{for(let x of t.get(y)??[])c(x),g(x.id)};return g(),a}let l=new Map,p=new Set;for(let g of s.routes)g.from&&g.to&&(l.set(g.from,[...l.get(g.from)??[],g.to]),p.add(g.to));let f=n.source??s.routes.find(g=>g.from&&!p.has(g.from))?.from??s.routes[0]?.from,d=f?[f]:[],h=new Set(d);for(;d.length;){let g=d.shift(),y=i.get(g);y&&c(y);for(let x of l.get(g)??[])h.has(x)||(h.add(x),d.push(x))}for(let g of[...r].sort(o))c(g);return a}var jc={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"},Rc={"lift-off":"lift",sink:"rise",scatter:"scatter","fly-out":"edge",fade:"fade",explode:"explode",collapse:"collapse"};function kl(s,e,n={}){let r=n.seed??1,i=e==="disassemble",o=i&&n.style==="reverse",t=j=>{if(!i)return j.motion?.style??n.style??"edge";let N=j.motion?.out??n.style??"fly-out";return N==="reverse"?j.motion?.style??n.of??"edge":Rc[N]},a=j=>i?j.motion?.out??n.style??"fly-out":t(j),m=!i&&!n.order&&n.stagger===void 0&&n.piece===void 0&&n.overlap===void 0&&(n.style??"edge")==="edge",c=n.order??(n.style==="build"?"by-layer":"by-depth"),l=[],p,f,d=(j,N,R)=>{let D=t(j),K=j.motion?.easing??n.easing??jc[i&&a(j)!=="reverse"?a(j):D]??"ease";return{p:j,delay:N+(j.motion?.delay??0),dur:Math.max(1,j.motion?.duration??R),style:D,curve:sa[K],from:j.motion?.from??n.from??"left"}};if(m){let j=new Map(s.pieces.map(N=>[N.id,N]));for(let N of s.intro.pieces){let R=j.get(N.id);R&&l.push(d(R,N.delay,N.dur))}p=s.intro.routes.map(N=>({...N})),f={...s.intro.labels}}else{let j=Ic(s,c,{seed:r,source:n.source}),N=n.piece??600,R=n.stagger??Math.min(70,900/Math.max(1,j.length)),D=Nt(n.overlap??.5),K=o||i?[...j].reverse():j,G=Math.min(30,300/Math.max(1,s.routes.length)),ne=400,te=400;if(i){f={delay:0,dur:te};let J=te*(1-D);p=[...s.routes].reverse().map((q,Q)=>({id:q.id,delay:J+Q*G,dur:ne}));let pe=Math.max(J,...p.map(q=>q.delay+q.dur)),ie=Math.max(0,pe-D*ne);K.forEach((q,Q)=>l.push(d(q,ie+Q*R,N)))}else{K.forEach((q,Q)=>l.push(d(q,Q*R,N)));let J=Math.max(0,...l.map(q=>q.delay+q.dur)),pe=Math.max(0,J-D*N);p=s.routes.map((q,Q)=>({id:q.id,delay:pe+Q*G,dur:ne}));let ie=Math.max(pe,...p.map(q=>q.delay+q.dur));f={delay:Math.max(0,ie-D*te),dur:te}}}let h=n.pulses&&s.routes.length?700:0;if(h&&i)for(let j of[...l,...p,f])j.delay+=h;let g=Math.max(1,...l.map(j=>j.delay+j.dur),...p.map(j=>j.delay+j.dur),f.delay+f.dur),y=i?0:g;h&&!i&&(g+=h);let x=n.duration!==void 0?Math.max(1,n.duration)/g:1;for(let j of[...l,...p,f])j.delay=kt(j.delay*x),j.dur=Math.max(.01,kt(j.dur*x));let u=n.duration!==void 0?Math.max(1,n.duration):Math.max(1,kt(g)),b=new Map(l.map(j=>[j.p.id,j])),k=new Map(p.map(j=>[j.id,j])),[w,v,I,z]=s.viewBox,B=[w+I/2,v+z/2],T=j=>[j.x+j.w/2,j.y+j.h/2],L=(j,N)=>{let R=n.point;if(Array.isArray(R))return R;if(R==="region"||N==="collapse"&&R===void 0&&j.parent){let D=s.pieces.find(K=>K.id===j.parent);return D?D.foot:B}if(typeof R=="string"){let D=s.pieces.find(K=>K.id===R);if(D)return D.foot}return B};function P(j,N,R){let{p:D}=j,K=D.bbox,G=1-N,ne=(te,J)=>({dx:kt(te*G),dy:kt(J*G)});switch(j.style){case"drop":return ne(...na(K,s.viewBox,"top"));case"lift":return ne(...na(K,s.viewBox,"top"));case"fly":return ne(...na(K,s.viewBox,j.from));case"rise":{let te=K.h*G,[J,pe,ie]=D.base,q=K.y-K.h-4;return{...ne(0,K.h),clip:[[J[0],J[1]-te],[pe[0],pe[1]-te],[ie[0],ie[1]-te],[ie[0]+2,q-te],[J[0]-2,q-te]].map(Q=>[kt(Q[0]),kt(Q[1])])}}case"pop":return{scale:it(Math.max(0,N)),about:D.foot,opacity:it(Nt(R*4))};case"scatter":{let te=ia((r^ul(D.id))>>>0),J=te()*Math.PI*2,pe=.35+te()*.65;return{...ne(Math.cos(J)*I*pe*.6,Math.sin(J)*z*pe*.6),opacity:it(Nt(N*1.6))}}case"build":return{...ne(0,-18),opacity:it(Nt(N))};case"fade":return{opacity:it(Nt(N))};case"explode":{let te=L(D,"explode"),J=T(K),pe=J[0]-te[0],ie=J[1]-te[1],q=Math.hypot(pe,ie),Q=ia((r^ul(D.id))>>>0),ze=Q()*Math.PI*2,Ee=q>1?[pe/q,ie/q]:[Math.cos(ze),Math.sin(ze)],Ze=Math.hypot(I,z)+Math.max(K.w,K.h);return ne(Ee[0]*Ze,Ee[1]*Ze)}case"collapse":{let te=L(D,"collapse");return{...ne(te[0]-D.foot[0],te[1]-D.foot[1]),scale:it(Math.max(0,N)),about:D.foot,opacity:it(Nt(N*3))}}default:{let te=Mr(K,s.viewBox);return ne(te.dx,te.dy)}}}let A=(j,N,R)=>{let D=Nt((j-N)/R);return i?1-D:D},S={opacity:0},O=n.connectors??"draw",M=n.labels??"fade",C=[...s.pieces.map(j=>j.id),...s.routes.map(j=>j.id),...Object.keys(s.notes)];function V(j){let N=Math.max(0,Math.min(u,Number.isFinite(j)?j:0));if(i?N<=0:N>=u)return{};let R=i?N>=u:N<=0,D={},K={},G={};for(let ie of l){let q=R?0:A(N,ie.delay,ie.dur);q<=0?D[ie.p.id]=S:q<1&&(D[ie.p.id]=P(ie,i?1-ie.curve(1-q):ie.curve(q),q))}for(let ie of s.routes){let q=k.get(ie.id),Q=R||!q?0:A(N,q.delay,q.dur);Q<=0?K[ie.id]={opacity:0,drawn:0}:Q<1&&(K[ie.id]=O==="fade"?{opacity:it(Q)}:O==="grow"?{drawn:it(Q),by:"grow"}:{drawn:it(sa["ease-out"](Q))})}let ne=R?0:A(N,f.delay,f.dur),te=ne<=0?S:ne>=1?void 0:M==="type"?{typed:it(ne)}:{opacity:it(ne)};for(let ie of C){let q=te;if(M==="with-piece"){let Q=Object.hasOwn(s.notes,ie)?s.notes[ie]:ie,ze=Q===void 0?void 0:b.get(Q)??k.get(Q);if(ze){let Ee=R?0:A(N,ze.delay,ze.dur);q=Ee<=0?S:Ee>=1?void 0:{opacity:it(Ee)}}}q&&(G[ie]=q)}let J=[];if(h&&!R){let ie=(N-y*x)/(h*x);if(ie>0&&ie<1)for(let q of s.routes)J.push({route:q.id,at:it(sa.ease(ie))})}let pe=ie=>Object.keys(ie).length>0;return{...pe(D)?{items:D}:{},...pe(G)?{labels:G}:{},...pe(K)?{routes:K}:{},...ne<1?{marks:{opacity:it(Math.max(0,ne))}}:{},...J.length?{tokens:J}:{}}}return{kind:e,duration:u,pieces:l.map(j=>({id:j.p.id,delay:j.delay,dur:j.dur,style:a(j.p)})),routes:p,labels:f,at:V}}var je=s=>{let e=s.toFixed(2);return e==="-0.00"?"0":String(Number(e))},Cc=(s,e)=>`translate(${je(s[0])} ${je(s[1])}) scale(${Number(e.toFixed(4))}) translate(${je(-s[0])} ${je(-s[1])})`,oa=s=>[...s.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map(e=>[Number(e[1]),Number(e[2])]),la=s=>s.slice(1).reduce((e,n,r)=>e+Math.hypot(n[0]-s[r][0],n[1]-s[r][1]),0);function xl(s,e){let n=oa(s),r=la(n)*e;for(let i=0;i+1<n.length;i++){let o=Math.hypot(n[i+1][0]-n[i][0],n[i+1][1]-n[i][1]);if(r<=o&&o>0){let t=r/o;return[n[i][0]+(n[i+1][0]-n[i][0])*t,n[i][1]+(n[i+1][1]-n[i][1])*t]}r-=o}return n[n.length-1]??[0,0]}function Lc(s,e){let n=oa(s),r=xl(s,e),i=[],o=la(n)*e;for(let t=0;t<n.length;t++){i.push(n[t]);let a=t+1<n.length?Math.hypot(n[t+1][0]-n[t][0],n[t+1][1]-n[t][1]):1/0;if(o<=a)break;o-=a}return"M"+[...i,r].map(t=>`${je(t[0])},${je(t[1])}`).join(" L")}var ws=s=>String(Number(s.toFixed(4)));function _c(s){let e=[];return(s.dx||s.dy)&&e.push(`translate(${je(s.dx??0)} ${je(s.dy??0)})`),s.scale!==void 0&&s.scale!==1&&e.push(Cc(s.about??[0,0],s.scale)),{attrs:{...s.opacity===void 0||s.opacity===1?{}:{opacity:ws(s.opacity)},...e.length?{transform:e.join(" ")}:{}},clip:s.clip}}function Dc(s,e){let n={attrs:s.opacity===void 0||s.opacity===1?{}:{opacity:ws(s.opacity)}};if(s.drawn!==void 0&&s.drawn<1&&e!==void 0){let r=Nt(s.drawn),i=la(oa(e));n.path=s.by==="grow"?{d:Lc(e,r),head:!1}:{style:`stroke-dasharray:${je(i)} ${je(i)};stroke-dashoffset:${je(i*(1-r))}`,head:!1}}else s.ants&&(n.path={style:`stroke-dasharray:${je(s.ants.dash[0])} ${je(s.ants.dash[1])};stroke-dashoffset:${je(-s.ants.offset)}`,head:!0});return n}function Bc(s,e,n,r,i){if(r==="label"||r==="note"){let t=s.labels&&Object.hasOwn(s.labels,n)?s.labels[n]:void 0;return t&&{attrs:{...t.opacity===void 0||t.opacity===1?{}:{opacity:ws(t.opacity)},...t.dx||t.dy?{transform:`translate(${je(t.dx??0)} ${je(t.dy??0)})`}:{}},...t.typed===void 0||t.typed>=1?{}:{typed:t.typed}}}if(e==="route"){let t=s.routes&&Object.hasOwn(s.routes,n)?s.routes[n]:void 0;return t&&Dc(t,i(n))}let o=s.items&&Object.hasOwn(s.items,n)?s.items[n]:void 0;return o&&_c(o)}function qc(s,e,n){let r=[];for(let i of s.outlines??[])r.push(["polygon",{points:i.points.map(o=>o.map(je).join(",")).join(" "),class:"ring",fill:"none","stroke-width":"2.5","stroke-linejoin":"round",...i.opacity===void 0?{}:{opacity:ws(i.opacity)},...n?{stroke:i.color??n.control}:{style:`stroke:${i.color??"var(--ring,var(--control,currentColor))"}`}}]);for(let i of s.pulses??[])r.push(["ellipse",{cx:je(i.x),cy:je(i.y),rx:je(i.rx),ry:je(i.ry),class:"ring",fill:"none","stroke-width":"2.5",...i.opacity===void 0?{}:{opacity:ws(i.opacity)},...n?{stroke:i.color??n.control}:{style:`stroke:${i.color??"currentColor"}`}}]);for(let i of s.tokens??[]){let o=e(i.route);if(o===void 0)continue;let[t,a]=xl(o,Nt(i.at));r.push(["circle",{cx:je(t),cy:je(a),r:"7",class:"tok",...n?{fill:i.color??(i.kind!==void 0?n.kinds?.[i.kind]:void 0)??n.control,stroke:n.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 Kc=s=>Object.keys(s).every(e=>e==="morph"||s[e]===void 0),Fc=new Set(["marks","badges"]);function hl(s){let e=new Map,n=[];for(let r of s.matchAll(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>/g)){if(r[1]){let t=n.pop();t?.key!==void 0&&e.set(t.key,[t.from,r.index]);continue}if(r[4])continue;let i=/\sdata-item="([^"]*)"/.exec(r[3])?.[1],o=/\sdata-part="([^"]*)"/.exec(r[3])?.[1];n.push({...n.length===2&&i!==void 0&&o!==void 0?{key:`${Yc(i)}
138
+ ${o}`}:{},from:r.index+r[0].length})}return e}var yl=new WeakMap;function Zc(s,e){let n=yl.get(s)??new Map;yl.set(s,n);let r=n.get(e);if(!r){n.set(e,r=new Map);let i=s.variants?.[e],o=hl(s.svg);if(i!==void 0)for(let[t,[a,m]]of hl(i)){let c=o.get(t);c&&s.looks?.[t.split(`
139
+ `)[0]]?.includes(e)&&s.svg.slice(...c)!==i.slice(a,m)&&r.set(t,i.slice(a,m))}}return r}function Vc(s,e,n,r){let i=[];for(let o of s.looks?.[e]??[]){let t=Nt(r[o]??0),a=t>0?Zc(s,o).get(`${e}
140
+ ${n}`):void 0;a!==void 0&&i.push([a,t])}return i.length?{own:Nt(1-i.reduce((o,[,t])=>o+t,0)),looks:i}:void 0}var Yc=s=>s.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&"),ra=new WeakMap;function $l(s,e,n,r={}){let i=ra.get(s);if(i){for(let[u,b]of i.mixed)u.replaceChildren(...b);for(let[u,b]of i.attrs)for(let[k,w]of b)w===null?u.removeAttribute(k):u.setAttribute(k,w);for(let[u,b,k]of i.gone.reverse())b.insertBefore(u,k);for(let[u,b]of i.texts)u.data=b;for(let u of i.made)u.remove();ra.delete(s)}if(Kc(e))return;let o={attrs:new Map,texts:new Map,gone:[],made:[],mixed:[]};ra.set(s,o);let t=(u,b,k)=>{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),k===null?u.removeAttribute(b):u.setAttribute(b,k)},a=s.ownerDocument,m=(u,b,k)=>{let w=a.createElementNS("http://www.w3.org/2000/svg",u);for(let[v,I]of Object.entries(b))w.setAttribute(v,I);return k.append(w),o.made.push(w),w},c=Array.from(s.children),l=u=>c.find(b=>b.getAttribute("class")===`g-${u}`),p=new Map;for(let u of Array.from(l("flows")?.children??[])){let b=u.getAttribute("data-route"),k=u.querySelector("path.flow")?.getAttribute("d");b!==null&&k&&p.set(b,k)}let f=u=>p.get(u);e.camera&&t(s,"viewBox",e.camera.map(je).join(" "));for(let u of Fc){let b=l(u);b&&e.marks&&e.marks.opacity!==1&&t(b,"opacity",ws(e.marks.opacity))}let d=0,h=c.find(u=>u.localName==="defs"),g=h?.firstChild??null,y=s.getAttribute("data-scene")??"scene";for(let u of c)for(let b of Array.from(u.children)){let k=b.getAttribute("data-part");if(k===null)continue;let w=b.getAttribute("data-route"),v=w===null?b.getAttribute("data-item")??"":"",I=n&&e.variants&&Object.hasOwn(e.variants,v)?Vc(n,v,k,e.variants[v]):void 0;if(I){let T=Array.from(b.childNodes),L=(A,S)=>{let O=a.createElementNS("http://www.w3.org/2000/svg","g");return O.setAttribute("opacity",ws(A)),O.append(...S),O},P=A=>Array.from(a.importNode(new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${A}</svg>`,"image/svg+xml").documentElement,!0).childNodes);o.mixed.push([b,T]),b.replaceChildren(...I.own>0?[L(I.own,T)]:[],...I.looks.map(([A,S])=>L(S,P(A))))}let z=Bc(e,w===null?"item":"route",w??b.getAttribute("data-item")??"",k,f);if(!z)continue;for(let[T,L]of Object.entries(z.attrs))t(b,T,L);if(z.clip&&h){let T=m("clipPath",{id:`${y}-mc${d++}`},h);h.insertBefore(T,g);let L=a.createElementNS("http://www.w3.org/2000/svg","polygon");L.setAttribute("points",z.clip.map(P=>P.join(",")).join(" ")),T.append(L),t(b,"clip-path",`url(#${T.id})`)}if(z.typed!==void 0){let T=[];for(let L=a.createTreeWalker(b,4);L.nextNode();)T.push(L.currentNode);for(let L of T)o.texts.set(L,L.data),L.data=Array.from(L.data).slice(0,Math.round(Array.from(L.data).length*z.typed)).join(""),L.data||(o.gone.push([L,L.parentNode,L.nextSibling]),L.remove())}let B=z.path&&b.querySelector("path.flow");B&&z.path&&(z.path.d!==void 0&&t(B,"d",z.path.d),z.path.style!==void 0&&(r.styles==="cssom"?(t(B,"style",null),B.style.cssText=z.path.style):t(B,"style",z.path.style)),z.path.head||t(B,"marker-end",null))}let x=l("anim");if(x)for(let[u,b]of qc(e,f,n?.inks))m(u,b,x)}function Sl(s,e){if(!e)return s;let[n,r,i,o]=e,t=s[2]/s[3],a=i-n,m=o-r;a/m<t?a=m*t:m=a/t,a=Math.min(a,s[2]),m=Math.min(m,s[3]);let c=(n+i)/2,l=(r+o)/2,p=Math.max(s[0],Math.min(s[0]+s[2]-a,c-a/2)),f=Math.max(s[1],Math.min(s[1]+s[3]-m,l-m/2));return[p,f,a,m]}var Uc=["linear","ease","ease-in","ease-out","ease-in-out","settle","bounce"],vl=["extend","clamp","wrap","identity"];function Tt(s,e){if(typeof s=="number")return Number.isFinite(s)?s:void 0;if(typeof s!="string")return;let n=/^(-?\d+(?:\.\d+)?)(ms|s|f)?$/.exec(s.trim());if(!n)return;let r=Number(n[1]);return n[2]==="s"?r*1e3:n[2]==="f"?e?r/e*1e3:void 0:r}function ca(s,e){let n=e===!0?{}:e,r=n.base??2600,i=n.perChar??40,o=n.min??5600,t=n.max??12500;return Math.max(o,Math.min(t,r+(s?.text??"").length*i))}var Ks=(s,e,n,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(m,c,l)=>3*m*l*(1-l)**2+3*c*l*l*(1-l)+l**3,t=0,a=1;for(let m=0;m<50;m++){let c=(t+a)/2;o(s,n,c)<i?t=c:a=c}return o(e,r,(t+a)/2)},Gc=s=>{if(s<=0)return 0;if(s>=1)return 1;let e=7.5625,n=2.75;return s<1/n?e*s*s:s<2/n?e*(s-1.5/n)**2+.75:s<2.5/n?e*(s-2.25/n)**2+.9375:e*(s-2.625/n)**2+.984375},Wc={linear:s=>s,ease:Ks(.25,.1,.25,1),"ease-in":Ks(.42,0,1,1),"ease-out":Ks(0,0,.58,1),"ease-in-out":Ks(.42,0,.58,1),settle:Ks(.16,.84,.3,1),bounce:Gc};function _r(s,e={}){let n=e.mass??1,r=e.stiffness??100,i=e.damping??10,o=Math.max(0,s)/1e3,t=Math.sqrt(r/n),a=i/(2*Math.sqrt(r*n)),m;if(a<1){let c=t*Math.sqrt(1-a*a);m=1-Math.exp(-a*t*o)*(Math.cos(c*o)+a*t/c*Math.sin(c*o))}else m=1-Math.exp(-t*o)*(1+t*o);return e.overshootClamping?Math.min(1,m):m}function Xt(s,e,n="ease-in-out"){let r=s??n;return typeof r=="string"?Wc[r]:"bezier"in r?Ks(...r.bezier):i=>i<=0?0:i>=1?1:_r(i*e,r.spring)}function Dr(s,e,n){let r=s.times.map(p=>Tt(p,n)),i=s.values,o=r.length;if(o===1)return i[0];let t=(p,f)=>{if(p==="clamp")return f?i[0]:i[o-1];if(p==="identity")return e;if(p==="wrap"){let d=r[o-1]-r[0];return Dr({...s,extrapolateLeft:"clamp",extrapolateRight:"clamp"},r[0]+((e-r[0])%d+d)%d,n)}};if(e<r[0]){let p=t(s.extrapolateLeft??"extend",!0);if(p!==void 0)return p}if(e>r[o-1]){let p=t(s.extrapolateRight??"extend",!1);if(p!==void 0)return p}let a=0;for(;a<o-2&&e>=r[a+1];)a++;let m=r[a+1]-r[a],c=(e-r[a])/m,l=c<0||c>1?c:Xt(s.easing,m,"linear")(c);return i[a]+(i[a+1]-i[a])*l}var pa=["sequence","series","layers","assemble","disassemble","travel","pulse","ants","draw","type","move","lift","focus","highlight","camera"],Pl={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"},zt=["from","duration","easing"],kn={sequence:[],series:[],layers:[],assemble:zt,disassemble:zt,travel:[...zt,"each","hold","loop"],pulse:[...zt,"loop"],ants:[...zt,"speed","dash"],draw:[...zt,"by","stagger"],type:zt,move:["from","x","y","scale","opacity"],lift:[...zt,"by","stagger","to","opacity"],focus:[...zt,"fade"],highlight:[...zt,"fade"],camera:zt},Hc=["name","from","offset","duration","loop","playbackRate","trimBefore","say","show","hide","focus","highlight","levels","variants","enter","ants","children","layers","series"],_e=s=>!!s&&typeof s=="object"&&!Array.isArray(s);function Ol(s){let e=[],n=(u,b,k)=>{e.push({severity:"error",path:u,message:b,...k?{hint:k}:{}})},r=(u,b,k)=>{for(let w of Object.keys(u))if(!b.includes(w)){let v=Qe(w,b);n(`${k}/${w}`,`unknown key "${w}"`,v?`did you mean "${v}"?`:void 0)}};if(!_e(s))return n("","a motion document is a map"),e;r(s,["isomotion","fps","seed","ambient","series","layers","markers"],""),s.isomotion!==1&&n("/isomotion","isomotion is 1");let i=typeof s.fps=="number"&&s.fps>0?s.fps:void 0;s.fps!==void 0&&i===void 0&&n("/fps","fps is a number over 0"),s.seed!==void 0&&!Number.isInteger(s.seed)&&n("/seed","seed is a whole number"),s.ambient!==void 0&&s.ambient!=="on"&&s.ambient!=="off"&&n("/ambient",'ambient is "on" or "off"');let o=(u,b,k={})=>{if(u===void 0)return;if(typeof u=="string"&&/f$/.test(u)&&i===void 0){n(b,`"${u}" is in frames: the document needs its fps`);return}let w=Tt(u,i);w===void 0?n(b,`${JSON.stringify(u)} isn't a time (ms, "1.2s", "450ms", "30f")`):w<0&&!k.negative&&n(b,"a time can't be negative")},t=(u,b,k)=>{if(u!==void 0&&!b.includes(u)){let w=typeof u=="string"?Qe(u,b):void 0;n(k,`${JSON.stringify(u)} isn't one of ${b.join(", ")}`,w?`did you mean "${w}"?`:void 0)}},a=(u,b,k={})=>{u!==void 0&&(typeof u!="number"||!Number.isFinite(u)||k.min!==void 0&&u<k.min||k.max!==void 0&&u>k.max||k.over!==void 0&&u<=k.over)&&n(b,`${JSON.stringify(u)} isn't a number${k.over!==void 0?` over ${k.over}`:k.min!==void 0?` from ${k.min}${k.max!==void 0?` to ${k.max}`:""}`:""}`)},m=(u,b)=>{if(u!==void 0){if(!Array.isArray(u)){n(b,"a list of ids");return}u.forEach((k,w)=>{typeof k!="string"&&n(`${b}/${w}`,"an id")})}},c=(u,b,k=[])=>{if(!_e(u)){n(b,"a spring is a map");return}r(u,["mass","damping","stiffness","overshootClamping",...k],b);for(let w of["mass","damping","stiffness"])a(u[w],`${b}/${w}`,{over:0});u.overshootClamping!==void 0&&typeof u.overshootClamping!="boolean"&&n(`${b}/overshootClamping`,"true or false")},l=(u,b)=>{if(u!==void 0){if(typeof u=="string"){t(u,Uc,b);return}if(_e(u)&&"bezier"in u){r(u,["bezier"],b),(!Array.isArray(u.bezier)||u.bezier.length!==4||u.bezier.some(k=>typeof k!="number"))&&n(`${b}/bezier`,"four numbers");return}if(_e(u)&&"spring"in u){r(u,["spring"],b),c(u.spring,`${b}/spring`);return}n(b,"an easing is a name, { bezier: [a, b, c, d] } or { spring: { \u2026 } }")}},p=(u,b)=>{if(u===void 0)return;if(!_e(u)){n(b,"a curve is { times, values }");return}r(u,["times","values","easing","extrapolateLeft","extrapolateRight"],b);let k=u.times,w=u.values;if(!Array.isArray(k)||!k.length)n(`${b}/times`,"a list of times");else{k.forEach((I,z)=>o(I,`${b}/times/${z}`,{negative:!0}));let v=k.map(I=>Tt(I,i));for(let I=1;I<v.length;I++)v[I]!==void 0&&v[I-1]!==void 0&&v[I]<=v[I-1]&&n(`${b}/times/${I}`,"times go up")}!Array.isArray(w)||w.some(v=>typeof v!="number")?n(`${b}/values`,"a list of numbers"):Array.isArray(k)&&w.length!==k.length&&n(`${b}/values`,`${w.length} values for ${k.length} times`),l(u.easing,`${b}/easing`),t(u.extrapolateLeft,vl,`${b}/extrapolateLeft`),t(u.extrapolateRight,vl,`${b}/extrapolateRight`)},f=(u,b)=>{if(u!==void 0){if(!_e(u)){n(b,"focus is { lit: [ids] }");return}r(u,["lit","scope","level","always"],b),u.lit===void 0&&n(`${b}/lit`,"what is lit"),m(u.lit,`${b}/lit`),m(u.always,`${b}/always`),t(u.scope,["all","links"],`${b}/scope`),a(u.level,`${b}/level`,{min:0,max:1})}},d=(u,b)=>{u!==void 0&&typeof u!="string"&&n(b,"text")},h=new Map;function g(u,b,k){if(!_e(u)){n(b,"a sequence is a map");return}if(r(u,Hc,b),u.name!==void 0&&(typeof u.name!="string"||!/^[A-Za-z][\w-]*$/.test(u.name)?n(`${b}/name`,"a name is letters, digits, - and _, from a letter"):h.has(u.name)?n(`${b}/name`,`"${u.name}" is already a name (${h.get(u.name)})`):h.set(u.name,b)),k&&u.from!==void 0&&n(`${b}/from`,"in a series a sequence follows the one before","offset moves it"),!k&&u.offset!==void 0&&n(`${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`),_e(u.duration)){r(u.duration,["read"],`${b}/duration`);let w=u.duration.read;if(w!==!0&&!_e(w))n(`${b}/duration/read`,"true, or { base, perChar, min, max }");else if(_e(w)){r(w,["base","perChar","min","max"],`${b}/duration/read`);for(let v of["base","perChar","min","max"])a(w[v],`${b}/duration/read/${v}`,{min:0})}}else o(u.duration,`${b}/duration`);if(u.loop!==void 0&&typeof u.loop!="boolean"&&!(Number.isInteger(u.loop)&&u.loop>=1)&&n(`${b}/loop`,"true, false, or how many times"),a(u.playbackRate,`${b}/playbackRate`,{over:0}),u.say!==void 0)if(!_e(u.say))n(`${b}/say`,"say is a map");else{let w=u.say;r(w,["chapter","title","text","code","facts","color"],`${b}/say`);for(let v of["chapter","title","text","code","color"])d(w[v],`${b}/say/${v}`);w.facts!==void 0&&(!Array.isArray(w.facts)||w.facts.some(v=>!Array.isArray(v)||v.length!==2||v.some(I=>typeof I!="string")))&&n(`${b}/say/facts`,"a list of [name, value]")}for(let w of["show","hide","highlight"])m(u[w],`${b}/${w}`);if(f(u.focus,`${b}/focus`),u.levels!==void 0)if(!_e(u.levels))n(`${b}/levels`,"levels is a map: an id, and how much of it");else for(let[w,v]of Object.entries(u.levels))a(v,`${b}/levels/${w}`,{min:0,max:1});if(u.variants!==void 0)if(!_e(u.variants))n(`${b}/variants`,"variants is a map: an id, and the name of its look");else for(let[w,v]of Object.entries(u.variants))typeof v!="string"&&n(`${b}/variants/${w}`,`a look's name, or "" for its own`);u.enter!==void 0&&(_e(u.enter)?(r(u.enter,["fade","easing"],`${b}/enter`),u.enter.fade===void 0&&n(`${b}/enter/fade`,"how long the fade is"),o(u.enter.fade,`${b}/enter/fade`),l(u.enter.easing,`${b}/enter/easing`)):n(`${b}/enter`,"enter is { fade }")),u.ants!==void 0&&typeof u.ants!="boolean"&&m(u.ants,`${b}/ants`);for(let w of["children","layers"])u[w]!==void 0&&x(u[w],`${b}/${w}`);u.series!==void 0&&y(u.series,`${b}/series`)}function y(u,b){if(!Array.isArray(u)){n(b,"a series is a list");return}u.forEach((k,w)=>{let v=`${b}/${w}`;if(!_e(k)||Object.keys(k).length!==1||!("sequence"in k||"transition"in k)){n(v,"a series holds sequences and transitions");return}if("sequence"in k){g(k.sequence,`${v}/sequence`,!0);return}let I=k.transition,z=`${v}/transition`,B=T=>_e(u[T])&&"sequence"in u[T];if((!B(w-1)||!B(w+1))&&n(z,"a transition is between two sequences"),!_e(I)){n(z,"a transition is { presentation, timing }");return}r(I,["presentation","timing"],z),I.presentation===void 0?n(`${z}/presentation`,"a presentation"):t(I.presentation,["fade","none"],`${z}/presentation`),_e(I.timing)?"linear"in I.timing?(r(I.timing,["linear"],`${z}/timing`),o(I.timing.linear,`${z}/timing/linear`)):"spring"in I.timing?(r(I.timing,["spring"],`${z}/timing`),c(I.timing.spring,`${z}/timing/spring`,["duration"]),_e(I.timing.spring)&&o(I.timing.spring.duration,`${z}/timing/spring/duration`)):n(`${z}/timing`,"a timing is { linear } or { spring }"):n(`${z}/timing`,"a timing is { linear } or { spring }")})}function x(u,b){if(!Array.isArray(u)){n(b,"a list");return}u.forEach((k,w)=>{let v=`${b}/${w}`;if(!_e(k)){n(v,"a map");return}let I=pa.filter(L=>L in k);if(I.length!==1){let L=Object.keys(k).find(S=>S in Pl),P=Object.keys(k)[0],A=P?Qe(P,pa):void 0;n(v,L?`${L}: ${Pl[L]}`:I.length?`one of ${I.join(", ")}, not several`:`one of ${pa.join(", ")}`,!L&&!I.length&&A?`did you mean "${A}"?`:void 0);return}let z=I[0],B=k[z],T=`${v}/${z}`;r(k,[z,...kn[z]],v),kn[z].includes("from")&&o(k.from,`${v}/from`),kn[z].includes("duration")&&(o(k.duration,`${v}/duration`),l(k.easing,`${v}/easing`));for(let L of["each","hold","stagger","fade"])kn[z].includes(L)&&o(k[L],`${v}/${L}`);if(kn[z].includes("loop")&&k.loop!==void 0&&typeof k.loop!="boolean"&&n(`${v}/loop`,"true or false"),z==="sequence")g(B,T,!1);else if(z==="series")y(B,T);else if(z==="layers")x(B,T);else if(z==="assemble"||z==="disassemble")_e(B)?(t(B.style,z==="assemble"?gl:bl,`${T}/style`),t(B.order,wl,`${T}/order`),B.duration!==void 0&&n(`${T}/duration`,"its length is beside it","duration is the node's")):n(T,`${z} is a map (its options)`);else if(z==="travel")!Array.isArray(B)||!B.length?n(T,"a list of connectors"):B.forEach((L,P)=>{Array.isArray(L)?m(L,`${T}/${P}`):typeof L!="string"&&n(`${T}/${P}`,"a connector, or a list of them at once")});else if(z==="ants")B!==!0&&m(B,T),a(k.speed,`${v}/speed`),k.dash!==void 0&&(!Array.isArray(k.dash)||k.dash.length!==2||k.dash.some(L=>typeof L!="number"||L<=0))&&n(`${v}/dash`,"two numbers over 0: on, off");else if(z==="move"){typeof B!="string"&&n(T,"an id");for(let L of["x","y","scale","opacity"])p(k[L],`${v}/${L}`)}else if(z==="focus")f(B,T);else if(z==="camera"){if(B!=="fit")if(!_e(B))n(T,'"fit", or { focus, zoom, margin }');else{r(B,["focus","zoom","margin"],T),a(B.zoom,`${T}/zoom`,{over:0}),a(B.margin,`${T}/margin`);let L=B.focus;typeof L=="string"||Array.isArray(L)&&(L.every(P=>typeof P=="string")||L.length===4&&L.every(P=>typeof P=="number"))||n(`${T}/focus`,"an id, some ids, or a box [x, y, w, h]")}}else m(B,T);z==="draw"&&t(k.by,["stroke","grow"],`${v}/by`),z==="lift"&&(k.by===void 0&&n(`${v}/by`,"how far apart"),a(k.by,`${v}/by`),t(k.to,["up","down"],`${v}/to`),p(k.opacity,`${v}/opacity`))})}if(s.series!==void 0&&y(s.series,"/series"),s.layers!==void 0&&x(s.layers,"/layers"),s.markers!==void 0)if(!_e(s.markers))n("/markers","markers is a map");else for(let[u,b]of Object.entries(s.markers))if(typeof b=="string"&&/^[A-Za-z][\w-]*([+-].+)?$/.test(b)){let k=/^([A-Za-z][\w-]*?)(?:([+-])(\d.*))?$/.exec(b);if(k&&(h.has(k[1])?k[1]:void 0))k[3]!==void 0&&o(k[3],`/markers/${u}`);else if(!h.has(b)){let I=Qe(k?.[1]??b,h.keys());n(`/markers/${u}`,`no sequence is named "${k?.[1]??b}"`,I?`did you mean "${I}"?`:void 0)}}else o(b,`/markers/${u}`);return e}var yt=s=>Math.round(s*100)/100||0,et=s=>Math.round(s*1e4)/1e4||0,xt=s=>Math.max(0,Math.min(1,s)),Fs=(s,e,n)=>s+(e-s)*n,Jc=250,fa=class{items=new Map;labels=new Map;routes=new Map;tokens=[];pulses=[];outlines=[];variants={};marks=1;at(e,n){let r=e.get(n);return r||e.set(n,r={}),r}item(e,n){let r=this.at(this.items,e);n.opacity!==void 0&&(r.opacity=(r.opacity??1)*n.opacity),n.dx&&(r.dx=(r.dx??0)+n.dx),n.dy&&(r.dy=(r.dy??0)+n.dy),n.scale!==void 0&&(r.scale=(r.scale??1)*n.scale,r.about=n.about??r.about),n.clip&&(r.clip=n.clip)}label(e,n){let r=this.at(this.labels,e);n.opacity!==void 0&&(r.opacity=(r.opacity??1)*n.opacity),n.dx&&(r.dx=(r.dx??0)+n.dx),n.dy&&(r.dy=(r.dy??0)+n.dy),n.typed!==void 0&&(r.typed=Math.min(r.typed??1,n.typed))}route(e,n){let r=this.at(this.routes,e);n.opacity!==void 0&&(r.opacity=(r.opacity??1)*n.opacity),n.drawn!==void 0&&n.drawn<(r.drawn??1)&&(r.drawn=n.drawn,r.by=n.by),n.ants&&(r.ants=n.ants)}add(e){for(let[n,r]of Object.entries(e.items??{}))this.item(n,r);for(let[n,r]of Object.entries(e.labels??{}))this.label(n,r);for(let[n,r]of Object.entries(e.routes??{}))this.route(n,r);e.marks&&(this.marks*=e.marks.opacity),this.tokens.push(...e.tokens??[]),this.pulses.push(...e.pulses??[])}state(e){let n={},r=(l,p)=>{let f={};for(let[d,h]of l){let g=p(h);Object.keys(g).length&&(f[d]=g)}return f},i=l=>Object.keys(l).length>0,o=l=>l===void 0||et(l)>=1?{}:{opacity:et(Math.max(0,l))},t=l=>({...yt(l.dx??0)?{dx:yt(l.dx)}:{},...yt(l.dy??0)?{dy:yt(l.dy)}:{}}),a=r(this.items,l=>({...o(l.opacity),...t(l),...l.scale!==void 0&&et(l.scale)!==1?{scale:et(l.scale),...l.about?{about:l.about}:{}}:{},...l.clip?{clip:l.clip}:{}})),m=r(this.labels,l=>({...o(l.opacity),...l.typed!==void 0&&l.typed<1?{typed:et(l.typed)}:{},...t(l)})),c=r(this.routes,l=>{let p=l.opacity!==void 0&&et(l.opacity)<=0,f=l.drawn!==void 0&&l.drawn<1;return{...o(l.opacity),...f?{drawn:et(l.drawn),...l.by?{by:l.by}:{}}:{},...l.ants&&!p&&!f?{ants:l.ants}:{}}});return i(a)&&(n.items=a),i(m)&&(n.labels=m),i(c)&&(n.routes=c),et(this.marks)<1&&(n.marks={opacity:et(this.marks)}),this.tokens.length&&(n.tokens=this.tokens),this.pulses.length&&(n.pulses=this.pulses),this.outlines.length&&(n.outlines=this.outlines),i(this.variants)&&(n.variants=this.variants),e&&(n.camera=e),n}};function Xc(s){let e=Rr(s.raw),n=s.rendered.looks,r=aa(s),i=Object.keys(r.notes).filter(o=>r.notes[o]===void 0);return{model:r,kinds:Object.fromEntries(s.routes.map(o=>[o.id,o.kind])),outlines:Object.fromEntries(s.layout.items.map(o=>[o.id,rt(o.box).map(t=>[yt(t[0]),yt(t[1])])])),...n&&Object.keys(n).length?{looks:n}:{},...e?{ants:e}:{},...i.length?{free:i}:{}}}function Br(s,e,n={}){let r="model"in s?s:Xc(s),i=r.free?{...r.model,notes:{...r.model.notes,...Object.fromEntries(r.free.map($=>[$,void 0]))}}:r.model,o=Ol(e),t=e.fps,a=r.ants,m=()=>({ok:!1,diags:o,duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}});if(o.length)return m();let c=($,E,_)=>{o.push({severity:"error",path:$,message:E,..._?{hint:_}:{}})},l=($,E)=>$===void 0?E:Tt($,t),p=new Map(i.pieces.map($=>[$.id,$])),f=new Set(i.routes.map($=>$.id)),d=new Set(Object.keys(i.notes)),h=new Map(Object.entries(r.kinds)),g=[...p.keys(),...f,...d],y=new Set(g),x=new Map;for(let[$,E]of Object.entries(i.notes))E!==void 0&&x.set(E,[...x.get(E)??[],$]);let u={any:y,thing:new Set(p.keys()),route:f},b={any:"thing, connector or note",thing:"thing",route:"connector"},k=($,E,_="any")=>{if(!u[_].has($)){let W=Qe($,u[_]);c(E,`no ${b[_]} "${$}" in this drawing`,W?`did you mean "${W}"?`:void 0)}},w=($,E,_="any")=>$?.forEach((W,Y)=>k(W,`${E}/${Y}`,_)),v=new Map(Object.entries(r.outlines)),I=new Map;function z($,E){let _="from"in $?l($.from,0):0,W="duration"in $?l($.duration,NaN):NaN,Y=Number.isFinite(W);if("sequence"in $){let X=$.sequence;return l(X.from,0)+P(X,`${E}/sequence`)}if("series"in $)return A($.series,`${E}/series`).end;if("layers"in $)return Math.max(0,...$.layers.map((X,F)=>z(X,`${E}/layers/${F}`)));if("assemble"in $||"disassemble"in $){let X="assemble"in $?"assemble":"disassemble",F="assemble"in $?$.assemble:$.disassemble,ce=I.get($);return ce||I.set($,ce=kl(i,X,{seed:e.seed??1,...F,...Y?{duration:W}:{}})),_+ce.duration}return"draw"in $?_+(Y?W:400)+Math.max(0,$.draw.length-1)*l($.stagger,0):"lift"in $?_+Math.max(Y?W:750,...$.opacity?.times.map(X=>Tt(X,t))??[])+Math.max(0,$.lift.length-1)*l($.stagger,0):Y?_+W:"travel"in $?$.loop?_:_+$.travel.length*l($.each,1150):"pulse"in $?$.loop?_:_+1500:"type"in $?_+400:"camera"in $?_+900:"move"in $?_+Math.max(0,...[$.x,$.y,$.scale,$.opacity].flatMap(X=>X?.times.map(F=>Tt(F,t))??[])):_}let B=($,E)=>Math.max(0,...($.children??[]).map((_,W)=>z(_,`${E}/children/${W}`)),...($.layers??[]).map((_,W)=>z(_,`${E}/layers/${W}`)),$.series?A($.series,`${E}/series`).end:0),T=new Map;function L($,E){let _=T.get($);if(_!==void 0)return _;let W;return $.duration!==void 0&&typeof $.duration=="object"?W=ca($.say,$.duration.read):W=$.duration!==void 0?l($.duration,0):B($,E),$.duration===void 0&&W<=0&&$.say&&(W=ca($.say,!0)),W<=0&&c(`${E}/duration`,"how long is it? (nothing in it says)"),T.set($,W),W}let P=($,E)=>{let _=L($,E),W=$.playbackRate??1;return $.loop===!0?_/W:(typeof $.loop=="number"?_*$.loop:_)/W};function A($,E){let _=[],W=0,Y;return $.forEach((X,F)=>{if("transition"in X){let ue=X.transition,Oe=ue.timing,Ce=ue.presentation==="none"?0:Qc(Oe,t);Y={t:ue,length:Ce};return}let ce=X.sequence,de=`${E}/${F}/sequence`,be=P(ce,de),$e=Math.max(0,W+l(ce.offset,0)-(Y?.length??0));Y&&_.length&&Y.length>Math.min(_[_.length-1].end-_[_.length-1].start,be)&&c(`${E}/${F-1}/transition/timing`,"a transition is no longer than either side of it"),_.push({s:ce,path:de,start:$e,end:$e+be,...Y?{into:Y}:{}}),W=$e+be,Y=void 0}),{list:_,end:Math.max(0,..._.map(X=>X.end))}}let S=A(e.series??[],"/series"),O=Math.max(0,...(e.layers??[]).map(($,E)=>z($,`/layers/${E}`))),M=Math.max(S.end,O);M<=0&&!o.length&&c("","a motion document has a series, or layers, that last");let C=new Map,V=[],j=i.viewBox,N=($,E,_)=>{let W=_!==void 0?1/_:Math.max(($.w+E*2)/j[2],($.h+E*2)/j[3]);return[$.x+$.w/2-j[2]*W/2,$.y+$.h/2-j[3]*W/2,j[2]*W,j[3]*W]};function R($,E,_){let W=Y=>_?{at:_.at+Y/_.rate,rate:_.rate}:void 0;if("sequence"in $){K($.sequence,`${E}/sequence`,W(l($.sequence.from,0)),!1);return}if("series"in $){for(let Y of A($.series,`${E}/series`).list)K(Y.s,Y.path,W(Y.start),!1);return}if("layers"in $){$.layers.forEach((Y,X)=>R(Y,`${E}/layers/${X}`,_));return}if("travel"in $)$.travel.forEach((Y,X)=>(Array.isArray(Y)?Y:[Y]).forEach((F,ce)=>k(F.split(":")[0],`${E}/travel/${X}${Array.isArray(Y)?`/${ce}`:""}`,"route")));else if("pulse"in $)w($.pulse,`${E}/pulse`,"thing");else if("ants"in $)$.ants!==!0&&w($.ants,`${E}/ants`,"route");else if("draw"in $)w($.draw,`${E}/draw`,"route");else if("type"in $)w($.type,`${E}/type`);else if("move"in $)k($.move,`${E}/move`,"thing");else if("lift"in $)w($.lift,`${E}/lift`,"thing");else if("focus"in $)D($.focus,`${E}/focus`);else if("highlight"in $)w($.highlight,`${E}/highlight`,"thing");else if("camera"in $){let Y=$.camera,X=l($.duration,900);if(!_){c(`${E}/camera`,"a camera can't be in a loop");return}let F=j;if(Y!=="fit"){let ce=Y.focus;if(Array.isArray(ce)&&typeof ce[0]=="number")F=N({x:ce[0],y:ce[1],w:ce[2],h:ce[3]},Y.margin??0,Y.zoom);else{let de=typeof ce=="string"?[ce]:ce;de.forEach(($e,ue)=>k($e,`${E}/camera/focus${typeof ce=="string"?"":`/${ue}`}`,"thing"));let be=de.map($e=>p.get($e)?.bbox).filter($e=>!!$e);if(be.length){let $e=Math.min(...be.map(Oe=>Oe.x)),ue=Math.min(...be.map(Oe=>Oe.y));F=N({x:$e,y:ue,w:Math.max(...be.map(Oe=>Oe.x+Oe.w))-$e,h:Math.max(...be.map(Oe=>Oe.y+Oe.h))-ue},Y.margin??40,Y.zoom)}}}V.push({at:_.at+l($.from,0)/_.rate,over:X/_.rate,ease:Xt($.easing,X,"settle"),to:F})}}let D=($,E)=>{$&&(w($.lit,`${E}/lit`),w($.always,`${E}/always`))};function K($,E,_,W){if($.name!==void 0&&_&&C.set($.name,_.at),!W)for(let F of["show","hide","say","enter","focus","highlight","levels","variants","ants"])$[F]!==void 0&&c(`${E}/${F}`,`${F} is for a sequence of the document's own series`,F==="focus"||F==="highlight"||F==="ants"?`here, a child: { ${F}: \u2026 }`:void 0);w($.show,`${E}/show`),w($.hide,`${E}/hide`),w($.highlight,`${E}/highlight`,"thing"),D($.focus,`${E}/focus`);for(let F of Object.keys($.levels??{}))F!=="*"&&k(F,`${E}/levels/${F}`);for(let[F,ce]of Object.entries($.variants??{})){k(F,`${E}/variants/${F}`,"thing");let de=r.looks?.[F]??[];if(p.has(F)&&ce!==""&&!de.includes(ce)){let be=Qe(ce,de);c(`${E}/variants/${F}`,de.length?`${F} has no look "${ce}" (it has ${de.join(", ")})`:`${F} declares no looks (variants: in the diagram)`,be?`did you mean "${be}"?`:void 0)}}Array.isArray($.ants)&&w($.ants,`${E}/ants`,"route");let Y=$.playbackRate??1,X=_&&!$.loop?{at:_.at-l($.trimBefore,0)/(_.rate*Y),rate:_.rate*Y}:void 0;if(($.children??[]).forEach((F,ce)=>R(F,`${E}/children/${ce}`,X)),($.layers??[]).forEach((F,ce)=>R(F,`${E}/layers/${ce}`,X)),$.series)for(let F of A($.series,`${E}/series`).list)K(F.s,F.path,X&&{at:X.at+F.start/X.rate,rate:X.rate},!1)}for(let $ of S.list)K($.s,$.path,{at:$.start,rate:1},!0);(e.layers??[]).forEach(($,E)=>R($,`/layers/${E}`,{at:0,rate:1})),V.sort(($,E)=>$.at-E.at);let G={};for(let[$,E]of Object.entries(e.markers??{})){let _=Tt(E,t);if(_!==void 0){G[$]=_;continue}let W=String(E),Y=[...C.keys()].filter(ce=>W===ce||W.startsWith(ce+"+")||W.startsWith(ce+"-")).sort((ce,de)=>de.length-ce.length)[0];if(Y===void 0){c(`/markers/${$}`,`"${W}" isn't a moment of this document`);continue}let X=W.slice(Y.length),F=X?Tt(X.slice(1),t):0;if(F===void 0){c(`/markers/${$}`,`"${X}" isn't a time`);continue}G[$]=C.get(Y)+(X[0]==="-"?-F:F)}if(o.length)return m();let ne=S.list.map(($,E)=>({name:$.s.name??`beat-${E+1}`,index:E,start:$.start,end:$.end,...$.s.say?{say:$.s.say}:{}})),te=new Map;for(let $ of S.list){for(let E of $.s.show??[])te.has(E)||te.set(E,!1);for(let E of $.s.hide??[])te.has(E)||te.set(E,!0)}let J=[new Map(te)];for(let $ of S.list){let E=new Map(J[J.length-1]);for(let _ of $.s.show??[])E.set(_,!0);for(let _ of $.s.hide??[])E.set(_,!1);J.push(E)}let pe=[new Map];for(let $ of S.list){let E=new Map(pe[pe.length-1]);for(let[_,W]of Object.entries($.s.variants??{}))E.set(_,W);pe.push(E)}let ie=($,E)=>!$||$.lit.includes(E)||$.always?.includes(E)||$.scope==="links"&&p.has(E)?1:$.level??.12,q=($,E)=>{let _=$<0?void 0:S.list[$].s.levels;return _?_[E]??_["*"]??1:1},Q=($,E)=>(J[$+1].get(E)===!1?0:1)*($<0?1:ie(S.list[$].s.focus,E))*q($,E),ze=($,E)=>{let _=i.notes[E];if(_===void 0)return Q($,E);let W=$<0?void 0:S.list[$].s.levels?.[E];return Q($,_)*(J[$+1].get(E)===!1?0:1)*(W??1)},Ee=$=>{let E=-1;for(let _=0;_<S.list.length;_++)S.list[_].start<=$&&(E=_);return E},Ze=($,E)=>{let _=S.list[$],W=E-_.start;if(_.into&&_.into.length>0)return ef(_.into.t.timing,W,_.into.length);let Y=_.s.enter;if(!Y)return 1;let X=l(Y.fade,0);return X<=0?1:Xt(Y.easing,X,"ease")(xt(W/X))};function U($,E,_,W,Y){if("sequence"in $){let de=$.sequence,be=l(de.from,0);$n(de,E-be,_-be,xn(de,W-be),Y);return}if("series"in $){for(let de of A($.series,"").list)$n(de.s,E-de.start,_-de.start,de.end-de.start,Y);return}if("layers"in $){for(let de of $.layers)U(de,E,_,W,Y);return}let X=l("from"in $?$.from:void 0,0),F=E-X;if("assemble"in $||"disassemble"in $){Y.sum.add(I.get($).at(F));return}if("draw"in $){let de=Math.max(1,l($.duration,400)),be=l($.stagger,0),$e=Xt($.easing,de,"ease-out");$.draw.forEach((ue,Oe)=>{let Ce=$e(xt((F-Oe*be)/de));Ce<=0?(Y.sum.route(ue,{opacity:0,drawn:0}),Y.sum.label(ue,{opacity:0})):Ce<1&&(Y.sum.route(ue,{drawn:Ce,...$.by?{by:$.by}:{}}),Y.sum.label(ue,{opacity:Ce}))});return}if("type"in $){let de=l($.duration,400),be=Xt($.easing,de,"linear")(xt(F/Math.max(1,de)));if(be<1)for(let $e of $.type)Y.sum.label($e,be<=0?{opacity:0}:{typed:be});return}if("move"in $){let de=Ce=>Ce?Dr(Ce,F,t):void 0,be=de($.x)??0,$e=de($.y)??0,ue=de($.scale),Oe=de($.opacity);Y.sum.item($.move,{dx:be,dy:$e,...ue===void 0?{}:{scale:ue,about:p.get($.move).foot},...Oe===void 0?{}:{opacity:xt(Oe)}});for(let Ce of[$.move,...x.get($.move)??[]])Y.sum.label(Ce,{dx:be,dy:$e,...Oe===void 0?{}:{opacity:xt(Oe)}});return}if("lift"in $){let de=l($.stagger,0),be=Math.max(1,l($.duration,750)),$e=Xt($.easing,be,"ease-out"),ue=$.to==="down",Oe=$.lift.length;$.lift.forEach((Ce,qt)=>{let oe=F-(ue?Oe-1-qt:qt)*de,Te=$e(xt(oe/be)),Ve=(qt+1)*$.by*(ue?Te:-Te),Ye=$.opacity?xt(Dr($.opacity,oe,t)):1;if(!(!Ve&&Ye>=1)){Y.sum.item(Ce,{dy:Ve,opacity:Ye});for(let Qt of[Ce,...x.get(Ce)??[]])Y.sum.label(Qt,{dy:Ve,opacity:Ye})}});return}if("camera"in $)return;let ce=$.duration===void 0?Math.max(0,W-X):l($.duration,0);if(!(F<0||F>ce)){if("focus"in $||"highlight"in $){let de=Math.max(1,l($.fade,Jc)),be=xt(Math.min(F/de,$.duration===void 0?1:(ce-F)/de)),$e=Xt($.easing,de,"linear")(be);if("focus"in $)ks($.focus,$e,Y.sum);else for(let ue of $.highlight)Y.shown(ue)&&Re(ue,$e,Y.sum);return}if("ants"in $){De($.ants===!0?[...f]:$.ants,Y,$.speed,$.dash);return}if("pulse"in $){let be=$.loop?ge(_-X,1500,Y)/1500:F/Math.max(1,$.duration===void 0?1500:ce);if(be<0||be>=1)return;for(let $e of $.pulse)if(Y.shown($e)){let ue=p.get($e),Oe=ue.bbox.w*.5*(.7+be*.6);Y.sum.pulses.push({x:yt(ue.foot[0]),y:yt(ue.foot[1]),rx:yt(Oe),ry:yt(Oe*.58),opacity:et(1-be)})}return}if("travel"in $){let de=l($.each,1150),be=l($.hold,$.loop?700:0),$e=$.travel.length*de+be,ue=$.loop?ge(_-X,$e,Y):F,Oe=Math.floor(ue/de);if(Oe>=$.travel.length)return;let Ce=(ue-Oe*de)/de,qt=Xt($.easing,de,"ease-in-out")(Ce),oe=$.travel[Oe];for(let Te of Array.isArray(oe)?oe:[oe]){let[Ve,Ye]=Te.split(":");Y.shown(Ve)&&Y.sum.tokens.push({route:Ve,at:et((Ye??h.get(Ve))==="blocked"?fe(Ce):qt),...Ye?{kind:Ye}:{}})}}}}let fe=$=>$<.7?$/.7:1-($-.7)/.3*.25,ge=($,E,_)=>_.off?0:($%E+E)%E,Re=($,E,_)=>{et(E)>0&&v.has($)&&_.outlines.push({id:$,points:v.get($),...et(E)<1?{opacity:et(E)}:{}})},ks=($,E,_)=>{for(let W of g){let Y=d.has(W)&&!$.lit.includes(W)&&!$.always?.includes(W)?i.notes[W]:void 0,X=Fs(1,ie($,Y??W),E);X>=1||(p.has(W)?(_.item(W,{opacity:X}),_.label(W,{opacity:X})):f.has(W)?(_.route(W,{opacity:X}),_.label(W,{opacity:X})):_.label(W,{opacity:X}))}},De=($,E,_=fl,W)=>{for(let Y of $){let X=dl(h.get(Y)??"",{dash:W,kinds:n.kinds,still:n.still});if(!X)continue;let F=X[0]+X[1],ce=ge(_*E.A/1e3,F,E);E.sum.route(Y,{ants:{dash:X,offset:yt(ce)}})}},xn=($,E)=>$.loop===!0?Math.max(0,E):P($,"");function $n($,E,_,W,Y){if(E<0||E>W||E===W&&W<M&&W>0&&$.loop)return;let X=$.playbackRate??1,F=L($,""),ce=l($.trimBefore,0),de=$.loop&&F>0?E*X%F:E*X,be=de+ce,$e=_*X+ce;for(let ue of $.children??[])U(ue,be,$e,F+ce,Y);for(let ue of $.layers??[])U(ue,be,$e,F+ce,Y);if($.series)for(let ue of A($.series,"").list)$n(ue.s,be-ue.start,$e-ue.start,ue.end-ue.start,Y)}function Dl($,E={}){let _=Math.max(0,Math.min(M,Number.isFinite($)?$:0)),W=E.ambient==="off"||e.ambient==="off"&&E.ambient===void 0,Y=typeof E.ambient=="number"?E.ambient:_,X=new fa,F=Ee(_),ce=F<0?1:Ze(F,_),de=(oe,Te)=>F<0?Te(-1,oe):ce>=1?Te(F,oe):Fs(Te(F-1,oe),Te(F,oe),ce),be=oe=>(F<0?J[0]:J[F+1]).get(oe)!==!1;if(te.size||S.list.some(oe=>oe.s.focus||oe.s.levels))for(let oe of g){let Te=de(oe,d.has(oe)?ze:Q);Te>=1||(p.has(oe)&&X.item(oe,{opacity:Te}),f.has(oe)&&X.route(oe,{opacity:Te}),X.label(oe,{opacity:Te}))}if(F>=0)for(let oe of pe[pe.length-1].keys()){let Te=pe[F].get(oe)??"",Ve=pe[F+1].get(oe)??"",Ye={};Te&&ce<1&&(Ye[Te]=et(1-ce)),Ve&&(Ye[Ve]=et((Ye[Ve]??0)+ce));for(let Qt of Object.keys(Ye))Ye[Qt]<=0&&delete Ye[Qt];Object.keys(Ye).length&&(X.variants[oe]=Ye)}if(F>=0){let oe=new Set(S.list[F].s.highlight??[]),Te=new Set(F>0&&ce<1?S.list[F-1].s.highlight??[]:[]);for(let Ve of new Set([...Te,...oe]))Re(Ve,Fs(Te.has(Ve)?1:0,oe.has(Ve)?1:0,ce),X)}let $e={sum:X,shown:be,off:W,A:Y},ue=F>=0?S.list[F].s.ants:void 0,Oe=ue===void 0?a:void 0;ue?De(ue===!0?[...f]:ue,$e):Oe&&De(Oe.ids??[...f],$e,Oe.speed,Oe.dash),S.list.forEach((oe,Te)=>{_>=oe.start&&(_<oe.end||Te===F&&_<=oe.end)&&$n(oe.s,_-oe.start,Y-oe.start,oe.end-oe.start,$e)});for(let oe of e.layers??[])U(oe,_,Y,M,$e);let Ce;for(let oe of V){if(oe.at>_)break;let Te=oe.over<=0?1:oe.ease(xt((_-oe.at)/oe.over)),Ve=Ce??j;if(Te>=1){Ce=oe.to;continue}let Ye=Ve[2],Qt=oe.to[2],vn=Math.exp(Fs(Math.log(Ye),Math.log(Qt),Te)),ka=Math.abs(Qt-Ye)<1e-6?Te:(vn-Ye)/(Qt-Ye),ql=Fs(Ve[0]+Ve[2]/2,oe.to[0]+oe.to[2]/2,ka),Kl=Fs(Ve[1]+Ve[3]/2,oe.to[1]+oe.to[3]/2,ka),xa=vn*j[3]/j[2];Ce=[ql-vn/2,Kl-xa/2,vn,xa]}let qt=Ce?.map(yt);return X.state(qt&&qt.some((oe,Te)=>Math.abs(oe-j[Te])>.005)?qt:void 0)}let Sn=$=>{if(!$||typeof $!="object")return!1;if(Array.isArray($))return $.some(Sn);let E=$;return E.ants!==void 0&&E.ants!==!1||E.loop===!0&&("travel"in E||"pulse"in E)?!0:Object.values(E).some(Sn)},Bl=a!==void 0||Sn(e.series)||Sn(e.layers),wa=$=>{let E=Ee(Math.max(0,Math.min(M,$)));return E<0?void 0:ne[E]};return{ok:!0,diags:o,duration:M,beats:ne,markers:G,ambient:e.ambient??"on",loops:Bl,at:Dl,beatAt:wa,startOf:$=>C.get($)??ne.find(E=>E.name===$)?.start,cues($){let E=wa($);if(!E)return;let _=Math.max(0,Math.min(M,$));return{beat:E.name,index:E.index,of:ne.length,progress:et(xt((_-E.start)/Math.max(1,E.end-E.start))),...E.say?{say:E.say,...E.say.chapter!==void 0?{chapter:E.say.chapter}:{},...E.say.color!==void 0?{color:E.say.color}:{}}:{}}}}}var Qc=(s,e)=>"linear"in s?Tt(s.linear,e)??0:Tt(s.spring.duration,e)??tf(s.spring);function ef(s,e,n){return n<=0||e>=n?1:"spring"in s?xt(_r(e,{...s.spring,overshootClamping:!0})/_r(n,{...s.spring,overshootClamping:!0})):xt(e/n)}function tf(s){let e=s.mass??1,n=s.stiffness??100,r=s.damping??10,i=Math.sqrt(n/e),o=Math.min(1,r/(2*Math.sqrt(n*e)));return Math.ceil(Math.log(200)/(o*i)*1e3*(o>=1?1.6:1))}function Al(s){let{steps:e,vis:n}=s.steps,r=s.rendered.viewBox,i=!1,o=aa(s),t=new Set([...o.pieces.map(l=>l.id),...o.routes.map(l=>l.id),...Object.keys(o.notes)]),a=l=>t.has(l),m=Object.keys(o.notes).filter(l=>o.notes[l]===void 0),c=e.map((l,p)=>{let f=[],d=[];for(let[u,b]of Object.entries(n))(p===0?!b.includes(!0):b[p-1]&&!b[p])?d.push(u):p>0&&b[p]&&!b[p-1]&&f.push(u);let h=[],g=u=>`${u.route}:${u.kind}`;l.phases.length&&h.push({travel:l.phases.map(u=>u.length===1?g(u[0]):u.map(g)),each:1150,hold:700,loop:!0});let y=(s.raw.steps??[])[p]?.pulse?.filter(u=>s.layout.byId.has(u))??[];if(y.length&&h.push({pulse:y,loop:!0}),l.focus){let[u,b,k,w]=Sl(r,l.focus).map(yt);h.push({camera:{focus:[u,b,k,w]},duration:900,easing:"ease-in-out"}),i=!0}else i&&(h.push({camera:"fit",duration:900,easing:"ease-in-out"}),i=!1);let x={name:`step-${l.n}`,duration:l.duration,say:{title:l.heading,...l.caption?{text:l.caption}:{},...l.command?{code:l.command}:{}}};return f.length&&(x.show=f),d.length&&(x.hide=d),x.focus=s.raw.dim==="all"?{lit:l.lit.filter(a),scope:"all",level:.14}:{lit:l.lit.filter(a),scope:"links",level:.12,...m.length?{always:m}:{}},h.length&&(x.children=h),{sequence:x}});return{isomotion:1,...c.length?{series:c}:{}}}function Ml(s,e){let n={};for(let r of s.layout.items){let i=(r.region??r.node)?.variants;i&&(n[r.id]=Object.keys(i))}Object.keys(n).length&&(s.rendered.looks=n,s.rendered.variants=Object.fromEntries([...new Set(Object.values(n).flat())].map(r=>[r,zr({scene:s.raw,routes:s.routes,steps:s.steps,theme:e,id:s.raw.id,gridStep:s.grid.step??s.grid.snap??1,layout:{...s.layout,items:s.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 Nl=s=>sf+Po(s)+nf+_o(),sf=`
141
+ /* blocks: hue per role, lightness per face and theme */
142
+ .blk .top{fill:hsl(var(--h) var(--s) var(--l-top))}
143
+ .blk .lft{fill:hsl(var(--h) var(--s) var(--l-left))}
144
+ .blk .rgt{fill:hsl(var(--h) var(--s) var(--l-right))}
145
+ .blk polygon,.blk path.top,.blk path.lft{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8;stroke-linejoin:round}
146
+ .blk .det{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.4;fill:none;stroke-linecap:round;opacity:.7}
147
+ .k-slab .top{fill:var(--slab-top)} .k-slab .lft{fill:var(--slab-l)} .k-slab .rgt{fill:var(--slab-r)}
148
+ .k-pad .top{fill:var(--pad-top)}
149
+ .wall polygon{fill-opacity:.34}
150
+ .zone polygon{fill:hsl(var(--h) var(--s) 50% / .12);stroke:hsl(var(--h) var(--s) 45% / .55);stroke-dasharray:5 4;stroke-width:1.2}
151
+ .ghost polygon{fill:transparent!important;stroke:var(--muted);stroke-dasharray:4 4;stroke-width:1.2}
152
+ .ghost .det{opacity:.45}
153
+ .blk polygon.ico-unknown{fill:none;stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.2;stroke-dasharray:3 2.5}
154
+ .blk .ico-unknown-q{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.6;stroke-linecap:round;fill:none}
155
+ .blk polygon.sock-hole{fill:hsl(var(--h) var(--s) 18%);opacity:.8}
156
+ .scr .t{fill:#1d1f27;stroke:#3a3b44;stroke-width:.6}
157
+ .scr .ln{stroke:#8fd3b0;stroke-width:1.2;stroke-linecap:round}
158
+ .scr .bar{fill:#2a2c36}
159
+ .scr .win{fill:#e9e9ee}
160
+ .scr .wall{fill:#3b5bbd}
161
+ .scr .glass{fill:#0d0e12;stroke:#3a3b44;stroke-width:1}
162
+ .scr .w{fill:#f4f4f2}
163
+ .scr .d{fill:#0b0b0d}
164
+ .scr .m{fill:#3a3934}
165
+ .scr .unk{fill:none;stroke:#8a8d99;stroke-width:1;stroke-dasharray:3 2.5}
166
+ .scr .unk-q{fill:none;stroke:#8a8d99;stroke-width:1.4;stroke-linecap:round}
167
+ .scr .unk-dot{fill:#8a8d99}
168
+ .orb .ball{fill:url(#orbG);stroke:#8a8b93;stroke-width:.8}
169
+ .orb .shade{fill:#000;opacity:.18}
170
+ .orb .eye{fill:#0b0b0d}
171
+ .person .body{fill:hsl(var(--h) var(--s) var(--l-left));stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8}
172
+ .person .head{fill:hsl(var(--h) var(--s) var(--l-top));stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8}
173
+
174
+ /* text */
175
+ .lbl{font-size:13px;font-weight:700;fill:var(--ink);paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
176
+ .sub{font-size:11px;fill:var(--muted);font-weight:400;paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
177
+ .floor{font-size:11px;font-weight:600;letter-spacing:.01em}
178
+ .floor.t-control{fill:var(--muted)}
179
+ .slabname{font-size:15px;font-weight:800;fill:var(--muted);letter-spacing:.12em;opacity:.8}
180
+ .slabname.sm{font-size:10.5px;letter-spacing:.1em;opacity:1}
181
+ `,nf=`.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
182
+ .tunnel .top{fill:hsl(205 85% 65% / .22)}
183
+ .tunnel .rib{fill:none;stroke:hsl(205 75% 45% / .5);stroke-width:1}
184
+ .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}
185
+
186
+ /* flows */
187
+ .flow{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
188
+ `;var da=`
189
+ /* step marks */
190
+ .xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}
191
+ .xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}
192
+ .say rect{fill:var(--surface);stroke-width:1.5}
193
+ .say text{font-size:12px;font-weight:600}
194
+ .badge{cursor:pointer}
195
+ .badge circle{fill:var(--c);stroke:var(--surface);stroke-width:2.5}
196
+ .badge text{font-size:11.5px;font-weight:800;fill:var(--on);text-anchor:middle;dominant-baseline:central;pointer-events:none}
197
+ .tok{stroke:var(--surface);stroke-width:2.5}
198
+ .pulse{fill:none;stroke-width:2.5;transform-box:fill-box;transform-origin:center;animation:pulse 1.5s ease-out infinite}
199
+ @keyframes pulse{from{transform:scale(.35);opacity:.95}to{transform:scale(1.5);opacity:0}}
200
+ .sub{stroke-width:5px}
201
+
202
+ /* step focus: what a step does not touch dims; things that appear later are hidden */
203
+ [data-hl],[data-id],[data-step]{transition:opacity .25s}
204
+ svg.focus [data-hl]:not(.hl){opacity:.12}
205
+ svg.focus.dim-all [data-dim]:not(.hl){opacity:.14}
206
+ svg.focus .badge:not(.on){opacity:.14}
207
+ svg.all .badge{opacity:1}
208
+ svg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}
209
+ svg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}
210
+ .pre{opacity:0!important;pointer-events:none}
211
+ `,rf=`
212
+ /* player */
213
+ .player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
214
+ .ctrls{display:flex;gap:6px;flex:none}
215
+ .pbtn{font:inherit;font-size:13px;font-weight:700;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:99px;padding:6px 14px;cursor:pointer}
216
+ .pbtn.icon{padding:6px 11px}
217
+ .pbtn:hover{border-color:var(--muted)}
218
+ .pbtn:disabled{opacity:.6;cursor:default}
219
+ .pbtn.primary{background:var(--ink);color:var(--surface);border-color:var(--ink);min-width:92px;justify-content:center}
220
+ .pbtn:focus-visible,.dot:focus-visible,.badge:focus-visible{outline:2px solid var(--send);outline-offset:2px}
221
+ .cap{flex:1 1 360px;min-width:0}
222
+ .cap-h{font-size:14.5px;font-weight:700;display:flex;align-items:center;gap:8px}
223
+ .cap-h .cnt{margin-left:auto;font-weight:500;color:var(--muted);font-size:12px;white-space:nowrap}
224
+ .num{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--c,var(--control));color:var(--on);font-size:11px;font-weight:800}
225
+ .cap-t{font-size:13.5px;color:var(--ink);margin:4px 0 0;max-width:92ch;min-height:3.1em}
226
+ .cap-c{margin:8px 0 0;background:var(--code-bg);border-radius:8px;padding:7px 10px;font-size:12px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;max-height:9.5em;overflow-y:auto;color:var(--ink)}
227
+ .cap-c:empty{display:none}
228
+ .prog{height:3px;background:var(--line);border-radius:3px;overflow:hidden;margin-top:9px}
229
+ .prog i{display:block;height:100%;width:0;background:var(--c,var(--ink))}
230
+ .dots{display:flex;gap:5px;flex-wrap:wrap;flex-basis:100%;padding-left:2px;order:4}
231
+ .dot{width:10px;height:10px;border-radius:50%;background:var(--line);border:0;padding:0;cursor:pointer}
232
+ .dot.on{background:var(--ink)} .dot.done{background:var(--muted)}
233
+ details.steps{margin:0 0 8px;font-size:13.5px}
234
+ details.steps summary{cursor:pointer;color:var(--muted);font-size:13px}
235
+ details.steps ol{margin:8px 0 0;padding-left:22px;max-width:92ch}
236
+ details.steps li{margin:6px 0}
237
+ details.steps li code{font-size:11.5px}
238
+ @media (prefers-reduced-motion:reduce){.pulse{animation:none;opacity:.8}}
239
+ @media (max-width:560px){.cap{flex-basis:100%}}
240
+ .still .pulse{animation:none;opacity:.85}
241
+ .still *,.still *::before{transition:none!important}
242
+ .still .prog{display:none}
243
+ .still .ctrls,.still .tools{display:none}
244
+ .tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}
245
+ .pbtn.small{font-size:12px;padding:4px 11px;font-weight:600;color:var(--muted)}
246
+ .pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,ma=`
247
+ .grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}
248
+ svg.show-grid .grid{display:inline}
249
+ svg.pre-assemble > g:not(.g-anim){opacity:0}
250
+ `,D0=da+rf+ma;var af={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(s,e){let[n,r]=hn(e),i=Math.min(e.x1-e.x0,e.y1-e.y0)/2,o=(l,p)=>[n+i*Math.cos(l*Math.PI/180),r+i*Math.sin(l*Math.PI/180),p],t=(l,p,f)=>Array.from({length:13},(d,h)=>o(l+(p-l)*h/12,f)),a=(l,p,f)=>s.poly([...t(l,p,e.z0),...t(l,p,e.z1).reverse()],f),m=e.z1-e.z0,c=l=>t(-45,135,l).slice(1).map((p,f,d)=>s.line3(f?d[f-1]:o(-45,l),p,"det")).join("");return a(45,135,"lft")+a(-45,45,"rgt")+c(e.z0+m*.36)+c(e.z0+m*.68)+s.poly(Array.from({length:32},(l,p)=>o(p*360/32,e.z1)),"top")}},of={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(s,e){s.def("orbG",le("radialGradient",{id:"orbG",cx:"0.36",cy:"0.30",r:"0.80"},le("stop",{offset:"0",style:"stop-color:#ffffff"})+le("stop",{offset:"0.62",style:"stop-color:#f6f6f4"})+le("stop",{offset:"1",style:"stop-color:#cfd0d6"})));let n=Bi(e),[r,i]=ae((e.x0+e.x1)/2,(e.y0+e.y1)/2,n.z1),o=23,t=i-o+3;s.bounds.add([r-o,t-o]),s.bounds.add([r+o,t+o]);let a=(m,c,l,p)=>le("rect",{class:"eye",x:r+m-l/2,y:t+c-p/2,width:l,height:p,rx:l/2,transform:`rotate(-24 ${(r+m).toFixed(1)} ${(t+c).toFixed(1)})`});return s.blockFaces(n)+le("ellipse",{class:"shade",cx:r,cy:i+1,rx:o*.8,ry:o*.3})+le("circle",{class:"ball",cx:r,cy:t,r:o})+a(3,-7,6.4,13.5)+a(14,-12,5.4,10.5)},label(s,e,n){let[r,i]=ae((s.x0+s.x1)/2,(s.y0+s.y1)/2,s.z0+1.95);return{x:r,y:i-26+(n?0:14),anchor:"middle"}},pulse:s=>[(s.x0+s.x1)/2,(s.y0+s.y1)/2,s.z0+.8,26]},lf={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(s,e){let n=Bi(e),[r,i]=ae((e.x0+e.x1)/2,(e.y0+e.y1)/2,n.z1);s.bounds.add([r-13,i-50]);let o=t=>t.toFixed(1);return s.blockFaces(n)+le("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`})+le("circle",{class:"head",cx:r,cy:i-40,r:10})},label(s){let[e,n]=ae((s.x0+s.x1)/2,(s.y0+s.y1)/2,s.z0);return{x:e+30,y:n+2,anchor:"start"}},pulse:s=>[(s.x0+s.x1)/2,(s.y0+s.y1)/2,s.z0+.9,26]},pf={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(s,e,n){let[r,i]=hn(e),o=(e.x1-e.x0)/2,t=e.z1-e.z0,a=.14,m=(n.facing??0)*Math.PI/180,c=Math.cos(m),l=Math.sin(m),p=Math.sin(m)*a,f=-Math.cos(m)*a,d=[r-c*o,i-l*o],h=[r+c*o,i+l*o],g=e.z0,y=e.z1,x=s.poly([[h[0],h[1],g],[h[0]+p,h[1]+f,g],[h[0]+p,h[1]+f,y],[h[0],h[1],y]],"rgt")+s.poly([[d[0],d[1],y],[h[0],h[1],y],[h[0]+p,h[1]+f,y],[d[0]+p,d[1]+f,y]],"top")+s.poly([[d[0],d[1],g],[h[0],h[1],g],[h[0],h[1],y],[d[0],d[1],y]],"lft"),u=ae(d[0],d[1],y),b=ae(h[0],h[1],y),k=2*o*Xe,w=t*Xe,v=[(b[0]-u[0])/k,(b[1]-u[1])/k,0,1,u[0],u[1]],I=yn(n.face??"terminal")??Li;return x+=s.onMatrix(v,k,w,(z,B)=>_i(z,B)+I(z,B),"scr"),x}},cf={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(s,e,n){let r=yn(n.face??"terminal")??Li;return s.blockFaces(e)+s.onFace(e,"left",(i,o)=>_i(i,o)+r(i,o),"scr")}},ff={name:"cloud",description:"A cloud lying on the floor: the internet, or a hosted service.",size:[3,2.4,.3],role:"cloud",draw:(s,e)=>gr(s,e)},zl={block:ut("block","A box. Size and colour role are free; add decorations with `deco`.",[2.4,2.4,1.6],"grey"),session:ut("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:ut("terminal","A box with terminal lines on its front.",[1.6,1.2,.8],"term",[{terminal:2}]),server:ut("server","A service or daemon: a low box with two terminal lines.",[3,2.2,.9],"doz",[{terminal:2}]),chat:ut("chat","A chat server or room: a box with a chat bubble on top.",[3.6,4.4,1.3],"chat",["bubble"]),mailbox:ut("mailbox","A room or inbox: terminal lines and an envelope on top.",[2.4,2.4,1.6],"mail",[{terminal:3},"envelope"]),file:ut("file","A file or document: a low box with lines on top.",[1.6,1.6,.6],"file",["file-lines"]),folder:ut("folder","A folder or directory: a flat box.",[1.6,1.6,.5],"folder"),key:ut("key","A secret: a low box with a key on top.",[1.6,1.6,.6],"key",[],(s,e)=>jo(s,e)),socket:ut("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(s,e)=>Ro(s,e)),gate:ut("gate","A gate or proxy: a narrow upright slab, usually set in a fence wall.",[.3,2,1.1],"gate"),placeholder:ut("placeholder","A placeholder value: a small low box with lines.",[1.2,1,.45],"placeholder",["file-lines"]),orb:of,person:lf,screen:pf,monitor:cf,cloud:ff,volume:af};var df="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",mf={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:df,box:!0,auto:!0},css:`.fz{fill:var(--fence-text)!important;opacity:1!important}
251
+ `},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}}},Zs={regions:mf,nodes:zl,defaultNode:"block"};var ua=class extends Error{diags;constructor(e){super(e.filter(n=>n.severity==="error").map(n=>`line ${n.line}: ${n.message}`).join(`
252
+ `)),this.name="CompileError",this.diags=e}};function Tl(s,e,n={}){if(n.font&&!n.resolveVars)throw new Error("font: a self-contained drawing's (resolveVars)");let r=zo(n.font,()=>hf(s,e,n)),i=n.font&&{sans:n.font.sans,mono:n.font.mono??Ji.mono};if(!r.ok&&n.strict==="throw")throw new ua(r.diags);if(!r.ok&&n.strict&&(r.scenes=[]),n.stepMs!==void 0)for(let a of r.scenes)for(let m of a.steps.steps)m.duration=n.stepMs;if(n.treatment!==void 0&&n.treatment!=="mono"&&n.treatment!=="none")throw new Error(`treatment: there is "mono" (and "none"), and no ${JSON.stringify(n.treatment)}`);let o=(n.treatment??r.doc?.treatment)==="mono";if(n.treatment==="mono"&&!n.resolveVars)throw new Error("treatment: a self-contained drawing's (resolveVars)");let t=r.theme;if(n.resolveVars)for(let a of r.scenes){let m=n.mode??"light",c=Nl(Zs)+da+ma;if(o){uf(a,t,m,c,n.mono,i);continue}let l={mode:m,theme:r.theme,css:c,fonts:i};a.rendered.svg=Er(a.rendered.svg,l),a.rendered.variants&&(a.rendered.variants=Object.fromEntries(Object.entries(a.rendered.variants).map(([p,f])=>[p,Er(f,l)]))),a.rendered.inks={surface:r.theme[l.mode].surface??r.theme.light.surface,control:r.theme[l.mode].control??r.theme.light.control,kinds:Object.fromEntries(Object.entries(r.theme.kinds).map(([p,f])=>[p,r.theme[l.mode][f.color]??f.color]))}}if(n.font)for(let a of r.scenes){let m=n.font.name,c=l=>l.replace("<svg ",`<svg data-font="${m.replace(/[^\w-]/g,"")}" `);a.rendered.svg=c(a.rendered.svg),a.rendered.variants&&(a.rendered.variants=Object.fromEntries(Object.entries(a.rendered.variants).map(([l,p])=>[l,c(p)])))}return n.resolveVars&&o&&t&&(r.theme={...t,kinds:Object.fromEntries(Object.entries(t.kinds).map(([a,m])=>{let c=r.scenes.map(l=>l.rendered.mono?.kinds[a]?.dash).find(l=>l&&l.length>1);return[a,c?{...m,ants:[c[0],c[1]]}:m]}))}),r}function uf(s,e,n,r,i,o){let t=[s.rendered.svg,...Object.values(s.rendered.variants??{})],a=cl(t.join(""),e,n,[...s.routes.map(c=>c.kind),...s.steps.kindsUsed],i),m=c=>pl(Er(c,{mode:n,theme:a.theme,css:r+a.css,fonts:o}),a.look,s.id);s.rendered.svg=m(s.rendered.svg),s.rendered.variants&&(s.rendered.variants=Object.fromEntries(Object.entries(s.rendered.variants).map(([c,l])=>[c,m(l)]))),s.rendered.inks={surface:a.look.paper,control:a.look.ink,kinds:Object.fromEntries(Object.keys(e.kinds).map(c=>[c,a.look.ink]))},s.rendered.mono=a.look;for(let c of a.look.warnings)s.rendered.warnings.push({path:"",message:`black and white: ${c}`})}function hf(s,e,n){let r=mo(s),i=[...r.diags];if(i.some(l=>l.severity==="error"))return{ok:!1,diags:i,catalog:Zs,scenes:[]};let o=So(r);i.push(...o);let t=r.data;if(o.length){try{let l=_s(ur(e),t.roles??{},t.kinds??{}),p=o.map(f=>f.path);(Array.isArray(t.scenes)?t.scenes:[]).forEach((f,d)=>{try{let h=mr(f,`/scenes/${d}`,r,l,Zs,t.roles??{});i.push(...h.diags.filter(g=>!p.some(y=>g.path===y||g.path.startsWith(y+"/"))))}catch{}})}catch{}return i.sort((l,p)=>l.line-p.line||l.col-p.col),{ok:!1,diags:i,catalog:Zs,scenes:[]}}let a=el(t,e,Zs,r,s,{snap:n.snap},i),m=0,c=(l,p,f)=>{let d=r.locate(l);a.diags.push({severity:"error",message:p,line:d.line,col:d.col,path:l,...f?{hint:f}:{}}),m++};return a.scenes.forEach((l,p)=>{Ml(l,a.theme);let f=l.raw.ants,d=Rr(l.raw)?.ids,h=l.routes.map(u=>u.id);if((d??[]).forEach((u,b)=>{h.includes(u)||c(`/scenes/${p}/ants${Array.isArray(f)?"":"/ids"}/${b}`,`no connector "${u}" in this scene`,h.length?`its connectors: ${h.slice(0,8).join(", ")}${h.length>8?", \u2026":""}`:void 0)}),!l.raw.motion)return;let g={isomotion:1,...l.raw.motion},y=`/scenes/${p}/motion`,x=Br(l,g,{kinds:a.theme.kinds}).diags;for(let u of x){let b=r.locate(y+u.path);a.diags.push({severity:u.severity,message:u.message,line:b.line,col:b.col,path:y+u.path,...u.hint?{hint:u.hint}:{}})}m+=x.length,x.length||(l.motion=g)}),m&&(a.ok=!1,a.diags.sort((l,p)=>l.line-p.line||l.col-p.col)),a}function Ne(s,e=null,...n){let r=document.createElement(s);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[t,a]of Object.entries(o))r.addEventListener(t,a);else r.setAttribute(i,o===!0?"":String(o));for(let i of n)i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}var lb=["<","script"].join("");function ha(s){return s?gs(s).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>").replace(/(^|[^*])\*([^*\s][^*]*)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,n,r)=>/^(https?:|#|\.{0,2}\/)/.test(r.replace(/&amp;/g,"&"))?`<a href="${r}">${n}</a>`:n):""}function yf(){let s=globalThis;return{now:()=>performance.now(),next(e){let n={},r=()=>{n.raf!==void 0&&s.cancelAnimationFrame?.(n.raf),clearTimeout(n.timer),e()};return n.raf=s.requestAnimationFrame?.(r),n.timer=setTimeout(r,n.raf===void 0?16:100),n},cancel(e){let n=e;n.raf!==void 0&&s.cancelAnimationFrame?.(n.raf),clearTimeout(n.timer)}}}var gf=400;function El(s,e={}){let n=e.clock??yf(),r=s,i=0,o=b(e.rate??1),t=e.loop??!1,a=!1,m=!0,c=!1,l=(e.ambient??r.ambient)==="on",p=l?0:"off",f,d=0,h=r.beatAt(0),g=!1,y=0,x,u={};function b(O){if(!(Number.isFinite(O)&&O>0))throw new Error("rate is a number over 0");return O}let k=O=>Math.max(0,Math.min(r.duration,O));function w(O,...M){for(let C of[...u[O]??[]])C(...M)}let v=()=>m&&!c&&(a||l&&r.loops);function I(){v()?f===void 0&&(d=n.now(),f=n.next(T)):f!==void 0&&(n.cancel(f),f=void 0)}function z(O,M){let C=y;for(let V of r.beats)if(!(V.start<=O||V.start>M||V.index===h?.index)&&(h=V,g=!0,w("beat",V,"play"),y!==C))return!1;return!0}function B(O){if(!a){w("time",i,"ambient");return}let M=i,C=i+O,V=y;if(x!==void 0&&C>=x){if(i=x,!z(M,i))return;x=void 0,a=!1,w("time",i,"play"),y===V&&w("pause");return}if(C<r.duration){i=C,z(M,i)&&w("time",i,"play");return}if(t){if(!z(M,r.duration)||(i=C%r.duration,l&&(p=i),h=void 0,w("loop"),y!==V))return;let j=r.beatAt(0);if(j&&(h=j,w("beat",j,"play"),y!==V||!z(j.start,i)))return;w("time",i,"play");return}i=r.duration,z(M,i)&&(a=!1,w("time",i,"play"),y===V&&(w("pause"),y===V&&w("end")))}function T(){f=void 0;let O=n.now(),M=Math.max(0,O-d)*o;d=O,l&&p!=="off"&&(p+=M),B(M),f===void 0&&v()&&(f=n.next(T))}function L(O,M=!1){let C=r.beatAt(i);y++;let V=y,j=C?.name!==h?.name||C?.index!==h?.index;h=C,!(C&&(j||M)&&(g=!0,w("beat",C,O),y!==V))&&w("time",i,O)}function P(O,M={}){if(c||!Number.isFinite(O))return;let C=k(O);l&&p!=="off"&&(p=M.join?C:p+C-i),i=C,d=n.now(),x!==void 0&&i>=x&&(x=void 0),L("seek"),I()}function A(){c||(i=0,l&&(p=0),x=void 0,d=n.now(),L("seek",!0),I())}let S={get timeline(){return r},get duration(){return r.duration},get time(){return i},get ambientTime(){return p},get playing(){return a},get beat(){return h},get cue(){return r.cues(i)},get rate(){return o},set rate(O){let M=b(O);M!==o&&(o=M,w("rate",M))},get loop(){return t},set loop(O){t=O},get ambient(){return l},set ambient(O){c||O===l||(l=O,l&&p==="off"&&(p=h?.start??0),I(),w("ambient",l),w("time",i,"ambient"))},get active(){return m},set active(O){O!==m&&(m=O,I())},state:()=>r.at(i,{ambient:p}),play(O={}){c||a||r.duration<=0||(i>=r.duration&&O.until===void 0&&A(),x=O.until!==void 0&&O.until>i&&O.until<=r.duration?O.until:void 0,!(O.until!==void 0&&x===void 0)&&(a=!0,d=n.now(),I(),w("play"),a&&!g&&h&&(g=!0,w("beat",h,"play"))))},pause(){a&&(a=!1,x=void 0,y++,I(),w("pause"))},toggle(){a?S.pause():S.play()},seek:P,seekBeat(O){let M=typeof O=="number"?r.beats[O]?.start:r.beats.find(C=>C.name===O)?.start;return M===void 0?!1:(P(M),!0)},next(){let O=r.beats.find(M=>M.start>i);P(O?O.start:r.duration)},prev(){let O=[...r.beats].reverse().find(M=>M.start<i-gf);P(O?O.start:0)},restart:A,rebind(O){if(c||!O.ok)return!1;x=void 0;let M=r.beatAt(i),C=M?(i-M.start)/Math.max(1,M.end-M.start):0,V=p==="off"?0:p-i,j=r;if(r=O,M){let N=O.beats.find(R=>R.name===M.name);if(N)i=N.start+C*(N.end-N.start);else{let R=j.beats.filter(D=>D.index<M.index).reverse().map(D=>O.beats.find(K=>K.name===D.name)).find(Boolean);i=R?R.start:0}}return i=k(i),l&&p!=="off"&&(p=i+V),d=n.now(),L("rebind"),I(),!0},on(O,M){let C=u[O]??=new Set;return C.add(M),()=>{C.delete(M)}},dispose(){c=!0,y++,a=!1,f!==void 0&&n.cancel(f),f=void 0;for(let O of Object.keys(u))u[O].clear()}};return I(),S}var Kr=new Map;function Il(){let s,e=.35;for(let[n,r]of Kr)r.wants&&r.seen>=e&&(r.seen>e||!s)&&(s=n,e=r.seen);for(let[n,r]of Kr)r.wants&&r.auto(n===s)}var jl=s=>{let e=new DOMParser().parseFromString(s,"image/svg+xml");if(e.documentElement.localName!=="svg")throw new Error("the drawing is not SVG");return document.importNode(e.documentElement,!0)},qr=s=>{let e=Math.round(s/1e3);return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`},Rl={ok:!0,diags:[],duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}};function bf(s){let e={...s.camera?{camera:s.camera}:{},...s.variants?{variants:s.variants}:{}};for(let n of["items","labels","routes"]){let r=Object.entries(s[n]??{}).filter(([,i])=>i.opacity===0).map(([i])=>[i,{opacity:0}]);r.length&&(e[n]=Object.fromEntries(r))}return e}function ya(s,e){if(e.timeline&&!e.timeline.ok)throw new Error(`the motion has faults: ${e.timeline.diags.map(U=>`${U.path}: ${U.message}`).join("; ")}`);let n=e.scene,r=jl(n.rendered.svg),i,o,t=!1,a=!1,m=El(e.timeline??Rl,{loop:e.loop,rate:e.rate,ambient:e.ambient,clock:e.clock}),c=e.controls??!0,l=e.reducedMotion==="respect"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,p=l,f=(U,fe,ge,Re)=>Ne("button",{type:"button",class:`iso-play-btn ${U}`,"aria-label":fe,title:fe,on:{click:Re}},ge),d=Ne("div",{class:"iso-play-stage"},r),h=f("back","Back","\u2039",()=>pe(()=>q(Math.max(0,te()-1)))),g=f("play","Play","\u25B6",()=>Q()),y=f("next","Next","\u203A",()=>pe(()=>q(Math.min(m.timeline.beats.length-1,te()+1)))),x=f("again","Reset","\u21BA",()=>pe(()=>{ie(),m.restart()})),u=f("ambient","Ambient motion","\u223F",()=>{J(),m.ambient=!m.ambient,K()}),b=Ne("input",{type:"range",class:"iso-play-bar",min:0,step:1,"aria-label":"Time",on:{input:(()=>pe(()=>{ie(),m.seek(Number(b.value))}))}}),k=Ne("span",{class:"iso-play-time"}),w=Ne("div",{class:"iso-play-dots"}),v=Ne("span",{class:"iso-play-num"}),I=Ne("span",{class:"iso-play-title"}),z=Ne("span",{class:"iso-play-chapter"}),B=Ne("span",{class:"iso-play-count"}),T=Ne("div",{class:"iso-play-text"}),L=Ne("pre",{class:"iso-play-code"}),P=Ne("dl",{class:"iso-play-facts"}),A=Ne("div",{class:"iso-play-say","aria-live":"polite"},Ne("div",{class:"iso-play-head"},v,I,z,B),T,L,P),S=Ne("details",{class:"iso-play-list"}),O=Ne("div",{class:"iso-play-row"},h,g,y,x,u,b,k),M=Ne("div",{class:"iso-play",role:"group","aria-roledescription":"animated diagram","aria-label":e.label??"Diagram",tabindex:c?0:void 0,"data-mode":e.mode??"light"},d,c&&O,c&&w,c&&A,c&&S);s.append(M);let C=[];function V(){let U=m.timeline.beats,fe=U.length>0,ge=U.some(De=>De.say);C=[],w.replaceChildren();let Re,ks;for(let De of U){(!Re||De.say?.chapter!==ks)&&(Re=Ne("span",{class:"iso-play-group",role:"group","aria-label":De.say?.chapter,title:De.say?.chapter}),w.append(Re),ks=De.say?.chapter);let xn=Ne("button",{type:"button",class:"iso-play-dot","aria-label":`Step ${De.index+1}: ${De.say?.title??De.name}`,title:De.say?.title??De.name,on:{click:(()=>pe(()=>q(De.index)))}});Re.append(xn),C.push(xn)}S.replaceChildren(Ne("summary",null,`All ${U.length} steps as text`),Ne("ol",null,...U.map(De=>Ne("li",null,...j(De)))));for(let De of[h,y,w])De.hidden=!fe;A.hidden=!ge,S.hidden=!ge,u.hidden=!m.timeline.loops,b.max=String(Math.round(m.duration));for(let De of[g,x,b,k])De.hidden=m.duration<=0;N=void 0}function j(U){let fe=U.say,ge=[Ne("b",null,fe?.title??U.name)];if(fe?.text){let Re=Ne("div",null);Re.innerHTML=ha(fe.text),ge.push(Re)}return fe?.code&&ge.push(Ne("code",null,fe.code)),fe?.facts?.length&&ge.push(Ne("span",null,fe.facts.map(([Re,ks])=>`${Re}: ${ks}`).join(" \xB7 "))),ge}let N;function R(U){let fe=String((U?.index??-1)+1);for(let ge of r.querySelectorAll("[data-badge]"))ge.classList.toggle("on",ge.getAttribute("data-badge")===fe),e.steps&&(ge.getAttribute("data-badge")===fe||p?ge.removeAttribute("opacity"):ge.setAttribute("opacity","0.14"));if(e.steps)for(let ge of r.querySelectorAll("[data-step]"))ge.setAttribute("visibility",ge.getAttribute("data-step")===fe&&!p?"visible":"hidden")}function D(){let U=m.beat;if(U===N||(N=U,R(U),!c))return;let fe=U?.say;v.textContent=U?String(U.index+1):"",v.style.backgroundColor=fe?.color??"",I.textContent=fe?.title??U?.name??"",z.textContent=fe?.chapter??"",B.textContent=U?`${U.index+1} / ${m.timeline.beats.length}`:"",T.innerHTML=ha(fe?.text),L.textContent=fe?.code??"",P.replaceChildren(...(fe?.facts??[]).flatMap(([ge,Re])=>[Ne("dt",null,ge),Ne("dd",null,Re)])),L.hidden=!fe?.code,P.hidden=!fe?.facts?.length,C.forEach((ge,Re)=>{ge.classList.toggle("on",Re===U?.index),ge.classList.toggle("done",U!==void 0&&Re<U.index),Re===U?.index?ge.setAttribute("aria-current","step"):ge.removeAttribute("aria-current")})}function K(){let U=i!==void 0?m.timeline.at(i,{ambient:i}):p?bf(m.timeline.at(m.duration,{ambient:"off"})):m.state();$l(r,U,n.rendered,{styles:"cssom"}),M.dataset.time=String(Math.round(i??m.time)),i!==void 0?R(m.timeline.beatAt(i)):D(),c&&(b.value=String(Math.round(m.time)),b.setAttribute("aria-valuetext",`${qr(m.time)} of ${qr(m.duration)}${m.beat?`, ${m.beat.say?.title??m.beat.name}`:""}`),k.textContent=`${qr(m.time)} / ${qr(m.duration)}`)}function G(){let U=ne();g.textContent=U?"\u275A\u275A":"\u25B6",g.setAttribute("aria-label",U?"Pause":"Play"),g.title=U?"Pause":"Play",u.setAttribute("aria-pressed",String(m.ambient)),A.setAttribute("aria-live",U?"off":"polite"),M.dataset.playing=String(U)}let ne=()=>m.playing&&o===void 0,te=()=>m.beat?.index??0;function J(){p&&(p=!1,N=void 0)}function pe(U){J(),t=!0,U(),G(),K()}function ie(){o=void 0,m.pause()}function q(U){let fe=m.timeline.beats[U];if(!fe||a)return;m.pause(),m.seek(fe.start,{join:!0});let ge=m.timeline.beats[U+1]?.start??1/0;o=Math.max(fe.start,Math.min(fe.end,ge,m.duration)-1),m.play({until:o})}function Q(){J(),ne()?(t=!0,ie()):(t=!1,o=void 0,m.pause(),m.play()),G(),K()}m.on("time",K),m.on("play",G),m.on("ambient",G),m.on("pause",()=>{o=void 0,G()}),M.addEventListener("keydown",U=>{let fe=U.key,ge=U.target;U.altKey||U.ctrlKey||U.metaKey||ge===b||(fe==="ArrowRight"||fe==="ArrowLeft"?(U.preventDefault(),(fe==="ArrowRight"?y:h).click()):fe==="Home"?(U.preventDefault(),x.click()):(fe===" "||fe==="k")&&ge===M&&(U.preventDefault(),Q()))});let ze=U=>{let fe=U.target.closest?.("[data-go]"),ge=U.key;!fe||U.type==="keydown"&&ge!=="Enter"&&ge!==" "||(U.preventDefault(),U.stopPropagation(),pe(()=>q(Number(fe.getAttribute("data-go"))-1)))};d.addEventListener("click",ze),d.addEventListener("keydown",ze);let Ee={seen:0,wants:e.autoplay==="visible"&&!l,auto(U){U?!t&&!ne()&&(o=void 0,m.play()):ne()&&(o=void 0,m.pause())}};Kr.set(M,Ee);let Ze=typeof IntersectionObserver=="function"?new IntersectionObserver(U=>{for(let fe of U)Ee.seen=fe.isIntersecting?fe.intersectionRatio:0,i===void 0&&(m.active=fe.isIntersecting);Il()},{threshold:[0,.2,.35,.5,.7,.9,1]}):void 0;return Ze?.observe(M),V(),G(),K(),e.autoplay===!0&&!l&&m.play(),{root:M,transport:m,step:U=>pe(()=>q(U)),set(U,fe=Rl,ge){if(a||!fe.ok)return!1;let Re=jl(U.rendered.svg);return n=U,r.replaceWith(Re),r=Re,ge&&(M.dataset.mode=ge),o!==void 0&&ie(),m.rebind(fe),V(),G(),K(),!0},freeze(U){i=U,m.pause(),m.active=!1,M.classList.add("frozen"),K()},dispose(){a=!0,Ze?.disconnect(),Kr.delete(M),m.dispose(),M.remove(),Il()}}}var ga=`
253
+ .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}
254
+ .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}
255
+ .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}
256
+ .iso-play [hidden]{display:none}
257
+ .iso-play-stage svg{display:block;width:100%;height:auto}
258
+ .iso-play-stage [data-go]{cursor:pointer}
259
+ .iso-play-row{display:flex;align-items:center;gap:6px;padding:8px 12px 4px}
260
+ .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}
261
+ .iso-play-btn:hover{border-color:var(--ip-muted)}
262
+ .iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}
263
+ .iso-play-btn.ambient[aria-pressed="false"]{color:var(--ip-muted);text-decoration:line-through}
264
+ .iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}
265
+ .iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
266
+ .iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}
267
+ .iso-play-group{display:inline-flex;gap:0}
268
+ .iso-play-dot{width:24px;height:24px;padding:0;border:0;background:none;cursor:pointer;display:grid;place-items:center}
269
+ .iso-play-dot::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--ip-line)}
270
+ .iso-play-dot.done::before{background:var(--ip-muted)}
271
+ .iso-play-dot.on::before{background:var(--ip-ink);width:11px;height:11px}
272
+ .iso-play-say{padding:4px 12px 10px;min-height:5.2em}
273
+ .iso-play-head{display:flex;align-items:baseline;gap:8px;font-weight:700}
274
+ .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}
275
+ .iso-play-chapter,.iso-play-count{color:var(--ip-muted);font-size:12px;font-weight:500}
276
+ .iso-play-count{margin-left:auto;white-space:nowrap}
277
+ .iso-play-text{max-width:80ch}
278
+ .iso-play-text a{color:inherit}
279
+ .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}
280
+ .iso-play-facts{display:flex;flex-wrap:wrap;gap:2px 16px;margin:6px 0 0;font-size:12px}
281
+ .iso-play-facts dt{color:var(--ip-muted)}
282
+ .iso-play-facts dd{margin:0 8px 0 -10px;font-weight:600}
283
+ .iso-play-list{padding:0 12px 10px;font-size:13px}
284
+ .iso-play-list summary{color:var(--ip-muted);cursor:pointer}
285
+ .iso-play.frozen>:not(.iso-play-stage){display:none}
286
+ @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}}
287
+ `;var Cl=`# The default theme: the tokens of the reference pages, verbatim.
288
+ # A theme is data. Every key becomes a CSS custom property (--key) for its mode.
289
+ name: default
290
+
291
+ light:
292
+ bg: "#f5f4ef"
293
+ surface: "#ffffff"
294
+ ink: "#1c1c1f"
295
+ muted: "#66666d"
296
+ line: "#dcd8ce"
297
+ code-bg: "#f0eee7"
298
+ on: "#ffffff" # text on a coloured step number or badge
299
+ # lightness of each block face; hue and saturation come from the node's role
300
+ l-top: 80%
301
+ l-left: 64%
302
+ l-right: 52%
303
+ l-edge: 30%
304
+ slab-top: "#e3dfd4"
305
+ slab-l: "#c9c3b4"
306
+ slab-r: "#b3ac9c"
307
+ pad-top: "#dfe3ea"
308
+ fence-text: "hsl(38 85% 32%)"
309
+ tunnel-text: "hsl(205 80% 32%)"
310
+ # flow kinds
311
+ send: "#2a64d6"
312
+ reply: "#14946a"
313
+ user: "#8446d0"
314
+ token: "#c9820a"
315
+ blocked: "#c8433a"
316
+ control: "#55565e"
317
+ event: "#c2317f"
318
+
319
+ dark:
320
+ bg: "#131316"
321
+ surface: "#1c1c20"
322
+ ink: "#ececf0"
323
+ muted: "#9d9da6"
324
+ line: "#33333a"
325
+ code-bg: "#24242a"
326
+ on: "#111111"
327
+ l-top: 44%
328
+ l-left: 32%
329
+ l-right: 24%
330
+ l-edge: 62%
331
+ slab-top: "#26262c"
332
+ slab-l: "#1d1d22"
333
+ slab-r: "#17171b"
334
+ pad-top: "#22252c"
335
+ fence-text: "hsl(38 90% 62%)"
336
+ tunnel-text: "hsl(205 80% 72%)"
337
+ send: "#6e9bff"
338
+ reply: "#3fcf98"
339
+ user: "#b58bff"
340
+ token: "#f2b33d"
341
+ blocked: "#ff7a6e"
342
+ control: "#b5b6bf"
343
+ event: "#ff86c8"
344
+
345
+ # Flow kinds: colour token, line style, legend text. Files may add more with \`kinds:\`.
346
+ kinds:
347
+ send: { color: send, dash: solid, legend: Message sent }
348
+ reply: { color: reply, dash: solid, legend: Reply or answer }
349
+ user: { color: user, dash: solid, legend: The human }
350
+ token: { color: token, dash: dashed, legend: Token, placeholder or swap }
351
+ blocked: { color: blocked, dash: dotted, legend: Blocked or refused }
352
+ control: { color: control, dash: solid, legend: Setup or control }
353
+ event: { color: event, dash: solid, legend: Wake or event }
354
+ planned: { color: token, dash: dashed, legend: Not built }
355
+
356
+ # Colour roles for nodes and regions: hue and saturation; lightness comes from the face.
357
+ # \`top\` replaces the top face colour; \`tint\` mixes the role colour into pad-top for the top face.
358
+ roles:
359
+ slab: { h: 40, s: 10 }
360
+ pad: { h: 220, s: 12 }
361
+ lead: { h: 218, s: 62 }
362
+ work: { h: 150, s: 45 }
363
+ doz: { h: 228, s: 8 }
364
+ chat: { h: 170, s: 48 }
365
+ mail: { h: 170, s: 48 }
366
+ file: { h: 40, s: 28 }
367
+ folder: { h: 38, s: 35 }
368
+ key: { h: 46, s: 78 }
369
+ gate: { h: 28, s: 85 }
370
+ cloud: { h: 200, s: 50 }
371
+ event: { h: 325, s: 58 }
372
+ placeholder: { h: 38, s: 70 }
373
+ term: { h: 275, s: 35 }
374
+ socket: { h: 205, s: 35 }
375
+ fence: { h: 38, s: 80 }
376
+ sandbox: { h: 170, s: 30, tint: 18 }
377
+ server: { h: 205, s: 22, tint: 13 }
378
+ belt: { h: 38, s: 55, tint: 20 }
379
+ bot: { h: 328, s: 55 }
380
+ cursor: { h: 228, s: 8 }
381
+ grey: { h: 228, s: 8 }
382
+ violet: { h: 250, s: 52 }
383
+ blue: { h: 218, s: 62 }
384
+ green: { h: 150, s: 45 }
385
+ person: { h: 275, s: 35 }
386
+ `;var kf=":host{display:block}:host([hidden]){display:none}.iso-play-problem{margin:0;padding:10px 12px;border:1px solid #c9463d;border-radius:8px;color:#c9463d;font:13px/1.5 system-ui,sans-serif;white-space:pre-wrap}",Ll,xf=typeof HTMLElement=="function"?HTMLElement:class{},ba=class extends xf{static observedAttributes=["ambient","autoplay","controls","label","loop","mode","rate","reduced-motion","scene","treatment"];#a;#o;#n;#e;#r;#i=!1;#l=!1;#s;get source(){return this.#a??$f(this.querySelector('script[type="text/yaml"],script[type="application/yaml"]')?.textContent??this.textContent??"")}set source(e){this.#a=e,this.#t()}get theme(){return this.#o??Cl}set theme(e){this.#o=e,this.#t()}get motion(){return this.#n}set motion(e){this.#n=e,this.#t()}get transport(){return this.#e?.transport}connectedCallback(){this.#r??=this.attachShadow({mode:"open"}),Ll??=(()=>{let e=new CSSStyleSheet;return e.replaceSync(ga+kf),e})(),this.#r.adoptedStyleSheets=[Ll],this.#s=matchMedia("(prefers-color-scheme: dark)"),this.#s.addEventListener("change",this.#t),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t()}disconnectedCallback(){this.#s?.removeEventListener("change",this.#t),document.removeEventListener("DOMContentLoaded",this.#t),this.#e?.dispose(),this.#e=void 0}attributeChangedCallback(e,n,r){let i=this.#e?.transport;if(n!==r){if(!i){this.#t();return}e==="loop"?i.loop=r!==null:e==="rate"?i.rate=_l(r):e==="ambient"?i.ambient=r===null?i.timeline.ambient==="on":r!=="off":(e!=="mode"&&e!=="scene"&&e!=="treatment"&&(this.#e.dispose(),this.#e=void 0),this.#t())}}#t=()=>{this.#i||!this.isConnected||(this.#i=!0,queueMicrotask(()=>{this.#i=!1,this.isConnected&&this.#p()}))};#p(){let e=this.#r,n=this.#c(),r;try{r=Sf(this.source,this.theme,n,this.getAttribute("scene"),this.#n,this.getAttribute("treatment"))}catch(m){this.#e?.dispose(),this.#e=void 0;let c=document.createElement("p");c.className="iso-play-problem",c.setAttribute("role","alert"),c.textContent=m.message,e.replaceChildren(c),this.dispatchEvent(new CustomEvent("isometric-error",{detail:m.message}));return}if(this.#e&&this.#l!==r.steps&&(this.#e.dispose(),this.#e=void 0),this.#l=r.steps,this.#e){this.#e.set(r.s,r.tl,n);return}e.replaceChildren();let i=this.getAttribute("autoplay"),o=vf(this.hasAttribute("links")?location.hash:"",r.tl);this.#e=ya(e,{scene:r.s,timeline:r.tl,mode:n,steps:r.steps,label:this.getAttribute("label")??r.s.raw.title??r.c.doc?.title,controls:this.hasAttribute("controls"),loop:this.hasAttribute("loop"),rate:_l(this.getAttribute("rate")),autoplay:o?!1:i==="visible"?"visible":i!==null,...this.getAttribute("ambient")===null?{}:{ambient:this.getAttribute("ambient")==="off"?"off":"on"},reducedMotion:this.getAttribute("reduced-motion")==="respect"?"respect":"ignore"});let t=this.#e.transport,a=(m,c)=>this.dispatchEvent(new CustomEvent(m,{detail:c}));t.on("beat",(m,c)=>a("beat",{beat:m,how:c}));for(let m of["play","pause","end","loop"])t.on(m,()=>a(m));o&&(o.still?this.#e.freeze(o.at):t.seek(o.at)),a("isometric-ready")}#c(){let e=this.getAttribute("mode");return e==="light"||e==="dark"?e:this.#s?.matches?"dark":"light"}},_l=s=>{let e=Number(s??1);return Number.isFinite(e)&&e>0?e:1};function $f(s){let e=s.replace(/^[ \t]*\r?\n/,"").replace(/\s+$/,"").split(/\r?\n/),n=Math.min(...e.filter(r=>r.trim()).map(r=>/^ */.exec(r)[0].length));return Number.isFinite(n)?e.map(r=>r.slice(n)).join(`
387
+ `)+`
388
+ `:""}function Sf(s,e,n,r,i,o){if(!s.trim())throw new Error("no drawing: its text goes in the element, or in its source");if(o!==null&&o!=="mono"&&o!=="none")throw new Error(`no treatment "${o}" (there is mono, and none)`);let t=Tl(s,e,{mode:n,resolveVars:!0,strict:"throw",...o?{treatment:o}:{}}),a=r===null?t.scenes[0]:t.scenes.find(l=>l.id===r);if(!a)throw new Error(r===null?"no scene in it":`no scene "${r}" (there ${t.scenes.length===1?"is":"are"} ${t.scenes.map(l=>l.id).join(", ")})`);let m=i??a.motion??(a.steps.steps.length?Al(a):void 0),c=m&&Br(a,m,{kinds:t.theme.kinds});if(c&&!c.ok)throw new Error(c.diags.map(l=>`${l.path}: ${l.message}${l.hint?` (${l.hint})`:""}`).join(`
389
+ `));return{c:t,s:a,tl:c,steps:!i&&!a.motion}}function vf(s,e){let n=Number(/[#&]step=(\d+)/.exec(s)?.[1]??0),r=/[#&]still\b/.test(s),i=/[#&]t=([\d.]+)/.exec(s)?.[1];if(!e||!n&&!r&&i===void 0)return;let o=e.beats[Math.min(e.beats.length,Math.max(1,n))-1],t=Math.max(0,Math.min(1,i===void 0?r?.6:0:Number(i)||0)),a=o?.start??0,m=o?.end??e.duration;return{at:a+Math.max(0,Math.min(m-a-(m<e.duration?1:0),(m-a)*t)),still:r}}typeof customElements<"u"&&!customElements.get("isometric-diagram")&&customElements.define("isometric-diagram",ba);export{ba as IsometricDiagram,ga as PLAY_CSS,ya as mountPlayer};