house-lights 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
// GENERATED by tools/assets.mjs (way engine v0.259.0). Do not edit.
|
|
2
2
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
`)}};ht.defaultYaml={explicit:!1,version:"1.2"};ht.defaultTags={"!!":"tag:yaml.org,2002:"};
|
|
3
|
+
var lc=Object.create;var pi=Object.defineProperty;var cc=Object.getOwnPropertyDescriptor;var fc=Object.getOwnPropertyNames;var uc=Object.getPrototypeOf,dc=Object.prototype.hasOwnProperty;var en=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var pc=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of fc(t))!dc.call(e,r)&&r!==n&&pi(e,r,{get:()=>t[r],enumerable:!(s=cc(t,r))||s.enumerable});return e};var ys=(e,t,n)=>(n=e!=null?lc(uc(e)):{},pc(t||!e||!e.__esModule?pi(n,"default",{value:e,enumerable:!0}):n,e));var U=M(te=>{"use strict";var ks=Symbol.for("yaml.alias"),ki=Symbol.for("yaml.document"),nn=Symbol.for("yaml.map"),$i=Symbol.for("yaml.pair"),$s=Symbol.for("yaml.scalar"),sn=Symbol.for("yaml.seq"),Se=Symbol.for("yaml.node.type"),Oc=e=>!!e&&typeof e=="object"&&e[Se]===ks,Ac=e=>!!e&&typeof e=="object"&&e[Se]===ki,Nc=e=>!!e&&typeof e=="object"&&e[Se]===nn,Ec=e=>!!e&&typeof e=="object"&&e[Se]===$i,vi=e=>!!e&&typeof e=="object"&&e[Se]===$s,xc=e=>!!e&&typeof e=="object"&&e[Se]===sn;function Si(e){if(e&&typeof e=="object")switch(e[Se]){case nn:case sn:return!0}return!1}function Cc(e){if(e&&typeof e=="object")switch(e[Se]){case ks:case nn:case $s:case sn:return!0}return!1}var Tc=e=>(vi(e)||Si(e))&&!!e.anchor;te.ALIAS=ks;te.DOC=ki;te.MAP=nn;te.NODE_TYPE=Se;te.PAIR=$i;te.SCALAR=$s;te.SEQ=sn;te.hasAnchor=Tc;te.isAlias=Oc;te.isCollection=Si;te.isDocument=Ac;te.isMap=Nc;te.isNode=Cc;te.isPair=Ec;te.isScalar=vi;te.isSeq=xc});var pt=M(vs=>{"use strict";var Z=U(),ce=Symbol("break visit"),Oi=Symbol("skip children"),be=Symbol("remove node");function rn(e,t){let n=Ai(t);Z.isDocument(e)?Je(null,e.contents,n,Object.freeze([e]))===be&&(e.contents=null):Je(null,e,n,Object.freeze([]))}rn.BREAK=ce;rn.SKIP=Oi;rn.REMOVE=be;function Je(e,t,n,s){let r=Ni(e,t,n,s);if(Z.isNode(r)||Z.isPair(r))return Ei(e,s,r),Je(e,r,n,s);if(typeof r!="symbol"){if(Z.isCollection(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){let o=Je(i,t.items[i],n,s);if(typeof o=="number")i=o-1;else{if(o===ce)return ce;o===be&&(t.items.splice(i,1),i-=1)}}}else if(Z.isPair(t)){s=Object.freeze(s.concat(t));let i=Je("key",t.key,n,s);if(i===ce)return ce;i===be&&(t.key=null);let o=Je("value",t.value,n,s);if(o===ce)return ce;o===be&&(t.value=null)}}return r}async function on(e,t){let n=Ai(t);Z.isDocument(e)?await Ge(null,e.contents,n,Object.freeze([e]))===be&&(e.contents=null):await Ge(null,e,n,Object.freeze([]))}on.BREAK=ce;on.SKIP=Oi;on.REMOVE=be;async function Ge(e,t,n,s){let r=await Ni(e,t,n,s);if(Z.isNode(r)||Z.isPair(r))return Ei(e,s,r),Ge(e,r,n,s);if(typeof r!="symbol"){if(Z.isCollection(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){let o=await Ge(i,t.items[i],n,s);if(typeof o=="number")i=o-1;else{if(o===ce)return ce;o===be&&(t.items.splice(i,1),i-=1)}}}else if(Z.isPair(t)){s=Object.freeze(s.concat(t));let i=await Ge("key",t.key,n,s);if(i===ce)return ce;i===be&&(t.key=null);let o=await Ge("value",t.value,n,s);if(o===ce)return ce;o===be&&(t.value=null)}}return r}function Ai(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ni(e,t,n,s){if(typeof n=="function")return n(e,t,s);if(Z.isMap(t))return n.Map?.(e,t,s);if(Z.isSeq(t))return n.Seq?.(e,t,s);if(Z.isPair(t))return n.Pair?.(e,t,s);if(Z.isScalar(t))return n.Scalar?.(e,t,s);if(Z.isAlias(t))return n.Alias?.(e,t,s)}function Ei(e,t,n){let s=t[t.length-1];if(Z.isCollection(s))s.items[e]=n;else if(Z.isPair(s))e==="key"?s.key=n:s.value=n;else if(Z.isDocument(s))s.contents=n;else{let r=Z.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}vs.visit=rn;vs.visitAsync=on});var Ss=M(Ci=>{"use strict";var xi=U(),qc=pt(),Mc={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Lc=e=>e.replace(/[!,[\]{}]/g,t=>Mc[t]),ht=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let s=t.trim().split(/[ \t]+/),r=s.shift();switch(r){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[i,o]=s;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[i]=s;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let o=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let i=this.tags[s];if(i)try{return i+decodeURIComponent(r)}catch(o){return n(String(o)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+Lc(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),r;if(t&&s.length>0&&xi.isNode(t.contents)){let i={};qc.visit(t.contents,(o,a)=>{xi.isNode(a)&&a.tag&&(i[a.tag]=!0)}),r=Object.keys(i)}else r=[];for(let[i,o]of s)i==="!!"&&o==="tag:yaml.org,2002:"||(!t||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${i} ${o}`);return n.join(`
|
|
4
|
+
`)}};ht.defaultYaml={explicit:!1,version:"1.2"};ht.defaultTags={"!!":"tag:yaml.org,2002:"};Ci.Directives=ht});var an=M(mt=>{"use strict";var Ti=U(),Pc=pt();function Ic(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function qi(e){let t=new Set;return Pc.visit(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function Mi(e,t){for(let n=1;;++n){let s=`${e}${n}`;if(!t.has(s))return s}}function Rc(e,t){let n=[],s=new Map,r=null;return{onAnchor:i=>{n.push(i),r??(r=qi(e));let o=Mi(t,r);return r.add(o),o},setAnchors:()=>{for(let i of n){let o=s.get(i);if(typeof o=="object"&&o.anchor&&(Ti.isScalar(o.node)||Ti.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:s}}mt.anchorIsValid=Ic;mt.anchorNames=qi;mt.createNodeAnchors=Rc;mt.findNewAnchor=Mi});var Os=M(Li=>{"use strict";function gt(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let r=0,i=s.length;r<i;++r){let o=s[r],a=gt(e,s,String(r),o);a===void 0?delete s[r]:a!==o&&(s[r]=a)}else if(s instanceof Map)for(let r of Array.from(s.keys())){let i=s.get(r),o=gt(e,s,r,i);o===void 0?s.delete(r):o!==i&&s.set(r,o)}else if(s instanceof Set)for(let r of Array.from(s)){let i=gt(e,s,r,r);i===void 0?s.delete(r):i!==r&&(s.delete(r),s.add(i))}else for(let[r,i]of Object.entries(s)){let o=gt(e,s,r,i);o===void 0?delete s[r]:o!==i&&(s[r]=o)}return e.call(t,n,s)}Li.applyReviver=gt});var xe=M(Ii=>{"use strict";var Fc=U();function Pi(e,t,n){if(Array.isArray(e))return e.map((s,r)=>Pi(s,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!Fc.hasAnchor(e))return e.toJSON(t,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=i=>{s.res=i,delete n.onCreate};let r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!n?.keep?Number(e):e}Ii.toJS=Pi});var ln=M(Fi=>{"use strict";var Dc=Os(),Ri=U(),jc=xe(),As=class{constructor(t){Object.defineProperty(this,Ri.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:s,onAnchor:r,reviver:i}={}){if(!Ri.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=jc.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:f}of o.anchors.values())r(f,c);return typeof i=="function"?Dc.applyReviver(i,{"":a},"",a):a}};Fi.NodeBase=As});var yt=M(Di=>{"use strict";var _c=an(),Bc=pt(),He=U(),Kc=ln(),Uc=xe(),Ns=class extends Kc.NodeBase{constructor(t){super(He.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let s;n?.aliasResolveCache?s=n.aliasResolveCache:(s=[],Bc.visit(t,{Node:(i,o)=>{(He.isAlias(o)||He.hasAnchor(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let r;for(let i of s){if(i===this)break;i.anchor===this.source&&(r=i)}if(r&&n){let{anchors:i,doc:o,maxAliasCount:a}=n,c=i.get(r);if(c||(Uc.toJS(r,null,n),c=i.get(r)),c?.res===void 0){let f="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(f)}if(a>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=cn(o,r,i)),c.count*c.aliasCount>a)){let f="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(f)}}return r}toJSON(t,n){if(!n)return{source:this.source};let s=this.resolve(n.doc,n);if(!s){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(r)}return n.anchors.get(s).res}toString(t,n,s){let r=`*${this.source}`;if(t){if(_c.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(t.implicitKey)return`${r} `}return r}};function cn(e,t,n){if(He.isAlias(t)){let s=t.resolve(e),r=n&&s&&n.get(s);return r?r.count*r.aliasCount:0}else if(He.isCollection(t)){let s=0;for(let r of t.items){let i=cn(e,r,n);i>s&&(s=i)}return s}else if(He.isPair(t)){let s=cn(e,t.key,n),r=cn(e,t.value,n);return Math.max(s,r)}return 1}Di.Alias=Ns});var Q=M(Es=>{"use strict";var Yc=U(),zc=ln(),Wc=xe(),Vc=e=>!e||typeof e!="function"&&typeof e!="object",Ce=class extends zc.NodeBase{constructor(t){super(Yc.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:Wc.toJS(this.value,t,n)}toString(){return String(this.value)}};Ce.BLOCK_FOLDED="BLOCK_FOLDED";Ce.BLOCK_LITERAL="BLOCK_LITERAL";Ce.PLAIN="PLAIN";Ce.QUOTE_DOUBLE="QUOTE_DOUBLE";Ce.QUOTE_SINGLE="QUOTE_SINGLE";Es.Scalar=Ce;Es.isScalarValue=Vc});var bt=M(_i=>{"use strict";var Jc=yt(),_e=U(),ji=Q(),Gc="tag:yaml.org,2002:";function Hc(e,t,n){if(t){let s=n.filter(i=>i.tag===t),r=s.find(i=>!i.format)??s[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(s=>s.identify?.(e)&&!s.format)}function Xc(e,t,n){if(_e.isDocument(e)&&(e=e.contents),_e.isNode(e))return e;if(_e.isPair(e)){let u=n.schema[_e.MAP].createNode?.(n.schema,null,n);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:r,onTagObj:i,schema:o,sourceObjects:a}=n,c;if(s&&e&&typeof e=="object"){if(c=a.get(e),c)return c.anchor??(c.anchor=r(e)),new Jc.Alias(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=Gc+t.slice(2));let f=Hc(e,t,o.tags);if(!f){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new ji.Scalar(e);return c&&(c.node=u),u}f=e instanceof Map?o[_e.MAP]:Symbol.iterator in Object(e)?o[_e.SEQ]:o[_e.MAP]}i&&(i(f),delete n.onTagObj);let m=f?.createNode?f.createNode(n.schema,e,n):typeof f?.nodeClass?.from=="function"?f.nodeClass.from(n.schema,e,n):new ji.Scalar(e);return t?m.tag=t:f.default||(m.tag=f.tag),c&&(c.node=m),m}_i.createNode=Xc});var un=M(fn=>{"use strict";var Qc=bt(),we=U(),Zc=ln();function xs(e,t,n){let s=n;for(let r=t.length-1;r>=0;--r){let i=t[r];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=s,s=o}else s=new Map([[i,s]])}return Qc.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Bi=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Cs=class extends Zc.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(s=>we.isNode(s)||we.isPair(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Bi(t))this.add(n);else{let[s,...r]=t,i=this.get(s,!0);if(we.isCollection(i))i.addIn(r,n);else if(i===void 0&&this.schema)this.set(s,xs(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}deleteIn(t){let[n,...s]=t;if(s.length===0)return this.delete(n);let r=this.get(n,!0);if(we.isCollection(r))return r.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){let[s,...r]=t,i=this.get(s,!0);return r.length===0?!n&&we.isScalar(i)?i.value:i:we.isCollection(i)?i.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!we.isPair(n))return!1;let s=n.value;return s==null||t&&we.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){let[n,...s]=t;if(s.length===0)return this.has(n);let r=this.get(n,!0);return we.isCollection(r)?r.hasIn(s):!1}setIn(t,n){let[s,...r]=t;if(r.length===0)this.set(s,n);else{let i=this.get(s,!0);if(we.isCollection(i))i.setIn(r,n);else if(i===void 0&&this.schema)this.set(s,xs(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}};fn.Collection=Cs;fn.collectionFromPath=xs;fn.isEmptyPath=Bi});var wt=M(dn=>{"use strict";var ef=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Ts(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var tf=(e,t,n)=>e.endsWith(`
|
|
5
5
|
`)?Ts(n,t):n.includes(`
|
|
6
6
|
`)?`
|
|
7
|
-
`+Ts(n,t):(e.endsWith(" ")?"":" ")+n;dn.indentComment=Ts;dn.lineComment=
|
|
8
|
-
`)n===qs&&(h=
|
|
7
|
+
`+Ts(n,t):(e.endsWith(" ")?"":" ")+n;dn.indentComment=Ts;dn.lineComment=tf;dn.stringifyComment=ef});var Ui=M(kt=>{"use strict";var nf="flow",qs="block",pn="quoted";function sf(e,t,n="flow",{indentAtStart:s,lineWidth:r=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return e;r<i&&(i=0);let c=Math.max(1+i,1+r-t.length);if(e.length<=c)return e;let f=[],m={},u=r-t.length;typeof s=="number"&&(s>r-Math.max(2,i)?f.push(0):u=r-s);let l,p,d=!1,h=-1,y=-1,w=-1;n===qs&&(h=Ki(e,h,t.length),h!==-1&&(u=h+c));for(let O;O=e[h+=1];){if(n===pn&&O==="\\"){switch(y=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(O===`
|
|
8
|
+
`)n===qs&&(h=Ki(e,h,t.length)),u=h+t.length+c,l=void 0;else{if(O===" "&&p&&p!==" "&&p!==`
|
|
9
9
|
`&&p!==" "){let E=e[h+1];E&&E!==" "&&E!==`
|
|
10
10
|
`&&E!==" "&&(l=h)}if(h>=u)if(l)f.push(l),u=l+c,l=void 0;else if(n===pn){for(;p===" "||p===" ";)p=O,O=e[h+=1],d=!0;let E=h>w+1?h-2:y-1;if(m[E])return e;f.push(E),m[E]=!0,u=E+c,l=void 0}else d=!0}p=O}if(d&&a&&a(),f.length===0)return e;o&&o();let v=e.slice(0,f[0]);for(let O=0;O<f.length;++O){let E=f[O],S=f[O+1]||e.length;E===0?v=`
|
|
11
11
|
${t}${e.slice(0,S)}`:(n===pn&&m[E]&&(v+=`${e[E]}\\`),v+=`
|
|
12
|
-
${t}${e.slice(E+1,S)}`)}return v}function
|
|
13
|
-
`);s=t,
|
|
14
|
-
`){if(
|
|
12
|
+
${t}${e.slice(E+1,S)}`)}return v}function Ki(e,t,n){let s=t,r=t+1,i=e[r];for(;i===" "||i===" ";)if(t<r+n)i=e[++t];else{do i=e[++t];while(i&&i!==`
|
|
13
|
+
`);s=t,r=t+1,i=e[r]}return s}kt.FOLD_BLOCK=qs;kt.FOLD_FLOW=nf;kt.FOLD_QUOTED=pn;kt.foldFlowLines=sf});var vt=M(Yi=>{"use strict";var me=Q(),Te=Ui(),mn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),gn=e=>/^(%|---|\.\.\.)/m.test(e);function rf(e,t,n){if(!t||t<0)return!1;let s=t-n,r=e.length;if(r<=s)return!1;for(let i=0,o=0;i<r;++i)if(e[i]===`
|
|
14
|
+
`){if(i-o>s)return!0;if(o=i+1,r-o<=s)return!1}return!0}function $t(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=t,r=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(gn(e)?" ":""),o="",a=0;for(let c=0,f=n[c];f;f=n[++c])if(f===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,f="\\"),f==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let m=n.substr(c+2,4);switch(m){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:m.substr(0,2)==="00"?o+="\\x"+m.substr(2):o+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(s||n[c+2]==='"'||n.length<r)c+=1;else{for(o+=n.slice(a,c)+`
|
|
15
15
|
|
|
16
16
|
`;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
|
|
17
|
-
`,c+=2;o+=
|
|
17
|
+
`,c+=2;o+=i,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,s?o:Te.foldFlowLines(o,i,Te.FOLD_QUOTED,mn(t,!1))}function Ms(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
18
|
`)||/[ \t]\n|\n[ \t]/.test(e))return $t(e,t);let n=t.indent||(gn(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
-
${n}`)+"'";return t.implicitKey?s:Te.foldFlowLines(s,n,Te.FOLD_FLOW,mn(t,!1))}function Xe(e,t){let{singleQuote:n}=t.options,s;if(n===!1)s=$t;else{let
|
|
19
|
+
${n}`)+"'";return t.implicitKey?s:Te.foldFlowLines(s,n,Te.FOLD_FLOW,mn(t,!1))}function Xe(e,t){let{singleQuote:n}=t.options,s;if(n===!1)s=$t;else{let r=e.includes('"'),i=e.includes("'");r&&!i?s=Ms:i&&!r?s=$t:s=n?Ms:$t}return s(e,t)}var Ls;try{Ls=new RegExp(`(^|(?<!
|
|
20
20
|
))
|
|
21
21
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{Ls=/\n+(?!\n|$)/g}function hn({comment:e,type:t,value:n},s,i
|
|
22
|
+
|$)`,"g")}catch{Ls=/\n+(?!\n|$)/g}function hn({comment:e,type:t,value:n},s,r,i){let{blockQuote:o,commentString:a,lineWidth:c}=s.options;if(!o||/\n[\t ]+$/.test(n))return Xe(n,s);let f=s.indent||(s.forceBlockIndent||gn(n)?" ":""),m=o==="literal"?!0:o==="folded"||t===me.Scalar.BLOCK_FOLDED?!1:t===me.Scalar.BLOCK_LITERAL?!0:!rf(n,c,f.length);if(!n)return m?`|
|
|
23
23
|
`:`>
|
|
24
24
|
`;let u,l;for(l=n.length;l>0;--l){let S=n[l-1];if(S!==`
|
|
25
25
|
`&&S!==" "&&S!==" ")break}let p=n.substring(l),d=p.indexOf(`
|
|
26
|
-
`);d===-1?u="-":n===p||d!==p.length-1?(u="+",
|
|
26
|
+
`);d===-1?u="-":n===p||d!==p.length-1?(u="+",i&&i()):u="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
27
27
|
`&&(p=p.slice(0,-1)),p=p.replace(Ls,`$&${f}`));let h=!1,y,w=-1;for(y=0;y<n.length;++y){let S=n[y];if(S===" ")h=!0;else if(S===`
|
|
28
|
-
`)w=y;else break}let v=n.substring(0,w<y?w+1:y);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${f}`));let E=(h?f?"2":"1":"")+u;if(e&&(E+=" "+a(e.replace(/ ?[\r\n]+/g," ")),
|
|
28
|
+
`)w=y;else break}let v=n.substring(0,w<y?w+1:y);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${f}`));let E=(h?f?"2":"1":"")+u;if(e&&(E+=" "+a(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!m){let S=n.replace(/\n+/g,`
|
|
29
29
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${f}`),C=!1,q=mn(s,!0);o!=="folded"&&t!==me.Scalar.BLOCK_FOLDED&&(q.onOverflow=()=>{C=!0});let x=Te.foldFlowLines(`${v}${S}${p}`,f,Te.FOLD_BLOCK,q);if(!C)return`>${E}
|
|
30
30
|
${f}${x}`}return n=n.replace(/\n+/g,`$&${f}`),`|${E}
|
|
31
|
-
${f}${v}${n}${p}`}function
|
|
32
|
-
`)||m&&/[[\]{},]/.test(
|
|
33
|
-
`)?Xe(
|
|
34
|
-
`))return hn(e,t,n,s);if(gn(
|
|
35
|
-
${c}`);if(o){let l=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:d}=t.doc.schema;if(d.some(l)||p?.some(l))return Xe(
|
|
36
|
-
${t.indent}${a}`:a}
|
|
37
|
-
${a}:`):(y=`${y}:`,l&&(y+=Ot.lineComment(y,n.indent,f(l))));let w,v,O;Oe.isNode(t)?(w=!!t.spaceBefore,v=t.commentBefore,O=t.comment):(w=!1,v=null,O=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!l&&Oe.isScalar(t)&&(n.indentAtStart=y.length+1),h=!1,!m&&c.length>=2&&!n.inFlow&&!p&&Oe.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let E=!1,S=
|
|
31
|
+
${f}${v}${n}${p}`}function of(e,t,n,s){let{type:r,value:i}=e,{actualString:o,implicitKey:a,indent:c,indentStep:f,inFlow:m}=t;if(a&&i.includes(`
|
|
32
|
+
`)||m&&/[[\]{},]/.test(i))return Xe(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||m||!i.includes(`
|
|
33
|
+
`)?Xe(i,t):hn(e,t,n,s);if(!a&&!m&&r!==me.Scalar.PLAIN&&i.includes(`
|
|
34
|
+
`))return hn(e,t,n,s);if(gn(i)){if(c==="")return t.forceBlockIndent=!0,hn(e,t,n,s);if(a&&c===f)return Xe(i,t)}let u=i.replace(/\n+/g,`$&
|
|
35
|
+
${c}`);if(o){let l=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:d}=t.doc.schema;if(d.some(l)||p?.some(l))return Xe(i,t)}return a?u:Te.foldFlowLines(u,c,Te.FOLD_FLOW,mn(t,!1))}function af(e,t,n,s){let{implicitKey:r,inFlow:i}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==me.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=me.Scalar.QUOTE_DOUBLE);let c=m=>{switch(m){case me.Scalar.BLOCK_FOLDED:case me.Scalar.BLOCK_LITERAL:return r||i?Xe(o.value,t):hn(o,t,n,s);case me.Scalar.QUOTE_DOUBLE:return $t(o.value,t);case me.Scalar.QUOTE_SINGLE:return Ms(o.value,t);case me.Scalar.PLAIN:return of(o,t,n,s);default:return null}},f=c(a);if(f===null){let{defaultKeyType:m,defaultStringType:u}=t.options,l=r&&m||u;if(f=c(l),f===null)throw new Error(`Unsupported default string type ${l}`)}return f}Yi.stringifyString=af});var St=M(Ps=>{"use strict";var lf=an(),qe=U(),cf=wt(),ff=vt();function uf(e,t){let n=Object.assign({blockQuote:!0,commentString:cf.stringifyComment,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},e.schema.toStringOptions,t),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function df(e,t){if(t.tag){let r=e.filter(i=>i.tag===t.tag);if(r.length>0)return r.find(i=>i.format===t.format)??r[0]}let n,s;if(qe.isScalar(t)){s=t.value;let r=e.filter(i=>i.identify?.(s));if(r.length>1){let i=r.filter(o=>o.test);i.length>0&&(r=i)}n=r.find(i=>i.format===t.format)??r.find(i=>!i.format)}else s=t,n=e.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){let r=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function pf(e,t,{anchors:n,doc:s}){if(!s.directives)return"";let r=[],i=(qe.isScalar(e)||qe.isCollection(e))&&e.anchor;i&&lf.anchorIsValid(i)&&(n.add(i),r.push(`&${i}`));let o=e.tag??(t.default?null:t.tag);return o&&r.push(s.directives.tagString(o)),r.join(" ")}function hf(e,t,n,s){if(qe.isPair(e))return e.toString(t,n,s);if(qe.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,i=qe.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>r=c});r??(r=df(t.doc.schema.tags,i));let o=pf(i,r,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(i,t,n,s):qe.isScalar(i)?ff.stringifyString(i,t,n,s):i.toString(t,n,s);return o?qe.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
36
|
+
${t.indent}${a}`:a}Ps.createStringifyContext=uf;Ps.stringify=hf});var Ji=M(Vi=>{"use strict";var Oe=U(),zi=Q(),Wi=St(),Ot=wt();function mf({key:e,value:t},n,s,r){let{allNullValues:i,doc:o,indent:a,indentStep:c,options:{commentString:f,indentSeq:m,simpleKeys:u}}=n,l=Oe.isNode(e)&&e.comment||null;if(u){if(l)throw new Error("With simple keys, key nodes cannot have comments");if(Oe.isCollection(e)||!Oe.isNode(e)&&typeof e=="object"){let q="With simple keys, collection cannot be used as a key value";throw new Error(q)}}let p=!u&&(!e||l&&t==null&&!n.inFlow||Oe.isCollection(e)||(Oe.isScalar(e)?e.type===zi.Scalar.BLOCK_FOLDED||e.type===zi.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(u||!i),indent:a+c});let d=!1,h=!1,y=Wi.stringify(e,n,()=>d=!0,()=>h=!0);if(!p&&!n.inFlow&&y.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||t==null)return d&&s&&s(),y===""?"?":p?`? ${y}`:y}else if(i&&!u||t==null&&p)return y=`? ${y}`,l&&!d?y+=Ot.lineComment(y,n.indent,f(l)):h&&r&&r(),y;d&&(l=null),p?(l&&(y+=Ot.lineComment(y,n.indent,f(l))),y=`? ${y}
|
|
37
|
+
${a}:`):(y=`${y}:`,l&&(y+=Ot.lineComment(y,n.indent,f(l))));let w,v,O;Oe.isNode(t)?(w=!!t.spaceBefore,v=t.commentBefore,O=t.comment):(w=!1,v=null,O=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!l&&Oe.isScalar(t)&&(n.indentAtStart=y.length+1),h=!1,!m&&c.length>=2&&!n.inFlow&&!p&&Oe.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let E=!1,S=Wi.stringify(t,n,()=>E=!0,()=>h=!0),C=" ";if(l||w||v){if(C=w?`
|
|
38
38
|
`:"",v){let q=f(v);C+=`
|
|
39
39
|
${Ot.indentComment(q,n.indent)}`}S===""&&!n.inFlow?C===`
|
|
40
40
|
`&&O&&(C=`
|
|
@@ -43,34 +43,34 @@ ${Ot.indentComment(q,n.indent)}`}S===""&&!n.inFlow?C===`
|
|
|
43
43
|
${n.indent}`}else if(!p&&Oe.isCollection(t)){let q=S[0],x=S.indexOf(`
|
|
44
44
|
`),b=x!==-1,T=n.inFlow??t.flow??t.items.length===0;if(b||!T){let R=!1;if(b&&(q==="&"||q==="!")){let j=S.indexOf(" ");q==="&"&&j!==-1&&j<x&&S[j+1]==="!"&&(j=S.indexOf(" ",j+1)),(j===-1||x<j)&&(R=!0)}R||(C=`
|
|
45
45
|
${n.indent}`)}}else(S===""||S[0]===`
|
|
46
|
-
`)&&(C="");return y+=C+S,n.inFlow?E&&s&&s():O&&!E?y+=Ot.lineComment(y,n.indent,f(O)):h&&
|
|
46
|
+
`)&&(C="");return y+=C+S,n.inFlow?E&&s&&s():O&&!E?y+=Ot.lineComment(y,n.indent,f(O)):h&&r&&r(),y}Vi.stringifyPair=mf});var Rs=M(Is=>{"use strict";var Gi=en("process");function gf(e,...t){e==="debug"&&console.log(...t)}function yf(e,t){(e==="debug"||e==="warn")&&(typeof Gi.emitWarning=="function"?Gi.emitWarning(t):console.warn(t))}Is.debug=gf;Is.warn=yf});var $n=M(kn=>{"use strict";var wn=U(),Hi=Q(),yn="<<",bn={identify:e=>e===yn||typeof e=="symbol"&&e.description===yn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Hi.Scalar(Symbol(yn)),{addToJSMap:Xi}),stringify:()=>yn},bf=(e,t)=>(bn.identify(t)||wn.isScalar(t)&&(!t.type||t.type===Hi.Scalar.PLAIN)&&bn.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===bn.tag&&n.default);function Xi(e,t,n){let s=Qi(e,n);if(wn.isSeq(s))for(let r of s.items)Fs(e,t,r);else if(Array.isArray(s))for(let r of s)Fs(e,t,r);else Fs(e,t,s)}function Fs(e,t,n){let s=Qi(e,n);if(!wn.isMap(s))throw new Error("Merge sources must be maps or map aliases");let r=s.toJSON(null,e,Map);for(let[i,o]of r)t instanceof Map?t.has(i)||t.set(i,o):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Qi(e,t){return e&&wn.isAlias(t)?t.resolve(e.doc,e):t}kn.addMergeToJSMap=Xi;kn.isMergeKey=bf;kn.merge=bn});var js=M(to=>{"use strict";var wf=Rs(),Zi=$n(),kf=St(),eo=U(),Ds=xe();function $f(e,t,{key:n,value:s}){if(eo.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(Zi.isMergeKey(e,n))Zi.addMergeToJSMap(e,t,s);else{let r=Ds.toJS(n,"",e);if(t instanceof Map)t.set(r,Ds.toJS(s,r,e));else if(t instanceof Set)t.add(r);else{let i=vf(n,r,e),o=Ds.toJS(s,i,e);i in t?Object.defineProperty(t,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[i]=o}}return t}function vf(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(eo.isNode(e)&&n?.doc){let s=kf.createStringifyContext(n.doc,{});s.anchors=new Set;for(let i of n.anchors.keys())s.anchors.add(i.anchor);s.inFlow=!0,s.inStringifyKey=!0;let r=e.toString(s);if(!n.mapKeyWarned){let i=JSON.stringify(r);i.length>40&&(i=i.substring(0,36)+'..."'),wf.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}to.addPairToJSMap=$f});var Me=M(_s=>{"use strict";var no=bt(),Sf=Ji(),Of=js(),vn=U();function Af(e,t,n){let s=no.createNode(e,void 0,n),r=no.createNode(t,void 0,n);return new Sn(s,r)}var Sn=class e{constructor(t,n=null){Object.defineProperty(this,vn.NODE_TYPE,{value:vn.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return vn.isNode(n)&&(n=n.clone(t)),vn.isNode(s)&&(s=s.clone(t)),new e(n,s)}toJSON(t,n){let s=n?.mapAsMap?new Map:{};return Of.addPairToJSMap(n,s,this)}toString(t,n,s){return t?.doc?Sf.stringifyPair(this,t,n,s):JSON.stringify(this)}};_s.Pair=Sn;_s.createPair=Af});var Bs=M(ro=>{"use strict";var Be=U(),so=St(),On=wt();function Nf(e,t,n){return(t.inFlow??e.flow?xf:Ef)(e,t,n)}function Ef({comment:e,items:t},n,{blockItemPrefix:s,flowChars:r,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:f}}=n,m=Object.assign({},n,{indent:i,type:null}),u=!1,l=[];for(let d=0;d<t.length;++d){let h=t[d],y=null;if(Be.isNode(h))!u&&h.spaceBefore&&l.push(""),An(n,l,h.commentBefore,u),h.comment&&(y=h.comment);else if(Be.isPair(h)){let v=Be.isNode(h.key)?h.key:null;v&&(!u&&v.spaceBefore&&l.push(""),An(n,l,v.commentBefore,u))}u=!1;let w=so.stringify(h,m,()=>y=null,()=>u=!0);y&&(w+=On.lineComment(w,i,f(y))),u&&y&&(u=!1),l.push(s+w)}let p;if(l.length===0)p=r.start+r.end;else{p=l[0];for(let d=1;d<l.length;++d){let h=l[d];p+=h?`
|
|
47
47
|
${c}${h}`:`
|
|
48
48
|
`}}return e?(p+=`
|
|
49
|
-
`+On.indentComment(f(e),c),a&&a()):u&&o&&o(),p}function
|
|
49
|
+
`+On.indentComment(f(e),c),a&&a()):u&&o&&o(),p}function xf({items:e},t,{flowChars:n,itemIndent:s}){let{indent:r,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=t;s+=i;let c=Object.assign({},t,{indent:s,inFlow:!0,type:null}),f=!1,m=0,u=[];for(let d=0;d<e.length;++d){let h=e[d],y=null;if(Be.isNode(h))h.spaceBefore&&u.push(""),An(t,u,h.commentBefore,!1),h.comment&&(y=h.comment);else if(Be.isPair(h)){let v=Be.isNode(h.key)?h.key:null;v&&(v.spaceBefore&&u.push(""),An(t,u,v.commentBefore,!1),v.comment&&(f=!0));let O=Be.isNode(h.value)?h.value:null;O?(O.comment&&(y=O.comment),O.commentBefore&&(f=!0)):h.value==null&&v?.comment&&(y=v.comment)}y&&(f=!0);let w=so.stringify(h,c,()=>y=null);f||(f=u.length>m||w.includes(`
|
|
50
50
|
`)),d<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(f||(f=u.reduce((v,O)=>v+O.length+2,2)+(w.length+2)>t.options.lineWidth)),f&&(w+=",")),y&&(w+=On.lineComment(w,s,a(y))),u.push(w),m=u.length}let{start:l,end:p}=n;if(u.length===0)return l+p;if(!f){let d=u.reduce((h,y)=>h+y.length+2,2);f=t.options.lineWidth>0&&d>t.options.lineWidth}if(f){let d=l;for(let h of u)d+=h?`
|
|
51
|
-
${
|
|
51
|
+
${i}${r}${h}`:`
|
|
52
52
|
`;return`${d}
|
|
53
|
-
${
|
|
54
|
-
`:" ")}return
|
|
55
|
-
${
|
|
56
|
-
${r.comment}`:s.comment}s=i}e.items[n]=In.isPair(s)?s:new ei.Pair(s)}}else t("Expected a sequence for this tag");return e}function No(e,t,n){let{replacer:s}=n,i=new du.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(r++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let f=Object.keys(o);if(f.length===1)a=f[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${f.length} keys`)}else a=o;i.items.push(ei.createPair(a,c,n))}return i}var pu={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ao,createNode:No};Pn.createPairs=No;Pn.pairs=pu;Pn.resolvePairs=Ao});var si=M(ni=>{"use strict";var Eo=U(),ti=xe(),xt=Ie(),hu=Pe(),xo=Rn(),Ke=class e extends hu.YAMLSeq{constructor(){super(),this.add=xt.YAMLMap.prototype.add.bind(this),this.delete=xt.YAMLMap.prototype.delete.bind(this),this.get=xt.YAMLMap.prototype.get.bind(this),this.has=xt.YAMLMap.prototype.has.bind(this),this.set=xt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let s=new Map;n?.onCreate&&n.onCreate(s);for(let i of this.items){let r,o;if(Eo.isPair(i)?(r=ti.toJS(i.key,"",n),o=ti.toJS(i.value,r,n)):r=ti.toJS(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,n,s){let i=xo.createPairs(t,n,s),r=new this;return r.items=i.items,r}};Ke.tag="tag:yaml.org,2002:omap";var mu={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ke,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=xo.resolvePairs(e,t),s=[];for(let{key:i}of n.items)Eo.isScalar(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Ke,n)},createNode:(e,t,n)=>Ke.from(e,t,n)};ni.YAMLOMap=Ke;ni.omap=mu});var Lo=M(ii=>{"use strict";var Co=Q();function To({value:e,source:t},n){return t&&(e?qo:Mo).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var qo={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Co.Scalar(!0),stringify:To},Mo={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Co.Scalar(!1),stringify:To};ii.falseTag=Mo;ii.trueTag=qo});var Io=M(Fn=>{"use strict";var gu=Q(),ri=et(),yu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ri.stringifyNumber},bu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ri.stringifyNumber(e)}},wu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new gu.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:ri.stringifyNumber};Fn.float=wu;Fn.floatExp=bu;Fn.floatNaN=yu});var Ro=M(Tt=>{"use strict";var Po=et(),Ct=e=>typeof e=="bigint"||Number.isInteger(e);function Dn(e,t,n,{intAsBigInt:s}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return i==="-"?BigInt(-1)*o:o}let r=parseInt(e,n);return i==="-"?-1*r:r}function oi(e,t,n){let{value:s}=e;if(Ct(s)){let i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return Po.stringifyNumber(e)}var ku={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Dn(e,2,2,n),stringify:e=>oi(e,2,"0b")},$u={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Dn(e,1,8,n),stringify:e=>oi(e,8,"0")},vu={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Dn(e,0,10,n),stringify:Po.stringifyNumber},Su={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Dn(e,2,16,n),stringify:e=>oi(e,16,"0x")};Tt.int=vu;Tt.intBin=ku;Tt.intHex=Su;Tt.intOct=$u});var li=M(ai=>{"use strict";var Bn=U(),jn=Me(),_n=Ie(),Ue=class e extends _n.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Bn.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new jn.Pair(t.key,null):n=new jn.Pair(t,null),_n.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let s=_n.findPair(this.items,t);return!n&&Bn.isPair(s)?Bn.isScalar(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=_n.findPair(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new jn.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){let{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(jn.createPair(o,null,s));return r}};Ue.tag="tag:yaml.org,2002:set";var Ou={collection:"map",identify:e=>e instanceof Set,nodeClass:Ue,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Ue.from(e,t,n),resolve(e,t){if(Bn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ue,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};ai.YAMLSet=Ue;ai.set=Ou});var fi=M(Kn=>{"use strict";var Au=et();function ci(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*r:r}function Fo(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Au.stringifyNumber(e);let s="";t<0&&(s="-",t*=n(-1));let i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Nu={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>ci(e,n),stringify:Fo},Eu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>ci(e,!1),stringify:Fo},Do={identify:e=>e 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(e){let t=e.match(Do.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,f=Date.UTC(n,s-1,i,r||0,o||0,a||0,c),m=t[8];if(m&&m!=="Z"){let u=ci(m,!1);Math.abs(u)<30&&(u*=60),f-=6e4*u}return new Date(f)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Kn.floatTime=Eu;Kn.intTime=Nu;Kn.timestamp=Do});var Bo=M(_o=>{"use strict";var xu=Qe(),Cu=Cn(),Tu=Ze(),qu=Nt(),Mu=Zs(),jo=Lo(),ui=Io(),Un=Ro(),Lu=$n(),Iu=si(),Pu=Rn(),Ru=li(),di=fi(),Fu=[xu.map,Tu.seq,qu.string,Cu.nullTag,jo.trueTag,jo.falseTag,Un.intBin,Un.intOct,Un.int,Un.intHex,ui.floatNaN,ui.floatExp,ui.float,Mu.binary,Lu.merge,Iu.omap,Pu.pairs,Ru.set,di.intTime,di.floatTime,di.timestamp];_o.schema=Fu});var Xo=M(mi=>{"use strict";var zo=Qe(),Du=Cn(),Wo=Ze(),ju=Nt(),_u=zs(),pi=Vs(),hi=Gs(),Bu=ko(),Ku=So(),Vo=Zs(),qt=$n(),Jo=si(),Go=Rn(),Ko=Bo(),Ho=li(),Yn=fi(),Uo=new Map([["core",Bu.schema],["failsafe",[zo.map,Wo.seq,ju.string]],["json",Ku.schema],["yaml11",Ko.schema],["yaml-1.1",Ko.schema]]),Yo={binary:Vo.binary,bool:_u.boolTag,float:pi.float,floatExp:pi.floatExp,floatNaN:pi.floatNaN,floatTime:Yn.floatTime,int:hi.int,intHex:hi.intHex,intOct:hi.intOct,intTime:Yn.intTime,map:zo.map,merge:qt.merge,null:Du.nullTag,omap:Jo.omap,pairs:Go.pairs,seq:Wo.seq,set:Ho.set,timestamp:Yn.timestamp},Uu={"tag:yaml.org,2002:binary":Vo.binary,"tag:yaml.org,2002:merge":qt.merge,"tag:yaml.org,2002:omap":Jo.omap,"tag:yaml.org,2002:pairs":Go.pairs,"tag:yaml.org,2002:set":Ho.set,"tag:yaml.org,2002:timestamp":Yn.timestamp};function Yu(e,t,n){let s=Uo.get(t);if(s&&!e)return n&&!s.includes(qt.merge)?s.concat(qt.merge):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{let r=Array.from(Uo.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(qt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Yo[o]:o;if(!a){let c=JSON.stringify(o),f=Object.keys(Yo).map(m=>JSON.stringify(m)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${f}`)}return r.includes(a)||r.push(a),r},[])}mi.coreKnownTags=Uu;mi.getTags=Yu});var bi=M(Qo=>{"use strict";var gi=U(),zu=Qe(),Wu=Ze(),Vu=Nt(),zn=Xo(),Ju=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,yi=class e{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?zn.getTags(t,"compat"):t?zn.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?zn.coreKnownTags:{},this.tags=zn.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,gi.MAP,{value:zu.map}),Object.defineProperty(this,gi.SCALAR,{value:Vu.string}),Object.defineProperty(this,gi.SEQ,{value:Wu.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ju:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Qo.Schema=yi});var ea=M(Zo=>{"use strict";var Gu=U(),wi=St(),Mt=wt();function Hu(e,t){let n=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(n.push(c),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");let i=wi.createStringifyContext(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=r(e.commentBefore);n.unshift(Mt.indentComment(c,""))}let o=!1,a=null;if(e.contents){if(Gu.isNode(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let m=r(e.contents.commentBefore);n.push(Mt.indentComment(m,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>o=!0,f=wi.stringify(e.contents,i,()=>a=null,c);a&&(f+=Mt.lineComment(f,"",r(a))),(f[0]==="|"||f[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${f}`:n.push(f)}else n.push(wi.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let c=r(e.comment);c.includes(`
|
|
57
|
-
`)?(n.push("..."),n.push(Mt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Mt.indentComment(
|
|
53
|
+
${r}${p}`}else return`${l}${o}${u.join(" ")}${o}${p}`}function An({indent:e,options:{commentString:t}},n,s,r){if(s&&r&&(s=s.replace(/^\n+/,"")),s){let i=On.indentComment(t(s),e);n.push(i.trimStart())}}ro.stringifyCollection=Nf});var Pe=M(Us=>{"use strict";var Cf=Bs(),Tf=js(),qf=un(),Le=U(),Nn=Me(),Mf=Q();function At(e,t){let n=Le.isScalar(t)?t.value:t;for(let s of e)if(Le.isPair(s)&&(s.key===t||s.key===n||Le.isScalar(s.key)&&s.key.value===n))return s}var Ks=class extends qf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Le.MAP,t),this.items=[]}static from(t,n,s){let{keepUndefined:r,replacer:i}=s,o=new this(t),a=(c,f)=>{if(typeof i=="function")f=i.call(n,c,f);else if(Array.isArray(i)&&!i.includes(c))return;(f!==void 0||r)&&o.items.push(Nn.createPair(c,f,s))};if(n instanceof Map)for(let[c,f]of n)a(c,f);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,n){let s;Le.isPair(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new Nn.Pair(t,t?.value):s=new Nn.Pair(t.key,t.value);let r=At(this.items,s.key),i=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${s.key} already set`);Le.isScalar(r.value)&&Mf.isScalarValue(s.value)?r.value.value=s.value:r.value=s.value}else if(i){let o=this.items.findIndex(a=>i(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(t){let n=At(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let r=At(this.items,t)?.value;return(!n&&Le.isScalar(r)?r.value:r)??void 0}has(t){return!!At(this.items,t)}set(t,n){this.add(new Nn.Pair(t,n),!0)}toJSON(t,n,s){let r=s?new s:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let i of this.items)Tf.addPairToJSMap(n,r,i);return r}toString(t,n,s){if(!t)return JSON.stringify(this);for(let r of this.items)if(!Le.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Cf.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}};Us.YAMLMap=Ks;Us.findPair=At});var Qe=M(oo=>{"use strict";var Lf=U(),io=Pe(),Pf={collection:"map",default:!0,nodeClass:io.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Lf.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>io.YAMLMap.from(e,t,n)};oo.map=Pf});var Ie=M(ao=>{"use strict";var If=bt(),Rf=Bs(),Ff=un(),xn=U(),Df=Q(),jf=xe(),Ys=class extends Ff.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(xn.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=En(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let s=En(t);if(typeof s!="number")return;let r=this.items[s];return!n&&xn.isScalar(r)?r.value:r}has(t){let n=En(t);return typeof n=="number"&&n<this.items.length}set(t,n){let s=En(t);if(typeof s!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[s];xn.isScalar(r)&&Df.isScalarValue(n)?r.value=n:this.items[s]=n}toJSON(t,n){let s=[];n?.onCreate&&n.onCreate(s);let r=0;for(let i of this.items)s.push(jf.toJS(i,String(r++),n));return s}toString(t,n,s){return t?Rf.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(t,n,s){let{replacer:r}=s,i=new this(t);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(o++);a=r.call(n,c,a)}i.items.push(If.createNode(a,void 0,s))}}return i}};function En(e){let t=xn.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}ao.YAMLSeq=Ys});var Ze=M(co=>{"use strict";var _f=U(),lo=Ie(),Bf={collection:"seq",default:!0,nodeClass:lo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return _f.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>lo.YAMLSeq.from(e,t,n)};co.seq=Bf});var Nt=M(fo=>{"use strict";var Kf=vt(),Uf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),Kf.stringifyString(e,t,n,s)}};fo.string=Uf});var Cn=M(ho=>{"use strict";var uo=Q(),po={identify:e=>e==null,createNode:()=>new uo.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new uo.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&po.test.test(e)?e:t.options.nullStr};ho.nullTag=po});var zs=M(go=>{"use strict";var Yf=Q(),mo={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Yf.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&mo.test.test(e)){let s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};go.boolTag=mo});var et=M(yo=>{"use strict";function zf({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);let r=typeof s=="number"?s:Number(s);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let i=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=t-(i.length-o-1);for(;a-- >0;)i+="0"}return i}yo.stringifyNumber=zf});var Vs=M(Tn=>{"use strict";var Wf=Q(),Ws=et(),Vf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ws.stringifyNumber},Jf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Ws.stringifyNumber(e)}},Gf={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Wf.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ws.stringifyNumber};Tn.float=Gf;Tn.floatExp=Jf;Tn.floatNaN=Vf});var Gs=M(Mn=>{"use strict";var bo=et(),qn=e=>typeof e=="bigint"||Number.isInteger(e),Js=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function wo(e,t,n){let{value:s}=e;return qn(s)&&s>=0?n+s.toString(t):bo.stringifyNumber(e)}var Hf={identify:e=>qn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Js(e,2,8,n),stringify:e=>wo(e,8,"0o")},Xf={identify:qn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Js(e,0,10,n),stringify:bo.stringifyNumber},Qf={identify:e=>qn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Js(e,2,16,n),stringify:e=>wo(e,16,"0x")};Mn.int=Xf;Mn.intHex=Qf;Mn.intOct=Hf});var $o=M(ko=>{"use strict";var Zf=Qe(),eu=Cn(),tu=Ze(),nu=Nt(),su=zs(),Hs=Vs(),Xs=Gs(),ru=[Zf.map,tu.seq,nu.string,eu.nullTag,su.boolTag,Xs.intOct,Xs.int,Xs.intHex,Hs.floatNaN,Hs.floatExp,Hs.float];ko.schema=ru});var Oo=M(So=>{"use strict";var iu=Q(),ou=Qe(),au=Ze();function vo(e){return typeof e=="bigint"||Number.isInteger(e)}var Ln=({value:e})=>JSON.stringify(e),lu=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Ln},{identify:e=>e==null,createNode:()=>new iu.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ln},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Ln},{identify:vo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>vo(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Ln}],cu={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},fu=[ou.map,au.seq].concat(lu,cu);So.schema=fu});var Zs=M(Ao=>{"use strict";var Et=en("buffer"),Qs=Q(),uu=vt(),du={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Et.Buffer=="function")return Et.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let r=0;r<n.length;++r)s[r]=n.charCodeAt(r);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,r,i){if(!n)return"";let o=n,a;if(typeof Et.Buffer=="function")a=o instanceof Et.Buffer?o.toString("base64"):Et.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let f=0;f<o.length;++f)c+=String.fromCharCode(o[f]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Qs.Scalar.BLOCK_LITERAL),t!==Qs.Scalar.QUOTE_DOUBLE){let c=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),f=Math.ceil(a.length/c),m=new Array(f);for(let u=0,l=0;u<f;++u,l+=c)m[u]=a.substr(l,c);a=m.join(t===Qs.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return uu.stringifyString({comment:e,type:t,value:a},s,r,i)}};Ao.binary=du});var Rn=M(In=>{"use strict";var Pn=U(),er=Me(),pu=Q(),hu=Ie();function No(e,t){if(Pn.isSeq(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!Pn.isPair(s)){if(Pn.isMap(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");let r=s.items[0]||new er.Pair(new pu.Scalar(null));if(s.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${s.commentBefore}
|
|
55
|
+
${r.key.commentBefore}`:s.commentBefore),s.comment){let i=r.value??r.key;i.comment=i.comment?`${s.comment}
|
|
56
|
+
${i.comment}`:s.comment}s=r}e.items[n]=Pn.isPair(s)?s:new er.Pair(s)}}else t("Expected a sequence for this tag");return e}function Eo(e,t,n){let{replacer:s}=n,r=new hu.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let f=Object.keys(o);if(f.length===1)a=f[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${f.length} keys`)}else a=o;r.items.push(er.createPair(a,c,n))}return r}var mu={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:No,createNode:Eo};In.createPairs=Eo;In.pairs=mu;In.resolvePairs=No});var sr=M(nr=>{"use strict";var xo=U(),tr=xe(),xt=Pe(),gu=Ie(),Co=Rn(),Ke=class e extends gu.YAMLSeq{constructor(){super(),this.add=xt.YAMLMap.prototype.add.bind(this),this.delete=xt.YAMLMap.prototype.delete.bind(this),this.get=xt.YAMLMap.prototype.get.bind(this),this.has=xt.YAMLMap.prototype.has.bind(this),this.set=xt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let s=new Map;n?.onCreate&&n.onCreate(s);for(let r of this.items){let i,o;if(xo.isPair(r)?(i=tr.toJS(r.key,"",n),o=tr.toJS(r.value,i,n)):i=tr.toJS(r,"",n),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,o)}return s}static from(t,n,s){let r=Co.createPairs(t,n,s),i=new this;return i.items=r.items,i}};Ke.tag="tag:yaml.org,2002:omap";var yu={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ke,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Co.resolvePairs(e,t),s=[];for(let{key:r}of n.items)xo.isScalar(r)&&(s.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new Ke,n)},createNode:(e,t,n)=>Ke.from(e,t,n)};nr.YAMLOMap=Ke;nr.omap=yu});var Po=M(rr=>{"use strict";var To=Q();function qo({value:e,source:t},n){return t&&(e?Mo:Lo).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Mo={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new To.Scalar(!0),stringify:qo},Lo={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new To.Scalar(!1),stringify:qo};rr.falseTag=Lo;rr.trueTag=Mo});var Io=M(Fn=>{"use strict";var bu=Q(),ir=et(),wu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ir.stringifyNumber},ku={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ir.stringifyNumber(e)}},$u={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new bu.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:ir.stringifyNumber};Fn.float=$u;Fn.floatExp=ku;Fn.floatNaN=wu});var Fo=M(Tt=>{"use strict";var Ro=et(),Ct=e=>typeof e=="bigint"||Number.isInteger(e);function Dn(e,t,n,{intAsBigInt:s}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return r==="-"?BigInt(-1)*o:o}let i=parseInt(e,n);return r==="-"?-1*i:i}function or(e,t,n){let{value:s}=e;if(Ct(s)){let r=s.toString(t);return s<0?"-"+n+r.substr(1):n+r}return Ro.stringifyNumber(e)}var vu={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Dn(e,2,2,n),stringify:e=>or(e,2,"0b")},Su={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Dn(e,1,8,n),stringify:e=>or(e,8,"0")},Ou={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Dn(e,0,10,n),stringify:Ro.stringifyNumber},Au={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Dn(e,2,16,n),stringify:e=>or(e,16,"0x")};Tt.int=Ou;Tt.intBin=vu;Tt.intHex=Au;Tt.intOct=Su});var lr=M(ar=>{"use strict";var Bn=U(),jn=Me(),_n=Pe(),Ue=class e extends _n.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Bn.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new jn.Pair(t.key,null):n=new jn.Pair(t,null),_n.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let s=_n.findPair(this.items,t);return!n&&Bn.isPair(s)?Bn.isScalar(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=_n.findPair(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new jn.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){let{replacer:r}=s,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),i.items.push(jn.createPair(o,null,s));return i}};Ue.tag="tag:yaml.org,2002:set";var Nu={collection:"map",identify:e=>e instanceof Set,nodeClass:Ue,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Ue.from(e,t,n),resolve(e,t){if(Bn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ue,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};ar.YAMLSet=Ue;ar.set=Nu});var fr=M(Kn=>{"use strict";var Eu=et();function cr(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,r=o=>t?BigInt(o):Number(o),i=s.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*i:i}function Do(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Eu.stringifyNumber(e);let s="";t<0&&(s="-",t*=n(-1));let r=n(60),i=[t%r];return t<60?i.unshift(0):(t=(t-i[0])/r,i.unshift(t%r),t>=60&&(t=(t-i[0])/r,i.unshift(t))),s+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var xu={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>cr(e,n),stringify:Do},Cu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>cr(e,!1),stringify:Do},jo={identify:e=>e 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(e){let t=e.match(jo.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,r,i,o,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,f=Date.UTC(n,s-1,r,i||0,o||0,a||0,c),m=t[8];if(m&&m!=="Z"){let u=cr(m,!1);Math.abs(u)<30&&(u*=60),f-=6e4*u}return new Date(f)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Kn.floatTime=Cu;Kn.intTime=xu;Kn.timestamp=jo});var Ko=M(Bo=>{"use strict";var Tu=Qe(),qu=Cn(),Mu=Ze(),Lu=Nt(),Pu=Zs(),_o=Po(),ur=Io(),Un=Fo(),Iu=$n(),Ru=sr(),Fu=Rn(),Du=lr(),dr=fr(),ju=[Tu.map,Mu.seq,Lu.string,qu.nullTag,_o.trueTag,_o.falseTag,Un.intBin,Un.intOct,Un.int,Un.intHex,ur.floatNaN,ur.floatExp,ur.float,Pu.binary,Iu.merge,Ru.omap,Fu.pairs,Du.set,dr.intTime,dr.floatTime,dr.timestamp];Bo.schema=ju});var Qo=M(mr=>{"use strict";var Wo=Qe(),_u=Cn(),Vo=Ze(),Bu=Nt(),Ku=zs(),pr=Vs(),hr=Gs(),Uu=$o(),Yu=Oo(),Jo=Zs(),qt=$n(),Go=sr(),Ho=Rn(),Uo=Ko(),Xo=lr(),Yn=fr(),Yo=new Map([["core",Uu.schema],["failsafe",[Wo.map,Vo.seq,Bu.string]],["json",Yu.schema],["yaml11",Uo.schema],["yaml-1.1",Uo.schema]]),zo={binary:Jo.binary,bool:Ku.boolTag,float:pr.float,floatExp:pr.floatExp,floatNaN:pr.floatNaN,floatTime:Yn.floatTime,int:hr.int,intHex:hr.intHex,intOct:hr.intOct,intTime:Yn.intTime,map:Wo.map,merge:qt.merge,null:_u.nullTag,omap:Go.omap,pairs:Ho.pairs,seq:Vo.seq,set:Xo.set,timestamp:Yn.timestamp},zu={"tag:yaml.org,2002:binary":Jo.binary,"tag:yaml.org,2002:merge":qt.merge,"tag:yaml.org,2002:omap":Go.omap,"tag:yaml.org,2002:pairs":Ho.pairs,"tag:yaml.org,2002:set":Xo.set,"tag:yaml.org,2002:timestamp":Yn.timestamp};function Wu(e,t,n){let s=Yo.get(t);if(s&&!e)return n&&!s.includes(qt.merge)?s.concat(qt.merge):s.slice();let r=s;if(!r)if(Array.isArray(e))r=[];else{let i=Array.from(Yo.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(let i of e)r=r.concat(i);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(qt.merge)),r.reduce((i,o)=>{let a=typeof o=="string"?zo[o]:o;if(!a){let c=JSON.stringify(o),f=Object.keys(zo).map(m=>JSON.stringify(m)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${f}`)}return i.includes(a)||i.push(a),i},[])}mr.coreKnownTags=zu;mr.getTags=Wu});var br=M(Zo=>{"use strict";var gr=U(),Vu=Qe(),Ju=Ze(),Gu=Nt(),zn=Qo(),Hu=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,yr=class e{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?zn.getTags(t,"compat"):t?zn.getTags(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?zn.coreKnownTags:{},this.tags=zn.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,gr.MAP,{value:Vu.map}),Object.defineProperty(this,gr.SCALAR,{value:Gu.string}),Object.defineProperty(this,gr.SEQ,{value:Ju.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Hu:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Zo.Schema=yr});var ta=M(ea=>{"use strict";var Xu=U(),wr=St(),Mt=wt();function Qu(e,t){let n=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(n.push(c),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");let r=wr.createStringifyContext(e,t),{commentString:i}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=i(e.commentBefore);n.unshift(Mt.indentComment(c,""))}let o=!1,a=null;if(e.contents){if(Xu.isNode(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let m=i(e.contents.commentBefore);n.push(Mt.indentComment(m,""))}r.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>o=!0,f=wr.stringify(e.contents,r,()=>a=null,c);a&&(f+=Mt.lineComment(f,"",i(a))),(f[0]==="|"||f[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${f}`:n.push(f)}else n.push(wr.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let c=i(e.comment);c.includes(`
|
|
57
|
+
`)?(n.push("..."),n.push(Mt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Mt.indentComment(i(c),"")))}return n.join(`
|
|
58
58
|
`)+`
|
|
59
|
-
`}
|
|
60
|
-
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=n.linePos[1];c?.line===s&&c.col>
|
|
59
|
+
`}ea.stringifyDocument=Qu});var Lt=M(na=>{"use strict";var Zu=yt(),tt=un(),de=U(),ed=Me(),td=xe(),nd=br(),sd=ta(),kr=an(),rd=Os(),id=bt(),$r=Ss(),vr=class e{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,de.NODE_TYPE,{value:de.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:s===void 0&&n&&(s=n,n=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=i;let{version:o}=i;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new $r.Directives({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,r,s)}clone(){let t=Object.create(e.prototype,{[de.NODE_TYPE]:{value:de.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=de.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){nt(this.contents)&&this.contents.add(t)}addIn(t,n){nt(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let s=kr.anchorNames(this);t.anchor=!n||s.has(n)?kr.findNewAnchor(n||"a",s):n}return new Zu.Alias(t.anchor)}createNode(t,n,s){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){let y=v=>typeof v=="number"||v instanceof String||v instanceof Number,w=n.filter(y).map(String);w.length>0&&(n=n.concat(w)),r=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:f,tag:m}=s??{},{onAnchor:u,setAnchors:l,sourceObjects:p}=kr.createNodeAnchors(this,o||"a"),d={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:f,replacer:r,schema:this.schema,sourceObjects:p},h=id.createNode(t,m,d);return a&&de.isCollection(h)&&(h.flow=!0),l(),h}createPair(t,n,s={}){let r=this.createNode(t,null,s),i=this.createNode(n,null,s);return new ed.Pair(r,i)}delete(t){return nt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return tt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):nt(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return de.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return tt.isEmptyPath(t)?!n&&de.isScalar(this.contents)?this.contents.value:this.contents:de.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return de.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return tt.isEmptyPath(t)?this.contents!==void 0:de.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=tt.collectionFromPath(this.schema,[t],n):nt(this.contents)&&this.contents.set(t,n)}setIn(t,n){tt.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=tt.collectionFromPath(this.schema,Array.from(t),n):nt(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new $r.Directives({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new $r.Directives({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new nd.Schema(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=td.toJS(this.contents,n??"",a);if(typeof i=="function")for(let{count:f,res:m}of a.anchors.values())i(m,f);return typeof o=="function"?rd.applyReviver(o,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return sd.stringifyDocument(this,t)}};function nt(e){if(de.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}na.Document=vr});var Rt=M(It=>{"use strict";var Pt=class extends Error{constructor(t,n,s,r){super(),this.name=t,this.code=s,this.message=r,this.pos=n}},Sr=class extends Pt{constructor(t,n,s){super("YAMLParseError",t,n,s)}},Or=class extends Pt{constructor(t,n,s){super("YAMLWarning",t,n,s)}},od=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));let{line:s,col:r}=n.linePos[0];n.message+=` at line ${s}, column ${r}`;let i=r-1,o=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,i))){let a=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=n.linePos[1];c?.line===s&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-i)));let f=" ".repeat(i)+"^".repeat(a);n.message+=`:
|
|
61
61
|
|
|
62
62
|
${o}
|
|
63
63
|
${f}
|
|
64
|
-
`}};
|
|
65
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(
|
|
66
|
-
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||
|
|
67
|
-
`+O.comment:v.comment=O.comment);let E=new
|
|
68
|
-
`+C.comment:f.comment=C.comment),u=C.end;continue}!o&&n.options.strict&&
|
|
69
|
-
`+q:x.comment=q,C.comment=C.comment.substring(q.length+1)}}if(!o&&!E&&!C.found){let q=S?e(n,S,C,
|
|
70
|
-
`+b.comment:x.comment=b.comment);let R=new
|
|
71
|
-
`+y.comment:f.comment=y.comment),f.range=[s.offset,h,y.offset]}else f.range=[s.offset,h,h];return f}
|
|
72
|
-
`.repeat(Math.max(1,o.length-1)):"",y=s+
|
|
73
|
-
`;for(let h=m;h<a;++h){let[y,w]=o[h];f+=y.length+w.length+1;let v=w[w.length-1]==="\r";if(v&&(w=w.slice(0,-1)),w&&y.length<c){let E=`Block scalar lines must not be less indented than their ${
|
|
64
|
+
`}};It.YAMLError=Pt;It.YAMLParseError=Sr;It.YAMLWarning=Or;It.prettifyError=od});var Ft=M(sa=>{"use strict";function ad(e,{flow:t,indicator:n,next:s,offset:r,onError:i,parentIndent:o,startOnNewline:a}){let c=!1,f=a,m=a,u="",l="",p=!1,d=!1,h=null,y=null,w=null,v=null,O=null,E=null,S=null;for(let x of e)switch(d&&(x.type!=="space"&&x.type!=="newline"&&x.type!=="comma"&&i(x.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d=!1),h&&(f&&x.type!=="comment"&&x.type!=="newline"&&i(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),x.type){case"space":!t&&(n!=="doc-start"||s?.type!=="flow-collection")&&x.source.includes(" ")&&(h=x),m=!0;break;case"comment":{m||i(x,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let b=x.source.substring(1)||" ";u?u+=l+b:u=b,l="",f=!1;break}case"newline":f?u?u+=x.source:(!E||n!=="seq-item-ind")&&(c=!0):l+=x.source,f=!0,p=!0,(y||w)&&(v=x),m=!0;break;case"anchor":y&&i(x,"MULTIPLE_ANCHORS","A node can have at most one anchor"),x.source.endsWith(":")&&i(x.offset+x.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=x,S??(S=x.offset),f=!1,m=!1,d=!0;break;case"tag":{w&&i(x,"MULTIPLE_TAGS","A node can have at most one tag"),w=x,S??(S=x.offset),f=!1,m=!1,d=!0;break}case n:(y||w)&&i(x,"BAD_PROP_ORDER",`Anchors and tags must be after the ${x.source} indicator`),E&&i(x,"UNEXPECTED_TOKEN",`Unexpected ${x.source} in ${t??"collection"}`),E=x,f=n==="seq-item-ind"||n==="explicit-key-ind",m=!1;break;case"comma":if(t){O&&i(x,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),O=x,f=!1,m=!1;break}default:i(x,"UNEXPECTED_TOKEN",`Unexpected ${x.type} token`),f=!1,m=!1}let C=e[e.length-1],q=C?C.offset+C.source.length:r;return d&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&i(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(f&&h.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&i(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:O,found:E,spaceBefore:c,comment:u,hasNewline:p,anchor:y,tag:w,newlineAfterProp:v,end:q,start:S??q}}sa.resolveProps=ad});var Wn=M(ra=>{"use strict";function Ar(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
65
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(Ar(t.key)||Ar(t.value))return!0}return!1;default:return!0}}ra.containsNewline=Ar});var Nr=M(ia=>{"use strict";var ld=Wn();function cd(e,t,n){if(t?.type==="flow-collection"){let s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&ld.containsNewline(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}ia.flowIndentCheck=cd});var Er=M(aa=>{"use strict";var oa=U();function fd(e,t,n){let{uniqueKeys:s}=e.options;if(s===!1)return!1;let r=typeof s=="function"?s:(i,o)=>i===o||oa.isScalar(i)&&oa.isScalar(o)&&i.value===o.value;return t.some(i=>r(i.key,n))}aa.mapIncludes=fd});var pa=M(da=>{"use strict";var la=Me(),ud=Pe(),ca=Ft(),dd=Wn(),fa=Nr(),pd=Er(),ua="All mapping items must start at the same column";function hd({composeNode:e,composeEmptyNode:t},n,s,r,i){let o=i?.nodeClass??ud.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=s.offset,f=null;for(let m of s.items){let{start:u,key:l,sep:p,value:d}=m,h=ca.resolveProps(u,{indicator:"explicit-key-ind",next:l??p?.[0],offset:c,onError:r,parentIndent:s.indent,startOnNewline:!0}),y=!h.found;if(y){if(l&&(l.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in l&&l.indent!==s.indent&&r(c,"BAD_INDENT",ua)),!h.anchor&&!h.tag&&!p){f=h.end,h.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||dd.containsNewline(l))&&r(l??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&r(c,"BAD_INDENT",ua);n.atKey=!0;let w=h.end,v=l?e(n,l,h,r):t(n,w,u,null,h,r);n.schema.compat&&fa.flowIndentCheck(s.indent,l,r),n.atKey=!1,pd.mapIncludes(n,a.items,v)&&r(w,"DUPLICATE_KEY","Map keys must be unique");let O=ca.resolveProps(p??[],{indicator:"map-value-ind",next:d,offset:v.range[2],onError:r,parentIndent:s.indent,startOnNewline:!l||l.type==="block-scalar"});if(c=O.end,O.found){y&&(d?.type==="block-map"&&!O.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<O.found.offset-1024&&r(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let E=d?e(n,d,O,r):t(n,c,p,null,O,r);n.schema.compat&&fa.flowIndentCheck(s.indent,d,r),c=E.range[2];let S=new la.Pair(v,E);n.options.keepSourceTokens&&(S.srcToken=m),a.items.push(S)}else{y&&r(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),O.comment&&(v.comment?v.comment+=`
|
|
67
|
+
`+O.comment:v.comment=O.comment);let E=new la.Pair(v);n.options.keepSourceTokens&&(E.srcToken=m),a.items.push(E)}}return f&&f<c&&r(f,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,c,f??c],a}da.resolveBlockMap=hd});var ma=M(ha=>{"use strict";var md=Ie(),gd=Ft(),yd=Nr();function bd({composeNode:e,composeEmptyNode:t},n,s,r,i){let o=i?.nodeClass??md.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=s.offset,f=null;for(let{start:m,value:u}of s.items){let l=gd.resolveProps(m,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:s.indent,startOnNewline:!0});if(!l.found)if(l.anchor||l.tag||u)u?.type==="block-seq"?r(l.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{f=l.end,l.comment&&(a.comment=l.comment);continue}let p=u?e(n,u,l,r):t(n,l.end,m,null,l,r);n.schema.compat&&yd.flowIndentCheck(s.indent,u,r),c=p.range[2],a.items.push(p)}return a.range=[s.offset,c,f??c],a}ha.resolveBlockSeq=bd});var st=M(ga=>{"use strict";function wd(e,t,n,s){let r="";if(e){let i=!1,o="";for(let a of e){let{source:c,type:f}=a;switch(f){case"space":i=!0;break;case"comment":{n&&!i&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let m=c.substring(1)||" ";r?r+=o+m:r=m,o="";break}case"newline":r&&(o+=c),i=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${f} at node end`)}t+=c.length}}return{comment:r,offset:t}}ga.resolveEnd=wd});var ka=M(wa=>{"use strict";var kd=U(),$d=Me(),ya=Pe(),vd=Ie(),Sd=st(),ba=Ft(),Od=Wn(),Ad=Er(),xr="Block collections are not allowed within flow collections",Cr=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Nd({composeNode:e,composeEmptyNode:t},n,s,r,i){let o=s.start.source==="{",a=o?"flow map":"flow sequence",c=i?.nodeClass??(o?ya.YAMLMap:vd.YAMLSeq),f=new c(n.schema);f.flow=!0;let m=n.atRoot;m&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=s.offset+s.start.source.length;for(let y=0;y<s.items.length;++y){let w=s.items[y],{start:v,key:O,sep:E,value:S}=w,C=ba.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:O??E?.[0],offset:u,onError:r,parentIndent:s.indent,startOnNewline:!1});if(!C.found){if(!C.anchor&&!C.tag&&!E&&!S){y===0&&C.comma?r(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<s.items.length-1&&r(C.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),C.comment&&(f.comment?f.comment+=`
|
|
68
|
+
`+C.comment:f.comment=C.comment),u=C.end;continue}!o&&n.options.strict&&Od.containsNewline(O)&&r(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)C.comma&&r(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(C.comma||r(C.start,"MISSING_CHAR",`Missing , between ${a} items`),C.comment){let q="";e:for(let x of v)switch(x.type){case"comma":case"space":break;case"comment":q=x.source.substring(1);break e;default:break e}if(q){let x=f.items[f.items.length-1];kd.isPair(x)&&(x=x.value??x.key),x.comment?x.comment+=`
|
|
69
|
+
`+q:x.comment=q,C.comment=C.comment.substring(q.length+1)}}if(!o&&!E&&!C.found){let q=S?e(n,S,C,r):t(n,C.end,E,null,C,r);f.items.push(q),u=q.range[2],Cr(S)&&r(q.range,"BLOCK_IN_FLOW",xr)}else{n.atKey=!0;let q=C.end,x=O?e(n,O,C,r):t(n,q,v,null,C,r);Cr(O)&&r(x.range,"BLOCK_IN_FLOW",xr),n.atKey=!1;let b=ba.resolveProps(E??[],{flow:a,indicator:"map-value-ind",next:S,offset:x.range[2],onError:r,parentIndent:s.indent,startOnNewline:!1});if(b.found){if(!o&&!C.found&&n.options.strict){if(E)for(let j of E){if(j===b.found)break;if(j.type==="newline"){r(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}C.start<b.found.offset-1024&&r(b.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?r(S,"MISSING_CHAR",`Missing space after : in ${a}`):r(b.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let T=S?e(n,S,b,r):b.found?t(n,b.end,E,null,b,r):null;T?Cr(S)&&r(T.range,"BLOCK_IN_FLOW",xr):b.comment&&(x.comment?x.comment+=`
|
|
70
|
+
`+b.comment:x.comment=b.comment);let R=new $d.Pair(x,T);if(n.options.keepSourceTokens&&(R.srcToken=w),o){let j=f;Ad.mapIncludes(n,j.items,x)&&r(q,"DUPLICATE_KEY","Map keys must be unique"),j.items.push(R)}else{let j=new ya.YAMLMap(n.schema);j.flow=!0,j.items.push(R);let oe=(T??x).range;j.range=[x.range[0],oe[1],oe[2]],f.items.push(j)}u=T?T.range[2]:b.end}}let l=o?"}":"]",[p,...d]=s.end,h=u;if(p?.source===l)h=p.offset+p.source.length;else{let y=a[0].toUpperCase()+a.substring(1),w=m?`${y} must end with a ${l}`:`${y} in block collection must be sufficiently indented and end with a ${l}`;r(u,m?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&d.unshift(p)}if(d.length>0){let y=Sd.resolveEnd(d,h,n.options.strict,r);y.comment&&(f.comment?f.comment+=`
|
|
71
|
+
`+y.comment:f.comment=y.comment),f.range=[s.offset,h,y.offset]}else f.range=[s.offset,h,h];return f}wa.resolveFlowCollection=Nd});var va=M($a=>{"use strict";var Ed=U(),xd=Q(),Cd=Pe(),Td=Ie(),qd=pa(),Md=ma(),Ld=ka();function Tr(e,t,n,s,r,i){let o=n.type==="block-map"?qd.resolveBlockMap(e,t,n,s,i):n.type==="block-seq"?Md.resolveBlockSeq(e,t,n,s,i):Ld.resolveFlowCollection(e,t,n,s,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function Pd(e,t,n,s,r){let i=s.tag,o=i?t.directives.tagName(i.source,l=>r(i,"TAG_RESOLVE_FAILED",l)):null;if(n.type==="block-seq"){let{anchor:l,newlineAfterProp:p}=s,d=l&&i?l.offset>i.offset?l:i:l??i;d&&(!p||p.offset<d.offset)&&r(d,"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(!i||!o||o==="!"||o===Cd.YAMLMap.tagName&&a==="map"||o===Td.YAMLSeq.tagName&&a==="seq")return Tr(e,t,n,r,o);let c=t.schema.tags.find(l=>l.tag===o&&l.collection===a);if(!c){let l=t.schema.knownTags[o];if(l?.collection===a)t.schema.tags.push(Object.assign({},l,{default:!1})),c=l;else return l?r(i,"BAD_COLLECTION_TYPE",`${l.tag} used for ${a} collection, but expects ${l.collection??"scalar"}`,!0):r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Tr(e,t,n,r,o)}let f=Tr(e,t,n,r,o,c),m=c.resolve?.(f,l=>r(i,"TAG_RESOLVE_FAILED",l),t.options)??f,u=Ed.isNode(m)?m:new xd.Scalar(m);return u.range=f.range,u.tag=o,c?.format&&(u.format=c.format),u}$a.composeCollection=Pd});var Mr=M(Sa=>{"use strict";var qr=Q();function Id(e,t,n){let s=t.offset,r=Rd(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[s,s,s]};let i=r.mode===">"?qr.Scalar.BLOCK_FOLDED:qr.Scalar.BLOCK_LITERAL,o=t.source?Fd(t.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let y=o[h][1];if(y===""||y==="\r")a=h;else break}if(a===0){let h=r.chomp==="+"&&o.length>0?`
|
|
72
|
+
`.repeat(Math.max(1,o.length-1)):"",y=s+r.length;return t.source&&(y+=t.source.length),{value:h,type:i,comment:r.comment,range:[s,y,y]}}let c=t.indent+r.indent,f=t.offset+r.length,m=0;for(let h=0;h<a;++h){let[y,w]=o[h];if(w===""||w==="\r")r.indent===0&&y.length>c&&(c=y.length);else{y.length<c&&n(f+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=y.length),m=h,c===0&&!e.atRoot&&n(f,"BAD_INDENT","Block scalar values in collections must be indented");break}f+=y.length+w.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>c&&(a=h+1);let u="",l="",p=!1;for(let h=0;h<m;++h)u+=o[h][0].slice(c)+`
|
|
73
|
+
`;for(let h=m;h<a;++h){let[y,w]=o[h];f+=y.length+w.length+1;let v=w[w.length-1]==="\r";if(v&&(w=w.slice(0,-1)),w&&y.length<c){let E=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(f-w.length-(v?2:1),"BAD_INDENT",E),y=""}i===qr.Scalar.BLOCK_LITERAL?(u+=l+y.slice(c)+w,l=`
|
|
74
74
|
`):y.length>c||w[0]===" "?(l===" "?l=`
|
|
75
75
|
`:!p&&l===`
|
|
76
76
|
`&&(l=`
|
|
@@ -79,69 +79,69 @@ ${f}
|
|
|
79
79
|
`,p=!0):w===""?l===`
|
|
80
80
|
`?u+=`
|
|
81
81
|
`:l=`
|
|
82
|
-
`:(u+=l+w,l=" ",p=!1)}switch(
|
|
82
|
+
`:(u+=l+w,l=" ",p=!1)}switch(r.chomp){case"-":break;case"+":for(let h=a;h<o.length;++h)u+=`
|
|
83
83
|
`+o[h][0].slice(c);u[u.length-1]!==`
|
|
84
84
|
`&&(u+=`
|
|
85
85
|
`);break;default:u+=`
|
|
86
|
-
`}let d=s+
|
|
87
|
-
`?
|
|
88
|
-
`:(
|
|
89
|
-
`))if(
|
|
90
|
-
`){let{fold:
|
|
91
|
-
`)for(
|
|
92
|
-
`)for(
|
|
86
|
+
`}let d=s+r.length+t.source.length;return{value:u,type:i,comment:r.comment,range:[s,d,d]}}function Rd({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],i=r[0],o=0,a="",c=-1;for(let l=1;l<r.length;++l){let p=r[l];if(!a&&(p==="-"||p==="+"))a=p;else{let d=Number(p);!o&&d?o=d:c===-1&&(c=e+l)}}c!==-1&&s(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let f=!1,m="",u=r.length;for(let l=1;l<t.length;++l){let p=t[l];switch(p.type){case"space":f=!0;case"newline":u+=p.source.length;break;case"comment":n&&!f&&s(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,m=p.source.substring(1);break;case"error":s(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let d=`Unexpected token in block scalar header: ${p.type}`;s(p,"UNEXPECTED_TOKEN",d);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:i,indent:o,chomp:a,comment:m,length:u}}function Fd(e){let t=e.split(/\n( *)/),n=t[0],s=n.match(/^( *)/),i=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let o=1;o<t.length;o+=2)i.push([t[o],t[o+1]]);return i}Sa.resolveBlockScalar=Id});var Pr=M(Aa=>{"use strict";var Lr=Q(),Dd=st();function jd(e,t,n){let{offset:s,type:r,source:i,end:o}=e,a,c,f=(l,p,d)=>n(s+l,p,d);switch(r){case"scalar":a=Lr.Scalar.PLAIN,c=_d(i,f);break;case"single-quoted-scalar":a=Lr.Scalar.QUOTE_SINGLE,c=Bd(i,f);break;case"double-quoted-scalar":a=Lr.Scalar.QUOTE_DOUBLE,c=Kd(i,f);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[s,s+i.length,s+i.length]}}let m=s+i.length,u=Dd.resolveEnd(o,m,t,n);return{value:c,type:a,comment:u.comment,range:[s,m,u.offset]}}function _d(e,t){let n="";switch(e[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 ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Oa(e)}function Bd(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Oa(e.slice(1,-1)).replace(/''/g,"'")}function Oa(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let s,r;try{s=new RegExp("(?<![ ])[ ]+$"),r=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{s=/[ \t]+$/,r=/^[ \t]+|[ \t]+$/g}let i=n[1].replace(s,""),o=" ",a=t.lastIndex;for(;n=t.exec(e);){let f=n[1].replace(r,"");f===""?o===`
|
|
87
|
+
`?i+=o:o=`
|
|
88
|
+
`:(i+=o+f,o=" "),a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,n=c.exec(e),i+o+(n?.[1]??"")}function Kd(e,t){let n="";for(let s=1;s<e.length-1;++s){let r=e[s];if(!(r==="\r"&&e[s+1]===`
|
|
89
|
+
`))if(r===`
|
|
90
|
+
`){let{fold:i,offset:o}=Ud(e,s);n+=i,s=o}else if(r==="\\"){let i=e[++s],o=Yd[i];if(o)n+=o;else if(i===`
|
|
91
|
+
`)for(i=e[s+1];i===" "||i===" ";)i=e[++s+1];else if(i==="\r"&&e[s+1]===`
|
|
92
|
+
`)for(i=e[++s+1];i===" "||i===" ";)i=e[++s+1];else if(i==="x"||i==="u"||i==="U"){let a=i==="x"?2:i==="u"?4:8;n+=zd(e,s+1,a,t),s+=a}else{let a=e.substr(s-1,2);t(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let i=s,o=e[s+1];for(;o===" "||o===" ";)o=e[++s+1];o!==`
|
|
93
93
|
`&&!(o==="\r"&&e[s+2]===`
|
|
94
|
-
`)&&(n+=s>
|
|
94
|
+
`)&&(n+=s>i?e.slice(i,s+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Ud(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===`
|
|
95
95
|
`||s==="\r")&&!(s==="\r"&&e[t+2]!==`
|
|
96
96
|
`);)s===`
|
|
97
97
|
`&&(n+=`
|
|
98
|
-
`),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}var
|
|
99
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
98
|
+
`),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}var Yd={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
99
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function zd(e,t,n,s){let r=e.substr(t,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Aa.resolveFlowScalar=jd});var xa=M(Ea=>{"use strict";var Ye=U(),Na=Q(),Wd=Mr(),Vd=Pr();function Jd(e,t,n,s){let{value:r,type:i,comment:o,range:a}=t.type==="block-scalar"?Wd.resolveBlockScalar(e,t,s):Vd.resolveFlowScalar(t,e.options.strict,s),c=n?e.directives.tagName(n.source,u=>s(n,"TAG_RESOLVE_FAILED",u)):null,f;e.options.stringKeys&&e.atKey?f=e.schema[Ye.SCALAR]:c?f=Gd(e.schema,r,c,n,s):t.type==="scalar"?f=Hd(e,r,t,s):f=e.schema[Ye.SCALAR];let m;try{let u=f.resolve(r,l=>s(n??t,"TAG_RESOLVE_FAILED",l),e.options);m=Ye.isScalar(u)?u:new Na.Scalar(u)}catch(u){let l=u instanceof Error?u.message:String(u);s(n??t,"TAG_RESOLVE_FAILED",l),m=new Na.Scalar(r)}return m.range=a,m.source=r,i&&(m.type=i),c&&(m.tag=c),f.format&&(m.format=f.format),o&&(m.comment=o),m}function Gd(e,t,n,s,r){if(n==="!")return e[Ye.SCALAR];let i=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(t))return a;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ye.SCALAR])}function Hd({atKey:e,directives:t,schema:n},s,r,i){let o=n.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(s))||n[Ye.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(s))??n[Ye.SCALAR];if(o.tag!==a.tag){let c=t.tagString(o.tag),f=t.tagString(a.tag),m=`Value may be parsed as either ${c} or ${f}`;i(r,"TAG_RESOLVE_FAILED",m,!0)}}return o}Ea.composeScalar=Jd});var Ta=M(Ca=>{"use strict";function Xd(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let r=t[s];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++s];r?.type==="space";)e+=r.source.length,r=t[++s];break}}return e}Ca.emptyScalarPosition=Xd});var La=M(Rr=>{"use strict";var Qd=yt(),Zd=U(),ep=va(),qa=xa(),tp=st(),np=Ta(),sp={composeNode:Ma,composeEmptyNode:Ir};function Ma(e,t,n,s){let r=e.atKey,{spaceBefore:i,comment:o,anchor:a,tag:c}=n,f,m=!0;switch(t.type){case"alias":f=rp(e,t,s),(a||c)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":f=qa.composeScalar(e,t,c,s),a&&(f.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{f=ep.composeCollection(sp,e,t,n,s),a&&(f.anchor=a.source.substring(1))}catch(u){let l=u instanceof Error?u.message:String(u);s(t,"RESOURCE_EXHAUSTION",l)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",u),m=!1}}return f??(f=Ir(e,t.offset,void 0,null,n,s)),a&&f.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!Zd.isScalar(f)||typeof f.value!="string"||f.tag&&f.tag!=="tag:yaml.org,2002:str")&&s(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(f.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?f.comment=o:f.commentBefore=o),e.options.keepSourceTokens&&m&&(f.srcToken=t),f}function Ir(e,t,n,s,{spaceBefore:r,comment:i,anchor:o,tag:a,end:c},f){let m={type:"scalar",offset:np.emptyScalarPosition(t,n,s),indent:-1,source:""},u=qa.composeScalar(e,m,a,f);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&f(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=c),u}function rp({options:e},{offset:t,source:n,end:s},r){let i=new Qd.Alias(n.substring(1));i.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+n.length,a=tp.resolveEnd(s,o,e.strict,r);return i.range=[t,o,a.offset],a.comment&&(i.comment=a.comment),i}Rr.composeEmptyNode=Ir;Rr.composeNode=Ma});var Ra=M(Ia=>{"use strict";var ip=Lt(),Pa=La(),op=st(),ap=Ft();function lp(e,t,{offset:n,start:s,value:r,end:i},o){let a=Object.assign({_directives:t},e),c=new ip.Document(void 0,a),f={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},m=ap.resolveProps(s,{indicator:"doc-start",next:r??i?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});m.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!m.hasNewline&&o(m.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?Pa.composeNode(f,r,m,o):Pa.composeEmptyNode(f,m.end,s,null,m,o);let u=c.contents.range[2],l=op.resolveEnd(i,u,!1,o);return l.comment&&(c.comment=l.comment),c.range=[n,u,l.offset],c}Ia.composeDoc=lp});var Dr=M(ja=>{"use strict";var cp=en("process"),fp=Ss(),up=Lt(),Dt=Rt(),Fa=U(),dp=Ra(),pp=st();function jt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function Da(e){let t="",n=!1,s=!1;for(let r=0;r<e.length;++r){let i=e[r];switch(i[0]){case"#":t+=(t===""?"":s?`
|
|
100
100
|
|
|
101
101
|
`:`
|
|
102
|
-
`)+(
|
|
103
|
-
${s}`:s;else if(
|
|
104
|
-
${a}`:s}else{let o=
|
|
105
|
-
${o}`:s}}if(n){for(let
|
|
106
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Dt.YAMLParseError(jt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let s=Object.assign({_directives:this.directives},this.options),
|
|
102
|
+
`)+(i.substring(1)||" "),n=!0,s=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}var Fr=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,r,i)=>{let o=jt(n);i?this.warnings.push(new Dt.YAMLWarning(o,s,r)):this.errors.push(new Dt.YAMLParseError(o,s,r))},this.directives=new fp.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:s,afterEmptyLine:r}=Da(this.prelude);if(s){let i=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
103
|
+
${s}`:s;else if(r||t.directives.docStart||!i)t.commentBefore=s;else if(Fa.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];Fa.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
|
|
104
|
+
${a}`:s}else{let o=i.commentBefore;i.commentBefore=o?`${s}
|
|
105
|
+
${o}`:s}}if(n){for(let i=0;i<this.errors.length;++i)t.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)t.warnings.push(this.warnings[i])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Da(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,s=-1){for(let r of t)yield*this.next(r);yield*this.end(n,s)}*next(t){switch(cp.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,s,r)=>{let i=jt(t);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",s,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=dp.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"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(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new Dt.YAMLParseError(jt(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new Dt.YAMLParseError(jt(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=pp.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
|
|
106
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Dt.YAMLParseError(jt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let s=Object.assign({_directives:this.directives},this.options),r=new up.Document(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};ja.Composer=Fr});var Ka=M(Vn=>{"use strict";var hp=Mr(),mp=Pr(),gp=Rt(),_a=vt();function yp(e,t=!0,n){if(e){let s=(r,i,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,i,o);else throw new gp.YAMLParseError([a,a+1],i,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return mp.resolveFlowScalar(e,t,s);case"block-scalar":return hp.resolveBlockScalar({options:{strict:t}},e,s)}}return null}function bp(e,t){let{implicitKey:n=!1,indent:s,inFlow:r=!1,offset:i=-1,type:o="PLAIN"}=t,a=_a.stringifyString({type:o,value:e},{implicitKey:n,indent:s>0?" ".repeat(s):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:s,source:`
|
|
107
107
|
`}];switch(a[0]){case"|":case">":{let f=a.indexOf(`
|
|
108
108
|
`),m=a.substring(0,f),u=a.substring(f+1)+`
|
|
109
|
-
`,l=[{type:"block-scalar-header",offset:
|
|
110
|
-
`}),{type:"block-scalar",offset:
|
|
111
|
-
`),s=t.substring(0,n),
|
|
112
|
-
`;if(e.type==="block-scalar"){let
|
|
113
|
-
`});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:
|
|
114
|
-
`};delete e.items,Object.assign(e,{type:n,source:t,end:[
|
|
109
|
+
`,l=[{type:"block-scalar-header",offset:i,indent:s,source:m}];return Ba(l,c)||l.push({type:"newline",offset:-1,indent:s,source:`
|
|
110
|
+
`}),{type:"block-scalar",offset:i,indent:s,props:l,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:s,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:s,source:a,end:c};default:return{type:"scalar",offset:i,indent:s,source:a,end:c}}}function wp(e,t,n={}){let{afterKey:s=!1,implicitKey:r=!1,inFlow:i=!1,type:o}=n,a="indent"in e?e.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let f=e.props[0];if(f.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=f.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=_a.stringifyString({type:o,value:t},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":kp(e,c);break;case'"':jr(e,c,"double-quoted-scalar");break;case"'":jr(e,c,"single-quoted-scalar");break;default:jr(e,c,"scalar")}}function kp(e,t){let n=t.indexOf(`
|
|
111
|
+
`),s=t.substring(0,n),r=t.substring(n+1)+`
|
|
112
|
+
`;if(e.type==="block-scalar"){let i=e.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=s,e.source=r}else{let{offset:i}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:s}];Ba(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
113
|
+
`});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:r})}}function Ba(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function jr(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let s=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let i of s)i.offset+=r;delete e.props,Object.assign(e,{type:n,source:t,end:s});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
114
|
+
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let s="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(e))i!=="type"&&i!=="offset"&&delete e[i];Object.assign(e,{type:n,indent:s,source:t,end:r})}}}Vn.createScalarToken=bp;Vn.resolveAsScalar=yp;Vn.setScalarValue=wp});var Ya=M(Ua=>{"use strict";var $p=e=>"type"in e?Gn(e):Jn(e);function Gn(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Gn(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=Jn(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=Jn(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=Jn(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function Jn({start:e,key:t,sep:n,value:s}){let r="";for(let i of e)r+=i.source;if(t&&(r+=Gn(t)),n)for(let i of n)r+=i.source;return s&&(r+=Gn(s)),r}Ua.stringify=$p});var Ja=M(Va=>{"use strict";var _r=Symbol("break visit"),vp=Symbol("skip children"),za=Symbol("remove item");function ze(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Wa(Object.freeze([]),e,t)}ze.BREAK=_r;ze.SKIP=vp;ze.REMOVE=za;ze.itemAtPath=(e,t)=>{let n=e;for(let[s,r]of t){let i=n?.[s];if(i&&"items"in i)n=i.items[r];else return}return n};ze.parentCollection=(e,t)=>{let n=ze.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],r=n?.[s];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Wa(e,t,n){let s=n(t,e);if(typeof s=="symbol")return s;for(let r of["key","value"]){let i=t[r];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=Wa(Object.freeze(e.concat([[r,o]])),i.items[o],n);if(typeof a=="number")o=a-1;else{if(a===_r)return _r;a===za&&(i.items.splice(o,1),o-=1)}}typeof s=="function"&&r==="key"&&(s=s(t,e))}}return typeof s=="function"?s(t,e):s}Va.visit=ze});var Hn=M(fe=>{"use strict";var Br=Ka(),Sp=Ya(),Op=Ja(),Kr="\uFEFF",Ur="",Yr="",zr="",Ap=e=>!!e&&"items"in e,Np=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Ep(e){switch(e){case Kr:return"<BOM>";case Ur:return"<DOC>";case Yr:return"<FLOW_END>";case zr:return"<SCALAR>";default:return JSON.stringify(e)}}function xp(e){switch(e){case Kr:return"byte-order-mark";case Ur:return"doc-mode";case Yr:return"flow-error-end";case zr:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
115
115
|
`:case`\r
|
|
116
|
-
`: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(e[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}fe.createScalarToken=
|
|
117
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
118
|
-
\r `),
|
|
116
|
+
`: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(e[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}fe.createScalarToken=Br.createScalarToken;fe.resolveAsScalar=Br.resolveAsScalar;fe.setScalarValue=Br.setScalarValue;fe.stringify=Sp.stringify;fe.visit=Op.visit;fe.BOM=Kr;fe.DOCUMENT=Ur;fe.FLOW_END=Yr;fe.SCALAR=zr;fe.isCollection=Ap;fe.isScalar=Np;fe.prettyToken=Ep;fe.tokenType=xp});var Jr=M(Ha=>{"use strict";var _t=Hn();function ge(e){switch(e){case void 0:case" ":case`
|
|
117
|
+
`:case"\r":case" ":return!0;default:return!1}}var Ga=new Set("0123456789ABCDEFabcdef"),Cp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Xn=new Set(",[]{}"),Tp=new Set(` ,[]{}
|
|
118
|
+
\r `),Wr=e=>!e||Tp.has(e),Vr=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(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
|
|
119
119
|
`?!0:n==="\r"?this.buffer[t+1]===`
|
|
120
|
-
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+t];if(n==="\r"){let
|
|
121
|
-
`||!
|
|
120
|
+
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+t];if(n==="\r"){let r=this.buffer[s+t+1];if(r===`
|
|
121
|
+
`||!r&&!this.atEnd)return t+s+1}return n===`
|
|
122
122
|
`||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){let s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&ge(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
123
|
-
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===_t.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,s=t.indexOf("#");for(;s!==-1;){let
|
|
124
|
-
`,this.pos);if(
|
|
125
|
-
`,
|
|
126
|
-
`:t=
|
|
127
|
-
`)break}default:break e}if(!s&&!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
|
|
128
|
-
`,
|
|
129
|
-
`;)s=this.buffer[++
|
|
130
|
-
`&&
|
|
131
|
-
`?(s+=1,
|
|
132
|
-
`,
|
|
133
|
-
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&Xn.has(
|
|
123
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===_t.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,s=t.indexOf("#");for(;s!==-1;){let i=t[s-1];if(i===" "||i===" "){n=s-1;break}else s=t.indexOf("#",s+1)}for(;;){let i=t[n-1];if(i===" "||i===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield _t.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&ge(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&&!ge(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ge(n)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.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(Wr),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&r[0]!=="#"||s===0&&(r.startsWith("---")||r.startsWith("..."))&&ge(r[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield _t.FLOW_END,yield*this.parseLineStart();let i=0;for(;r[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-i),"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(Wr),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ge(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let i=0;for(;this.buffer[n-1-i]==="\\";)i+=1;if(i%2===0)break;n=this.buffer.indexOf('"',n+1)}let s=this.buffer.substring(0,n),r=s.indexOf(`
|
|
124
|
+
`,this.pos);if(r!==-1){for(;r!==-1;){let i=this.continueScalar(r+1);if(i===-1)break;r=s.indexOf(`
|
|
125
|
+
`,i)}r!==-1&&(n=r-(s[r-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 t=this.pos;for(;;){let n=this.buffer[++t];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=>ge(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let i=this.pos;s=this.buffer[i];++i)switch(s){case" ":n+=1;break;case`
|
|
126
|
+
`:t=i,n=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
127
|
+
`)break}default:break e}if(!s&&!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 i=this.continueScalar(t+1);if(i===-1)break;t=this.buffer.indexOf(`
|
|
128
|
+
`,i)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(s=this.buffer[r];s===" ";)s=this.buffer[++r];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
129
|
+
`;)s=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let i=t-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
|
|
130
|
+
`&&i>=this.pos&&i+1+n>a)t=i;else break}while(!0);return yield _t.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){let i=this.buffer[s+1];if(ge(i)||t&&Xn.has(i))break;n=s}else if(ge(r)){let i=this.buffer[s+1];if(r==="\r"&&(i===`
|
|
131
|
+
`?(s+=1,r=`
|
|
132
|
+
`,i=this.buffer[s+1]):n=s),i==="#"||t&&Xn.has(i))break;if(r===`
|
|
133
|
+
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&Xn.has(r))break;n=s}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield _t.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Wr),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,s=this.charAt(1);if(ge(s)||n&&Xn.has(s)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!ge(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(Cp.has(n))n=this.buffer[++t];else if(n==="%"&&Ga.has(this.buffer[t+1])&&Ga.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
134
134
|
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
135
|
-
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");let
|
|
135
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Ha.Lexer=Vr});var Hr=M(Xa=>{"use strict";var Gr=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n<s;){let i=n+s>>1;this.lineStarts[i]<t?n=i+1:s=i}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}};Xa.LineCounter=Gr});var Qr=M(nl=>{"use strict";var qp=en("process"),Qa=Hn(),Mp=Jr();function Re(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Za(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function tl(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Qn(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function rt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Zn(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function el(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Re(t.start,"explicit-key-ind")&&!Re(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,tl(t.value)?t.value.end?Zn(t.value.end,t.sep):t.value.end=t.sep:Zn(t.start,t.sep),delete t.sep)}var Xr=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Mp.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(t,n))yield*this.next(s);n||(yield*this.end())}*next(t){if(this.source=t,qp.env.LOG_TOKENS&&console.log("|",Qa.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=Qa.tokenType(t);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+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let s=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.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(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??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 s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&el(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{let r=s.items[s.items.length-1];if(r.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=s.items[s.items.length-1];r.value?s.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=s.items[s.items.length-1];!r||r.value?s.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&Za(r.start)===-1&&(n.indent===0||r.start.every(i=>i.type!=="comment"||i.indent<n.indent))&&(s.type==="document"?s.end=r.start:s.items.push({start:r.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 t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{Za(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Qn(this.peek(2)),s=rt(n),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let i={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
136
136
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
137
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.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)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let
|
|
137
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.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)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Zn(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let s=!this.onKeyLine&&this.indent===t.indent,r=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(i.push(this.sourceToken),t.items.push({start:i}),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):r||n.value?(i.push(this.sourceToken),t.items.push({start:i,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)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Re(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(tl(n.key)&&!Re(n.sep,"newline")){let o=rt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else i.length>0?n.sep=n.sep.concat(i,this.sourceToken):n.sep.push(this.sourceToken);else if(Re(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=rt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:i,key:null,sep:[this.sourceToken]}):Re(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 o=this.flowScalar(this.type);r||n.value?(t.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Re(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 s&&t.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){Zn(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Re(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.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?t.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 r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let r=Qn(s),i=rt(r);el(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
138
138
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
139
|
-
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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=Qn(t),s=
|
|
140
|
-
`).length}var ee=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[\s._-]+/g,"")
|
|
141
|
-
`),s=n.findIndex(i=>new RegExp(`^\\s*${t}:`).test(i));return s<0?1:/:\s*[|>][-+]?\s*$/.test(n[s])?s+2:s+1}var Zp=new Set(["LogCustomTelemetryEvent","CSATQuestion","SearchAndSummarizeContent","SearchKnowledgeSources"]),eh={topics:"topic",actions:"action",knowledge:"knowledge",variables:"variable"},th=/^workflows\/([^/]+)\/(.+)$/;function nh(e,t,n){let s={id:e,facts:{},children:[],unknown:[],names:{},texts:[],contract:[],flows:[],telemetry:[]},i=[],r=new Map,o=[],a=d=>rt(d,"/").replace(/(\.topic)?\.mcs\.ya?ml$|\.ya?ml$/,""),c=[],f=[],m=[],u=[],l=new Map;for(let d of[...t].sort((h,y)=>h.path.localeCompare(y.path))){let h=th.exec(d.path);if(h&&(/\.json$/.test(d.path)||/^metadata\.ya?ml$/.test(h[2]))){let b=l.get(h[1])??{json:{}};if(l.set(h[1],b),/\.json$/.test(d.path)){try{b.json[h[2]]={file:d.path,text:d.text,data:JSON.parse(d.text)}}catch{s.unknown.push({file:d.path,why:"json"})}continue}let T=ll(d.text);T==="yaml"||T==="empty"?s.unknown.push({file:d.path,why:T}):[b.meta,b.metaFile]=[J(T.data),d.path];continue}if(!/\.ya?ml$/.test(d.path)){s.unknown.push({file:d.path,why:"file"});continue}let y=ll(d.text);if(y==="yaml"||y==="empty"){s.unknown.push({file:d.path,why:y});continue}let w=J(y.data),v=/^agents\/([^/]+)\//.exec(d.path)?.[1],O=s.facts;if(v){let b=s.children.find(T=>T.name===v);b||s.children.push(b={name:v,facts:{}}),O=b.facts}let E=(b,T,R=O)=>(R[b]??=[]).push({file:d.path,line:y.lineOf(T??w)});if(v&&E(`child:${v}`,w,s.facts),!v&&/^settings\.mcs\.ya?ml$/.test(d.path)&&w){s.schemaName=_(w.schemaName)??s.schemaName,s.displayName=_(w.displayName)??s.displayName,_(w.authenticationMode)&&E(`auth:${w.authenticationMode}`);let b=J(w.configuration),T=J(b?.settings)?.GenerativeActionsEnabled;typeof T=="boolean"&&E(`setting:generative=${T?"on":"off"}`,b),b?.isAgentConnectable===!0&&E("setting:connectable",b);continue}let S=n?[...ot(w)].map(b=>b.kind).find(b=>!n.has(b)):void 0;if(S&&s.unknown.push({file:d.path,why:"kind",kind:S}),typeof w?.kind!="string"){S||s.unknown.push({file:d.path,why:"kind"});continue}if(w.state==="Inactive"||w.status==="Inactive"){E(`disabled:${eh[d.path.split("/")[v?2:0]]??"component"}:${a(d.path)}`);continue}let C=d.text,q=(b,T,R)=>{v||!_(R)||Hp.test(rt(d.path,"/"))||s.texts.push({source:b,file:d.path,line:Qp(C,T),text:R.trimEnd().slice(0,Xp)})},x=(b,T)=>{_(b)&&(E("instructions:present",T),/\b(Today|Now)\(\)/.test(b)&&E("ms:date-context",T))};switch(w.kind){case"GptComponentMetadata":{s.displayName??=_(w.displayName),x(w.instructions,w),q("instructions","instructions",w.instructions),q("instructions","responseInstructions",w.responseInstructions);let b=J(w.aISettings),T=oe=>oe===!0?"on":"off";typeof b?.useModelKnowledge=="boolean"&&E(`setting:model-knowledge=${T(b.useModelKnowledge)}`,b),_(b?.contentModeration)&&E(`setting:moderation=${b.contentModeration.toLowerCase()}`,b),typeof b?.isSemanticSearchEnabled=="boolean"&&E(`setting:semantic-search=${T(b.isSemanticSearchEnabled)}`,b);let R=J(w.gptCapabilities);typeof R?.webBrowsing=="boolean"&&E(`setting:web-browsing=${T(R.webBrowsing)}`,R);let j=J(J(w.aISettings)?.model);_(j?.modelNameHint)&&E(`model:${j.modelNameHint}`,j);break}case"AgentDialog":{let b=J(w.beginDialog);_(b?.kind)&&E(`trigger:${b.kind}`,b),x(J(w.settings)?.instructions,w.settings);break}case"AdaptiveDialog":{let b=J(w.beginDialog),T=_(b?.kind);T&&E(`trigger:${T}`,b),T&&r.set(`${v??""}/${a(d.path)}`,T),_(w.modelDescription)&&E("topics:with-model-description");let R=Ut(J(b?.intent)?.triggerQueries).length;!v&&T==="OnRecognizedIntent"&&!_(w.modelDescription)&&!R&&f.push({kind:"topic",name:a(d.path),at:{file:d.path,line:y.lineOf(w)}}),q("descriptions","modelDescription",w.modelDescription);let j=Ut(w.inputs).some(oe=>J(oe)?.kind==="AutomaticTaskInput"&&J(oe)?.shouldPromptUser===!1);T==="OnRecognizedIntent"&&j&&E("ms:orchestrator-variables",b),T==="OnError"&&C.includes("System.Error.SubCode")&&E("ms:rai-error-handling",b),T==="OnKnowledgeRequested"&&[...ot(b)].some(oe=>oe.kind==="SendActivity")&&E("ms:knowledge-hold-message",b),T==="OnGeneratedResponse"&&C.includes("System.ContinueResponse")&&E("ms:prevent-tool-call-leaks",b);break}case"TaskDialog":{let b=J(w.action);q("descriptions","modelDescription",w.modelDescription),!v&&!_(w.modelDescription)&&f.push({kind:"action",name:a(d.path),at:{file:d.path,line:y.lineOf(w)}});let T=_(b?.connectionReference);if(b?.kind==="InvokeConnectorTaskAction"&&T&&(E(`connector:${Yt(T)}`,b),_(b.operationId)&&E(`operation:${Yt(T)}/${b.operationId}`,b)),b?.kind==="InvokeExternalAgentTaskAction"&&J(b.operationDetails)?.kind==="ModelContextProtocolMetadata"&&T&&E(`mcp:${Yt(T)}`,b),b?.kind==="InvokeConnectedAgentTaskAction"&&_(b.botSchemaName)&&(E(`calls:${b.botSchemaName}`,b),v||s.contract.push({calls:b.botSchemaName,..._(w.modelDisplayName)?{name:w.modelDisplayName}:{},history:J(b.historyType)?.kind==="ConversationHistory",inputs:Ut(w.inputs).map(R=>_(J(R)?.propertyName)).filter(R=>!!R),description:_(w.modelDescription)?.trim()??"",file:d.path,line:y.lineOf(b)})),b?.kind==="InvokeFlowTaskAction"&&_(b.flowId)){E(`flow:${b.flowId}`,b);let R=_(w.modelDisplayName)??_(J(w["mcs.metadata"])?.componentName);R&&(s.names[b.flowId]??=R)}break}case"KnowledgeSourceConfiguration":{let b=J(w.source);_(b?.kind)&&E(`knowledge:${b.kind}`,b),b&&"triggerCondition"in b&&E("yaml-only:triggerCondition",b),i.push({file:d.path,line:y.lineOf(w)});break}case"GlobalVariableComponent":{let b=J(w.variable)??w,T=_(b.name)??(_(w.schemaName)?rt(w.schemaName,"."):void 0);if(!T)break;E(`var:${T}`),b.isExternalInitializationAllowed===!0&&E(`var-in:${T}`),v||m.push({name:T,at:{file:d.path,line:y.lineOf(w)}});break}case"ConnectionReferencesSourceFile":for(let b of Ut(w.connectionReferences).map(J)){let T=_(b?.connectorId)?rt(b.connectorId,"/"):_(b?.connectionReferenceLogicalName)?Yt(b.connectionReferenceLogicalName):void 0;T&&E(`connref:${T}`,b),T&&_(b?.displayName)&&(s.names[T]=b.displayName)}break}for(let b of ot(w,!0))E(`disabled:node:${b.kind}`,b);for(let b of ot(w)){if(Zp.has(b.kind)&&E(`node:${b.kind}`,b),b.kind==="LogCustomTelemetryEvent"&&!v&&(_(b.eventName)&&!b.eventName.trim().startsWith("=")?u.push({name:b.eventName.trim(),properties:b.properties,at:{file:d.path,line:y.lineOf(b)}}):s.unknown.push({file:d.path,why:"telemetry"})),b.kind==="InvokeConnectorAction"&&_(b.connectionReference)){let R=Yt(b.connectionReference);E(`connector:${R}`,b),_(b.operationId)&&E(`operation:${R}/${b.operationId}`,b)}if(b.kind==="InvokeFlowAction"&&_(b.flowId)&&E(`flow:${b.flowId}`,b),(b.kind==="BeginDialog"||b.kind==="ReplaceDialog")&&_(b.dialog)){let R=b.dialog;c.push(R),R.startsWith("=")?R.includes("Switch(")&&E("ms:dynamic-topic-redirect",b):o.push({topic:`${v??""}/${rt(R,".topic.")}`,into:O,at:{file:d.path,line:y.lineOf(b)}})}let T=R=>typeof R=="string"&&R.includes("System.Activity.ChannelId");(b.kind==="ConditionGroup"&&Ut(b.conditions).some(R=>T(J(R)?.condition))||b.kind==="SetVariable"&&T(b.value))&&E("ms:channel-aware-behavior",b),(b.kind==="SendActivity"||b.kind==="Question")&&JSON.stringify(b).includes("<br")&&E("ms:line-breaks-in-messages",b)}}i.length&&(s.facts[`knowledge:count=${i.length}`]=i);for(let d of u){let h=yr(d.name,s),y=br(d.properties);(s.facts[`telemetry:event:${h}`]??=[]).push(d.at);for(let w of y??[])(s.facts[`telemetry:field:${h}/${w}`]??=[]).push(d.at);s.telemetry.push({name:d.name,form:h,...y?{fields:y}:{},...d.at})}let p=new Set([s.facts,...s.children.map(d=>d.facts)].flatMap(d=>Object.keys(d)).filter(d=>d.startsWith("flow:")).map(d=>d.slice(5)));for(let[d,{meta:h,metaFile:y,json:w}]of[...l].sort(([v],[O])=>v.localeCompare(O))){let v=_(h?.jsonFileName)??Object.keys(w)[0],O=v?w[v]:void 0,E=_(h?.workflowId),S=d.replace(/-[0-9a-f]{6,}$/i,"");if(!O){y&&s.unknown.push({file:y,why:"flow"});continue}let C=gr(O.data);if(!C||!E){s.unknown.push({file:O.file,why:"flow"});continue}let q=_(h?.displayName)??_(J(J(O.data)?.properties)?.displayName)??S,x=p.has(E);if(s.flows.push({id:E,name:q,folder:d,uses:C.uses.map(b=>b.key),returns:!!C.returns,called:x,file:O.file}),s.names[E]??=q,!x){(s.facts[`orphan:flow:${S}`]??=[]).push({file:y??O.file,line:1}),s.names[S]??=q;continue}for(let b of C.uses)(s.facts[`flow-uses:${b.key}`]??=[]).push({file:O.file,line:ws(O.text,b.action)});C.returns&&(s.facts["flow-returns"]??=[]).push({file:O.file,line:ws(O.text,C.returns)})}for(let d of f)c.some(h=>h===d.name||h.endsWith(`.${d.name}`))||(s.facts[`orphan:${d.kind}:${d.name}`]??=[]).push(d.at);for(let d of m)t.some(y=>y.path!==d.at.file&&new RegExp(`\\bGlobal\\.${d.name}\\b`).test(y.text))||(delete s.facts[`var:${d.name}`],delete s.facts[`var-in:${d.name}`],(s.facts[`orphan:variable:${d.name}`]??=[]).push(d.at));for(let d of o){let h=r.get(d.topic);(d.into[h?`reaches:${h}`:`calls:topic:${rt(d.topic,"/")}`]??=[]).push(d.at)}for(let d of[s.facts,...s.children.map(h=>h.facts)])for(let[h,y]of Object.entries(d))d[h]=y.filter((w,v)=>y.findIndex(O=>O.file===w.file&&O.line===w.line)===v);return s}function sh(e){let t=new Set,n=i=>{if(!i||typeof i!="object")return;let{const:r,enum:o}=i;if(typeof r=="string"&&t.add(r),Array.isArray(o))for(let a of o)typeof a=="string"&&t.add(a)},s=i=>{if(Array.isArray(i))return i.forEach(s);if(!i||typeof i!="object")return;let r=i;n(r.kind),n(r.properties?.kind);for(let o of Object.values(r))s(o)};for(let i of Object.values(e.definitions??{}))s(i);return t}var at=ys(ts(),1);function ns(e,t){let n=new at.LineCounter,s=(0,at.parseDocument)(e,{lineCounter:n,prettyErrors:!1}),i=o=>{for(let a=o;a.length;a=a.slice(0,-1)){let c=s.getIn(a,!0);if(c?.range)return n.linePos(c.range[0]).line}return 1};if(s.errors.length)return{ok:!1,problem:{line:n.linePos(s.errors[0].pos[0]).line,key:"syntax",detail:s.errors[0].code}};let r=s.toJS();return!r||typeof r!="object"||Array.isArray(r)||r.format!==t||!(0,at.isMap)(s.contents)?{ok:!1,problem:{line:i(["format"]),key:"format"}}:{ok:!0,format:{raw:r,doc:s,at:i,lineOf:o=>n.linePos(o).line}}}var ss=[{id:"orchestrator-variables",name:"Orchestrator-Generated Variables",sign:"an OnRecognizedIntent topic with an AutomaticTaskInput that has shouldPromptUser: false"},{id:"rai-error-handling",name:"RAI Error Handling",sign:"the OnError topic reads System.Error.SubCode"},{id:"knowledge-hold-message",name:"Knowledge Hold Message",sign:"an OnKnowledgeRequested topic that sends a message"},{id:"prevent-tool-call-leaks",name:"Prevent Tool Call Leaks",sign:"an OnGeneratedResponse topic that sets System.ContinueResponse"},{id:"dynamic-topic-redirect",name:"Dynamic Topic Redirect",sign:"a BeginDialog whose dialog is a =Switch( expression"},{id:"channel-aware-behavior",name:"Channel-Aware Behavior",sign:"a condition or SetVariable that reads System.Activity.ChannelId (not a tool input)"},{id:"date-context",name:"Date Context",sign:"the instructions use Today() or Now()"},{id:"line-breaks-in-messages",name:"Line Breaks in Messages",sign:"<br /> inside a SendActivity or Question"},{id:"conversation-history-variable",name:"Conversation History Variable"},{id:"chain-of-thought-logging",name:"Chain of Thought Logging"},{id:"deterministic-mcp-calls",name:"Deterministic MCP Calls"},{id:"prevent-child-agent-responses",name:"Prevent Child Agent Responses"},{id:"jit-glossary",name:"JIT Glossary"},{id:"jit-user-context",name:"JIT User Context"},{id:"teams-production-hardening",name:"Teams Production Hardening"}];var er={conversation:{en:"A. Conversation",pt:"A. Conversa"},integrations:{en:"B. Integrations",pt:"B. Integra\xE7\xF5es"},knowledge:{en:"C. Knowledge",pt:"C. Conhecimento"},orchestration:{en:"D. Orchestrator",pt:"D. Orquestrador"},governance:{en:"E. Governance",pt:"E. Governan\xE7a"},text:{en:"F. Text",pt:"F. Texto"},microsoft:{en:"Microsoft patterns",pt:"Padr\xF5es Microsoft"},declared:{en:"Declared",pt:"Declarado"}},is={"trigger:OnConversationStart":{dim:"conversation",en:"Greeting",pt:"Boas-vindas"},"trigger:OnUnknownIntent":{dim:"conversation",en:"Fallback (when it does not understand)",pt:"Fallback (quando n\xE3o entende)"},"trigger:OnEscalate":{dim:"conversation",en:"Escalation to a person",pt:"Escalonamento para humano",lacks:{en:["does not escalate to a person","do not escalate to a person"],pt:["n\xE3o escala para humano","n\xE3o escalam para humano"]}},"trigger:OnError":{dim:"conversation",en:"Error handling",pt:"Tratamento de erro",lacks:{en:["does not handle errors","do not handle errors"],pt:["n\xE3o trata erro","n\xE3o tratam erro"]}},"trigger:OnRecognizedIntent":{dim:"conversation",en:"A topic of its own, by intent",pt:"T\xF3pico pr\xF3prio, por inten\xE7\xE3o"},"trigger:OnRedirect":{dim:"orchestration",en:"Takes a call from the orchestrator",pt:"Recebe chamada do orquestrador",lacks:{en:["takes no call from the orchestrator","take no call from the orchestrator"],pt:["n\xE3o recebe chamada do orquestrador","n\xE3o recebem chamada do orquestrador"]}},"trigger:OnSelectIntent":{dim:"conversation",en:"Disambiguation (\xABdid you mean\u2026\xBB)",pt:"Desambigua\xE7\xE3o (\xABvoc\xEA quis dizer\u2026\xBB)"},"trigger:OnSignIn":{dim:"conversation",en:"Sign-in",pt:"Login"},"trigger:OnGeneratedResponse":{dim:"conversation",en:"Reviews the generated answer",pt:"Revisa a resposta gerada"},"trigger:OnKnowledgeRequested":{dim:"knowledge",en:"Before searching knowledge",pt:"Antes de buscar no conhecimento"},"trigger:OnToolSelected":{dim:"orchestration",en:"Child chosen as a tool",pt:"Filho escolhido como ferramenta"},"trigger:OnActivity":{dim:"conversation",en:"On every message",pt:"Em toda mensagem"},"setting:generative=on":{dim:"conversation",en:"Generative orchestration on",pt:"Orquestra\xE7\xE3o generativa ligada"},"setting:generative=off":{dim:"conversation",en:"Generative orchestration off",pt:"Orquestra\xE7\xE3o generativa desligada"},"setting:model-knowledge=on":{dim:"governance",en:"The model's general knowledge on",pt:"Conhecimento geral do modelo ligado"},"setting:model-knowledge=off":{dim:"governance",en:"The model's general knowledge off",pt:"Conhecimento geral do modelo desligado"},"setting:semantic-search=on":{dim:"knowledge",en:"Semantic search on",pt:"Busca sem\xE2ntica ligada"},"setting:semantic-search=off":{dim:"knowledge",en:"Semantic search off",pt:"Busca sem\xE2ntica desligada"},"setting:web-browsing=on":{dim:"knowledge",en:"Web browsing on",pt:"Navega\xE7\xE3o na web ligada"},"setting:web-browsing=off":{dim:"knowledge",en:"Web browsing off",pt:"Navega\xE7\xE3o na web desligada"},"setting:connectable":{dim:"orchestration",en:"Can be called by an orchestrator",pt:"Pode ser chamado por um orquestrador"},"called-with:history":{dim:"orchestration",en:"Receives the conversation history",pt:"Recebe o hist\xF3rico da conversa",lacks:{en:["does not receive the conversation history from the orchestrator","do not receive the conversation history from the orchestrator"],pt:["n\xE3o recebe o hist\xF3rico da conversa do orquestrador","n\xE3o recebem o hist\xF3rico da conversa do orquestrador"]}},"routing:described":{dim:"orchestration",en:"Has a routing description",pt:"Tem descri\xE7\xE3o de roteamento",lacks:{en:["has no routing description","have no routing description"],pt:["n\xE3o tem descri\xE7\xE3o de roteamento","n\xE3o t\xEAm descri\xE7\xE3o de roteamento"]}},"flow-returns":{dim:"integrations",en:"The flow returns an answer",pt:"O fluxo devolve uma resposta",lacks:{en:["has a flow that returns nothing","have a flow that returns nothing"],pt:["tem fluxo que n\xE3o devolve nada","t\xEAm fluxo que n\xE3o devolve nada"]}},"flow-uses:child-flow":{dim:"integrations",en:"The flow calls another flow",pt:"O fluxo chama outro fluxo"},"topics:with-model-description":{dim:"conversation",en:"Topics described for the model",pt:"T\xF3picos descritos para o modelo"},"instructions:present":{dim:"governance",en:"Has instructions",pt:"Tem instru\xE7\xF5es",lacks:{en:["has no instructions","have no instructions"],pt:["n\xE3o tem instru\xE7\xF5es","n\xE3o t\xEAm instru\xE7\xF5es"]}},"node:LogCustomTelemetryEvent":{dim:"governance",en:"Logs telemetry",pt:"Registra telemetria",lacks:{en:["logs no telemetry","log no telemetry"],pt:["n\xE3o registra telemetria","n\xE3o registram telemetria"]}},"node:CSATQuestion":{dim:"governance",en:"Asks for satisfaction (CSAT)",pt:"Pergunta a satisfa\xE7\xE3o (CSAT)",lacks:{en:["does not ask for satisfaction","do not ask for satisfaction"],pt:["n\xE3o pergunta a satisfa\xE7\xE3o","n\xE3o perguntam a satisfa\xE7\xE3o"]}},"node:SearchAndSummarizeContent":{dim:"knowledge",en:"Generative answers from knowledge",pt:"Respostas generativas sobre o conhecimento"},"node:SearchKnowledgeSources":{dim:"knowledge",en:"Searches the knowledge sources",pt:"Busca nas fontes de conhecimento"},"yaml-only:triggerCondition":{dim:"knowledge",en:"Search condition only in YAML (the editor may erase it)",pt:"Condi\xE7\xE3o de busca s\xF3 no YAML (a tela pode apagar)"},"knowledge:SharePointSearchSource":{dim:"knowledge",en:"Knowledge in SharePoint",pt:"Conhecimento no SharePoint"},"declared:kpi":{dim:"declared",en:"KPI declared",pt:"KPI declarado",lacks:{en:["has no KPI declared","have no KPI declared"],pt:["n\xE3o tem KPI declarado","n\xE3o t\xEAm KPI declarado"]}},"declared:owner":{dim:"declared",en:"Owner declared",pt:"Dono declarado",lacks:{en:["has no owner declared","have no owner declared"],pt:["n\xE3o tem dono declarado","n\xE3o t\xEAm dono declarado"]}}},ih=Object.fromEntries(ss.map(e=>[e.id,e.name])),rh=[["called-with:input:","orchestration","Receives <value> from the orchestrator","Recebe <valor> do orquestrador"],["flow-uses:http:","integrations","Flow calls","Fluxo chama"],["flow-uses:connector:","integrations","Flow uses the connector","Fluxo usa o conector"],["flow-uses:operation:","integrations","Flow uses the operation","Fluxo usa a opera\xE7\xE3o"],["orphan:topic:","governance","Topic nobody calls","T\xF3pico que ningu\xE9m chama"],["orphan:action:","governance","Tool nobody can choose","Ferramenta que ningu\xE9m escolhe"],["orphan:variable:","governance","Variable nobody uses","Vari\xE1vel que ningu\xE9m usa"],["orphan:flow:","governance","Flow nobody calls","Fluxo que ningu\xE9m chama"],["disabled:node:","governance","Switched-off node","N\xF3 desligado"],["telemetry:event:","governance","Logs the event","Registra o evento"],["telemetry:field:","governance","The event carries the field (<event>/<field>)","O evento leva o campo (<evento>/<campo>)"],["disabled:","governance","Switched off","Desligado"],["reaches:","conversation","A topic leads to it (part of trigger:<value>)","Um t\xF3pico leva a ele (parte de trigger:<valor>)"],["calls:topic:","conversation","Calls the topic (one not found)","Chama o t\xF3pico (n\xE3o encontrado)"],["trigger:","conversation","Trigger","Gatilho"],["setting:","conversation","Setting","Configura\xE7\xE3o"],["connector:","integrations","Connector","Conector"],["operation:","integrations","Operation","Opera\xE7\xE3o"],["connref:","integrations","Connection reference","Refer\xEAncia de conex\xE3o"],["mcp:","integrations","MCP server","Servidor MCP"],["flow:","integrations","Flow","Fluxo"],["knowledge:","knowledge","Knowledge","Conhecimento"],["node:","governance","Node","N\xF3"],["calls:","orchestration","Calls","Chama"],["child:","orchestration","Child","Filho"],["var-in:","orchestration","Receives from the orchestrator","Recebe do orquestrador"],["var:","orchestration","Global variable","Vari\xE1vel global"],["model:","governance","Model","Modelo"],["auth:","governance","Sign-in","Login"],["ms:","microsoft","Microsoft pattern:","Padr\xE3o Microsoft:"],["text:","text","Text:","Texto:"],["declared:","declared","Declared:","Declarado:"]],fl=e=>rh.find(([t])=>e.startsWith(t)),ul=e=>!!is[e]?.lacks;function zt(e){return e.startsWith("reaches:")?zt(`trigger:${e.slice(8)}`):is[e]?.dim??fl(e)?.[1]??"governance"}var De=(e,t)=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t,dl=80;function lt(e){if(e.startsWith("reaches:"))return`trigger:${e.slice(8)}`;if(e.startsWith("telemetry:event:"))return"node:LogCustomTelemetryEvent";if(e.startsWith("telemetry:field:"))return`telemetry:event:${e.slice(16,e.lastIndexOf("/"))}`}var ke=(e,t)=>e.split("{agent}").join(t==="pt"?"\u2039nome\u203A":"\u2039name\u203A"),pl=e=>({form:e.slice(16,e.lastIndexOf("/")),field:e.slice(e.lastIndexOf("/")+1)}),cl=(e,t)=>t?.[e]??e;function pe(e,t,n){let s=is[e];if(s)return s[t];if(e.startsWith("text:block:")){let a=e.endsWith("~variant"),c=a?e.slice(0,-8):e,f=n?.[c]??c.slice(11);return a?`${f} (${t==="pt"?"varia\xE7\xE3o":"variation"})`:f}if(e.startsWith("text:link-domain:"))return`${t==="pt"?"Link para":"Link to"} ${e.slice(17)}`;if(e==="text:email")return t==="pt"?"Cita um e-mail":"Mentions an e-mail";if(e.startsWith("text:")){let[a,c]=[e.slice(5).split("=")[0],e.includes("=")?e.slice(e.indexOf("=")+1):void 0],f=n?.[`text:${a}`]??a;return c===void 0?f:`${f} = ${c}`}if(e.startsWith("reaches:")){let a=pe(`trigger:${e.slice(8)}`,t);return t==="pt"?`Um t\xF3pico leva a \xAB${a}\xBB`:`A topic leads to \xAB${a}\xBB`}if(e.startsWith("called-with:input:"))return t==="pt"?`Recebe \xAB${e.slice(18)}\xBB do orquestrador`:`Receives \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:"))return t==="pt"?`Registra o evento \xAB${ke(e.slice(16),t)}\xBB`:`Logs the event \xAB${ke(e.slice(16),t)}\xBB`;if(e.startsWith("telemetry:field:")){let{form:a,field:c}=pl(e),f=ke(a,t);return t==="pt"?`\xAB${f}\xBB leva \xAB${c}\xBB`:`\xAB${f}\xBB carries \xAB${c}\xBB`}let i=/^knowledge:count=(\d+)$/.exec(e);if(i){let a=Number(i[1]);return t==="pt"?`${a} ${a===1?"fonte":"fontes"} de conhecimento`:`${a} knowledge ${a===1?"source":"sources"}`}let r=fl(e);if(!r)return e;let o=e.slice(r[0].length);if(r[0]==="ms:"&&(o=ih[o]??o),r[0]==="auth:"&&o==="None")return t==="pt"?"Sem login":"No sign-in";if(e.startsWith("setting:moderation="))return t==="pt"?`Modera\xE7\xE3o de conte\xFAdo: ${e.slice(19)}`:`Content moderation: ${e.slice(19)}`;if(["connector:","connref:","mcp:","calls:","flow:","flow-uses:connector:","orphan:flow:"].includes(r[0])&&(o=cl(o,n)),r[0]==="disabled:"&&(o=o.replace(":"," ")),r[0]==="operation:"||r[0]==="flow-uses:operation:"){let[a,c]=[o.slice(0,o.indexOf("/")),o.slice(o.indexOf("/")+1)];o=`${cl(a,n)} \xB7 ${c}`}return`${r[t==="pt"?3:2]} ${o}`}function rs(e,t,n,s){let i=is[e]?.lacks?.[t];if(i)return i[n===1?0:1];if(e.startsWith("reaches:")){let o=pe(`trigger:${e.slice(8)}`,t);return t==="pt"?`${n===1?"tem":"t\xEAm"} \xAB${o}\xBB, mas nenhum t\xF3pico leva a ele`:`${n===1?"has":"have"} \xAB${o}\xBB, but no topic leads to it`}if(e.startsWith("called-with:input:"))return t==="pt"?`${n===1?"n\xE3o recebe":"n\xE3o recebem"} \xAB${e.slice(18)}\xBB do orquestrador`:`${n===1?"does":"do"} not receive \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:")){let o=ke(e.slice(16),t);return t==="pt"?`${n===1?"n\xE3o registra":"n\xE3o registram"} o evento \xAB${o}\xBB`:`${n===1?"does":"do"} not log the event \xAB${o}\xBB`}if(e.startsWith("telemetry:field:")){let{form:o,field:a}=pl(e),c=ke(o,t);return t==="pt"?`${n===1?"registra":"registram"} \xAB${c}\xBB sem \xAB${a}\xBB`:`${n===1?"logs":"log"} \xAB${c}\xBB without \xAB${a}\xBB`}if(e.startsWith("calls:topic:"))return t==="pt"?`${n===1?"n\xE3o chama":"n\xE3o chamam"} o t\xF3pico ${e.slice(12)}`:`${n===1?"does":"do"} not call the topic ${e.slice(12)}`;let r=pe(e,t,s);return t==="pt"?`${n===1?"n\xE3o tem":"n\xE3o t\xEAm"} \xAB${r}\xBB`:`${n===1?"does":"do"} not have \xAB${r}\xBB`}var hl="cast-list/profile-v1",nr=["orchestrator","specialist"],tr={roles:{},threshold:.7,minAgents:3,rules:[],markers:[],blocks:[],types:[],focusAreas:[],ignore:[],microsoftPatterns:!0},oh=["format","name","roles","threshold","min_agents","rules","markers","blocks","types","focus_areas","ignore","microsoft_patterns"],ah=["instructions","descriptions","all"],lh=new Set(["trigger","setting","topics","instructions","connector","operation","connref","mcp","flow","knowledge","node","calls","reaches","child","var","var-in","model","auth","ms","declared","text","yaml-only","called-with","routing","flow-uses","flow-returns","orphan","disabled","telemetry"]),ch=e=>lh.has(e.split(":")[0]),We=e=>!!e&&typeof e=="object"&&!Array.isArray(e),G=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"",os=e=>Array.isArray(e)?e.map(G).filter(Boolean):G(e)?[G(e)]:[],ml=e=>nr.includes(e);function fh(e){let t=ns(e,hl);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:hl}:t.problem]};let{raw:n,at:s}=t.format,i=[];for(let S of Object.keys(n))oh.includes(S)||i.push({line:s([S]),key:"unknownKey",what:S});let r=(S,C,q)=>(G(S)||i.push({line:s(q),key:"missing",what:C}),G(S)),o=(S,C)=>{let q=new Set;C.forEach((x,b)=>{x&&q.has(x)&&i.push({line:s([S,b]),key:"duplicate",what:S,id:x}),q.add(x)})},a=S=>Array.isArray(n[S])?n[S]:[],c=n.threshold===void 0?tr.threshold:Number(n.threshold);c>0&&c<=1||i.push({line:s(["threshold"]),key:"threshold",value:G(n.threshold)});let f=n.min_agents===void 0?tr.minAgents:Number(n.min_agents);Number.isInteger(f)&&f>=1||i.push({line:s(["min_agents"]),key:"minAgents",value:G(n.min_agents)});let m={},u=We(n.roles)?n.roles:{};for(let S of Object.keys(u))ml(S)?m[S]=G(u[S])==="*"?"*":os(u[S]):i.push({line:s(["roles",S]),key:"role",what:`roles.${S}`,value:S});let l=(S,C,q)=>(ml(G(S))||i.push({line:s(q),key:"role",what:C,value:G(S)}),G(S)),p=(S,C,q)=>{let x=os(S);for(let b of x)ch(b)||i.push({line:s(q),key:"prefix",what:C,value:b});return x},d=a("rules").filter(We).map((S,C)=>{let q=`rules[${C}]`,x=p(S.has,q,["rules",C])[0],b=p(S.not,q,["rules",C])[0],T=p(S.when,q,["rules",C]);return!x&&!b&&i.push({line:s(["rules",C]),key:"rule",what:q}),{id:r(S.id,`${q}.id`,["rules",C]),...S.role!==void 0?{role:l(S.role,`${q}.role`,["rules",C,"role"])}:{},...T.length?{when:T}:{},...x?{has:x}:{},...b?{not:b}:{},says:G(S.says)||x||`not ${b}`}});o("rules",d.map(S=>S.id));let h=a("markers").filter(We).map((S,C)=>{let q=`markers[${C}]`,x=r(S.pattern,`${q}.pattern`,["markers",C]);try{x&&new RegExp(x,"i")}catch(R){i.push({line:s(["markers",C]),key:"regex",what:`${q}.pattern`,detail:R.message.replace(/^Invalid regular expression: /,"")})}let b=G(S.in)||"instructions";ah.includes(b)||i.push({line:s(["markers",C]),key:"in",what:`${q}.in`,value:b});let T=r(S.id,`${q}.id`,["markers",C]);return{id:T,name:G(S.name)||T,in:b,pattern:x,...G(S.value)?{value:G(S.value)}:{}}});o("markers",h.map(S=>S.id));let y=a("blocks").filter(We).map((S,C)=>{let q=r(S.id,`blocks[${C}].id`,["blocks",C]);return{id:q,name:G(S.name)||q,text:r(S.text,`blocks[${C}].text`,["blocks",C]),role:S.role!==void 0?l(S.role,`blocks[${C}].role`,["blocks",C,"role"]):"specialist"}});o("blocks",y.map(S=>S.id));let w=a("types").filter(We).map((S,C)=>{let q=`types[${C}]`,x=We(S.when)?S.when:{},b=Object.fromEntries(["all","any","none"].filter(j=>x[j]!==void 0).map(j=>[j,p(x[j],q,["types",C])]));!b.all?.length&&!b.any?.length&&i.push({line:s(["types",C]),key:"when",what:q});let T=S.min_agents===void 0?2:Number(S.min_agents);Number.isInteger(T)&&T>=1||i.push({line:s(["types",C,"min_agents"]),key:"minAgents",value:G(S.min_agents)});let R=r(S.id,`${q}.id`,["types",C]);return{id:R,name:G(S.name)||R,when:b,minAgents:T}});o("types",w.map(S=>S.id));let v=a("focus_areas").filter(We).map((S,C)=>{let q=os(S.facts);q.length||i.push({line:s(["focus_areas",C]),key:"missing",what:`focus_areas[${C}].facts`});let x=r(S.id,`focus_areas[${C}].id`,["focus_areas",C]);return{id:x,name:G(S.name)||x,facts:q}});o("focus_areas",v.map(S=>S.id));let O=n.microsoft_patterns,E={...G(n.name)?{name:G(n.name)}:{},roles:m,threshold:c,minAgents:f,rules:d,markers:h,blocks:y,types:w,focusAreas:v,ignore:os(n.ignore),microsoftPatterns:!(O===!1||G(O).toLowerCase()==="off")};return i.length?{problems:i}:{profile:E,problems:i}}var uh=e=>Object.keys(e.facts).some(t=>t.startsWith("calls:")&&!t.startsWith("calls:topic:"));function gl(e,t,n={}){let{orchestrator:s,specialist:i}=t.roles,r=(f,m)=>Array.isArray(f)&&f.includes(m),o=Object.fromEntries(e.map(f=>[f.id,r(s,f.id)?"orchestrator":r(i,f.id)?"specialist":n[f.id]??(s==="*"?"orchestrator":i==="*"?"specialist":uh(f)?"orchestrator":"specialist")])),a=new Set(e.map(f=>f.id)),c=[s,i].flatMap(f=>Array.isArray(f)?f:[]).filter(f=>!a.has(f));return{roles:o,unmatched:c}}function yl(e,t,n,s){let i=(r,o)=>Object.keys(r).some(a=>De(a,o));return Object.fromEntries(e.map(r=>{if(t[r.id]!=="specialist")return[r.id,[]];if(s[r.id]?.length)return[r.id,s[r.id]];let o=n.types.filter(({when:a})=>(a.all??[]).every(c=>i(r.facts,c))&&(!a.any?.length||a.any.some(c=>i(r.facts,c)))&&!(a.none??[]).some(c=>i(r.facts,c)));return[r.id,o.map(a=>a.id)]}))}var $e=ys(ts());var Wt="cast-list/cast-v1",dh=["accepted","rejected"],ph=["platform","specialist","orchestrator"],hh=e=>ph.includes(e)||/^type:[\w-]+$/.test(e),mh=["format","name","agents","blocks","declared","decisions"],gh=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ne=e=>typeof e=="string"?e.trim():typeof e=="number"||typeof e=="boolean"?String(e):"";function yh(e){let t=ns(e,Wt);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:Wt}:t.problem]};let{raw:n,at:s}=t.format,i=[];for(let l of Object.keys(n))mh.includes(l)||i.push({line:s([l]),key:"unknownKey",what:l});let r=l=>(Array.isArray(n[l])?n[l]:[]).filter(gh),o=(l,p,d)=>(ne(l)||i.push({line:s(d),key:"missing",what:p}),ne(l)),a=(l,p)=>{let d=new Set;p.forEach((h,y)=>{h&&d.has(h)&&i.push({line:s([l,y]),key:"duplicate",what:l,id:h}),d.add(h)})},c=r("agents").map((l,p)=>{let d=ne(l.role);nr.includes(d)||i.push({line:s(["agents",p,"role"]),key:"role",what:`agents[${p}].role`,value:d});let h=Array.isArray(l.types)?l.types.map(ne).filter(Boolean):[];return{id:o(l.id,`agents[${p}].id`,["agents",p]),role:d,...h.length?{types:h}:{}}}),f=r("blocks").map((l,p)=>({id:o(l.id,`blocks[${p}].id`,["blocks",p]),text:o(l.text,`blocks[${p}].text`,["blocks",p])}));a("blocks",f.map(l=>l.id)),a("agents",c.map(l=>l.id));let m=r("declared").map((l,p)=>({agent:o(l.agent,`declared[${p}].agent`,["declared",p]),key:o(l.key,`declared[${p}].key`,["declared",p]),value:ne(l.value),source:ne(l.source)}));a("declared",m.map(l=>`${l.agent} ${l.key}`));let u=r("decisions").map((l,p)=>{let d=ne(l.status),h=ne(l.scope);return dh.includes(d)||i.push({line:s(["decisions",p,"status"]),key:"status",value:d}),hh(h)||i.push({line:s(["decisions",p,"scope"]),key:"scope",value:h}),{key:o(l.key,`decisions[${p}].key`,["decisions",p]),status:d,scope:h,why:ne(l.why)}});return a("decisions",u.map(l=>l.key)),i.length?{problems:i}:{cast:{...ne(n.name)?{name:ne(n.name)}:{},agents:c,blocks:f,declared:m,decisions:u},problems:i}}var bh=` What people said about the agents, and what was decided. build.mjs keeps it up to date; edit it, or fill the
|
|
142
|
-
workbook's \xABDeclared\xBB sheet and the \xABDecision\xBB column and read it back with --from
|
|
143
|
-
`),
|
|
144
|
-
`).trim(),c=rr(a,e.file,e.line+s,t);c.words.length>=Sh&&n.push(c),s=-1};return i.forEach((o,a)=>{o.trim()?s<0&&(s=a):r(a)}),r(i.length),n}var Eh=(e,t)=>{let n=e.filter(i=>!i.startsWith("#")).slice(0,5).join("-")||"block",s=n;for(let i=2;t.has(s);i++)s=`${n}-${i}`;return t.add(s),s},$l=e=>{let t=e.split(/\s+/).filter(Boolean);return t.slice(0,8).join(" ")+(t.length>8?"\u2026":"")};function Sl(e,t,n){let s=e.flatMap(u=>u.texts.flatMap(l=>Nh(l,u.id))),i=[];for(let u of s){let l=i.find(p=>as(p[0].shingles,u.shingles)>=sr);l?l.push(u):i.push([u])}let r=n.map(u=>({...u,block:rr(u.text,"profile",0)})),o=t.map(u=>({...u,block:rr(u.text,"cast",0)})),a=new Set([...n.map(u=>u.id),...t.map(u=>u.id)]),c=[],f=new Set;for(let u of i){let l=r.find(v=>!f.has(v.id)&&as(v.block.shingles,u[0].shingles)>=sr);if(new Set(u.map(v=>v.agent)).size<2&&!l)continue;let p=v=>u.filter(O=>kl(O.shingles,v.shingles)>=wl).length,d=l?.block??u.reduce((v,O)=>p(O)>p(v)?O:v,u[0]),h=l?void 0:o.find(v=>!f.has(v.id)&&as(v.block.shingles,d.shingles)>=sr),y=l?.id??h?.id??Eh(d.words,a);f.add(y);let w={id:y,label:$l(d.text),text:d.text,...l?{official:l.name}:{},holders:{},variants:{}};for(let v of u){let O=v.agent,E=kl(d.shingles,v.shingles)>=wl?1:as(d.shingles,v.shingles);E===1?(w.holders[O]??={file:v.file,line:v.line},delete w.variants[O]):!w.holders[O]&&(!w.variants[O]||E>w.variants[O].similarity)&&(w.variants[O]={source:{file:v.file,line:v.line},similarity:E,text:v.text,diff:bl(d.text,v.text)})}c.push(w)}for(let u of r.filter(l=>!f.has(l.id)))c.push({id:u.id,label:$l(u.text),text:u.text,official:u.name,holders:{},variants:{}});let m=Object.fromEntries(e.map(u=>[u.id,{}]));for(let u of c){for(let[l,p]of Object.entries(u.holders))m[l][`text:block:${u.id}`]=[p];for(let[l,p]of Object.entries(u.variants))m[l][`text:block:${u.id}~variant`]=[p.source]}return{families:c,facts:m}}var xh=/https?:\/\/([^\s/)\]>"'«»]+)/gi,Ch=/[\w.+-]+@[\w-]+(\.[\w-]+)+/g,Th=(e,t)=>e.line+(e.text.slice(0,t).match(/\n/g)?.length??0),qh=e=>e.toLowerCase().replace(/\s+/g," ").trim();function Ol(e,t){let n={},s={};for(let i of e){let r=n[i.id]={},o=s[i.id]={},a=(c,f,m)=>(r[c]??=[]).push({file:f.file,line:Th(f,m)});for(let c of i.texts){for(let f of t.filter(m=>m.in==="all"||m.in===c.source))for(let m of c.text.matchAll(new RegExp(f.pattern,"gi"))){if(!f.value){a(`text:${f.id}`,c,m.index);continue}let u=qh(f.value.replace(/\$(\d)/g,(l,p)=>m[Number(p)]??""));u&&(a(`text:${f.id}=${u}`,c,m.index),(o[f.id]??=[]).includes(u)||o[f.id].push(u))}if(c.source==="instructions"){for(let f of c.text.matchAll(xh))a(`text:link-domain:${f[1].toLowerCase().replace(/[.,;:]+$/,"")}`,c,f.index);for(let f of c.text.matchAll(Ch))a("text:email",c,f.index)}}for(let[c,f]of Object.entries(r))r[c]=f.filter((m,u)=>f.findIndex(l=>l.file===m.file&&l.line===m.line)===u)}return{facts:n,values:s}}function Al(e,t,n){let s=[];for(let i of t.filter(r=>r.value)){for(let r of["specialist","orchestrator"]){let o={};for(let[a,c]of Object.entries(e))if(n[a]===r)for(let f of c[i.id]??[])(o[f]??=[]).push(a);Object.keys(o).length>1&&s.push({kind:"values",marker:i,role:r,byValue:o})}for(let[r,o]of Object.entries(e))(o[i.id]??[]).length>1&&s.push({kind:"twice",marker:i,agent:r,values:o[i.id]})}return s}var Mh=/^(no|não|nao|false|off|0)$/i,Lh=new Set(ss.filter(e=>!e.sign).map(e=>`ms:${e.id}`)),Ih=e=>e.includes(":")&&!e.startsWith("declared:")&&!Lh.has(e),Ph=e=>e.startsWith("declared:")?e:`declared:${e}`,or=e=>e.endsWith("~variant"),ls=e=>/^(orphan|disabled):/.test(e);function Rh(e){let t=new Map;for(let s of e)for(let i of s.telemetry??[]){let r=t.get(ee(i.form))??new Map;t.set(ee(i.form),r),r.set(i.form,(r.get(i.form)??new Set).add(s.id))}let n=new Map;for(let s of t.values()){let[i]=[...s].sort(([r,o],[a,c])=>c.size-o.size||r.localeCompare(a));for(let r of s.keys())n.set(r,i[0])}return n}function Fh(e,t){if(e.startsWith("telemetry:event:"))return`telemetry:event:${t.get(e.slice(16))??e.slice(16)}`;if(e.startsWith("telemetry:field:")){let n=e.lastIndexOf("/"),s=e.slice(16,n);return`telemetry:field:${t.get(s)??s}${e.slice(n)}`}return e}function Dh(e,t,n,s){let i=Object.fromEntries(n.agents.map(g=>[g.id,g.role])),{roles:r,unmatched:o}=gl(e,t,i),a=g=>t.ignore.includes(g)||!t.microsoftPatterns&&g.startsWith("ms:"),c=[],f=Sl(e,n.blocks,t.blocks),m=Ol(e,t.markers),u=new Map(e.filter(g=>g.schemaName).map(g=>[g.schemaName,g.id])),l=e.flatMap(g=>(g.contract??[]).map(N=>({...N,caller:g.id,...u.has(N.calls)?{agent:u.get(N.calls)}:{}}))),p={};for(let g of l.filter(N=>N.agent)){let N=p[g.agent]??={},P={file:`${g.caller}/${g.file}`,line:g.line},F=W=>(N[W]??=[]).push(P);g.history&&F("called-with:history");for(let W of g.inputs)F(`called-with:input:${W}`);g.description&&F("routing:described")}let d=Rh(e),h=g=>{let N={};for(let[P,F]of Object.entries(g.facts))(N[Fh(P,d)]??=[]).push(...F);return{...N,...f.facts[g.id],...m.facts[g.id],...p[g.id]}},y=e.map(g=>{let N=h(g),P=Object.fromEntries(Object.entries(N).filter(([F])=>!a(F)));for(let F of n.declared.filter(W=>W.agent===g.id)){let W=!Mh.test(F.value);if(Ih(F.key)){let H=F.key in N;W!==H&&c.push({agent:g.id,key:F.key,declared:F.value||"yes",observed:H,source:F.source})}else W&&(P[Ph(F.key)]??=[]).push({file:F.source?`declared: ${F.source}`:"declared"})}return{id:g.id,role:r[g.id],...g.schemaName?{schemaName:g.schemaName}:{},...g.displayName?{displayName:g.displayName}:{},facts:P,children:g.children}}),w=g=>y.filter(N=>N.role===g),v=(g,N=y)=>N.filter(P=>g in P.facts),O=(g,N=y)=>N.flatMap(P=>P.facts[g]??[]),E=[...new Set(y.flatMap(g=>Object.keys(g.facts)))].sort(),S=g=>n.decisions.find(N=>N.key===g),C=yl(y,r,t,Object.fromEntries(n.agents.filter(g=>g.types?.length).map(g=>[g.id,g.types]))),q=g=>g==="platform"?y:g.startsWith("type:")?y.filter(N=>C[N.id]?.includes(g.slice(5))):w(g),x=[];for(let g of["specialist","orchestrator"]){let N=w(g);if(N.length<t.minAgents)continue;let P=w(g==="specialist"?"orchestrator":"specialist");for(let F of E){if(F.startsWith("declared:")||lt(F)||or(F)||ls(F)||x.some(gs=>gs.key===F))continue;let H=v(F,N).length/N.length;if(H<t.threshold)continue;let ms=P.length>0&&v(F,P).length/P.length>=(P.length>=t.minAgents?t.threshold:1),je=S(F);x.push({key:F,role:g,scope:je?.scope??(ms?"platform":g),share:H,agents:v(F).map(gs=>gs.id),sources:O(F),...je?{decision:je}:{}})}}let b=[];for(let g of t.types){let N=q(`type:${g.id}`);if(N.length){if(N.length<g.minAgents){b.push({type:g.id,agents:N.map(P=>P.id)});continue}for(let P of E){if(P.startsWith("declared:")||lt(P)||or(P)||ls(P)||x.some(H=>H.key===P))continue;let F=v(P,N).length/N.length;if(F<t.threshold)continue;let W=S(P);x.push({key:P,role:"specialist",scope:W?.scope??`type:${g.id}`,share:F,agents:v(P).map(H=>H.id),sources:O(P),...W?{decision:W}:{}})}}}for(let g of t.blocks){let N=`text:block:${g.id}`,P=x.find(H=>H.key===N);if(P){P.official=g.name;continue}let F=w(g.role),W=S(N);x.push({key:N,role:g.role,scope:W?.scope??g.role,share:F.length?v(N,F).length/F.length:0,agents:v(N).map(H=>H.id),sources:O(N),official:g.name,...W?{decision:W}:{}})}for(let g of n.decisions.filter(N=>N.status==="accepted"&&!x.some(P=>P.key===N.key))){let N=q(g.scope),P=v(g.key,N);x.push({key:g.key,role:g.scope==="orchestrator"?"orchestrator":"specialist",scope:g.scope,share:N.length?P.length/N.length:0,agents:P.map(F=>F.id),sources:O(g.key),decision:g})}for(let g of E.filter(N=>lt(N))){let N=x.find(H=>H.key===lt(g));if(!N)continue;let P=q(N.scope).filter(H=>N.key in H.facts),F=P.length?v(g,P).length/P.length:0;if(F<t.threshold)continue;let W=S(g)??N.decision;x.push({key:g,role:N.role,scope:N.scope,share:F,agents:v(g).map(H=>H.id),sources:O(g),partOf:N.key,...W?{decision:W}:{}})}x.sort((g,N)=>g.scope.localeCompare(N.scope)||g.key.localeCompare(N.key));let T=e.flatMap(g=>(g.telemetry??[]).map(N=>{let P=s?.rows.filter(F=>F.agent===g.id&&ee(F.event)===ee(N.name));return{...N,agent:g.id,as:d.get(N.form)??N.form,...s?{fired:P.reduce((F,W)=>F+W.count,0)}:{}}})),R=new Set(T.filter(g=>!g.fields).map(g=>`${g.agent} ${g.as}`)),j=(g,N)=>N.startsWith("telemetry:field:")&&R.has(`${g} ${N.slice(16,N.lastIndexOf("/"))}`),oe=x.filter(g=>g.decision?.status!=="rejected").flatMap(g=>q(g.scope).filter(N=>!(g.key in N.facts)&&(!g.partOf||g.partOf in N.facts)&&!j(N.id,g.key)).map(N=>({agent:N.id,key:g.key,scope:g.scope,...g.partOf?{partOf:g.partOf}:{},...`${g.key}~variant`in N.facts?{variant:!0}:{}}))).sort((g,N)=>g.agent.localeCompare(N.agent)||g.key.localeCompare(N.key)),Ee=[],k=[];for(let g of E){if(g.startsWith("declared:")||lt(g)||or(g)||ls(g))continue;let N=v(g),P={key:g,agents:N.map(F=>F.id),sources:O(g)};N.every(F=>F.role==="orchestrator")?k.push(P):N.length===1&&Ee.push(P)}let $=(g,N)=>Object.keys(g.facts).some(P=>De(P,N)),I=t.rules.map(g=>({rule:g,agents:(g.role?w(g.role):y).filter(N=>(g.when??[]).every(P=>$(N,P))).filter(N=>g.has!==void 0&&!$(N,g.has)||g.not!==void 0&&$(N,g.not)).map(N=>N.id)})).filter(g=>g.agents.length),B=y.some(g=>g.role==="orchestrator"),Y=new Set(l.map(g=>g.agent)),ae=y.flatMap(g=>Object.keys(g.facts).filter(ls).sort().map(N=>{let[P,F,...W]=N.split(":");return{agent:g.id,key:N,how:P,what:F,name:W.join(":"),sources:g.facts[N]}}));return{...t.name??n.name?{name:t.name??n.name}:{},roles:r,unmatched:o,agents:y,patterns:x,offPattern:oe,solos:Ee,orchestratorDoes:k,gaps:I,conflicts:c,unknown:e.flatMap(g=>g.unknown.map(N=>({...N,agent:g.id}))),names:Object.assign({},...e.map(g=>g.names??{}),...e.map(g=>g.schemaName&&g.displayName?{[g.schemaName]:g.displayName}:{}),...f.families.map(g=>({[`text:block:${g.id}`]:g.official??g.label})),...t.markers.map(g=>({[`text:${g.id}`]:g.name}))),types:C,typeNames:Object.fromEntries(t.types.map(g=>[g.id,g.name])),typeNotes:b,blocks:f.families,markerFindings:Al(m.values,t.markers,r),contract:{routes:l,missing:l.filter(g=>!g.agent),uncalled:B?y.filter(g=>g.role==="specialist"&&!Y.has(g.id)).map(g=>g.id):[],short:l.filter(g=>g.description&&g.description.length<dl)},flows:e.flatMap(g=>(g.flows??[]).map(N=>({...N,agent:g.id}))),unused:ae,telemetry:{events:T,spellings:T.filter(g=>g.as!==g.form),notFired:s?T.filter(g=>g.fired===0&&s.rows.some(N=>N.agent===g.agent)):[],silent:s?e.map(g=>g.id).filter(g=>!s.rows.some(N=>N.agent===g)):[],...s?{days:s.days,file:s.file}:{}}}}var jh={specialist:{en:["specialist","specialists"],pt:["especialista","especialistas"]},orchestrator:{en:["orchestrator","orchestrators"],pt:["orquestrador","orquestradores"]}},ue=(e,t,n)=>jh[e][t][n===1?0:1],cs={en:{summary:"Summary",matrix:"Matrix",patterns:"Patterns",text:"Text",off:"Off pattern",gaps:"Gaps",conflicts:"Conflicts",agents:"Cast",evidence:"Evidence",declared:"Declared",unknown:"Not understood",routing:"Routing",unused:"Unused",telemetry:"Telemetry",written:"As written",form:"Form",fields:"Fields",fired:e=>`Fired (${e} days)`,notRead:"not read",caller:"Caller",called:"Called",history:"History",inputs:"Inputs",routingText:"Routing description",chars:"Characters",notInFolder:"not in the folder",what:"What",how:"How",thing:{topic:"topic",action:"tool",variable:"variable",flow:"flow",node:"node",knowledge:"knowledge source"},orphan:"nobody uses it",disabled:"switched off",dimension:"Dimension",fact:"Fact",key:"Key",agent:"Who",name:"Name",role:"Role",scope:"Scope",share:"Share",have:"Who has it",lack:"Who lacks it",decision:"Decision",why:"Why",missing:"Missing",accepted:"Accepted pattern",rule:"Rule",says:"Says",notMet:"Who does not meet it",value:"Value",source:"Source",inYaml:"In the YAML",file:"File",line:"Line",facts:"Facts",alone:"Only it has",children:"Children",kind:"Kind",types:"Types",id:"Id",label:"Label",body:"Text",variant:"Variation",official:"Official",type:"type",yes:"yes",no:"no",accept:"accepted",reject:"rejected",platform:"platform",specialist:"specialist",orchestrator:"orchestrator",title:"The cast, compared",look:"To look at",nothing:"Nothing to look at",privacy:"This file holds the client\u2019s data: keep it in the client\u2019s environment.",count:{agents:"In the cast",orchestrators:"Orchestrators",specialists:"Specialists",patterns:"Patterns",off:"Off a pattern",gaps:"Rules not met",conflicts:"Conflicts",solos:"Only one has it",unused:"Unused or switched off"},why_:{yaml:"YAML that does not read",empty:"empty",kind:"a kind Copilot Studio does not have",file:"not a Copilot Studio file",json:"JSON that does not read",flow:"a flow in a shape the analysis does not know",telemetry:"a telemetry event whose name is a formula"}},pt:{summary:"Resumo",matrix:"Matriz",patterns:"Padr\xF5es",text:"Texto",off:"Fora do padr\xE3o",gaps:"Lacunas",conflicts:"Conflitos",agents:"Elenco",evidence:"Evid\xEAncias",declared:"Declarado",unknown:"N\xE3o entendeu",routing:"Roteamento",unused:"Sem uso",telemetry:"Telemetria",written:"Como est\xE1 escrito",form:"Forma",fields:"Campos",fired:e=>`Disparou (${e} dias)`,notRead:"n\xE3o lido",caller:"Quem chama",called:"Chamado",history:"Hist\xF3rico",inputs:"Entradas",routingText:"Descri\xE7\xE3o de roteamento",chars:"Caracteres",notInFolder:"n\xE3o est\xE1 na pasta",what:"O qu\xEA",how:"Como",thing:{topic:"t\xF3pico",action:"ferramenta",variable:"vari\xE1vel",flow:"fluxo",node:"n\xF3",knowledge:"fonte de conhecimento"},orphan:"ningu\xE9m usa",disabled:"desligado",dimension:"Dimens\xE3o",fact:"Fato",key:"Chave",agent:"Quem",name:"Nome",role:"Papel",scope:"Escopo",share:"Quantos",have:"Quem tem",lack:"Quem falta",decision:"Decis\xE3o",why:"Por qu\xEA",missing:"Falta",accepted:"Padr\xE3o aceito",rule:"Regra",says:"Diz",notMet:"Quem n\xE3o cumpre",value:"Valor",source:"Fonte",inYaml:"No YAML",file:"Arquivo",line:"Linha",facts:"Fatos",alone:"S\xF3 ele tem",children:"Filhos",kind:"Kind",types:"Tipos",id:"Id",label:"R\xF3tulo",body:"Texto",variant:"Varia\xE7\xE3o",official:"Oficial",type:"tipo",yes:"sim",no:"n\xE3o",accept:"aceito",reject:"rejeitado",platform:"plataforma",specialist:"especialista",orchestrator:"orquestrador",title:"Elenco comparado",look:"Para olhar",nothing:"Nada para olhar",privacy:"Este arquivo tem dados do cliente: deixe-o no ambiente dele.",count:{agents:"No elenco",orchestrators:"Orquestradores",specialists:"Especialistas",patterns:"Padr\xF5es",off:"Fora do padr\xE3o",gaps:"Regras n\xE3o cumpridas",conflicts:"Conflitos",solos:"S\xF3 um tem",unused:"Sem uso ou desligado"},why_:{yaml:"YAML que n\xE3o se l\xEA",empty:"vazio",kind:"um kind que o Copilot Studio n\xE3o tem",file:"n\xE3o \xE9 arquivo do Copilot Studio",json:"JSON que n\xE3o se l\xEA",flow:"um fluxo num formato que a an\xE1lise n\xE3o conhece",telemetry:"um evento de telemetria com o nome em f\xF3rmula"}}};var Ae=e=>e.join(", "),Nl=["conflict","contradiction","spelling","contract","flow","telemetry","off","gap","values","twice","solo","unused","type","unknown","unmatched"],El=e=>e.replace(/(\.topic)?\.mcs\.ya?ml$/,"");function _h(e){let t=[],n=(l,p)=>pe(l,p,e.names);for(let l of e.conflicts){let p=l.source?`\xAB${l.source}\xBB`:null,[d,h]=[n(l.key,"en"),n(l.key,"pt")];t.push(l.observed?{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it does not have \xAB${d}\xBB, but the YAML has it`,pt:`${l.agent}: ${p??"o declarado"} diz que n\xE3o tem \xAB${h}\xBB, mas o YAML tem`}:{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it has \xAB${d}\xBB, but the YAML does not`,pt:`${l.agent}: ${p??"o declarado"} diz que tem \xAB${h}\xBB, mas o YAML n\xE3o tem`})}let s=(l,p)=>Object.keys(e.agents.find(d=>d.id===l)?.facts??{}).filter(d=>De(d,p));for(let l of e.gaps.filter(p=>p.rule.not&&!p.rule.has))for(let p of[...l.agents].sort()){let d=s(p,l.rule.not)[0]??l.rule.not,h=(l.rule.when??[]).map(w=>s(p,w)[0]??w),y=w=>h.length?`\xAB${h.map(v=>n(v,w)).join(w==="pt"?"\xBB e \xAB":"\xBB and \xAB")}\xBB, ${w==="pt"?"mas tamb\xE9m":"but also"} \xAB${n(d,w)}\xBB`:`\xAB${n(d,w)}\xBB`;t.push({key:"contradiction",agents:[p],fact:d,en:`${p} has ${y("en")} (rule \xAB${l.rule.says}\xBB)`,pt:`${p} tem ${y("pt")} (regra \xAB${l.rule.says}\xBB)`})}for(let l of e.contract.missing)t.push({key:"contract",agents:[l.caller],fact:`calls:${l.calls}`,en:`The orchestrator calls \xAB${l.name??l.calls}\xBB, which is not in the folder`,pt:`O orquestrador chama \xAB${l.name??l.calls}\xBB, que n\xE3o est\xE1 na pasta`});for(let l of e.contract.uncalled)t.push({key:"contract",agents:[l],en:`${l} is in the folder, but no orchestrator calls it`,pt:`${l} est\xE1 na pasta, mas nenhum orquestrador o chama`});for(let l of e.contract.short){let p=l.description.length;t.push({key:"contract",agents:[l.agent],fact:"routing:described",en:`The routing description of ${l.agent} has only ${p} characters`,pt:`A descri\xE7\xE3o de roteamento de ${l.agent} tem s\xF3 ${p} caracteres`})}for(let l of e.flows.filter(p=>p.called&&!p.returns))t.push({key:"flow",agents:[l.agent],fact:"flow-returns",en:`The flow \xAB${l.name}\xBB of ${l.agent} returns nothing`,pt:`O fluxo \xAB${l.name}\xBB de ${l.agent} n\xE3o devolve nada`});let i=new Map;for(let l of e.telemetry.spellings)i.set(`${l.agent} ${l.form}`,l);for(let l of i.values())t.push({key:"spelling",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`${l.agent} logs \xAB${l.name}\xBB; the others, \xAB${ke(l.as,"en")}\xBB: the same event?`,pt:`${l.agent} registra \xAB${l.name}\xBB; os outros, \xAB${ke(l.as,"pt")}\xBB: \xE9 o mesmo evento?`});let r=e.telemetry.days;for(let l of e.telemetry.notFired)t.push({key:"telemetry",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`The event \xAB${l.name}\xBB of ${l.agent} did not fire in ${r} days`,pt:`O evento \xAB${l.name}\xBB de ${l.agent} n\xE3o disparou em ${r} dias`});for(let l of e.telemetry.silent)t.push({key:"telemetry",agents:[l],en:`${l} has no line in the telemetry: is it connected to Application Insights?`,pt:`${l} n\xE3o tem nenhuma linha na telemetria: est\xE1 ligado ao Application Insights?`});let o=l=>l.startsWith("type:")?e.typeNames[l.slice(5)]??l.slice(5):void 0,a=new Map;for(let l of e.offPattern){let p=e.roles[l.agent],d=`${l.key} ${p} ${l.scope} ${l.variant?"v":""}`,h=a.get(d)??{key:l.key,role:p,type:o(l.scope),variant:!!l.variant,agents:[]};h.agents.push(l.agent),a.set(d,h)}for(let l of a.values()){let p=l.agents.length,d=e.patterns.find(O=>O.key===l.key),h=d?.decision?.status==="accepted",y=O=>l.type?O==="pt"?`${p} ${ue(l.role,O,p)} de ${l.type}`:`${p} ${l.type} ${ue(l.role,O,p)}`:`${p} ${ue(l.role,O,p)}`,w=!!d?.official;if(l.variant){let O=E=>E==="pt"?`do bloco${w?" oficial":""} \xAB${n(l.key,E)}\xBB`:`of the${w?" official":""} block \xAB${n(l.key,E)}\xBB`;t.push({key:"off",agents:l.agents,fact:l.key,en:`${y("en")} ${p===1?"has":"have"} a variation ${O("en")} (${Ae(l.agents)}): align it?`,pt:`${y("pt")} ${p===1?"tem":"t\xEAm"} uma varia\xE7\xE3o ${O("pt")} (${Ae(l.agents)}): alinhar?`});continue}let v=O=>`${y(O)} ${rs(l.key,O,p,e.names)} (${Ae(l.agents)})`;t.push({key:"off",agents:l.agents,fact:l.key,en:h?`${v("en")}, and the pattern was accepted: correct it?`:w?`${v("en")}: add it?`:`${v("en")}: on purpose?`,pt:h?`${v("pt")}, e o padr\xE3o foi aceito: corrigir?`:w?`${v("pt")}: incluir?`:`${v("pt")}: \xE9 intencional?`})}for(let l of e.gaps.filter(p=>p.rule.has)){let p=l.agents.filter(h=>!e.offPattern.some(y=>y.agent===h&&y.key===l.rule.has)).sort(),d=p.length;d&&t.push({key:"gap",agents:p,fact:l.rule.has,en:`Rule \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${ue(l.rule.role,"en",d)}`:""} ${d===1?"does":"do"} not meet it (${Ae(p)})`,pt:`Regra \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${ue(l.rule.role,"pt",d)}`:""} n\xE3o ${d===1?"cumpre":"cumprem"} (${Ae(p)})`})}for(let l of e.markerFindings)if(l.kind==="values"){let p=[...new Set(Object.values(l.byValue).flat())],d=p.length,h=Object.entries(l.byValue).sort(([w,v],[O,E])=>E.length-v.length||w.localeCompare(O)).map(([w,v])=>`${w} {in} ${v.length}`),y=Object.keys(l.byValue).length;t.push({key:"values",agents:p.sort(),fact:`text:${l.marker.id}`,en:`${d} ${ue(l.role,"en",d)} set \xAB${l.marker.name}\xBB in ${y} ways (${h.join("; ").replace(/\{in\}/g,"in")}): unify?`,pt:`${d} ${ue(l.role,"pt",d)} definem \xAB${l.marker.name}\xBB de ${y} jeitos (${h.join("; ").replace(/\{in\}/g,"em")}): unificar?`})}else t.push({key:"twice",agents:[l.agent],fact:`text:${l.marker.id}`,en:`${l.agent} sets \xAB${l.marker.name}\xBB ${l.values.length===2?"twice":`${l.values.length} times`} (${l.values.join("; ")}): which one holds?`,pt:`${l.agent} define \xAB${l.marker.name}\xBB ${l.values.length===2?"duas vezes":`${l.values.length} vezes`} (${l.values.join("; ")}): qual vale?`});let c=new Set(e.solos.filter(l=>/^(connector|mcp):/.test(l.key)).map(l=>`${l.agents[0]} ${l.key.slice(l.key.indexOf(":")+1)}`)),f=e.gaps.filter(l=>l.rule.not).flatMap(l=>l.agents.map(p=>({agent:p,keys:[...l.rule.when??[],l.rule.not]})));for(let l of e.solos){let p=l.agents[0],d=l.key.startsWith("connref:")?l.key.slice(8):l.key.startsWith("operation:")?l.key.slice(10).split("/")[0]:void 0;d&&c.has(`${p} ${d}`)||f.some(h=>h.agent===p&&h.keys.some(y=>De(l.key,y)))||t.push({key:"solo",agents:[p],fact:l.key,en:`Only ${p} has \xAB${n(l.key,"en")}\xBB: innovation or debt?`,pt:`S\xF3 ${p} tem \xAB${n(l.key,"pt")}\xBB: inova\xE7\xE3o ou d\xEDvida?`})}let m={topic:["the topic","o t\xF3pico"],action:["the tool","a ferramenta"],variable:["the variable","a vari\xE1vel"],flow:["the flow","o fluxo"],knowledge:["the knowledge source","a fonte de conhecimento"]};for(let l of e.unused){let[p,d]=m[l.what]??["",""],h=e.names[l.name]??l.name;if(l.how==="orphan"){let y=l.what==="variable"?["remove it?","remover?"]:["remove it or switch it on?","remover ou ligar?"],w=l.what==="variable"?["uses","usa"]:l.what==="action"?["can choose","pode escolher"]:["calls","chama"];t.push({key:"unused",agents:[l.agent],fact:l.key,en:`Nobody ${w[0]} ${p} \xAB${h}\xBB (${l.agent}): ${y[0]}`,pt:`Ningu\xE9m ${w[1]} ${d} \xAB${h}\xBB (${l.agent}): ${y[1]}`})}else if(l.what==="node")for(let y of[...new Set(l.sources.map(w=>w.file))])t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has a switched-off node in \xAB${El(y)}\xBB (${l.name}): remove it?`,pt:`${l.agent} tem um n\xF3 desligado em \xAB${El(y)}\xBB (${l.name}): remover?`});else t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has ${p||l.what} \xAB${h}\xBB switched off: remove it?`,pt:`${l.agent} tem ${d||l.what} \xAB${h}\xBB ${d.startsWith("a ")?"desligada":"desligado"}: remover?`})}for(let l of e.typeNotes){let p=e.typeNames[l.type]??l.type,d=l.agents.length;t.push({key:"type",agents:l.agents,en:`The type \xAB${p}\xBB has ${d} ${ue("specialist","en",d)} (${Ae(l.agents)}): nothing to compare in it`,pt:`O tipo \xAB${p}\xBB tem ${d} ${ue("specialist","pt",d)} (${Ae(l.agents)}): nada a comparar dentro dele`})}let u=new Map;for(let l of e.unknown)u.set(l.agent,[...u.get(l.agent)??[],l.file]);for(let[l,p]of u){let d=p.length;t.push({key:"unknown",agents:[l],en:`${l}: the analysis did not understand ${d} ${d===1?"file":"files"} (${Ae(p)})`,pt:`${l}: a an\xE1lise n\xE3o entendeu ${d} ${d===1?"arquivo":"arquivos"} (${Ae(p)})`})}for(let l of e.unmatched)t.push({key:"unmatched",agents:[],en:`The profile names \xAB${l}\xBB, which is not in the folder`,pt:`O perfil cita \xAB${l}\xBB, que n\xE3o est\xE1 na pasta`});return t.sort((l,p)=>Nl.indexOf(l.key)-Nl.indexOf(p.key))}function Vt(e){let t=i=>e.offPattern.some(r=>r.key===i.key||r.partOf===i.key),n=i=>i.share===1&&!i.decision&&!t(i),s=e.patterns.filter(i=>!i.partOf);return{look:s.filter(i=>!n(i)),everyone:s.filter(n)}}var xl=new TextEncoder,ar=e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,""),Jt=e=>e<26?String.fromCharCode(65+e):Jt(Math.floor(e/26)-1)+String.fromCharCode(65+e%26),Bh=e=>e.replace(/[:\\/?*[\]]/g," ").slice(0,31)||"Sheet";function Kh(e){let t=[{}],n=l=>JSON.stringify([l.bold??!1,l.fill??"",l.color??"",l.center??!1,l.wrap??!1]),s=new Map([[n({}),0]]);for(let l of e)for(let p of l.rows)for(let d of p){if(typeof d!="object")continue;let{v:h,...y}=d,w=n(y);s.has(w)||(s.set(w,t.length),t.push(y))}let i=new Map([["|",0]]),r=new Map([["",0]]),o=l=>{let p=`${l.bold?"b":""}|${l.color??""}`;return i.has(p)||i.set(p,i.size),i.get(p)},a=l=>l.fill?(r.has(l.fill)||r.set(l.fill,r.size+1),r.get(l.fill)):0,c=t.map(l=>{let p=l.center||l.wrap?`<alignment${l.center?' horizontal="center"':""}${l.wrap?' wrapText="1"':""} vertical="top"/>`:'<alignment vertical="top"/>';return`<xf numFmtId="0" fontId="${o(l)}" fillId="${a(l)}" borderId="${l.fill||l.bold?1:0}" xfId="0" applyFont="1" applyFill="1" applyBorder="1" applyAlignment="1">${p}</xf>`}),f=[...i.keys()].map(l=>{let[p,d]=l.split("|");return`<font>${p?"<b/>":""}<sz val="11"/>${d?`<color rgb="FF${d}"/>`:""}<name val="Calibri"/><family val="2"/></font>`}),m=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>',...[...r.keys()].filter(Boolean).map(l=>`<fill><patternFill patternType="solid"><fgColor rgb="FF${l}"/><bgColor indexed="64"/></patternFill></fill>`)];return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
139
|
+
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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=Qn(t),s=rt(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Qn(t),s=rt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};nl.Parser=Xr});var al=M(Kt=>{"use strict";var sl=Dr(),Lp=Lt(),Bt=Rt(),Pp=Rs(),Ip=U(),Rp=Hr(),rl=Qr();function il(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Rp.LineCounter||null,prettyErrors:t}}function Fp(e,t={}){let{lineCounter:n,prettyErrors:s}=il(t),r=new rl.Parser(n?.addNewLine),i=new sl.Composer(t),o=Array.from(i.compose(r.parse(e)));if(s&&n)for(let a of o)a.errors.forEach(Bt.prettifyError(e,n)),a.warnings.forEach(Bt.prettifyError(e,n));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function ol(e,t={}){let{lineCounter:n,prettyErrors:s}=il(t),r=new rl.Parser(n?.addNewLine),i=new sl.Composer(t),o=null;for(let a of i.compose(r.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Bt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Bt.prettifyError(e,n)),o.warnings.forEach(Bt.prettifyError(e,n))),o}function Dp(e,t,n){let s;typeof t=="function"?s=t:n===void 0&&t&&typeof t=="object"&&(n=t);let r=ol(e,n);if(!r)return null;if(r.warnings.forEach(i=>Pp.warn(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:s},n))}function jp(e,t,n){let s=null;if(typeof t=="function"||Array.isArray(t)?s=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}return Ip.isDocument(e)&&!s?e.toString(n):new Lp.Document(e,s,n).toString(n)}Kt.parse=Dp;Kt.parseAllDocuments=Fp;Kt.parseDocument=ol;Kt.stringify=jp});var ts=M(z=>{"use strict";var _p=Dr(),Bp=Lt(),Kp=br(),Zr=Rt(),Up=yt(),Fe=U(),Yp=Me(),zp=Q(),Wp=Pe(),Vp=Ie(),Jp=Hn(),Gp=Jr(),Hp=Hr(),Xp=Qr(),es=al(),ll=pt();z.Composer=_p.Composer;z.Document=Bp.Document;z.Schema=Kp.Schema;z.YAMLError=Zr.YAMLError;z.YAMLParseError=Zr.YAMLParseError;z.YAMLWarning=Zr.YAMLWarning;z.Alias=Up.Alias;z.isAlias=Fe.isAlias;z.isCollection=Fe.isCollection;z.isDocument=Fe.isDocument;z.isMap=Fe.isMap;z.isNode=Fe.isNode;z.isPair=Fe.isPair;z.isScalar=Fe.isScalar;z.isSeq=Fe.isSeq;z.Pair=Yp.Pair;z.Scalar=zp.Scalar;z.YAMLMap=Wp.YAMLMap;z.YAMLSeq=Vp.YAMLSeq;z.CST=Jp;z.Lexer=Gp.Lexer;z.LineCounter=Hp.LineCounter;z.Parser=Xp.Parser;z.parse=es.parse;z.parseAllDocuments=es.parseAllDocuments;z.parseDocument=es.parseDocument;z.stringify=es.stringify;z.visit=ll.visit;z.visitAsync=ll.visitAsync});import{readdirSync as hc,readFileSync as mc}from"node:fs";import{basename as gc,join as bs}from"node:path";var yc=/^agent\.mcs\.ya?ml$/,bc=/\.ya?ml$/,wc=/(^|\/)workflows\/.+\.json$/,hi=e=>hc(e,{withFileTypes:!0}).filter(t=>!t.name.startsWith(".")&&t.name!=="node_modules");function mi(e,t=""){return hi(e).flatMap(n=>{let s=t?`${t}/${n.name}`:n.name;return n.isDirectory()?mi(bs(e,n.name),s):n.isFile()?[{path:s,text:bc.test(n.name)||wc.test(s)?mc(bs(e,n.name),"utf8"):""}]:[]})}function gi(e){let t=hi(e);return t.some(n=>n.isFile()&&yc.test(n.name))?[{id:gc(e),dir:e,files:mi(e)}]:t.filter(n=>n.isDirectory()).flatMap(n=>gi(bs(e,n.name)))}var le=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,tn=e=>typeof e=="string"&&e.trim()?e:void 0;function kc(e){let t=le(le(le(e)?.properties)?.definition)??le(le(e)?.definition);return t&&(le(t.actions)||le(t.triggers))?t:void 0}function*dt(e){for(let[t,n]of Object.entries(le(e)??{})){let s=le(n);if(s){yield[t,s],yield*dt(s.actions),yield*dt(le(s.else)?.actions);for(let r of Object.values(le(s.cases)??{}))yield*dt(le(r)?.actions);yield*dt(le(s.default)?.actions)}}}var $c=e=>/^https?:\/\/([^/?#:@]+)/i.exec(e)?.[1]?.toLowerCase(),vc=e=>e.slice(e.lastIndexOf("/")+1);function yi(e){let t=kc(e);if(!t)return;let n={uses:[]},s=(r,i)=>n.uses.some(o=>o.key===r)||n.uses.push({key:r,action:i});for(let[r,i]of dt(t.actions)){let o=le(i.inputs),a=le(o?.host);switch(i.type){case"OpenApiConnection":case"OpenApiConnectionWebhook":{let c=tn(a?.apiId)?vc(a.apiId):tn(a?.connectionName);if(!c)break;s(`connector:${c}`,r),tn(a?.operationId)&&s(`operation:${c}/${a.operationId}`,r);break}case"Http":{let c=tn(o?.uri)&&$c(o.uri);c&&s(`http:${c}`,r);break}case"Workflow":s("child-flow",r);break;case"Response":n.returns??=r;break}}return n}function ws(e,t){let n=e.indexOf(`${JSON.stringify(t)}:`);return n<0?1:e.slice(0,n).split(`
|
|
140
|
+
`).length}var ee=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[\s._-]+/g,""),Sc="{agent}";function bi(e,t){let n=[];for(let o=0;o<e.length;o++)for(let a of ee(e[o]))n.push({c:a,at:o});let s=n.map(o=>o.c).join(""),r=t.schemaName?.slice(t.schemaName.indexOf("_")+1),i=[...new Set([t.id,r,t.displayName].filter(o=>!!o).map(ee).filter(o=>o.length>=3))].sort((o,a)=>a.length-o.length);for(let o of i){let a=s.indexOf(o);if(a<0)continue;let c=n[a].at,f=n[a+o.length-1].at+1;return`${e.slice(0,c)}${Sc}${e.slice(f)}`}return e}function wi(e){if(typeof e!="string")return;let t=e.trim().replace(/^=\s*/,"").trim();if(!t.startsWith("{")||!t.endsWith("}"))return;let n=t.slice(1,-1),s=[],r=0,i,o="";for(let c=0;c<n.length;c++){let f=n[c];if(i){o+=f,f===i&&(n[c+1]===i?o+=n[++c]:i=void 0);continue}f==='"'||f==="'"?i=f:f==="{"||f==="("||f==="["?r++:(f==="}"||f===")"||f==="]")&&r--,f===","&&r===0?(s.push(o),o=""):o+=f}if(i||r)return;o.trim()&&s.push(o);let a=[];for(let c of s){let f=/^\s*(?:'((?:[^']|'')+)'|"((?:[^"]|"")+)"|([A-Za-z_][\w]*))\s*:/.exec(c);if(!f)return;a.push((f[1]??f[2]??f[3]).replace(/''|""/g,m=>m[0]))}return a}var ye=ys(ts()),J=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,_=e=>typeof e=="string"&&e.trim()?e:void 0,Ut=e=>Array.isArray(e)?e:[];function cl(e){if(!e.trim())return"empty";let t=new ye.LineCounter,n=(0,ye.parseDocument)(e,{lineCounter:t,uniqueKeys:!1});if(n.errors.length)return"yaml";let s=new WeakMap,r=o=>{if((0,ye.isMap)(o)){let a={};o.range&&s.set(a,o.range[0]);for(let c of o.items)a[String((0,ye.isScalar)(c.key)?c.key.value:c.key)]=r(c.value);return a}return(0,ye.isSeq)(o)?o.items.map(r):(0,ye.isScalar)(o)?o.value:o},i=r(n.contents);return i==null?"empty":{data:i,lineOf:o=>o&&typeof o=="object"&&s.has(o)?t.linePos(s.get(o)).line:void 0}}function*ot(e,t=!1){if(Array.isArray(e))for(let s of e)yield*ot(s,t);let n=J(e);if(n){if(n.disabled===!0){t&&typeof n.kind=="string"&&(yield n);return}typeof n.kind=="string"&&!t&&(yield n);for(let s of Object.values(n))yield*ot(s,t)}}var Yt=e=>e.split(".")[1]??e,it=(e,t)=>e.slice(e.lastIndexOf(t)+(e.includes(t)?t.length:0)),Qp=/(^|[\s._-])(copy|c[oó]pia|new|test|teste)([\s._-]|$)|\.[a-z]{2}-[A-Z]{2}(\.topic)?\.mcs\.ya?ml$/i,Zp=5e4;function eh(e,t){let n=e.split(`
|
|
141
|
+
`),s=n.findIndex(r=>new RegExp(`^\\s*${t}:`).test(r));return s<0?1:/:\s*[|>][-+]?\s*$/.test(n[s])?s+2:s+1}var th=new Set(["LogCustomTelemetryEvent","CSATQuestion","SearchAndSummarizeContent","SearchKnowledgeSources"]),nh={topics:"topic",actions:"action",knowledge:"knowledge",variables:"variable"},sh=/^workflows\/([^/]+)\/(.+)$/;function rh(e,t,n){let s={id:e,facts:{},children:[],unknown:[],names:{},texts:[],contract:[],flows:[],telemetry:[]},r=[],i=new Map,o=[],a=d=>it(d,"/").replace(/(\.topic)?\.mcs\.ya?ml$|\.ya?ml$/,""),c=[],f=[],m=[],u=[],l=new Map;for(let d of[...t].sort((h,y)=>h.path.localeCompare(y.path))){let h=sh.exec(d.path);if(h&&(/\.json$/.test(d.path)||/^metadata\.ya?ml$/.test(h[2]))){let b=l.get(h[1])??{json:{}};if(l.set(h[1],b),/\.json$/.test(d.path)){try{b.json[h[2]]={file:d.path,text:d.text,data:JSON.parse(d.text)}}catch{s.unknown.push({file:d.path,why:"json"})}continue}let T=cl(d.text);T==="yaml"||T==="empty"?s.unknown.push({file:d.path,why:T}):[b.meta,b.metaFile]=[J(T.data),d.path];continue}if(!/\.ya?ml$/.test(d.path)){s.unknown.push({file:d.path,why:"file"});continue}let y=cl(d.text);if(y==="yaml"||y==="empty"){s.unknown.push({file:d.path,why:y});continue}let w=J(y.data),v=/^agents\/([^/]+)\//.exec(d.path)?.[1],O=s.facts;if(v){let b=s.children.find(T=>T.name===v);b||s.children.push(b={name:v,facts:{}}),O=b.facts}let E=(b,T,R=O)=>(R[b]??=[]).push({file:d.path,line:y.lineOf(T??w)});if(v&&E(`child:${v}`,w,s.facts),!v&&/^settings\.mcs\.ya?ml$/.test(d.path)&&w){s.schemaName=_(w.schemaName)??s.schemaName,s.displayName=_(w.displayName)??s.displayName,_(w.authenticationMode)&&E(`auth:${w.authenticationMode}`);let b=J(w.configuration),T=J(b?.settings)?.GenerativeActionsEnabled;typeof T=="boolean"&&E(`setting:generative=${T?"on":"off"}`,b),b?.isAgentConnectable===!0&&E("setting:connectable",b);continue}let S=n?[...ot(w)].map(b=>b.kind).find(b=>!n.has(b)):void 0;if(S&&s.unknown.push({file:d.path,why:"kind",kind:S}),typeof w?.kind!="string"){S||s.unknown.push({file:d.path,why:"kind"});continue}if(w.state==="Inactive"||w.status==="Inactive"){E(`disabled:${nh[d.path.split("/")[v?2:0]]??"component"}:${a(d.path)}`);continue}let C=d.text,q=(b,T,R)=>{v||!_(R)||Qp.test(it(d.path,"/"))||s.texts.push({source:b,file:d.path,line:eh(C,T),text:R.trimEnd().slice(0,Zp)})},x=(b,T)=>{_(b)&&(E("instructions:present",T),/\b(Today|Now)\(\)/.test(b)&&E("ms:date-context",T))};switch(w.kind){case"GptComponentMetadata":{s.displayName??=_(w.displayName),x(w.instructions,w),q("instructions","instructions",w.instructions),q("instructions","responseInstructions",w.responseInstructions);let b=J(w.aISettings),T=oe=>oe===!0?"on":"off";typeof b?.useModelKnowledge=="boolean"&&E(`setting:model-knowledge=${T(b.useModelKnowledge)}`,b),_(b?.contentModeration)&&E(`setting:moderation=${b.contentModeration.toLowerCase()}`,b),typeof b?.isSemanticSearchEnabled=="boolean"&&E(`setting:semantic-search=${T(b.isSemanticSearchEnabled)}`,b);let R=J(w.gptCapabilities);typeof R?.webBrowsing=="boolean"&&E(`setting:web-browsing=${T(R.webBrowsing)}`,R);let j=J(J(w.aISettings)?.model);_(j?.modelNameHint)&&E(`model:${j.modelNameHint}`,j);break}case"AgentDialog":{let b=J(w.beginDialog);_(b?.kind)&&E(`trigger:${b.kind}`,b),x(J(w.settings)?.instructions,w.settings);break}case"AdaptiveDialog":{let b=J(w.beginDialog),T=_(b?.kind);T&&E(`trigger:${T}`,b),T&&i.set(`${v??""}/${a(d.path)}`,T),_(w.modelDescription)&&E("topics:with-model-description");let R=Ut(J(b?.intent)?.triggerQueries).length;!v&&T==="OnRecognizedIntent"&&!_(w.modelDescription)&&!R&&f.push({kind:"topic",name:a(d.path),at:{file:d.path,line:y.lineOf(w)}}),q("descriptions","modelDescription",w.modelDescription);let j=Ut(w.inputs).some(oe=>J(oe)?.kind==="AutomaticTaskInput"&&J(oe)?.shouldPromptUser===!1);T==="OnRecognizedIntent"&&j&&E("ms:orchestrator-variables",b),T==="OnError"&&C.includes("System.Error.SubCode")&&E("ms:rai-error-handling",b),T==="OnKnowledgeRequested"&&[...ot(b)].some(oe=>oe.kind==="SendActivity")&&E("ms:knowledge-hold-message",b),T==="OnGeneratedResponse"&&C.includes("System.ContinueResponse")&&E("ms:prevent-tool-call-leaks",b);break}case"TaskDialog":{let b=J(w.action);q("descriptions","modelDescription",w.modelDescription),!v&&!_(w.modelDescription)&&f.push({kind:"action",name:a(d.path),at:{file:d.path,line:y.lineOf(w)}});let T=_(b?.connectionReference);if(b?.kind==="InvokeConnectorTaskAction"&&T&&(E(`connector:${Yt(T)}`,b),_(b.operationId)&&E(`operation:${Yt(T)}/${b.operationId}`,b)),b?.kind==="InvokeExternalAgentTaskAction"&&J(b.operationDetails)?.kind==="ModelContextProtocolMetadata"&&T&&E(`mcp:${Yt(T)}`,b),b?.kind==="InvokeConnectedAgentTaskAction"&&_(b.botSchemaName)&&(E(`calls:${b.botSchemaName}`,b),v||s.contract.push({calls:b.botSchemaName,..._(w.modelDisplayName)?{name:w.modelDisplayName}:{},history:J(b.historyType)?.kind==="ConversationHistory",inputs:Ut(w.inputs).map(R=>_(J(R)?.propertyName)).filter(R=>!!R),description:_(w.modelDescription)?.trim()??"",file:d.path,line:y.lineOf(b)})),b?.kind==="InvokeFlowTaskAction"&&_(b.flowId)){E(`flow:${b.flowId}`,b);let R=_(w.modelDisplayName)??_(J(w["mcs.metadata"])?.componentName);R&&(s.names[b.flowId]??=R)}break}case"KnowledgeSourceConfiguration":{let b=J(w.source);_(b?.kind)&&E(`knowledge:${b.kind}`,b),b&&"triggerCondition"in b&&E("yaml-only:triggerCondition",b),r.push({file:d.path,line:y.lineOf(w)});break}case"GlobalVariableComponent":{let b=J(w.variable)??w,T=_(b.name)??(_(w.schemaName)?it(w.schemaName,"."):void 0);if(!T)break;E(`var:${T}`),b.isExternalInitializationAllowed===!0&&E(`var-in:${T}`),v||m.push({name:T,at:{file:d.path,line:y.lineOf(w)}});break}case"ConnectionReferencesSourceFile":for(let b of Ut(w.connectionReferences).map(J)){let T=_(b?.connectorId)?it(b.connectorId,"/"):_(b?.connectionReferenceLogicalName)?Yt(b.connectionReferenceLogicalName):void 0;T&&E(`connref:${T}`,b),T&&_(b?.displayName)&&(s.names[T]=b.displayName)}break}for(let b of ot(w,!0))E(`disabled:node:${b.kind}`,b);for(let b of ot(w)){if(th.has(b.kind)&&E(`node:${b.kind}`,b),b.kind==="LogCustomTelemetryEvent"&&!v&&(_(b.eventName)&&!b.eventName.trim().startsWith("=")?u.push({name:b.eventName.trim(),properties:b.properties,at:{file:d.path,line:y.lineOf(b)}}):s.unknown.push({file:d.path,why:"telemetry"})),b.kind==="InvokeConnectorAction"&&_(b.connectionReference)){let R=Yt(b.connectionReference);E(`connector:${R}`,b),_(b.operationId)&&E(`operation:${R}/${b.operationId}`,b)}if(b.kind==="InvokeFlowAction"&&_(b.flowId)&&E(`flow:${b.flowId}`,b),(b.kind==="BeginDialog"||b.kind==="ReplaceDialog")&&_(b.dialog)){let R=b.dialog;c.push(R),R.startsWith("=")?R.includes("Switch(")&&E("ms:dynamic-topic-redirect",b):o.push({topic:`${v??""}/${it(R,".topic.")}`,into:O,at:{file:d.path,line:y.lineOf(b)}})}let T=R=>typeof R=="string"&&R.includes("System.Activity.ChannelId");(b.kind==="ConditionGroup"&&Ut(b.conditions).some(R=>T(J(R)?.condition))||b.kind==="SetVariable"&&T(b.value))&&E("ms:channel-aware-behavior",b),(b.kind==="SendActivity"||b.kind==="Question")&&JSON.stringify(b).includes("<br")&&E("ms:line-breaks-in-messages",b)}}r.length&&(s.facts[`knowledge:count=${r.length}`]=r);for(let d of u){let h=bi(d.name,s),y=wi(d.properties);(s.facts[`telemetry:event:${h}`]??=[]).push(d.at);for(let w of y??[])(s.facts[`telemetry:field:${h}/${w}`]??=[]).push(d.at);s.telemetry.push({name:d.name,form:h,...y?{fields:y}:{},...d.at})}let p=new Set([s.facts,...s.children.map(d=>d.facts)].flatMap(d=>Object.keys(d)).filter(d=>d.startsWith("flow:")).map(d=>d.slice(5)));for(let[d,{meta:h,metaFile:y,json:w}]of[...l].sort(([v],[O])=>v.localeCompare(O))){let v=_(h?.jsonFileName)??Object.keys(w)[0],O=v?w[v]:void 0,E=_(h?.workflowId),S=d.replace(/-[0-9a-f]{6,}$/i,"");if(!O){y&&s.unknown.push({file:y,why:"flow"});continue}let C=yi(O.data);if(!C||!E){s.unknown.push({file:O.file,why:"flow"});continue}let q=_(h?.displayName)??_(J(J(O.data)?.properties)?.displayName)??S,x=p.has(E);if(s.flows.push({id:E,name:q,folder:d,uses:C.uses.map(b=>b.key),returns:!!C.returns,called:x,file:O.file}),s.names[E]??=q,!x){(s.facts[`orphan:flow:${S}`]??=[]).push({file:y??O.file,line:1}),s.names[S]??=q;continue}for(let b of C.uses)(s.facts[`flow-uses:${b.key}`]??=[]).push({file:O.file,line:ws(O.text,b.action)});C.returns&&(s.facts["flow-returns"]??=[]).push({file:O.file,line:ws(O.text,C.returns)})}for(let d of f)c.some(h=>h===d.name||h.endsWith(`.${d.name}`))||(s.facts[`orphan:${d.kind}:${d.name}`]??=[]).push(d.at);for(let d of m)t.some(y=>y.path!==d.at.file&&new RegExp(`\\bGlobal\\.${d.name}\\b`).test(y.text))||(delete s.facts[`var:${d.name}`],delete s.facts[`var-in:${d.name}`],(s.facts[`orphan:variable:${d.name}`]??=[]).push(d.at));for(let d of o){let h=i.get(d.topic);(d.into[h?`reaches:${h}`:`calls:topic:${it(d.topic,"/")}`]??=[]).push(d.at)}for(let d of[s.facts,...s.children.map(h=>h.facts)])for(let[h,y]of Object.entries(d))d[h]=y.filter((w,v)=>y.findIndex(O=>O.file===w.file&&O.line===w.line)===v);return s}function ih(e){let t=new Set,n=r=>{if(!r||typeof r!="object")return;let{const:i,enum:o}=r;if(typeof i=="string"&&t.add(i),Array.isArray(o))for(let a of o)typeof a=="string"&&t.add(a)},s=r=>{if(Array.isArray(r))return r.forEach(s);if(!r||typeof r!="object")return;let i=r;n(i.kind),n(i.properties?.kind);for(let o of Object.values(i))s(o)};for(let r of Object.values(e.definitions??{}))s(r);return t}var at=ys(ts(),1);function ns(e,t){let n=new at.LineCounter,s=(0,at.parseDocument)(e,{lineCounter:n,prettyErrors:!1}),r=o=>{for(let a=o;a.length;a=a.slice(0,-1)){let c=s.getIn(a,!0);if(c?.range)return n.linePos(c.range[0]).line}return 1};if(s.errors.length)return{ok:!1,problem:{line:n.linePos(s.errors[0].pos[0]).line,key:"syntax",detail:s.errors[0].code}};let i=s.toJS();return!i||typeof i!="object"||Array.isArray(i)||i.format!==t||!(0,at.isMap)(s.contents)?{ok:!1,problem:{line:r(["format"]),key:"format"}}:{ok:!0,format:{raw:i,doc:s,at:r,lineOf:o=>n.linePos(o).line}}}var ss=[{id:"orchestrator-variables",name:"Orchestrator-Generated Variables",sign:"an OnRecognizedIntent topic with an AutomaticTaskInput that has shouldPromptUser: false"},{id:"rai-error-handling",name:"RAI Error Handling",sign:"the OnError topic reads System.Error.SubCode"},{id:"knowledge-hold-message",name:"Knowledge Hold Message",sign:"an OnKnowledgeRequested topic that sends a message"},{id:"prevent-tool-call-leaks",name:"Prevent Tool Call Leaks",sign:"an OnGeneratedResponse topic that sets System.ContinueResponse"},{id:"dynamic-topic-redirect",name:"Dynamic Topic Redirect",sign:"a BeginDialog whose dialog is a =Switch( expression"},{id:"channel-aware-behavior",name:"Channel-Aware Behavior",sign:"a condition or SetVariable that reads System.Activity.ChannelId (not a tool input)"},{id:"date-context",name:"Date Context",sign:"the instructions use Today() or Now()"},{id:"line-breaks-in-messages",name:"Line Breaks in Messages",sign:"<br /> inside a SendActivity or Question"},{id:"conversation-history-variable",name:"Conversation History Variable"},{id:"chain-of-thought-logging",name:"Chain of Thought Logging"},{id:"deterministic-mcp-calls",name:"Deterministic MCP Calls"},{id:"prevent-child-agent-responses",name:"Prevent Child Agent Responses"},{id:"jit-glossary",name:"JIT Glossary"},{id:"jit-user-context",name:"JIT User Context"},{id:"teams-production-hardening",name:"Teams Production Hardening"}];var ei={conversation:{en:"A. Conversation",pt:"A. Conversa"},integrations:{en:"B. Integrations",pt:"B. Integra\xE7\xF5es"},knowledge:{en:"C. Knowledge",pt:"C. Conhecimento"},orchestration:{en:"D. Orchestrator",pt:"D. Orquestrador"},governance:{en:"E. Governance",pt:"E. Governan\xE7a"},text:{en:"F. Text",pt:"F. Texto"},microsoft:{en:"Microsoft patterns",pt:"Padr\xF5es Microsoft"},declared:{en:"Declared",pt:"Declarado"}},rs={"trigger:OnConversationStart":{dim:"conversation",en:"Greeting",pt:"Boas-vindas"},"trigger:OnUnknownIntent":{dim:"conversation",en:"Fallback (when it does not understand)",pt:"Fallback (quando n\xE3o entende)"},"trigger:OnEscalate":{dim:"conversation",en:"Escalation to a person",pt:"Escalonamento para humano",lacks:{en:["does not escalate to a person","do not escalate to a person"],pt:["n\xE3o escala para humano","n\xE3o escalam para humano"]}},"trigger:OnError":{dim:"conversation",en:"Error handling",pt:"Tratamento de erro",lacks:{en:["does not handle errors","do not handle errors"],pt:["n\xE3o trata erro","n\xE3o tratam erro"]}},"trigger:OnRecognizedIntent":{dim:"conversation",en:"A topic of its own, by intent",pt:"T\xF3pico pr\xF3prio, por inten\xE7\xE3o"},"trigger:OnRedirect":{dim:"orchestration",en:"Takes a call from the orchestrator",pt:"Recebe chamada do orquestrador",lacks:{en:["takes no call from the orchestrator","take no call from the orchestrator"],pt:["n\xE3o recebe chamada do orquestrador","n\xE3o recebem chamada do orquestrador"]}},"trigger:OnSelectIntent":{dim:"conversation",en:"Disambiguation (\xABdid you mean\u2026\xBB)",pt:"Desambigua\xE7\xE3o (\xABvoc\xEA quis dizer\u2026\xBB)"},"trigger:OnSignIn":{dim:"conversation",en:"Sign-in",pt:"Login"},"trigger:OnGeneratedResponse":{dim:"conversation",en:"Reviews the generated answer",pt:"Revisa a resposta gerada"},"trigger:OnKnowledgeRequested":{dim:"knowledge",en:"Before searching knowledge",pt:"Antes de buscar no conhecimento"},"trigger:OnToolSelected":{dim:"orchestration",en:"Child chosen as a tool",pt:"Filho escolhido como ferramenta"},"trigger:OnActivity":{dim:"conversation",en:"On every message",pt:"Em toda mensagem"},"setting:generative=on":{dim:"conversation",en:"Generative orchestration on",pt:"Orquestra\xE7\xE3o generativa ligada"},"setting:generative=off":{dim:"conversation",en:"Generative orchestration off",pt:"Orquestra\xE7\xE3o generativa desligada"},"setting:model-knowledge=on":{dim:"governance",en:"The model's general knowledge on",pt:"Conhecimento geral do modelo ligado"},"setting:model-knowledge=off":{dim:"governance",en:"The model's general knowledge off",pt:"Conhecimento geral do modelo desligado"},"setting:semantic-search=on":{dim:"knowledge",en:"Semantic search on",pt:"Busca sem\xE2ntica ligada"},"setting:semantic-search=off":{dim:"knowledge",en:"Semantic search off",pt:"Busca sem\xE2ntica desligada"},"setting:web-browsing=on":{dim:"knowledge",en:"Web browsing on",pt:"Navega\xE7\xE3o na web ligada"},"setting:web-browsing=off":{dim:"knowledge",en:"Web browsing off",pt:"Navega\xE7\xE3o na web desligada"},"setting:connectable":{dim:"orchestration",en:"Can be called by an orchestrator",pt:"Pode ser chamado por um orquestrador"},"called-with:history":{dim:"orchestration",en:"Receives the conversation history",pt:"Recebe o hist\xF3rico da conversa",lacks:{en:["does not receive the conversation history from the orchestrator","do not receive the conversation history from the orchestrator"],pt:["n\xE3o recebe o hist\xF3rico da conversa do orquestrador","n\xE3o recebem o hist\xF3rico da conversa do orquestrador"]}},"routing:described":{dim:"orchestration",en:"Has a routing description",pt:"Tem descri\xE7\xE3o de roteamento",lacks:{en:["has no routing description","have no routing description"],pt:["n\xE3o tem descri\xE7\xE3o de roteamento","n\xE3o t\xEAm descri\xE7\xE3o de roteamento"]}},"flow-returns":{dim:"integrations",en:"The flow returns an answer",pt:"O fluxo devolve uma resposta",lacks:{en:["has a flow that returns nothing","have a flow that returns nothing"],pt:["tem fluxo que n\xE3o devolve nada","t\xEAm fluxo que n\xE3o devolve nada"]}},"flow-uses:child-flow":{dim:"integrations",en:"The flow calls another flow",pt:"O fluxo chama outro fluxo"},"topics:with-model-description":{dim:"conversation",en:"Topics described for the model",pt:"T\xF3picos descritos para o modelo"},"instructions:present":{dim:"governance",en:"Has instructions",pt:"Tem instru\xE7\xF5es",lacks:{en:["has no instructions","have no instructions"],pt:["n\xE3o tem instru\xE7\xF5es","n\xE3o t\xEAm instru\xE7\xF5es"]}},"node:LogCustomTelemetryEvent":{dim:"governance",en:"Logs telemetry",pt:"Registra telemetria",lacks:{en:["logs no telemetry","log no telemetry"],pt:["n\xE3o registra telemetria","n\xE3o registram telemetria"]}},"node:CSATQuestion":{dim:"governance",en:"Asks for satisfaction (CSAT)",pt:"Pergunta a satisfa\xE7\xE3o (CSAT)",lacks:{en:["does not ask for satisfaction","do not ask for satisfaction"],pt:["n\xE3o pergunta a satisfa\xE7\xE3o","n\xE3o perguntam a satisfa\xE7\xE3o"]}},"node:SearchAndSummarizeContent":{dim:"knowledge",en:"Generative answers from knowledge",pt:"Respostas generativas sobre o conhecimento"},"node:SearchKnowledgeSources":{dim:"knowledge",en:"Searches the knowledge sources",pt:"Busca nas fontes de conhecimento"},"yaml-only:triggerCondition":{dim:"knowledge",en:"Search condition only in YAML (the editor may erase it)",pt:"Condi\xE7\xE3o de busca s\xF3 no YAML (a tela pode apagar)"},"knowledge:SharePointSearchSource":{dim:"knowledge",en:"Knowledge in SharePoint",pt:"Conhecimento no SharePoint"},"declared:kpi":{dim:"declared",en:"KPI declared",pt:"KPI declarado",lacks:{en:["has no KPI declared","have no KPI declared"],pt:["n\xE3o tem KPI declarado","n\xE3o t\xEAm KPI declarado"]}},"declared:owner":{dim:"declared",en:"Owner declared",pt:"Dono declarado",lacks:{en:["has no owner declared","have no owner declared"],pt:["n\xE3o tem dono declarado","n\xE3o t\xEAm dono declarado"]}}},oh=Object.fromEntries(ss.map(e=>[e.id,e.name])),ah=[["called-with:input:","orchestration","Receives <value> from the orchestrator","Recebe <valor> do orquestrador"],["flow-uses:http:","integrations","Flow calls","Fluxo chama"],["flow-uses:connector:","integrations","Flow uses the connector","Fluxo usa o conector"],["flow-uses:operation:","integrations","Flow uses the operation","Fluxo usa a opera\xE7\xE3o"],["orphan:topic:","governance","Topic nobody calls","T\xF3pico que ningu\xE9m chama"],["orphan:action:","governance","Tool nobody can choose","Ferramenta que ningu\xE9m escolhe"],["orphan:variable:","governance","Variable nobody uses","Vari\xE1vel que ningu\xE9m usa"],["orphan:flow:","governance","Flow nobody calls","Fluxo que ningu\xE9m chama"],["disabled:node:","governance","Switched-off node","N\xF3 desligado"],["telemetry:event:","governance","Logs the event","Registra o evento"],["telemetry:field:","governance","The event carries the field (<event>/<field>)","O evento leva o campo (<evento>/<campo>)"],["disabled:","governance","Switched off","Desligado"],["reaches:","conversation","A topic leads to it (part of trigger:<value>)","Um t\xF3pico leva a ele (parte de trigger:<valor>)"],["calls:topic:","conversation","Calls the topic (one not found)","Chama o t\xF3pico (n\xE3o encontrado)"],["trigger:","conversation","Trigger","Gatilho"],["setting:","conversation","Setting","Configura\xE7\xE3o"],["connector:","integrations","Connector","Conector"],["operation:","integrations","Operation","Opera\xE7\xE3o"],["connref:","integrations","Connection reference","Refer\xEAncia de conex\xE3o"],["mcp:","integrations","MCP server","Servidor MCP"],["flow:","integrations","Flow","Fluxo"],["knowledge:","knowledge","Knowledge","Conhecimento"],["node:","governance","Node","N\xF3"],["calls:","orchestration","Calls","Chama"],["child:","orchestration","Child","Filho"],["var-in:","orchestration","Receives from the orchestrator","Recebe do orquestrador"],["var:","orchestration","Global variable","Vari\xE1vel global"],["model:","governance","Model","Modelo"],["auth:","governance","Sign-in","Login"],["ms:","microsoft","Microsoft pattern:","Padr\xE3o Microsoft:"],["text:","text","Text:","Texto:"],["declared:","declared","Declared:","Declarado:"]],ul=e=>ah.find(([t])=>e.startsWith(t)),dl=e=>!!rs[e]?.lacks;function zt(e){return e.startsWith("reaches:")?zt(`trigger:${e.slice(8)}`):rs[e]?.dim??ul(e)?.[1]??"governance"}var De=(e,t)=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t,pl=80;function lt(e){if(e.startsWith("reaches:"))return`trigger:${e.slice(8)}`;if(e.startsWith("telemetry:event:"))return"node:LogCustomTelemetryEvent";if(e.startsWith("telemetry:field:"))return`telemetry:event:${e.slice(16,e.lastIndexOf("/"))}`}var ke=(e,t)=>e.split("{agent}").join(t==="pt"?"\u2039nome\u203A":"\u2039name\u203A"),hl=e=>({form:e.slice(16,e.lastIndexOf("/")),field:e.slice(e.lastIndexOf("/")+1)}),fl=(e,t)=>t?.[e]??e;function pe(e,t,n){let s=rs[e];if(s)return s[t];if(e.startsWith("text:block:")){let a=e.endsWith("~variant"),c=a?e.slice(0,-8):e,f=n?.[c]??c.slice(11);return a?`${f} (${t==="pt"?"varia\xE7\xE3o":"variation"})`:f}if(e.startsWith("text:link-domain:"))return`${t==="pt"?"Link para":"Link to"} ${e.slice(17)}`;if(e==="text:email")return t==="pt"?"Cita um e-mail":"Mentions an e-mail";if(e.startsWith("text:")){let[a,c]=[e.slice(5).split("=")[0],e.includes("=")?e.slice(e.indexOf("=")+1):void 0],f=n?.[`text:${a}`]??a;return c===void 0?f:`${f} = ${c}`}if(e.startsWith("reaches:")){let a=pe(`trigger:${e.slice(8)}`,t);return t==="pt"?`Um t\xF3pico leva a \xAB${a}\xBB`:`A topic leads to \xAB${a}\xBB`}if(e.startsWith("called-with:input:"))return t==="pt"?`Recebe \xAB${e.slice(18)}\xBB do orquestrador`:`Receives \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:"))return t==="pt"?`Registra o evento \xAB${ke(e.slice(16),t)}\xBB`:`Logs the event \xAB${ke(e.slice(16),t)}\xBB`;if(e.startsWith("telemetry:field:")){let{form:a,field:c}=hl(e),f=ke(a,t);return t==="pt"?`\xAB${f}\xBB leva \xAB${c}\xBB`:`\xAB${f}\xBB carries \xAB${c}\xBB`}let r=/^knowledge:count=(\d+)$/.exec(e);if(r){let a=Number(r[1]);return t==="pt"?`${a} ${a===1?"fonte":"fontes"} de conhecimento`:`${a} knowledge ${a===1?"source":"sources"}`}let i=ul(e);if(!i)return e;let o=e.slice(i[0].length);if(i[0]==="ms:"&&(o=oh[o]??o),i[0]==="auth:"&&o==="None")return t==="pt"?"Sem login":"No sign-in";if(e.startsWith("setting:moderation="))return t==="pt"?`Modera\xE7\xE3o de conte\xFAdo: ${e.slice(19)}`:`Content moderation: ${e.slice(19)}`;if(["connector:","connref:","mcp:","calls:","flow:","flow-uses:connector:","orphan:flow:"].includes(i[0])&&(o=fl(o,n)),i[0]==="disabled:"&&(o=o.replace(":"," ")),i[0]==="operation:"||i[0]==="flow-uses:operation:"){let[a,c]=[o.slice(0,o.indexOf("/")),o.slice(o.indexOf("/")+1)];o=`${fl(a,n)} \xB7 ${c}`}return`${i[t==="pt"?3:2]} ${o}`}function is(e,t,n,s){let r=rs[e]?.lacks?.[t];if(r)return r[n===1?0:1];if(e.startsWith("reaches:")){let o=pe(`trigger:${e.slice(8)}`,t);return t==="pt"?`${n===1?"tem":"t\xEAm"} \xAB${o}\xBB, mas nenhum t\xF3pico leva a ele`:`${n===1?"has":"have"} \xAB${o}\xBB, but no topic leads to it`}if(e.startsWith("called-with:input:"))return t==="pt"?`${n===1?"n\xE3o recebe":"n\xE3o recebem"} \xAB${e.slice(18)}\xBB do orquestrador`:`${n===1?"does":"do"} not receive \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:")){let o=ke(e.slice(16),t);return t==="pt"?`${n===1?"n\xE3o registra":"n\xE3o registram"} o evento \xAB${o}\xBB`:`${n===1?"does":"do"} not log the event \xAB${o}\xBB`}if(e.startsWith("telemetry:field:")){let{form:o,field:a}=hl(e),c=ke(o,t);return t==="pt"?`${n===1?"registra":"registram"} \xAB${c}\xBB sem \xAB${a}\xBB`:`${n===1?"logs":"log"} \xAB${c}\xBB without \xAB${a}\xBB`}if(e.startsWith("calls:topic:"))return t==="pt"?`${n===1?"n\xE3o chama":"n\xE3o chamam"} o t\xF3pico ${e.slice(12)}`:`${n===1?"does":"do"} not call the topic ${e.slice(12)}`;let i=pe(e,t,s);return t==="pt"?`${n===1?"n\xE3o tem":"n\xE3o t\xEAm"} \xAB${i}\xBB`:`${n===1?"does":"do"} not have \xAB${i}\xBB`}var ml="cast-list/profile-v1",ni=["orchestrator","specialist"],ti={roles:{},threshold:.7,minAgents:3,rules:[],markers:[],blocks:[],types:[],focusAreas:[],ignore:[],microsoftPatterns:!0},lh=["format","name","roles","threshold","min_agents","rules","markers","blocks","types","focus_areas","ignore","microsoft_patterns"],ch=["instructions","descriptions","all"],fh=new Set(["trigger","setting","topics","instructions","connector","operation","connref","mcp","flow","knowledge","node","calls","reaches","child","var","var-in","model","auth","ms","declared","text","yaml-only","called-with","routing","flow-uses","flow-returns","orphan","disabled","telemetry"]),uh=e=>fh.has(e.split(":")[0]),We=e=>!!e&&typeof e=="object"&&!Array.isArray(e),G=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"",os=e=>Array.isArray(e)?e.map(G).filter(Boolean):G(e)?[G(e)]:[],gl=e=>ni.includes(e);function dh(e){let t=ns(e,ml);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:ml}:t.problem]};let{raw:n,at:s}=t.format,r=[];for(let S of Object.keys(n))lh.includes(S)||r.push({line:s([S]),key:"unknownKey",what:S});let i=(S,C,q)=>(G(S)||r.push({line:s(q),key:"missing",what:C}),G(S)),o=(S,C)=>{let q=new Set;C.forEach((x,b)=>{x&&q.has(x)&&r.push({line:s([S,b]),key:"duplicate",what:S,id:x}),q.add(x)})},a=S=>Array.isArray(n[S])?n[S]:[],c=n.threshold===void 0?ti.threshold:Number(n.threshold);c>0&&c<=1||r.push({line:s(["threshold"]),key:"threshold",value:G(n.threshold)});let f=n.min_agents===void 0?ti.minAgents:Number(n.min_agents);Number.isInteger(f)&&f>=1||r.push({line:s(["min_agents"]),key:"minAgents",value:G(n.min_agents)});let m={},u=We(n.roles)?n.roles:{};for(let S of Object.keys(u))gl(S)?m[S]=G(u[S])==="*"?"*":os(u[S]):r.push({line:s(["roles",S]),key:"role",what:`roles.${S}`,value:S});let l=(S,C,q)=>(gl(G(S))||r.push({line:s(q),key:"role",what:C,value:G(S)}),G(S)),p=(S,C,q)=>{let x=os(S);for(let b of x)uh(b)||r.push({line:s(q),key:"prefix",what:C,value:b});return x},d=a("rules").filter(We).map((S,C)=>{let q=`rules[${C}]`,x=p(S.has,q,["rules",C])[0],b=p(S.not,q,["rules",C])[0],T=p(S.when,q,["rules",C]);return!x&&!b&&r.push({line:s(["rules",C]),key:"rule",what:q}),{id:i(S.id,`${q}.id`,["rules",C]),...S.role!==void 0?{role:l(S.role,`${q}.role`,["rules",C,"role"])}:{},...T.length?{when:T}:{},...x?{has:x}:{},...b?{not:b}:{},says:G(S.says)||x||`not ${b}`}});o("rules",d.map(S=>S.id));let h=a("markers").filter(We).map((S,C)=>{let q=`markers[${C}]`,x=i(S.pattern,`${q}.pattern`,["markers",C]);try{x&&new RegExp(x,"i")}catch(R){r.push({line:s(["markers",C]),key:"regex",what:`${q}.pattern`,detail:R.message.replace(/^Invalid regular expression: /,"")})}let b=G(S.in)||"instructions";ch.includes(b)||r.push({line:s(["markers",C]),key:"in",what:`${q}.in`,value:b});let T=i(S.id,`${q}.id`,["markers",C]);return{id:T,name:G(S.name)||T,in:b,pattern:x,...G(S.value)?{value:G(S.value)}:{}}});o("markers",h.map(S=>S.id));let y=a("blocks").filter(We).map((S,C)=>{let q=i(S.id,`blocks[${C}].id`,["blocks",C]);return{id:q,name:G(S.name)||q,text:i(S.text,`blocks[${C}].text`,["blocks",C]),role:S.role!==void 0?l(S.role,`blocks[${C}].role`,["blocks",C,"role"]):"specialist"}});o("blocks",y.map(S=>S.id));let w=a("types").filter(We).map((S,C)=>{let q=`types[${C}]`,x=We(S.when)?S.when:{},b=Object.fromEntries(["all","any","none"].filter(j=>x[j]!==void 0).map(j=>[j,p(x[j],q,["types",C])]));!b.all?.length&&!b.any?.length&&r.push({line:s(["types",C]),key:"when",what:q});let T=S.min_agents===void 0?2:Number(S.min_agents);Number.isInteger(T)&&T>=1||r.push({line:s(["types",C,"min_agents"]),key:"minAgents",value:G(S.min_agents)});let R=i(S.id,`${q}.id`,["types",C]);return{id:R,name:G(S.name)||R,when:b,minAgents:T}});o("types",w.map(S=>S.id));let v=a("focus_areas").filter(We).map((S,C)=>{let q=os(S.facts);q.length||r.push({line:s(["focus_areas",C]),key:"missing",what:`focus_areas[${C}].facts`});let x=i(S.id,`focus_areas[${C}].id`,["focus_areas",C]);return{id:x,name:G(S.name)||x,facts:q}});o("focus_areas",v.map(S=>S.id));let O=n.microsoft_patterns,E={...G(n.name)?{name:G(n.name)}:{},roles:m,threshold:c,minAgents:f,rules:d,markers:h,blocks:y,types:w,focusAreas:v,ignore:os(n.ignore),microsoftPatterns:!(O===!1||G(O).toLowerCase()==="off")};return r.length?{problems:r}:{profile:E,problems:r}}var ph=e=>Object.keys(e.facts).some(t=>t.startsWith("calls:")&&!t.startsWith("calls:topic:"));function yl(e,t,n={}){let{orchestrator:s,specialist:r}=t.roles,i=(f,m)=>Array.isArray(f)&&f.includes(m),o=Object.fromEntries(e.map(f=>[f.id,i(s,f.id)?"orchestrator":i(r,f.id)?"specialist":n[f.id]??(s==="*"?"orchestrator":r==="*"?"specialist":ph(f)?"orchestrator":"specialist")])),a=new Set(e.map(f=>f.id)),c=[s,r].flatMap(f=>Array.isArray(f)?f:[]).filter(f=>!a.has(f));return{roles:o,unmatched:c}}function bl(e,t,n,s){let r=(i,o)=>Object.keys(i).some(a=>De(a,o));return Object.fromEntries(e.map(i=>{if(t[i.id]!=="specialist")return[i.id,[]];if(s[i.id]?.length)return[i.id,s[i.id]];let o=n.types.filter(({when:a})=>(a.all??[]).every(c=>r(i.facts,c))&&(!a.any?.length||a.any.some(c=>r(i.facts,c)))&&!(a.none??[]).some(c=>r(i.facts,c)));return[i.id,o.map(a=>a.id)]}))}var $e=ys(ts());var Wt="cast-list/cast-v1",hh=["accepted","rejected"],mh=["platform","specialist","orchestrator"],gh=e=>mh.includes(e)||/^type:[\w-]+$/.test(e),yh=["format","name","agents","blocks","declared","decisions"],bh=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ne=e=>typeof e=="string"?e.trim():typeof e=="number"||typeof e=="boolean"?String(e):"";function wh(e){let t=ns(e,Wt);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:Wt}:t.problem]};let{raw:n,at:s}=t.format,r=[];for(let l of Object.keys(n))yh.includes(l)||r.push({line:s([l]),key:"unknownKey",what:l});let i=l=>(Array.isArray(n[l])?n[l]:[]).filter(bh),o=(l,p,d)=>(ne(l)||r.push({line:s(d),key:"missing",what:p}),ne(l)),a=(l,p)=>{let d=new Set;p.forEach((h,y)=>{h&&d.has(h)&&r.push({line:s([l,y]),key:"duplicate",what:l,id:h}),d.add(h)})},c=i("agents").map((l,p)=>{let d=ne(l.role);ni.includes(d)||r.push({line:s(["agents",p,"role"]),key:"role",what:`agents[${p}].role`,value:d});let h=Array.isArray(l.types)?l.types.map(ne).filter(Boolean):[];return{id:o(l.id,`agents[${p}].id`,["agents",p]),role:d,...h.length?{types:h}:{}}}),f=i("blocks").map((l,p)=>({id:o(l.id,`blocks[${p}].id`,["blocks",p]),text:o(l.text,`blocks[${p}].text`,["blocks",p])}));a("blocks",f.map(l=>l.id)),a("agents",c.map(l=>l.id));let m=i("declared").map((l,p)=>({agent:o(l.agent,`declared[${p}].agent`,["declared",p]),key:o(l.key,`declared[${p}].key`,["declared",p]),value:ne(l.value),source:ne(l.source)}));a("declared",m.map(l=>`${l.agent} ${l.key}`));let u=i("decisions").map((l,p)=>{let d=ne(l.status),h=ne(l.scope);return hh.includes(d)||r.push({line:s(["decisions",p,"status"]),key:"status",value:d}),gh(h)||r.push({line:s(["decisions",p,"scope"]),key:"scope",value:h}),{key:o(l.key,`decisions[${p}].key`,["decisions",p]),status:d,scope:h,why:ne(l.why)}});return a("decisions",u.map(l=>l.key)),r.length?{problems:r}:{cast:{...ne(n.name)?{name:ne(n.name)}:{},agents:c,blocks:f,declared:m,decisions:u},problems:r}}var kh=` What people said about the agents, and what was decided. build.mjs keeps it up to date; edit it, or fill the
|
|
142
|
+
workbook's \xABDeclared\xBB sheet and the \xABDecision\xBB column and read it back with --from.`,$h={agents:e=>ne(e.id),blocks:e=>ne(e.id),declared:e=>`${ne(e.agent)} ${ne(e.key)}`,decisions:e=>ne(e.key)},vh=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""&&t!==void 0));function Sh(e,t){let n=t?(0,$e.parseDocument)(t):void 0,s=n&&!n.errors.length&&(0,$e.isMap)(n.contents)?n:new $e.Document({format:Wt});s!==n&&(s.commentBefore=kh),s.get("format")!==Wt&&s.set("format",Wt),e.name===void 0?s.delete("name"):s.get("name")!==e.name&&s.set("name",e.name);for(let[r,i]of Object.entries($h)){let o=e[r];if(!o.length){s.delete(r);continue}let a=s.get(r,!0);if((0,$e.isSeq)(a)||s.set(r,a=s.createNode([])),!(0,$e.isSeq)(a))continue;let c=new Map(a.items.filter($e.isMap).map(f=>[i(f.toJSON()),f]));a.items=o.map(f=>{let m=vh(f),u=c.get(i(m));if(!u){let l=s.createNode(m);return l.flow=r!=="blocks",l}for(let[l,p]of Object.entries(m))JSON.stringify(u.toJSON()[l])!==JSON.stringify(p)&&u.set(l,p);for(let l of Object.keys(u.toJSON()))l in m||u.delete(l);return u})}return s.toString({lineWidth:0,flowCollectionPadding:!0})}function Oh(e,t="en"){let n=t==="pt";switch(e.key){case"syntax":return n?`n\xE3o se l\xEA como YAML (${e.detail})`:`does not read as YAML (${e.detail})`;case"format":return n?`\xABformat\xBB precisa ser ${e.format}`:`\xABformat\xBB must be ${e.format}`;case"missing":return n?`falta \xAB${e.what}\xBB`:`\xAB${e.what}\xBB is missing`;case"duplicate":return n?`${e.what}: o id \xAB${e.id}\xBB se repete`:`${e.what}: the id \xAB${e.id}\xBB is repeated`;case"unknownKey":return n?`\xAB${e.what}\xBB n\xE3o \xE9 um campo deste arquivo`:`\xAB${e.what}\xBB is not a field of this file`;case"threshold":return n?`\xABthreshold\xBB vai de 0 a 1, como 0.7 (est\xE1 \xAB${e.value}\xBB)`:`\xABthreshold\xBB goes from 0 to 1, like 0.7 (it is \xAB${e.value}\xBB)`;case"minAgents":return n?`\xABmin_agents\xBB \xE9 um n\xFAmero inteiro a partir de 1 (est\xE1 \xAB${e.value}\xBB)`:`\xABmin_agents\xBB is a whole number from 1 (it is \xAB${e.value}\xBB)`;case"role":return n?`\xAB${e.what}\xBB \xE9 orchestrator ou specialist (est\xE1 \xAB${e.value}\xBB)`:`\xAB${e.what}\xBB is orchestrator or specialist (it is \xAB${e.value}\xBB)`;case"status":return n?`\xABstatus\xBB \xE9 accepted ou rejected (est\xE1 \xAB${e.value}\xBB)`:`\xABstatus\xBB is accepted or rejected (it is \xAB${e.value}\xBB)`;case"scope":return n?`\xABscope\xBB \xE9 platform, specialist, orchestrator ou type:<tipo> (est\xE1 \xAB${e.value}\xBB)`:`\xABscope\xBB is platform, specialist, orchestrator or type:<type> (it is \xAB${e.value}\xBB)`;case"regex":return n?`\xAB${e.what}\xBB n\xE3o \xE9 uma express\xE3o regular v\xE1lida (${e.detail})`:`\xAB${e.what}\xBB is not a valid regular expression (${e.detail})`;case"in":return n?`\xAB${e.what}\xBB \xE9 instructions, descriptions ou all (est\xE1 \xAB${e.value}\xBB)`:`\xAB${e.what}\xBB is instructions, descriptions or all (it is \xAB${e.value}\xBB)`;case"when":return n?`\xAB${e.what}\xBB precisa de \xABwhen\xBB com all, any ou none`:`\xAB${e.what}\xBB needs a \xABwhen\xBB with all, any or none`;case"prefix":return n?`\xAB${e.what}\xBB: nenhuma chave come\xE7a como \xAB${e.value}\xBB (veja references/keys.md)`:`\xAB${e.what}\xBB: no key starts like \xAB${e.value}\xBB (see references/keys.md)`;case"rule":return n?`\xAB${e.what}\xBB precisa de \xABhas\xBB ou \xABnot\xBB: o que conferir`:`\xAB${e.what}\xBB needs \xABhas\xBB or \xABnot\xBB: what to check`}}function wl(e,t){let n=e.split(/\s+/).filter(Boolean),s=t.split(/\s+/).filter(Boolean);if(n.length>2e3||s.length>2e3)return[{op:"del",text:n.join(" ")},{op:"add",text:s.join(" ")}];let r=Array.from({length:n.length+1},()=>new Uint16Array(s.length+1));for(let f=n.length-1;f>=0;f--)for(let m=s.length-1;m>=0;m--)r[f][m]=n[f]===s[m]?r[f+1][m+1]+1:Math.max(r[f+1][m],r[f][m+1]);let i=[],o=(f,m)=>{let u=i[i.length-1];u?.op===f?u.text+=` ${m}`:i.push({op:f,text:m})},a=0,c=0;for(;a<n.length||c<s.length;)a<n.length&&c<s.length&&n[a]===s[c]?o("same",(a++,c++,n[a-1])):c<s.length&&(a===n.length||r[a][c+1]>=r[a+1][c])?o("add",s[c++]):o("del",n[a++]);for(let f=0;f+1<i.length;f++)i[f].op==="add"&&i[f+1].op==="del"&&([i[f],i[f+1]]=[i[f+1],i[f]]);return i}var kl=.85,si=.5,Ah=8,ri=5;function Nh(e){return e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/https?:\/\/\S+|www\.\S+/g," #url ").replace(/\d+([.,]\d+)?/g," #n ").replace(/[^a-z#\s]+/g," ").split(/\s+/).filter(Boolean)}var Eh=e=>{if(e.length<=ri)return new Set([e.join(" ")]);let t=new Set;for(let n=0;n+ri<=e.length;n++)t.add(e.slice(n,n+ri).join(" "));return t},Sl=(e,t)=>{let n=0;for(let s of e)t.has(s)&&n++;return n},$l=(e,t)=>{let n=Sl(e,t);return n/(e.size+t.size-n||1)},as=(e,t)=>Sl(e,t)/(Math.min(e.size,t.size)||1);var ii=(e,t,n,s)=>{let r=Nh(e);return{agent:s,file:t,line:n,text:e,words:r,shingles:Eh(r)}};function xh(e,t){let n=[],s=-1,r=e.text.split(`
|
|
143
|
+
`),i=o=>{if(s<0)return;let a=r.slice(s,o).join(`
|
|
144
|
+
`).trim(),c=ii(a,e.file,e.line+s,t);c.words.length>=Ah&&n.push(c),s=-1};return r.forEach((o,a)=>{o.trim()?s<0&&(s=a):i(a)}),i(r.length),n}var Ch=(e,t)=>{let n=e.filter(r=>!r.startsWith("#")).slice(0,5).join("-")||"block",s=n;for(let r=2;t.has(s);r++)s=`${n}-${r}`;return t.add(s),s},vl=e=>{let t=e.split(/\s+/).filter(Boolean);return t.slice(0,8).join(" ")+(t.length>8?"\u2026":"")};function Ol(e,t,n){let s=e.flatMap(u=>u.texts.flatMap(l=>xh(l,u.id))),r=[];for(let u of s){let l=r.find(p=>as(p[0].shingles,u.shingles)>=si);l?l.push(u):r.push([u])}let i=n.map(u=>({...u,block:ii(u.text,"profile",0)})),o=t.map(u=>({...u,block:ii(u.text,"cast",0)})),a=new Set([...n.map(u=>u.id),...t.map(u=>u.id)]),c=[],f=new Set;for(let u of r){let l=i.find(v=>!f.has(v.id)&&as(v.block.shingles,u[0].shingles)>=si);if(new Set(u.map(v=>v.agent)).size<2&&!l)continue;let p=v=>u.filter(O=>$l(O.shingles,v.shingles)>=kl).length,d=l?.block??u.reduce((v,O)=>p(O)>p(v)?O:v,u[0]),h=l?void 0:o.find(v=>!f.has(v.id)&&as(v.block.shingles,d.shingles)>=si),y=l?.id??h?.id??Ch(d.words,a);f.add(y);let w={id:y,label:vl(d.text),text:d.text,...l?{official:l.name}:{},holders:{},variants:{}};for(let v of u){let O=v.agent,E=$l(d.shingles,v.shingles)>=kl?1:as(d.shingles,v.shingles);E===1?(w.holders[O]??={file:v.file,line:v.line},delete w.variants[O]):!w.holders[O]&&(!w.variants[O]||E>w.variants[O].similarity)&&(w.variants[O]={source:{file:v.file,line:v.line},similarity:E,text:v.text,diff:wl(d.text,v.text)})}c.push(w)}for(let u of i.filter(l=>!f.has(l.id)))c.push({id:u.id,label:vl(u.text),text:u.text,official:u.name,holders:{},variants:{}});let m=Object.fromEntries(e.map(u=>[u.id,{}]));for(let u of c){for(let[l,p]of Object.entries(u.holders))m[l][`text:block:${u.id}`]=[p];for(let[l,p]of Object.entries(u.variants))m[l][`text:block:${u.id}~variant`]=[p.source]}return{families:c,facts:m}}var Th=/https?:\/\/([^\s/)\]>"'«»]+)/gi,qh=/[\w.+-]+@[\w-]+(\.[\w-]+)+/g,Mh=(e,t)=>e.line+(e.text.slice(0,t).match(/\n/g)?.length??0),Lh=e=>e.toLowerCase().replace(/\s+/g," ").trim();function Al(e,t){let n={},s={};for(let r of e){let i=n[r.id]={},o=s[r.id]={},a=(c,f,m)=>(i[c]??=[]).push({file:f.file,line:Mh(f,m)});for(let c of r.texts){for(let f of t.filter(m=>m.in==="all"||m.in===c.source))for(let m of c.text.matchAll(new RegExp(f.pattern,"gi"))){if(!f.value){a(`text:${f.id}`,c,m.index);continue}let u=Lh(f.value.replace(/\$(\d)/g,(l,p)=>m[Number(p)]??""));u&&(a(`text:${f.id}=${u}`,c,m.index),(o[f.id]??=[]).includes(u)||o[f.id].push(u))}if(c.source==="instructions"){for(let f of c.text.matchAll(Th))a(`text:link-domain:${f[1].toLowerCase().replace(/[.,;:]+$/,"")}`,c,f.index);for(let f of c.text.matchAll(qh))a("text:email",c,f.index)}}for(let[c,f]of Object.entries(i))i[c]=f.filter((m,u)=>f.findIndex(l=>l.file===m.file&&l.line===m.line)===u)}return{facts:n,values:s}}function Nl(e,t,n){let s=[];for(let r of t.filter(i=>i.value)){for(let i of["specialist","orchestrator"]){let o={};for(let[a,c]of Object.entries(e))if(n[a]===i)for(let f of c[r.id]??[])(o[f]??=[]).push(a);Object.keys(o).length>1&&s.push({kind:"values",marker:r,role:i,byValue:o})}for(let[i,o]of Object.entries(e))(o[r.id]??[]).length>1&&s.push({kind:"twice",marker:r,agent:i,values:o[r.id]})}return s}var Ph=/^(no|não|nao|false|off|0)$/i,Ih=new Set(ss.filter(e=>!e.sign).map(e=>`ms:${e.id}`)),Rh=e=>e.includes(":")&&!e.startsWith("declared:")&&!Ih.has(e),Fh=e=>e.startsWith("declared:")?e:`declared:${e}`,oi=e=>e.endsWith("~variant"),ls=e=>/^(orphan|disabled):/.test(e);function Dh(e){let t=new Map;for(let s of e)for(let r of s.telemetry??[]){let i=t.get(ee(r.form))??new Map;t.set(ee(r.form),i),i.set(r.form,(i.get(r.form)??new Set).add(s.id))}let n=new Map;for(let s of t.values()){let[r]=[...s].sort(([i,o],[a,c])=>c.size-o.size||i.localeCompare(a));for(let i of s.keys())n.set(i,r[0])}return n}function jh(e,t){if(e.startsWith("telemetry:event:"))return`telemetry:event:${t.get(e.slice(16))??e.slice(16)}`;if(e.startsWith("telemetry:field:")){let n=e.lastIndexOf("/"),s=e.slice(16,n);return`telemetry:field:${t.get(s)??s}${e.slice(n)}`}return e}function _h(e,t,n,s){let r=Object.fromEntries(n.agents.map(g=>[g.id,g.role])),{roles:i,unmatched:o}=yl(e,t,r),a=g=>t.ignore.includes(g)||!t.microsoftPatterns&&g.startsWith("ms:"),c=[],f=Ol(e,n.blocks,t.blocks),m=Al(e,t.markers),u=new Map(e.filter(g=>g.schemaName).map(g=>[g.schemaName,g.id])),l=e.flatMap(g=>(g.contract??[]).map(N=>({...N,caller:g.id,...u.has(N.calls)?{agent:u.get(N.calls)}:{}}))),p={};for(let g of l.filter(N=>N.agent)){let N=p[g.agent]??={},I={file:`${g.caller}/${g.file}`,line:g.line},F=W=>(N[W]??=[]).push(I);g.history&&F("called-with:history");for(let W of g.inputs)F(`called-with:input:${W}`);g.description&&F("routing:described")}let d=Dh(e),h=g=>{let N={};for(let[I,F]of Object.entries(g.facts))(N[jh(I,d)]??=[]).push(...F);return{...N,...f.facts[g.id],...m.facts[g.id],...p[g.id]}},y=e.map(g=>{let N=h(g),I=Object.fromEntries(Object.entries(N).filter(([F])=>!a(F)));for(let F of n.declared.filter(W=>W.agent===g.id)){let W=!Ph.test(F.value);if(Rh(F.key)){let H=F.key in N;W!==H&&c.push({agent:g.id,key:F.key,declared:F.value||"yes",observed:H,source:F.source})}else W&&(I[Fh(F.key)]??=[]).push({file:F.source?`declared: ${F.source}`:"declared"})}return{id:g.id,role:i[g.id],...g.schemaName?{schemaName:g.schemaName}:{},...g.displayName?{displayName:g.displayName}:{},facts:I,children:g.children}}),w=g=>y.filter(N=>N.role===g),v=(g,N=y)=>N.filter(I=>g in I.facts),O=(g,N=y)=>N.flatMap(I=>I.facts[g]??[]),E=[...new Set(y.flatMap(g=>Object.keys(g.facts)))].sort(),S=g=>n.decisions.find(N=>N.key===g),C=bl(y,i,t,Object.fromEntries(n.agents.filter(g=>g.types?.length).map(g=>[g.id,g.types]))),q=g=>g==="platform"?y:g.startsWith("type:")?y.filter(N=>C[N.id]?.includes(g.slice(5))):w(g),x=[];for(let g of["specialist","orchestrator"]){let N=w(g);if(N.length<t.minAgents)continue;let I=w(g==="specialist"?"orchestrator":"specialist");for(let F of E){if(F.startsWith("declared:")||lt(F)||oi(F)||ls(F)||x.some(gs=>gs.key===F))continue;let H=v(F,N).length/N.length;if(H<t.threshold)continue;let ms=I.length>0&&v(F,I).length/I.length>=(I.length>=t.minAgents?t.threshold:1),je=S(F);x.push({key:F,role:g,scope:je?.scope??(ms?"platform":g),share:H,agents:v(F).map(gs=>gs.id),sources:O(F),...je?{decision:je}:{}})}}let b=[];for(let g of t.types){let N=q(`type:${g.id}`);if(N.length){if(N.length<g.minAgents){b.push({type:g.id,agents:N.map(I=>I.id)});continue}for(let I of E){if(I.startsWith("declared:")||lt(I)||oi(I)||ls(I)||x.some(H=>H.key===I))continue;let F=v(I,N).length/N.length;if(F<t.threshold)continue;let W=S(I);x.push({key:I,role:"specialist",scope:W?.scope??`type:${g.id}`,share:F,agents:v(I).map(H=>H.id),sources:O(I),...W?{decision:W}:{}})}}}for(let g of t.blocks){let N=`text:block:${g.id}`,I=x.find(H=>H.key===N);if(I){I.official=g.name;continue}let F=w(g.role),W=S(N);x.push({key:N,role:g.role,scope:W?.scope??g.role,share:F.length?v(N,F).length/F.length:0,agents:v(N).map(H=>H.id),sources:O(N),official:g.name,...W?{decision:W}:{}})}for(let g of n.decisions.filter(N=>N.status==="accepted"&&!x.some(I=>I.key===N.key))){let N=q(g.scope),I=v(g.key,N);x.push({key:g.key,role:g.scope==="orchestrator"?"orchestrator":"specialist",scope:g.scope,share:N.length?I.length/N.length:0,agents:I.map(F=>F.id),sources:O(g.key),decision:g})}for(let g of E.filter(N=>lt(N))){let N=x.find(H=>H.key===lt(g));if(!N)continue;let I=q(N.scope).filter(H=>N.key in H.facts),F=I.length?v(g,I).length/I.length:0;if(F<t.threshold)continue;let W=S(g)??N.decision;x.push({key:g,role:N.role,scope:N.scope,share:F,agents:v(g).map(H=>H.id),sources:O(g),partOf:N.key,...W?{decision:W}:{}})}x.sort((g,N)=>g.scope.localeCompare(N.scope)||g.key.localeCompare(N.key));let T=e.flatMap(g=>(g.telemetry??[]).map(N=>{let I=s?.rows.filter(F=>F.agent===g.id&&ee(F.event)===ee(N.name));return{...N,agent:g.id,as:d.get(N.form)??N.form,...s?{fired:I.reduce((F,W)=>F+W.count,0)}:{}}})),R=new Set(T.filter(g=>!g.fields).map(g=>`${g.agent} ${g.as}`)),j=(g,N)=>N.startsWith("telemetry:field:")&&R.has(`${g} ${N.slice(16,N.lastIndexOf("/"))}`),oe=x.filter(g=>g.decision?.status!=="rejected").flatMap(g=>q(g.scope).filter(N=>!(g.key in N.facts)&&(!g.partOf||g.partOf in N.facts)&&!j(N.id,g.key)).map(N=>({agent:N.id,key:g.key,scope:g.scope,...g.partOf?{partOf:g.partOf}:{},...`${g.key}~variant`in N.facts?{variant:!0}:{}}))).sort((g,N)=>g.agent.localeCompare(N.agent)||g.key.localeCompare(N.key)),Ee=[],k=[];for(let g of E){if(g.startsWith("declared:")||lt(g)||oi(g)||ls(g))continue;let N=v(g),I={key:g,agents:N.map(F=>F.id),sources:O(g)};N.every(F=>F.role==="orchestrator")?k.push(I):N.length===1&&Ee.push(I)}let $=(g,N)=>Object.keys(g.facts).some(I=>De(I,N)),P=t.rules.map(g=>({rule:g,agents:(g.role?w(g.role):y).filter(N=>(g.when??[]).every(I=>$(N,I))).filter(N=>g.has!==void 0&&!$(N,g.has)||g.not!==void 0&&$(N,g.not)).map(N=>N.id)})).filter(g=>g.agents.length),B=y.some(g=>g.role==="orchestrator"),Y=new Set(l.map(g=>g.agent)),ae=y.flatMap(g=>Object.keys(g.facts).filter(ls).sort().map(N=>{let[I,F,...W]=N.split(":");return{agent:g.id,key:N,how:I,what:F,name:W.join(":"),sources:g.facts[N]}}));return{...t.name??n.name?{name:t.name??n.name}:{},roles:i,unmatched:o,agents:y,patterns:x,offPattern:oe,solos:Ee,orchestratorDoes:k,gaps:P,conflicts:c,unknown:e.flatMap(g=>g.unknown.map(N=>({...N,agent:g.id}))),names:Object.assign({},...e.map(g=>g.names??{}),...e.map(g=>g.schemaName&&g.displayName?{[g.schemaName]:g.displayName}:{}),...f.families.map(g=>({[`text:block:${g.id}`]:g.official??g.label})),...t.markers.map(g=>({[`text:${g.id}`]:g.name}))),types:C,typeNames:Object.fromEntries(t.types.map(g=>[g.id,g.name])),typeNotes:b,blocks:f.families,markerFindings:Nl(m.values,t.markers,i),contract:{routes:l,missing:l.filter(g=>!g.agent),uncalled:B?y.filter(g=>g.role==="specialist"&&!Y.has(g.id)).map(g=>g.id):[],short:l.filter(g=>g.description&&g.description.length<pl)},flows:e.flatMap(g=>(g.flows??[]).map(N=>({...N,agent:g.id}))),unused:ae,telemetry:{events:T,spellings:T.filter(g=>g.as!==g.form),notFired:s?T.filter(g=>g.fired===0&&s.rows.some(N=>N.agent===g.agent)):[],silent:s?e.map(g=>g.id).filter(g=>!s.rows.some(N=>N.agent===g)):[],...s?{days:s.days,file:s.file}:{}}}}var Bh={specialist:{en:["specialist","specialists"],pt:["especialista","especialistas"]},orchestrator:{en:["orchestrator","orchestrators"],pt:["orquestrador","orquestradores"]}},ue=(e,t,n)=>Bh[e][t][n===1?0:1],cs={en:{summary:"Summary",matrix:"Matrix",patterns:"Patterns",text:"Text",off:"Off pattern",gaps:"Gaps",conflicts:"Conflicts",agents:"Cast",evidence:"Evidence",declared:"Declared",unknown:"Not understood",routing:"Routing",unused:"Unused",telemetry:"Telemetry",written:"As written",form:"Form",fields:"Fields",fired:e=>`Fired (${e} days)`,notRead:"not read",caller:"Caller",called:"Called",history:"History",inputs:"Inputs",routingText:"Routing description",chars:"Characters",notInFolder:"not in the folder",what:"What",how:"How",thing:{topic:"topic",action:"tool",variable:"variable",flow:"flow",node:"node",knowledge:"knowledge source"},orphan:"nobody uses it",disabled:"switched off",dimension:"Dimension",fact:"Fact",key:"Key",agent:"Who",name:"Name",role:"Role",scope:"Scope",share:"Share",have:"Who has it",lack:"Who lacks it",decision:"Decision",why:"Why",missing:"Missing",accepted:"Accepted pattern",rule:"Rule",says:"Says",notMet:"Who does not meet it",value:"Value",source:"Source",inYaml:"In the YAML",file:"File",line:"Line",facts:"Facts",alone:"Only it has",children:"Children",kind:"Kind",types:"Types",id:"Id",label:"Label",body:"Text",variant:"Variation",official:"Official",type:"type",yes:"yes",no:"no",accept:"accepted",reject:"rejected",platform:"platform",specialist:"specialist",orchestrator:"orchestrator",title:"The cast, compared",look:"To look at",nothing:"Nothing to look at",privacy:"This file holds the client\u2019s data: keep it in the client\u2019s environment.",count:{agents:"In the cast",orchestrators:"Orchestrators",specialists:"Specialists",patterns:"Patterns",off:"Off a pattern",gaps:"Rules not met",conflicts:"Conflicts",solos:"Only one has it",unused:"Unused or switched off"},why_:{yaml:"YAML that does not read",empty:"empty",kind:"a kind Copilot Studio does not have",file:"not a Copilot Studio file",json:"JSON that does not read",flow:"a flow in a shape the analysis does not know",telemetry:"a telemetry event whose name is a formula"}},pt:{summary:"Resumo",matrix:"Matriz",patterns:"Padr\xF5es",text:"Texto",off:"Fora do padr\xE3o",gaps:"Lacunas",conflicts:"Conflitos",agents:"Elenco",evidence:"Evid\xEAncias",declared:"Declarado",unknown:"N\xE3o entendeu",routing:"Roteamento",unused:"Sem uso",telemetry:"Telemetria",written:"Como est\xE1 escrito",form:"Forma",fields:"Campos",fired:e=>`Disparou (${e} dias)`,notRead:"n\xE3o lido",caller:"Quem chama",called:"Chamado",history:"Hist\xF3rico",inputs:"Entradas",routingText:"Descri\xE7\xE3o de roteamento",chars:"Caracteres",notInFolder:"n\xE3o est\xE1 na pasta",what:"O qu\xEA",how:"Como",thing:{topic:"t\xF3pico",action:"ferramenta",variable:"vari\xE1vel",flow:"fluxo",node:"n\xF3",knowledge:"fonte de conhecimento"},orphan:"ningu\xE9m usa",disabled:"desligado",dimension:"Dimens\xE3o",fact:"Fato",key:"Chave",agent:"Quem",name:"Nome",role:"Papel",scope:"Escopo",share:"Quantos",have:"Quem tem",lack:"Quem falta",decision:"Decis\xE3o",why:"Por qu\xEA",missing:"Falta",accepted:"Padr\xE3o aceito",rule:"Regra",says:"Diz",notMet:"Quem n\xE3o cumpre",value:"Valor",source:"Fonte",inYaml:"No YAML",file:"Arquivo",line:"Linha",facts:"Fatos",alone:"S\xF3 ele tem",children:"Filhos",kind:"Kind",types:"Tipos",id:"Id",label:"R\xF3tulo",body:"Texto",variant:"Varia\xE7\xE3o",official:"Oficial",type:"tipo",yes:"sim",no:"n\xE3o",accept:"aceito",reject:"rejeitado",platform:"plataforma",specialist:"especialista",orchestrator:"orquestrador",title:"Elenco comparado",look:"Para olhar",nothing:"Nada para olhar",privacy:"Este arquivo tem dados do cliente: deixe-o no ambiente dele.",count:{agents:"No elenco",orchestrators:"Orquestradores",specialists:"Especialistas",patterns:"Padr\xF5es",off:"Fora do padr\xE3o",gaps:"Regras n\xE3o cumpridas",conflicts:"Conflitos",solos:"S\xF3 um tem",unused:"Sem uso ou desligado"},why_:{yaml:"YAML que n\xE3o se l\xEA",empty:"vazio",kind:"um kind que o Copilot Studio n\xE3o tem",file:"n\xE3o \xE9 arquivo do Copilot Studio",json:"JSON que n\xE3o se l\xEA",flow:"um fluxo num formato que a an\xE1lise n\xE3o conhece",telemetry:"um evento de telemetria com o nome em f\xF3rmula"}}};var Ae=e=>e.join(", "),Cl=[{key:"contradictions",en:"Contradictions",pt:"Contradi\xE7\xF5es",keys:["conflict","contradiction"]},{key:"contract",en:"Contract and telemetry",pt:"Contrato e telemetria",keys:["spelling","contract","flow","telemetry"]},{key:"off",en:"Off pattern",pt:"Fora do padr\xE3o",keys:["off","values","twice","type"]},{key:"rules",en:"Rules",pt:"Regras",keys:["gap"]},{key:"solo",en:"Only one has it",pt:"S\xF3 um tem",keys:["solo"],folded:!0},{key:"unused",en:"Unused",pt:"Sem uso",keys:["unused"],folded:!0},{key:"unknown",en:"Not understood",pt:"N\xE3o entendeu",keys:["unknown","unmatched"]}],El=Cl.flatMap(e=>e.keys);function ai(e){return Cl.map(t=>({key:t.key,en:t.en,pt:t.pt,folded:!!t.folded,looks:e.flatMap((n,s)=>t.keys.includes(n.key)?[{look:n,at:s}]:[])})).filter(t=>t.looks.length)}var xl=e=>e.replace(/(\.topic)?\.mcs\.ya?ml$/,"");function Kh(e){let t=[],n=(l,p)=>pe(l,p,e.names);for(let l of e.conflicts){let p=l.source?`\xAB${l.source}\xBB`:null,[d,h]=[n(l.key,"en"),n(l.key,"pt")];t.push(l.observed?{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it does not have \xAB${d}\xBB, but the YAML has it`,pt:`${l.agent}: ${p??"o declarado"} diz que n\xE3o tem \xAB${h}\xBB, mas o YAML tem`}:{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it has \xAB${d}\xBB, but the YAML does not`,pt:`${l.agent}: ${p??"o declarado"} diz que tem \xAB${h}\xBB, mas o YAML n\xE3o tem`})}let s=(l,p)=>Object.keys(e.agents.find(d=>d.id===l)?.facts??{}).filter(d=>De(d,p));for(let l of e.gaps.filter(p=>p.rule.not&&!p.rule.has))for(let p of[...l.agents].sort()){let d=s(p,l.rule.not)[0]??l.rule.not,h=(l.rule.when??[]).map(w=>s(p,w)[0]??w),y=w=>h.length?`\xAB${h.map(v=>n(v,w)).join(w==="pt"?"\xBB e \xAB":"\xBB and \xAB")}\xBB, ${w==="pt"?"mas tamb\xE9m":"but also"} \xAB${n(d,w)}\xBB`:`\xAB${n(d,w)}\xBB`;t.push({key:"contradiction",agents:[p],fact:d,en:`${p} has ${y("en")} (rule \xAB${l.rule.says}\xBB)`,pt:`${p} tem ${y("pt")} (regra \xAB${l.rule.says}\xBB)`})}for(let l of e.contract.missing)t.push({key:"contract",agents:[l.caller],fact:`calls:${l.calls}`,en:`The orchestrator calls \xAB${l.name??l.calls}\xBB, which is not in the folder`,pt:`O orquestrador chama \xAB${l.name??l.calls}\xBB, que n\xE3o est\xE1 na pasta`});for(let l of e.contract.uncalled)t.push({key:"contract",agents:[l],en:`${l} is in the folder, but no orchestrator calls it`,pt:`${l} est\xE1 na pasta, mas nenhum orquestrador o chama`});for(let l of e.contract.short){let p=l.description.length;t.push({key:"contract",agents:[l.agent],fact:"routing:described",en:`The routing description of ${l.agent} has only ${p} characters`,pt:`A descri\xE7\xE3o de roteamento de ${l.agent} tem s\xF3 ${p} caracteres`})}for(let l of e.flows.filter(p=>p.called&&!p.returns))t.push({key:"flow",agents:[l.agent],fact:"flow-returns",en:`The flow \xAB${l.name}\xBB of ${l.agent} returns nothing`,pt:`O fluxo \xAB${l.name}\xBB de ${l.agent} n\xE3o devolve nada`});let r=new Map;for(let l of e.telemetry.spellings)r.set(`${l.agent} ${l.form}`,l);for(let l of r.values())t.push({key:"spelling",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`${l.agent} logs \xAB${l.name}\xBB; the others, \xAB${ke(l.as,"en")}\xBB: the same event?`,pt:`${l.agent} registra \xAB${l.name}\xBB; os outros, \xAB${ke(l.as,"pt")}\xBB: \xE9 o mesmo evento?`});let i=e.telemetry.days;for(let l of e.telemetry.notFired)t.push({key:"telemetry",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`The event \xAB${l.name}\xBB of ${l.agent} did not fire in ${i} days`,pt:`O evento \xAB${l.name}\xBB de ${l.agent} n\xE3o disparou em ${i} dias`});for(let l of e.telemetry.silent)t.push({key:"telemetry",agents:[l],en:`${l} has no line in the telemetry: is it connected to Application Insights?`,pt:`${l} n\xE3o tem nenhuma linha na telemetria: est\xE1 ligado ao Application Insights?`});let o=l=>l.startsWith("type:")?e.typeNames[l.slice(5)]??l.slice(5):void 0,a=new Map;for(let l of e.offPattern){let p=e.roles[l.agent],d=`${l.key} ${p} ${l.scope} ${l.variant?"v":""}`,h=a.get(d)??{key:l.key,role:p,type:o(l.scope),variant:!!l.variant,agents:[]};h.agents.push(l.agent),a.set(d,h)}for(let l of a.values()){let p=l.agents.length,d=e.patterns.find(O=>O.key===l.key),h=d?.decision?.status==="accepted",y=O=>l.type?O==="pt"?`${p} ${ue(l.role,O,p)} de ${l.type}`:`${p} ${l.type} ${ue(l.role,O,p)}`:`${p} ${ue(l.role,O,p)}`,w=!!d?.official;if(l.variant){let O=E=>E==="pt"?`do bloco${w?" oficial":""} \xAB${n(l.key,E)}\xBB`:`of the${w?" official":""} block \xAB${n(l.key,E)}\xBB`;t.push({key:"off",agents:l.agents,fact:l.key,en:`${y("en")} ${p===1?"has":"have"} a variation ${O("en")} (${Ae(l.agents)}): align it?`,pt:`${y("pt")} ${p===1?"tem":"t\xEAm"} uma varia\xE7\xE3o ${O("pt")} (${Ae(l.agents)}): alinhar?`});continue}let v=O=>`${y(O)} ${is(l.key,O,p,e.names)} (${Ae(l.agents)})`;t.push({key:"off",agents:l.agents,fact:l.key,en:h?`${v("en")}, and the pattern was accepted: correct it?`:w?`${v("en")}: add it?`:`${v("en")}: on purpose?`,pt:h?`${v("pt")}, e o padr\xE3o foi aceito: corrigir?`:w?`${v("pt")}: incluir?`:`${v("pt")}: \xE9 intencional?`})}for(let l of e.gaps.filter(p=>p.rule.has)){let p=l.agents.filter(h=>!e.offPattern.some(y=>y.agent===h&&y.key===l.rule.has)).sort(),d=p.length;d&&t.push({key:"gap",agents:p,fact:l.rule.has,en:`Rule \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${ue(l.rule.role,"en",d)}`:""} ${d===1?"does":"do"} not meet it (${Ae(p)})`,pt:`Regra \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${ue(l.rule.role,"pt",d)}`:""} n\xE3o ${d===1?"cumpre":"cumprem"} (${Ae(p)})`})}for(let l of e.markerFindings)if(l.kind==="values"){let p=[...new Set(Object.values(l.byValue).flat())],d=p.length,h=Object.entries(l.byValue).sort(([w,v],[O,E])=>E.length-v.length||w.localeCompare(O)).map(([w,v])=>`${w} {in} ${v.length}`),y=Object.keys(l.byValue).length;t.push({key:"values",agents:p.sort(),fact:`text:${l.marker.id}`,en:`${d} ${ue(l.role,"en",d)} set \xAB${l.marker.name}\xBB in ${y} ways (${h.join("; ").replace(/\{in\}/g,"in")}): unify?`,pt:`${d} ${ue(l.role,"pt",d)} definem \xAB${l.marker.name}\xBB de ${y} jeitos (${h.join("; ").replace(/\{in\}/g,"em")}): unificar?`})}else t.push({key:"twice",agents:[l.agent],fact:`text:${l.marker.id}`,en:`${l.agent} sets \xAB${l.marker.name}\xBB ${l.values.length===2?"twice":`${l.values.length} times`} (${l.values.join("; ")}): which one holds?`,pt:`${l.agent} define \xAB${l.marker.name}\xBB ${l.values.length===2?"duas vezes":`${l.values.length} vezes`} (${l.values.join("; ")}): qual vale?`});let c=new Set(e.solos.filter(l=>/^(connector|mcp):/.test(l.key)).map(l=>`${l.agents[0]} ${l.key.slice(l.key.indexOf(":")+1)}`)),f=e.gaps.filter(l=>l.rule.not).flatMap(l=>l.agents.map(p=>({agent:p,keys:[...l.rule.when??[],l.rule.not]})));for(let l of e.solos){let p=l.agents[0],d=l.key.startsWith("connref:")?l.key.slice(8):l.key.startsWith("operation:")?l.key.slice(10).split("/")[0]:void 0;d&&c.has(`${p} ${d}`)||f.some(h=>h.agent===p&&h.keys.some(y=>De(l.key,y)))||t.push({key:"solo",agents:[p],fact:l.key,en:`Only ${p} has \xAB${n(l.key,"en")}\xBB: innovation or debt?`,pt:`S\xF3 ${p} tem \xAB${n(l.key,"pt")}\xBB: inova\xE7\xE3o ou d\xEDvida?`})}let m={topic:["the topic","o t\xF3pico"],action:["the tool","a ferramenta"],variable:["the variable","a vari\xE1vel"],flow:["the flow","o fluxo"],knowledge:["the knowledge source","a fonte de conhecimento"]};for(let l of e.unused){let[p,d]=m[l.what]??["",""],h=e.names[l.name]??l.name;if(l.how==="orphan"){let y=l.what==="variable"?["remove it?","remover?"]:["remove it or switch it on?","remover ou ligar?"],w=l.what==="variable"?["uses","usa"]:l.what==="action"?["can choose","pode escolher"]:["calls","chama"];t.push({key:"unused",agents:[l.agent],fact:l.key,en:`Nobody ${w[0]} ${p} \xAB${h}\xBB (${l.agent}): ${y[0]}`,pt:`Ningu\xE9m ${w[1]} ${d} \xAB${h}\xBB (${l.agent}): ${y[1]}`})}else if(l.what==="node")for(let y of[...new Set(l.sources.map(w=>w.file))])t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has a switched-off node in \xAB${xl(y)}\xBB (${l.name}): remove it?`,pt:`${l.agent} tem um n\xF3 desligado em \xAB${xl(y)}\xBB (${l.name}): remover?`});else t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has ${p||l.what} \xAB${h}\xBB switched off: remove it?`,pt:`${l.agent} tem ${d||l.what} \xAB${h}\xBB ${d.startsWith("a ")?"desligada":"desligado"}: remover?`})}for(let l of e.typeNotes){let p=e.typeNames[l.type]??l.type,d=l.agents.length;t.push({key:"type",agents:l.agents,en:`The type \xAB${p}\xBB has ${d} ${ue("specialist","en",d)} (${Ae(l.agents)}): nothing to compare in it`,pt:`O tipo \xAB${p}\xBB tem ${d} ${ue("specialist","pt",d)} (${Ae(l.agents)}): nada a comparar dentro dele`})}let u=new Map;for(let l of e.unknown)u.set(l.agent,[...u.get(l.agent)??[],l.file]);for(let[l,p]of u){let d=p.length;t.push({key:"unknown",agents:[l],en:`${l}: the analysis did not understand ${d} ${d===1?"file":"files"} (${Ae(p)})`,pt:`${l}: a an\xE1lise n\xE3o entendeu ${d} ${d===1?"arquivo":"arquivos"} (${Ae(p)})`})}for(let l of e.unmatched)t.push({key:"unmatched",agents:[],en:`The profile names \xAB${l}\xBB, which is not in the folder`,pt:`O perfil cita \xAB${l}\xBB, que n\xE3o est\xE1 na pasta`});return t.sort((l,p)=>El.indexOf(l.key)-El.indexOf(p.key))}function Vt(e){let t=r=>e.offPattern.some(i=>i.key===r.key||i.partOf===r.key),n=r=>r.share===1&&!r.decision&&!t(r),s=e.patterns.filter(r=>!r.partOf);return{look:s.filter(r=>!n(r)),everyone:s.filter(n)}}var Tl=new TextEncoder,li=e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,""),Jt=e=>e<26?String.fromCharCode(65+e):Jt(Math.floor(e/26)-1)+String.fromCharCode(65+e%26),Uh=e=>e.replace(/[:\\/?*[\]]/g," ").slice(0,31)||"Sheet";function Yh(e){let t=[{}],n=l=>JSON.stringify([l.bold??!1,l.fill??"",l.color??"",l.center??!1,l.wrap??!1]),s=new Map([[n({}),0]]);for(let l of e)for(let p of l.rows)for(let d of p){if(typeof d!="object")continue;let{v:h,...y}=d,w=n(y);s.has(w)||(s.set(w,t.length),t.push(y))}let r=new Map([["|",0]]),i=new Map([["",0]]),o=l=>{let p=`${l.bold?"b":""}|${l.color??""}`;return r.has(p)||r.set(p,r.size),r.get(p)},a=l=>l.fill?(i.has(l.fill)||i.set(l.fill,i.size+1),i.get(l.fill)):0,c=t.map(l=>{let p=l.center||l.wrap?`<alignment${l.center?' horizontal="center"':""}${l.wrap?' wrapText="1"':""} vertical="top"/>`:'<alignment vertical="top"/>';return`<xf numFmtId="0" fontId="${o(l)}" fillId="${a(l)}" borderId="${l.fill||l.bold?1:0}" xfId="0" applyFont="1" applyFill="1" applyBorder="1" applyAlignment="1">${p}</xf>`}),f=[...r.keys()].map(l=>{let[p,d]=l.split("|");return`<font>${p?"<b/>":""}<sz val="11"/>${d?`<color rgb="FF${d}"/>`:""}<name val="Calibri"/><family val="2"/></font>`}),m=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>',...[...i.keys()].filter(Boolean).map(l=>`<fill><patternFill patternType="solid"><fgColor rgb="FF${l}"/><bgColor indexed="64"/></patternFill></fill>`)];return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
145
145
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
146
146
|
<fonts count="${f.length}">${f.join("")}</fonts>
|
|
147
147
|
<fills count="${m.length}">${m.join("")}</fills>
|
|
@@ -149,13 +149,13 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
149
149
|
<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
|
|
150
150
|
<cellXfs count="${c.length}">${c.join("")}</cellXfs>
|
|
151
151
|
<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
|
|
152
|
-
</styleSheet>`,styleOf:l=>typeof l=="object"?s.get(n((({v:p,...d})=>d)(l)))??0:0}}function
|
|
152
|
+
</styleSheet>`,styleOf:l=>typeof l=="object"?s.get(n((({v:p,...d})=>d)(l)))??0:0}}function zh(e,t){let n=Math.max(e.columns.length,...e.rows.map(c=>c.length),1),s=e.rows.map((c,f)=>{let m=c.map((u,l)=>{let p=`${Jt(l)}${f+1}`,d=typeof u=="object"?u.v:u,h=t(u),y=h?` s="${h}"`:"";return d===""||d===void 0||d===null?h?`<c r="${p}"${y}/>`:"":typeof d=="number"?`<c r="${p}"${y}><v>${d}</v></c>`:`<c r="${p}"${y} t="inlineStr"><is><t xml:space="preserve">${li(String(d))}</t></is></c>`}).join("");return`<row r="${f+1}">${m}</row>`}),r=`${Jt(n-1)}${Math.max(1,e.rows.length)}`,i=e.header?'<pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft" activeCell="A2" sqref="A2"/>':"",o=e.columns.length?`<cols>${e.columns.map((c,f)=>`<col min="${f+1}" max="${f+1}" width="${c.width}" customWidth="1"/>`).join("")}</cols>`:"",a=e.header&&e.rows.length>1?`<autoFilter ref="A1:${Jt(Math.max(0,e.columns.length-1))}${e.rows.length}"/>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
153
153
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
154
|
-
<dimension ref="A1:${
|
|
155
|
-
</worksheet>`}function
|
|
154
|
+
<dimension ref="A1:${r}"/><sheetViews><sheetView workbookViewId="0">${i}</sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>${o}<sheetData>${s.join("")}</sheetData>${a}
|
|
155
|
+
</worksheet>`}function ql(e){let{xml:t,styleOf:n}=Yh(e),s=e.map(o=>Uh(o.name)),r=e.map((o,a)=>o.header&&o.rows.length>1?`<definedName name="_xlnm._FilterDatabase" localSheetId="${a}" hidden="1">'${li(s[a]).replace(/'/g,"''")}'!$A$1:$${Jt(Math.max(0,o.columns.length-1))}$${o.rows.length}</definedName>`:"").join(""),i=[["[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
156
156
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>${e.map((o,a)=>`<Override PartName="/xl/worksheets/sheet${a+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`],["_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
157
157
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`],["xl/workbook.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
158
|
-
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><bookViews><workbookView/></bookViews><sheets>${s.map((o,a)=>`<sheet name="${
|
|
159
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((o,a)=>`<Relationship Id="rId${a+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${a+1}.xml"/>`).join("")}<Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`],["xl/styles.xml",t],...e.map((o,a)=>[`xl/worksheets/sheet${a+1}.xml`,Uh(o,n)])];return Wh(r.map(([o,a])=>[o,xl.encode(a)]))}var Yh=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function zh(e){let t=4294967295;for(let n=0;n<e.length;n++)t=Yh[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}function Wh(e){let t=[],n=[],s=0;for(let[f,m]of e){let u=xl.encode(f),l=zh(m),p=new DataView(new ArrayBuffer(30));p.setUint32(0,67324752,!0),p.setUint16(4,20,!0),p.setUint16(6,2048,!0),p.setUint16(8,0,!0),p.setUint32(14,l,!0),p.setUint32(18,m.length,!0),p.setUint32(22,m.length,!0),p.setUint16(26,u.length,!0),t.push(new Uint8Array(p.buffer),u,m);let d=new DataView(new ArrayBuffer(46));d.setUint32(0,33639248,!0),d.setUint16(4,20,!0),d.setUint16(6,20,!0),d.setUint16(8,2048,!0),d.setUint32(16,l,!0),d.setUint32(20,m.length,!0),d.setUint32(24,m.length,!0),d.setUint16(28,u.length,!0),d.setUint32(42,s,!0),n.push(new Uint8Array(d.buffer),u),s+=30+u.length+m.length}let i=n.reduce((f,m)=>f+m.length,0),r=new DataView(new ArrayBuffer(22));r.setUint32(0,101010256,!0),r.setUint16(8,e.length,!0),r.setUint16(10,e.length,!0),r.setUint32(12,i,!0),r.setUint32(16,s,!0);let o=[...t,...n,new Uint8Array(r.buffer)],a=new Uint8Array(o.reduce((f,m)=>f+m.length,0)),c=0;for(let f of o)a.set(f,c),c+=f.length;return a}var Vh=e=>Cl(e),Jh={bold:!0,fill:"E8EEF7"},Gh={v:"\u25CF",fill:"DDF3E6",center:!0},Hh={v:"\xD7",fill:"FFD5CC",center:!0,bold:!0},Xh={v:"\u25D0",fill:"FFF3C4",center:!0},Qh={v:"\u2248",fill:"FFF6DC",center:!0,bold:!0},Tl=Object.keys(er);function Zh(e,t,n,s="en"){let i=cs[s],r=(k,$,I)=>({key:k,name:i[k],header:!0,columns:$.map(([B,Y])=>({title:B,width:Y})),rows:[$.map(([B])=>({v:B,...Jh})),...I]}),o=k=>i[e.roles[k]],a=k=>k.startsWith("type:")?`${i.type}:${e.typeNames[k.slice(5)]??k.slice(5)}`:i[k],c=k=>(e.types[k]??[]).map($=>e.typeNames[$]??$).join(" \xB7 "),f=k=>pe(k,s,e.names),m=[...e.agents].sort((k,$)=>k.role===$.role?k.id.localeCompare($.id):k.role==="orchestrator"?-1:1),u=[...new Set([...m.flatMap(k=>Object.keys(k.facts)),...e.patterns.map(k=>k.key)])].filter(k=>!k.endsWith("~variant")).sort((k,$)=>Tl.indexOf(zt(k))-Tl.indexOf(zt($))||k.localeCompare($)),l=new Set(e.offPattern.map(k=>`${k.agent} ${k.key}`)),p=k=>e.agents.filter($=>$.role===k).length,d={key:"summary",name:i.summary,header:!1,columns:[{title:"",width:28},{title:"",width:100}],rows:[[{v:e.name??i.title,bold:!0},""],[{v:i.privacy,color:"B42318"},""],[i.count.agents,e.agents.length],[i.count.orchestrators,p("orchestrator")],[i.count.specialists,p("specialist")],[i.count.patterns,e.patterns.length],[i.count.off,new Set(e.offPattern.map(k=>k.agent)).size],[i.count.gaps,e.gaps.length],[i.count.conflicts,e.conflicts.length],[i.count.solos,t.filter(k=>k.key==="solo").length],[i.count.unused,e.unused.length],["",""],[{v:t.length?i.look:i.nothing,bold:!0},""],...t.map(k=>["",{v:k[s],wrap:!0}])]},h=r("matrix",[[i.dimension,18],[i.fact,40],[i.key,34],...m.map(k=>[k.id,14])],u.map(k=>[er[zt(k)][s],f(k),k,...m.map($=>k in $.facts?k.startsWith("declared:")?Xh:Gh:`${k}~variant`in $.facts?Qh:l.has(`${$.id} ${k}`)?Hh:"")])),{look:y,everyone:w}=Vt(e),v=r("patterns",[[i.key,34],[i.fact,40],[i.scope,14],[i.role,14],[i.share,10],[i.have,50],[i.lack,40],[i.decision,12],[i.why,50]],[...y,...w].map(k=>{let $=e.offPattern.filter(I=>I.key===k.key).map(I=>I.agent);return[k.key,f(k.key),a(k.scope),i[k.role],`${Math.round(k.share*100)}%`,k.agents.join(", "),$.join(", "),k.decision?i[k.decision.status==="accepted"?"accept":"reject"]:"",k.decision?.why??""]})),O=r("off",[[i.agent,24],[i.role,14],[i.missing,44],[i.key,34],[i.scope,14],[i.accepted,14]],e.offPattern.map(k=>[k.agent,o(k.agent),f(k.key),k.key,a(k.scope),e.patterns.find($=>$.key===k.key)?.decision?.status==="accepted"?i.yes:""])),E=r("gaps",[[i.rule,16],[i.says,50],[i.role,14],[i.notMet,60]],e.gaps.map(k=>[k.rule.id,k.rule.says,k.rule.role?i[k.rule.role]:"",k.agents.join(", ")])),S=r("conflicts",[[i.agent,24],[i.fact,40],[i.key,34],[i.declared,20],[i.source,40],[i.inYaml,12]],e.conflicts.map(k=>[k.agent,f(k.key),k.key,k.declared,k.source,k.observed?i.yes:i.no])),C=r("agents",[[i.agent,24],[i.name,32],[i.role,14],[i.types,24],[i.facts,8],[i.off,44],[i.alone,44],[i.children,24],[i.unknown,12]],m.map(k=>[k.id,k.displayName??"",i[k.role],c(k.id),Object.keys(k.facts).length,e.offPattern.filter($=>$.agent===k.id).map($=>f($.key)).join("; "),e.solos.filter($=>$.agents[0]===k.id).map($=>f($.key)).join("; "),k.children.map($=>$.name).join(", "),e.unknown.filter($=>$.agent===k.id).length||""])),q=r("evidence",[[i.agent,30],[i.fact,40],[i.key,34],[i.file,50],[i.line,8]],m.flatMap(k=>[{who:k.id,facts:k.facts},...k.children.map($=>({who:`${k.id} \u203A ${$.name}`,facts:$.facts}))]).flatMap(({who:k,facts:$})=>Object.entries($).sort(([I],[B])=>I.localeCompare(B)).flatMap(([I,B])=>B.map(Y=>[k,f(I),I,Y.file,Y.line??""])))),x=r("declared",[[i.agent,24],[i.key,34],[i.value,40],[i.source,40]],n.declared.map(k=>[k.agent,k.key,k.value,k.source])),b=r("text",[[i.id,28],[i.label,36],[i.body,70],[i.have,50],[i.variant,40],[i.official,10]],e.blocks.map(k=>[k.id,k.official??k.label,{v:k.text,wrap:!0},Object.keys(k.holders).sort().join(", "),Object.entries(k.variants).sort(([$],[I])=>$.localeCompare(I)).map(([$,I])=>`${$} (${Math.round(I.similarity*100)}%)`).join(", "),k.official?i.yes:""])),T=r("routing",[[i.caller,24],[i.called,30],[i.history,10],[i.inputs,30],[i.routingText,70],[i.chars,10],[i.file,44]],e.contract.routes.map(k=>[k.caller,k.agent??`${k.name??k.calls} (${i.notInFolder})`,k.history?i.yes:i.no,k.inputs.join(", "),{v:k.description,wrap:!0},k.description.length,`${k.file}${k.line?`:${k.line}`:""}`])),R=e.telemetry.days,j=r("telemetry",[[i.agent,24],[i.written,30],[i.form,28],[i.fields,50],[i.file,44],...R?[[i.fired(R),16]]:[]],e.telemetry.events.map(k=>[k.agent,k.name,ke(k.as,s),k.fields?k.fields.join(", "):i.notRead,`${k.file}${k.line?`:${k.line}`:""}`,...R?[k.fired===void 0||e.telemetry.silent.includes(k.agent)?"\u2014":k.fired===0?{v:0,color:"B42318",bold:!0}:k.fired]:[]])),oe=r("unused",[[i.agent,24],[i.what,16],[i.name,30],[i.how,14],[i.file,50]],e.unused.flatMap(k=>k.sources.map($=>[k.agent,i.thing[k.what]??k.what,e.names[k.name]??k.name,i[k.how],`${$.file}${$.line?`:${$.line}`:""}`]))),Ee=[d,h,v,...e.blocks.length?[b]:[],...e.contract.routes.length?[T]:[],...e.telemetry.events.length?[j]:[],O,E,S,...e.unused.length?[oe]:[],C,q,x];return e.unknown.length&&Ee.push(r("unknown",[[i.agent,24],[i.file,50],[i.why,40],[i.kind,24]],e.unknown.map(k=>[k.agent,k.file,i.why_[k.why],k.kind??""]))),Ee}var ve=e=>String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase(),Gt=Object.values(cs),ql=(e,t)=>e.find(n=>Gt.some(s=>ve(s[t])===ve(n.name)));function Ml(e,...t){let n=t.map(s=>e?.rows[0]?.findIndex(i=>Gt.some(r=>ve(r[s])===ve(i)))??-1);return s=>n.map(i=>i<0?"":String(s[i]??"").trim())}var Ll=(e,t)=>t.find(([,n])=>Gt.some(s=>ve(s[n])===ve(e)))?.[0],Il=e=>e.slice(1).filter(t=>t.some(n=>String(n??"").trim())),Pl=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function em(e,t,n={}){let s=[],i=[],r=ql(t,"declared");if(r){let a=Ml(r,"agent","key","value","source"),c=[];Il(r.rows).forEach((u,l)=>{let[p,d,h,y]=a(u);!p||!d?i.push(`${r.name}, ${l+2}: \xAB${a(r.rows[0])[p?1:0]}\xBB ?`):c.push({agent:p,key:d,value:h,source:y})});let f=u=>`${u.agent} ${u.key}`,m=0;for(let u of c){let l=e.declared.find(p=>f(p)===f(u));l?Pl(l,u)||s.push({key:`d${++m}`,kind:"declared",op:"set",before:l,after:u}):s.push({key:`d${++m}`,kind:"declared",op:"add",after:u})}for(let u of e.declared)c.some(l=>f(l)===f(u))||s.push({key:`d${++m}`,kind:"declared",op:"remove",before:u})}let o=ql(t,"patterns");if(o){let a=Ml(o,"key","scope","decision","why"),c=0;for(let f of Il(o.rows)){let[m,u,l,p]=a(f);if(!m)continue;let d=e.decisions.find(O=>O.key===m);if(!l){d&&s.push({key:`p${++c}`,kind:"decision",op:"remove",before:d});continue}let h=Ll(l,[["accepted","accept"],["rejected","reject"]]),y=/^(tipo|type)\s*:\s*(.+)$/i.exec(u),w=y?Object.entries(n).find(([O,E])=>ve(E)===ve(y[2])||ve(O)===ve(y[2]))?.[0]:void 0,v=y?w?`type:${w}`:void 0:Ll(u,[["platform","platform"],["specialist","specialist"],["orchestrator","orchestrator"]]);if(!h)i.push(`${o.name}, ${m}: \xAB${l}\xBB \u2014 ${Gt.map(O=>`${O.accept}/${O.reject}`).join(", ")}`);else if(!v)i.push(`${o.name}, ${m}: \xAB${u}\xBB \u2014 ${Gt.map(O=>`${O.platform}/${O.specialist}/${O.orchestrator}`).join(", ")}`);else{let O={key:m,status:h,scope:v,why:p};d?Pl(d,O)||s.push({key:`p${++c}`,kind:"decision",op:"set",before:d,after:O}):s.push({key:`p${++c}`,kind:"decision",op:"add",after:O})}}}return{changes:s,problems:i}}function tm(e,t,n){let s={...e,declared:[...e.declared],decisions:[...e.decisions]};for(let i of t.filter(r=>n.includes(r.key)))if(i.kind==="declared"){let r=a=>`${a.agent} ${a.key}`,o=i.before?s.declared.findIndex(a=>r(a)===r(i.before)):-1;i.op==="add"?s.declared.push(i.after):i.op==="set"?s.declared[o]=i.after:s.declared.splice(o,1)}else{let r=i.before?s.decisions.findIndex(o=>o.key===i.before.key):-1;i.op==="add"?s.decisions.push(i.after):i.op==="set"?s.decisions[r]=i.after:s.decisions.splice(r,1)}return s}var Xt="#8C8578";var fs="#C8442C",Fl="#2E8F62";var Rl=e=>Math.round(e*10)/10,Ht=e=>[Rl(e[0]),Rl(e[1])],Ne=(e,t,n=22,s="start",i)=>({type:"text",at:Ht(e),text:t,size:n,anchor:s,...i?{style:{color:i}}:{}}),Dl=(e,t,n)=>({type:"line",from:Ht(e),to:Ht(t),...n?{style:n}:{}}),jl=(e,t,n)=>({type:"arrow",from:Ht(e),to:Ht(t),...n?{style:n}:{}});var nm=(e,t)=>e.length*t*.48;function us(e,t,n){let s=[],i="";for(let r of e.split(/\s+/).filter(Boolean)){let o=i?`${i} ${r}`:r;i&&nm(o,t)>n?(s.push(i),i=r):i=o}return i&&s.push(i),s.length?s:[""]}var ct=150,Qt=40,sm=24,_l=250,Bl="#7B4FC9",Kl=17,Ul=23,lr=5,cr=4,im=/^(auth|model|setting|topics|connref|operation):/,rm={en:{chapters:["The cast","What repeats","Who is off","What is missing","What to decide"],cast:(e,t)=>e?`${e} ${e===1?"orchestrator calls":"orchestrators call"} ${t} ${t===1?"specialist":"specialists"}.`:`${t} ${t===1?"specialist":"specialists"}, with no orchestrator.`,repeats:(e,t,n)=>e?`${e} patterns: ${t} of the platform, ${n} of the specialists.`:"Nothing repeats enough to be a pattern yet.",off:e=>e.length?`Off a pattern: ${e.join(", ")}.`:"Nobody is off a pattern.",missing:e=>e?`${e} ${e===1?"rule is":"rules are"} not met.`:"Every rule is met.",decide:e=>e?`${e} ${e===1?"thing":"things"} to decide.`:"Nothing left to decide.",unused:e=>`${e} ${e===1?"thing nobody uses or switched off":"things nobody uses or switched off"}: remove or switch on?`,pattern:e=>`A pattern? \xAB${e}\xBB`,platform:"platform",specialist:"specialists",more:e=>`and ${e} more on the map`,none:"nothing"},pt:{chapters:["O elenco","O que se repete","Quem est\xE1 fora","O que falta","O que decidir"],cast:(e,t)=>e?`${e} ${e===1?"orquestrador chama":"orquestradores chamam"} ${t} ${t===1?"especialista":"especialistas"}.`:`${t} ${t===1?"especialista":"especialistas"}, sem orquestrador.`,repeats:(e,t,n)=>e?`${e} padr\xF5es: ${t} da plataforma, ${n} dos especialistas.`:"Nada se repete o bastante para ser padr\xE3o ainda.",off:e=>e.length?`Fora do padr\xE3o: ${e.join(", ")}.`:"Ningu\xE9m est\xE1 fora do padr\xE3o.",missing:e=>e?`${e} ${e===1?"regra n\xE3o \xE9 cumprida":"regras n\xE3o s\xE3o cumpridas"}.`:"Todas as regras s\xE3o cumpridas.",decide:e=>e?`${e} ${e===1?"coisa":"coisas"} para decidir.`:"Nada em aberto para decidir.",unused:e=>`${e} ${e===1?"coisa sem uso ou desligada":"coisas sem uso ou desligadas"}: remover ou ligar?`,pattern:e=>`Padr\xE3o? \xAB${e}\xBB`,platform:"plataforma",specialist:"especialistas",more:e=>`e mais ${e} no mapa`,none:"nada"}};function om(e,t,n="en"){let s=rm[n],i=e.agents.filter($=>$.role==="orchestrator").sort(($,I)=>$.id.localeCompare(I.id)),r=Object.keys(e.typeNames),o=$=>{let I=(e.types[$]??[])[0];return I===void 0?r.length:r.indexOf(I)},a=e.agents.filter($=>$.role==="specialist").sort(($,I)=>o($.id)-o(I.id)||$.id.localeCompare(I.id)),c=r.length>0&&a.some($=>(e.types[$.id]??[]).length),f=c?390:340,m=Math.max(1,Math.ceil(a.length/sm)),u=Math.max(1,Math.ceil(a.length/m)),l=Math.max(1e3,Qt*2+Math.max(u,i.length)*ct),p=($,I)=>l/2+($-(I-1)/2)*ct,d=$=>ul($)?0:im.test($)?2:1,h=[{...Ne([Qt,52],e.name??s.chapters[0],30),chapter:s.chapters[0],say:`${e.name?`${e.name}: `:""}${s.cast(i.length,a.length)}`}],y=($,I,B)=>us($,15,ct-12).slice(0,2).forEach((Y,ae)=>h.push(Ne([I[0],I[1]+ae*18],Y,15,"middle",B))),w=170,v=new Map;i.forEach(($,I)=>{let B=p(I,i.length);v.set($.id,[B,w]),h.push({type:"prop",name:"robot",at:[B,w],size:70}),y($.id,[B,w+24],Xt)}),a.forEach(($,I)=>{let B=Math.floor(I/u),Y=Math.min(u,a.length-B*u),ae=[p(I%u,Y),f+B*_l];v.set($.id,ae),h.push({type:"prop",name:"robot",at:ae,size:64}),y($.id,[ae[0],ae[1]+24])});for(let $ of i){let I=v.get($.id);for(let B of a.filter(Y=>Y.schemaName&&`calls:${Y.schemaName}`in $.facts)){let Y=v.get(B.id);Y[1]===f&&h.push(jl([I[0],I[1]+44],[Y[0],Y[1]-(c?118:76)],{color:Xt}))}}if(c){let $=[];a.forEach(I=>{let B=(e.types[I.id]??[])[0],Y=B===void 0?n==="pt"?"sem tipo":"no type":e.typeNames[B]??B,[ae,g]=v.get(I.id),N=$[$.length-1];N&&N.name===Y&&N.y===g?N.xs.push(ae):$.push({name:Y,xs:[ae],y:g})});for(let I of $){let[B,Y]=[Math.min(...I.xs),Math.max(...I.xs)];h.push(Ne([(B+Y)/2,I.y-92],I.name,16,"middle",Bl),Dl([B-ct/2+14,I.y-84],[Y+ct/2-14,I.y-84],{color:Bl}))}}let O=f+(m-1)*_l+160,E=(l-Qt*2)/3,S=O,C=($,I,B,Y,ae)=>{let g=Qt+$*E;h.push({...Ne([g,O],I,22,"start",ae),chapter:I,say:B});let N=O+34,P=Y.slice(0,lr);Y.length>lr&&P.push(s.more(Y.length-lr)),P.length||P.push(s.none);for(let F of P){let W=us(F,Kl,E-30),H=W.length>cr?[...W.slice(0,cr-1),`${W[cr-1]}\u2026`]:W;H.forEach((ms,je)=>h.push(Ne([g+(je?14:0),N+je*Ul],`${je?"":"\xB7 "}${ms}`,Kl,"start",Xt))),N+=H.length*Ul+6}S=Math.max(S,N)},q=e.patterns.filter($=>!$.partOf).sort(($,I)=>d($.key)-d(I.key)||($.scope===I.scope?0:$.scope==="platform"?-1:1)||I.share-$.share||$.key.localeCompare(I.key)),x=$=>$==="platform"?s.platform:s.specialist;C(0,s.chapters[1],s.repeats(e.patterns.length,e.patterns.filter($=>$.scope==="platform").length,e.patterns.filter($=>$.scope!=="platform").length),q.map($=>`${pe($.key,n,e.names)} \xB7 ${x($.scope)}${$.share<1?` \xB7 ${Math.round($.share*100)}%`:""}`),Fl);let b=[...new Set(e.offPattern.map($=>$.agent))].sort();b.forEach(($,I)=>{let B=v.get($),Y=g=>g.variant?`${n==="pt"?"varia\xE7\xE3o de":"a variation of"} \xAB${pe(g.key,n,e.names)}\xBB`:rs(g.key,n,1,e.names),ae=e.offPattern.filter(g=>g.agent===$).sort((g,N)=>d(g.key)-d(N.key)).flatMap(g=>us(Y(g),13,ct-10)).slice(0,4);h.push({...Ne([B[0]+34,B[1]-50],"\xD7",30,"middle",fs),...I===0?{chapter:s.chapters[2],say:s.off(b)}:{}}),ae.forEach((g,N)=>h.push(Ne([B[0],B[1]+66+N*16],g,13,"middle",fs)))}),b.length||h.push({...Ne([l-Qt,92],s.off([]),16,"end",Xt),chapter:s.chapters[2],say:s.off([])});let T=e.gaps.flatMap($=>{let I=$.agents.filter(B=>!e.offPattern.some(Y=>Y.agent===B&&Y.key===$.rule.has)).length;return I?[n==="pt"?`\xAB${$.rule.says}\xBB: ${I}${$.rule.role?` ${ue($.rule.role,n,I)}`:""} n\xE3o ${I===1?"cumpre":"cumprem"}`:`\xAB${$.rule.says}\xBB: ${I}${$.rule.role?` ${ue($.rule.role,n,I)}`:""} ${I===1?"does":"do"} not meet it`]:[]});T.push(...t.filter($=>$.key==="telemetry").map($=>$[n]),...t.filter($=>$.key==="contract"||$.key==="flow").map($=>$[n]));let R=e.unknown.length;R&&T.push(n==="pt"?`${R} ${R===1?"arquivo n\xE3o entendido":"arquivos n\xE3o entendidos"}`:`${R} ${R===1?"file":"files"} not understood`),C(1,s.chapters[3],s.missing(t.filter($=>$.key==="gap").length),T,fs);let j=t.filter($=>$.key==="unused").length,{look:oe}=Vt(e),Ee=[...t.filter($=>$.key==="conflict"||$.key==="spelling"||$.key==="values"||$.key==="twice").map($=>$[n]),...j?[s.unused(j)]:[],...oe.filter($=>!$.decision).map($=>s.pattern(pe($.key,n,e.names))),...t.filter($=>$.key==="solo").map($=>$[n])];return C(2,s.chapters[4],s.decide(Ee.length),Ee),{id:(e.name??"cast").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"cast",title:e.name??s.chapters[0],width:l,height:Math.min(4e3,S+40),background:"plain",locale:n==="pt"?"pt-BR":"en-US",steps:h}}function am(e,t){let n=e.replace(/^/,""),s=n.slice(0,n.search(/\r?\n|$/)),i=m=>s.split('"').filter((u,l)=>l%2===0).join("").split(m).length,r=i(";")>i(",")?";":",",o=[],a=[],c="",f=!1;for(let m=0;m<n.length;m++){let u=n[m];f?u==='"'&&n[m+1]==='"'?c+=n[++m]:u==='"'?f=!1:c+=u:u==='"'?f=!0:u===r?(a.push(c),c=""):u===`
|
|
158
|
+
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><bookViews><workbookView/></bookViews><sheets>${s.map((o,a)=>`<sheet name="${li(o)}" sheetId="${a+1}" r:id="rId${a+1}"/>`).join("")}</sheets>${r?`<definedNames>${r}</definedNames>`:""}</workbook>`],["xl/_rels/workbook.xml.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
159
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((o,a)=>`<Relationship Id="rId${a+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${a+1}.xml"/>`).join("")}<Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`],["xl/styles.xml",t],...e.map((o,a)=>[`xl/worksheets/sheet${a+1}.xml`,zh(o,n)])];return Jh(i.map(([o,a])=>[o,Tl.encode(a)]))}var Wh=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function Vh(e){let t=4294967295;for(let n=0;n<e.length;n++)t=Wh[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}function Jh(e){let t=[],n=[],s=0;for(let[f,m]of e){let u=Tl.encode(f),l=Vh(m),p=new DataView(new ArrayBuffer(30));p.setUint32(0,67324752,!0),p.setUint16(4,20,!0),p.setUint16(6,2048,!0),p.setUint16(8,0,!0),p.setUint32(14,l,!0),p.setUint32(18,m.length,!0),p.setUint32(22,m.length,!0),p.setUint16(26,u.length,!0),t.push(new Uint8Array(p.buffer),u,m);let d=new DataView(new ArrayBuffer(46));d.setUint32(0,33639248,!0),d.setUint16(4,20,!0),d.setUint16(6,20,!0),d.setUint16(8,2048,!0),d.setUint32(16,l,!0),d.setUint32(20,m.length,!0),d.setUint32(24,m.length,!0),d.setUint16(28,u.length,!0),d.setUint32(42,s,!0),n.push(new Uint8Array(d.buffer),u),s+=30+u.length+m.length}let r=n.reduce((f,m)=>f+m.length,0),i=new DataView(new ArrayBuffer(22));i.setUint32(0,101010256,!0),i.setUint16(8,e.length,!0),i.setUint16(10,e.length,!0),i.setUint32(12,r,!0),i.setUint32(16,s,!0);let o=[...t,...n,new Uint8Array(i.buffer)],a=new Uint8Array(o.reduce((f,m)=>f+m.length,0)),c=0;for(let f of o)a.set(f,c),c+=f.length;return a}var Gh=e=>ql(e),Hh={bold:!0,fill:"E8EEF7"},Xh={v:"\u25CF",fill:"DDF3E6",center:!0},Qh={v:"\xD7",fill:"FFD5CC",center:!0,bold:!0},Zh={v:"\u25D0",fill:"FFF3C4",center:!0},em={v:"\u2248",fill:"FFF6DC",center:!0,bold:!0},Ml=Object.keys(ei);function tm(e,t,n,s="en"){let r=cs[s],i=(k,$,P)=>({key:k,name:r[k],header:!0,columns:$.map(([B,Y])=>({title:B,width:Y})),rows:[$.map(([B])=>({v:B,...Hh})),...P]}),o=k=>r[e.roles[k]],a=k=>k.startsWith("type:")?`${r.type}:${e.typeNames[k.slice(5)]??k.slice(5)}`:r[k],c=k=>(e.types[k]??[]).map($=>e.typeNames[$]??$).join(" \xB7 "),f=k=>pe(k,s,e.names),m=[...e.agents].sort((k,$)=>k.role===$.role?k.id.localeCompare($.id):k.role==="orchestrator"?-1:1),u=[...new Set([...m.flatMap(k=>Object.keys(k.facts)),...e.patterns.map(k=>k.key)])].filter(k=>!k.endsWith("~variant")).sort((k,$)=>Ml.indexOf(zt(k))-Ml.indexOf(zt($))||k.localeCompare($)),l=new Set(e.offPattern.map(k=>`${k.agent} ${k.key}`)),p=k=>e.agents.filter($=>$.role===k).length,d={key:"summary",name:r.summary,header:!1,columns:[{title:"",width:28},{title:"",width:100}],rows:[[{v:e.name??r.title,bold:!0},""],[{v:r.privacy,color:"B42318"},""],[r.count.agents,e.agents.length],[r.count.orchestrators,p("orchestrator")],[r.count.specialists,p("specialist")],[r.count.patterns,e.patterns.length],[r.count.off,new Set(e.offPattern.map(k=>k.agent)).size],[r.count.gaps,e.gaps.length],[r.count.conflicts,e.conflicts.length],[r.count.solos,t.filter(k=>k.key==="solo").length],[r.count.unused,e.unused.length],["",""],[{v:t.length?r.look:r.nothing,bold:!0},""],...ai(t).flatMap(k=>[[{v:`${k[s]} \xB7 ${k.looks.length}`,bold:!0},""],...k.looks.map(({look:$})=>["",{v:$[s],wrap:!0}])])]},h=i("matrix",[[r.dimension,18],[r.fact,40],[r.key,34],...m.map(k=>[k.id,14])],u.map(k=>[ei[zt(k)][s],f(k),k,...m.map($=>k in $.facts?k.startsWith("declared:")?Zh:Xh:`${k}~variant`in $.facts?em:l.has(`${$.id} ${k}`)?Qh:"")])),{look:y,everyone:w}=Vt(e),v=i("patterns",[[r.key,34],[r.fact,40],[r.scope,14],[r.role,14],[r.share,10],[r.have,50],[r.lack,40],[r.decision,12],[r.why,50]],[...y,...w].map(k=>{let $=e.offPattern.filter(P=>P.key===k.key).map(P=>P.agent);return[k.key,f(k.key),a(k.scope),r[k.role],`${Math.round(k.share*100)}%`,k.agents.join(", "),$.join(", "),k.decision?r[k.decision.status==="accepted"?"accept":"reject"]:"",k.decision?.why??""]})),O=i("off",[[r.agent,24],[r.role,14],[r.missing,44],[r.key,34],[r.scope,14],[r.accepted,14]],e.offPattern.map(k=>[k.agent,o(k.agent),f(k.key),k.key,a(k.scope),e.patterns.find($=>$.key===k.key)?.decision?.status==="accepted"?r.yes:""])),E=i("gaps",[[r.rule,16],[r.says,50],[r.role,14],[r.notMet,60]],e.gaps.map(k=>[k.rule.id,k.rule.says,k.rule.role?r[k.rule.role]:"",k.agents.join(", ")])),S=i("conflicts",[[r.agent,24],[r.fact,40],[r.key,34],[r.declared,20],[r.source,40],[r.inYaml,12]],e.conflicts.map(k=>[k.agent,f(k.key),k.key,k.declared,k.source,k.observed?r.yes:r.no])),C=i("agents",[[r.agent,24],[r.name,32],[r.role,14],[r.types,24],[r.facts,8],[r.off,44],[r.alone,44],[r.children,24],[r.unknown,12]],m.map(k=>[k.id,k.displayName??"",r[k.role],c(k.id),Object.keys(k.facts).length,e.offPattern.filter($=>$.agent===k.id).map($=>f($.key)).join("; "),e.solos.filter($=>$.agents[0]===k.id).map($=>f($.key)).join("; "),k.children.map($=>$.name).join(", "),e.unknown.filter($=>$.agent===k.id).length||""])),q=i("evidence",[[r.agent,30],[r.fact,40],[r.key,34],[r.file,50],[r.line,8]],m.flatMap(k=>[{who:k.id,facts:k.facts},...k.children.map($=>({who:`${k.id} \u203A ${$.name}`,facts:$.facts}))]).flatMap(({who:k,facts:$})=>Object.entries($).sort(([P],[B])=>P.localeCompare(B)).flatMap(([P,B])=>B.map(Y=>[k,f(P),P,Y.file,Y.line??""])))),x=i("declared",[[r.agent,24],[r.key,34],[r.value,40],[r.source,40]],n.declared.map(k=>[k.agent,k.key,k.value,k.source])),b=i("text",[[r.id,28],[r.label,36],[r.body,70],[r.have,50],[r.variant,40],[r.official,10]],e.blocks.map(k=>[k.id,k.official??k.label,{v:k.text,wrap:!0},Object.keys(k.holders).sort().join(", "),Object.entries(k.variants).sort(([$],[P])=>$.localeCompare(P)).map(([$,P])=>`${$} (${Math.round(P.similarity*100)}%)`).join(", "),k.official?r.yes:""])),T=i("routing",[[r.caller,24],[r.called,30],[r.history,10],[r.inputs,30],[r.routingText,70],[r.chars,10],[r.file,44]],e.contract.routes.map(k=>[k.caller,k.agent??`${k.name??k.calls} (${r.notInFolder})`,k.history?r.yes:r.no,k.inputs.join(", "),{v:k.description,wrap:!0},k.description.length,`${k.file}${k.line?`:${k.line}`:""}`])),R=e.telemetry.days,j=i("telemetry",[[r.agent,24],[r.written,30],[r.form,28],[r.fields,50],[r.file,44],...R?[[r.fired(R),16]]:[]],e.telemetry.events.map(k=>[k.agent,k.name,ke(k.as,s),k.fields?k.fields.join(", "):r.notRead,`${k.file}${k.line?`:${k.line}`:""}`,...R?[k.fired===void 0||e.telemetry.silent.includes(k.agent)?"\u2014":k.fired===0?{v:0,color:"B42318",bold:!0}:k.fired]:[]])),oe=i("unused",[[r.agent,24],[r.what,16],[r.name,30],[r.how,14],[r.file,50]],e.unused.flatMap(k=>k.sources.map($=>[k.agent,r.thing[k.what]??k.what,e.names[k.name]??k.name,r[k.how],`${$.file}${$.line?`:${$.line}`:""}`]))),Ee=[d,h,v,...e.blocks.length?[b]:[],...e.contract.routes.length?[T]:[],...e.telemetry.events.length?[j]:[],O,E,S,...e.unused.length?[oe]:[],C,q,x];return e.unknown.length&&Ee.push(i("unknown",[[r.agent,24],[r.file,50],[r.why,40],[r.kind,24]],e.unknown.map(k=>[k.agent,k.file,r.why_[k.why],k.kind??""]))),Ee}var ve=e=>String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase(),Gt=Object.values(cs),Ll=(e,t)=>e.find(n=>Gt.some(s=>ve(s[t])===ve(n.name)));function Pl(e,...t){let n=t.map(s=>e?.rows[0]?.findIndex(r=>Gt.some(i=>ve(i[s])===ve(r)))??-1);return s=>n.map(r=>r<0?"":String(s[r]??"").trim())}var Il=(e,t)=>t.find(([,n])=>Gt.some(s=>ve(s[n])===ve(e)))?.[0],Rl=e=>e.slice(1).filter(t=>t.some(n=>String(n??"").trim())),Fl=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function nm(e,t,n={}){let s=[],r=[],i=Ll(t,"declared");if(i){let a=Pl(i,"agent","key","value","source"),c=[];Rl(i.rows).forEach((u,l)=>{let[p,d,h,y]=a(u);!p||!d?r.push(`${i.name}, ${l+2}: \xAB${a(i.rows[0])[p?1:0]}\xBB ?`):c.push({agent:p,key:d,value:h,source:y})});let f=u=>`${u.agent} ${u.key}`,m=0;for(let u of c){let l=e.declared.find(p=>f(p)===f(u));l?Fl(l,u)||s.push({key:`d${++m}`,kind:"declared",op:"set",before:l,after:u}):s.push({key:`d${++m}`,kind:"declared",op:"add",after:u})}for(let u of e.declared)c.some(l=>f(l)===f(u))||s.push({key:`d${++m}`,kind:"declared",op:"remove",before:u})}let o=Ll(t,"patterns");if(o){let a=Pl(o,"key","scope","decision","why"),c=0;for(let f of Rl(o.rows)){let[m,u,l,p]=a(f);if(!m)continue;let d=e.decisions.find(O=>O.key===m);if(!l){d&&s.push({key:`p${++c}`,kind:"decision",op:"remove",before:d});continue}let h=Il(l,[["accepted","accept"],["rejected","reject"]]),y=/^(tipo|type)\s*:\s*(.+)$/i.exec(u),w=y?Object.entries(n).find(([O,E])=>ve(E)===ve(y[2])||ve(O)===ve(y[2]))?.[0]:void 0,v=y?w?`type:${w}`:void 0:Il(u,[["platform","platform"],["specialist","specialist"],["orchestrator","orchestrator"]]);if(!h)r.push(`${o.name}, ${m}: \xAB${l}\xBB \u2014 ${Gt.map(O=>`${O.accept}/${O.reject}`).join(", ")}`);else if(!v)r.push(`${o.name}, ${m}: \xAB${u}\xBB \u2014 ${Gt.map(O=>`${O.platform}/${O.specialist}/${O.orchestrator}`).join(", ")}`);else{let O={key:m,status:h,scope:v,why:p};d?Fl(d,O)||s.push({key:`p${++c}`,kind:"decision",op:"set",before:d,after:O}):s.push({key:`p${++c}`,kind:"decision",op:"add",after:O})}}}return{changes:s,problems:r}}function sm(e,t,n){let s={...e,declared:[...e.declared],decisions:[...e.decisions]};for(let r of t.filter(i=>n.includes(i.key)))if(r.kind==="declared"){let i=a=>`${a.agent} ${a.key}`,o=r.before?s.declared.findIndex(a=>i(a)===i(r.before)):-1;r.op==="add"?s.declared.push(r.after):r.op==="set"?s.declared[o]=r.after:s.declared.splice(o,1)}else{let i=r.before?s.decisions.findIndex(o=>o.key===r.before.key):-1;r.op==="add"?s.decisions.push(r.after):r.op==="set"?s.decisions[i]=r.after:s.decisions.splice(i,1)}return s}var Xt="#8C8578";var fs="#C8442C",jl="#2E8F62";var Dl=e=>Math.round(e*10)/10,Ht=e=>[Dl(e[0]),Dl(e[1])],Ne=(e,t,n=22,s="start",r)=>({type:"text",at:Ht(e),text:t,size:n,anchor:s,...r?{style:{color:r}}:{}}),_l=(e,t,n)=>({type:"line",from:Ht(e),to:Ht(t),...n?{style:n}:{}}),Bl=(e,t,n)=>({type:"arrow",from:Ht(e),to:Ht(t),...n?{style:n}:{}});var rm=(e,t)=>e.length*t*.48;function us(e,t,n){let s=[],r="";for(let i of e.split(/\s+/).filter(Boolean)){let o=r?`${r} ${i}`:i;r&&rm(o,t)>n?(s.push(r),r=i):r=o}return r&&s.push(r),s.length?s:[""]}var ct=150,Qt=40,im=24,Kl=250,Ul="#7B4FC9",Yl=17,zl=23,ci=5,fi=4,om=/^(auth|model|setting|topics|connref|operation):/,am={en:{chapters:["The cast","What repeats","Who is off","What is missing","What to decide"],cast:(e,t)=>e?`${e} ${e===1?"orchestrator calls":"orchestrators call"} ${t} ${t===1?"specialist":"specialists"}.`:`${t} ${t===1?"specialist":"specialists"}, with no orchestrator.`,repeats:(e,t,n)=>e?`${e} patterns: ${t} of the platform, ${n} of the specialists.`:"Nothing repeats enough to be a pattern yet.",off:e=>e.length?`Off a pattern: ${e.join(", ")}.`:"Nobody is off a pattern.",missing:e=>e?`${e} ${e===1?"rule is":"rules are"} not met.`:"Every rule is met.",decide:e=>e?`${e} ${e===1?"thing":"things"} to decide.`:"Nothing left to decide.",unused:e=>`${e} ${e===1?"thing nobody uses or switched off":"things nobody uses or switched off"}: remove or switch on?`,pattern:e=>`A pattern? \xAB${e}\xBB`,platform:"platform",specialist:"specialists",more:e=>`and ${e} more on the map`,none:"nothing"},pt:{chapters:["O elenco","O que se repete","Quem est\xE1 fora","O que falta","O que decidir"],cast:(e,t)=>e?`${e} ${e===1?"orquestrador chama":"orquestradores chamam"} ${t} ${t===1?"especialista":"especialistas"}.`:`${t} ${t===1?"especialista":"especialistas"}, sem orquestrador.`,repeats:(e,t,n)=>e?`${e} padr\xF5es: ${t} da plataforma, ${n} dos especialistas.`:"Nada se repete o bastante para ser padr\xE3o ainda.",off:e=>e.length?`Fora do padr\xE3o: ${e.join(", ")}.`:"Ningu\xE9m est\xE1 fora do padr\xE3o.",missing:e=>e?`${e} ${e===1?"regra n\xE3o \xE9 cumprida":"regras n\xE3o s\xE3o cumpridas"}.`:"Todas as regras s\xE3o cumpridas.",decide:e=>e?`${e} ${e===1?"coisa":"coisas"} para decidir.`:"Nada em aberto para decidir.",unused:e=>`${e} ${e===1?"coisa sem uso ou desligada":"coisas sem uso ou desligadas"}: remover ou ligar?`,pattern:e=>`Padr\xE3o? \xAB${e}\xBB`,platform:"plataforma",specialist:"especialistas",more:e=>`e mais ${e} no mapa`,none:"nada"}};function lm(e,t,n="en"){let s=am[n],r=e.agents.filter($=>$.role==="orchestrator").sort(($,P)=>$.id.localeCompare(P.id)),i=Object.keys(e.typeNames),o=$=>{let P=(e.types[$]??[])[0];return P===void 0?i.length:i.indexOf(P)},a=e.agents.filter($=>$.role==="specialist").sort(($,P)=>o($.id)-o(P.id)||$.id.localeCompare(P.id)),c=i.length>0&&a.some($=>(e.types[$.id]??[]).length),f=c?390:340,m=Math.max(1,Math.ceil(a.length/im)),u=Math.max(1,Math.ceil(a.length/m)),l=Math.max(1e3,Qt*2+Math.max(u,r.length)*ct),p=($,P)=>l/2+($-(P-1)/2)*ct,d=$=>dl($)?0:om.test($)?2:1,h=[{...Ne([Qt,52],e.name??s.chapters[0],30),chapter:s.chapters[0],say:`${e.name?`${e.name}: `:""}${s.cast(r.length,a.length)}`}],y=($,P,B)=>us($,15,ct-12).slice(0,2).forEach((Y,ae)=>h.push(Ne([P[0],P[1]+ae*18],Y,15,"middle",B))),w=170,v=new Map;r.forEach(($,P)=>{let B=p(P,r.length);v.set($.id,[B,w]),h.push({type:"prop",name:"robot",at:[B,w],size:70}),y($.id,[B,w+24],Xt)}),a.forEach(($,P)=>{let B=Math.floor(P/u),Y=Math.min(u,a.length-B*u),ae=[p(P%u,Y),f+B*Kl];v.set($.id,ae),h.push({type:"prop",name:"robot",at:ae,size:64}),y($.id,[ae[0],ae[1]+24])});for(let $ of r){let P=v.get($.id);for(let B of a.filter(Y=>Y.schemaName&&`calls:${Y.schemaName}`in $.facts)){let Y=v.get(B.id);Y[1]===f&&h.push(Bl([P[0],P[1]+44],[Y[0],Y[1]-(c?118:76)],{color:Xt}))}}if(c){let $=[];a.forEach(P=>{let B=(e.types[P.id]??[])[0],Y=B===void 0?n==="pt"?"sem tipo":"no type":e.typeNames[B]??B,[ae,g]=v.get(P.id),N=$[$.length-1];N&&N.name===Y&&N.y===g?N.xs.push(ae):$.push({name:Y,xs:[ae],y:g})});for(let P of $){let[B,Y]=[Math.min(...P.xs),Math.max(...P.xs)];h.push(Ne([(B+Y)/2,P.y-92],P.name,16,"middle",Ul),_l([B-ct/2+14,P.y-84],[Y+ct/2-14,P.y-84],{color:Ul}))}}let O=f+(m-1)*Kl+160,E=(l-Qt*2)/3,S=O,C=($,P,B,Y,ae)=>{let g=Qt+$*E;h.push({...Ne([g,O],P,22,"start",ae),chapter:P,say:B});let N=O+34,I=Y.slice(0,ci);Y.length>ci&&I.push(s.more(Y.length-ci)),I.length||I.push(s.none);for(let F of I){let W=us(F,Yl,E-30),H=W.length>fi?[...W.slice(0,fi-1),`${W[fi-1]}\u2026`]:W;H.forEach((ms,je)=>h.push(Ne([g+(je?14:0),N+je*zl],`${je?"":"\xB7 "}${ms}`,Yl,"start",Xt))),N+=H.length*zl+6}S=Math.max(S,N)},q=e.patterns.filter($=>!$.partOf).sort(($,P)=>d($.key)-d(P.key)||($.scope===P.scope?0:$.scope==="platform"?-1:1)||P.share-$.share||$.key.localeCompare(P.key)),x=$=>$==="platform"?s.platform:s.specialist;C(0,s.chapters[1],s.repeats(e.patterns.length,e.patterns.filter($=>$.scope==="platform").length,e.patterns.filter($=>$.scope!=="platform").length),q.map($=>`${pe($.key,n,e.names)} \xB7 ${x($.scope)}${$.share<1?` \xB7 ${Math.round($.share*100)}%`:""}`),jl);let b=[...new Set(e.offPattern.map($=>$.agent))].sort();b.forEach(($,P)=>{let B=v.get($),Y=g=>g.variant?`${n==="pt"?"varia\xE7\xE3o de":"a variation of"} \xAB${pe(g.key,n,e.names)}\xBB`:is(g.key,n,1,e.names),ae=e.offPattern.filter(g=>g.agent===$).sort((g,N)=>d(g.key)-d(N.key)).flatMap(g=>us(Y(g),13,ct-10)).slice(0,4);h.push({...Ne([B[0]+34,B[1]-50],"\xD7",30,"middle",fs),...P===0?{chapter:s.chapters[2],say:s.off(b)}:{}}),ae.forEach((g,N)=>h.push(Ne([B[0],B[1]+66+N*16],g,13,"middle",fs)))}),b.length||h.push({...Ne([l-Qt,92],s.off([]),16,"end",Xt),chapter:s.chapters[2],say:s.off([])});let T=e.gaps.flatMap($=>{let P=$.agents.filter(B=>!e.offPattern.some(Y=>Y.agent===B&&Y.key===$.rule.has)).length;return P?[n==="pt"?`\xAB${$.rule.says}\xBB: ${P}${$.rule.role?` ${ue($.rule.role,n,P)}`:""} n\xE3o ${P===1?"cumpre":"cumprem"}`:`\xAB${$.rule.says}\xBB: ${P}${$.rule.role?` ${ue($.rule.role,n,P)}`:""} ${P===1?"does":"do"} not meet it`]:[]});T.push(...t.filter($=>$.key==="telemetry").map($=>$[n]),...t.filter($=>$.key==="contract"||$.key==="flow").map($=>$[n]));let R=e.unknown.length;R&&T.push(n==="pt"?`${R} ${R===1?"arquivo n\xE3o entendido":"arquivos n\xE3o entendidos"}`:`${R} ${R===1?"file":"files"} not understood`),C(1,s.chapters[3],s.missing(t.filter($=>$.key==="gap").length),T,fs);let j=t.filter($=>$.key==="unused").length,{look:oe}=Vt(e),Ee=[...t.filter($=>$.key==="conflict"||$.key==="spelling"||$.key==="values"||$.key==="twice").map($=>$[n]),...j?[s.unused(j)]:[],...oe.filter($=>!$.decision).map($=>s.pattern(pe($.key,n,e.names))),...t.filter($=>$.key==="solo").map($=>$[n])];return C(2,s.chapters[4],s.decide(Ee.length),Ee),{id:(e.name??"cast").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"cast",title:e.name??s.chapters[0],width:l,height:Math.min(4e3,S+40),background:"plain",locale:n==="pt"?"pt-BR":"en-US",steps:h}}function cm(e,t){let n=e.replace(/^/,""),s=n.slice(0,n.search(/\r?\n|$/)),r=m=>s.split('"').filter((u,l)=>l%2===0).join("").split(m).length,i=r(";")>r(",")?";":",",o=[],a=[],c="",f=!1;for(let m=0;m<n.length;m++){let u=n[m];f?u==='"'&&n[m+1]==='"'?c+=n[++m]:u==='"'?f=!1:c+=u:u==='"'?f=!0:u===i?(a.push(c),c=""):u===`
|
|
160
160
|
`||u==="\r"?(u==="\r"&&n[m+1]===`
|
|
161
|
-
`&&m++,a.push(c),o.push(a),a=[],c=""):c+=u}return(c||a.length)&&o.push([...a,c]),{name:t,rows:o}}function Yl(e){let t=new Map;for(let n of e)for(let s of[n.schemaName,n.id,n.displayName])s&&ee(s)&&t.set(ee(s),n.id);return n=>t.get(ee(n))}function zl(e,t,n,s){let i=e.rows[0]??[];if(s){let f=i.findIndex(m=>ee(m)===ee(s));return f>=0?{at:f}:{problem:"header",titles:i}}let r=i.map((f,m)=>new Set(e.rows.slice(1).map(u=>t(u[m]??"")).filter(Boolean)).size),o=Math.max(0,...r),a=r.flatMap((f,m)=>f===o?[m]:[]);if(o<Math.min(2,n))return{problem:"none",titles:i};let c=e.rows.slice(1).every(f=>new Set(a.map(m=>t(f[m]??"")).filter(Boolean)).size<=1);return a.length>1&&!c?{problem:"tie",titles:a.map(f=>i[f])}:{at:a[0]}}var lm={dono:"owner",responsavel:"owner",proprietario:"owner","owner-name":"owner",indicador:"kpi",kpis:"kpi"},fr=e=>{let t=e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return lm[t]??t},cm=new Set(["itemtype","tipodoitem","tipo","type"]),fm=new Set(["agent","agente","agents","agentes","copilotstudioagent","microsoftcopilotstudio/agents"]);function um(e,t,n,s){let i=Yl(t),r=zl(e,i,t.length,s.agentColumn);if(!("at"in r))return{changes:[],unmatched:[],problem:r};let o=e.rows[0],a=o.findIndex(p=>cm.has(ee(p))),c=p=>`${s.file}${e.name?` \u203A ${e.name}`:""} \u203A ${s.lang==="pt"?"linha":"line"} ${p}`,f=new Map,m=[];e.rows.slice(1).forEach((p,d)=>{if(!p.some(w=>w.trim())||a>=0&&p[a]?.trim()&&!fm.has(ee(p[a])))return;let h=(p[r.at]??"").trim(),y=i(h);if(!y)return m.push({line:d+2,value:h});o.forEach((w,v)=>{let O=(p[v]??"").trim();v===r.at||v===a||!O||!fr(w)||i(O)===y||f.set(`${y} ${fr(w)}`,{agent:y,key:fr(w),value:O,source:c(d+2)})})});let u=[],l=0;for(let p of f.values()){let d=n.declared.find(h=>h.agent===p.agent&&h.key===p.key);d?(d.value!==p.value||d.source!==p.source)&&u.push({key:`d${++l}`,kind:"declared",op:"set",before:d,after:p}):u.push({key:`d${++l}`,kind:"declared",op:"add",after:p})}return{changes:u,unmatched:m}}function dm(e){let t=new Map;for(let n of e)n.kind==="declared"&&n.after&&t.set(`${n.after.agent} ${n.after.key}`,n);return[...t.values()].map((n,s)=>({...n,key:`d${s+1}`}))}var pm=new Set(["evento","event","eventname","name","nome"]),hm=new Set(["vezes","count","contagem","times","total"]);function mm(e,t,n){let s=Yl(t),i=zl(e,s,t.length,n.agentColumn);if(!("at"in i))return{problem:i};let r=e.rows[0],o=r.findIndex((f,m)=>m!==i.at&&pm.has(ee(f)));if(o<0)return{problem:{problem:"event",titles:r}};let a=r.findIndex(f=>hm.has(ee(f))),c=[];return e.rows.slice(1).forEach((f,m)=>{let u=s(f[i.at]??""),l=(f[o]??"").trim();if(!u||!l)return;let p=a>=0?Number((f[a]??"").replace(/[^\d]/g,""))||0:1;c.push({agent:u,event:l,count:p,line:m+2})}),{days:n.days,file:n.file,rows:c}}var Wl=["and","or","not"];var ur=["person","person-pointing","person-sitting","house","car","bus","coin","phone","document","server","bank","cloud","queue","desk","computer","clock","lock","money-arrow","tree","school","hospital","factory","truck","cart","safe","bulb","gear","database","robot","ship","container","warehouse","box","pallet","shop","shelf","field","cup","function","api-gateway","cache","cluster","board","book","pencil"],ds={pessoa:"person","pessoa-apontando":"person-pointing","pessoa-sentada":"person-sitting",casa:"house",carro:"car",onibus:"bus",moeda:"coin",celular:"phone",documento:"document",servidor:"server",banco:"bank",nuvem:"cloud",fila:"queue",mesa:"desk",computador:"computer",relogio:"clock",cadeado:"lock","seta-dinheiro":"money-arrow"},ps=e=>ur.includes(e)?e:typeof e=="string"&&Object.hasOwn(ds,e)?ds[e]:void 0;var Jl=e=>ps(e)!==void 0,A={skin:"#E8C6A5",shirt:"#A9BCC3",wood:"#D8C29C",gold:"#F2C94C",paper:"#FFFFFF",screen:"#DCE8F0",device:"#5B6B7C",roof:"#D9785F",wall:"#F3E3C3",car:"#7FA7C9",bus:"#E9C46A",green:"#7DBE8A",dark:"#4A4A4A",metal:"#C9D3DD",board:"#2F4F3F",chalk:"#F2EFE6"},L=(e,t,n,s,i,r)=>({kind:"polygon",points:[[e,t],[e+n,t],[e+n,t+s],[e,t+s]],fill:i,main:r}),D=(...e)=>({kind:"polyline",points:e});function Gl(e){return[{kind:"polygon",points:[[-.15,-.72],[.15,-.72],[.19,-.38],[-.19,-.38]],fill:A.shirt,main:!0},{kind:"circle",c:[0,-.87],r:.11,fill:A.skin},...e,D([-.08,-.38],[-.1,0]),D([.08,-.38],[.1,0])]}var Vl=Gl([D([-.15,-.7],[-.25,-.42]),D([.15,-.7],[.25,-.42])]);function gm(e,t,n){let s=([i,r])=>[n+i*t,r*t];return e.map(i=>i.kind==="circle"?{...i,c:s(i.c),r:i.r*t}:{...i,points:i.points.map(s)})}function ym(){let e=[[-.28,-.3,.18],[-.06,-.45,.25],[.2,-.4,.21],[.37,-.27,.13]],t=[];for(let n=0;n<=24;n++){let s=-.46+.96*n/24,i=e.filter(([r,,o])=>Math.abs(s-r)<=o).map(([r,o,a])=>o-Math.sqrt(Math.max(0,a*a-(s-r)**2)));i.length&&t.push([s,Math.min(...i)])}return[...t,[.42,-.12],[-.4,-.12]]}var Uy={person:Vl,"person-pointing":Gl([D([-.15,-.7],[-.25,-.42]),D([.15,-.69],[.47,-.73])]),"person-sitting":[D([-.3,-.8],[-.27,-.4]),D([-.32,-.4],[.2,-.4]),D([-.27,-.4],[-.27,0]),D([.16,-.4],[.16,0]),{kind:"polygon",points:[[-.22,-.77],[.04,-.77],[.06,-.44],[-.22,-.44]],fill:A.shirt,main:!0},{kind:"circle",c:[-.08,-.9],r:.1,fill:A.skin},D([-.1,-.44],[.3,-.44],[.32,0]),D([0,-.74],[.18,-.55],[.3,-.58])],house:[L(-.4,-.6,.8,.6,A.wall,!0),{kind:"polygon",points:[[-.5,-.58],[0,-1],[.5,-.58]],fill:A.roof},L(-.08,-.32,.16,.32,A.wood),L(.16,-.46,.16,.14,A.screen)],car:[{kind:"polygon",fill:A.car,main:!0,points:[[-.5,-.14],[-.5,-.32],[-.3,-.36],[-.18,-.56],[.2,-.56],[.32,-.36],[.5,-.32],[.5,-.14]]},{kind:"polygon",points:[[-.14,-.51],[.17,-.51],[.25,-.37],[-.22,-.37]],fill:A.screen},{kind:"circle",c:[-.28,-.12],r:.1,fill:A.dark},{kind:"circle",c:[.28,-.12],r:.1,fill:A.dark}],bus:[L(-.5,-.66,1,.52,A.bus,!0),...[-.42,-.21,0,.21].map(e=>L(e,-.6,.15,.16,A.screen)),D([-.5,-.3],[.5,-.3]),{kind:"circle",c:[-.3,-.12],r:.1,fill:A.dark},{kind:"circle",c:[.3,-.12],r:.1,fill:A.dark}],coin:[{kind:"circle",c:[0,-.42],r:.4,fill:A.gold,main:!0},{kind:"circle",c:[0,-.42],r:.3},{kind:"curve",points:[[.1,-.56],[-.08,-.57],[-.09,-.46],[.08,-.39],[.08,-.29],[-.11,-.28]]},D([0,-.64],[0,-.2])],phone:[L(-.26,-1,.52,1,A.device,!0),L(-.2,-.92,.4,.76,A.screen),{kind:"circle",c:[0,-.08],r:.035,fill:A.paper}],document:[{kind:"polygon",points:[[-.36,-1],[.16,-1],[.36,-.8],[.36,0],[-.36,0]],fill:A.paper,main:!0},D([.16,-1],[.16,-.8],[.36,-.8]),...[-.66,-.5,-.34,-.18].map(e=>D([-.22,e],[.22,e]))],server:[-1,-.66,-.32].flatMap(e=>[L(-.36,e,.72,.3,A.metal,!0),D([-.26,e+.15],[.06,e+.15]),{kind:"circle",c:[.22,e+.15],r:.035,fill:A.green}]),bank:[{kind:"polygon",points:[[-.5,-.74],[0,-1],[.5,-.74]],fill:A.wall,main:!0},L(-.45,-.74,.9,.08,A.wall),...[-.33,-.11,.11,.33].map(e=>L(e-.04,-.66,.08,.56,A.paper)),L(-.5,-.1,1,.1,A.wall)],cloud:[{kind:"polygon",points:ym(),fill:A.paper,main:!0}],queue:[-.32,0,.32].flatMap(e=>gm(Vl,.7,e)),desk:[L(-.5,-.5,1,.07,A.wood,!0),D([-.42,-.43],[-.42,0]),D([.42,-.43],[.42,0])],computer:[L(-.45,-1,.9,.6,A.device,!0),L(-.39,-.94,.78,.48,A.screen),{kind:"polygon",points:[[-.06,-.4],[.06,-.4],[.1,-.1],[-.1,-.1]],fill:A.device},L(-.25,-.1,.5,.08,A.device)],clock:[{kind:"circle",c:[0,-.48],r:.45,fill:A.paper,main:!0},...[[0,-.9,0,-.82],[.42,-.48,.34,-.48],[0,-.06,0,-.14],[-.42,-.48,-.34,-.48]].map(([e,t,n,s])=>D([e,t],[n,s])),D([0,-.48],[0,-.78]),D([0,-.48],[.2,-.48])],lock:[{kind:"curve",points:[[-.22,-.52],[-.22,-.76],[0,-.96],[.22,-.76],[.22,-.52]]},L(-.36,-.54,.72,.54,A.bus,!0),{kind:"circle",c:[0,-.32],r:.06,fill:A.dark},D([0,-.28],[0,-.14])],"money-arrow":[{kind:"polygon",fill:A.green,main:!0,points:[[-.5,-.4],[.12,-.4],[.12,-.56],[.5,-.3],[.12,-.04],[.12,-.2],[-.5,-.2]]},{kind:"circle",c:[-.2,-.3],r:.16,fill:A.gold},D([-.2,-.4],[-.2,-.2])],tree:[L(-.07,-.36,.14,.36,A.wood),{kind:"circle",c:[0,-.64],r:.3,fill:A.green,main:!0}],school:[L(-.45,-.6,.9,.6,A.wall,!0),{kind:"polygon",points:[[-.5,-.6],[0,-.82],[.5,-.6]],fill:A.roof},L(-.08,-.28,.16,.28,A.wood),L(-.36,-.48,.16,.12,A.screen),L(.2,-.48,.16,.12,A.screen),D([0,-.82],[0,-1]),{kind:"polygon",points:[[0,-1],[.17,-.95],[0,-.9]],fill:A.roof}],hospital:[L(-.4,-.8,.8,.8,A.paper,!0),L(-.045,-.7,.09,.26,"#C8442C"),L(-.13,-.615,.26,.09,"#C8442C"),L(-.1,-.24,.2,.24,A.metal)],factory:[{kind:"polygon",points:[[-.5,0],[-.5,-.5],[-.25,-.65],[-.25,-.5],[0,-.65],[0,-.5],[.25,-.65],[.25,-.5],[.5,-.5],[.5,0]],fill:A.wall,main:!0},L(.3,-.95,.12,.3,A.dark),L(-.38,-.32,.16,.12,A.screen),L(-.08,-.32,.16,.12,A.screen),L(.22,-.32,.16,.12,A.screen)],truck:[L(-.5,-.62,.62,.46,A.metal,!0),{kind:"polygon",points:[[.12,-.16],[.12,-.5],[.34,-.5],[.48,-.32],[.48,-.16]],fill:A.bus},{kind:"polygon",points:[[.18,-.46],[.32,-.46],[.42,-.33],[.18,-.33]],fill:A.screen},{kind:"circle",c:[-.3,-.1],r:.1,fill:A.dark},{kind:"circle",c:[.3,-.1],r:.1,fill:A.dark}],cart:[D([-.48,-.78],[-.4,-.62]),{kind:"polygon",points:[[-.4,-.62],[.42,-.62],[.32,-.26],[-.3,-.26]],fill:A.metal,main:!0},D([-.3,-.26],[-.3,-.14],[.32,-.14]),{kind:"circle",c:[-.22,-.07],r:.06,fill:A.dark},{kind:"circle",c:[.24,-.07],r:.06,fill:A.dark}],safe:[L(-.4,-.82,.8,.82,A.device,!0),L(-.3,-.72,.6,.62,A.metal),{kind:"circle",c:[0,-.41],r:.13,fill:A.paper},D([0,-.41],[.08,-.47])],bulb:[{kind:"circle",c:[0,-.62],r:.3,fill:A.gold,main:!0},L(-.13,-.33,.26,.2,A.metal),{kind:"curve",points:[[-.09,-.52],[0,-.66],[.09,-.52]]},D([-.08,-.08],[.08,-.08])],gear:[{kind:"polygon",points:[[.42,-.5],[.296,-.378],[.297,-.203],[.122,-.204],[0,-.08],[-.122,-.204],[-.297,-.203],[-.296,-.378],[-.42,-.5],[-.296,-.622],[-.297,-.797],[-.122,-.796],[-0,-.92],[.122,-.796],[.297,-.797],[.296,-.622]],fill:A.metal,main:!0},{kind:"circle",c:[0,-.5],r:.12,fill:A.paper}],database:[{kind:"polygon",points:[[-.35,-.8],[.35,-.8],[.35,-.16],[-.35,-.16]],fill:A.screen,main:!0},{kind:"polygon",points:[[.35,-.8],[.303,-.755],[.175,-.722],[0,-.71],[-.175,-.722],[-.303,-.755],[-.35,-.8],[-.303,-.845],[-.175,-.878],[-0,-.89],[.175,-.878],[.303,-.845]],fill:A.metal},{kind:"curve",points:[[-.35,-.16],[0,-.06],[.35,-.16]]},{kind:"curve",points:[[-.35,-.58],[0,-.48],[.35,-.58]]},{kind:"curve",points:[[-.35,-.37],[0,-.27],[.35,-.37]]}],robot:[D([0,-.95],[0,-1]),L(-.22,-.95,.44,.3,A.metal),{kind:"circle",c:[-.09,-.81],r:.045,fill:A.screen},{kind:"circle",c:[.09,-.81],r:.045,fill:A.screen},L(-.28,-.62,.56,.42,A.metal,!0),D([-.28,-.55],[-.42,-.35]),D([.28,-.55],[.42,-.35]),L(-.2,-.2,.12,.2,A.device),L(.08,-.2,.12,.2,A.device)],ship:[{kind:"polygon",points:[[-.48,-.3],[.48,-.3],[.36,-.04],[-.4,-.04]],fill:A.car,main:!0},L(-.42,-.62,.14,.32,A.wall),L(-.24,-.5,.2,.2,A.roof),L(-.02,-.5,.2,.2,A.bus),L(.2,-.5,.2,.2,A.green),{kind:"curve",points:[[-.5,0],[-.3,-.04],[-.1,0],[.1,-.04],[.3,0],[.5,-.04]]}],container:[L(-.46,-.52,.92,.52,A.roof,!0),...[-.3,-.15,0,.15,.3].map(e=>D([e,-.48],[e,-.04]))],warehouse:[{kind:"polygon",points:[[-.46,0],[.46,0],[.46,-.55],[0,-.82],[-.46,-.55]],fill:A.wall,main:!0},L(-.2,-.38,.4,.38,A.metal),D([-.2,-.26],[.2,-.26]),D([-.2,-.13],[.2,-.13])],box:[L(-.36,-.5,.52,.5,A.wood,!0),{kind:"polygon",points:[[-.36,-.5],[.16,-.5],[.36,-.64],[-.16,-.64]],fill:A.wood},{kind:"polygon",points:[[.16,0],[.36,-.14],[.36,-.64],[.16,-.5]],fill:A.wood},D([-.1,-.5],[.1,-.64])],pallet:[L(-.46,-.12,.92,.06,A.wood),...[-.42,-.05,.32].map(e=>L(e,-.06,.1,.06,A.wood)),L(-.42,-.5,.4,.38,A.wood,!0),L(.02,-.5,.4,.38,A.wood),L(-.2,-.82,.4,.32,A.wood)],shop:[L(-.42,-.6,.84,.6,A.wall,!0),{kind:"polygon",points:[[-.48,-.6],[.48,-.6],[.42,-.78],[-.42,-.78]],fill:A.roof},L(-.34,-.48,.34,.26,A.screen),L(.08,-.42,.24,.42,A.wood)],shelf:[L(-.4,-.92,.8,.92,A.paper,!0),D([-.4,-.62],[.4,-.62]),D([-.4,-.32],[.4,-.32]),L(-.32,-.8,.16,.18,A.roof),L(-.1,-.78,.14,.16,A.bus),L(.1,-.5,.22,.18,A.green),L(-.3,-.2,.24,.2,A.wood)],field:[D([-.48,0],[.48,0]),...[-.3,0,.3].flatMap(e=>[{kind:"curve",points:[[e,0],[e-.02,-.25],[e,-.5]]},{kind:"circle",c:[e-.08,-.32],r:.07,fill:A.green,main:!0},{kind:"circle",c:[e+.08,-.42],r:.07,fill:A.green,main:!0},{kind:"circle",c:[e,-.52],r:.06,fill:A.roof}])],cup:[{kind:"polygon",points:[[-.26,-.52],[.26,-.52],[.2,-.1],[-.2,-.1]],fill:A.paper,main:!0},{kind:"curve",points:[[.24,-.44],[.4,-.38],[.22,-.2]]},{kind:"polygon",points:[[-.46,-.1],[.46,-.1],[.36,0],[-.36,0]],fill:A.paper},{kind:"curve",points:[[-.08,-.62],[-.02,-.72],[-.08,-.84]]},{kind:"curve",points:[[.08,-.62],[.14,-.72],[.08,-.84]]}],function:[L(-.38,-.72,.76,.62,A.screen,!0),D([-.14,-.62],[0,-.62],[.14,-.2]),D([.02,-.42],[-.14,-.2])],"api-gateway":[L(-.12,-.8,.24,.8,A.metal,!0),D([-.48,-.55],[-.16,-.55]),D([-.24,-.62],[-.16,-.55],[-.24,-.48]),D([.16,-.3],[.48,-.3]),D([.4,-.37],[.48,-.3],[.4,-.23])],cache:[L(-.34,-.66,.68,.66,A.metal,!0),{kind:"polygon",points:[[.04,-.58],[-.12,-.3],[0,-.3],[-.06,-.08],[.14,-.38],[.02,-.38]],fill:A.gold}],cluster:[{kind:"curve",points:[[-.4,-.8],[0,-.86],[.4,-.8],[.48,-.45],[.4,-.1],[0,-.04],[-.4,-.1],[-.48,-.45],[-.4,-.8]]},L(-.3,-.7,.24,.2,A.screen,!0),L(.06,-.7,.24,.2,A.screen,!0),L(-.12,-.38,.24,.2,A.screen,!0)],board:[L(-.48,-.9,.96,.6,A.board,!0),L(-.34,-.76,.42,.03,A.chalk),L(-.34,-.62,.58,.03,A.chalk),L(-.34,-.48,.3,.03,A.chalk),D([-.3,-.3],[-.36,0]),D([.3,-.3],[.36,0])],book:[{kind:"polygon",points:[[0,-.62],[-.46,-.7],[-.46,-.1],[0,-.04]],fill:A.paper,main:!0},{kind:"polygon",points:[[0,-.62],[.46,-.7],[.46,-.1],[0,-.04]],fill:A.paper,main:!0},D([-.36,-.52],[-.1,-.48]),D([-.36,-.38],[-.1,-.34]),D([.1,-.48],[.36,-.52]),D([.1,-.34],[.36,-.38])],pencil:[{kind:"polygon",points:[[-.38,-.12],[.22,-.72],[.34,-.6],[-.26,0]],fill:A.bus,main:!0},{kind:"polygon",points:[[.22,-.72],[.34,-.6],[.44,-.86]],fill:A.wood},{kind:"polygon",points:[[-.38,-.12],[-.26,0],[-.46,-.02]],fill:A.roof}]},Hl=["happy","sad","surprised","worried","idea"],bm={person:[0,-.87,.11],"person-pointing":[0,-.87,.11],"person-sitting":[-.08,-.9,.1]},Xl=e=>{let t=ps(e);return!!t&&t in bm};var Ql=["spin","drive","steam","talk","pulse","float"],wm=["lesson","pitch","arch","decision","data","timeline","story"],Zl=8,ec=6,tc=2e5,nc=6e5,sc=24;var rc=["card","line","arrow","polyline","polygon","curve","circle","ellipse","plot","text","highlight","pause","prop","repeat","when","move","link","counter","row","column","grid","axis","timeline","balloon","brace","note","table","bars","chain","animate","lottie"],ft=["text","prop","card","counter","circle","ellipse"],ic=["row","column","grid","chain"],km=50;function X(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: expected an object.`)}function V(e,t){if(typeof e!="string"||!e.trim()||e.length>2e3)throw new Error(`${t}: expected text of 1 to 2000 characters.`)}function K(e,t,n=-1e4,s=1e4){if(typeof e!="number"||!Number.isFinite(e)||e<n||e>s)throw new Error(`${t}: expected a number between ${n} and ${s}.`)}function ie(e,t){if(typeof e=="string"){if(V(e,t),e.length>300)throw new Error(`${t}: expression too long.`)}else K(e,t)}function se(e,t){if(!Array.isArray(e)||e.length!==2)throw new Error(`${t}: expected [x, y].`);e.forEach((n,s)=>ie(n,`${t}[${s}]`))}function he(e,t){e!==void 0&&V(e,t)}function re(e,t,n){if(e!==void 0&&(typeof e!="string"||!t.includes(e)))throw new Error(`${n}: choose one of ${t.join(", ")}.`)}function hs(e){if(!/^[A-Za-z_][A-Za-z_0-9]*$/.test(e)||["__proto__","constructor","prototype",...Wl].includes(e))throw new Error(`Invalid variable name: "${e}".`)}var ut=(e,t)=>t.includes("{")||e.exact.has(t)||[...e.repeated].some(n=>t.startsWith(`${n}-`)&&/^\d+$/.test(t.slice(n.length+1)));function Ve(e,t,n,s){s&&e[t]===void 0&&(e[t]=[0,0]),se(e[t],`${n}.${t}`)}function Zt(e,t,n,s,i=!1){if(X(e,t),++n.count>500)throw new Error(`${t}: a recipe draws at most 500 steps, counting those inside repeat and when.`);if(s){for(let a of["chapter","say","duration"])if(e[a]!==void 0)throw new Error(`${t}.${a}: put it on the ${s} step itself, not on a step inside it.`);if(e.type==="pause")throw new Error(`${t}: a pause cannot go inside ${s}.`);if(e.type==="repeat"&&s==="repeat")throw new Error(`${t}: a repeat cannot go inside another repeat.`);if(ic.includes(s)&&e.place!==void 0)throw new Error(`${t}.place: the ${s} places the steps inside it.`)}if(!rc.includes(e.type))throw new Error(`${t}: unknown type "${e.type}".`);for(let a of["id","say","chapter"])he(e[a],`${t}.${a}`);if(e.duration!==void 0&&K(e.duration,`${t}.duration`,0,3e4),e.nudge!==void 0){if(["pause","move","link","animate"].includes(e.type))throw new Error(`${t}.nudge: a ${e.type} has no place of its own to move.`);if(!Array.isArray(e.nudge)||e.nudge.length!==2)throw new Error(`${t}.nudge: use [dx, dy].`);e.nudge.forEach((a,c)=>K(a,`${t}.nudge[${c}]`,-900,900))}let r=s!==null&&ic.includes(s)||i;if(e.place!==void 0){if(!ft.includes(e.type))throw new Error(`${t}.place: only ${ft.join(", ")} can be placed.`);if(X(e.place,`${t}.place`),V(e.place.to,`${t}.place.to`),!ut(n,String(e.place.to)))throw new Error(`${t}.place.to: no earlier step has the id "${e.place.to}".`);if(!["below","above","left","right"].includes(e.place.side))throw new Error(`${t}.place.side: choose one of below, above, left, right.`);e.place.gap!==void 0&&K(e.place.gap,`${t}.place.gap`,-200,400),re(e.place.align,["center","start","end"],`${t}.place.align`)}let o=r||e.place!==void 0;if(e.style!==void 0){X(e.style,`${t}.style`);for(let a of["color","fill"]){let c=e.style[a];if(c!==void 0&&(typeof c!="string"||!/^(#[\da-f]{3,8}|[a-z]+)$/i.test(c)))throw new Error(`${t}.style.${a}: use a hex colour or a colour name, no URLs.`)}for(let a of["width","roughness","bowing"])e.style[a]!==void 0&&K(e.style[a],`${t}.style.${a}`,0,20);if(e.style.opacity!==void 0&&K(e.style.opacity,`${t}.style.opacity`,0,1),e.style.dashed!==void 0&&typeof e.style.dashed!="boolean")throw new Error(`${t}: dashed must be a boolean.`);re(e.style.fillStyle,["hachure","solid","zigzag","cross-hatch","dots"],`${t}.style.fillStyle`)}switch(e.type){case"line":case"arrow":case"highlight":se(e.from,`${t}.from`),se(e.to,`${t}.to`),e.thickness!==void 0&&K(e.thickness,`${t}.thickness`,1,200);break;case"polyline":case"polygon":case"curve":if(!Array.isArray(e.points)||e.points.length<(e.type==="polygon"?3:2)||e.points.length>500)throw new Error(`${t}: points needs ${e.type==="polygon"?3:2} to 500 points.`);e.points.forEach((a,c)=>se(a,`${t}.points[${c}]`));break;case"circle":case"ellipse":Ve(e,"center",t,o);for(let a of e.type==="circle"?["r"]:["rx","ry"])ie(e[a],`${t}.${a}`),typeof e[a]=="number"&&K(e[a],`${t}.${a}`,0);break;case"text":Ve(e,"at",t,o),V(e.text,`${t}.text`),e.size!==void 0&&K(e.size,`${t}.size`,1,200),e.rotate!==void 0&&K(e.rotate,`${t}.rotate`,-360,360),re(e.font,["hand","body"],`${t}.font`),re(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"card":Ve(e,"at",t,o),ie(e.w,`${t}.w`),ie(e.h,`${t}.h`);for(let a of["w","h"])typeof e[a]=="number"&&K(e[a],`${t}.${a}`,40);if(V(e.title,`${t}.title`),e.lines!==void 0){if(!Array.isArray(e.lines)||e.lines.length>6)throw new Error(`${t}: at most 6 lines per card.`);e.lines.forEach((a,c)=>V(a,`${t}.lines[${c}]`))}break;case"plot":V(e.fn,`${t}.fn`),e.var!==void 0&&(V(e.var,`${t}.var`),hs(String(e.var))),se(e.domain,`${t}.domain`),se(e.range,`${t}.range`),X(e.box,`${t}.box`);for(let a of["x","y","w","h"])ie(e.box[a],`${t}.box.${a}`);if(e.samples!==void 0&&(K(e.samples,`${t}.samples`,2,1e3),!Number.isInteger(e.samples)))throw new Error(`${t}: samples must be an integer.`);break;case"pause":K(e.ms,`${t}.ms`,0,3e4),he(e.ask,`${t}.ask`);break;case"prop":if(!Jl(e.name)&&!n.figures.has(String(e.name))){let a=n.figures.size?`, or one the recipe defines (${[...n.figures].join(", ")})`:"";throw new Error(`${t}.name: unknown prop "${String(e.name)}"; use one of ${ur.join(", ")}${a}.`)}if(Ve(e,"at",t,o),e.size!==void 0&&(ie(e.size,`${t}.size`),typeof e.size=="number"&&K(e.size,`${t}.size`,10,1e3)),he(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);if(e.mood!==void 0){if(!Xl(e.name))throw new Error(`${t}.mood: only a person (person, person-pointing, person-sitting) has a face.`);re(e.mood,Hl,`${t}.mood`)}break;case"repeat":if(ie(e.times,`${t}.times`),typeof e.times=="number"&&(K(e.times,`${t}.times`,0,km),!Number.isInteger(e.times)))throw new Error(`${t}.times: expected a whole number.`);Zt(e.step,`${t}.step`,n,"repeat",r);break;case"when":if(ie(e.if,`${t}.if`),!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>Zt(a,`${t}.steps[${c}]`,n,s??"when"));break;case"move":if(V(e.target,`${t}.target`),!ut(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);se(e.to,`${t}.to`),re(e.along,["line","curve"],`${t}.along`),e.ms!==void 0&&K(e.ms,`${t}.ms`,200,5e3);break;case"lottie":if(V(e.src,`${t}.src`),se(e.at,`${t}.at`),e.size!==void 0&&(ie(e.size,`${t}.size`),typeof e.size=="number"&&K(e.size,`${t}.size`,24,1e3)),e.loop!==void 0&&typeof e.loop!="boolean")throw new Error(`${t}.loop: expected true or false.`);break;case"animate":if(V(e.target,`${t}.target`),!ut(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);if(re(e.effect,[...Ql,"stop"],`${t}.effect`),e.effect===void 0)throw new Error(`${t}.effect: choose one of ${[...Ql,"stop"].join(", ")}.`);re(e.speed,["slow","fast"],`${t}.speed`);break;case"link":for(let a of["from","to"])if(V(e[a],`${t}.${a}`),!ut(n,String(e[a])))throw new Error(`${t}.${a}: no earlier step has the id "${e[a]}".`);he(e.label,`${t}.label`);break;case"counter":if(Ve(e,"at",t,o),ie(e.value,`${t}.value`),e.format!==void 0&&(V(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "R$ {v:0}".`);e.size!==void 0&&K(e.size,`${t}.size`,1,200),re(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"row":case"column":case"grid":if(r)throw new Error(`${t}: a ${e.type} cannot go inside another ${s}.`);if(Ve(e,"at",t,!1),e.gap!==void 0&&K(e.gap,`${t}.gap`,0,400),e.type==="grid"){if(K(e.columns,`${t}.columns`,1,12),!Number.isInteger(e.columns))throw new Error(`${t}.columns: expected a whole number.`)}else re(e.align,["center","start","end"],`${t}.align`);if(!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>{X(a,`${t}.steps[${c}]`);let f=a.type==="repeat"?a.step?.type:a.type;if(!ft.includes(f))throw new Error(`${t}.steps[${c}]: a ${e.type} holds only ${ft.join(", ")} (or a repeat of one).`);Zt(a,`${t}.steps[${c}]`,n,e.type)});break;case"chain":if(r)throw new Error(`${t}: a chain cannot go inside a ${s}.`);if(Ve(e,"at",t,!1),e.gap!==void 0&&e.gap!=="auto"&&K(e.gap,`${t}.gap`,0,400),re(e.direction,["right","down"],`${t}.direction`),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new Error(`${t}.wrap: expected true or false.`);if(he(e.forward,`${t}.forward`),he(e.back,`${t}.back`),e.size!==void 0&&(ie(e.size,`${t}.size`),typeof e.size=="number"&&K(e.size,`${t}.size`,10,1e3)),!Array.isArray(e.steps)||e.steps.length<2||e.steps.length>12)throw new Error(`${t}.steps: a chain joins 2 to 12 pieces.`);e.steps.forEach((a,c)=>{if(X(a,`${t}.steps[${c}]`),!ft.includes(a.type))throw new Error(`${t}.steps[${c}]: a chain holds only ${ft.join(", ")}.`);Zt(a,`${t}.steps[${c}]`,n,"chain")});break;case"axis":case"timeline":if(se(e.from,`${t}.from`),se(e.to,`${t}.to`),se(e.domain,`${t}.domain`),e.type==="axis"){if(e.ticks!==void 0){if(Array.isArray(e.ticks)){if(e.ticks.length>30)throw new Error(`${t}.ticks: at most 30 marks.`);e.ticks.forEach((a,c)=>K(a,`${t}.ticks[${c}]`))}else if(K(e.ticks,`${t}.ticks`,0,30),!Number.isInteger(e.ticks))throw new Error(`${t}.ticks: expected a whole number.`)}if(he(e.label,`${t}.label`),e.format!==void 0&&(V(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v} km".`)}else{if(!Array.isArray(e.marks)||e.marks.length===0||e.marks.length>20)throw new Error(`${t}.marks: expected 1 to 20 marks.`);e.marks.forEach((a,c)=>{X(a,`${t}.marks[${c}]`),ie(a.at,`${t}.marks[${c}].at`),he(a.label,`${t}.marks[${c}].label`),he(a.text,`${t}.marks[${c}].text`)})}break;case"balloon":if(V(e.to,`${t}.to`),!ut(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`);if(V(e.text,`${t}.text`),String(e.text).length>300)throw new Error(`${t}.text: keep a balloon under 300 characters.`);re(e.side,["below","above","left","right"],`${t}.side`),re(e.kind,["speech","thought"],`${t}.kind`),e.width!==void 0&&K(e.width,`${t}.width`,80,600),e.size!==void 0&&K(e.size,`${t}.size`,12,60);break;case"brace":if(se(e.from,`${t}.from`),se(e.to,`${t}.to`),he(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);break;case"note":if(se(e.at,`${t}.at`),V(e.text,`${t}.text`),e.to===void 0==(e.point===void 0))throw new Error(`${t}: a note points either to an element (to) or to a point (point).`);if(e.to!==void 0){if(V(e.to,`${t}.to`),!ut(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`)}else se(e.point,`${t}.point`);e.size!==void 0&&K(e.size,`${t}.size`,12,60);break;case"table":if(se(e.at,`${t}.at`),!Array.isArray(e.rows)||e.rows.length===0||e.rows.length>12)throw new Error(`${t}.rows: expected 1 to 12 rows.`);if(e.rows.forEach((a,c)=>{if(!Array.isArray(a)||a.length===0||a.length>6)throw new Error(`${t}.rows[${c}]: expected 1 to 6 cells.`);a.forEach((f,m)=>{if(typeof f!="string"||f.length>120)throw new Error(`${t}.rows[${c}][${m}]: expected text of up to 120 characters.`)})}),e.header!==void 0&&typeof e.header!="boolean")throw new Error(`${t}.header: expected true or false.`);e.size!==void 0&&K(e.size,`${t}.size`,12,40);break;case"bars":X(e.box,`${t}.box`);for(let a of["x","y","w","h"])ie(e.box[a],`${t}.box.${a}`);if(!Array.isArray(e.values)||e.values.length===0||e.values.length>12)throw new Error(`${t}.values: expected 1 to 12 values.`);if(e.values.forEach((a,c)=>ie(a,`${t}.values[${c}]`)),e.labels!==void 0){if(!Array.isArray(e.labels)||e.labels.length>e.values.length)throw new Error(`${t}.labels: at most one label per value.`);e.labels.forEach((a,c)=>V(a,`${t}.labels[${c}]`))}if(e.max!==void 0&&ie(e.max,`${t}.max`),e.format!==void 0&&(V(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v}%".`);break}typeof e.id=="string"&&(s==="repeat"?n.repeated:n.exact).add(e.id)}function $m(e,t){let n=`defs.${e}`;if(!/^[a-z][a-z0-9-]{1,30}$/.test(e))throw new Error(`${n}: a figure's name is 2 to 31 lowercase letters, digits or -, starting with a letter.`);if(ps(e)||Object.hasOwn(ds,e)||rc.includes(e)||["define","title","param","switch","var"].includes(e))throw new Error(`${n}: "${e}" is already a prop or a step; choose another name.`);if(X(t,n),!Array.isArray(t.shapes)||t.shapes.length===0||t.shapes.length>sc)throw new Error(`${n}.shapes: expected 1 to ${sc} shapes.`);let s=(i,r)=>{if(typeof i!="number"||!Number.isInteger(i)||i<0||i>100)throw new Error(`${r}: expected a whole number from 0 to 100 (the figure's grid, y down; it stands at 50,100).`)};t.shapes.forEach((i,r)=>{let o=`${n}.shapes[${r}]`;if(X(i,o),i.fill!==void 0&&(typeof i.fill!="string"||!/^(#[0-9a-fA-F]{3,8}|[a-z]{3,20})$/.test(i.fill)))throw new Error(`${o}.fill: a colour, as hex or a plain name.`);if(i.kind==="circle"){if(!Array.isArray(i.c)||i.c.length!==2)throw new Error(`${o}.c: expected [x, y].`);i.c.forEach((c,f)=>s(c,`${o}.c[${f}]`)),s(i.r,`${o}.r`);return}if(!["polygon","polyline","curve"].includes(i.kind))throw new Error(`${o}.kind: choose one of polygon, polyline, curve, circle.`);let a=i.kind==="polygon"?3:2;if(!Array.isArray(i.points)||i.points.length<a||i.points.length>40)throw new Error(`${o}.points: a ${i.kind} takes ${a} to 40 points.`);i.points.forEach((c,f)=>{if(!Array.isArray(c)||c.length!==2)throw new Error(`${o}.points[${f}]: expected [x, y].`);c.forEach((m,u)=>s(m,`${o}.points[${f}][${u}]`))})})}function vm(e,t){let n=`lottie "${e}"`;X(t,n);let s=JSON.stringify(t).length;if(s>tc)throw new Error(`${n}: ${Math.round(s/1e3)} KB; an animation can have at most ${tc/1e3} KB.`);for(let r of["fr","ip","op","w","h"])K(t[r],`${n}.${r}`,0,1e5);if(typeof t.v!="string"||!Array.isArray(t.layers))throw new Error(`${n}: not a Lottie animation (it needs v and layers).`);let i=(r,o)=>{if(Array.isArray(r))return r.forEach((a,c)=>i(a,`${o}[${c}]`));if(!(!r||typeof r!="object"))for(let[a,c]of Object.entries(r)){if(a==="x"&&typeof c=="string")throw new Error(`${n}: the animation has an expression (code inside it, at ${o}); only animations without expressions play.`);i(c,`${o}.${a}`)}};i(t.layers,"layers");for(let r of Array.isArray(t.assets)?t.assets:[]){let o=r?.p;if(typeof o=="string"&&o&&!o.startsWith("data:")&&!Array.isArray(r.layers))throw new Error(`${n}: an image from outside the animation ("${o.slice(0,40)}"); only images inside it (data:) are kept.`)}return s}function Sm(e){X(e,"The recipe");let t=e;K(t.width,"width",100,4e3),K(t.height,"height",100,4e3);for(let i of["id","title","category"])he(t[i],i);if(t.locale!==void 0&&!(typeof t.locale=="string"&&/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$/.test(t.locale)&&Intl.NumberFormat.supportedLocalesOf([t.locale]).length>0))throw new Error('locale: expected a language tag such as "en-US" or "pt-BR".');if(re(t.background,["dots","grid","plain"],"background"),re(t.kind,wm,"kind"),he(t.source,"source"),t.quiz!==void 0&&t.kind!==void 0&&t.kind!=="lesson")throw new Error(`quiz: only a lesson has a quiz (this drawing is a ${t.kind}).`);if(re(t.theme,["paper","chalkboard"],"theme"),t.quiz!==void 0){if(X(t.quiz,"quiz"),V(t.quiz.question,"quiz.question"),!Array.isArray(t.quiz.options)||t.quiz.options.length<2||t.quiz.options.length>4)throw new Error("quiz.options: expected 2 to 4 options.");if(t.quiz.options.forEach((i,r)=>{if(X(i,`quiz.options[${r}]`),V(i.text,`quiz.options[${r}].text`),V(i.why,`quiz.options[${r}].why`),typeof i.right!="boolean")throw new Error(`quiz.options[${r}].right: expected true or false.`)}),t.quiz.options.filter(i=>i.right===!0).length!==1)throw new Error("quiz.options: exactly one option is right.")}if(t.learning!==void 0){X(t.learning,"learning");for(let i of["goal","question","answer","caveat"])V(t.learning[i],`learning.${i}`)}if(t.params!==void 0){X(t.params,"params");for(let[i,r]of Object.entries(t.params))if(hs(i),X(r,`params.${i}`),V(r.label,`params.${i}.label`),K(r.min,`${i}.min`),K(r.max,`${i}.max`),K(r.step,`${i}.step`,1e-6),K(r.value,`${i}.value`,r.min,r.max),r.max<=r.min)throw new Error(`${i}: max must be greater than min.`)}if(t.vars!==void 0){X(t.vars,"vars");for(let[i,r]of Object.entries(t.vars))hs(i),ie(r,`vars.${i}`)}if(t.switches!==void 0){X(t.switches,"switches");let i=Object.entries(t.switches);if(i.length>8)throw new Error("switches: at most 8.");for(let[r,o]of i){if(hs(r),Object.hasOwn(t.params??{},r)||Object.hasOwn(t.vars??{},r))throw new Error(`switches.${r}: the name is already a param or a var.`);if(X(o,`switches.${r}`),V(o.label,`switches.${r}.label`),typeof o.on!="boolean")throw new Error(`switches.${r}.on: expected true or false.`)}}if(!Array.isArray(t.steps)||t.steps.length===0||t.steps.length>250)throw new Error("A recipe needs 1 to 250 steps.");let n=new Set;if(t.defs!==void 0){X(t.defs,"defs");let i=Object.entries(t.defs);if(i.length>Zl)throw new Error(`defs: at most ${Zl} figures.`);for(let[r,o]of i)$m(r,o),n.add(r)}if(t.lotties!==void 0){X(t.lotties,"lotties");let i=Object.entries(t.lotties);if(i.length>ec)throw new Error(`lotties: at most ${ec} animations.`);let r=i.reduce((o,[a,c])=>o+vm(a,c),0);if(r>nc)throw new Error(`lotties: ${Math.round(r/1e3)} KB in all; at most ${nc/1e3} KB.`)}if(t.credits!==void 0){if(!Array.isArray(t.credits)||t.credits.length>5)throw new Error("credits: at most 5 lines.");t.credits.forEach((i,r)=>V(i,`credits[${r}]`))}let s={exact:new Set,repeated:new Set,count:0,figures:n};return t.steps.forEach((i,r)=>Zt(i,`Step ${r+1}`,s,null)),{...t,id:t.id??"pasted",title:t.title??"",background:t.background??"dots"}}export{tr as DEFAULT_PROFILE,mr as agentsIn,tm as applyChanges,Dh as compare,um as declaredFrom,nh as extractAgent,mm as firedFrom,em as fromSheets,Vt as groupPatterns,sh as knownKinds,pe as labelOf,om as lessonOf,dm as mergeDeclared,vh as problemText,yh as readCast,am as readCsv,fh as readProfile,_h as reviewCast,Sm as validateScene,Vh as workbookFile,Zh as workbookOf,$h as writeCast};
|
|
161
|
+
`&&m++,a.push(c),o.push(a),a=[],c=""):c+=u}return(c||a.length)&&o.push([...a,c]),{name:t,rows:o}}function Wl(e){let t=new Map;for(let n of e)for(let s of[n.schemaName,n.id,n.displayName])s&&ee(s)&&t.set(ee(s),n.id);return n=>t.get(ee(n))}function Vl(e,t,n,s){let r=e.rows[0]??[];if(s){let f=r.findIndex(m=>ee(m)===ee(s));return f>=0?{at:f}:{problem:"header",titles:r}}let i=r.map((f,m)=>new Set(e.rows.slice(1).map(u=>t(u[m]??"")).filter(Boolean)).size),o=Math.max(0,...i),a=i.flatMap((f,m)=>f===o?[m]:[]);if(o<Math.min(2,n))return{problem:"none",titles:r};let c=e.rows.slice(1).every(f=>new Set(a.map(m=>t(f[m]??"")).filter(Boolean)).size<=1);return a.length>1&&!c?{problem:"tie",titles:a.map(f=>r[f])}:{at:a[0]}}var fm={dono:"owner",responsavel:"owner",proprietario:"owner","owner-name":"owner",indicador:"kpi",kpis:"kpi"},ui=e=>{let t=e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return fm[t]??t},um=new Set(["itemtype","tipodoitem","tipo","type"]),dm=new Set(["agent","agente","agents","agentes","copilotstudioagent","microsoftcopilotstudio/agents"]);function pm(e,t,n,s){let r=Wl(t),i=Vl(e,r,t.length,s.agentColumn);if(!("at"in i))return{changes:[],unmatched:[],problem:i};let o=e.rows[0],a=o.findIndex(p=>um.has(ee(p))),c=p=>`${s.file}${e.name?` \u203A ${e.name}`:""} \u203A ${s.lang==="pt"?"linha":"line"} ${p}`,f=new Map,m=[];e.rows.slice(1).forEach((p,d)=>{if(!p.some(w=>w.trim())||a>=0&&p[a]?.trim()&&!dm.has(ee(p[a])))return;let h=(p[i.at]??"").trim(),y=r(h);if(!y)return m.push({line:d+2,value:h});o.forEach((w,v)=>{let O=(p[v]??"").trim();v===i.at||v===a||!O||!ui(w)||r(O)===y||f.set(`${y} ${ui(w)}`,{agent:y,key:ui(w),value:O,source:c(d+2)})})});let u=[],l=0;for(let p of f.values()){let d=n.declared.find(h=>h.agent===p.agent&&h.key===p.key);d?(d.value!==p.value||d.source!==p.source)&&u.push({key:`d${++l}`,kind:"declared",op:"set",before:d,after:p}):u.push({key:`d${++l}`,kind:"declared",op:"add",after:p})}return{changes:u,unmatched:m}}function hm(e){let t=new Map;for(let n of e)n.kind==="declared"&&n.after&&t.set(`${n.after.agent} ${n.after.key}`,n);return[...t.values()].map((n,s)=>({...n,key:`d${s+1}`}))}var mm=new Set(["evento","event","eventname","name","nome"]),gm=new Set(["vezes","count","contagem","times","total"]);function ym(e,t,n){let s=Wl(t),r=Vl(e,s,t.length,n.agentColumn);if(!("at"in r))return{problem:r};let i=e.rows[0],o=i.findIndex((f,m)=>m!==r.at&&mm.has(ee(f)));if(o<0)return{problem:{problem:"event",titles:i}};let a=i.findIndex(f=>gm.has(ee(f))),c=[];return e.rows.slice(1).forEach((f,m)=>{let u=s(f[r.at]??""),l=(f[o]??"").trim();if(!u||!l)return;let p=a>=0?Number((f[a]??"").replace(/[^\d]/g,""))||0:1;c.push({agent:u,event:l,count:p,line:m+2})}),{days:n.days,file:n.file,rows:c}}var Jl=["and","or","not"];var di=["person","person-pointing","person-sitting","house","car","bus","coin","phone","document","server","bank","cloud","queue","desk","computer","clock","lock","money-arrow","tree","school","hospital","factory","truck","cart","safe","bulb","gear","database","robot","ship","container","warehouse","box","pallet","shop","shelf","field","cup","function","api-gateway","cache","cluster","board","book","pencil"],ds={pessoa:"person","pessoa-apontando":"person-pointing","pessoa-sentada":"person-sitting",casa:"house",carro:"car",onibus:"bus",moeda:"coin",celular:"phone",documento:"document",servidor:"server",banco:"bank",nuvem:"cloud",fila:"queue",mesa:"desk",computador:"computer",relogio:"clock",cadeado:"lock","seta-dinheiro":"money-arrow"},ps=e=>di.includes(e)?e:typeof e=="string"&&Object.hasOwn(ds,e)?ds[e]:void 0;var Hl=e=>ps(e)!==void 0,A={skin:"#E8C6A5",shirt:"#A9BCC3",wood:"#D8C29C",gold:"#F2C94C",paper:"#FFFFFF",screen:"#DCE8F0",device:"#5B6B7C",roof:"#D9785F",wall:"#F3E3C3",car:"#7FA7C9",bus:"#E9C46A",green:"#7DBE8A",dark:"#4A4A4A",metal:"#C9D3DD",board:"#2F4F3F",chalk:"#F2EFE6"},L=(e,t,n,s,r,i)=>({kind:"polygon",points:[[e,t],[e+n,t],[e+n,t+s],[e,t+s]],fill:r,main:i}),D=(...e)=>({kind:"polyline",points:e});function Xl(e){return[{kind:"polygon",points:[[-.15,-.72],[.15,-.72],[.19,-.38],[-.19,-.38]],fill:A.shirt,main:!0},{kind:"circle",c:[0,-.87],r:.11,fill:A.skin},...e,D([-.08,-.38],[-.1,0]),D([.08,-.38],[.1,0])]}var Gl=Xl([D([-.15,-.7],[-.25,-.42]),D([.15,-.7],[.25,-.42])]);function bm(e,t,n){let s=([r,i])=>[n+r*t,i*t];return e.map(r=>r.kind==="circle"?{...r,c:s(r.c),r:r.r*t}:{...r,points:r.points.map(s)})}function wm(){let e=[[-.28,-.3,.18],[-.06,-.45,.25],[.2,-.4,.21],[.37,-.27,.13]],t=[];for(let n=0;n<=24;n++){let s=-.46+.96*n/24,r=e.filter(([i,,o])=>Math.abs(s-i)<=o).map(([i,o,a])=>o-Math.sqrt(Math.max(0,a*a-(s-i)**2)));r.length&&t.push([s,Math.min(...r)])}return[...t,[.42,-.12],[-.4,-.12]]}var zy={person:Gl,"person-pointing":Xl([D([-.15,-.7],[-.25,-.42]),D([.15,-.69],[.47,-.73])]),"person-sitting":[D([-.3,-.8],[-.27,-.4]),D([-.32,-.4],[.2,-.4]),D([-.27,-.4],[-.27,0]),D([.16,-.4],[.16,0]),{kind:"polygon",points:[[-.22,-.77],[.04,-.77],[.06,-.44],[-.22,-.44]],fill:A.shirt,main:!0},{kind:"circle",c:[-.08,-.9],r:.1,fill:A.skin},D([-.1,-.44],[.3,-.44],[.32,0]),D([0,-.74],[.18,-.55],[.3,-.58])],house:[L(-.4,-.6,.8,.6,A.wall,!0),{kind:"polygon",points:[[-.5,-.58],[0,-1],[.5,-.58]],fill:A.roof},L(-.08,-.32,.16,.32,A.wood),L(.16,-.46,.16,.14,A.screen)],car:[{kind:"polygon",fill:A.car,main:!0,points:[[-.5,-.14],[-.5,-.32],[-.3,-.36],[-.18,-.56],[.2,-.56],[.32,-.36],[.5,-.32],[.5,-.14]]},{kind:"polygon",points:[[-.14,-.51],[.17,-.51],[.25,-.37],[-.22,-.37]],fill:A.screen},{kind:"circle",c:[-.28,-.12],r:.1,fill:A.dark},{kind:"circle",c:[.28,-.12],r:.1,fill:A.dark}],bus:[L(-.5,-.66,1,.52,A.bus,!0),...[-.42,-.21,0,.21].map(e=>L(e,-.6,.15,.16,A.screen)),D([-.5,-.3],[.5,-.3]),{kind:"circle",c:[-.3,-.12],r:.1,fill:A.dark},{kind:"circle",c:[.3,-.12],r:.1,fill:A.dark}],coin:[{kind:"circle",c:[0,-.42],r:.4,fill:A.gold,main:!0},{kind:"circle",c:[0,-.42],r:.3},{kind:"curve",points:[[.1,-.56],[-.08,-.57],[-.09,-.46],[.08,-.39],[.08,-.29],[-.11,-.28]]},D([0,-.64],[0,-.2])],phone:[L(-.26,-1,.52,1,A.device,!0),L(-.2,-.92,.4,.76,A.screen),{kind:"circle",c:[0,-.08],r:.035,fill:A.paper}],document:[{kind:"polygon",points:[[-.36,-1],[.16,-1],[.36,-.8],[.36,0],[-.36,0]],fill:A.paper,main:!0},D([.16,-1],[.16,-.8],[.36,-.8]),...[-.66,-.5,-.34,-.18].map(e=>D([-.22,e],[.22,e]))],server:[-1,-.66,-.32].flatMap(e=>[L(-.36,e,.72,.3,A.metal,!0),D([-.26,e+.15],[.06,e+.15]),{kind:"circle",c:[.22,e+.15],r:.035,fill:A.green}]),bank:[{kind:"polygon",points:[[-.5,-.74],[0,-1],[.5,-.74]],fill:A.wall,main:!0},L(-.45,-.74,.9,.08,A.wall),...[-.33,-.11,.11,.33].map(e=>L(e-.04,-.66,.08,.56,A.paper)),L(-.5,-.1,1,.1,A.wall)],cloud:[{kind:"polygon",points:wm(),fill:A.paper,main:!0}],queue:[-.32,0,.32].flatMap(e=>bm(Gl,.7,e)),desk:[L(-.5,-.5,1,.07,A.wood,!0),D([-.42,-.43],[-.42,0]),D([.42,-.43],[.42,0])],computer:[L(-.45,-1,.9,.6,A.device,!0),L(-.39,-.94,.78,.48,A.screen),{kind:"polygon",points:[[-.06,-.4],[.06,-.4],[.1,-.1],[-.1,-.1]],fill:A.device},L(-.25,-.1,.5,.08,A.device)],clock:[{kind:"circle",c:[0,-.48],r:.45,fill:A.paper,main:!0},...[[0,-.9,0,-.82],[.42,-.48,.34,-.48],[0,-.06,0,-.14],[-.42,-.48,-.34,-.48]].map(([e,t,n,s])=>D([e,t],[n,s])),D([0,-.48],[0,-.78]),D([0,-.48],[.2,-.48])],lock:[{kind:"curve",points:[[-.22,-.52],[-.22,-.76],[0,-.96],[.22,-.76],[.22,-.52]]},L(-.36,-.54,.72,.54,A.bus,!0),{kind:"circle",c:[0,-.32],r:.06,fill:A.dark},D([0,-.28],[0,-.14])],"money-arrow":[{kind:"polygon",fill:A.green,main:!0,points:[[-.5,-.4],[.12,-.4],[.12,-.56],[.5,-.3],[.12,-.04],[.12,-.2],[-.5,-.2]]},{kind:"circle",c:[-.2,-.3],r:.16,fill:A.gold},D([-.2,-.4],[-.2,-.2])],tree:[L(-.07,-.36,.14,.36,A.wood),{kind:"circle",c:[0,-.64],r:.3,fill:A.green,main:!0}],school:[L(-.45,-.6,.9,.6,A.wall,!0),{kind:"polygon",points:[[-.5,-.6],[0,-.82],[.5,-.6]],fill:A.roof},L(-.08,-.28,.16,.28,A.wood),L(-.36,-.48,.16,.12,A.screen),L(.2,-.48,.16,.12,A.screen),D([0,-.82],[0,-1]),{kind:"polygon",points:[[0,-1],[.17,-.95],[0,-.9]],fill:A.roof}],hospital:[L(-.4,-.8,.8,.8,A.paper,!0),L(-.045,-.7,.09,.26,"#C8442C"),L(-.13,-.615,.26,.09,"#C8442C"),L(-.1,-.24,.2,.24,A.metal)],factory:[{kind:"polygon",points:[[-.5,0],[-.5,-.5],[-.25,-.65],[-.25,-.5],[0,-.65],[0,-.5],[.25,-.65],[.25,-.5],[.5,-.5],[.5,0]],fill:A.wall,main:!0},L(.3,-.95,.12,.3,A.dark),L(-.38,-.32,.16,.12,A.screen),L(-.08,-.32,.16,.12,A.screen),L(.22,-.32,.16,.12,A.screen)],truck:[L(-.5,-.62,.62,.46,A.metal,!0),{kind:"polygon",points:[[.12,-.16],[.12,-.5],[.34,-.5],[.48,-.32],[.48,-.16]],fill:A.bus},{kind:"polygon",points:[[.18,-.46],[.32,-.46],[.42,-.33],[.18,-.33]],fill:A.screen},{kind:"circle",c:[-.3,-.1],r:.1,fill:A.dark},{kind:"circle",c:[.3,-.1],r:.1,fill:A.dark}],cart:[D([-.48,-.78],[-.4,-.62]),{kind:"polygon",points:[[-.4,-.62],[.42,-.62],[.32,-.26],[-.3,-.26]],fill:A.metal,main:!0},D([-.3,-.26],[-.3,-.14],[.32,-.14]),{kind:"circle",c:[-.22,-.07],r:.06,fill:A.dark},{kind:"circle",c:[.24,-.07],r:.06,fill:A.dark}],safe:[L(-.4,-.82,.8,.82,A.device,!0),L(-.3,-.72,.6,.62,A.metal),{kind:"circle",c:[0,-.41],r:.13,fill:A.paper},D([0,-.41],[.08,-.47])],bulb:[{kind:"circle",c:[0,-.62],r:.3,fill:A.gold,main:!0},L(-.13,-.33,.26,.2,A.metal),{kind:"curve",points:[[-.09,-.52],[0,-.66],[.09,-.52]]},D([-.08,-.08],[.08,-.08])],gear:[{kind:"polygon",points:[[.42,-.5],[.296,-.378],[.297,-.203],[.122,-.204],[0,-.08],[-.122,-.204],[-.297,-.203],[-.296,-.378],[-.42,-.5],[-.296,-.622],[-.297,-.797],[-.122,-.796],[-0,-.92],[.122,-.796],[.297,-.797],[.296,-.622]],fill:A.metal,main:!0},{kind:"circle",c:[0,-.5],r:.12,fill:A.paper}],database:[{kind:"polygon",points:[[-.35,-.8],[.35,-.8],[.35,-.16],[-.35,-.16]],fill:A.screen,main:!0},{kind:"polygon",points:[[.35,-.8],[.303,-.755],[.175,-.722],[0,-.71],[-.175,-.722],[-.303,-.755],[-.35,-.8],[-.303,-.845],[-.175,-.878],[-0,-.89],[.175,-.878],[.303,-.845]],fill:A.metal},{kind:"curve",points:[[-.35,-.16],[0,-.06],[.35,-.16]]},{kind:"curve",points:[[-.35,-.58],[0,-.48],[.35,-.58]]},{kind:"curve",points:[[-.35,-.37],[0,-.27],[.35,-.37]]}],robot:[D([0,-.95],[0,-1]),L(-.22,-.95,.44,.3,A.metal),{kind:"circle",c:[-.09,-.81],r:.045,fill:A.screen},{kind:"circle",c:[.09,-.81],r:.045,fill:A.screen},L(-.28,-.62,.56,.42,A.metal,!0),D([-.28,-.55],[-.42,-.35]),D([.28,-.55],[.42,-.35]),L(-.2,-.2,.12,.2,A.device),L(.08,-.2,.12,.2,A.device)],ship:[{kind:"polygon",points:[[-.48,-.3],[.48,-.3],[.36,-.04],[-.4,-.04]],fill:A.car,main:!0},L(-.42,-.62,.14,.32,A.wall),L(-.24,-.5,.2,.2,A.roof),L(-.02,-.5,.2,.2,A.bus),L(.2,-.5,.2,.2,A.green),{kind:"curve",points:[[-.5,0],[-.3,-.04],[-.1,0],[.1,-.04],[.3,0],[.5,-.04]]}],container:[L(-.46,-.52,.92,.52,A.roof,!0),...[-.3,-.15,0,.15,.3].map(e=>D([e,-.48],[e,-.04]))],warehouse:[{kind:"polygon",points:[[-.46,0],[.46,0],[.46,-.55],[0,-.82],[-.46,-.55]],fill:A.wall,main:!0},L(-.2,-.38,.4,.38,A.metal),D([-.2,-.26],[.2,-.26]),D([-.2,-.13],[.2,-.13])],box:[L(-.36,-.5,.52,.5,A.wood,!0),{kind:"polygon",points:[[-.36,-.5],[.16,-.5],[.36,-.64],[-.16,-.64]],fill:A.wood},{kind:"polygon",points:[[.16,0],[.36,-.14],[.36,-.64],[.16,-.5]],fill:A.wood},D([-.1,-.5],[.1,-.64])],pallet:[L(-.46,-.12,.92,.06,A.wood),...[-.42,-.05,.32].map(e=>L(e,-.06,.1,.06,A.wood)),L(-.42,-.5,.4,.38,A.wood,!0),L(.02,-.5,.4,.38,A.wood),L(-.2,-.82,.4,.32,A.wood)],shop:[L(-.42,-.6,.84,.6,A.wall,!0),{kind:"polygon",points:[[-.48,-.6],[.48,-.6],[.42,-.78],[-.42,-.78]],fill:A.roof},L(-.34,-.48,.34,.26,A.screen),L(.08,-.42,.24,.42,A.wood)],shelf:[L(-.4,-.92,.8,.92,A.paper,!0),D([-.4,-.62],[.4,-.62]),D([-.4,-.32],[.4,-.32]),L(-.32,-.8,.16,.18,A.roof),L(-.1,-.78,.14,.16,A.bus),L(.1,-.5,.22,.18,A.green),L(-.3,-.2,.24,.2,A.wood)],field:[D([-.48,0],[.48,0]),...[-.3,0,.3].flatMap(e=>[{kind:"curve",points:[[e,0],[e-.02,-.25],[e,-.5]]},{kind:"circle",c:[e-.08,-.32],r:.07,fill:A.green,main:!0},{kind:"circle",c:[e+.08,-.42],r:.07,fill:A.green,main:!0},{kind:"circle",c:[e,-.52],r:.06,fill:A.roof}])],cup:[{kind:"polygon",points:[[-.26,-.52],[.26,-.52],[.2,-.1],[-.2,-.1]],fill:A.paper,main:!0},{kind:"curve",points:[[.24,-.44],[.4,-.38],[.22,-.2]]},{kind:"polygon",points:[[-.46,-.1],[.46,-.1],[.36,0],[-.36,0]],fill:A.paper},{kind:"curve",points:[[-.08,-.62],[-.02,-.72],[-.08,-.84]]},{kind:"curve",points:[[.08,-.62],[.14,-.72],[.08,-.84]]}],function:[L(-.38,-.72,.76,.62,A.screen,!0),D([-.14,-.62],[0,-.62],[.14,-.2]),D([.02,-.42],[-.14,-.2])],"api-gateway":[L(-.12,-.8,.24,.8,A.metal,!0),D([-.48,-.55],[-.16,-.55]),D([-.24,-.62],[-.16,-.55],[-.24,-.48]),D([.16,-.3],[.48,-.3]),D([.4,-.37],[.48,-.3],[.4,-.23])],cache:[L(-.34,-.66,.68,.66,A.metal,!0),{kind:"polygon",points:[[.04,-.58],[-.12,-.3],[0,-.3],[-.06,-.08],[.14,-.38],[.02,-.38]],fill:A.gold}],cluster:[{kind:"curve",points:[[-.4,-.8],[0,-.86],[.4,-.8],[.48,-.45],[.4,-.1],[0,-.04],[-.4,-.1],[-.48,-.45],[-.4,-.8]]},L(-.3,-.7,.24,.2,A.screen,!0),L(.06,-.7,.24,.2,A.screen,!0),L(-.12,-.38,.24,.2,A.screen,!0)],board:[L(-.48,-.9,.96,.6,A.board,!0),L(-.34,-.76,.42,.03,A.chalk),L(-.34,-.62,.58,.03,A.chalk),L(-.34,-.48,.3,.03,A.chalk),D([-.3,-.3],[-.36,0]),D([.3,-.3],[.36,0])],book:[{kind:"polygon",points:[[0,-.62],[-.46,-.7],[-.46,-.1],[0,-.04]],fill:A.paper,main:!0},{kind:"polygon",points:[[0,-.62],[.46,-.7],[.46,-.1],[0,-.04]],fill:A.paper,main:!0},D([-.36,-.52],[-.1,-.48]),D([-.36,-.38],[-.1,-.34]),D([.1,-.48],[.36,-.52]),D([.1,-.34],[.36,-.38])],pencil:[{kind:"polygon",points:[[-.38,-.12],[.22,-.72],[.34,-.6],[-.26,0]],fill:A.bus,main:!0},{kind:"polygon",points:[[.22,-.72],[.34,-.6],[.44,-.86]],fill:A.wood},{kind:"polygon",points:[[-.38,-.12],[-.26,0],[-.46,-.02]],fill:A.roof}]},Ql=["happy","sad","surprised","worried","idea"],km={person:[0,-.87,.11],"person-pointing":[0,-.87,.11],"person-sitting":[-.08,-.9,.1]},Zl=e=>{let t=ps(e);return!!t&&t in km};var ec=["spin","drive","steam","talk","pulse","float"],$m=["lesson","pitch","arch","decision","data","timeline","story"],tc=8,nc=6,sc=2e5,rc=6e5,ic=24;var ac=["card","line","arrow","polyline","polygon","curve","circle","ellipse","plot","text","highlight","pause","prop","repeat","when","move","link","counter","row","column","grid","axis","timeline","balloon","brace","note","table","bars","chain","animate","lottie"],ft=["text","prop","card","counter","circle","ellipse"],oc=["row","column","grid","chain"],vm=50;function X(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: expected an object.`)}function V(e,t){if(typeof e!="string"||!e.trim()||e.length>2e3)throw new Error(`${t}: expected text of 1 to 2000 characters.`)}function K(e,t,n=-1e4,s=1e4){if(typeof e!="number"||!Number.isFinite(e)||e<n||e>s)throw new Error(`${t}: expected a number between ${n} and ${s}.`)}function re(e,t){if(typeof e=="string"){if(V(e,t),e.length>300)throw new Error(`${t}: expression too long.`)}else K(e,t)}function se(e,t){if(!Array.isArray(e)||e.length!==2)throw new Error(`${t}: expected [x, y].`);e.forEach((n,s)=>re(n,`${t}[${s}]`))}function he(e,t){e!==void 0&&V(e,t)}function ie(e,t,n){if(e!==void 0&&(typeof e!="string"||!t.includes(e)))throw new Error(`${n}: choose one of ${t.join(", ")}.`)}function hs(e){if(!/^[A-Za-z_][A-Za-z_0-9]*$/.test(e)||["__proto__","constructor","prototype",...Jl].includes(e))throw new Error(`Invalid variable name: "${e}".`)}var ut=(e,t)=>t.includes("{")||e.exact.has(t)||[...e.repeated].some(n=>t.startsWith(`${n}-`)&&/^\d+$/.test(t.slice(n.length+1)));function Ve(e,t,n,s){s&&e[t]===void 0&&(e[t]=[0,0]),se(e[t],`${n}.${t}`)}function Zt(e,t,n,s,r=!1){if(X(e,t),++n.count>500)throw new Error(`${t}: a recipe draws at most 500 steps, counting those inside repeat and when.`);if(s){for(let a of["chapter","say","duration"])if(e[a]!==void 0)throw new Error(`${t}.${a}: put it on the ${s} step itself, not on a step inside it.`);if(e.type==="pause")throw new Error(`${t}: a pause cannot go inside ${s}.`);if(e.type==="repeat"&&s==="repeat")throw new Error(`${t}: a repeat cannot go inside another repeat.`);if(oc.includes(s)&&e.place!==void 0)throw new Error(`${t}.place: the ${s} places the steps inside it.`)}if(!ac.includes(e.type))throw new Error(`${t}: unknown type "${e.type}".`);for(let a of["id","say","chapter"])he(e[a],`${t}.${a}`);if(e.duration!==void 0&&K(e.duration,`${t}.duration`,0,3e4),e.nudge!==void 0){if(["pause","move","link","animate"].includes(e.type))throw new Error(`${t}.nudge: a ${e.type} has no place of its own to move.`);if(!Array.isArray(e.nudge)||e.nudge.length!==2)throw new Error(`${t}.nudge: use [dx, dy].`);e.nudge.forEach((a,c)=>K(a,`${t}.nudge[${c}]`,-900,900))}let i=s!==null&&oc.includes(s)||r;if(e.place!==void 0){if(!ft.includes(e.type))throw new Error(`${t}.place: only ${ft.join(", ")} can be placed.`);if(X(e.place,`${t}.place`),V(e.place.to,`${t}.place.to`),!ut(n,String(e.place.to)))throw new Error(`${t}.place.to: no earlier step has the id "${e.place.to}".`);if(!["below","above","left","right"].includes(e.place.side))throw new Error(`${t}.place.side: choose one of below, above, left, right.`);e.place.gap!==void 0&&K(e.place.gap,`${t}.place.gap`,-200,400),ie(e.place.align,["center","start","end"],`${t}.place.align`)}let o=i||e.place!==void 0;if(e.style!==void 0){X(e.style,`${t}.style`);for(let a of["color","fill"]){let c=e.style[a];if(c!==void 0&&(typeof c!="string"||!/^(#[\da-f]{3,8}|[a-z]+)$/i.test(c)))throw new Error(`${t}.style.${a}: use a hex colour or a colour name, no URLs.`)}for(let a of["width","roughness","bowing"])e.style[a]!==void 0&&K(e.style[a],`${t}.style.${a}`,0,20);if(e.style.opacity!==void 0&&K(e.style.opacity,`${t}.style.opacity`,0,1),e.style.dashed!==void 0&&typeof e.style.dashed!="boolean")throw new Error(`${t}: dashed must be a boolean.`);ie(e.style.fillStyle,["hachure","solid","zigzag","cross-hatch","dots"],`${t}.style.fillStyle`)}switch(e.type){case"line":case"arrow":case"highlight":se(e.from,`${t}.from`),se(e.to,`${t}.to`),e.thickness!==void 0&&K(e.thickness,`${t}.thickness`,1,200);break;case"polyline":case"polygon":case"curve":if(!Array.isArray(e.points)||e.points.length<(e.type==="polygon"?3:2)||e.points.length>500)throw new Error(`${t}: points needs ${e.type==="polygon"?3:2} to 500 points.`);e.points.forEach((a,c)=>se(a,`${t}.points[${c}]`));break;case"circle":case"ellipse":Ve(e,"center",t,o);for(let a of e.type==="circle"?["r"]:["rx","ry"])re(e[a],`${t}.${a}`),typeof e[a]=="number"&&K(e[a],`${t}.${a}`,0);break;case"text":Ve(e,"at",t,o),V(e.text,`${t}.text`),e.size!==void 0&&K(e.size,`${t}.size`,1,200),e.rotate!==void 0&&K(e.rotate,`${t}.rotate`,-360,360),ie(e.font,["hand","body"],`${t}.font`),ie(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"card":Ve(e,"at",t,o),re(e.w,`${t}.w`),re(e.h,`${t}.h`);for(let a of["w","h"])typeof e[a]=="number"&&K(e[a],`${t}.${a}`,40);if(V(e.title,`${t}.title`),e.lines!==void 0){if(!Array.isArray(e.lines)||e.lines.length>6)throw new Error(`${t}: at most 6 lines per card.`);e.lines.forEach((a,c)=>V(a,`${t}.lines[${c}]`))}break;case"plot":V(e.fn,`${t}.fn`),e.var!==void 0&&(V(e.var,`${t}.var`),hs(String(e.var))),se(e.domain,`${t}.domain`),se(e.range,`${t}.range`),X(e.box,`${t}.box`);for(let a of["x","y","w","h"])re(e.box[a],`${t}.box.${a}`);if(e.samples!==void 0&&(K(e.samples,`${t}.samples`,2,1e3),!Number.isInteger(e.samples)))throw new Error(`${t}: samples must be an integer.`);break;case"pause":K(e.ms,`${t}.ms`,0,3e4),he(e.ask,`${t}.ask`);break;case"prop":if(!Hl(e.name)&&!n.figures.has(String(e.name))){let a=n.figures.size?`, or one the recipe defines (${[...n.figures].join(", ")})`:"";throw new Error(`${t}.name: unknown prop "${String(e.name)}"; use one of ${di.join(", ")}${a}.`)}if(Ve(e,"at",t,o),e.size!==void 0&&(re(e.size,`${t}.size`),typeof e.size=="number"&&K(e.size,`${t}.size`,10,1e3)),he(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);if(e.mood!==void 0){if(!Zl(e.name))throw new Error(`${t}.mood: only a person (person, person-pointing, person-sitting) has a face.`);ie(e.mood,Ql,`${t}.mood`)}break;case"repeat":if(re(e.times,`${t}.times`),typeof e.times=="number"&&(K(e.times,`${t}.times`,0,vm),!Number.isInteger(e.times)))throw new Error(`${t}.times: expected a whole number.`);Zt(e.step,`${t}.step`,n,"repeat",i);break;case"when":if(re(e.if,`${t}.if`),!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>Zt(a,`${t}.steps[${c}]`,n,s??"when"));break;case"move":if(V(e.target,`${t}.target`),!ut(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);se(e.to,`${t}.to`),ie(e.along,["line","curve"],`${t}.along`),e.ms!==void 0&&K(e.ms,`${t}.ms`,200,5e3);break;case"lottie":if(V(e.src,`${t}.src`),se(e.at,`${t}.at`),e.size!==void 0&&(re(e.size,`${t}.size`),typeof e.size=="number"&&K(e.size,`${t}.size`,24,1e3)),e.loop!==void 0&&typeof e.loop!="boolean")throw new Error(`${t}.loop: expected true or false.`);break;case"animate":if(V(e.target,`${t}.target`),!ut(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);if(ie(e.effect,[...ec,"stop"],`${t}.effect`),e.effect===void 0)throw new Error(`${t}.effect: choose one of ${[...ec,"stop"].join(", ")}.`);ie(e.speed,["slow","fast"],`${t}.speed`);break;case"link":for(let a of["from","to"])if(V(e[a],`${t}.${a}`),!ut(n,String(e[a])))throw new Error(`${t}.${a}: no earlier step has the id "${e[a]}".`);he(e.label,`${t}.label`);break;case"counter":if(Ve(e,"at",t,o),re(e.value,`${t}.value`),e.format!==void 0&&(V(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "R$ {v:0}".`);e.size!==void 0&&K(e.size,`${t}.size`,1,200),ie(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"row":case"column":case"grid":if(i)throw new Error(`${t}: a ${e.type} cannot go inside another ${s}.`);if(Ve(e,"at",t,!1),e.gap!==void 0&&K(e.gap,`${t}.gap`,0,400),e.type==="grid"){if(K(e.columns,`${t}.columns`,1,12),!Number.isInteger(e.columns))throw new Error(`${t}.columns: expected a whole number.`)}else ie(e.align,["center","start","end"],`${t}.align`);if(!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>{X(a,`${t}.steps[${c}]`);let f=a.type==="repeat"?a.step?.type:a.type;if(!ft.includes(f))throw new Error(`${t}.steps[${c}]: a ${e.type} holds only ${ft.join(", ")} (or a repeat of one).`);Zt(a,`${t}.steps[${c}]`,n,e.type)});break;case"chain":if(i)throw new Error(`${t}: a chain cannot go inside a ${s}.`);if(Ve(e,"at",t,!1),e.gap!==void 0&&e.gap!=="auto"&&K(e.gap,`${t}.gap`,0,400),ie(e.direction,["right","down"],`${t}.direction`),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new Error(`${t}.wrap: expected true or false.`);if(he(e.forward,`${t}.forward`),he(e.back,`${t}.back`),e.size!==void 0&&(re(e.size,`${t}.size`),typeof e.size=="number"&&K(e.size,`${t}.size`,10,1e3)),!Array.isArray(e.steps)||e.steps.length<2||e.steps.length>12)throw new Error(`${t}.steps: a chain joins 2 to 12 pieces.`);e.steps.forEach((a,c)=>{if(X(a,`${t}.steps[${c}]`),!ft.includes(a.type))throw new Error(`${t}.steps[${c}]: a chain holds only ${ft.join(", ")}.`);Zt(a,`${t}.steps[${c}]`,n,"chain")});break;case"axis":case"timeline":if(se(e.from,`${t}.from`),se(e.to,`${t}.to`),se(e.domain,`${t}.domain`),e.type==="axis"){if(e.ticks!==void 0){if(Array.isArray(e.ticks)){if(e.ticks.length>30)throw new Error(`${t}.ticks: at most 30 marks.`);e.ticks.forEach((a,c)=>K(a,`${t}.ticks[${c}]`))}else if(K(e.ticks,`${t}.ticks`,0,30),!Number.isInteger(e.ticks))throw new Error(`${t}.ticks: expected a whole number.`)}if(he(e.label,`${t}.label`),e.format!==void 0&&(V(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v} km".`)}else{if(!Array.isArray(e.marks)||e.marks.length===0||e.marks.length>20)throw new Error(`${t}.marks: expected 1 to 20 marks.`);e.marks.forEach((a,c)=>{X(a,`${t}.marks[${c}]`),re(a.at,`${t}.marks[${c}].at`),he(a.label,`${t}.marks[${c}].label`),he(a.text,`${t}.marks[${c}].text`)})}break;case"balloon":if(V(e.to,`${t}.to`),!ut(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`);if(V(e.text,`${t}.text`),String(e.text).length>300)throw new Error(`${t}.text: keep a balloon under 300 characters.`);ie(e.side,["below","above","left","right"],`${t}.side`),ie(e.kind,["speech","thought"],`${t}.kind`),e.width!==void 0&&K(e.width,`${t}.width`,80,600),e.size!==void 0&&K(e.size,`${t}.size`,12,60);break;case"brace":if(se(e.from,`${t}.from`),se(e.to,`${t}.to`),he(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);break;case"note":if(se(e.at,`${t}.at`),V(e.text,`${t}.text`),e.to===void 0==(e.point===void 0))throw new Error(`${t}: a note points either to an element (to) or to a point (point).`);if(e.to!==void 0){if(V(e.to,`${t}.to`),!ut(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`)}else se(e.point,`${t}.point`);e.size!==void 0&&K(e.size,`${t}.size`,12,60);break;case"table":if(se(e.at,`${t}.at`),!Array.isArray(e.rows)||e.rows.length===0||e.rows.length>12)throw new Error(`${t}.rows: expected 1 to 12 rows.`);if(e.rows.forEach((a,c)=>{if(!Array.isArray(a)||a.length===0||a.length>6)throw new Error(`${t}.rows[${c}]: expected 1 to 6 cells.`);a.forEach((f,m)=>{if(typeof f!="string"||f.length>120)throw new Error(`${t}.rows[${c}][${m}]: expected text of up to 120 characters.`)})}),e.header!==void 0&&typeof e.header!="boolean")throw new Error(`${t}.header: expected true or false.`);e.size!==void 0&&K(e.size,`${t}.size`,12,40);break;case"bars":X(e.box,`${t}.box`);for(let a of["x","y","w","h"])re(e.box[a],`${t}.box.${a}`);if(!Array.isArray(e.values)||e.values.length===0||e.values.length>12)throw new Error(`${t}.values: expected 1 to 12 values.`);if(e.values.forEach((a,c)=>re(a,`${t}.values[${c}]`)),e.labels!==void 0){if(!Array.isArray(e.labels)||e.labels.length>e.values.length)throw new Error(`${t}.labels: at most one label per value.`);e.labels.forEach((a,c)=>V(a,`${t}.labels[${c}]`))}if(e.max!==void 0&&re(e.max,`${t}.max`),e.format!==void 0&&(V(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v}%".`);break}typeof e.id=="string"&&(s==="repeat"?n.repeated:n.exact).add(e.id)}function Sm(e,t){let n=`defs.${e}`;if(!/^[a-z][a-z0-9-]{1,30}$/.test(e))throw new Error(`${n}: a figure's name is 2 to 31 lowercase letters, digits or -, starting with a letter.`);if(ps(e)||Object.hasOwn(ds,e)||ac.includes(e)||["define","title","param","switch","var"].includes(e))throw new Error(`${n}: "${e}" is already a prop or a step; choose another name.`);if(X(t,n),!Array.isArray(t.shapes)||t.shapes.length===0||t.shapes.length>ic)throw new Error(`${n}.shapes: expected 1 to ${ic} shapes.`);let s=(r,i)=>{if(typeof r!="number"||!Number.isInteger(r)||r<0||r>100)throw new Error(`${i}: expected a whole number from 0 to 100 (the figure's grid, y down; it stands at 50,100).`)};t.shapes.forEach((r,i)=>{let o=`${n}.shapes[${i}]`;if(X(r,o),r.fill!==void 0&&(typeof r.fill!="string"||!/^(#[0-9a-fA-F]{3,8}|[a-z]{3,20})$/.test(r.fill)))throw new Error(`${o}.fill: a colour, as hex or a plain name.`);if(r.kind==="circle"){if(!Array.isArray(r.c)||r.c.length!==2)throw new Error(`${o}.c: expected [x, y].`);r.c.forEach((c,f)=>s(c,`${o}.c[${f}]`)),s(r.r,`${o}.r`);return}if(!["polygon","polyline","curve"].includes(r.kind))throw new Error(`${o}.kind: choose one of polygon, polyline, curve, circle.`);let a=r.kind==="polygon"?3:2;if(!Array.isArray(r.points)||r.points.length<a||r.points.length>40)throw new Error(`${o}.points: a ${r.kind} takes ${a} to 40 points.`);r.points.forEach((c,f)=>{if(!Array.isArray(c)||c.length!==2)throw new Error(`${o}.points[${f}]: expected [x, y].`);c.forEach((m,u)=>s(m,`${o}.points[${f}][${u}]`))})})}function Om(e,t){let n=`lottie "${e}"`;X(t,n);let s=JSON.stringify(t).length;if(s>sc)throw new Error(`${n}: ${Math.round(s/1e3)} KB; an animation can have at most ${sc/1e3} KB.`);for(let i of["fr","ip","op","w","h"])K(t[i],`${n}.${i}`,0,1e5);if(typeof t.v!="string"||!Array.isArray(t.layers))throw new Error(`${n}: not a Lottie animation (it needs v and layers).`);let r=(i,o)=>{if(Array.isArray(i))return i.forEach((a,c)=>r(a,`${o}[${c}]`));if(!(!i||typeof i!="object"))for(let[a,c]of Object.entries(i)){if(a==="x"&&typeof c=="string")throw new Error(`${n}: the animation has an expression (code inside it, at ${o}); only animations without expressions play.`);r(c,`${o}.${a}`)}};r(t.layers,"layers");for(let i of Array.isArray(t.assets)?t.assets:[]){let o=i?.p;if(typeof o=="string"&&o&&!o.startsWith("data:")&&!Array.isArray(i.layers))throw new Error(`${n}: an image from outside the animation ("${o.slice(0,40)}"); only images inside it (data:) are kept.`)}return s}function Am(e){X(e,"The recipe");let t=e;K(t.width,"width",100,4e3),K(t.height,"height",100,4e3);for(let r of["id","title","category"])he(t[r],r);if(t.locale!==void 0&&!(typeof t.locale=="string"&&/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$/.test(t.locale)&&Intl.NumberFormat.supportedLocalesOf([t.locale]).length>0))throw new Error('locale: expected a language tag such as "en-US" or "pt-BR".');if(ie(t.background,["dots","grid","plain"],"background"),ie(t.kind,$m,"kind"),he(t.source,"source"),t.quiz!==void 0&&t.kind!==void 0&&t.kind!=="lesson")throw new Error(`quiz: only a lesson has a quiz (this drawing is a ${t.kind}).`);if(ie(t.theme,["paper","chalkboard"],"theme"),t.quiz!==void 0){if(X(t.quiz,"quiz"),V(t.quiz.question,"quiz.question"),!Array.isArray(t.quiz.options)||t.quiz.options.length<2||t.quiz.options.length>4)throw new Error("quiz.options: expected 2 to 4 options.");if(t.quiz.options.forEach((r,i)=>{if(X(r,`quiz.options[${i}]`),V(r.text,`quiz.options[${i}].text`),V(r.why,`quiz.options[${i}].why`),typeof r.right!="boolean")throw new Error(`quiz.options[${i}].right: expected true or false.`)}),t.quiz.options.filter(r=>r.right===!0).length!==1)throw new Error("quiz.options: exactly one option is right.")}if(t.learning!==void 0){X(t.learning,"learning");for(let r of["goal","question","answer","caveat"])V(t.learning[r],`learning.${r}`)}if(t.params!==void 0){X(t.params,"params");for(let[r,i]of Object.entries(t.params))if(hs(r),X(i,`params.${r}`),V(i.label,`params.${r}.label`),K(i.min,`${r}.min`),K(i.max,`${r}.max`),K(i.step,`${r}.step`,1e-6),K(i.value,`${r}.value`,i.min,i.max),i.max<=i.min)throw new Error(`${r}: max must be greater than min.`)}if(t.vars!==void 0){X(t.vars,"vars");for(let[r,i]of Object.entries(t.vars))hs(r),re(i,`vars.${r}`)}if(t.switches!==void 0){X(t.switches,"switches");let r=Object.entries(t.switches);if(r.length>8)throw new Error("switches: at most 8.");for(let[i,o]of r){if(hs(i),Object.hasOwn(t.params??{},i)||Object.hasOwn(t.vars??{},i))throw new Error(`switches.${i}: the name is already a param or a var.`);if(X(o,`switches.${i}`),V(o.label,`switches.${i}.label`),typeof o.on!="boolean")throw new Error(`switches.${i}.on: expected true or false.`)}}if(!Array.isArray(t.steps)||t.steps.length===0||t.steps.length>250)throw new Error("A recipe needs 1 to 250 steps.");let n=new Set;if(t.defs!==void 0){X(t.defs,"defs");let r=Object.entries(t.defs);if(r.length>tc)throw new Error(`defs: at most ${tc} figures.`);for(let[i,o]of r)Sm(i,o),n.add(i)}if(t.lotties!==void 0){X(t.lotties,"lotties");let r=Object.entries(t.lotties);if(r.length>nc)throw new Error(`lotties: at most ${nc} animations.`);let i=r.reduce((o,[a,c])=>o+Om(a,c),0);if(i>rc)throw new Error(`lotties: ${Math.round(i/1e3)} KB in all; at most ${rc/1e3} KB.`)}if(t.credits!==void 0){if(!Array.isArray(t.credits)||t.credits.length>5)throw new Error("credits: at most 5 lines.");t.credits.forEach((r,i)=>V(r,`credits[${i}]`))}let s={exact:new Set,repeated:new Set,count:0,figures:n};return t.steps.forEach((r,i)=>Zt(r,`Step ${i+1}`,s,null)),{...t,id:t.id??"pasted",title:t.title??"",background:t.background??"dots"}}export{ti as DEFAULT_PROFILE,gi as agentsIn,sm as applyChanges,_h as compare,pm as declaredFrom,rh as extractAgent,ym as firedFrom,nm as fromSheets,ai as groupLooks,Vt as groupPatterns,ih as knownKinds,pe as labelOf,lm as lessonOf,hm as mergeDeclared,Oh as problemText,wh as readCast,cm as readCsv,dh as readProfile,Kh as reviewCast,Am as validateScene,Gh as workbookFile,tm as workbookOf,Sh as writeCast};
|