@smartkomm/plexus-cli 0.1.148 → 0.1.150
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +2 -2
- package/dist/spec.snapshot.json +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -11199,7 +11199,7 @@ The link is valid for {{gueltigkeit}} and works once. Afterwards you are signed
|
|
|
11199
11199
|
|
|
11200
11200
|
{{einstellungenLink}}`,en:`Open Plexus and, in the user menu, \u201CSettings\u201D \u2192 \u201CSignature\u201D:
|
|
11201
11201
|
|
|
11202
|
-
{{einstellungenLink}}`}}]},rw=[KW,zW,HW,JW,QW,n1,t1,v1,S1,P1,F1,M1,j1,U1,z1,H1,Z1,t2,r2,A1,E1,T1,i2,o2,s2,r1,i1,o1,l1,u1,m1,k1,_1,T2,R2,VW,UW,l2,c2,f2,m2,y2,k2,v2];function iw(e){let t=rw.find(n=>n.id===e);return t===void 0&&F(`notifications: unknown letter "${e}"`),t}s(iw,"letterDefFor");function ow(e){return rw.some(t=>t.id===e)}s(ow,"hasLetterDef");function sw(e,t){return t===void 0?!0:xf(e,t)}s(sw,"letterArgCompatible");function _l(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${bn(e)} (${e})`,en:`${bn(e)} (${e})`}}s(_l,"letterArgTypeLabel");function k_(e){let t=new Map,n=s((r,i)=>{let o=t.get(r);o===void 0?t.set(r,[i]):o.push(i)},"add");for(let r of e.args)n(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of o_)n(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return t}s(k_,"eventArgSources");function b_(e,t){let n=e.type===void 0?[...t]:t.filter(r=>sw(r.type,e.type));if(n.length>1)return{status:"ambiguous",matches:n};if(n.length===1){let r=n[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...t]}:{status:"unused"}}s(b_,"resolveLetterParam");var aw=["booked","rescheduled","cancelled"],I2={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},x_=":";function S_(e,t){return`${e}${x_}${t}`}s(S_,"appointmentEventId");function O2(e){let t=e.lastIndexOf(x_);if(t<=0)return null;let n=e.slice(t+1);return aw.includes(n)?{taskKey:e.slice(0,t),kind:n}:null}s(O2,"parseAppointmentEventId");var v_={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function Hs(e){return Array.isArray(e.tasks)?e.tasks.filter(t=>typeof t?.key=="string"&&t.result?.kind==="appointment"):[]}s(Hs,"appointmentTasksOf");function _2(e){return aw.map(t=>({id:S_(e.key,t),label:{de:`${v_[t].de} \u2013 \u201E${e.title.de}\u201C`,en:`${v_[t].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(_2,"appointmentTaskEvents");function A_(e,t){let n=t.notificationEvents?.(e)??[],r=Hs(e).flatMap(_2);return r.length===0?n:[...n,...r]}s(A_,"nodeNotificationEvents");function N2(e){return Object.fromEntries(aw.map(t=>[S_(e,t),{templateId:I2[t]}]))}s(N2,"defaultAppointmentBindings");function C2(e,t){if(e===void 0)return{notifications:e,dropped:[]};let n=[],r={};for(let[i,o]of Object.entries(e))O2(i)?.taskKey===t?n.push(i):r[i]=o;return n.length===0?{notifications:e,dropped:n}:{notifications:Object.keys(r).length===0?void 0:r,dropped:n}}s(C2,"withoutAppointmentBindings");function Vf(e,t,n){let r=new Set(Hs(t).map(d=>d.key)),i=new Set(Hs(n).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=C2(o,d);o=c.notifications,a.push(...c.dropped)}let l=[];for(let d of i)if(!r.has(d))for(let[c,u]of Object.entries(N2(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(Vf,"syncAppointmentBindings");function P2(e){return e.kind==="task"&&!("title"in e)}s(P2,"isLegacyFreeTodoContext");function lw(e){let{context:t}=e;if(P2(t)&&F(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),t.kind==="task")return{...e,context:t,kind:"task",createdVia:"human",partyId:t.partyId};let{anchor:n,task:r,kind:i,title:o,description:a,...l}=t,d=n.scope==="node"?{nodeId:n.nodeId,templateKey:n.templateKey,gatesNode:n.gatesNode,blocks:n.blocks}:n.scope==="application"?{scope:"application",templateKey:n.templateKey}:n.scope==="crossNode"?{scope:"application",nodeId:n.nodeId,templateKey:n.templateKey,blocks:n.blocks}:{};return{...e,context:t,...l,...d,...r??{},kind:i}}s(lw,"readWorkItem");async function Nl(e,t){let n;if(t.nodeId!==void 0){let r=t.nodeId;n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(t.isOpen!==void 0){let r=t.isOpen;n=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",t.applicationId).eq("isOpen",r)).collect()}else n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",t.applicationId)).collect();return n.filter(r=>t.isOpen===void 0||r.isOpen===t.isOpen).map(lw)}s(Nl,"listWorkItemsForApplication");var npe=m.union(m.literal("approved"),m.literal("rejected")),Cl=new Set(["task","approval"]);function D2(e,t){switch(e){case"task":return t?.gatesNode===!0&&F("expandComposedTask: gatesNode is approval-only \u2014 a 'task' template never gates its node (use blocks to hold a gating sibling back)"),{kind:"task",recipient:"internal",gatesNode:!1};case"approval":return{kind:"approval",recipient:"internal",isApproval:!0,gatesNode:t?.gatesNode??!0};default:F(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...Cl].join(", ")}`)}}s(D2,"expandComposedTask");for(let e of["task","approval"]){let t=D2(e);t.kind==="approval"!=(t.isApproval===!0)&&F(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var E_=Ri,qi=`${E_}.`,F2=new Set(["text","number","date","boolean","option","edge"]);function Bf(e,t){let n=e[t];return n===void 0&&F(`[env/unknownKey] no environment key '${t}'`),typeof n=="string"?null:Object.keys(n)}s(Bf,"contextFields");function T_(e,t){return Object.hasOwn(e,t)}s(T_,"isContextKey");function $_(e){let t=[];for(let n of Object.keys(e)){let r=Bf(e,n);if(r===null)t.push(n);else for(let i of r)t.push(`${n}.${i}`)}return t}s($_,"leafPaths");function Pl(e,t){let[n="",r,...i]=t.split(".");if(!T_(e,n)||i.length>0)return;let o=e[n];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s(Pl,"leafType");function R_(e){let t=new Set;for(let n of e){let r=Js(n);r!==null&&t.add(r.split(".")[0])}return[...t]}s(R_,"contextKeysOf");function Js(e){return e.startsWith(qi)?e.slice(qi.length):null}s(Js,"contextPathOf");function Dl(e){return e===E_||e.startsWith(qi)}s(Dl,"isContextIdentifier");function Uf(e,t){let n=Js(t)??"",[r=""]=n.split("."),i=Object.keys(e);if(!T_(e,r))return{code:"env/unknownKey",message:{de:`'${t}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${t}' names no environment key \u2014 known: ${i.join(", ")}.`}};if(Pl(e,n)!==void 0)return null;let o=Bf(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${t}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${qi}${r}'.`,en:`'${t}': environment key '${r}' is a single value \u2014 read it as '${qi}${r}'.`}:{de:`'${t}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${t}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(Uf,"identifierIssue");function Gf(e,t,n=Object.keys(e)){let r={};for(let i of n){let o=Bf(e,i),a=Object.hasOwn(t,i)?t[i]:void 0;if(a===void 0&&F(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${qi}${i}`]=a;continue}for(let l of o){let d=typeof a=="object"&&a!==null&&Object.hasOwn(a,l)?a[l]:void 0;d===void 0&&F(`[env/missing] context key '${i}' carries no '${l}'`),r[`${qi}${i}.${l}`]=d}}return r}s(Gf,"flatten");function I_(e,t,n){if(n===void 0)return!1;let r=Bf(e,t);return r===null?!0:typeof n=="object"&&n!==null&&r.every(i=>n[i]!==void 0)}s(I_,"contextValueComplete");function L2(e,t){switch(t){case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e);default:return typeof e=="string"}}s(L2,"valueMatchesDataType");function O_(e,t,n=Object.keys(e.types)){let r=new Set(n);for(let i of $_(e.types)){if(!r.has(i.split(".")[0]))continue;let o=t[`${qi}${i}`];o===void 0&&F(`[env/missing] context path '${i}' was not supplied`);let a=e.fields[i];if(o===null){a.nullable||F(`[env/null] context path '${i}' is not nullable but carries null`);continue}let l=bn(Pl(e.types,i));L2(o,l)||F(`[env/type] context path '${i}' expects ${l}, got ${JSON.stringify(o)}`),a.valueSet.kind==="fixed"&&!a.valueSet.values.includes(o)&&F(`[env/value] context path '${i}' carries '${String(o)}', outside ${a.valueSet.values.join(" | ")}`)}}s(O_,"assertContextValues");function M2(e){let t=[],n=$_(e.types);for(let r of n){let i=Pl(e.types,r),o=bn(i);if(!Ci(i)||o===void 0||!F2.has(o)){t.push(`'${r}' has type '${String(i)}', not a scalar value type`);continue}let a=Object.hasOwn(e.fields,r)?e.fields[r]:void 0;if(a===void 0){t.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&t.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&t.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))n.includes(r)||t.push(`field spec '${r}' names no leaf of the schema`);return t}s(M2,"schemaIssues");function Qs(e){let t=M2(e);t.length>0&&F(`[env/schema] ${t.join("; ")}`)}s(Qs,"assertSchema");var zf={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function Ki(e){return JSON.stringify(e)}s(Ki,"canonical");function Xs(e){return e.kind==="binary"&&e.op==="&&"?[...Xs(e.left),...Xs(e.right)]:[e]}s(Xs,"conjuncts");function C_(e,t){let n;try{n=$t(e)}catch{return!1}let r=Ki($t(t));return Xs(n).some(i=>Ki(i)===r)}s(C_,"hasConjunct");function P_(e,t){try{return Ki($t(e))===Ki($t(t))}catch{return!1}}s(P_,"sameCondition");function D_(e){let t=[];for(let n of e)t.push(...Rt(ei(n)));return R_(t)}s(D_,"contextKeysRead");function F_(e){try{return Rt($t(e)).some(Dl)}catch{return!1}}s(F_,"readsContext");var q2=/^\d{4}-\d{2}-\d{2}$/,K2=new Set(["==","!=","<","<=",">",">=","in"]),j2=new Set(["<","<=",">",">="]);function Yf(e,t,n=[]){Qs(t);let r;try{r=$t(e)}catch(a){let l=a.message;return[Ut("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of Rt(r)){if(!Dl(a)){i.push(Ut("condition/foreignIdentifier",`'${a}' ist kein Umgebungswert \u2014 Bedingungen lesen nur '$env.*'`,`'${a}' is not a context identifier \u2014 conditions read only '$env.*'`));continue}let l=Uf(t.types,a);l!==null&&i.push(Ut("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=Dr(r,t,i);Fl(o)||i.push(Ut("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),G2(r,t,i);for(let{identifier:a,op:l}of uw(r,t))i.push(Ut("condition/unguardedNullable",`'${l}' \xFCber '${a}', das leer sein kann, braucht davor eine Absicherung '${a} != null &&'`,`'${l}' over '${a}', which may be null, needs a guard '${a} != null &&' before it`));return i.push(...V2(r,n)),i}s(Yf,"conditionIssues");function V2(e,t){let n=Xs(e).map(Ki);return t.flatMap(r=>{let i=$t(r),o=B2(i);return o===null||!n.includes(Ki(o))?[]:[{severity:"info",code:"condition/guardForm",message:{de:`[condition/guardForm] eine gespiegelte Absicherung z\xE4hlt nicht \u2014 schreibe sie genau als '${r}'`,en:`[condition/guardForm] a mirrored guard does not count \u2014 write it exactly as '${r}'`}}]})}s(V2,"guardFormHints");function B2(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let t={...e,left:e.right,right:e.left};return Ki(t)===Ki(e)?null:t}s(B2,"mirror");function Fl(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(Fl,"isBooleanish");function L_(e){let t=Js(e);return t===null&&F(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),t}s(L_,"contextPath");function M_(e,t){let n=Js(t);return n!==null&&e.fields[n]?.nullable===!0}s(M_,"isNullableLeaf");function U2(e,t){let n=bn(Pl(e.types,L_(t)));return n===void 0?{t:"unknown"}:{t:"data",dt:n}}s(U2,"identType");function Wf(e,t){return e.t==="unknown"||t.t==="unknown"||e.t==="null"||t.t==="null"?!0:e.t==="array"||t.t==="array"?!1:e.t==="str"&&t.t==="str"?!0:e.t==="str"?__(e.value,t.dt):t.t==="str"?__(t.value,e.dt):e.dt===t.dt}s(Wf,"fits");function __(e,t){return t==="text"||t==="option"||t==="edge"?!0:t==="date"?q2.test(e):!1}s(__,"strFits");function N_(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(N_,"orderedCategory");function Dr(e,t,n){switch(e.kind){case"num":return{t:"data",dt:"number"};case"bool":return{t:"data",dt:"boolean"};case"str":return{t:"str",value:e.value};case"null":return{t:"null"};case"ident":return U2(t,e.path);case"arr":for(let r of e.items)Dr(r,t,n);return{t:"array"};case"unary":{let r=Dr(e.operand,t,n);return Fl(r)||n.push(Ut("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(zf,e.name)?zf[e.name]:void 0,i=e.args.map(l=>Dr(l,t,n));return r===void 0?(n.push(Ut("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(zf).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(zf).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&Wf(l,{t:"data",dt:r.params[d]}))||n.push(Ut("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=Dr(e.cond,t,n);Fl(r)||n.push(Ut("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=Dr(e.then,t,n),o=Dr(e.else,t,n);return Wf(i,o)||n.push(Ut("condition/typeMismatch","die beiden Zweige von 'if' haben verschiedene Typen","the two arms of 'if' differ in type")),i.t==="null"?o:i}case"binary":{let r=Dr(e.left,t,n),i=Dr(e.right,t,n);if(e.op==="&&"||e.op==="||")(!Fl(r)||!Fl(i))&&n.push(Ut("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?n.push(Ut("condition/inWithoutArray","'in' braucht rechts eine Liste, z. B. ['a', 'b']","'in' needs a list on its right, e.g. ['a', 'b']")):e.right.items.every(o=>Wf(r,Dr(o,t,[])))||n.push(Ut("condition/typeMismatch","ein Listeneintrag von 'in' passt nicht zum Typ des linken Operanden","a list item of 'in' does not match the left operand's type"));else if(j2.has(e.op)){let o=N_(r),a=N_(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&n.push(Ut("condition/orderedComparison",`'${e.op}' vergleicht nur Zahlen \u2014 f\xFCr Daten years_between(\u2026) verwenden`,`'${e.op}' compares only numbers \u2014 for dates use years_between(\u2026)`))}else Wf(r,i)||n.push(Ut("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(Dr,"typeOf");function dw(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(dw,"isLiteral");function q_(e){let t=[],n=s(r=>{if(r.kind==="binary"&&K2.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(dw):dw(r.right)?[r.right]:[];i.length>0&&t.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&dw(r.left)&&t.push({ident:r.right.path,literals:[r.left]})}K_(r,n)},"visit");return n(e),t}s(q_,"comparedLiterals");function G2(e,t,n){for(let{ident:r,literals:i}of q_(e)){let o=z2(r,i,t);o!==null&&n.push(o)}}s(G2,"literalIssues");function cw(e,t){let n;try{n=$t(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of q_(n)){let a=Js(i);if(!(a===null||t.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(cw,"liveLiterals");function z2(e,t,n){let r=n.fields[L_(e)]?.valueSet;if(r?.kind==="unstable")return Ut("condition/literalOnUnstable",`'${e}' ist nicht \xFCber Umgebungen stabil \u2014 vergleiche ihn mit keinem festen Wert; verzweige stattdessen \xFCber ein stabiles Merkmal`,`'${e}' is not stable across environments \u2014 compare it to no literal; branch on a stable attribute instead`);if(r?.kind!=="fixed")return null;let i=t.flatMap(a=>a.kind==="str"&&!r.values.includes(a.value)?[`'${a.value}'`]:[]);if(i.length===0)return null;let o=r.values.map(a=>`'${a}'`).join(", ");return Ut("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(z2,"valueSetIssue");function K_(e,t){switch(e.kind){case"binary":t(e.left),t(e.right);return;case"unary":t(e.operand);return;case"call":e.args.forEach(t);return;case"arr":e.items.forEach(t);return;case"if":t(e.cond),t(e.then),t(e.else);return;default:return}}s(K_,"forEachChild");function j_(e){return e.kind==="binary"&&(e.op==="=="||e.op==="!=")&&(e.left.kind==="ident"&&e.right.kind==="null"||e.left.kind==="null"&&e.right.kind==="ident")}s(j_,"isNullTest");function V_(e){return Xs(e).flatMap(t=>{let n=B_(t);return n===null?[]:[n]})}s(V_,"guardsOf");function Ll(e,t,n){switch(e.kind){case"ident":return M_(t,e.path)&&!n.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=Ll(r,t,n);if(i!==null)return i}return null;case"if":return Ll(e.then,t,new Set([...n,...V_(e.cond)]))??Ll(e.else,t,n);default:return null}}s(Ll,"unguardedNullSource");function B_(e){return!j_(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(B_,"guardedIdent");function Zs(e,t,n,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(n);for(let o of Xs(e)){Zs(o,t,i,r);let a=B_(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Zs(e.cond,t,n,r),Zs(e.then,t,new Set([...n,...V_(e.cond)]),r),Zs(e.else,t,n,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=Ll(e.left,t,n)??Ll(e.right,t,n);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!j_(e.operand)){let i=Rt(e.operand).filter(o=>M_(t,o)&&!n.has(o));i.length>0&&r(i[0],"!")}K_(e,i=>Zs(i,t,n,r))}s(Zs,"nullableReads");function uw(e,t){Qs(t);let n=[];return Zs(e,t,new Set,(r,i)=>{n.some(o=>o.identifier===r)||n.push({identifier:r,op:i})}),n}s(uw,"unguardedNullableReads");function Ut(e,t,n){return{severity:"error",code:e,message:{de:`[${e}] ${t}`,en:`[${e}] ${n}`}}}s(Ut,"error");function Ml(e){let t=Array.isArray(e.nodes)?e.nodes:[],n=new Set;for(let r of t)for(let i of Rf(r))i.key!==null&&Ls[i.leaf].involves&&n.add(i.key);return n}s(Ml,"declaredGroupKeys");var ea=of;var W2="unit.key",Y2="offer.key";function U_(e,t){return e===W2?t.unitKeys:e===Y2?t.offerKeys:null}s(U_,"liveKeyUniverse");function Hf(e){return[ht,...[...Ml(e)].sort((t,n)=>t.localeCompare(n)).map(ff)]}s(Hf,"requiredSlots");var ji=`${af("applicant.channel")} == 'staff'`;var pw=["strict","leastLoaded"];var fw=2;function G_(e){return e.some(t=>t.length===0)?{de:"nennt einen leeren Personenschl\xFCssel",en:"names an empty person key"}:new Set(e).size!==e.length?{de:"nennt eine Person zweimal",en:"names a person twice"}:e.length<fw?{de:`braucht mindestens ${fw} Personen`,en:`needs at least ${fw} people`}:null}s(G_,"rotationPoolProblem");function H2(e,t){let n=t===null?-1:e.indexOf(t);return[...e.slice(n+1),...e.slice(0,n+1)]}s(H2,"strictOrder");function z_(e){let t=H2(e.pool,e.previous).filter(i=>e.eligible.has(i));if(t.length===0)return null;if(e.mode==="strict")return t[0];let n=e.openCounts;n===void 0&&F("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=n.get(i);return o===void 0&&F(`[assignment/rotation] no open count for '${i}'`),o},"load");return t.reduce((i,o)=>r(o)<r(i)?o:i)}s(z_,"pickFromPool");function Y_(e){return e.map(t=>({slot:pI(t.slot),rules:[...t.rules]}))}s(Y_,"rulesOfStored");function H_(e){return e.map(t=>({slot:J2(t.slot),rules:[...t.rules]}))}s(H_,"storedOfRules");function J2(e){let t=mf(e);return t===null&&F(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),t}s(J2,"slotOf");function J_(e,t){let n=e?.assignmentRules;n===void 0&&F(`[assignment/noRules] ${t}: the workflow has no assignment rule`);let r=eN(n);return r.length>0&&F(`${r.join("; ")} (${t})`),Y_(n)}s(J_,"rulesOfGraph");function Q2(e){return e===ht?{slot:e,rules:[{when:ji,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(Q2,"defaultSlotRules");function Q_(e,t){let n=new Set(e.map(o=>o.slot)),r=t.filter(o=>!n.has(o)).map(Q2);return[...r.filter(o=>o.slot===ht),...e,...r.filter(o=>o.slot!==ht)]}s(Q_,"withRequiredSlots");function _t(e,t){return t===void 0?`slot '${e}'`:`slot '${e}' row #${t+1}`}s(_t,"where");function Cn(e,t){return t===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${t+1}`}s(Cn,"whereDe");function vn(e,t,n={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${t.de}`,en:`[${e}] ${t.en}`},...n}}s(vn,"issue");function W_(e){if(e===ht)return!0;let t=pf(e);return t!==null&&t.length>0}s(W_,"isKnownSlot");function Z2(e,t){Qs(ea);let n=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;W_(l)||n.push(vn("assignment/unknownSlot",{de:`'${l}' ist keine Liste \u2014 'responsible' oder 'team:<teamKey>'`,en:`'${l}' is no slot \u2014 'responsible' or 'team:<teamKey>'`},{slot:l})),r.has(l)&&n.push(vn("assignment/duplicateSlot",{de:`${Cn(l)} steht zweimal da`,en:`${_t(l)} is listed twice`},{slot:l})),r.add(l),l===ht&&a!==0&&n.push(vn("assignment/responsibleFirst",{de:`'${ht}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${ht}' must be the first slot \u2014 team rows copy it`},{slot:l})),n.push(...X2(o))});for(let o of t)r.has(o)||n.push(vn("assignment/slotMissing",{de:`${Cn(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${_t(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(t);for(let{slot:o}of e)o!==ht&&!i.has(o)&&W_(o)&&n.push(vn("assignment/unusedSlot",{de:`${Cn(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${_t(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return n}s(Z2,"validateRules");function X2({slot:e,rules:t}){let n=[];return(t.length===0||t[t.length-1].when!==null)&&n.push(vn("assignment/defaultRowMissing",{de:`${Cn(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${_t(e)} must end with a row without condition ("otherwise")`},{slot:e})),t.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<t.length-1&&n.push(vn("assignment/ruleAfterDefault",{de:`${Cn(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${_t(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=Yf(a,ea,[ji]);for(let c of d)n.push({...c,message:{de:`${c.message.de} (${Cn(e,i)})`,en:`${c.message.en} (${_t(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){F_(a)||n.push(vn("assignment/shadowedRule",{de:`${Cn(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${_t(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=t.slice(0,i).findIndex(u=>u.when!==null&&P_(u.when,a));c!==-1&&n.push(vn("assignment/shadowedRule",{de:`${Cn(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${_t(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===ht&&l.kind==="slot"&&n.push(vn("assignment/slotForwardRef",{de:`${Cn(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${ht}'`,en:`${_t(e,i)} copies '${l.slot}' \u2014 only a team slot after '${ht}' may`},o)),e===ht&&l.kind==="queue"&&n.push(vn("assignment/queueOnProcessSlot",{de:`${Cn(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${_t(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&n.push(vn("assignment/targetMissing",{de:`${Cn(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${_t(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=G_(l.configKeys);d!==null&&n.push(vn("assignment/rotationPool",{de:`${Cn(e,i)}: die Reihum-Liste ${d.de}`,en:`${_t(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!C_(a,ji))&&n.push(vn("assignment/unguardedTarget",{de:`${Cn(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${ji}' ist (oder enth\xE4lt)`,en:`${_t(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${ji}'`},o))}),n}s(X2,"rowIssues");function Z_(e,t){for(let r of t)e.some(i=>i.slot===r)||F(`[assignment/slotMissing] ${_t(r)} has no rule list`);let n=new Set(t);return e.filter(r=>n.has(r.slot))}s(Z_,"selectSlots");function eY(e,t){return D_(Z_(e,t).flatMap(n=>n.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(eY,"contextKeysOfRules");function X_(e,t,n,r){Qs(ea);let i=Z_(e,n),o=eY(e,n),a=Gf(ea.types,t,o);O_(ea,a,o);let l=[];for(let{slot:d,rules:c}of i){let u=c.findIndex((h,w)=>{if(h.when===null)return!0;for(let k of Rt(ei(h.when)))Object.hasOwn(a,k)||F(`[condition/unknownIdentifier] ${_t(d,w)} reads '${k}', which the context does not carry`);return VI(h.when,{values:a})});u===-1&&F(`[assignment/defaultRowMissing] ${_t(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:tY(d,u,p,l,r)})}return l}s(X_,"evaluateRules");function tY(e,t,n,r,i){switch(n.kind){case"person":return{kind:"value",value:i.person(n.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(n,{slot:e,row:t})};case"unassigned":return F(`[assignment/targetMissing] ${_t(e,t)} names no one`);case"queue":return e===ht&&F(`[assignment/queueOnProcessSlot] ${_t(e,t)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===ht?void 0:r.find(a=>a.slot===n.slot);return o===void 0&&F(`[assignment/slotForwardRef] ${_t(e,t)} copies '${n.slot}', which is not decided before it`),o.value}}}s(tY,"resolveTarget");var mw={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function nY(e){if(typeof e!="object"||e===null)return!1;let{kind:t,groupKey:n,...r}=e;return Object.keys(r).length>0?!1:t==="responsible"?n===void 0:t==="team"&&typeof n=="string"&&n.length>0}s(nY,"isStoredSlot");function eN(e){let t=[],n=s((r,i)=>t.push(`[assignment/shape] ${r}: ${i}`),"bad");return Array.isArray(e)?(e.forEach((r,i)=>{let o=`slots[${i}]`;if(typeof r!="object"||r===null)return n(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&n(o,`unknown field(s) ${Object.keys(d).join(", ")}`),nY(a)||n(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return n(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return n(p,"must be { when, assign }");let{when:h,assign:w,...k}=c;Object.keys(k).length>0&&n(p,`unknown field(s) ${Object.keys(k).join(", ")}`),h!==null&&typeof h!="string"&&n(p,"when must be a condition string or null (\u201Esonst\u201C)");let y=w?.kind;if(typeof w!="object"||w===null||typeof y!="string"||!Object.hasOwn(mw,y))return n(p,`assign must be one of ${Object.keys(mw).map(I=>`{kind:'${I}'}`).join(", ")}`);let v=mw[y],A=Object.keys(w);(A.some(I=>!v.includes(I))||v.some(I=>!A.includes(I)))&&n(p,`a '${y}' target has exactly the field(s) ${v.join(", ")}`);let E=w;if(y==="person"&&(typeof E.configKey!="string"||E.configKey.length===0)&&n(p,"a 'person' target needs a non-empty configKey"),y==="rotation"){let I=E.configKeys;(!Array.isArray(I)||I.some(C=>typeof C!="string"))&&n(p,"a 'rotation' target needs configKeys, a list of person keys"),pw.includes(E.mode)||n(p,`a 'rotation' target's mode is one of ${pw.map(C=>`'${C}'`).join(", ")}`)}y==="slot"&&E.slot!==ht&&n(p,`a 'slot' target copies '${ht}' and nothing else`)})}),t):(n("slots","must be a list of { slot, rules }"),t)}s(eN,"ruleShapeIssues");function tN(e){let t=e??{},n=[];if(t.teamOwnerBindings!==void 0&&n.push({de:"[assignment/legacyBindings] der Workflow tr\xE4gt noch teamOwnerBindings \u2014 die Zust\xE4ndigkeitsregel ersetzt sie; das Feld entfernen",en:"[assignment/legacyBindings] the workflow still carries teamOwnerBindings \u2014 the assignment rule replaces them; remove the field"}),t.assignmentRules===void 0)return n.push({de:"[assignment/noRules] der Workflow hat keine Zust\xE4ndigkeitsregel (graph.assignmentRules) \u2014 jeder Workflow muss sagen, wer zust\xE4ndig wird",en:"[assignment/noRules] the workflow has no assignment rule (graph.assignmentRules) \u2014 every workflow must say who becomes responsible"}),n;let r=eN(t.assignmentRules);if(r.length>0)return[...n,...r.map(o=>({de:o,en:o}))];let i=Hf({nodes:Array.isArray(t.nodes)?t.nodes:[]});for(let o of Z2(Y_(t.assignmentRules),i))o.severity==="error"&&n.push(o.message);return n}s(tN,"workflowAssignmentIssues");function Jf(e,t){let o=new Map;for(let d of e)o.set(d,0);let a=new Map,l=[];for(let d of e){if((o.get(d)??0)!==0)continue;let c=[{id:d,edges:t(d),idx:0}];for(o.set(d,1),a.set(d,null);c.length>0;){let u=c[c.length-1];if(u.idx>=u.edges.length){o.set(u.id,2),c.pop();continue}let{target:p,edge:h}=u.edges[u.idx];u.idx++;let w=o.get(p)??0;if(w===1){let k=[p],y=u.id;for(;y&&y!==p;)k.push(y),y=a.get(y)??null;k.reverse(),l.push({edge:h,source:u.id,target:p,cycle:k})}else w===0&&(o.set(p,1),a.set(p,u.id),c.push({id:p,edges:t(p),idx:0}))}}return l}s(Jf,"detectBackEdges");var hw="team:",rY=/^[a-z0-9][a-z0-9-]*$/;function iY(e){if(!e.startsWith(hw))return null;let t=e.slice(hw.length);return t.length>0?t:null}s(iY,"teamKeyOfMember");function Qf(e){return`${hw}${e}`}s(Qf,"teamMember");function ta(e){let t=e.channels;return t===void 0?[]:(Array.isArray(t)||F("graph.channels must be an array"),t)}s(ta,"readAuthoredChannels");function nN(e){return[...Ml(e)].sort()}s(nN,"derivedChannelTeamKeys");function rN(e,t){let n=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!t.has(n))return n;for(let r=2;;r++){let i=`${n}-${r}`;if(!t.has(i))return i}}s(rN,"mintChannelKey");function iN(e,t){let n=e.channels;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"channels",reason:{de:"[channels/shape] graph.channels muss eine Liste sein.",en:"[channels/shape] graph.channels must be a list."}}];let r=[],i=Ml(e),o=new Set,a=new Map;return n.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Tt(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every(A=>typeof A=="string")){r.push({path:c,reason:{de:"[channels/shape] Ein Kanal braucht key, label ({ de, en }) und members (Liste von Texten).",en:"[channels/shape] A channel needs key, label ({ de, en }) and members (a list of texts)."}});return}let p={de:`Kanal "${u.key}"`,en:`Channel "${u.key}"`};rY.test(u.key)||r.push({path:`${c}.key`,reason:{de:`[channels/invalidKey] ${p.de}: Schl\xFCssel nur aus Kleinbuchstaben, Ziffern und Bindestrich.`,en:`[channels/invalidKey] ${p.en}: key only from lowercase letters, digits and hyphens.`}}),o.has(u.key)&&r.push({path:`${c}.key`,reason:{de:`[channels/duplicateKey] ${p.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[channels/duplicateKey] ${p.en}: key is used twice.`}}),o.add(u.key);let h=Tt(u.label);if(h!=="not-localized"&&h.length===2?r.push({path:`${c}.label`,reason:{de:`[channels/emptyLabel] ${p.de}: Bezeichnung fehlt.`,en:`[channels/emptyLabel] ${p.en}: name is missing.`}}):h!=="not-localized"&&h.length>0&&r.push({path:`${c}.label`,reason:{de:`[i18n/missingTranslation] ${p.de}: Bezeichnung fehlt in: ${h.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${p.en}: name is missing in: ${h.join(", ")} \u2014 every displayed text needs German and English.`}}),u.members.length===0){r.push({path:`${c}.members`,reason:{de:`[channels/emptyMembers] ${p.de}: mindestens ein Team.`,en:`[channels/emptyMembers] ${p.en}: at least one team.`}});return}let w=[];for(let A of u.members){let E=iY(A);if(E===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${A}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${A}" is not a "team:<key>".`}});continue}if(w.includes(E)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${E}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${E}" is named twice.`}});continue}t!==void 0&&!t.has(E)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${E}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${E}" does not exist at this school (or it is the applicant group).`}}),w.push(E)}if(w.length===0)return;let k=[...w].sort().join("+"),[y]=w;w.length===1&&y!==void 0&&i.has(y)&&r.push({path:`${c}.members`,reason:{de:`[channels/duplicatesDerived] ${p.de}: Team "${y}" ist am Prozess beteiligt und hat seinen Kanal schon automatisch.`,en:`[channels/duplicatesDerived] ${p.en}: team "${y}" takes part in the process and already has its channel automatically.`}});let v=a.get(k);v!==void 0?r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMembership] ${p.de}: dieselben Teams wie Kanal "${v}" \u2014 zwei Tabs w\xE4ren derselbe Chat.`,en:`[channels/duplicateMembership] ${p.en}: the same teams as channel "${v}" \u2014 two tabs would be the same chat.`}}):a.set(k,u.key)}),r}s(iN,"channelIssues");var Hpe=Object.freeze({});function oY(e,t){return Object.freeze(Gf(Yr,e,t))}s(oY,"formContextEntries");function oN(e){return e.env??[]}s(oN,"declaredContextKeys");function sN(e,t){return oN(e).every(n=>aN(n,t?.[n]))}s(sN,"scenarioContextComplete");function aN(e,t){return I_(Yr,e,t)}s(aN,"contextValueComplete");function lN(e,t){return oY(t??{},oN(e))}s(lN,"scenarioContextEntries");function yw(e){return Dl(e)}s(yw,"isContextIdentifier");function sY(e,t,n){let r=Uf(Yr,e);if(r!==null)return{severity:"error",path:n,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return t.has(i)?null:{severity:"error",path:n,code:"env/undeclared",message:{de:`'${e}' liest den Umgebungsschl\xFCssel '${i}', den das Formular nicht in \`env\` deklariert.`,en:`'${e}' reads the environment key '${i}', which the form does not declare in \`env\`.`}}}s(sY,"contextIdentifierIssue");var gw=af("stage.key");function aY(e){let t=[],n=s(i=>i.kind==="ident"&&i.path===gw,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(n(i.left)&&i.right.kind==="str"&&t.push(i.right.value),n(i.right)&&i.left.kind==="str"&&t.push(i.left.value)),i.op==="in"&&n(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&t.push(o.value);r(i.left),r(i.right);return;case"unary":r(i.operand);return;case"if":r(i.cond),r(i.then),r(i.else);return;case"call":i.args.forEach(r);return;case"arr":i.items.forEach(r);return;default:return}},"walk");return r(e),t}s(aY,"stageKeyLiterals");function Zf(e,t,n){return t===void 0?[]:aY(e).filter(r=>!t.has(r)).map(r=>cN(r,t,n))}s(Zf,"stageKeyAstIssues");function dN(e,t){if(t===void 0)return[];let n=[];for(let r of e.testScenarios??[]){let i=r.env?.stage;typeof i?.key=="string"&&!t.has(i.key)&&n.push(cN(i.key,t,`scenario:${r.id}/env`))}return n}s(dN,"scenarioStageKeyIssues");function cN(e,t,n){let r=[...t].sort();return{severity:"error",path:n,code:"env/unknownStageKey",message:{de:`'${e}' ist kein Stufenschl\xFCssel des Programms dieses Angebots \u2014 `+(r.length>0?`bekannt: ${r.join(", ")}.`:"das Angebot hat kein Programm mit Stufen.")+` \`${gw}\` ist der Bundle-Schl\xFCssel (\`program.stages[].key\`), nie das gespeicherte \`<program>-stufe-<key>\`.`,en:`'${e}' is not a stage key of the offer's program \u2014 `+(r.length>0?`known: ${r.join(", ")}.`:"the offer has no program with stages.")+` \`${gw}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(cN,"unknownStageKeyIssue");function uN(e,t,n){let r=[];for(let i of Rt(e)){if(!yw(i))continue;let o=sY(i,t,n);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of uw(e,of))r.push({severity:"error",path:n,code:"env/unguardedNullable",message:{de:`'${o}' \xFCber '${i}', das bei manchen Bewerbungen leer ist, braucht davor eine Absicherung '${i} != null &&' \u2014 lege fest, was ein leerer Wert bedeutet.`,en:`'${o}' over '${i}', which is empty for some applications, needs a guard '${i} != null &&' before it \u2014 say what an empty value means.`}});return r}s(uN,"contextAstIssues");function fN(e,t){let n=[...lY(e)],r=new Set(e.env??[]);for(let i of e.env??[]){if(!Ss(i)){n.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${i}' geh\xF6rt nicht zum Vokabular (${xs.join(", ")}).`,en:`Declared environment key '${i}' is not in the vocabulary (${xs.join(", ")}).`}});continue}t!==void 0&&!t.has(i)&&n.push({severity:"error",path:"env",code:"env/unsupplied",message:{de:`Das Formular deklariert den Umgebungsschl\xFCssel '${i}', aber sein Host liefert ihn nicht.`,en:`The form declares environment key '${i}', but its host does not supply it.`}})}for(let i of e.testScenarios??[]){let o=[...r].filter(a=>Ss(a)&&!aN(a,i.env?.[a]));o.length>0&&n.push({severity:"error",path:`scenario:${i.id}/env`,code:"env/unsampled",message:{de:`Szenario '${i.id}' belegt den deklarierten Umgebungsschl\xFCssel ${o.map(a=>`'${a}'`).join(", ")} nicht vollst\xE4ndig \u2014 eine echte Bewerbung tr\xE4gt immer jedes seiner Felder (ein leeres als null).`,en:`Scenario '${i.id}' does not sample the declared environment key(s) ${o.map(a=>`'${a}'`).join(", ")} completely \u2014 a real application always carries every field of them (an empty one as null).`}});for(let a of Object.keys(i.env??{}))Ss(a)?r.has(a)||n.push({severity:"error",path:`scenario:${i.id}/env`,code:"env/undeclared",message:{de:`Szenario '${i.id}' belegt den Umgebungsschl\xFCssel '${a}', den das Formular nicht deklariert.`,en:`Scenario '${i.id}' samples environment key '${a}', which the form does not declare.`}}):n.push({severity:"error",path:`scenario:${i.id}/env`,code:"env/unknownKey",message:{de:`Szenario '${i.id}' belegt den unbekannten Umgebungsschl\xFCssel '${a}'.`,en:`Scenario '${i.id}' samples unknown environment key '${a}'.`}})}return n}s(fN,"formContextIssues");function lY(e){let t=[];Object.hasOwn(e,"context")&&t.push({severity:"error",path:"context",code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Formular deklariert die gelesene Umgebung als `env`.",en:"`context` is retired \u2014 a form declares the environment it reads as `env`."}});let n=e.testScenarios;for(let r of Array.isArray(n)?n:[])r!==null&&typeof r=="object"&&Object.hasOwn(r,"context")&&t.push({severity:"error",path:`scenario:${String(r.id)}/context`,code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Szenario belegt die Umgebung als `env`.",en:"`context` is retired \u2014 a scenario samples the environment as `env`."}});return t}s(lY,"retiredContextFields");function Xf(e,t,n){let r=Yf(e,t).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(n?.liveEnvKeys!==void 0)for(let o of cw(e,t)){let a=U_(o.path,n.liveEnvKeys);a===null&&F(`[condition] no live-key universe for '${o.path}' \u2014 extend liveKeyUniverse`),a.has(o.value)||i.push({de:`$env.${o.path} == '${o.value}' nennt keinen Schl\xFCssel dieses Mandanten.`,en:`$env.${o.path} == '${o.value}' names no key of this school.`})}for(let o of Zf($t(e),n?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(Xf,"envConditionFindings");function ep(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(ep,"isReviewField");function na(e){let t=[],n=[];function r(y,v){try{return $t(y)}catch(A){t.push({path:v,src:y,reason:A instanceof Error?A.message:String(A)});return}}s(r,"tryParse");function i(y,v){return{...y,visibleIf:y.visibleIf?r(y.visibleIf,`${v}.visibleIf`):void 0,requiredIf:y.requiredIf?r(y.requiredIf,`${v}.requiredIf`):void 0,disabledIf:y.disabledIf?r(y.disabledIf,`${v}.disabledIf`):void 0,defaultValue:y.defaultValue?r(y.defaultValue,`${v}.defaultValue`):void 0}}s(i,"compileField");function o(y,v){return{...y,visibleIf:y.visibleIf?r(y.visibleIf,`${v}.visibleIf`):void 0,fields:y.fields.map((A,E)=>i(A,`${v}.fields[${E}]`))}}s(o,"compileGroup");function a(y,v){return{...y,itemTemplate:y.itemTemplate.map((A,E)=>i(A,`${v}.itemTemplate[${E}]`)),effects:y.effects?.map((A,E)=>d(A,`${v}.effects[${E}]`)),itemVisibleIf:y.itemVisibleIf?r(y.itemVisibleIf,`${v}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(y,v){let A=[];return y.fields.forEach((E,I)=>{if(E.externalFlag){n.push({key:E.key,label:E.label,defaultValue:E.defaultValue?r(E.defaultValue,`${v}.fields[${I}].defaultValue`):void 0});return}A.push(i(E,`${v}.fields[${I}]`))}),{...y,visibleIf:y.visibleIf?r(y.visibleIf,`${v}.visibleIf`):void 0,fields:A,groups:y.groups?.map((E,I)=>o(E,`${v}.groups[${I}]`)),computed:y.computed?.map((E,I)=>{let C=r(E.expression,`${v}.computed[${I}].expression`);return{key:E.key,expression:C??{kind:"null"}}}),subsections:y.subsections?.map((E,I)=>l(E,`${v}.subsections[${I}]`)),repeated:y.repeated?.map((E,I)=>a(E,`${v}.repeated[${I}]`)),validators:y.validators}}s(l,"compileSection");function d(y,v){return{...y,when:y.when?r(y.when,`${v}.when`):void 0}}s(d,"compileEffect");function c(y,v){let A=r(y.when,`${v}.when`);return A?{...y,when:A}:null}s(c,"compileOutcome");let u=e.sections.map((y,v)=>l(y,`sections[${v}]`)),p=(e.effects??[]).map((y,v)=>d(y,`effects[${v}]`)),h=[],w=e.outcomes??[];for(let y=0;y<w.length;y++){let v=w[y],A=c(v,`outcomes[${y}]`);A&&h.push(A)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:n},errors:t}}s(na,"compileForm");var dY=new Set(["decision","review","governedDocument"]);function mN(e){return dY.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s(mN,"isReadinessGatedNode");function cY(e){let t=new Map,n=fY(e),r=s((i,o)=>{let a=ww(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&t.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:uY(d.bucket,n,a),section:a,type:d.type,enumSource:pN(d),repeated:!1,reviewRequired:d.reviewRequired===!0});for(let d of i.repeated??[])for(let c of d.itemTemplate){let u=`${d.key}.${c.key}`;t.set(u,{kind:"entered",key:u,label:c.label,qualifier:ww(d),section:a,type:c.type,enumSource:pN(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=Rt($t(d.expression));t.set(d.key,{kind:"computed",key:d.key,label:d.label??{de:d.key,en:d.key},qualifier:a,deps:c})}for(let d of i.subsections??[])r(d,o)},"visit");for(let i of e.sections)r(i,i);return t}s(cY,"formFieldCatalog");function pN(e){return e.type==="enum"?e:null}s(pN,"enumSourceOf");function uY(e,t,n){return e===void 0?n:t.get(e)??n}s(uY,"fieldQualifier");function fY(e){let t=new Map,n=s((r,i)=>{i===void 0||t.has(r)||t.set(r,ww(i))},"add");for(let r of gN(e))r.kind==="person"?n(r.bucket,r.display):r.kind==="organization"&&n(r.id.replace(/^o\./,""),r.display);return t}s(fY,"bucketWordings");function hN(e){return e.flatMap(t=>[t,...hN(t.subsections??[])])}s(hN,"allSections");function gN(e){return[...e.effects,...hN(e.sections).flatMap(t=>(t.repeated??[]).flatMap(n=>n.effects??[]))]}s(gN,"allEffects");function ww(e){return{label:e.label}}s(ww,"wordingOf");function yN(e){return xl(e).flatMap(({slot:t,address:n})=>{let r=YI(n);return r===null||vl.includes(r.path)?[]:[{slotId:t,owner:r.owner,fieldKey:r.path}]})}s(yN,"admissionBindingLeaves");function pY(e,t){let n=e.get(t);if(n===void 0)return null;let r=[],i=new Set,o=s(a=>{if(!i.has(a.key)&&(i.add(a.key),r.push({fieldKey:a.key,kind:a.kind}),a.kind==="computed"))for(let l of a.deps){let d=e.get(l);d!==void 0&&o(d)}},"walk");return o(n),r}s(pY,"expandKey");function mY(e){let t=new Set;for(let n of gN(e))if(!(n.kind!=="person"||n.contractParty===void 0)&&n.when!==void 0)for(let r of Rt($t(n.when)))t.add(r);return[...t]}s(mY,"contractPartyConditionKeys");function hY(e){return na(e).compiled.flags.map(t=>({key:t.key,name:t.label}))}s(hY,"formExternalFlags");function wN(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([t,n])=>[t,cY(n)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(mY(n))])),formFlagKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(hY(n).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set((n.views??[]).map(r=>r.key))]))}}s(wN,"readinessUniverse");function kw(e,t){let n=new Set;for(let r of t)for(let i of pY(e,r)??[])i.kind==="entered"&&n.add(i.fieldKey);return n}s(kw,"enteredFieldsBehind");var gY=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function yY(e){return gY.has(e)?!0:kN(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(yY,"isTextKey");function kN(e){return/^localized[A-Z]/.test(e)}s(kN,"isLegacyTwinKey");var wY=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),kY=new Set(["inputs","resolver","library"]);function np(e,t){let n=[];return bw(e,t,n),n}s(np,"findUnlocalizedTexts");function bw(e,t,n){if(Array.isArray(e)){e.forEach((i,o)=>bw(i,`${t}[${vY(i,o)}]`,n));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${t}.${i}`;if(!kY.has(i)){if(kN(i)){n.push({path:a,missing:"legacy-twin"});continue}if(yY(i)){bY(o,a,n);continue}if(wY.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&bN(d,`${a}.${l}`,n);continue}bw(o,a,n)}}}s(bw,"walk");function bY(e,t,n){e!=null&&bN(e,t,n)}s(bY,"checkText");function bN(e,t,n){let r=Tt(e);(r==="not-localized"||r.length>0)&&n.push({path:t,missing:r})}s(bN,"report");function vY(e,t){if(e!==null&&typeof e=="object"){let n=e;if(typeof n.id=="string")return n.id;if(typeof n.key=="string")return n.key}return String(t)}s(vY,"keyOf");function tp(e,t){return e==="not-localized"?t==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?t==="de"?'ist ein Zwilling der alten Form \u2014 der Text geh\xF6rt in das Feld ohne \u201Elocalized"':'is a twin of the old shape \u2014 the text belongs in the field without "localized"':t==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(tp,"describe");function vw({path:e,missing:t}){return t==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${tp(t,"de")}.`,en:`[i18n/legacyTwin] ${e} ${tp(t,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${tp(t,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${tp(t,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(vw,"unlocalizedTextReason");var xY={engagePush:["engage"]};function SY(e){let t=xY[e.type];return t===void 0?e:Object.fromEntries(Object.entries(e).filter(([n])=>!t.includes(n)))}s(SY,"withoutMachineData");function vN(e,t){return[...np(e.nodes.map(SY),"nodes"),...t===void 0?[]:np(t,`layout.${t.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:vw(r),severity:"error"}))}s(vN,"checkLocalizedTexts");var $o=5,Ro=480;function ii(e){return typeof e=="string"&&e.trim().length>0}s(ii,"isNonEmptyString");function SN(e,t,n){return Object.keys(e).filter(r=>!t.includes(r)).map(r=>({field:`result.${r}`,code:tt.unknownField,message:{de:`Unbekanntes Feld '${r}' im ${n.de}; erlaubt sind: ${t.join(", ")}.`,en:`Unknown field '${r}' in the ${n.en}; allowed: ${t.join(", ")}.`}}))}s(SN,"unknownFieldIssues");function AY(e){let t=[],n=e.title;(n===void 0||typeof n!="object"||n===null||!ii(n.de)||!ii(n.en))&&t.push({field:"result.title",code:tt.appointmentMissingTitle,message:{de:"Ein Termin-Ergebnis braucht einen neutralen Titel in beiden Sprachen ({ de, en }) \u2014 er steht in der Mail und in der Kalenderdatei der Familie, deshalb nie ein Familienname.",en:"An appointment result needs a neutral title in both languages ({ de, en }) \u2014 it appears in the email and in the family's calendar file, so never a family name."}});let r=e.durationMinutes;return(typeof r!="number"||!Number.isInteger(r)||r<$o||r>Ro)&&t.push({field:"result.durationMinutes",code:tt.appointmentInvalidDuration,message:{de:`'durationMinutes' muss eine ganze Zahl von ${$o} bis ${Ro} sein, erhalten ${JSON.stringify(r)}.`,en:`'durationMinutes' must be a whole number from ${$o} to ${Ro}, got ${JSON.stringify(r)}.`}}),t.push(...SN(e,["kind","title","durationMinutes"],{de:"Termin-Ergebnis",en:"appointment result"})),t}s(AY,"appointmentIssues");function xN(e){if(typeof e!="object"||e===null)return!1;let t=e;return ii(t.de)&&ii(t.en)}s(xN,"isBilingual");var xw=["key","type","label","writes","options","min","suggest","evidence","evidenceFrom"];function EY(e){let t=s((i,o)=>({field:i,code:tt.recordFields,message:o}),"issue");if(!Array.isArray(e)||e.length===0)return[t("result.fields",{de:"Eine Erfassung braucht mindestens ein Feld ('result.fields').",en:"A record needs at least one field ('result.fields')."})];let n=[],r=new Set;for(let[i,o]of e.entries()){let a=`result.fields[${i}]`;if(typeof o!="object"||o===null||Array.isArray(o)){n.push(t(a,{de:"Ein Feld der Erfassung muss ein Objekt sein.",en:"A field of the record must be an object."}));continue}let l=o,d=l.key;typeof d!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(d)?n.push(t(`${a}.key`,{de:`Feld-Schl\xFCssel ${JSON.stringify(d)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,en:`Field key ${JSON.stringify(d)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`})):r.has(d)?n.push(t(`${a}.key`,{de:`Feld-Schl\xFCssel "${d}" ist doppelt.`,en:`Field key "${d}" is duplicated.`})):r.add(d);let c=typeof d=="string"?`"${d}"`:`Nr. ${i+1}`,u=typeof d=="string"?`"${d}"`:`no. ${i+1}`;if(gy(l.type)||n.push(t(`${a}.type`,{de:`Feld ${c}: Typ ${JSON.stringify(l.type)} \u2014 erlaubt: ${gf.join(", ")}.`,en:`Field ${u}: type ${JSON.stringify(l.type)} \u2014 allowed: ${gf.join(", ")}.`})),xN(l.label)||n.push(t(`${a}.label`,{de:`Feld ${c} braucht ein Label in beiden Sprachen ({ de, en }).`,en:`Field ${u} needs a label in both languages ({ de, en }).`})),ii(l.writes)||n.push(t(`${a}.writes`,{de:`Feld ${c} schreibt in keinen Vorgangs-Schl\xFCssel ('writes') \u2014 ein Wert, den niemand lesen kann, geh\xF6rt nicht in eine Erfassung.`,en:`Field ${u} writes to no process key ('writes') \u2014 a value nobody can read does not belong in a record.`})),l.type==="enum"){let h=Array.isArray(l.options)?l.options:[],w=h.map(k=>k.key);(h.length<2||w.some(k=>typeof k!="string"||k.length===0)||new Set(w).size!==w.length||h.some(k=>!xN(k.label)))&&n.push(t(`${a}.options`,{de:`Feld ${c} (Auswahl) braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln und Labels in beiden Sprachen.`,en:`Field ${u} (choice) needs at least 2 options with unique keys and labels in both languages.`}))}else l.options!==void 0&&n.push(t(`${a}.options`,{de:`Feld ${c}: 'options' gibt es nur bei Typ 'enum'.`,en:`Field ${u}: 'options' exists only for type 'enum'.`}));if(l.min!==void 0&&(l.type!=="number"||typeof l.min!="number"||!Number.isInteger(l.min))&&n.push(t(`${a}.min`,{de:`Feld ${c}: 'min' gibt es nur bei Typ 'number', als ganze Zahl.`,en:`Field ${u}: 'min' exists only for type 'number', as a whole number.`})),l.evidence!==void 0&&typeof l.evidence!="boolean"&&n.push(t(`${a}.evidence`,{de:`Feld ${c}: 'evidence' ist true oder false.`,en:`Field ${u}: 'evidence' is true or false.`})),l.evidenceFrom!==void 0){let h=typeof l.min=="number"?l.min:0;(l.type!=="number"||l.evidence!==!0||typeof l.evidenceFrom!="number"||!Number.isInteger(l.evidenceFrom)||l.evidenceFrom<=h)&&n.push(t(`${a}.evidenceFrom`,{de:`Feld ${c}: 'evidenceFrom' gibt es nur bei Typ 'number' mit 'evidence', als ganze Zahl \xFCber dem Minimum (${h}) \u2014 sonst g\xE4lte der Nachweis immer.`,en:`Field ${u}: 'evidenceFrom' exists only for type 'number' with 'evidence', as a whole number above the minimum (${h}) \u2014 otherwise the proof would always apply.`}))}if(l.suggest!==void 0){let h=l.suggest,w=typeof h=="object"&&h!==null?h.kind:void 0;w==="form"&&"address"in h&&Object.keys(h).length===2&&(!xe(h.address)||ct(h.address))||w==="siblingRank"&&Object.keys(h).length===1&&l.type==="number"||n.push({field:`${a}.suggest`,code:tt.recordSuggest,message:{de:`Feld ${c}: Vorschlag ${JSON.stringify(l.suggest)} \u2014 erlaubt: { kind: 'form', address: '$node.<formular>.admission.<export>' } oder { kind: 'siblingRank' } (nur bei Typ 'number'); bekannte Arten: ${yy.join(", ")}.`,en:`Field ${u}: suggestion ${JSON.stringify(l.suggest)} \u2014 allowed: { kind: 'form', address: '$node.<form>.admission.<export>' } or { kind: 'siblingRank' } (only for type 'number'); known kinds: ${yy.join(", ")}.`}})}let p=Object.keys(l).filter(h=>!xw.includes(h));p.length>0&&n.push(t(a,{de:`Feld ${c}: unbekannte Angabe ${p.map(h=>`'${h}'`).join(", ")}; erlaubt: ${xw.join(", ")}.`,en:`Field ${u}: unknown entry ${p.map(h=>`'${h}'`).join(", ")}; allowed: ${xw.join(", ")}.`}))}return n}s(EY,"recordFieldIssues");function TY(e,t,n){let r=[],i=t.options;if(e==="choice"){let o=Array.isArray(i)?i:[],a=o.map(l=>l.key);(o.length<2||a.some(l=>typeof l!="string"||l.length===0)||new Set(a).size!==a.length)&&r.push({field:"result.options",code:tt.choiceOptions,message:{de:`Ein Auswahl-Ergebnis braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln, erhalten ${JSON.stringify(a)}.`,en:`A choice result needs at least 2 options with unique keys, got ${JSON.stringify(a)}.`}})}else i!==void 0&&r.push({field:"result.options",code:tt.choiceOptions,message:{de:`'result.options' gibt es nur bei 'choice' \u2014 ${e==="recommendation"?"eine Empfehlung hat die festen Tendenzen Positiv/Neutral/Negativ":"ein Freitext hat keine Auswahl"}.`,en:`'result.options' exists only for 'choice' \u2014 ${e==="recommendation"?"a recommendation has the fixed leanings Positive/Neutral/Negative":"a free text has no choice"}.`}});if(e==="pricedItem"){let o=t.item;if(!ii(o))r.push({field:"result.item",code:tt.pricedItemMissingItem,message:{de:"Ein Preispositions-Ergebnis nennt den Artikel, den es bepreist \u2014 'result.item' (der Schl\xFCssel des Artikels, z. B. 'tuition') fehlt.",en:"A priced-item result names the article it prices \u2014 'result.item' (the article's key, e.g. 'tuition') is missing."}});else if(n.billingItemKeys!==void 0&&!n.billingItemKeys.has(o))r.push({field:"result.item",code:tt.pricedItemUnknownItem,message:{de:`'result.item' "${o}" \u2014 kein Artikel dieses Mandanten tr\xE4gt diesen Schl\xFCssel (bekannt: ${[...n.billingItemKeys].join(", ")||"keine"}).`,en:`'result.item' "${o}" \u2014 no article of this school has this key (known: ${[...n.billingItemKeys].join(", ")||"none"}).`}});else if(n.offerProgram===null)r.push({field:"result.item",code:tt.pricedItemOfferWithoutProgram,message:{de:`'result.item' "${o}" \u2014 das Angebot ist keinem Programm zugeordnet, also geh\xF6rt kein Artikel zu ihm; dem Angebot ein Programm geben.`,en:`'result.item' "${o}" \u2014 the offer is not assigned to a program, so no article belongs to it; give the offer a program.`}});else if(n.offerProgram!==void 0&&!n.offerProgram.billingItemKeys.has(o)){let l=n.offerProgram;r.push({field:"result.item",code:tt.pricedItemNotInProgram,message:{de:`'result.item' "${o}" \u2014 der Artikel ist dem Programm \u201E${l.nameDe}\u201C des Angebots nicht zugeordnet (zugeordnet: ${[...l.billingItemKeys].join(", ")||"keine"}); unter Finanzen \u2192 Artikel zuordnen, direkt oder \xFCber ein Paket.`,en:`'result.item' "${o}" \u2014 the article is not assigned to the offer's program "${l.nameDe}" (assigned: ${[...l.billingItemKeys].join(", ")||"none"}); assign it under Finance \u2192 articles, directly or through a package.`}})}let a=t.label;(typeof a!="object"||a===null||!ii(a.de)||!ii(a.en))&&r.push({field:"result.label",code:tt.labelMissing,message:{de:"Ein Preispositions-Ergebnis braucht einen Namen f\xFCr seinen Wert in beiden Sprachen ('result.label', z. B. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 so hei\xDFt er im Workflow und in der Verdrahtung.",en:"A priced-item result needs a name for its value in both languages ('result.label', e.g. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 that is what it is called in the workflow and in the wiring."}})}else t.item!==void 0&&r.push({field:"result.item",code:tt.itemOnNonPricedItem,message:{de:`'result.item' gibt es nur bei 'pricedItem' \u2014 ein ${e}-Ergebnis bepreist keinen Artikel.`,en:`'result.item' exists only for 'pricedItem' \u2014 a ${e} result prices no article.`}});if(e==="record"?(r.push(...EY(t.fields)),t.writes!==void 0&&r.push({field:"result.writes",code:tt.writesOnProse,message:{de:"Eine Erfassung schreibt je Feld ('fields[].writes'), nie als Ganzes ('result.writes').",en:"A record writes per field ('fields[].writes'), never as a whole ('result.writes')."}}),t.label!==void 0&&r.push({field:"result.label",code:tt.unknownField,message:{de:"Eine Erfassung benennt ihre Werte je Feld ('fields[].label'), nicht als Ganzes ('result.label').",en:"A record names its values per field ('fields[].label'), not as a whole ('result.label')."}})):t.fields!==void 0&&r.push({field:"result.fields",code:tt.fieldsOnNonRecord,message:{de:`'result.fields' gibt es nur bei 'record' \u2014 ein ${e}-Ergebnis hat keine Felder.`,en:`'result.fields' exists only for 'record' \u2014 a ${e} result has no fields.`}}),e==="reduction"&&(ii(t.writes)||r.push({field:"result.writes",code:tt.reductionPrices,message:{de:"Eine Reduktion schreibt ihren Betrag in einen Vorgangs-Schl\xFCssel vom Typ reduction ('result.writes') \u2014 sonst l\xE4se ihn kein Preis.",en:"A reduction writes its amount to a process key of type reduction ('result.writes') \u2014 otherwise no price would read it."}})),t.writes!==void 0&&(e==="freetext"||e==="recommendation")&&r.push({field:"result.writes",code:tt.writesOnProse,message:{de:`'result.writes' gibt es nur bei Ergebnissen mit Wert (Auswahl, Preisposition) \u2014 ein ${e}-Ergebnis bleibt im Chat und schreibt nichts in den Vorgang.`,en:`'result.writes' exists only for results with a value (choice, priced item) \u2014 a ${e} result stays in the chat and writes nothing to the process.`}}),e==="freetext"&&t.textRequired!==void 0&&r.push({field:"result.textRequired",code:tt.textRequiredOnFreetext,message:{de:"'textRequired' auf einem Freitext-Ergebnis \u2014 der Text eines Freitexts ist immer Pflicht; die Angabe entfernen.",en:"'textRequired' on a free-text result \u2014 the text of a free text is always required; remove the entry."}}),t.chat===void 0)r.push({field:"result.chat",code:tt.chatMissing,message:{de:"Ein Aufgaben-Ergebnis steht nur im Chat \u2014 'result.chat' fehlt: 'all', 'team:<Gruppe>' oder einen Kanal des Workflows angeben.",en:"A task result appears only in the chat \u2014 'result.chat' is missing: give 'all', 'team:<group>' or a channel of the workflow."}});else{let o=t.chat,a=typeof o=="string"?Is(o):null;o==="external"||a===null?r.push({field:"result.chat",code:tt.chatExternal,message:{de:`'result.chat' ${JSON.stringify(o)} \u2014 ein Aufgaben-Ergebnis bleibt intern: erlaubt sind 'all', 'team:<Gruppe>' oder ein Kanal des Workflows, nie 'external'.`,en:`'result.chat' ${JSON.stringify(o)} \u2014 a task result stays internal: 'all', 'team:<group>' or a channel of the workflow are allowed, never 'external'.`}}):a.kind==="channel"&&!n.channelKeys.has(a.channelKey)&&r.push({field:"result.chat",code:tt.chatUnknownChannel,message:{de:`'result.chat' "${a.channelKey}" ist weder 'all' noch 'team:<Gruppe>' noch ein Kanal des Workflows (bekannt: ${[...n.channelKeys].join(", ")||"keine"}).`,en:`'result.chat' "${a.channelKey}" is neither 'all' nor 'team:<group>' nor a channel of the workflow (known: ${[...n.channelKeys].join(", ")||"none"}).`}})}return r.push(...SN(t,["kind","options","textRequired","chat","item","label","writes","fields","prices"],{de:"Aufgaben-Ergebnis",en:"task result"})),r}s(TY,"recordedIssues");function AN(e,t,n={channelKeys:new Set}){if(t===void 0)return[];if(e!=="task")return[{field:"result",code:tt.onApproval,message:{de:`'result' gilt nur f\xFCr die Art 'task' \u2014 eine '${e}' wird durch ihr Votum abgeschlossen, nicht durch ein Ergebnis.`,en:`'result' applies only to the kind 'task' \u2014 an '${e}' is completed by its vote, not by a result.`}}];if(typeof t!="object"||t===null||Array.isArray(t))return[{field:"result",code:tt.unknownKind,message:{de:`'result' muss ein Objekt mit 'kind' sein; bekannte Arten: ${$s.join(", ")}.`,en:`'result' must be an object with 'kind'; known kinds: ${$s.join(", ")}.`}}];let r=t;return NI(r.kind)?r.kind==="appointment"?AY(r):TY(r.kind,r,n):[{field:"result.kind",code:tt.unknownKind,message:{de:`Unbekannte Ergebnisart ${JSON.stringify(r.kind)}; bekannte Arten: ${$s.join(", ")}.`,en:`Unknown result kind ${JSON.stringify(r.kind)}; known kinds: ${$s.join(", ")}.`}}]}s(AN,"taskResultIssues");var Sw=60;function oi(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(oi,"error");function $Y(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"warning"}}s($Y,"warning");function EN(e){return Array.isArray(e.tasks)?e.tasks:[]}s(EN,"tasksOf");function $N(e,t){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(r=>r.action==="spawnTasks"&&Array.isArray(r.tasks)&&r.tasks.includes(t))}s($N,"spawnActionsOf");function TN(e,t){return $N(e,t).map(n=>String(n.key)).sort()}s(TN,"bindingsOf");function RN(e,t){let n=[],r=EN(e),i=new Map;for(let o of r){if(o.appointment===void 0)continue;let a=typeof o.key=="string"?o.key:"?",l=`nodes.${e.id}.tasks.${a}`,d={de:`Terminaufgabe "${a}" (Knoten "${e.id}")`,en:`Appointment task "${a}" (node "${e.id}")`},c=o.appointment,p=typeof c=="object"&&c!==null&&Object.keys(c).every($=>$==="of"||$==="dueDaysAfterEnd")&&typeof c.of=="string"?c.of:void 0,h=p===void 0?void 0:r.find($=>$.key===p),w=h?.result;if(p===void 0||h===void 0||w?.kind!=="appointment")n.push(oi(`${l}.appointment.of`,{de:`[workItems/appointmentOfUnknown] ${d.de} braucht 'appointment: { of, dueDaysAfterEnd }', und 'of' nennt eine Aufgabe desselben Knotens, die mit einem Termin abschlie\xDFt (result.kind 'appointment'); erhalten ${JSON.stringify(o.appointment)}.`,en:`[workItems/appointmentOfUnknown] ${d.en} needs 'appointment: { of, dueDaysAfterEnd }', and 'of' names a task of the same node that ends with an appointment (result.kind 'appointment'); got ${JSON.stringify(o.appointment)}.`}));else{i.set(p,(i.get(p)??0)+1);let $=h.blocks,b=[...["when","optional"].filter(R=>h[R]!==void 0),...typeof $?.node=="string"&&$.node!==e.id?["blocks"]:[]];b.length>0&&n.push(oi(`nodes.${e.id}.tasks.${p}.${b[0]}`,{de:`[workItems/appointmentTaskShape] "${p}" bucht den Termin f\xFCr ${d.de} und tr\xE4gt ${b.map(R=>R==="blocks"?"ein knoten\xFCbergreifendes 'blocks'":`'${R}'`).join(", ")} \u2014 fiele sie ohne Buchung weg oder \xFCberlebte sie ihren Knoten, wartete die Terminaufgabe f\xFCr immer bzw. f\xE4nde die Buchung keine Terminaufgabe mehr.`,en:`[workItems/appointmentTaskShape] "${p}" books the appointment for ${d.en} and carries ${b.map(R=>R==="blocks"?"a cross-node 'blocks'":`'${R}'`).join(", ")} \u2014 if it dropped out without a booking or outlived its node, the appointment task would wait forever or the booking would find no appointment task any more.`}));for(let R of $N(e,p))R.repeatable!==!0&&n.push(oi(`nodes.${e.id}.optionalActions.${String(R.key)}.repeatable`,{de:`[workItems/appointmentActionRepeatable] Die optionale Aktion "${String(R.key)}" legt "${p}" an, die den Termin f\xFCr ${d.de} bucht, und ist nicht 'repeatable: true'. Eine Absage beendet die Runde; ohne zweite Runde lie\xDFe sich die Aktion nie wieder ausl\xF6sen, und eine Entscheidung, die auf sie wartet (requiresOneOf), bliebe h\xE4ngen.`,en:`[workItems/appointmentActionRepeatable] The optional action "${String(R.key)}" creates "${p}", which books the appointment for ${d.en}, and is not 'repeatable: true'. A cancellation ends the round; without a second round the action could never be triggered again, and a decision waiting for it (requiresOneOf) would hang.`}));TN(e,a).join(",")!==TN(e,p).join(",")&&n.push(oi(`${l}.appointment.of`,{de:`[workItems/appointmentTaskBinding] ${d.de} geh\xF6rt zu anderen optionalen Aktionen als "${p}", die ihren Termin bucht \u2014 beide Zeilen sind eine Runde: entweder beide in derselben Aktion (spawnTasks) oder beide in keiner.`,en:`[workItems/appointmentTaskBinding] ${d.en} belongs to different optional actions than "${p}", which books its appointment \u2014 both rows are one round: either both in the same action (spawnTasks) or both in none.`}))}let k=c?.dueDaysAfterEnd;(typeof k!="number"||!Number.isInteger(k)||k<0||k>Sw)&&n.push(oi(`${l}.appointment.dueDaysAfterEnd`,{de:`[workItems/appointmentTaskDue] ${d.de}: 'dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${Sw} \u2014 die Tage nach dem Terminende, bis die Aufgabe f\xE4llig ist; erhalten ${JSON.stringify(k)}.`,en:`[workItems/appointmentTaskDue] ${d.en}: 'dueDaysAfterEnd' is a whole number from 0 to ${Sw} \u2014 the days after the appointment ends until the task is due; got ${JSON.stringify(k)}.`})),o.params?.dueInDays!==void 0&&n.push(oi(`${l}.params.dueInDays`,{de:`[workItems/appointmentTaskDue] ${d.de} tr\xE4gt 'params.dueInDays' neben 'appointment.dueDaysAfterEnd' \u2014 eine Terminaufgabe ist ab dem Terminende f\xE4llig, nie ab ihrer Anlage.`,en:`[workItems/appointmentTaskDue] ${d.en} carries 'params.dueInDays' next to 'appointment.dueDaysAfterEnd' \u2014 an appointment task is due from the end of the appointment, never from its creation.`}));let y=o.result,v=["when","optional","familyRequest","reads","locksEvidence"].filter($=>o[$]!==void 0).map($=>`'${$}'`),A=typeof o.blocks?.node=="string"&&o.blocks.node!==e.id,E=s($=>[...o.kind!=="task"?["'kind: approval'"]:[],...y===void 0||!_i(y.kind)?[$==="de"?"kein erfasstes Ergebnis (Feedback)":"no recorded result (feedback)"]:[],...v,...A?[$==="de"?"ein knoten\xFCbergreifendes 'blocks'":"a cross-node 'blocks'"]:[]],"shapeFaults");E("de").length>0&&n.push(oi(`${l}.appointment`,{de:`[workItems/appointmentTaskShape] ${d.de}: ${E("de").join(", ")} \u2014 eine Terminaufgabe ist eine Aufgabe, die mit ihrem Feedback (Freitext, Empfehlung, Auswahl) abschlie\xDFt, und sie entsteht, weil der Termin entsteht: ohne Bedingung, nicht optional, keine Nachforderung, ohne Belege (nichts l\xE4sst sie ungebunden neu entstehen) und an ihrem Knoten.`,en:`[workItems/appointmentTaskShape] ${d.en}: ${E("en").join(", ")} \u2014 an appointment task is a task that ends with its feedback (free text, recommendation, choice), and it exists because the appointment exists: no condition, not optional, no follow-up request, no evidence (nothing lets it be created again unbound) and on its own node.`}));let I=o.result?.chat,C=o.assign?.group;typeof I=="string"&&I.startsWith("team:")&&typeof C=="string"&&I!==`team:${C}`&&n.push($Y(`${l}.result.chat`,{de:`[workItems/appointmentChatUnreadable] ${d.de} schreibt ihr Feedback in "${I}", geh\xF6rt aber dem Team "${C}" \u2014 die Gastgeberin bzw. der Gastgeber (ein Mitglied von "${C}") kann das eigene Feedback dort wom\xF6glich nicht lesen. 'team:${C}' oder 'all' w\xE4hlen, oder das Team als Mitglied des Chats sicherstellen.`,en:`[workItems/appointmentChatUnreadable] ${d.en} writes its feedback to "${I}", but belongs to the team "${C}" \u2014 the host (a member of "${C}") may not be able to read their own feedback there. Choose 'team:${C}' or 'all', or make sure the team is a member of the chat.`}));for(let $ of t)for(let b of EN($)){let R=b.blocks;R?.templateKey!==a||(typeof R.node=="string"?R.node:$.id)!==e.id||n.push(oi(`nodes.${$.id}.tasks.${String(b.key)}.blocks.templateKey`,{de:`[workItems/appointmentTaskBlocked] Task "${String(b.key)}" (Knoten "${$.id}") h\xE4lt ${d.de} zur\xFCck \u2014 eine Terminaufgabe wartet nur auf ihren Termin (abgeleitet aus 'appointment.of'); ein 'blocks' auf sie entf\xE4llt.`,en:`[workItems/appointmentTaskBlocked] Task "${String(b.key)}" (node "${$.id}") holds back ${d.en} \u2014 an appointment task only waits for its appointment (derived from 'appointment.of'); a 'blocks' on it is dropped.`}))}}for(let[o,a]of i)a<2||n.push(oi(`nodes.${e.id}.tasks.${o}`,{de:`[workItems/appointmentOfTwice] ${a} Terminaufgaben auf Knoten "${e.id}" geh\xF6ren zum Termin von "${o}" \u2014 ein Termin hat eine Terminaufgabe.`,en:`[workItems/appointmentOfTwice] ${a} appointment tasks on node "${e.id}" belong to the appointment of "${o}" \u2014 an appointment has one appointment task.`}));return n}s(RN,"appointmentTaskIssues");var RY="optionalAction:";function IN(e){return`${RY}${e}:trigger`}s(IN,"optionalActionTriggerActionId");var IY="processDecide";function ON(e){let t=e.optionalActions;return t==null?[]:(Array.isArray(t)||F(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof t}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),t)}s(ON,"optionalActionBindings");function _N(e){return ON(e).map(t=>({id:IN(t.key),kind:"internal",label:t.label,surface:IY,placement:"overflow",superUserOnly:!0}))}s(_N,"optionalActionTriggers");function NN(e){let t=new Set;for(let n of ON(e))if(n.action==="spawnTasks")for(let r of n.tasks??[])t.add(r);return t}s(NN,"referencedTaskTemplateKeys");var xn={notOptionalAction:"[workItems/familyRequestNotOptionalAction]",notTask:"[workItems/familyRequestNotTask]",closedOtherwise:"[workItems/familyRequestClosedOtherwise]",blocks:"[workItems/familyRequestBlocks]",noDeadline:"[workItems/familyRequestNoDeadline]",fields:"[workItems/familyRequestFields]",unknownField:"[workItems/familyRequestUnknownField]",shape:"[workItems/familyRequestShape]",twicePerAction:"[workItems/familyRequestTwicePerAction]",deadlock:"[workItems/familyRequestOnlyWayButAsked]"};function Sn(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${t} ${n.de}`,en:`${t} ${n.en}`},severity:"error"}}s(Sn,"issue");function OY(e,t,n){return e.flatMap(r=>(Array.isArray(r.tasks)?r.tasks:[]).filter(i=>{let o=i.blocks,a=typeof o?.node=="string"?o.node:r.id;return o?.templateKey===n&&a===t}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(OY,"blockersOf");function CN(e){let{graph:t,node:n,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${n.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${Oe(t,n.id,"de")}\u201C (${n.id})`,en:`Task "${o}" on node "${Oe(t,n.id,"en")}" (${n.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Sn(`${a}.familyRequest`,xn.shape,{de:`${l.de}: 'familyRequest' muss ein Objekt { fields } oder { from } sein.`,en:`${l.en}: 'familyRequest' must be an object { fields } or { from }.`})];let c=Object.keys(i).filter(k=>k!=="fields"&&k!=="from");c.length>0&&d.push(Sn(`${a}.familyRequest.${c[0]}`,xn.shape,{de:`${l.de}: 'familyRequest' kennt nur 'fields' oder 'from', nicht ${c.map(k=>`'${k}'`).join(", ")} \u2014 was angefordert wird und der Text an die Familie werden beim Ausl\xF6sen gew\xE4hlt.`,en:`${l.en}: 'familyRequest' only knows 'fields' or 'from', not ${c.map(k=>`'${k}'`).join(", ")} \u2014 what is requested and the text to the family are chosen when the action is triggered.`}));let{fields:u,from:p}=i;u===void 0==(p===void 0)&&d.push(Sn(`${a}.familyRequest`,xn.shape,{de:`${l.de}: 'familyRequest' nennt genau eines \u2014 'fields' (die anforderbaren Felder) oder 'from' (das Formular, dessen Dateifelder alle zur Wahl stehen).`,en:`${l.en}: 'familyRequest' names exactly one \u2014 'fields' (the fields that can be requested) or 'from' (the form whose file fields are all available).`})),e.onTrigger.has(o)||d.push(Sn(`${a}.familyRequest`,xn.notOptionalAction,{de:`${l.de} fordert bei der Familie an, geh\xF6rt aber zu keiner optionalen Aktion (spawnTasks) \u2014 nur deren Ausl\xF6sen \xF6ffnet die Anfrage an die Familie.`,en:`${l.en} requests from the family but belongs to no optional action (spawnTasks) \u2014 only triggering one opens the request to the family.`})),r.kind!=="task"&&d.push(Sn(`${a}.kind`,xn.notTask,{de:`${l.de} fordert bei der Familie an und muss die Art 'task' haben, nicht ${JSON.stringify(r.kind)}.`,en:`${l.en} requests from the family and must have the kind 'task', not ${JSON.stringify(r.kind)}.`}));for(let k of["result","when","locksEvidence","gatesNode"])r[k]!==void 0&&d.push(Sn(`${a}.${k}`,xn.closedOtherwise,{de:`${l.de} wartet auf die Familie und erledigt sich mit ihrer Antwort \u2014 '${k}' passt nicht dazu.`,en:`${l.en} waits for the family and completes with their answer \u2014 '${k}' does not fit that.`}));r.blocks!==void 0&&d.push(Sn(`${a}.blocks`,xn.blocks,{de:`${l.de} wartet auf die Familie und darf nichts zur\xFCckhalten ('blocks') \u2014 sie h\xE4lt ihren Knoten schon als Aufgabe einer optionalen Aktion.`,en:`${l.en} waits for the family and must not hold anything back ('blocks') \u2014 as the task of an optional action it already holds its node.`}));for(let k of OY(t.nodes,n.id,o))d.push(Sn(`nodes.${k.nodeId}.tasks.${k.key}.blocks`,xn.blocks,{de:`Task "${k.key}" auf Knoten "${k.nodeId}" h\xE4lt ${l.de} zur\xFCck \u2014 eine Nachforderung darf nie zur\xFCckgehalten werden: zur\xFCckgehalten h\xE4tte sie keine Frist und k\xF6nnte mit der Antwort der Familie nicht erledigt werden.`,en:`Task "${k.key}" on node "${k.nodeId}" holds back ${l.en} \u2014 a follow-up request must never be held back: held back, it would have no deadline and could not be completed by the family's answer.`}));let h=r.params?.dueInDays;if((typeof h!="number"||!Number.isInteger(h)||h<1)&&d.push(Sn(`${a}.params.dueInDays`,xn.noDeadline,{de:`${l.de} fordert bei der Familie an und braucht eine Frist in ganzen Tagen ('params.dueInDays' \u2265 1) \u2014 sie ist die Frist der Familie und Anlass der Erinnerung.`,en:`${l.en} requests from the family and needs a deadline in whole days ('params.dueInDays' \u2265 1) \u2014 it is the family's deadline and the reason for the reminder.`})),u===void 0)return d;if(!Array.isArray(u)||u.length===0)return d.push(Sn(`${a}.familyRequest.fields`,xn.fields,{de:`${l.de}: 'familyRequest.fields' muss mindestens ein Feld eines Formulars nennen \u2014 oder statt dessen 'from' das Formular, dann stehen alle seine Dateifelder zur Wahl.`,en:`${l.en}: 'familyRequest.fields' must name at least one field of a form \u2014 or 'from' the form instead, then all its file fields are available.`})),d;let w=new Set;for(let k of u){if(!xe(k))continue;let y=pe(k);if(w.has(y)){d.push(Sn(`${a}.familyRequest.fields`,xn.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${je(t,k,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${je(t,k,"en")} more than once.`}));continue}w.add(y),ct(k)||d.push(Sn(`${a}.familyRequest.fields`,xn.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${je(t,k,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${je(t,k,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(CN,"familyRequestIssues");function PN(e){let t=new Set((Array.isArray(e.tasks)?e.tasks:[]).flatMap(r=>r.familyRequest!==void 0&&typeof r.key=="string"?[r.key]:[]));return(Array.isArray(e.optionalActions)?e.optionalActions:[]).flatMap((r,i)=>{if(r.action!=="spawnTasks"||!Array.isArray(r.tasks))return[];let o=r.tasks.filter(a=>typeof a=="string"&&t.has(a));return o.length<=1?[]:[Sn(`nodes.${e.id}.optionalActions.${i}.tasks`,xn.twicePerAction,{de:`Optionale Aktion \u201E${String(r.key)}\u201C auf Knoten "${e.id}" startet ${o.length} Nachforderungen (${o.join(", ")}) \u2014 ein Ausl\xF6sen fragt die Familie nach EINER Sache; h\xF6chstens eine Nachforderung je Aktion.`,en:`Optional action "${String(r.key)}" on node "${e.id}" starts ${o.length} follow-up requests (${o.join(", ")}) \u2014 one trigger asks the family for ONE thing; at most one follow-up request per action.`})]})}s(PN,"familyRequestActionIssues");function DN(e,t){let n=e.nodes,r=new Map;for(let a of n)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)ct(l)&&r.set(pe(l),l);if(r.size===0)return[];let i=s(a=>{let l=ni(t,a);return l===void 0||l!==null&&l.kind==="entered"&&l.type==="docRef"},"isFileField"),o=s(a=>{let{fields:l,from:d}=a??{};return Array.isArray(l)?l.filter(ct):!xe(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return n.flatMap(a=>{let l=Array.isArray(a.requiresOneOf)?a.requiresOneOf:[],c=(Array.isArray(a.optionalActions)?a.optionalActions:[]).filter(h=>l.includes(h.key)),u=Array.isArray(a.tasks)?a.tasks:[];return c.filter(h=>Array.isArray(h.tasks)&&c.every(w=>w===h||w.when!==void 0)).flatMap(h=>u.flatMap(w=>{if(w.familyRequest===void 0||!h.tasks.includes(w.key))return[];let k=o(w.familyRequest).filter(y=>r.has(pe(y)));return k.length===0?[]:[{...Sn(`nodes.${a.id}.requiresOneOf`,xn.deadlock,{de:`Auf Knoten \u201E${Oe(e,a.id,"de")}\u201C (${a.id}) ist die Nachforderung \u201E${String(h.key)}\u201C der einzige Weg durch 'requiresOneOf', und eine Vollst\xE4ndigkeitspr\xFCfung fragt dieselben Felder an (${k.map(y=>je(e,y,"de")).join(", ")}). Ist deren Anfrage offen, lassen sich diese Felder nicht nachfordern \u2014 die Entscheidung bliebe gesperrt. Eine zweite Aktion in 'requiresOneOf' oder andere Felder l\xF6sen das.`,en:`On node "${Oe(e,a.id,"en")}" (${a.id}) the follow-up request "${String(h.key)}" is the only way through 'requiresOneOf', and a completeness check asks for the same fields (${k.map(y=>je(e,y,"en")).join(", ")}). While its request is open, these fields cannot be requested \u2014 the decision would stay locked. A second action in 'requiresOneOf' or other fields solve this.`}),severity:"warning"}]}))})}s(DN,"familyRequestDeadlockWarnings");var Aw={key:!0,kind:!0,title:!0,assign:!0,gatesNode:!0,blocks:!0,completableIf:!0,result:!0,when:!0,onConditionReturn:!0,reads:!0,locksEvidence:!0,feedback:!0,description:!0,documents:!0,formView:!0,familyRequest:!0,optional:!0,appointment:!0,params:!0};function _Y(e){let t=Ye(e);return new Map((typeof t.workItemTemplates=="function"?t.workItemTemplates(e):[]).map(n=>[n.key,n]))}s(_Y,"intrinsicTemplatesOf");function FN(e,t,n){if(n!==void 0&&typeof n!="string")return null;let r=n??t,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Ye(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:_Y(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(FN,"resolveBlocksTargetNode");function NY(e){let t=new Map;for(let r of Zn(e.nodes)){let i=t.get(r.source)??[];i.push(r.target),t.set(r.source,i)}let n=new Map;return r=>{let i=n.get(r);if(i!==void 0)return i;let o=new Set,a=[...t.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...t.get(l)??[]))}return n.set(r,o),o}}s(NY,"reachability");function LN(e){let t=[],n=new Map;for(let o of e.nodes){let a=o;for(let l of Array.isArray(a.tasks)?a.tasks:[]){let d=typeof l.key=="string"?l.key:void 0,c=l.blocks;if(d===void 0||typeof c?.templateKey!="string")continue;let u=typeof c.node=="string"?c.node:o.id;n.set(`${o.id}::${d}`,`${u}::${c.templateKey}`)}}let r=new Map,i=s((o,a)=>{if(r.get(o)==="done")return;if(r.get(o)==="visiting"){let d=[...a.slice(a.indexOf(o)),o],[c,u]=o.split("::");t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${c}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksCycle] Zyklus im 'blocks'-Graphen: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 jedes Mitglied w\xFCrde auf ein anderes warten, keines w\xFCrde je frei.`,en:`[workItems/blocksCycle] Cycle in the 'blocks' graph: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 every member would wait for another, none would ever be released.`},severity:"error"});return}r.set(o,"visiting");let l=n.get(o);l!==void 0&&n.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of n.keys())i(o,[]);return t}s(LN,"checkBlocksCycles");function CY(e){let{requiresOneOf:t,optionalActions:n}=e;if(!Array.isArray(t)||!Array.isArray(n))return new Set;let r=new Set(t.filter(o=>typeof o=="string")),i=new Set;for(let o of n)if(!(typeof o.key!="string"||!r.has(o.key)||!Array.isArray(o.tasks)))for(let a of o.tasks)typeof a=="string"&&i.add(a);return i}s(CY,"tasksOfRequiresOneOf");function MN(e){if(typeof e!="object"||e===null)return!1;let{de:t,en:n}=e;return typeof t=="string"&&t.trim().length>0&&typeof n=="string"&&n.trim().length>0}s(MN,"isFilledBilingual");var PY=["blocks","gatesNode","locksEvidence","completableIf"];function DY(e,t){let n={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},r=[];e.feedback!==!0&&r.push(xt(`${t.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${n.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${n.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;(e.kind!=="task"||i?.kind!=="freetext")&&r.push(xt(`${t.base}.feedback`,{de:`[workItems/feedbackNeedsFreetext] ${n.de} ist eine Feedback-Aufgabe und schlie\xDFt daher mit Freitext ('result: { kind: "freetext" }'); erhalten ${e.kind!=="task"?`kind ${String(e.kind)}`:`Ergebnis ${String(i?.kind)}`}.`,en:`[workItems/feedbackNeedsFreetext] ${n.en} is a feedback task, so it closes with free text ('result: { kind: "freetext" }'); got ${e.kind!=="task"?`kind ${String(e.kind)}`:`result ${String(i?.kind)}`}.`}));let o=["blocks","gatesNode","completableIf","locksEvidence","familyRequest","appointment"].filter(a=>e[a]!==void 0);return o.length>0&&r.push(xt(`${t.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${n.de} ist eine Feedback-Aufgabe; die Antwort kommt von einer Seite ohne weitere Daten und darf deshalb nicht von ${o.join(", ")} abh\xE4ngen.`,en:`[workItems/feedbackSteersProcess] ${n.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(DY,"feedbackTaskIssues");function FY(e,t){let n=[],r={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!MN(i.skipLabel))&&n.push(xt(`${t.base}.optional.skipLabel`,{de:`[workItems/optionalSkipLabel] ${r.de} ist optional, braucht daf\xFCr '{ skipLabel: { de, en } }' \u2014 die Worte des Knopfs, mit dem die zust\xE4ndige Person ohne Ergebnis abschlie\xDFt (\u201EKeine Einsch\xE4tzung abgeben"); erhalten ${JSON.stringify(i)}.`,en:`[workItems/optionalSkipLabel] ${r.en} is optional and needs '{ skipLabel: { de, en } }' for that \u2014 the words of the button the responsible person uses to finish without a result ("Give no assessment"); got ${JSON.stringify(i)}.`})),e.kind!=="task"&&n.push(xt(`${t.base}.optional`,{de:`[workItems/optionalOnApproval] ${r.de} ist eine Freigabe \u2014 optional ist nur eine Aufgabe; eine Freigabe schlie\xDFt mit ihrem Urteil.`,en:`[workItems/optionalOnApproval] ${r.en} is an approval \u2014 only a task can be optional; an approval ends with its verdict.`}));let a=e.result;(a===void 0||typeof a.kind!="string"||!CI({kind:a.kind,writes:a.writes}))&&n.push(xt(`${t.base}.optional`,{de:`[workItems/optionalNeedsProseResult] ${r.de} ist optional, schlie\xDFt aber ${a===void 0?"ohne Ergebnis":`mit einem ${String(a.kind)}-Ergebnis${a.writes!==void 0?" mit Wert":""}`} \u2014 optional ist nur eine Aufgabe mit Freitext, Empfehlung oder einer Auswahl ohne 'writes': einen Wert, den ein sp\xE4terer Schritt liest, g\xE4be es dann nie.`,en:`[workItems/optionalNeedsProseResult] ${r.en} is optional but ends ${a===void 0?"without a result":`with a ${String(a.kind)} result${a.writes!==void 0?" with a value":""}`} \u2014 only a task with free text, a recommendation or a choice without 'writes' can be optional: a value a later step reads would then never arrive.`}));let l=PY.filter(d=>e[d]!==void 0);return l.length>0&&n.push(xt(`${t.base}.${l[0]}`,{de:`[workItems/optionalHolds] ${r.de} ist optional und tr\xE4gt ${l.map(d=>`'${d}'`).join(", ")} \u2014 auf eine optionale Aufgabe wartet nichts: sie h\xE4lt keinen Schritt zur\xFCck. Entweder optional oder zur\xFCckhaltend.`,en:`[workItems/optionalHolds] ${r.en} is optional and carries ${l.map(d=>`'${d}'`).join(", ")} \u2014 nothing waits for an optional task: it holds no step back. Either optional or holding back.`})),t.requiredByRule&&n.push(xt(`${t.base}.optional`,{de:`[workItems/optionalInRequiresOneOf] ${r.de} ist optional, geh\xF6rt aber zu einer Aktion, die 'requiresOneOf' verlangt \u2014 \u201EKeine Einsch\xE4tzung abgeben" w\xFCrde die Regel erf\xFCllen, ohne dass etwas geschehen ist.`,en:`[workItems/optionalInRequiresOneOf] ${r.en} is optional but belongs to an action that 'requiresOneOf' requires \u2014 "Give no assessment" would satisfy the rule without anything having happened.`})),n}s(FY,"optionalTaskIssues");function xt(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(xt,"issue");function qN(e,t){let n=[],r=NY(e),i=new Set(ta(e).map(o=>o.key));n.push(...DN(e,t));for(let o of e.nodes){let a=o,l=NN(a);n.push(...PN(a));let d=CY(a);n.push(...RN(a,e.nodes));for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=typeof c.key=="string"?c.key:"?",p=`nodes.${o.id}.tasks.${u}`,h=c.kind,w=c.result,k=c.blocks,y=typeof k?.node=="string"&&k.node!==o.id?k.node:void 0;if(typeof k?.templateKey=="string"){let R=typeof k.node=="string"?k.node:o.id,q=e.nodes.find(Y=>Y.id===R),J=(Array.isArray(q?.tasks)?q.tasks:[]).find(Y=>Y.key===k.templateKey)?.blocks;typeof J?.node=="string"&&J.node!==R&&n.push(xt(`${p}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${u}" auf Knoten "${o.id}" h\xE4lt "${k.templateKey}" auf Knoten "${R}" zur\xFCck \u2014 das ist selbst eine knoten\xFCbergreifende Aufgabe, die ihren Knoten \xFCberlebt; zur\xFCckgehalten k\xF6nnte sie nach dessen Verlassen weder bearbeitet noch freigegeben werden. Nur Aufgaben, die an ihrem Knoten bleiben, und intrinsische Vorlagen sind Ziele.`,en:`[workItems/blocksCrossNodeTask] Task "${u}" on node "${o.id}" holds back "${k.templateKey}" on node "${R}" \u2014 that is itself a cross-node task that outlives its node; held back, it could be neither worked nor released after the node is left. Only tasks that stay on their node and intrinsic templates are targets.`}))}if(y!==void 0){let R=y;e.nodes.some(q=>q.id===R)&&!r(o.id).has(R)&&n.push(xt(`${p}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${u}" auf Knoten "${o.id}" blockiert Knoten "${R}", der von hier aus nicht erreichbar ist \u2014 die Aufgabe entst\xFCnde erst, wenn ihr Ziel schon hinter dem Prozess liegt. Ziel ist derselbe Knoten oder ein sp\xE4terer.`,en:`[workItems/blocksTargetNotAfter] Task "${u}" on node "${o.id}" blocks node "${R}", which cannot be reached from here \u2014 the task would only be created when its target is already behind the process. The target is the same node or a later one.`})),(w===void 0||!_i(w.kind))&&n.push(xt(`${p}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${u}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${R}"), hat aber kein 'result' \u2014 eine knoten\xFCbergreifende Aufgabe \xFCberlebt ihren Knoten und wird \xFCber ihr Ergebnis abgeschlossen (Freitext, Empfehlung oder Auswahl).`,en:`[workItems/crossNodeBlocksNeedsResult] Task "${u}" on node "${o.id}" blocks another node ("${R}") but has no 'result' \u2014 a cross-node task outlives its node and is completed through its result (free text, recommendation or choice).`})),l.has(u)&&n.push(xt(`${p}.blocks.node`,{de:`[optionalAction/crossNodeBlocks] Task "${u}" geh\xF6rt zu einer optionalen Aktion (spawnTasks) auf Knoten "${o.id}" und darf keinen anderen Knoten blockieren \u2014 ihre Zeilen sind die Runde der Aktion.`,en:`[optionalAction/crossNodeBlocks] Task "${u}" belongs to an optional action (spawnTasks) on node "${o.id}" and must not block another node \u2014 its rows are the round of the action.`}))}for(let R of AN(String(h),w,{channelKeys:i,...t?.billingItemKeys!==void 0?{billingItemKeys:t.billingItemKeys}:{},...t?.offerProgram!==void 0?{offerProgram:t.offerProgram}:{}}))n.push(xt(`${p}.${R.field}`,{de:`${R.code} ${R.message.de} (Task "${u}" auf Knoten "${o.id}").`,en:`${R.code} ${R.message.en} (task "${u}" on node "${o.id}").`}));let v=c.when,A=s((R,q,_)=>{!xe(q)||ct(q)||n.push(xt(R,{de:`[workItems/evidenceNotFormField] ${_} auf Task "${u}" (Knoten "${o.id}") nennt ${je(e,q,"de")} \u2014 Bedingung und Belege einer Aufgabe sind Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[workItems/evidenceNotFormField] ${_} on task "${u}" (node "${o.id}") names ${je(e,q,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");v!==void 0?(A(`${p}.when`,v,"'when'"),c.onConditionReturn!=="respawn"&&c.onConditionReturn!=="stayClosed"&&n.push(xt(`${p}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] Task "${u}" (Knoten "${o.id}") hat eine Bedingung, aber kein 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 was bei der R\xFCckkehr der Bedingung geschieht, muss entschieden sein.`,en:`[workItems/whenNeedsOnConditionReturn] Task "${u}" (node "${o.id}") has a condition but no 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 what happens when the condition returns must be decided.`}))):c.onConditionReturn!==void 0&&n.push(xt(`${p}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' ohne 'when' auf Task "${u}" (Knoten "${o.id}") \u2014 ohne Bedingung kehrt nichts zur\xFCck.`,en:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' without 'when' on task "${u}" (node "${o.id}") \u2014 without a condition nothing returns.`}));let E=c.reads;if(E!==void 0)if(!Array.isArray(E))n.push(xt(`${p}.reads`,{de:`[workItems/readsUnknownField] 'reads' auf Task "${u}" (Knoten "${o.id}") muss eine Liste von Feldadressen sein.`,en:`[workItems/readsUnknownField] 'reads' on task "${u}" (node "${o.id}") must be a list of field addresses.`}));else for(let[R,q]of E.entries())A(`${p}.reads.${R}`,q,"'reads'");let I=c.locksEvidence,C=s((R,q)=>n.push(xt(`${p}.locksEvidence`,{de:`[workItems/${R}] Task "${u}" (Knoten "${o.id}") ${q.de}`,en:`[workItems/${R}] Task "${u}" (node "${o.id}") ${q.en}`})),"lockIssue");I!==void 0&&I!==!0&&C("locksEvidenceNotTrue",{de:`tr\xE4gt 'locksEvidence' ${JSON.stringify(I)} \u2014 nur 'true' ist erlaubt; ohne Sperre entf\xE4llt das Feld.`,en:`carries 'locksEvidence' ${JSON.stringify(I)} \u2014 only 'true' is allowed; without a lock the field is dropped.`}),I===!0&&(E===void 0&&v===void 0&&C("locksEvidenceWithoutEvidence",{de:"sperrt seine Belege, hat aber weder 'reads' noch 'when' \u2014 es gibt nichts, worauf die Entscheidung beruht.",en:"locks its evidence but has neither 'reads' nor 'when' \u2014 there is nothing the decision rests on."}),(w===void 0||!_i(w.kind))&&C("locksEvidenceNeedsRecordedResult",{de:"sperrt seine Belege, schlie\xDFt aber nicht mit einem erfassten Ergebnis (Freitext, Empfehlung, Auswahl) \u2014 nur eine Entscheidung, die das Team wieder\xF6ffnen kann, darf Belege sperren (ein Termin bleibt gebucht).",en:"locks its evidence but does not end with a recorded result (free text, recommendation, choice) \u2014 only a decision the team can reopen may lock evidence (an appointment stays booked)."}),l.has(u)&&C("locksEvidenceOnOptionalAction",{de:"geh\xF6rt zu einer optionalen Aktion (spawnTasks) \u2014 ihre Zeilen sind die Runde der Aktion, wieder\xF6ffnen l\xE4sst sie sich nicht; Belege sperrt nur eine Knotenaufgabe.",en:"belongs to an optional action (spawnTasks) \u2014 its rows are the round of the action and cannot be reopened; only a node task locks evidence."})),n.push(...CN({graph:e,node:a,task:c,onTrigger:l,specCtx:t}));let $=Object.keys(c).filter(R=>!Object.hasOwn(Aw,R));$.length>0&&n.push(xt(`${p}.${$[0]}`,{de:`[workItems/unknownKey] Task "${u}" (Knoten "${o.id}") tr\xE4gt ${$.map(R=>`'${R}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(Aw).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${u}" (node "${o.id}") carries ${$.map(R=>`'${R}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(Aw).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let b=c.description;b!==void 0&&!MN(b)&&n.push(xt(`${p}.description`,{de:`[workItems/descriptionInvalid] 'description' auf Task "${u}" (Knoten "${o.id}") braucht Text in beiden Sprachen ({ de, en }), erhalten ${JSON.stringify(b)}.`,en:`[workItems/descriptionInvalid] 'description' on task "${u}" (node "${o.id}") needs text in both languages ({ de, en }), got ${JSON.stringify(b)}.`})),c.feedback!==void 0&&n.push(...DY(c,{key:u,nodeId:o.id,base:p})),c.optional!==void 0&&n.push(...FY(c,{key:u,nodeId:o.id,base:p,requiredByRule:d.has(u)}))}}return n}s(qN,"checkNodeTasks");function KN(e){let t=e.indexOf(":"),n=t===-1?"":e.slice(0,t),r=t===-1?"":e.slice(t+1).trim();if(n==="artifact"&&r.length>0)return{kind:n,key:r};let i=mo(r);return(n==="field"||n==="document")&&i!==null?{kind:n,address:i}:ae("INVALID",{de:`Dokument-Verweis "${e}" ist ung\xFCltig \u2014 erwartet artifact:<Slot-Schl\xFCssel>, field:$node.<Formular>.admission.<Feld> oder document:$node.<Knoten>.document.`,en:`Document reference "${e}" is invalid \u2014 expected artifact:<slot key>, field:$node.<form>.admission.<field> or document:$node.<node>.document.`})}s(KN,"parseTaskDocumentRef");function Ew(e){return e.kind==="artifact"?`artifact:${e.key}`:`${e.kind}:${pe(e.address)}`}s(Ew,"taskDocumentId");function si(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(si,"issue");function jN(e){return Array.isArray(e.tasks)?e.tasks:[]}s(jN,"tasksOf");function LY(e){let t=new Map;for(let n of e){let{id:r,artifacts:i}=n;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&t.set(o.key,[...t.get(o.key)??[],{nodeId:r,slot:o}])}return t}s(LY,"artifactSlotDeclarations");function MY(e){return e.flatMap(t=>{let{id:n,artifacts:r}=t;return(Array.isArray(r)?r:[]).filter(i=>!Ff(i?.type)).map(i=>({nodeId:String(n),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(MY,"unknownArtifactSlotTypes");function VN(e){let t=[];for(let{nodeId:n,slotKey:r,type:i}of MY(e.nodes))t.push(si(`nodes.${n}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${n}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${Gs.join(", ")}.`,en:`[artifact/unknownType] Node "${n}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${Gs.join(", ")}.`}));for(let[n,r]of LY(e.nodes))for(let i of r.slice(1))t.push(si(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${n}", den schon "${r[0].nodeId}" deklariert \u2014 jeder Slot-Schl\xFCssel geh\xF6rt genau einem Knoten.`,en:`[governedDocument/slotKeyTaken] Node "${i.nodeId}" declares the document slot "${n}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return t}s(VN,"checkArtifactSlotKeys");function BN(e){if(!Array.isArray(e)||e.length===0)return null;let t=[];for(let n of e){let r=typeof n=="object"&&n!==null?n:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)t.push({kind:"artifact",key:r.key});else if((r.kind==="field"||r.kind==="document")&&i==="address,kind")t.push({kind:r.kind,address:r.address});else return null}return t}s(BN,"authoredRefs");function qY(e){return e.scope==="node"&&(e.key===kl||e.key===_s||e.key===Ns)&&e.path===void 0}s(qY,"isDocumentAddress");function UN(e){let t=[];for(let n of e.nodes)for(let r of jN(n)){if(r.documents===void 0)continue;let i=typeof r.key=="string"?r.key:"?",o=`nodes.${n.id}.tasks.${i}.documents`,a={de:`Task "${i}" (Knoten "${n.id}")`,en:`Task "${i}" (node "${n.id}")`},l=BN(r.documents);if(l===null){t.push(si(o,{de:`[workItems/documentsInvalid] 'documents' auf ${a.de} muss eine nicht leere Liste von { kind: 'artifact', key } (eigener Slot), { kind: 'field', address } (Dateifeld eines Formulars) oder { kind: 'document', address } (Dokument eines anderen Knotens) sein, erhalten ${JSON.stringify(r.documents)}.`,en:`[workItems/documentsInvalid] 'documents' on ${a.en} must be a non-empty list of { kind: 'artifact', key } (own slot), { kind: 'field', address } (file field of a form) or { kind: 'document', address } (document of another node), got ${JSON.stringify(r.documents)}.`}));continue}let d=new Set;for(let c of l){if(c.kind!=="artifact"&&!xe(c.address))continue;let u=c.kind==="artifact"?Ew(c):Ew({kind:c.kind,address:c.address});d.has(u)&&t.push(si(o,{de:`[workItems/documentsDuplicate] ${a.de} verweist zweimal auf ${u}.`,en:`[workItems/documentsDuplicate] ${a.en} refers to ${u} twice.`})),d.add(u),c.kind==="artifact"&&!nO(n,c.key)&&t.push(si(o,{de:`[workItems/documentsUnknownArtifact] ${a.de} verweist auf das Dokument "${c.key}", aber der Knoten deklariert keinen solchen Slot \u2014 das Dokument eines anderen Knotens ist { kind: 'document', address: $node.<knoten>.document }.`,en:`[workItems/documentsUnknownArtifact] ${a.en} refers to the document "${c.key}", but the node declares no such slot \u2014 the document of another node is { kind: 'document', address: $node.<node>.document }.`})),c.kind==="field"&&!ct(c.address)&&t.push(si(o,{de:`[workItems/documentsInvalid] ${a.de}: ein Feld-Dokument nennt ein Feld eines Formulars ($node.<formular>.admission.<feld>), nicht ${je(e,c.address,"de")}.`,en:`[workItems/documentsInvalid] ${a.en}: a field document names a field of a form ($node.<form>.admission.<field>), not ${je(e,c.address,"en")}.`})),c.kind==="document"&&!qY(c.address)&&t.push(si(o,{de:`[workItems/documentsInvalid] ${a.de}: ein Dokument eines anderen Knotens ist dessen ganzes Dokument ($node.<knoten>.document), nicht ${pe(c.address)}.`,en:`[workItems/documentsInvalid] ${a.en}: a document of another node is that node's whole document ($node.<node>.document), not ${pe(c.address)}.`}))}}return t}s(UN,"checkTaskDocuments");function GN(e,t){let n=[];for(let r of e.nodes)for(let i of jN(r)){let o=BN(i.documents);if(o===null)continue;let a=typeof i.key=="string"?i.key:"?",l=`nodes.${r.id}.tasks.${a}.documents`;for(let d of o){if(d.kind!=="field"||!ct(d.address))continue;let c=ni(t,d.address);if(c==null)continue;let u={de:je(e,d.address,"de"),en:je(e,d.address,"en")},p=Ks("taskDocument",qs(c));if(p==="repeated"){n.push(si(l,{de:`[workItems/documentsUnknownField] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Dokument der Anmeldung.`,en:`[workItems/documentsUnknownField] Task "${a}" (node "${r.id}") refers to the field ${u.en} \u2014 a field in a repeated group is not a single document of the application.`}));continue}p==="notDocument"&&n.push(si(l,{de:`[workItems/documentsNotDocument] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de}, das keine Datei enth\xE4lt \u2014 nur Datei-Felder (docRef) sind Dokumente.`,en:`[workItems/documentsNotDocument] Task "${a}" (node "${r.id}") refers to the field ${u.en}, which holds no file \u2014 only file fields (docRef) are documents.`}))}}return n}s(GN,"checkTaskDocumentFields");var Tw=["form","documents"],KY=/^[a-z][a-zA-Z0-9_-]*$/;function jY(e){let t=new Map,n=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])t.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){t.set(i.key,"other");for(let o of i.itemTemplate)t.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(n)},"visit");return e.sections.forEach(n),t}s(jY,"fieldPlaces");function zN(e,t,n){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!KY.test(o)){r.push({severity:"error",path:`${n(a)}.key`,code:"view.invalid-key",message:{de:`${t.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${t.en}: '${String(o)}' is no valid key (a lower-case letter first, then letters, digits, - or _).`}});return}i.has(o)&&r.push({severity:"error",path:`${n(a)}.key`,code:"view.duplicate-key",message:{de:`${t.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${t.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(zN,"keyIssues");function VY(e,t,n){return e==="document"?null:e===void 0?{severity:"error",path:n,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${t}'.`,en:`View: the form has no field '${t}'.`}}:e==="row"?{severity:"error",path:n,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${t}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${t}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:n,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${t}' enth\xE4lt keine Datei.`,en:`View: the field '${t}' holds no file.`}}}s(VY,"fieldIssue");function BY(e,t,n){let r=[];Tw.includes(e.key)&&r.push({severity:"error",path:`${t}.key`,code:"view.reserved-key",message:{de:`Der Ansichtsschl\xFCssel '${e.key}' ist f\xFCr die Standardansicht reserviert.`,en:`The view key '${e.key}' is reserved for the standard view.`}});let i=e.groups;i.length===0&&r.push({severity:"error",path:`${t}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(...zN(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${t}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${t}.groups[${l}]`,c=a.fields;c.length===0&&r.push({severity:"error",path:`${d}.fields`,code:"view.empty",message:{de:`Gruppe '${a.key}' der Ansicht '${e.key}' hat keine Felder.`,en:`Group '${a.key}' of view '${e.key}' has no fields.`}}),c.forEach((u,p)=>{let h=`${d}.fields[${p}]`,w=VY(n.get(u),u,h);w!==null&&r.push(w),o.has(u)&&r.push({severity:"error",path:h,code:"view.field-twice",message:{de:`Ansicht '${e.key}': Das Feld '${u}' steht mehrfach; eine Datei hat einen Platz.`,en:`View '${e.key}': the field '${u}' is listed more than once; a file has one place.`}}),o.add(u)})}),r}s(BY,"viewIssues");function UY(e){if(!Array.isArray(e))return"views";for(let[t,n]of e.entries()){let r=n?.groups;if(!Array.isArray(r))return`views[${t}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${t}].groups[${i}].fields`}}return null}s(UY,"malformedAt");function WN(e){let t=e.views;if(t===void 0)return[];let n=UY(t);if(n!==null)return[{severity:"error",path:n,code:"view.malformed",message:{de:`${n} hat nicht die Form einer Ansicht: views ist eine Liste von { key, label, groups }, groups eine Liste von { key, label, fields }, fields eine Liste von Feldschl\xFCsseln.`,en:`${n} is not shaped like a view: views is a list of { key, label, groups }, groups a list of { key, label, fields }, fields a list of field keys.`}}];let r=jY(e);return[...zN(t.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...t.flatMap((i,o)=>BY(i,`views[${o}]`,r))]}s(WN,"formViewIssues");function rp(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(rp,"issue");function YN(e,t,n,r){let i=e;if(i===null||typeof i!="object"||typeof i.form!="string"||typeof i.key!="string")return[rp(t,{de:`[workItems/formViewInvalid] 'formView' auf ${n.de} muss { form: <Formularknoten>, key: <Ansicht> } sein.`,en:`[workItems/formViewInvalid] 'formView' on ${n.en} must be { form: <form node>, key: <view> }.`})];let o=r?.formViewKeysByFormNode;if(o===void 0)return[];let a=o.get(i.form);return a===void 0?[rp(t,{de:`[workItems/formViewUnknownForm] ${n.de} nennt das Formular "${i.form}", aber kein Formularknoten hei\xDFt so.`,en:`[workItems/formViewUnknownForm] ${n.en} names the form "${i.form}", but no form node has that id.`})]:a.has(i.key)||Tw.includes(i.key)?[]:[rp(t,{de:`[workItems/formViewUnknown] ${n.de} nennt die Ansicht "${i.key}", aber das Formular "${i.form}" hat keine solche Ansicht.`,en:`[workItems/formViewUnknown] ${n.en} names the view "${i.key}", but the form "${i.form}" has no such view.`})]}s(YN,"viewIssues");function HN(e,t){let n=[];for(let r of e.nodes){if(r.formView!==void 0){let i={de:`Knoten "${r.id}"`,en:`node "${r.id}"`};r.type!=="decision"?n.push(rp(`nodes.${r.id}.formView`,{de:`[workItems/formViewInvalid] ${i.de}: 'formView' am Knoten gilt nur f\xFCr eine Entscheidung; eine Aufgabe tr\xE4gt ihre eigene.`,en:`[workItems/formViewInvalid] ${i.en}: 'formView' on a node applies to a decision only; a task carries its own.`})):n.push(...YN(r.formView,`nodes.${r.id}.formView`,i,t))}for(let i of Array.isArray(r.tasks)?r.tasks:[]){if(i.formView===void 0)continue;let o=String(i.key);n.push(...YN(i.formView,`nodes.${r.id}.tasks.${o}.formView`,{de:`Task "${o}" (Knoten "${r.id}")`,en:`Task "${o}" (node "${r.id}")`},t))}}return n}s(HN,"checkTaskFormViews");var Pn="traeger",JN={de:"Tr\xE4ger",en:"Provider"};function ra(e){let t=e.inputs?.[Pn];return t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0?t.value:null}s(ra,"traegerKeyOfNode");var ip={name:"input.traeger.name",address:"input.traeger.anschrift"},Ihe=Object.values(ip);var QN="governedDocument",Io="prepareDocument",ql="prepareDocument:revision",Fr="releaseApproval",Oo="documentResponse",ia="coverLetterResponse",op="confirmCoverLetter",sp="requestCoverLetterRevision",oa="coverLetterConfirmation",Lr="responseCheck",ap="returnSigned";var ZN="requestApproval";var XN="issueDocument",eC="correctInPlace",tC="rescindAndReissue",lp="requestChange";var sa="releaseArtifact",cn="signingRecovery",dp="resendESignature",_o="switchToPaper";var $w=new Set([Io,ql]),nC=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],cp=["upload","resolver","template","none"],No=1,Co=366,ai="responseDueInDays";function Po(e){let t=e.inputs?.[oa];return t?.kind==="literal"&&t.value===!0}s(Po,"coverLetterConfirmationOf");function Kl(e){let t=e.inputs?.[ai];return t?.kind==="literal"&&jl(t.value)?t.value:void 0}s(Kl,"responseDueInDaysForVocabulary");function jl(e){return typeof e=="number"&&Number.isInteger(e)&&e>=No&&e<=Co}s(jl,"isValidResponseDueInDays");var up=["generatedAt","responseDueInDays","countersignature"],Do=["release","none"],fp=["confirm","signedUpload","signedUploadChecked","eSignature"];var GY={kind:"confirm",acceptOutcomeId:"accepted",declineOutcomeId:"declined",outcomeSemantics:{accept:"granted",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!1,declineIsAnswer:!0,acceptStatus:"accepted",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Annehmen",en:"Accept"},decline:{de:"Ablehnen",en:"Decline"}}},rC={kind:"signedUpload",acceptOutcomeId:"signed",declineOutcomeId:"absage",outcomeSemantics:{accept:"other",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!0,declineIsAnswer:!1,acceptStatus:"signed",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Unterschrieben zur\xFCcksenden",en:"Return signed"},decline:{de:"Ablehnen",en:"Decline"}}},iC={...rC,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},zY={...iC,kind:"eSignature",issuesBy:"provider"},li={confirm:GY,signedUpload:rC,signedUploadChecked:iC,eSignature:zY};function di(e){let t=e.responseStrategy;if(typeof t=="string"&&t in li)return li[t];F(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(t)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(di,"responseStrategyOf");function pp(e){if(e.type!==QN||e.production!=="resolver")return!1;let t=e.responseStrategy;return typeof t=="string"&&t in li?li[t].acceptEvent==="contractEvent":!1}s(pp,"isFamilySignedContractNode");function la(e){return e.label}s(la,"governedDocTitle");function Rw(e){return e.approval==="release"?ZN:XN}s(Rw,"submitActionId");function oC(e,t,n){return{key:t,recipient:"internal",title:n,unlocks:[Rw(e)],gatesNode:!0,advancesNode:!0}}s(oC,"producerTemplate");function WY(e){return e.titles?.respond??e.label}s(WY,"responseTitle");var aa={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Iw(e){let t=di(e),n=[];if(e.production!=="none"&&n.push(oC(e,Io,e.titles?.prepare??aa),oC(e,ql,e.titles?.revise??aa)),e.approval==="release"&&n.push({key:Fr,recipient:"internal",title:e.titles?.approve??aa,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),n.push({key:Oo,recipient:"external",title:WY(e),unlocks:t.producesResponseArtifact?[t.checksReturn?ap:t.acceptOutcomeId,t.declineOutcomeId,lp]:[t.acceptOutcomeId,t.declineOutcomeId],advancesNode:!0,...Kl(e)!==void 0?{dueInDays:Kl(e)}:{}}),Po(e)){let r=la(e);n.push({key:ia,recipient:"external",title:{de:`${r.de}: Schreiben best\xE4tigen`,en:`${r.en}: confirm the letter`},unlocks:[op,sp,t.declineOutcomeId],advancesNode:!0,...Kl(e)!==void 0?{dueInDays:Kl(e)}:{}})}if(t.checksReturn&&n.push({key:Lr,recipient:"internal",title:e.titles?.check??aa,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),t.issuesBy==="provider"){let r=la(e);n.push({key:cn,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[dp,_o],gatesNode:!1,advancesNode:!1})}return n}s(Iw,"governedDocIntrinsicTemplates");function YY(e){e.production==="none"&&F(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let t=e.artifacts??[];t.length!==1&&F(`governedDocSlot: node "${e.id}" declares ${t.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let n=t[0];return(typeof n.key!="string"||n.key.length===0)&&F(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),n}s(YY,"governedDocSlot");function mp(e){return YY(e).key}s(mp,"governedDocSlotKey");var Xn="processFooter";var hp="countersign",Ow="countersign",sC="countersigned",aC="countersigning",lC="countersigned";var dC={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},Vl=["scan","eSignature"],gp="service_provider:1",cC=["countersigning","awaitingSignature","signatureStalled","done"],uC={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function fC(e){return{de:`[countersign/traegerSignatoryMissing] Die Schule zeichnet elektronisch gegen, aber f\xFCr ${e} ist keine Unterschriftsperson hinterlegt, die unterschreiben kann (Rechtstr\xE4ger \u2192 signatoryUserKey, aktives Personal der Schule).`,en:`[countersign/traegerSignatoryMissing] The school countersigns electronically, but no signatory who can sign is on file for ${e} (legal entity \u2192 signatoryUserKey, active staff of the school).`}}s(fC,"traegerSignatoryMissingReason");function er(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${t}`,reason:n,severity:"error"}}s(er,"issue");function yp(e,t){return e.nodes.filter(n=>{let r=n.contract;return n.type==="countersign"&&xe(r)&&r.scope==="node"&&r.owner===t})}s(yp,"countersignersOf");function Bl(e){return e.signing==="eSignature"}s(Bl,"isElectronic");function HY(e,t){if(t===void 0||t.sendable||!Bl(e))return[];let n=e.label?.de??e.id,r=e.label?.en||e.id;return[er(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${n}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${t.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${t.reason.en}`})]}s(HY,"countersignProviderIssues");function JY(e,t,n){if(n.scope!=="node")return[];let r=e.nodes.find(o=>o.id===n.owner);if(r===void 0)return[];let i=[];return pp(r)||i.push("sourceNotCheckedContract"),yp(e,r.id).some(o=>o.id!==t)&&i.push("twice"),i}s(JY,"countersignContractRefusals");function pC(e){let t=e.inputs?.dueInDays;return t?.kind==="literal"&&typeof t.value=="number"&&Number.isInteger(t.value)&&t.value>=1?t.value:void 0}s(pC,"validDueInDays");function QY(e,t,n){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!Vl.includes(o))return[er(e,"signing",{de:`[countersign/unknownSigning] \u201E${r}\u201C: signing ist scan oder eSignature (gefunden: ${JSON.stringify(o)}).`,en:`[countersign/unknownSigning] "${i}": signing is scan or eSignature (found: ${JSON.stringify(o)}).`})];let a=e.assign?.[cn];if(!Bl(e))return a===void 0?[]:[er(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet auf Papier gegen \u2014 \`assign.signingRecovery\` h\xE4lt keine Aufgabe und geh\xF6rt entfernt.`,en:`[countersign/recoveryAssign] "${i}" countersigns on paper \u2014 \`assign.signingRecovery\` holds no task and must be removed.`})];let l=[];return(typeof a!="string"||a.length===0)&&l.push(er(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet elektronisch gegen \u2014 wer eine gescheiterte Gegenzeichnung kl\xE4rt, fehlt: \`assign.signingRecovery\` nennt das Team.`,en:`[countersign/recoveryAssign] "${i}" countersigns electronically \u2014 who resolves a failed countersignature is missing: \`assign.signingRecovery\` names the team.`})),l.push(...ZY(e,t,n),...XY(e,t,n),...HY(e,n?.signingProvider)),l}s(QY,"signingIssues");function hC(e,t){let n=e.contract;if(!(!xe(n)||n.scope!=="node"))return t.nodes.find(r=>r.id===n.owner)}s(hC,"contractNodeOf");function ZY(e,t,n){let r=hC(e,t),i=r===void 0?null:ra(r),o=i===null?void 0:n?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[er(e,"signing",fC(o.name))]}s(ZY,"traegerSignatoryIssues");function XY(e,t,n){let r=hC(e,t);if(r===void 0)return[];let i=n?.resolverDocumentAnchors?.get(r.id);if(i===void 0)return[];let o=e.label?.de??e.id,a=e.label?.en||e.id,l=[];for(let d of i)d.documentAnchors===null?l.push(er(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage des Generators \u201E${d.pin}\u201C wurde nie auf Unterschriftsanker gelesen \u2014 Vorlage neu hochladen und den Generator neu versiegeln.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of generator "${d.pin}" was never read for signature anchors \u2014 upload the template again and seal the generator again.`})):d.documentAnchors.has(gp)||l.push(er(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${gp}/ \u2014 der Anbieter f\xE4nde f\xFCr die Schule kein Unterschriftsfeld.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of "${d.pin}" carries no anchor /unterschrift:${gp}/ \u2014 the provider would find no signature field for the school.`}));return l}s(XY,"traegerAnchorIssues");var _w=100;async function eH(e,t){let n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",t.node.id)).take(_w+1);n.length>_w&&F(`countersign node "${t.node.id}" of ${t.applicationId} holds more than ${_w} rows`);let r=n.filter(o=>o.isOpen),i=s(o=>{if(o.context.kind!=="admission")return;let a=o.context.anchor;return"templateKey"in a?a.templateKey:void 0},"templateKeyOf");return r.some(o=>i(o)===cn)?"signatureStalled":r.some(o=>i(o)===hp)?"countersigning":Bl(t.node)?"awaitingSignature":"done"}s(eH,"countersignCurrentState");var mC={[aC]:{label:ne("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:ne("Gegenzeichnung","Countersignature"),scope:"node"},external:Ze(ne("Vertrag unterschrieben","Contract signed"),"blue",ne("Die Schule zeichnet Ihren Vertrag gegen","The school is countersigning your contract"),ne("Vielen Dank f\xFCr Ihre Unterschrift. Sobald die Schule gegengezeichnet hat, finden Sie Ihr Exemplar hier.","Thank you for signing. As soon as the school has countersigned, you will find your copy here."))}},gC={inputs:s(()=>[{id:"dueInDays",label:{de:"Frist der Aufgabe (Tage)",en:"Task due in (days)"},type:"number",inspector:"literal-only"}],"inputs"),role:"user-action",effect:"side-effect",outcomes:[{id:sC,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:mC,progressEvents:Ft(mC),notificationEvents:s(()=>[{id:lC,label:{de:"Vertrag gegengezeichnet",en:"Contract countersigned"},audience:"external",required:!0,args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0}]}],"notificationEvents"),actions:s(e=>[{id:Ow,kind:"internal",label:dC,surface:Xn,availableIn:["countersigning"]},...Bl(e)?[{id:_o,kind:"internal",surface:Xn,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:hp,recipient:"internal",title:e.titles?.countersign??aa,unlocks:[Ow],advancesNode:!0,...pC(e)!==void 0?{dueInDays:pC(e)}:{}},...Bl(e)?[{key:cn,recipient:"internal",title:uC,unlocks:[_o],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),states:cC,currentState:eH,validate:s((e,t,n)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id,a=e.assign?.[hp];(typeof a!="string"||a.length===0)&&r.push(er(e,"assign",{de:`[countersign/assign] \u201E${i}": wer gegenzeichnet, fehlt \u2014 \`assign.countersign\` nennt das Team.`,en:`[countersign/assign] "${o}": who countersigns is missing \u2014 \`assign.countersign\` names the team.`})),Ti(e.titles?.countersign)||r.push(er(e,"titles",{de:`[countersign/missingTitle] \u201E${i}": der Titel der Aufgabe fehlt \u2014 \`titles.countersign\` auf Deutsch und Englisch.`,en:`[countersign/missingTitle] "${o}": the task title is missing \u2014 \`titles.countersign\` in German and English.`}));let l=e.inputs?.dueInDays;l!==void 0&&l.kind!=="unset"&&!(l.kind==="literal"&&typeof l.value=="number"&&Number.isInteger(l.value)&&l.value>=1)&&r.push(er(e,"inputs.dueInDays",{de:`[countersign/dueInDays] \u201E${i}": dueInDays ist eine ganze Zahl \u2265 1.`,en:`[countersign/dueInDays] "${o}": dueInDays is a whole number \u2265 1.`})),r.push(...QY(e,t,n));let d=e.contract;if(!xe(d))return r;let c=JY(t,e.id,d);if(c.length===0)return r;let u=t.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(er(e,"contract",{de:`[countersign/sourceNotCheckedContract] \u201E${i}" zeichnet das Dokument von \u201E${u.label?.de??u.id}" (${u.id}) gegen \u2014 gegenzeichnen l\xE4sst sich nur ein erzeugter Vertrag, den die Familie mit verbuchten Unterschriften unterschreibt (governedDocument mit production: resolver und responseStrategy: signedUploadChecked oder eSignature).`,en:`[countersign/sourceNotCheckedContract] "${o}" countersigns the document of "${u.label?.en||u.id}" (${u.id}) \u2014 only a generated contract that the family signs with booked signatures can be countersigned (governedDocument with production: resolver and responseStrategy: signedUploadChecked or eSignature).`})),c.includes("twice")){let p=yp(t,u.id).filter(h=>h.id!==e.id);r.push(er(e,"contract",{de:`[countersign/twice] \u201E${i}": \u201E${u.label?.de??u.id}" (${u.id}) wird schon von ${p.map(h=>`"${h.id}"`).join(", ")} gegengezeichnet \u2014 ein Vertrag hat eine Gegenzeichnung.`,en:`[countersign/twice] "${o}": "${u.label?.en||u.id}" (${u.id}) is already countersigned by ${p.map(h=>`"${h.id}"`).join(", ")} \u2014 a contract has one countersignature.`}))}return r},"validate")};function tH(e){return pp(e)?ra(e):null}s(tH,"traegerSignerOf");var nH=s(e=>e.type==="end"&&To(e)==="approved","isApprovedEnd");function yC(e){let t=[];for(let n of e.nodes){let r=tH(n);if(r===null)continue;let i=yp(e,n.id).map(u=>u.id),o=DO(e,n.id,new Set(i),nH);if(o===null)continue;let a=n.label?.de||n.id,l=n.label?.en||n.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${n.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${n.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${n.id}) erzeugt einen Vertrag, den der Tr\xE4ger \u201E${r}\u201C mitunterschreibt, aber keine Gegenzeichnung nennt ihn \u2014 der Vertrag w\xFCrde nie unterschrieben und nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${n.id}) generates a contract the legal entity "${r}" co-signs, but no countersignature names it \u2014 the contract would never be signed and never billed. ${d.en}`}:{de:`[countersign/missingForContract] \u201E${a}\u201C (${n.id}): ein Weg erreicht das Ende \u201E${o}\u201C (Ergebnis approved), ohne durch die Gegenzeichnung ${i.map(u=>`\u201E${u}\u201C`).join(", ")} zu laufen \u2014 dort bliebe der Vertrag ohne Unterschrift des Tr\xE4gers \u201E${r}\u201C und w\xFCrde nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${n.id}): a path reaches the end "${o}" (outcome approved) without passing the countersignature ${i.map(u=>`"${u}"`).join(", ")} \u2014 there the contract would lack the signature of the legal entity "${r}" and never be billed. ${d.en}`};t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}`,reason:c,severity:"error"})}return t}s(yC,"checkCountersignCoverage");function rH(e){let t="error",n=new Map;for(let a of Zn(e.nodes)){let l=n.get(a.source)??[];l.push({id:a.id,target:a.target}),n.set(a.source,l)}let r=[],i=new Set,o=Jf(e.nodes.map(a=>a.id),a=>(n.get(a)??[]).map(({id:l,target:d})=>({target:d,edge:l})));for(let a of o)i.has(a.edge)||(i.add(a.edge),r.push({layer:"GRAPH",kind:"cycle",path:`edge.${a.edge}`,reason:{de:`Zyklus \xFCber Kante ${a.source} \u2192 ${a.target}`,en:`Cycle through edge ${a.source} \u2192 ${a.target}`},severity:t}));return r}s(rH,"checkAcyclic");function iH(e){let t=[],n=new Set(e.nodes.map(i=>i.id)),r="error";for(let i of e.nodes){let o=i.next;if(o)for(let[a,l]of Object.entries(o))n.has(l.to)||t.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.next.${a}`,reason:{de:`${i.label.de}: next.${a} verweist auf nicht-existenten Knoten '${l.to}'`,en:`${i.label.en}: next.${a} points to a node that does not exist: '${l.to}'`},severity:"error"});if(i.type!=="end"&&!(!i.outcomes||i.outcomes.length===0))for(let a of i.outcomes)(!o||!(a.id in o))&&t.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.outcome.${a.id}`,reason:{de:`${i.label.de}: Outcome '${a.label.de}' fehlt im next-Mapping`,en:`${i.label.en}: outcome '${a.label.en}' is missing from the next mapping`},severity:r})}return t}s(iH,"checkNextTargets");function oH(e){let t=[];for(let n of e.nodes){let r=n.next;if(!r)continue;let i=zy(n),o=new Set(i?i.map(a=>a.id):[zs]);for(let a of Object.keys(r))o.has(a)||t.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${n.id}.next.${a}`,reason:{de:`${n.label.de}: next-Schl\xFCssel '${a}' ist kein g\xFCltiges Outcome dieses Knotens (erlaubt: ${[...o].join(", ")}) \u2014 die Kante w\xFCrde im Editor verschwinden`,en:`${n.label.en}: next key '${a}' is not a valid outcome of this node (allowed: ${[...o].join(", ")}) \u2014 the edge would disappear in the editor`},severity:"error"})}return t}s(oH,"checkNextOutcomesKnown");function sH(e){let t=[],n=new Set(Zn(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!n.has(o.id));return r.length===0?t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:`Mehrere Start-Knoten (${r.map(o=>o.label.de).join(", ")})`,en:`Multiple start nodes (${r.map(o=>o.label.en).join(", ")})`},severity:"warning"}),e.nodes.filter(o=>o.type==="end").length===0&&t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),t}s(sH,"checkStartEnd");function aH(e){let t=new Map;for(let r of Zn(e.nodes))t.set(r.source,(t.get(r.source)??0)+1);let n=[];for(let r of e.nodes)r.type!=="end"&&(t.get(r.id)??0)===0&&n.push({layer:"GRAPH",kind:"startEnd",path:`node.${r.id}`,reason:{de:`${r.label.de}: keine ausgehende Kante`,en:`${r.label.en}: no outgoing edge`},severity:"warning"});return n}s(aH,"checkNoOutgoingEdge");function lH(e){return e.nodes.filter(t=>!Qg(t.id)).map(t=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${t.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${mr.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${t.id}": a node id is an identifier without a dot (${mr.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(lH,"checkNodeIdFormat");function dH(e){let t=new Set(e.nodes.map(r=>r.id)),n=[];for(let r of Zn(e.nodes))t.has(r.source)||n.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Quelle '${r.source}' nicht gefunden`,en:`Edge ${r.id}: source '${r.source}' not found`},severity:"error"}),t.has(r.target)||n.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Ziel '${r.target}' nicht gefunden`,en:`Edge ${r.id}: target '${r.target}' not found`},severity:"error"});return n}s(dH,"checkEdgeEndpoints");var cH=new Set(["countersignature"]);function uH(e){let t=[],n=s((o,a)=>{t.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:{de:`[graph/retiredField] ${a.de}`,en:`[graph/retiredField] ${a.en}`},severity:"error"})},"retired"),r={de:"Preise rechnet der Vertragsgenerator (`prices`), nicht der Workflow \u2014 binde Rang und Reduktion an seine Eing\xE4nge.",en:"Prices are computed by the contract generator (`prices`), not the workflow \u2014 bind rank and reduction to its inputs."},i=e;"pricingRules"in i&&n("pricingRules",r);for(let[o,a]of(Array.isArray(i.processStore)?i.processStore:[]).entries())for(let l of["derive","absentValue"])a!==null&&typeof a=="object"&&l in a&&n(`processStore.${o}.${l}`,r);for(let o of e.nodes)for(let a of o.tasks??[]){let l=a.result;l!==null&&typeof l=="object"&&"prices"in l&&n(`nodes.${o.id}.tasks.${a.key}.result.prices`,r)}for(let o of e.nodes){let a=o,l={de:`Knoten \u201E${Oe(e,o.id,"de")}\u201C (${o.id})`,en:`Node "${Oe(e,o.id,"en")}" (${o.id})`};for(let[c,u]of Object.entries(a.next??{}))u!==null&&typeof u=="object"&&"emits"in u&&n(`nodes.${o.id}.next.${c}.emits`,{de:`${l.de}: \`next.${c}.emits\` gibt es nicht mehr \u2014 ein Ausgang routet nur; ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`next.${c}.emits\` no longer exists \u2014 an outcome only routes; a node reads data through addresses in its own fields.`});for(let c of Array.isArray(a.outcomes)?a.outcomes:[])c!==null&&typeof c=="object"&&"emits"in c&&n(`nodes.${o.id}.outcomes.${String(c.id)}.emits`,{de:`${l.de}: \`emits\` am Ausgang "${String(c.id)}" gibt es nicht mehr \u2014 ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`emits\` on the outcome "${String(c.id)}" no longer exists \u2014 a node reads data through addresses in its own fields.`});"targetFormNodeId"in a&&n(`nodes.${o.id}.targetFormNodeId`,{de:`${l.de}: \`targetFormNodeId\` gibt es nicht mehr \u2014 welches Formular freigeschaltet wird, sagt die Adresse, an die der Eingang \`inputs.target\` gebunden ist ($node.<formular>.admission).`,en:`${l.en}: \`targetFormNodeId\` no longer exists \u2014 the address the input \`inputs.target\` is bound to says which form is unlocked ($node.<form>.admission).`}),"wires"in a&&n(`nodes.${o.id}.wires`,{de:`${l.de}: Datenkanten (\`wires\`) gibt es nicht mehr \u2014 jedes Feld, das Daten eines anderen Knotens liest, tr\xE4gt selbst die volle Adresse ($node.\u2026, $task.\u2026, $env.\u2026).`,en:`${l.en}: data edges (\`wires\`) no longer exist \u2014 every field that reads data of another node carries the full address itself ($node.\u2026, $task.\u2026, $env.\u2026).`});for(let[c,u]of Object.entries(a.inputs??{}))u!==null&&typeof u=="object"&&u.kind==="binding"&&"path"in u&&n(`nodes.${o.id}.inputs.${c}.path`,{de:`${l.de}: Der Eingang \u201E${c}\u201C ist \xFCber einen Pfad (\`path\`) gebunden \u2014 eine Bindung tr\xE4gt die volle Adresse (\`address\`) dessen, was sie liest.`,en:`${l.en}: The input "${c}" is bound through a path (\`path\`) \u2014 a binding carries the full address (\`address\`) of what it reads.`});o.type==="governedDocument"&&"resolver"in a&&n(`nodes.${o.id}.resolver`,{de:`${l.de}: \`resolver\` gibt es nicht mehr \u2014 der Generator ist der Eingang \`inputs.contractGenerator\` ({ kind, key }), seine Parameter stempelt die Plattform (\`generatorStamp\`), ein im Cockpit erg\xE4nzter Parameter ist sein Eingang \`{ kind: "cockpit" }\`.`,en:`${l.en}: \`resolver\` no longer exists \u2014 the generator is the input \`inputs.contractGenerator\` ({ kind, key }), the platform stamps its parameters (\`generatorStamp\`), a parameter completed in the cockpit is its input \`{ kind: "cockpit" }\`.`});let d=a.template;if(o.type==="governedDocument"&&d!==null&&typeof d=="object")for(let c of["key","cockpitFields"])c in d&&n(`nodes.${o.id}.template.${c}`,{de:`${l.de}: \`template.${c}\` gibt es nicht mehr \u2014 ${c==="key"?"die Vorlage ist der Eingang `inputs.documentTemplate`":'ein im Cockpit erg\xE4nzter Parameter ist sein Eingang `{ kind: "cockpit" }`'}.`,en:`${l.en}: \`template.${c}\` no longer exists \u2014 ${c==="key"?"the template is the input `inputs.documentTemplate`":'a parameter completed in the cockpit is its input `{ kind: "cockpit" }`'}.`});if(o.type==="setFlag")for(let c of["target","flagKey","value"])c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es am setFlag-Knoten nicht mehr \u2014 Formular, Merkmal und Wert sind die Eing\xE4nge \`inputs.target\` (gebunden an die Adresse $node.<formular>.admission), \`inputs.flagKey\` und \`inputs.value\` (feste Werte).`,en:`${l.en}: \`${c}\` no longer exists on a setFlag node \u2014 form, flag and value are the inputs \`inputs.target\` (bound to the address $node.<form>.admission), \`inputs.flagKey\` and \`inputs.value\` (literals).`});for(let c of Object.keys(Oy[o.type]??{}))c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es als Knoteneigenschaft nicht mehr \u2014 es ist der Eingang \`inputs.${c}\` (ein fester Wert im Parameter-Bereich).`,en:`${l.en}: \`${c}\` no longer exists as a node property \u2014 it is the input \`inputs.${c}\` (a fixed value among the parameters).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=c?.assign;u===null||typeof u!="object"||!("userId"in u)||n(`nodes.${o.id}.tasks.${String(c.key)}.assign.userId`,{de:`Aufgabe "${String(c.key)}" an ${l.de}: \`assign.userId\` gibt es nicht mehr \u2014 eine Aufgabe nennt ihr Team (\`assign.group\`), nie eine feste Person.`,en:`Task "${String(c.key)}" on ${l.en}: \`assign.userId\` no longer exists \u2014 a task names its team (\`assign.group\`), never a fixed person.`})}for(let c of _y[o.type]??[])c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es nicht mehr \u2014 dieser Knotentyp liest es nicht.`,en:`${l.en}: \`${c}\` no longer exists \u2014 this node type does not read it.`});for(let[c,u]of Object.entries(vO[o.type]??{}))c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&n(`nodes.${o.id}.adoptForm`,{de:`${l.de}: \`adoptForm: true\` gibt es nicht mehr \u2014 \`adoptForm\` ist die Adresse des \xFCbernommenen Formulars ($node.<anlegender Formularknoten>.admission).`,en:`${l.en}: \`adoptForm: true\` no longer exists \u2014 \`adoptForm\` is the address of the adopted form ($node.<creating form node>.admission).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=c?.result?.kind;typeof u=="string"&&cH.has(u)&&n(`nodes.${o.id}.tasks.${String(c.key)}.result`,{de:`Aufgabe "${String(c.key)}" an ${l.de}: das Ergebnis \u201E${u}" gibt es nicht mehr \u2014 die Gegenzeichnung ist der Knotentyp \u201EUnterschrift (intern)" (countersign).`,en:`Task "${String(c.key)}" on ${l.en}: the result "${u}" no longer exists \u2014 the countersignature is the node type "Signature (internal)" (countersign).`})}}return t}s(uH,"checkRetiredDataFields");function da(e,t){return t?.wiring&&t.layout?{wiring:t.wiring,layout:t.layout}:null}s(da,"resolveLayoutContext");function fH(e,t){let n=da(e,t);if(!n)return e.nodes.some(o=>(Ye(o)?.progressEvents?.length??0)>0)?[{layer:"GRAPH",kind:"progressState",path:"graph.progressWiring",reason:{de:`Graph emittiert Progress-Events, aber (Layout, Wiring) konnte nicht aufgel\xF6st werden (Wiring ${t?.wiring?"vorhanden":"fehlt"}, Layout ${t?.layout?"vorhanden":"fehlt"}) \u2014 der Engine wirft beim Spiegeln zur Laufzeit. Der Workflow-Entwurf muss progressLayout und progressWiring tragen.`,en:`The graph emits progress events, but (layout, wiring) could not be resolved (wiring ${t?.wiring?"present":"missing"}, layout ${t?.layout?"present":"missing"}) \u2014 the engine throws at runtime when mirroring. The workflow draft must carry progressLayout and progressWiring.`},severity:"error"}]:[];let r=[];for(let i of e.nodes){let a=Ye(i)?.progressEvents;if(a)for(let l of a){let d=js(n.wiring,{id:i.id,type:i.type},l);if(!d){r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Progress-Event '${l}' ist im Wiring (Layout '${n.layout.id}') keinem (Bus, State) zugeordnet \u2014 der Engine wirft beim Spiegeln`,en:`${i.type} '${i.id}': progress event '${l}' is not mapped to any (bus, state) in the wiring (layout '${n.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=_f(n.layout,d.bus)}catch{r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf unbekannten Bus '${d.bus}' im Layout '${n.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${n.layout.id}'`},severity:"error"});continue}El(c,d.state)||r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf State '${d.state}', der nicht im Bus '${d.bus}' deklariert ist`,en:`${i.type} '${i.id}': event '${l}' points to state '${d.state}', which is not declared in bus '${d.bus}'`},severity:"error"})}}return r}s(fH,"checkProgressEventMappings");function pH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses){if(!i.boards||i.boards.length===0)continue;let o=new Set(i.unboarded??[]),a=new Set;for(let l of i.boards)for(let d of l.columns)for(let c of d.states)a.add(c),El(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.board.${l.id}.column.${d.id}.${c}`,reason:{de:`Board '${l.id}', Spalte '${d.id}' referenziert State '${c}', der nicht im Bus '${i.key}' deklariert ist`,en:`Board '${l.id}', column '${d.id}' references state '${c}', which is not declared in bus '${i.key}'`},severity:"error"});for(let l of i.states)a.has(l.id)||o.has(l.id)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.${l.id}`,reason:{de:`State '${l.id}' (${l.label.de}) erscheint in keiner Board-Spalte und nicht in 'unboarded' \u2014 nicht darstellbar`,en:`State '${l.id}' (${l.label.en}) appears in no board column and not in 'unboarded' \u2014 it cannot be displayed`},severity:"error"})}return r}s(pH,"checkProgressBoardCoverage");function mH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses)if(!(!i.boards||i.boards.length===0))for(let o of i.boards)for(let a of ze){let l=new Map;for(let d of o.columns){if(!Ti(d.label))continue;let c=d.label[a],u=c.trim().toLocaleLowerCase(a),p=l.get(u);if(p===void 0){l.set(u,d.id);continue}r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.board.${o.id}.column.${d.id}.label.${a}`,reason:{de:`Board '${o.id}' hat zwei Spalten mit dem Label '${c}' (${a}) ('${p}' und '${d.id}') \u2014 f\xFCr Lesende nicht unterscheidbar. F\xFChre die Spalten zusammen (states beider in EINE Spalte) oder vergib unterschiedliche Labels.`,en:`Board '${o.id}' has two columns with the label '${c}' (${a}) ('${p}' and '${d.id}') \u2014 readers cannot tell them apart. Merge the columns (put the states of both into ONE column) or give them different labels.`},severity:"error"})}}return r}s(mH,"checkProgressBoardDistinctLabels");function hH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses)for(let o of i.states){let a=Nf(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`Terminal-State '${o.id}' hat keine Terminal-Semantik im Bus '${i.key}' \u2014 der Engine wirft beim Versiegeln`,en:`Terminal state '${o.id}' has no terminal semantics in bus '${i.key}' \u2014 the engine throws when sealing`},severity:"error"}),!o.terminal&&a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`State '${o.id}' ist nicht terminal, hat aber Terminal-Semantik im Bus '${i.key}' \u2014 Inkonsistenz`,en:`State '${o.id}' is not terminal but has terminal semantics in bus '${i.key}' \u2014 inconsistent`},severity:"error"})}return r}s(hH,"checkProgressTerminalSemantics");function gH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])El(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.holdsSeat.${a}`,reason:{de:`holdsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`holdsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let a of i.commitsSeat??[])El(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat '${a}' ist nicht in holdsSeat \u2014 ein fest belegter Platz muss auch belegt sein`,en:`commitsSeat '${a}' is not in holdsSeat \u2014 a firmly committed seat must also be held`},severity:"error"}):r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`commitsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let[a,l]of Object.entries(i.terminalSemantics??{}))l.outcome==="approved"&&(o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.holdsSeat`,reason:{de:`Endzustand '${a}' schlie\xDFt den Prozess positiv ab (outcome 'approved'), steht aber nicht in holdsSeat \u2014 damit z\xE4hlt er als Absage und f\xE4llt aus dem Fortschrittsbalken. Nimm '${a}' in holdsSeat (und in commitsSeat, wenn der Platz damit wirklich belegt ist) auf.`,en:`Final state '${a}' ends the process positively (outcome 'approved'), but is not in holdsSeat \u2014 so it counts as a rejection and drops out of the progress bar. Add '${a}' to holdsSeat (and to commitsSeat, if the seat is really taken by it).`},severity:"error"}))}return r}s(gH,"checkProgressSeatStates");var wp={de:"Abhilfe: nach dem Formularknoten einen review-Knoten einf\xFCgen und dessen 'reviewing' auf diesen Zustand mappen",en:"Remedy: insert a review node after the form node and map its 'reviewing' to this state"};function yH(e){return e==="both"?{de:`${wp.de} \u2014 die Spalte ist auch der Schritt, den die Familie sieht; den Zustand in die Spalte des Nachfolgers zu legen, n\xE4hme ihr diesen Schritt.`,en:`${wp.en} \u2014 the column is also the step the family sees; moving the state into the successor's column would take that step away from them.`}:{de:`${wp.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${wp.en}, or move the state into the successor's column.`}}s(yH,"passThroughRemedy");function wH(e,t){let n=da(e,t);if(!n)return[];let{layout:r,wiring:i}=n;if(!r.buses.some(v=>v.key==="process"))return[];let o=VO(r);if(!o)return[];let a=new Map(e.nodes.map(v=>[v.id,v])),l=s(v=>Ye(v).progressEvents??[],"eventsOf"),d=s(v=>Object.values(v.next??{}).map(A=>A.to),"routesOf"),c=s((v,A)=>{let E=a.get(v);if(!E||A.has(v))return null;if(l(E).length>0)return[E];if(kC[E.type]!==!1)return null;let I=d(E);if(I.length===0)return null;let C=[];for(let $ of I){let b=c($,new Set([...A,v]));if(!b)return null;C.push(...b)}return C},"firstProgressNodes"),u=s((v,A)=>{let E=[];for(let I of l(v)){let C=js(i,v,I);if(!C||C.bus!==A.bus||C.state===A.state)return null;E.push(C.state)}return[...new Set(E)].join("' / '")},"overwrites"),p=s((v,A)=>{let E=d(v);if(E.length===0)return null;let I=[];for(let C of E){let $=c(C,new Set([v.id]));if(!$)return null;for(let b of $){let R=u(b,A);if(R===null)return null;I.push({de:`'${b.id}' (${b.type}) mit '${R}'`,en:`'${b.id}' (${b.type}) with '${R}'`})}}return[...new Map(I.map(C=>[C.de,C])).values()]},"submitOverwrittenBy"),h=new Map;for(let v of e.nodes)for(let A of l(v)){let E=js(i,v,A);if(!E||E.bus!=="process")continue;let I=v.type==="form"&&A===ef?p(v,E):null,C=I?{de:`'${v.id}'.${A} erreicht ihn, und ${I.map($=>$.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${v.id}'.${A} reaches it, and ${I.map($=>$.en).join(", ")} overwrites it in the same transaction`}:null;h.set(E.state,[...h.get(E.state)??[],C])}let w=_f(r,"process"),k=new Map;for(let[v,A]of h){if(!A.every(I=>I!==null))continue;let E=[...new Map(A.map(I=>[I.de,I])).values()];k.set(v,{de:E.map(I=>I.de).join("; "),en:E.map(I=>I.en).join("; ")})}let y=[];for(let v of o.columns){if(v.states.length===0||!v.states.every(I=>k.has(I)))continue;let A=v.states.map(I=>{let C=w.holdsSeat?.includes(I)===!0,$=k.get(I);return{de:`Zustand '${I}'${C?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${$.de}`,en:`State '${I}'${C?" (is in holdsSeat, but never takes a seat)":""}: ${$.en}`}}),E=yH(o.audience);y.push({layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${o.id}.columns.${v.id}`,reason:{de:`[progress/passThroughState] Spalte \u201E${v.label.de}" ('${v.id}', Board '${o.id}') bleibt immer leer \u2014 ${A.map(I=>I.de).join("; ")}. ${E.de}`,en:`[progress/passThroughState] Column "${v.label.en}" ('${v.id}', board '${o.id}') always stays empty \u2014 ${A.map(I=>I.en).join("; ")}. ${E.en}`},severity:"warning"})}return y}s(wH,"checkProgressPassThroughColumns");function kH(e){let t=["workItems","workitems","work_items","taskTemplates"],n=[];for(let r of e.nodes){let i=r;for(let o of t){let a=i[o];a!=null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.${o}`,reason:{de:`[workItems/misnamedTasksKey] Knoten "${r.id}" deklariert "${o}" \u2014 komponierte Aufgaben werden ausschlie\xDFlich unter "tasks" gelesen. So wie es dasteht, w\xFCrde die Aufgabenkette stillschweigend nie entstehen. Benenne den Schl\xFCssel in "tasks" um.`,en:`[workItems/misnamedTasksKey] Node "${r.id}" declares "${o}" \u2014 composed tasks are read only from "tasks". As it stands, the task chain would silently never be created. Rename the key to "tasks".`},severity:"error"})}}return n}s(kH,"checkMisnamedTasksKey");function bH(e){let t=[];for(let n of e.nodes){let r=n,i=Array.isArray(r.tasks)?r.tasks:[],o=new Set;for(let c of i){let u=typeof c.key=="string"?c.key:void 0;u!==void 0&&(o.has(u)&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}`,reason:{de:`[workItems/duplicateTemplateKey] Doppelter Template-Key "${u}" auf Knoten "${r.id}".`,en:`[workItems/duplicateTemplateKey] Duplicate template key "${u}" on node "${r.id}".`},severity:"error"}),o.add(u))}let a=new Set;for(let c of Array.isArray(r.artifacts)?r.artifacts:[])typeof c.key=="string"&&a.add(`${c.key}Uploaded`);let l=Ye(n),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(n):[]).map(c=>[c.key,c]));for(let c of i){let u=typeof c.key=="string"?c.key:"?",p=typeof c.kind=="string"?c.kind:void 0;if(p===void 0||!Cl.has(p)){t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.kind`,reason:{de:`[workItems/invalidKind] Task "${u}" auf Knoten "${r.id}" hat Art ${JSON.stringify(c.kind)}; komponierbar sind: ${[...Cl].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...Cl].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.gatesNode`,reason:{de:`[workItems/gatesNodeOnTask] 'gatesNode' ist nur f\xFCr die Art 'approval' zul\xE4ssig \u2014 eine Task gated ihren Knoten nie direkt. Um eine gatende Freigabe zur\xFCckzuhalten, 'blocks' verwenden (Task "${u}" auf Knoten "${r.id}").`,en:`[workItems/gatesNodeOnTask] 'gatesNode' is only allowed for the kind 'approval' \u2014 a task never gates its node directly. To hold back a gating approval, use 'blocks' (task "${u}" on node "${r.id}").`},severity:"error"});let h=c.blocks,w=h===void 0?void 0:FN(e,r.id,h.node);if(h!==void 0&&w===null)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.node`,reason:{de:`[workItems/blocksUnknownNode] 'blocks.node' auf Task "${u}" (Knoten "${r.id}") nennt ${JSON.stringify(h.node)} \u2014 diesen Knoten gibt es im Workflow nicht.`,en:`[workItems/blocksUnknownNode] 'blocks.node' on task "${u}" (node "${r.id}") names ${JSON.stringify(h.node)} \u2014 there is no such node in the workflow.`},severity:"error"});else if(h!==void 0&&w!==void 0&&w!==null){let y=w.node.id===r.id,v=w.node.id,A=y?o:w.composedKeys,E=y?d:w.intrinsicByKey,I=w.node.assign??{};p==="approval"&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksOnApproval] 'blocks' ist auf der Art 'approval' verboten \u2014 nur Task-Zeilen d\xFCrfen einen Geschwister-Spawn zur\xFCckhalten (Approval "${u}" auf Knoten "${r.id}").`,en:`[workItems/blocksOnApproval] 'blocks' is forbidden on the kind 'approval' \u2014 only task rows may hold back a sibling spawn (approval "${u}" on node "${r.id}").`},severity:"error"});let C=h.templateKey,$=[...new Set([...A,...E.keys()])].filter(R=>!y||R!==u).join(", "),b={de:$||"keine",en:$||"none"};if(typeof C!="string"||y&&C===u||!A.has(C)&&!E.has(C))t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnknownTarget] 'blocks' muss ein Template auf dem Zielknoten benennen \u2014 komponiert ODER intrinsisch (nie sich selbst, nie ohne 'templateKey': die zielfreie Form geh\xF6rt der Maschine, nicht dem Autor). Ziel ${JSON.stringify(C)} auf Knoten "${v}"; zul\xE4ssige Ziele: ${b.de}.`,en:`[workItems/blocksUnknownTarget] 'blocks' must name a template on the target node \u2014 composed OR intrinsic (never itself, never without 'templateKey': the target-less form belongs to the engine, not the author). Target ${JSON.stringify(C)} on node "${v}"; allowed targets: ${b.en}.`},severity:"error"});else if(w.refuse(C)!==null)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:w.refuse(C),severity:"error"});else{let R=E.get(C);h.except!==void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.except`,reason:{de:`[workItems/blocksExceptRetired] 'blocks.except' auf Task "${u}" (Knoten "${r.id}") gibt es nicht mehr: eine blockierende Aufgabe sperrt die ganze Aktionsgruppe ihres Ziels (bei einer Entscheidung Freigeben, Warteliste, Ablehnen und das Nachr\xFCcken). 'except' entfernen.`,en:`[workItems/blocksExceptRetired] 'blocks.except' on task "${u}" (node "${r.id}") no longer exists: a blocking task locks the whole action group of its target (for a decision: approve, waitlist, reject and promote). Remove 'except'.`},severity:"error"}),R!==void 0&&R.recipient!=="external"&&R.verdictResolved!==!0&&typeof I[C]!="string"&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnwiredTarget] Task "${u}" auf Knoten "${r.id}" h\xE4lt "${C}" (Knoten "${v}") zur\xFCck, aber der Knoten weist "${C}" keiner Gruppe zu \u2014 ohne 'assign.${C}' entsteht diese Zeile nie: kein Team bekommt die zur\xFCckgehaltene Arbeit, niemand au\xDFer der verantwortlichen Person kann sie tun. Entweder 'assign.${C}' erg\xE4nzen oder das 'blocks' entfernen.`,en:`[workItems/blocksUnwiredTarget] Task "${u}" on node "${r.id}" holds back "${C}" (node "${v}"), but the node assigns "${C}" to no group \u2014 without 'assign.${C}' this row is never created: no team receives the held-back work, and nobody except the responsible person can do it. Either add 'assign.${C}' or remove the 'blocks'.`},severity:"error"})}}{let y=c.completableIf;if(typeof y=="string"&&y.trim().length>0){let v=y.trim().replace(/^!/,"").trim();a.has(v)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.completableIf`,reason:{de:`[workItems/unknownExport] completableIf "${y}" verweist auf unbekannten Node-Export "${v}"; bekannt: ${[...a].join(", ")||"keine"}.`,en:`[workItems/unknownExport] completableIf "${y}" refers to unknown node export "${v}"; known: ${[...a].join(", ")||"none"}.`},severity:"error"})}}let k=c.params;if(k?.commentRequired!==void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.commentRequired`,reason:{de:"[workItems/removedParam] 'params.commentRequired' wurde entfernt \u2014 Kommentar-Pflichten werden am Decision-Node ('commentRequired') autorisiert.",en:"[workItems/removedParam] 'params.commentRequired' was removed \u2014 comment requirements are authored on the decision node ('commentRequired')."},severity:"error"}),p!=="approval"){let y=[];k?.onReject!==void 0&&y.push("params.onReject"),k?.revisionGroup!==void 0&&y.push("params.revisionGroup");for(let v of y)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.${v}`,reason:{de:`[workItems/approvalOnlyField] '${v}' gilt nur f\xFCr die Art 'approval' (Task "${u}" ist '${p}').`,en:`[workItems/approvalOnlyField] '${v}' only applies to the kind 'approval' (task "${u}" is '${p}').`},severity:"error"});continue}k?.onReject!==void 0&&k.onReject!=="spawnRevision"&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.onReject`,reason:{de:`[workItems/invalidOnReject] Erwartet 'spawnRevision', erhalten ${JSON.stringify(k.onReject)}.`,en:`[workItems/invalidOnReject] Expected 'spawnRevision', got ${JSON.stringify(k.onReject)}.`},severity:"error"}),k?.onReject==="spawnRevision"&&(typeof k.revisionGroup!="string"||k.revisionGroup.length===0)&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.revisionGroup`,reason:{de:`[workItems/spawnRevisionNoTarget] Approval "${u}" mit 'params.onReject: spawnRevision' ohne 'params.revisionGroup' \u2014 die \xDCberarbeitung h\xE4tte keine Ziel-Gruppe.`,en:`[workItems/spawnRevisionNoTarget] Approval "${u}" with 'params.onReject: spawnRevision' but no 'params.revisionGroup' \u2014 the revision would have no target group.`},severity:"error"})}}return t.push(...LN(e)),t}s(bH,"checkWorkItemTemplates");var vH=new Set(["complete","approve","reject"]),kC={form:!0,decision:!0,review:!0,waitlist:!0,completenessCheck:!0,collectPayment:!0,eventTrigger:!0,join:!1,roleAssign:!1,setFlag:!1,if:!1,end:!1,countersign:!0,engagePush:!1,governedDocument:!0};function xH(e){let t=[];for(let n of e.nodes){let r=n,i=Ye(n),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(n)??[];if(o+a.length>0){let v=kC[r.type];v===void 0?t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/unknownParkSemantics] Knotentyp "${r.type}" hat keine bekannte Park-Semantik \u2014 NODE_TYPE_PARKS in validators.ts erg\xE4nzen.`,en:`[workItems/unknownParkSemantics] Node type "${r.type}" has no known parking semantics \u2014 add it to NODE_TYPE_PARKS in validators.ts.`},severity:"error"}):v||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/templatesOnNonParkingNode] Knoten "${r.id}" (Typ "${r.type}") parkt nie \u2014 seine Work-Item-Templates w\xFCrden im selben Dispatch gespawnt und storniert (totes Muster).`,en:`[workItems/templatesOnNonParkingNode] Node "${r.id}" (type "${r.type}") never parks \u2014 its work-item templates would be spawned and cancelled in the same dispatch (dead pattern).`},severity:"error"})}let l=i.actions?.(n)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(v=>[v.id,v]));for(let v of l)vH.has(v.id)&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/reservedActionId] Knotentyp "${r.type}" deklariert die Action "${v.id}" \u2014 reserviert f\xFCr den generischen Complete-/Verdict-Pfad (complete, approve, reject); die Spec muss eine andere Action-Id w\xE4hlen.`,en:`[capability/reservedActionId] Node type "${r.type}" declares the action "${v.id}" \u2014 reserved for the generic complete/verdict path (complete, approve, reject); the spec must choose a different action id.`},severity:"error"});let c=new Set(i.states??[i_]);for(let v of l)if(v.availableIn!==void 0)for(let A of v.availableIn)c.has(A)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.availableIn`,reason:{de:`[capability/unknownActionState] Action "${v.id}" auf Knotentyp "${r.type}" ist f\xFCr Zustand "${A}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${v.id}" on node type "${r.type}" is declared for state "${A}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=zy(n),p=new Set(u?u.map(v=>v.id):[zs]);for(let v of l){if(v.external===void 0)continue;let A=r_(v.external.event),E={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},I=A?v.kind==="advance"?{de:`ist als "advance" deklariert, l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 solche Aktionen sind "internal"`,en:`is declared as "advance", but does not resolve the node (event "${v.external.event}") \u2014 such actions are "internal"`}:v.outcome!==void 0?{de:`nennt das Outcome "${v.outcome}", l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 ein Outcome w\xFCrde eine zweite, stille Routing-Vokabel behaupten`,en:`names the outcome "${v.outcome}", but does not resolve the node (event "${v.external.event}") \u2014 an outcome would claim a second, silent routing vocabulary`}:v.label===void 0?E:null:v.kind!=="advance"?{de:`ist als "${v.kind}" deklariert (externe Aktionen l\xF6sen den Knoten auf und m\xFCssen "advance" sein)`,en:`is declared as "${v.kind}" (external actions resolve the node and must be "advance")`}:v.outcome===void 0?{de:"nennt kein Outcome",en:"names no outcome"}:p.has(v.outcome)?v.label===void 0?E:null:{de:`verweist auf das unbekannte Outcome "${v.outcome}" (deklariert: ${[...p].join(", ")||"keine"})`,en:`refers to the unknown outcome "${v.outcome}" (declared: ${[...p].join(", ")||"none"})`};I!==null&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.external`,reason:{de:`[capability/externalActionNeedsOutcome] Externe Aktion "${v.id}" auf Knotentyp "${r.type}" ${I.de}.`,en:`[capability/externalActionNeedsOutcome] External action "${v.id}" on node type "${r.type}" ${I.en}.`},severity:"error"})}for(let v of a){let A=v.unlocks;if(A.length===0&&v.verdictResolved!==!0&&v.informational!==!0){t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/emptyUnlocks] Intrinsisches Template "${v.key}" auf Knoten "${r.id}" schaltet keine Action frei (B5).`,en:`[capability/emptyUnlocks] Intrinsic template "${v.key}" on node "${r.id}" unlocks no action (B5).`},severity:"error"});continue}for(let E of A)d.get(E)===void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/danglingUnlock] Template "${v.key}" auf Knoten "${r.id}" schaltet unbekannte Action "${E}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${v.key}" on node "${r.id}" unlocks the unknown action "${E}"; declared: ${[...d.keys()].join(", ")||"none"}.`},severity:"error"})}let h=new Set(a.map(v=>v.key));for(let v of Object.keys(r.assign??{}))h.has(v)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.assign.${v}`,reason:{de:`[capability/unknownAssignKey] assign-Key "${v}" auf Knoten "${r.id}" ist kein intrinsisches Template dieses Knotentyps; bekannt: ${[...h].join(", ")||"keine"}.`,en:`[capability/unknownAssignKey] assign key "${v}" on node "${r.id}" is not an intrinsic template of this node type; known: ${[...h].join(", ")||"none"}.`},severity:"error"});let w=l.filter(v=>v.teamAssignable===!0).map(v=>v.id);for(let v of Object.keys(r.actionTeams??{}))w.includes(v)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actionTeams.${v}`,reason:{de:`[capability/unknownActionTeam] Knoten "${r.id}" nennt ein Team f\xFCr "${v}", aber diese Aktion l\xE4sst sich hier keinem Team geben; m\xF6glich: ${w.join(", ")||"keine"}.`,en:`[capability/unknownActionTeam] Node "${r.id}" names a team for "${v}", but this action cannot be given to a team here; possible: ${w.join(", ")||"none"}.`},severity:"error"});let k=new Set;for(let v of a)if(v.recipient==="external"||typeof(r.assign??{})[v.key]=="string")for(let E of v.unlocks)k.add(E);let y=i.strictActionCoverage===!0;for(let v of l){if(k.has(v.id)||v.superUserOnly===!0)continue;let A=a.find(I=>I.unlocks.includes(v.id)),E=A!==void 0?{de:` Fehlt die Zuweisung assign.${A.key}?`,en:` Is the assignment assign.${A.key} missing?`}:{de:"",en:""};t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/superUserOnly] Action "${v.id}" auf Knoten "${r.id}" ist von keinem verdrahteten Work-Item freigeschaltet \u2014 nur die verantwortliche Person (Super-User) kann sie ausf\xFChren.${E.de}`,en:`[capability/superUserOnly] Action "${v.id}" on node "${r.id}" is unlocked by no wired work item \u2014 only the responsible person (super user) can perform it.${E.en}`},severity:y?"error":"warning"})}}return t}s(xH,"checkNodeCapabilityWiring");function SH(e){let t=new Set(zI()),n=[];for(let r of e.nodes)t.has(r.type)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.type`,reason:{de:`[graph/unknownNodeType] Knoten "${r.id}" hat den unbekannten Typ "${String(r.type)}". Registrierte Typen: ${[...t].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...t].join(", ")}.`},severity:"error"});return n}s(SH,"checkKnownNodeTypes");function AH(e,t){let n=[],r=s((a,l)=>{n.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=tI(e),o=s(a=>typeof a=="object"&&a!==null&&Object.values(a).some(l=>typeof l=="string"&&l.trim().length>0),"hasText");for(let a of e.nodes){let l=a,d=Array.isArray(l.optionalActions)?l.optionalActions:[];if(n.push(...MH(l,d)),d.length===0)continue;let c=Ye(a),u=new Set(c.optionalActionKinds??[]),p=Array.isArray(l.tasks)?l.tasks:[],h=new Map;for(let y of p)typeof y.key=="string"&&h.set(y.key,y);let w=new Set,k=new Map;for(let y of d){let v=y.key,A=typeof v=="string"&&v.trim().length>0?v:void 0,E=A??"?",I=`nodes.${l.id}.optionalActions.${E}`,C=typeof y.action=="string"?y.action:void 0;if(y.when!==void 0){let $=s(b=>r(`${I}.when`,{de:`[optionalAction/when] Optionale Aktion "${E}" auf Knoten "${l.id}": ${b.de}`,en:`[optionalAction/when] Optional action "${E}" on node "${l.id}": ${b.en}`}),"conditionFinding");if(typeof y.when!="string"||y.when.trim()==="")$({de:"Die Bedingung ist leer \u2014 ohne Bedingung das Feld weglassen.",en:"The condition is empty \u2014 without a condition, omit the field."});else for(let b of Xf(y.when,i,t))$(b)}if((C===void 0||!u.has(C))&&r(`${I}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${E}" auf Knoten "${l.id}" hat die Art ${JSON.stringify(y.action)} \u2014 `+(u.size===0?`Knotentyp "${l.type}" deklariert keine Familien (spec.optionalActionKinds fehlt).`:`Knotentyp "${l.type}" deklariert nur: ${[...u].join(", ")}.`),en:`[optionalAction/kindNotDeclared] Optional action "${E}" on node "${l.id}" has the kind ${JSON.stringify(y.action)} \u2014 `+(u.size===0?`node type "${l.type}" declares no families (spec.optionalActionKinds is missing).`:`node type "${l.type}" only declares: ${[...u].join(", ")}.`)}),A===void 0?r(`${I}.key`,{de:`[optionalAction/missingKey] Optionale Aktion auf Knoten "${l.id}" ohne (oder mit leerem) 'key' \u2014 Trigger-Action und Template-Keys w\xE4ren namenlos ('optionalAction::\u2026').`,en:`[optionalAction/missingKey] Optional action on node "${l.id}" without (or with an empty) 'key' \u2014 the trigger action and template keys would be nameless ('optionalAction::\u2026').`}):(w.has(A)&&r(`${I}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${A}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${A}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),w.add(A)),o(y.label)||r(`${I}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${E}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${E}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),C==="spawnTasks"){y.except!==void 0&&r(`${I}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${E}" auf Knoten "${l.id}" tr\xE4gt 'except' \u2014 das gibt es nicht mehr: solange die Aufgaben offen sind, ist die ganze Aktionsgruppe des Knotens gesperrt. 'except' entfernen.`,en:`[optionalAction/exceptRetired] Optional action "${E}" on node "${l.id}" carries 'except' \u2014 that no longer exists: while the tasks are open, the node's whole action group is locked. Remove 'except'.`});let $=Array.isArray(y.tasks)?y.tasks:void 0;if($===void 0||$.length===0)r(`${I}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${E}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${E}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let b=new Set,R=new Set($.filter(q=>typeof q=="string"));for(let q of $){let _=typeof q=="string"?q:void 0;if(_===void 0||_.length===0){r(`${I}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${E}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${E}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(b.has(_)){r(`${I}.tasks.${_}`,{de:`[optionalAction/duplicateTaskRef] Template "${_}" ist in der Aktion "${E}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${_}" is referenced twice in the action "${E}" on node "${l.id}".`});continue}b.add(_);let J=h.get(_);if(J===void 0){r(`${I}.tasks.${_}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${E}" auf Knoten "${l.id}" referenziert das Template "${_}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${E}" on node "${l.id}" references the template "${_}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let Y=k.get(_);Y!==void 0&&Y!==E?r(`${I}.tasks.${_}`,{de:`[optionalAction/taskDoublyBound] Template "${_}" auf Knoten "${l.id}" ist bereits von der Aktion "${Y}" referenziert \u2014 ein Template geh\xF6rt zu h\xF6chstens einer optionalen Aktion.`,en:`[optionalAction/taskDoublyBound] Template "${_}" on node "${l.id}" is already referenced by the action "${Y}" \u2014 a template belongs to at most one optional action.`}):k.set(_,E);let ue=J.blocks?.templateKey;typeof ue=="string"&&!R.has(ue)&&r(`${I}.tasks.${_}`,{de:`[optionalAction/taskRefBlocks] Template "${_}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${ue}", das nicht zur selben Aktion "${E}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${_}" on node "${l.id}" carries 'blocks' on "${ue}", which does not belong to the same action "${E}" \u2014 a reference may only hold back a reference of the SAME action (checklist order), never a template outside it.`});for(let Q of p){let re=typeof Q.key=="string"?Q.key:void 0;Q.blocks?.templateKey===_&&(re!==void 0&&R.has(re)||r(`${I}.tasks.${_}`,{de:`[optionalAction/taskRefBlocks] Template "${_}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${re!==void 0?`"${re}"`:"einem Template"} au\xDFerhalb der Aktion "${E}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${_}" on node "${l.id}" is the target of a 'blocks' from ${re!==void 0?`"${re}"`:"a template"} outside the action "${E}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return n}s(AH,"checkOptionalActions");function EH(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(EH,"literalValueType");function TH(e,t){let n=[],r=t?.notificationTemplates;for(let i of e.nodes){let o=i,a=A_(i,Ye(i)),l=o.notifications??{};if(a.length===0&&Object.keys(l).length===0)continue;let d=new Map(a.map(c=>[c.id,c]));for(let c of Object.keys(l))d.has(c)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c}`,reason:{de:`[notification/unknownEvent] Knoten "${o.id}" bindet einen Brief an das Ereignis "${c}", das der Knotentyp "${o.type}" nicht kennt. Angeboten werden: ${a.map(u=>u.id).join(", ")||"(keine)"}.`,en:`[notification/unknownEvent] Node "${o.id}" binds a letter to the event "${c}", which the node type "${o.type}" does not know. Offered: ${a.map(u=>u.id).join(", ")||"(none)"}.`},severity:"error"});for(let c of a){let u=l[c.id];if(c.required===!0&&(u===void 0||u.disabled===!0)){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c.id}`,reason:{de:`[notification/missingBinding] Knoten "${o.id}" muss beim Ereignis "${c.label.de}" (${c.id}) einen Brief verschicken \u2014 es ist ${u===void 0?"keiner gebunden":"einer gebunden, aber abgeschaltet"}.`,en:`[notification/missingBinding] Node "${o.id}" must send a letter on the event "${c.label.en}" (${c.id}) \u2014 ${u===void 0?"none is bound":"one is bound, but switched off"}.`},severity:"error"});continue}if(u===void 0||u.disabled===!0)continue;let p=`nodes.${o.id}.notifications.${c.id}`;if(c.audience!=="external"){n.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/internalAudienceUnsupported] Knoten "${o.id}": das Ereignis "${c.id}" richtet sich an die Schule, und Briefe an die Schule k\xF6nnen noch nicht zugestellt werden \u2014 der gebundene Brief "${u.templateId}" w\xFCrde den Vorgang beim Versand abbrechen.`,en:`[notification/internalAudienceUnsupported] Node "${o.id}": the event "${c.id}" is addressed to the school, and letters to the school cannot be delivered yet \u2014 the bound letter "${u.templateId}" would abort the process when it is sent.`},severity:"error"});continue}if(r===void 0)continue;let h=r.get(u.templateId);if(h===void 0){n.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/unknownTemplate] Knoten "${o.id}": der Brief "${u.templateId}" ist nicht im Katalog. Bekannt sind: ${[...r.keys()].sort().join(", ")||"(keine)"}.`,en:`[notification/unknownTemplate] Node "${o.id}": the letter "${u.templateId}" is not in the catalog. Known: ${[...r.keys()].sort().join(", ")||"(none)"}.`},severity:"error"});continue}h.audience!==void 0&&h.audience!==c.audience&&n.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/audienceMismatch] Der Brief "${h.id}" ist f\xFCr ${h.audience==="internal"?"die Schule":"die Familie"} geschrieben, das Ereignis "${c.id}" richtet sich aber an die Familie.`,en:`[notification/audienceMismatch] The letter "${h.id}" is written for ${h.audience==="internal"?"the school":"the family"}, but the event "${c.id}" is addressed to the family.`},severity:"warning"});let w=k_(c),k=new Set(h.params.map(y=>y.key));for(let y of Object.keys(u.args??{}))k.has(y)||n.push({layer:"GRAPH",kind:"nodeRule",path:`${p}.args.${y}`,reason:{de:`[notification/unknownArg] Der Brief "${h.id}" hat kein Argument "${y}" \u2014 erwartet werden: ${h.params.map(v=>v.key).join(", ")||"(keine)"}.`,en:`[notification/unknownArg] The letter "${h.id}" has no argument "${y}" \u2014 expected: ${h.params.map(v=>v.key).join(", ")||"(none)"}.`},severity:"error"});for(let y of h.params){let v=u.args?.[y.key],A=`${p}.args.${y.key}`;if(v!==void 0&&"literal"in v){let I=EH(v.literal);y.type!==void 0&&!sw(I,y.type)&&n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/argTypeMismatch] "${y.key}" erwartet ${_l(y.type).de}, festgelegt ist aber ${JSON.stringify(v.literal)} (${I}).`,en:`[notification/argTypeMismatch] "${y.key}" expects ${_l(y.type).en}, but ${JSON.stringify(v.literal)} (${I}) is set.`},severity:"error"});continue}if(v!==void 0){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unsupportedArg] "${y.key}" ist an ${JSON.stringify(v)} gebunden \u2014 ein Brief-Argument kann nur ein Festwert ({ literal }) sein oder automatisch aus ${wC(w,"de")} kommen.`,en:`[notification/unsupportedArg] "${y.key}" is bound to ${JSON.stringify(v)} \u2014 a letter argument can only be a fixed value ({ literal }) or come automatically from ${wC(w,"en")}.`},severity:"error"});continue}let E=b_(y,w.get(y.key)??[]);if(!(E.status==="resolved"||E.status==="unused")){if(E.status==="sometimes"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Der Brief "${h.id}" braucht "${y.key}" immer, ${E.source.source} liefert es aber nur manchmal. In notifications.${c.id}.args.${y.key} einen Festwert benennen \u2014 oder einen Brief w\xE4hlen, der ohne "${y.key}" auskommt.`,en:`[notification/unresolvedArg] The letter "${h.id}" always needs "${y.key}", but ${E.source.source} provides it only sometimes. Name a fixed value in notifications.${c.id}.args.${y.key} \u2014 or choose a letter that works without "${y.key}".`},severity:"error"});continue}if(E.status==="ambiguous"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/ambiguousArg] "${y.key}" hat mehrere passende Quellen \u2014 ${E.matches.map(I=>I.source).join(", ")}. In notifications.${c.id}.args.${y.key} einen Festwert setzen.`,en:`[notification/ambiguousArg] "${y.key}" has several matching sources \u2014 ${E.matches.map(I=>I.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${y.key}.`},severity:"error"});continue}n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Der Brief "${h.id}" braucht "${y.key}"${y.type!==void 0?` (${_l(y.type).de})`:""}, und der Knoten hat daf\xFCr ${E.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${E.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The letter "${h.id}" needs "${y.key}"${y.type!==void 0?` (${_l(y.type).en})`:""}, and the node has ${E.rejected.length===0?"no source for it":`only unsuitable sources for it: ${E.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`},severity:"error"})}}}}return n}s(TH,"checkNotificationBindings");function $H(e){return tN(e).map(t=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:t,severity:"error"}))}s($H,"checkAssignmentRules");function wC(e,t){let n=[...e.keys()].sort();return n.length===0?t==="de"?"(nichts)":"(nothing)":n.join(", ")}s(wC,"describeCandidates");function RH(e,t){return iN(e,t?.teamKeys).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(RH,"checkChannels");function IH(e){return rI(e).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(IH,"checkStaffInputs");function OH(e,t){let n=[];for(let r of e.nodes){let i=r.reads;if(i===void 0)continue;let o=`nodes.${r.id}.reads`,a={de:`Knoten \u201E${Oe(e,r.id,"de")}\u201C (${r.id})`,en:`Node "${Oe(e,r.id,"en")}" (${r.id})`},l=s(c=>{n.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!mN(r)){l({de:`[readiness/readsNotGated] ${a.de} (${r.type}) deklariert \`reads\`, aber die Bereitschaftspr\xFCfung h\xE4lt nur Entscheidungs-Knoten und Dokument-Knoten mit Produktion \u2014 hier w\xFCrde \`reads\` nichts bewirken.`,en:`[readiness/readsNotGated] ${a.en} (${r.type}) declares \`reads\`, but the readiness check only holds decision nodes and document nodes with production \u2014 here \`reads\` would have no effect.`});continue}if(!Array.isArray(i)){l({de:`[readiness/readsDuplicate] \`reads\` von ${a.de} muss eine Liste von Feldadressen sein, erhalten ${JSON.stringify(i)}.`,en:`[readiness/readsDuplicate] \`reads\` of ${a.en} must be a list of field addresses, got ${JSON.stringify(i)}.`});continue}let d=new Set;for(let c of i){if(!xe(c))continue;let u=pe(c);if(d.has(u)){l({de:`[readiness/readsDuplicate] ${a.de} liest ${je(e,c,"de")} mehrfach.`,en:`[readiness/readsDuplicate] ${a.en} reads ${je(e,c,"en")} more than once.`});continue}if(d.add(u),!ct(c)){l({de:`[readiness/readsUnknownField] ${a.de} liest ${je(e,c,"de")} \u2014 \`reads\` nennt nur Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[readiness/readsUnknownField] ${a.en} reads ${je(e,c,"en")} \u2014 \`reads\` only names fields of a form ($node.<form>.admission.<field>).`});continue}let p=ni(t,c);p!=null&&Ks("nodeReads",qs(p))==="repeated"&&l({de:`[readiness/readsUnknownField] ${a.de} liest ${je(e,c,"de")} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Feld der Anmeldung und kann nicht gelesen werden.`,en:`[readiness/readsUnknownField] ${a.en} reads ${je(e,c,"en")} \u2014 a field in a repeated group is not a single field of the application and cannot be read.`})}}return n}s(OH,"checkReadinessReads");function _H(e,t){let n=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=oO(r),o=bf(r);if(i===null||o===null)continue;let a=t?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${It.flagKey}`,reason:{de:`[setFlag/unknownFlag] Knoten \u201E${Oe(e,r.id,"de")}\u201C (${r.id}) setzt \u201E${o}\u201C, aber das Formular von \u201E${Oe(e,i,"de")}\u201C hat kein externes Merkmal dieses Namens`+(l.length>0?` (vorhanden: ${l.join(", ")}).`:" \u2014 es deklariert gar keins."),en:`[setFlag/unknownFlag] Node "${Oe(e,r.id,"en")}" (${r.id}) sets "${o}", but the form of "${Oe(e,i,"en")}" has no external flag of that name`+(l.length>0?` (present: ${l.join(", ")}).`:" \u2014 it declares none at all.")},severity:"error"})}return n}s(_H,"checkSetFlagKeys");function NH(e,t){let n=t?.readinessFormFieldsByFormNode,r=t?.readinessPartyConditionKeysByFormNode;if(n===void 0||r===void 0)return[];let i=[];for(let o of e.nodes){if(o.type!=="governedDocument"||o.production!=="resolver")continue;let a=o.form;if(!xe(a)||!wr(a))continue;let l=n.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=kw(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(y=>ct(y)&&y.owner===a.owner),h=kw(l,[...p.map(y=>y.path),...yN(o).filter(y=>y.owner===a.owner).map(y=>y.fieldKey)]),w=[...c].filter(y=>!h.has(y)).sort();if(w.length===0)continue;let k={de:Oe(e,a.owner,"de"),en:Oe(e,a.owner,"en")};i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.reads`,reason:{de:`[readiness/readsMissesPartyCondition] Knoten \u201E${Oe(e,o.id,"de")}\u201C (${o.id}) erzeugt ein Dokument, dessen Vertragsparteien von Angaben im Formular \u201E${k.de}\u201C abh\xE4ngen, die er weder liest noch bindet: ${w.join(", ")}. Eine Korrektur darauf h\xE4lt den Knoten nicht an und kann nach der Ausstellung eine Vertragspartei entfernen \u2014 die Felder (oder den berechneten Schl\xFCssel) aus \u201E${k.de}\u201C in \`reads\` erg\xE4nzen.`,en:`[readiness/readsMissesPartyCondition] Node "${Oe(e,o.id,"en")}" (${o.id}) generates a document whose contract parties depend on answers in the form "${k.en}" that it neither reads nor binds: ${w.join(", ")}. A correction to them does not hold the node and can remove a contract party after issuing \u2014 add the fields (or the computed key) from "${k.en}" to \`reads\`.`},severity:"warning"})}return i}s(NH,"checkReadinessPartyConditions");function Nw(e){let t=Object.keys(e.inputs??{});if(t.length===0)return[];let n=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(n?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(Us(e).map(l=>l.id));return t.filter(l=>!a.has(l))}s(Nw,"undeclaredInputKeys");function CH(e,t){return e.nodes.flatMap(n=>[...DH(e,n,Us(n),t),...PH(e,n,t)])}s(CH,"checkUnknownResources");function PH(e,t,n){let r=[],i=new Set((Ye(t).workItemTemplates?.(t)??[]).map(o=>o.key));for(let o of Rf(t)){if(o.leaf==="assign{}"&&!i.has(o.owner))continue;let a=Ls[o.leaf],l=`nodes.${t.id}.${o.path}`,d=s(p=>p==="de"?`Knoten \u201E${Oe(e,t.id,"de")}\u201C (${t.id}), ${a.what.de} \u201E${o.owner}\u201C`:`node "${Oe(e,t.id,"en")}" (${t.id}), ${a.what.en} "${o.owner}"`,"where");if(o.missing){if(!a.required){r.push({layer:"GRAPH",kind:"nodeRule",path:l,severity:"error",reason:{de:`[inputs/emptyReference] ${d("de")}: der Eintrag ist leer oder kein Schl\xFCssel \u2014 ${a.consequence.de}. Team w\xE4hlen oder den Eintrag entfernen.`,en:`[inputs/emptyReference] ${d("en")}: the entry is empty or no key \u2014 ${a.consequence.en}. Choose a team or remove the entry.`}});continue}r.push({layer:"GRAPH",kind:"nodeRule",path:l,severity:"error",reason:{de:`[workItems/needsTeam] ${d("de")}: kein Team gew\xE4hlt \u2014 ${a.consequence.de}. Jede Aufgabe geh\xF6rt der Warteschlange eines Teams.`,en:`[workItems/needsTeam] ${d("en")}: no team chosen \u2014 ${a.consequence.en}. Every task belongs to a team's queue.`}});continue}if(o.key===null)continue;let c=n?.teamKeys;if(c===void 0||c.has(o.key))continue;let u=[...c].sort().join(", ")||"\u2014";r.push({layer:"GRAPH",kind:"nodeRule",path:l,severity:"error",reason:{de:`[inputs/unknownResource] ${d("de")}: \u201E${o.key}\u201C ist kein Team dieses Mandanten \u2014 ${a.consequence.de}. Teams: ${u}.`,en:`[inputs/unknownResource] ${d("en")}: "${o.key}" is no team of this school \u2014 ${a.consequence.en}. Teams: ${u}.`}})}return r}s(PH,"referenceIssues");function DH(e,t,n,r){let i=[];for(let o of n){if(!vf(o.type))continue;let a=Ps[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=t.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=Ps[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${Oe(e,t.id,"de")}\u201C (${t.id}) nennt im Eingang \u201E${o.label.de}\u201C ${c.de} \u201E${d.value}\u201C \u2014 diesen Schl\xFCssel kennt dieser Mandant nicht.`,en:`[inputs/unknownResource] Node "${Oe(e,t.id,"en")}" (${t.id}) names the ${c.en.toLowerCase()} "${d.value}" in its input "${o.label.en}", which does not exist in this school.`},severity:"error"})}return i}s(DH,"unknownResourceIssues");function FH(e){let t=[];for(let n of e.nodes)for(let r of Nw(n))t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${Oe(e,n.id,"de")}\u201C (${n.id}) hat einen Eingang \u201E${r}\u201C, den sein Typ nicht deklariert \u2014 ein Rest einer fr\xFCheren Einstellung (z. B. eines anderen Generators). Im Parameter-Bereich ist er nicht sichtbar; entfernen.`,en:`[inputs/undeclared] Node "${Oe(e,n.id,"en")}" (${n.id}) has an input "${r}" its type does not declare \u2014 a leftover of an earlier setting (e.g. another generator). It is not visible among the parameters; remove it.`},severity:"error"});return t}s(FH,"checkUndeclaredInputs");function LH(e){let t=[];for(let n of e.nodes){let r=new Set;for(let i of Us(n)){if(!r.has(i.id)){r.add(i.id);continue}t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${Oe(e,n.id,"de")}\u201C (${n.id}) hat den Eingang \u201E${i.id}\u201C zweimal \u2014 ein Parameter des Generators oder der Vorlage tr\xE4gt den Namen eines Eingangs des Knotentyps. Den Parameter umbenennen.`,en:`[inputs/duplicateSlot] Node "${Oe(e,n.id,"en")}" (${n.id}) has the input "${i.id}" twice \u2014 a parameter of the generator or template carries the name of an input of the node type. Rename the parameter.`},severity:"error"})}}return t}s(LH,"checkDuplicateSlots");function bC(e,t,n){let r=[],i=SH(e);if(i.length>0)return i;r.push(...lH(e)),r.push(...sH(e)),r.push(...dH(e)),r.push(...aH(e)),r.push(...rH(e)),r.push(...iH(e)),r.push(...oH(e)),r.push(...uH(e)),r.push(...WO(e,t)),r.push(...fH(e,t)),r.push(...pH(e,t)),r.push(...mH(e,t)),r.push(...vN(e,t?.layout)),r.push(...hH(e,t)),r.push(...gH(e,t)),r.push(...wH(e,t)),r.push(...MO(e,n)),r.push(...QO(e)),r.push(...n_(e)),r.push(...HO(e)),r.push(...JO(e)),r.push(...FH(e)),r.push(...CH(e,n)),r.push(...LH(e)),r.push(...kH(e)),r.push(...bH(e)),r.push(...qN(e,n)),r.push(...UN(e)),r.push(...VN(e)),r.push(...GN(e,n)),r.push(...HN(e,n)),r.push(...xH(e)),r.push(...TH(e,n)),r.push(...AH(e,n)),r.push(...$H(e)),r.push(...OH(e,n)),r.push(...NH(e,n)),r.push(..._H(e,n)),r.push(...RH(e,n)),r.push(...IH(e)),r.push(...yC(e));for(let o of e.nodes){let a=Ye(o);a.validate&&r.push(...a.validate(o,e,n))}return r}s(bC,"checkGraph");function MH(e,t){let n=e.requiresOneOf;if(n===void 0)return[];let r=`nodes.${e.id}.requiresOneOf`,i=s(d=>({layer:"GRAPH",kind:"nodeRule",path:r,reason:d,severity:"error"}),"issue");if(e.type!=="decision")return[i({de:`[decision/requiresOneOfNotDecision] Knoten "${e.id}" (Typ "${e.type}") tr\xE4gt 'requiresOneOf' \u2014 die Regel gilt nur an Entscheidungsknoten (decision).`,en:`[decision/requiresOneOfNotDecision] Node "${e.id}" (type "${e.type}") carries 'requiresOneOf' \u2014 the rule only applies to decision nodes (decision).`})];if(!Array.isArray(n)||n.length===0||n.some(d=>typeof d!="string"||d.length===0))return[i({de:`[decision/requiresOneOfEmpty] 'requiresOneOf' an Knoten "${e.id}" muss eine nicht-leere Liste von Aktions-Keys sein \u2014 sonst Feld weglassen.`,en:`[decision/requiresOneOfEmpty] 'requiresOneOf' on node "${e.id}" must be a non-empty list of action keys \u2014 otherwise omit the field.`})];let o=t.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of n){if(l.has(d)){a.push(i({de:`[decision/requiresOneOfDuplicate] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}" doppelt.`,en:`[decision/requiresOneOfDuplicate] 'requiresOneOf' on node "${e.id}" names "${d}" twice.`}));continue}l.add(d),o.includes(d)||a.push(i({de:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}", aber dieser Knoten hat keine optionale Aktion mit diesem Key \u2014 die Regel w\xE4re nie erf\xFCllbar. `+(o.length===0?"Der Knoten hat keine optionalen Aktionen.":`Optionale Aktionen dieses Knotens: ${o.join(", ")}.`),en:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' on node "${e.id}" names "${d}", but this node has no optional action with that key \u2014 the rule could never be met. `+(o.length===0?"The node has no optional actions.":`Optional actions of this node: ${o.join(", ")}.`)}))}return a}s(MH,"checkRequiresOneOf");function qH(e){return e.nodes.flatMap(t=>Nw(t).map(n=>({nodeId:t.id,key:n,binding:t.inputs?.[n]?.kind==="binding"})))}s(qH,"undeclaredInputCells");function vC(e,t){let n=qH(e).filter(o=>t.bindings||!o.binding);if(n.length===0)return{graph:e,dropped:n};let r=new Map;for(let o of n)r.set(o.nodeId,(r.get(o.nodeId)??new Set).add(o.key));let i=e.nodes.map(o=>{let a=r.get(String(o.id));if(a===void 0)return o;let l=Object.fromEntries(Object.entries(o.inputs).filter(([d])=>!a.has(d)));return{...o,inputs:l}});return{graph:{...e,nodes:i},dropped:n}}s(vC,"dropUndeclaredInputs");function Cw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Cw,"isObject");function xC(e){return Cw(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(xC,"oldShape");function SC(e){return(e?.nodes??[]).some(xC)}s(SC,"needsTemplateStampMove");function KH(e){let t=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(t)?t:null;let n=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(n)?n:null}s(KH,"stampedFields");function jH(e){let t=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:t,reason:"templateAndStamp"}};let n={...e},r=[];if("template"in e){let{template:i}=e;if(delete n.template,Cw(i))n.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:t,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete n.cockpitFields;let o=Cw(e.inputs)?{...e.inputs}:{},a=KH(n);if(a===null&&i.length>0)return{unmoved:{nodeId:t,key:i[0],reason:"noStamp"}};for(let l of i){let d=l in o&&o[l]?.kind!=="unset",c=(a??[]).find(u=>u.key===l);if(c===void 0)r.push({nodeId:t,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:t,key:l,reason:"processSource"}):d?r.push({nodeId:t,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}n.inputs=o}return{node:n,reports:r}}s(jH,"moveNode");function AC(e){let t=[],n=[],r=[],i=e.nodes.map(o=>{if(!xC(o))return o;let a=jH(o);return"unmoved"in a?(r.push(a.unmoved),o):(t.push(String(o.id)),n.push(...a.reports),a.node)});return t.length===0?{graph:e,moved:t,reports:n,unmoved:r}:{graph:{...e,nodes:i},moved:t,reports:n,unmoved:r}}s(AC,"moveTemplateStampAndCockpit");var EC=tf,VH="applicant.applicationSubmitted";function kp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(kp,"isObject");function TC(e){return kp(e)&&e.type==="form"&&typeof e.id=="string"&&!kn(e)}s(TC,"isCreatingFormNode");function BH(e){return kp(e.notifications)&&EC in e.notifications}s(BH,"hasSubmittedBinding");function Pw(e){let t={toBind:[],alreadyBound:[],malformed:[]};for(let n of e?.nodes??[])TC(n)&&(n.notifications!==void 0&&!kp(n.notifications)?t.malformed.push(n.id):BH(n)?t.alreadyBound.push(n.id):t.toBind.push(n.id));return t}s(Pw,"submitReceiptInventory");function $C(e){let{toBind:t}=Pw(e);if(t.length===0)return{graph:e,bound:[]};let n=new Set(t),r=e.nodes.map(i=>{if(!TC(i)||!n.has(i.id))return i;let o=kp(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[EC]:{templateId:VH}}}});return{graph:{...e,nodes:r},bound:t}}s($C,"bindSubmitReceipt");var Fo=["park","advance"],tr="whenNothingOwed",RC={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function IC(e){let t=e.inputs?.[tr],n=t?.kind==="literal"?t.value:void 0;return Dw(n)?n:null}s(IC,"reviewModeOrNull");function Dw(e){return Fo.includes(e)}s(Dw,"isReviewMode");function Fw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Fw,"isObject");function OC(e){return Fw(e)&&e.type==="review"&&!(Fw(e.inputs)&&tr in e.inputs)}s(OC,"lacksMode");function _C(e){return(e?.nodes??[]).some(OC)}s(_C,"needsReviewMode");function NC(e){let t=[],n=e.nodes.map(r=>{if(!OC(r))return r;t.push(r.id);let i=Fw(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[tr]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:n},set:t}}s(NC,"setReviewModePark");function bp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(bp,"isObject");function CC(e){let{notifications:t,bound:n}=Vf(e.notifications,{tasks:[]},e);return{next:t,bound:n}}s(CC,"bindingsFor");function PC(e){let t={toBind:[],malformed:[]};for(let n of e?.nodes??[])if(!(!bp(n)||typeof n.id!="string"||Hs(n).length===0)){if(n.notifications!==void 0&&!bp(n.notifications)){t.malformed.push(n.id);continue}for(let r of CC(n).bound)t.toBind.push(`${n.id}.${r}`)}return t}s(PC,"appointmentLetterInventory");function DC(e){let t=[],n=!1,r=e.nodes.map(i=>{if(!bp(i)||typeof i.id!="string"||Hs(i).length===0||i.notifications!==void 0&&!bp(i.notifications))return i;let{next:o,bound:a}=CC(i);return a.length===0?i:(n=!0,t.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return n?{graph:{...e,nodes:r},bound:t}:{graph:e,bound:[]}}s(DC,"bindAppointmentLetters");function ca(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ca,"isObject");var FC=["id","label","dataFlow"],LC=["audience","populates","stages","expectedOutcomes"];function MC(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(t=>ca(t)&&typeof t.slot=="string")}s(MC,"carriesStringSlots");function qC(e){return(e.nodes??[]).some(t=>ca(t)&&t.type==="form"&&LC.some(n=>n in t))}s(qC,"carriesRetiredFormNodeKey");var UH=[{key:"generatorPin",editor:!0,holds:RI,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:cO,what:{de:"Formular und Merkmal eines \u201EFlag setzen\u201C-Knotens als Eigenschaften",en:'form and flag of a "Set flag" node as properties'}},{key:"scalarProperties",editor:!0,holds:gO,what:{de:"Einstellungen eines Knotens als Eigenschaften statt als Eing\xE4nge",en:"a node's settings as properties instead of inputs"}},{key:"nodeConfigProperties",editor:!0,holds:AO,what:{de:"Hinweis einer Zahlung als Eigenschaft oder ein entferntes Muster-Dokument",en:"a payment's note as a property, or a removed sample document"}},{key:"outcomeWithoutSemantic",editor:!0,holds:wI,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:xI,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:SC,what:{de:"Parameter einer Vorlage am Knoten oder Cockpit-Felder als Liste",en:"a template's parameters on the node, or cockpit fields as a list"}},{key:"reviewWithoutMode",editor:!0,holds:_C,what:{de:"Pr\xFCfknoten ohne \u201EWenn nichts zu pr\xFCfen ist\u201C",en:'review nodes without "When nothing is owed"'}},{key:"taskAssignUser",editor:!1,holds:s(e=>$f(e).length>0,"holds"),what:{de:"eine Aufgabe mit fester Person (`assign.userId`)",en:"a task with a fixed person (`assign.userId`)"}},{key:"retiredGraphKey",editor:!1,holds:s(e=>FC.some(t=>t in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:MC,what:{de:"Zust\xE4ndigkeitsregeln mit Slot als Text (`responsible` / `team:<Schl\xFCssel>`)",en:"assignment rules with a slot as text (`responsible` / `team:<key>`)"}},{key:"retiredFormNodeKey",editor:!1,holds:qC,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function KC(e){if(!ca(e)||!Array.isArray(e.nodes))return[];let t=e;return UH.filter(n=>n.holds(t)).map(({key:n,what:r,editor:i})=>({key:n,what:r,editor:i}))}s(KC,"legacyGraphShapes");function jC(e,t){let n=t.answers??{},r=[],i=[],o=e,a=FC.filter($=>$ in o);if(a.length>0){let $={...o};for(let b of a)delete $[b],r.push({message:`graph.${b}: deleted (read by nothing)`});o=$}if(qC(o)&&(o={...o,nodes:o.nodes.map($=>{if(!ca($)||$.type!=="form")return $;let b=LC.filter(q=>q in $);if(b.length===0)return $;let R={...$};for(let q of b)delete R[q];return r.push({nodeId:String($.id),message:`form node: deleted ${b.map(q=>`\`${q}\``).join(", ")} (read by nothing)`}),R})}),MC(o)){let $=o.assignmentRules.map((b,R)=>{if(!ca(b)||typeof b.slot!="string")return b;let q=mf(b.slot);return q===null?(i.push({code:"assignment/slotUnknown",answer:"edit",message:`assignmentRules[${R}].slot "${b.slot}" is neither \`responsible\` nor \`team:<key>\` \u2014 edit it by hand`}),b):(r.push({message:`assignmentRules[${R}].slot "${b.slot}" \u2192 ${JSON.stringify(q)}`}),{...b,slot:q})});o={...o,assignmentRules:$}}let l=II(o);o=l.graph;for(let $ of l.moved)r.push({nodeId:$,message:"generator / template pin moved into its input"});for(let $ of l.unmoved)i.push({code:`generatorPin/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${$.reason}) \u2014 edit the node by hand`});let d=uO(o);o=d.graph;for(let $ of d.moved)r.push({nodeId:$,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let $ of d.unmoved)i.push({code:`setFlag/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${$.reason}) \u2014 edit the node by hand`});let c=yO(o);o=c.graph;for(let $ of c.moved)r.push({nodeId:$,message:"scalar settings moved into inputs"});for(let $ of c.unmoved)i.push({code:`scalar/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let u=EO(o);o=u.graph;for(let $ of u.moved)r.push({nodeId:$,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let $ of u.unmoved)i.push({code:`nodeConfig/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let p=AC(o);o=p.graph;for(let $ of p.moved){let b=o.nodes.find(_=>ca(_)&&_.id===$),R=b?.inputs?.documentTemplate,q=R?.kind==="literal"&&typeof R.value=="string"?R.value:null;r.push({nodeId:$,message:b!==void 0&&"templateStamp"in b&&q!==null?`template parameters moved onto \`templateStamp\` / cockpit list into cells \u2014 the record \`${q}\` must declare the same parameters (tenant catalog \`documentTemplates[].parameters\` / \`templates:setParameters\`) before publish, else [governedDocument/templateWithoutParameters]`:"cockpit list moved into `{ kind: 'cockpit' }` cells"})}for(let $ of p.reports)r.push({nodeId:$.nodeId,message:`cockpit field \`${$.key??""}\` deleted (${$.reason}: ${$.reason==="unknownKey"?"the stamp declares no such parameter":$.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let $ of p.unmoved)i.push({code:`templateStamp/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.reason==="noStamp"?"the cockpit list cannot be judged: the node carries no parameter stamp \u2014 run `offer workflow restamp-pins` against the environment, then upgrade again":$.reason==="templateAndStamp"?"the node carries both `template` and `templateStamp` \u2014 delete one by hand":"`template` is no object \u2014 edit the node by hand"});let h=SI(o);o=h.graph;for(let $ of h.moved)r.push({nodeId:$,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let $ of h.unmoved)i.push({code:`eventTrigger/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${$.reason}) \u2014 edit the node by hand`});let w=kI(o,n.semantics);o=w.graph;for(let $ of w.written){if($.source==="formerDefault"){r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,value:$.semantic}});continue}r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (${$.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let $ of w.refused)i.push({code:$.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:$.nodeId,answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,candidates:$.allowed,message:$.answer===void 0?`${$.nodeType} outcome \`${$.outcomeId}\` ran as "${py($.outcomeId)??""}", which a ${$.nodeType} outcome may no longer carry \u2014 say which one it is`:`${$.nodeType} outcome \`${$.outcomeId}\`: "${$.answer}" is not a meaning a ${$.nodeType} outcome may carry`});for(let $ of w.invalid)i.push({code:"outcome/semanticInvalid",nodeId:$.nodeId,answer:"edit",candidates:wn,message:`outcome \`${$.outcomeId}\` carries the semantic "${$.value}", which is no meaning \u2014 edit it`});let k=TI(o,t.selection,n.waitlistPolicy);o=k.graph;for(let $ of k.moved){let b=$.policy.waitlistOrder;r.push({nodeId:$.nodeId,message:`waitlist policy into inputs: ${GH($.policy)} (${$.source==="answer"?"answered":$.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...$.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:$.nodeId,value:b}}:{}})}for(let $ of k.refused)i.push({code:`waitlist/${$.reason}`,nodeId:$.nodeId,answer:"waitlistPolicy",answerKey:$.nodeId,candidates:Hn,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});if($O(o)){let $=RO(o,n.payee);o=$.graph;for(let b of $.set)r.push({nodeId:b.nodeId,message:`online payment: payee "${b.payee}" (answered)`});for(let b of $.refused)i.push({code:"collectPayment/payeeMissing",nodeId:b,answer:"payee",answerKey:b,message:"an online payment names the Tr\xE4ger its money goes to \u2014 say its key (a `legal_entities.configKey` of the tenant)"})}for(let $ of Pw(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:$,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let y=$C(o);o=y.graph;for(let $ of y.bound)r.push({nodeId:$,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let v=NC(o);o=v.graph;for(let $ of v.set)r.push({nodeId:$,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let $ of PC(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:$,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let A=DC(o);o=A.graph;for(let $ of A.bound){let b=$.indexOf(".");r.push({nodeId:$.slice(0,b),message:`appointment letter bound to \`notifications.${$.slice(b+1)}\` (the standard letter, sent by code before)`})}let E=$f(o).filter($=>!$.hasTeam);for(let $ of E)i.push({code:"task/userWithoutTeam",nodeId:$.nodeId,answer:"edit",message:`task \`${$.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let I=IO(o);o=I.graph;for(let $ of I.dropped.filter(b=>b.hasTeam))r.push({nodeId:$.nodeId,message:`task \`${$.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let C=vC(o,{bindings:!0});o=C.graph;for(let $ of C.dropped){if(!$.binding){r.push({nodeId:$.nodeId,message:`input \`${$.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:$.nodeId,message:`input \`${$.key}\` deleted (DEFAULT \u2014 a binding no slot declares: no slot handed its value to the node, but the readiness gate waited for it; the node no longer waits for that value)`,defaulted:{answer:"undeclaredBinding",answerKey:`${$.nodeId}.${$.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(jC,"upgradeGraph");function GH(e){return`waitlistOrder=${e.waitlistOrder}`}s(GH,"formatPolicy");function ci(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ci,"isObject");var VC="admission.generic",BC=Object.keys(uf).filter(e=>e!=="label");function UC(e){return ci(e.smartforms)?Object.entries(e.smartforms):[]}s(UC,"smartformEntries");function zH(e){let t=[];UC(e.index).some(([,i])=>ci(i)&&"outcomeFnRef"in i)&&t.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let n=Object.keys(e.manifest).filter(i=>Object.hasOwn(yl,i));if(n.length>0){let i=n.map(o=>`\`${o}\``).join(", ");t.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>BC.some(o=>o in i))&&t.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"});let r=e.workflow;return r!==void 0&&(ci(r.progressWiring)&&"layoutId"in r.progressWiring&&t.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),t.push(...KC(r.graph).map(i=>i.what))),t}s(zH,"legacyBundleShapes");function xp(e,t){let n=zH(e);n.length!==0&&ae("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${t} stammt aus einem \xE4lteren Bundle-Format (${n.map(r=>r.de).join("; ")}). Zuerst \`plexus-cli offer upgrade --dir <Bundle>\` ausf\xFChren (Probelauf, beantwortet die offenen Fragen), dann mit \`--write\` schreiben und erneut pr\xFCfen.`,en:`offer: ${t} is in an older bundle format (${n.map(r=>r.en).join("; ")}). Run \`plexus-cli offer upgrade --dir <bundle>\` first (a dry run that asks what it cannot decide), then write with \`--write\` and validate again.`})}s(xp,"assertBundleCurrent");function vp(e){let t=s(n=>Array.isArray(n)?n.map(t):ci(n)?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(vp,"canonical");function GC(e,t={}){let n=[],r=[],i=e.index,o=UC(i);if(o.some(([,u])=>ci(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!ci(h)||Object.keys(h).length===0){u[p]=h;continue}let{outcomeFnRef:w,...k}=h;if(Object.keys(k).length>0||w!==void 0&&w!==VC){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(y=>`\`${y}\``).join(", ")} \u2014 only \`outcomeFnRef: ${VC}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}n.push({file:"bundle.yaml",message:`smartforms.${p}.outcomeFnRef deleted (a form routes by its own declared outcomes)`}),u[p]={}}i={...i,smartforms:u}}let a={},l=e.workflow,d;for(let[u,p]of Object.entries(e.manifest)){if(u==="selection"){d=p,n.push({file:"manifest.json",message:"`selection` deleted (its queue policy goes to the waitlist node's inputs; release strategy and deadline were read by nothing)"});continue}if(u==="progressLayout"){l===void 0?n.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},n.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):vp(l.progressLayout)===vp(p)?n.push({file:"manifest.json",message:"`progressLayout` deleted (workflow.json carries the same layout)"}):(r.push({file:"manifest.json",code:"manifest/progressLayoutTwice",answer:"edit",message:"`progressLayout` differs from workflow.json `progressLayout` \u2014 keep one by hand"}),a[u]=p);continue}let h=Object.hasOwn(yl,u)?yl[u]:void 0;if(h===void 0){r.push({file:"manifest.json",code:"manifest/unknownKey",answer:"edit",message:`unknown key \`${u}\` \u2014 manifest.json carries no key; decide by hand where it belongs`}),a[u]=p;continue}n.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(ci(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},n.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(ci(u)&&Array.isArray(u.nodes)){let p=jC(u,{selection:d,answers:t});l={...l,graph:p.graph},n.push(...p.changes.map(h=>({...h,file:"workflow.json"}))),r.push(...p.refusals.map(h=>({...h,file:"workflow.json"})))}else r.push({file:"workflow.json",code:"workflow/graphShape",answer:"edit",message:"`graph` is no object with a node list"})}let c=e.smartforms;if(c!==void 0){let u={};for(let[p,h]of Object.entries(c)){let w={...h},k=`smartforms/${p}.json`;for(let y of BC)if(y in h){if(y==="outcomeIds"){let v=Array.isArray(h.outcomes)?h.outcomes.map(A=>ci(A)?A.id:void 0):[];if(vp([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==vp(v.map(String).sort())){r.push({file:k,code:"smartform/outcomeIdsDiffer",answer:"edit",message:"`outcomeIds` differs from the ids of `outcomes[]` \u2014 reconcile them by hand"});continue}}delete w[y],n.push({file:k,message:`\`${y}\` deleted (${uf[y].en})`})}u[p]=w}c=u}return{bundle:{index:i,manifest:a,...c!==void 0?{smartforms:c}:{},...l!==void 0?{workflow:l}:{}},changes:n,refusals:r}}s(GC,"upgradeOfferBundle");var WH={createManifest:x.workflow.createManifest,publishManifest:x.workflow.publishManifest,publishOfferInternal:x.workflow.publishOfferInternal,publishOfferExternal:x.workflow.publishOfferExternal,getOfferPublishState:x.workflow.getOfferPublishState,upsertCustomField:x.admission.upsertCustomField,upsertDerivedAttributeRule:x.admission.upsertDerivedAttributeRule,createSmartForm:x.forms.createSmartForm,getSmartFormBySlug:x.forms.getSmartFormBySlug,saveSmartFormDraft:x.forms.saveSmartFormDraft,publishSmartForm:x.forms.publishSmartForm,createWorkflow:x.workflow.createWorkflow,getWorkflowGraph:x.workflow.getWorkflowGraph,saveWorkflowDraft:x.workflow.saveWorkflowDraft,publishWorkflow:x.workflow.publishWorkflow},Bye={createManifest:Xt.workflow.createManifestInternal,publishManifest:Xt.workflow.publishManifestInternal,publishOfferInternal:Xt.workflow.publishOfferInternalInternal,publishOfferExternal:Xt.workflow.publishOfferExternalInternal,getOfferPublishState:Xt.workflow.getOfferPublishStateInternal,upsertCustomField:Xt.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:Xt.admission.upsertDerivedAttributeRuleInternal,createSmartForm:Xt.forms.createSmartFormInternal,getSmartFormBySlug:Xt.forms.getSmartFormBySlugInternal,saveSmartFormDraft:Xt.forms.saveSmartFormDraftInternal,publishSmartForm:Xt.forms.publishSmartFormInternal,createWorkflow:Xt.workflow.createWorkflowInternal,getWorkflowGraph:Xt.workflow.getWorkflowGraphInternal,saveWorkflowDraft:Xt.workflow.saveWorkflowDraftInternal,publishWorkflow:Xt.workflow.publishWorkflowInternal};function Lw(e,t){for(let[n,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&ae("INVALID",{de:`offer: ${t}: smartforms.${n} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${t}: smartforms.${n} must be an empty mapping ({}).`});let i=Object.keys(r);if(i.length===0)continue;let o=i.map(l=>`\`${l}\``).join(", "),a=i.includes("outcomeFnRef");ae("INVALID",{de:`offer: ${t}: smartforms.${n} enth\xE4lt unbekannte Schl\xFCssel ${o} \u2014 der Eintrag muss leer sein ({}).${a?" `outcomeFnRef` geh\xF6rt nicht mehr zum Bundle-Format: ein Formular entscheidet \xFCber seine eigenen Ergebnisse. Die Zeile l\xF6schen.":""}`,en:`offer: ${t}: smartforms.${n} carries unknown key(s) ${o} \u2014 the entry must be empty ({}).${a?" `outcomeFnRef` is no longer part of the bundle format: a form routes by its own declared outcomes. Delete the line.":""}`})}}s(Lw,"assertSmartformEntries");function zC(e){let t=s(n=>Array.isArray(n)?n.map(t):n&&typeof n=="object"?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(zC,"canonicalJson");function WC(e,t){return t==null?!0:zC(e)!==zC(t)}s(WC,"changed");async function YC(e,t,n,r={},i=WH){let{index:o}=t;xp({index:o,manifest:t.manifest,...t.smartforms!==void 0?{smartforms:t.smartforms}:{},...t.workflow!==void 0?{workflow:t.workflow}:{}},`bundle of ${o.slugs.manifest}`),Lw(o,`bundle of ${o.slugs.manifest}`);let a=cf(t.manifest);a.length>0&&ae("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11202
|
+
{{einstellungenLink}}`}}]},rw=[KW,zW,HW,JW,QW,n1,t1,v1,S1,P1,F1,M1,j1,U1,z1,H1,Z1,t2,r2,A1,E1,T1,i2,o2,s2,r1,i1,o1,l1,u1,m1,k1,_1,T2,R2,VW,UW,l2,c2,f2,m2,y2,k2,v2];function iw(e){let t=rw.find(n=>n.id===e);return t===void 0&&F(`notifications: unknown letter "${e}"`),t}s(iw,"letterDefFor");function ow(e){return rw.some(t=>t.id===e)}s(ow,"hasLetterDef");function sw(e,t){return t===void 0?!0:xf(e,t)}s(sw,"letterArgCompatible");function _l(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${bn(e)} (${e})`,en:`${bn(e)} (${e})`}}s(_l,"letterArgTypeLabel");function k_(e){let t=new Map,n=s((r,i)=>{let o=t.get(r);o===void 0?t.set(r,[i]):o.push(i)},"add");for(let r of e.args)n(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of o_)n(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return t}s(k_,"eventArgSources");function b_(e,t){let n=e.type===void 0?[...t]:t.filter(r=>sw(r.type,e.type));if(n.length>1)return{status:"ambiguous",matches:n};if(n.length===1){let r=n[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...t]}:{status:"unused"}}s(b_,"resolveLetterParam");var aw=["booked","rescheduled","cancelled"],I2={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},x_=":";function S_(e,t){return`${e}${x_}${t}`}s(S_,"appointmentEventId");function O2(e){let t=e.lastIndexOf(x_);if(t<=0)return null;let n=e.slice(t+1);return aw.includes(n)?{taskKey:e.slice(0,t),kind:n}:null}s(O2,"parseAppointmentEventId");var v_={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function Hs(e){return Array.isArray(e.tasks)?e.tasks.filter(t=>typeof t?.key=="string"&&t.result?.kind==="appointment"):[]}s(Hs,"appointmentTasksOf");function _2(e){return aw.map(t=>({id:S_(e.key,t),label:{de:`${v_[t].de} \u2013 \u201E${e.title.de}\u201C`,en:`${v_[t].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(_2,"appointmentTaskEvents");function A_(e,t){let n=t.notificationEvents?.(e)??[],r=Hs(e).flatMap(_2);return r.length===0?n:[...n,...r]}s(A_,"nodeNotificationEvents");function N2(e){return Object.fromEntries(aw.map(t=>[S_(e,t),{templateId:I2[t]}]))}s(N2,"defaultAppointmentBindings");function C2(e,t){if(e===void 0)return{notifications:e,dropped:[]};let n=[],r={};for(let[i,o]of Object.entries(e))O2(i)?.taskKey===t?n.push(i):r[i]=o;return n.length===0?{notifications:e,dropped:n}:{notifications:Object.keys(r).length===0?void 0:r,dropped:n}}s(C2,"withoutAppointmentBindings");function Vf(e,t,n){let r=new Set(Hs(t).map(d=>d.key)),i=new Set(Hs(n).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=C2(o,d);o=c.notifications,a.push(...c.dropped)}let l=[];for(let d of i)if(!r.has(d))for(let[c,u]of Object.entries(N2(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(Vf,"syncAppointmentBindings");function P2(e){return e.kind==="task"&&!("title"in e)}s(P2,"isLegacyFreeTodoContext");function lw(e){let{context:t}=e;if(P2(t)&&F(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),t.kind==="task")return{...e,context:t,kind:"task",createdVia:"human",partyId:t.partyId};let{anchor:n,task:r,kind:i,title:o,description:a,...l}=t,d=n.scope==="node"?{nodeId:n.nodeId,templateKey:n.templateKey,gatesNode:n.gatesNode,blocks:n.blocks}:n.scope==="application"?{scope:"application",templateKey:n.templateKey}:n.scope==="crossNode"?{scope:"application",nodeId:n.nodeId,templateKey:n.templateKey,blocks:n.blocks}:{};return{...e,context:t,...l,...d,...r??{},kind:i}}s(lw,"readWorkItem");async function Nl(e,t){let n;if(t.nodeId!==void 0){let r=t.nodeId;n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(t.isOpen!==void 0){let r=t.isOpen;n=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",t.applicationId).eq("isOpen",r)).collect()}else n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",t.applicationId)).collect();return n.filter(r=>t.isOpen===void 0||r.isOpen===t.isOpen).map(lw)}s(Nl,"listWorkItemsForApplication");var npe=m.union(m.literal("approved"),m.literal("rejected")),Cl=new Set(["task","approval"]);function D2(e,t){switch(e){case"task":return t?.gatesNode===!0&&F("expandComposedTask: gatesNode is approval-only \u2014 a 'task' template never gates its node (use blocks to hold a gating sibling back)"),{kind:"task",recipient:"internal",gatesNode:!1};case"approval":return{kind:"approval",recipient:"internal",isApproval:!0,gatesNode:t?.gatesNode??!0};default:F(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...Cl].join(", ")}`)}}s(D2,"expandComposedTask");for(let e of["task","approval"]){let t=D2(e);t.kind==="approval"!=(t.isApproval===!0)&&F(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var E_=Ri,qi=`${E_}.`,F2=new Set(["text","number","date","boolean","option","edge"]);function Bf(e,t){let n=e[t];return n===void 0&&F(`[env/unknownKey] no environment key '${t}'`),typeof n=="string"?null:Object.keys(n)}s(Bf,"contextFields");function T_(e,t){return Object.hasOwn(e,t)}s(T_,"isContextKey");function $_(e){let t=[];for(let n of Object.keys(e)){let r=Bf(e,n);if(r===null)t.push(n);else for(let i of r)t.push(`${n}.${i}`)}return t}s($_,"leafPaths");function Pl(e,t){let[n="",r,...i]=t.split(".");if(!T_(e,n)||i.length>0)return;let o=e[n];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s(Pl,"leafType");function R_(e){let t=new Set;for(let n of e){let r=Js(n);r!==null&&t.add(r.split(".")[0])}return[...t]}s(R_,"contextKeysOf");function Js(e){return e.startsWith(qi)?e.slice(qi.length):null}s(Js,"contextPathOf");function Dl(e){return e===E_||e.startsWith(qi)}s(Dl,"isContextIdentifier");function Uf(e,t){let n=Js(t)??"",[r=""]=n.split("."),i=Object.keys(e);if(!T_(e,r))return{code:"env/unknownKey",message:{de:`'${t}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${t}' names no environment key \u2014 known: ${i.join(", ")}.`}};if(Pl(e,n)!==void 0)return null;let o=Bf(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${t}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${qi}${r}'.`,en:`'${t}': environment key '${r}' is a single value \u2014 read it as '${qi}${r}'.`}:{de:`'${t}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${t}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(Uf,"identifierIssue");function Gf(e,t,n=Object.keys(e)){let r={};for(let i of n){let o=Bf(e,i),a=Object.hasOwn(t,i)?t[i]:void 0;if(a===void 0&&F(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${qi}${i}`]=a;continue}for(let l of o){let d=typeof a=="object"&&a!==null&&Object.hasOwn(a,l)?a[l]:void 0;d===void 0&&F(`[env/missing] context key '${i}' carries no '${l}'`),r[`${qi}${i}.${l}`]=d}}return r}s(Gf,"flatten");function I_(e,t,n){if(n===void 0)return!1;let r=Bf(e,t);return r===null?!0:typeof n=="object"&&n!==null&&r.every(i=>n[i]!==void 0)}s(I_,"contextValueComplete");function L2(e,t){switch(t){case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e);default:return typeof e=="string"}}s(L2,"valueMatchesDataType");function O_(e,t,n=Object.keys(e.types)){let r=new Set(n);for(let i of $_(e.types)){if(!r.has(i.split(".")[0]))continue;let o=t[`${qi}${i}`];o===void 0&&F(`[env/missing] context path '${i}' was not supplied`);let a=e.fields[i];if(o===null){a.nullable||F(`[env/null] context path '${i}' is not nullable but carries null`);continue}let l=bn(Pl(e.types,i));L2(o,l)||F(`[env/type] context path '${i}' expects ${l}, got ${JSON.stringify(o)}`),a.valueSet.kind==="fixed"&&!a.valueSet.values.includes(o)&&F(`[env/value] context path '${i}' carries '${String(o)}', outside ${a.valueSet.values.join(" | ")}`)}}s(O_,"assertContextValues");function M2(e){let t=[],n=$_(e.types);for(let r of n){let i=Pl(e.types,r),o=bn(i);if(!Ci(i)||o===void 0||!F2.has(o)){t.push(`'${r}' has type '${String(i)}', not a scalar value type`);continue}let a=Object.hasOwn(e.fields,r)?e.fields[r]:void 0;if(a===void 0){t.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&t.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&t.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))n.includes(r)||t.push(`field spec '${r}' names no leaf of the schema`);return t}s(M2,"schemaIssues");function Qs(e){let t=M2(e);t.length>0&&F(`[env/schema] ${t.join("; ")}`)}s(Qs,"assertSchema");var zf={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function Ki(e){return JSON.stringify(e)}s(Ki,"canonical");function Xs(e){return e.kind==="binary"&&e.op==="&&"?[...Xs(e.left),...Xs(e.right)]:[e]}s(Xs,"conjuncts");function C_(e,t){let n;try{n=$t(e)}catch{return!1}let r=Ki($t(t));return Xs(n).some(i=>Ki(i)===r)}s(C_,"hasConjunct");function P_(e,t){try{return Ki($t(e))===Ki($t(t))}catch{return!1}}s(P_,"sameCondition");function D_(e){let t=[];for(let n of e)t.push(...Rt(ei(n)));return R_(t)}s(D_,"contextKeysRead");function F_(e){try{return Rt($t(e)).some(Dl)}catch{return!1}}s(F_,"readsContext");var q2=/^\d{4}-\d{2}-\d{2}$/,K2=new Set(["==","!=","<","<=",">",">=","in"]),j2=new Set(["<","<=",">",">="]);function Yf(e,t,n=[]){Qs(t);let r;try{r=$t(e)}catch(a){let l=a.message;return[Ut("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of Rt(r)){if(!Dl(a)){i.push(Ut("condition/foreignIdentifier",`'${a}' ist kein Umgebungswert \u2014 Bedingungen lesen nur '$env.*'`,`'${a}' is not a context identifier \u2014 conditions read only '$env.*'`));continue}let l=Uf(t.types,a);l!==null&&i.push(Ut("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=Dr(r,t,i);Fl(o)||i.push(Ut("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),G2(r,t,i);for(let{identifier:a,op:l}of uw(r,t))i.push(Ut("condition/unguardedNullable",`'${l}' \xFCber '${a}', das leer sein kann, braucht davor eine Absicherung '${a} != null &&'`,`'${l}' over '${a}', which may be null, needs a guard '${a} != null &&' before it`));return i.push(...V2(r,n)),i}s(Yf,"conditionIssues");function V2(e,t){let n=Xs(e).map(Ki);return t.flatMap(r=>{let i=$t(r),o=B2(i);return o===null||!n.includes(Ki(o))?[]:[{severity:"info",code:"condition/guardForm",message:{de:`[condition/guardForm] eine gespiegelte Absicherung z\xE4hlt nicht \u2014 schreibe sie genau als '${r}'`,en:`[condition/guardForm] a mirrored guard does not count \u2014 write it exactly as '${r}'`}}]})}s(V2,"guardFormHints");function B2(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let t={...e,left:e.right,right:e.left};return Ki(t)===Ki(e)?null:t}s(B2,"mirror");function Fl(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(Fl,"isBooleanish");function L_(e){let t=Js(e);return t===null&&F(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),t}s(L_,"contextPath");function M_(e,t){let n=Js(t);return n!==null&&e.fields[n]?.nullable===!0}s(M_,"isNullableLeaf");function U2(e,t){let n=bn(Pl(e.types,L_(t)));return n===void 0?{t:"unknown"}:{t:"data",dt:n}}s(U2,"identType");function Wf(e,t){return e.t==="unknown"||t.t==="unknown"||e.t==="null"||t.t==="null"?!0:e.t==="array"||t.t==="array"?!1:e.t==="str"&&t.t==="str"?!0:e.t==="str"?__(e.value,t.dt):t.t==="str"?__(t.value,e.dt):e.dt===t.dt}s(Wf,"fits");function __(e,t){return t==="text"||t==="option"||t==="edge"?!0:t==="date"?q2.test(e):!1}s(__,"strFits");function N_(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(N_,"orderedCategory");function Dr(e,t,n){switch(e.kind){case"num":return{t:"data",dt:"number"};case"bool":return{t:"data",dt:"boolean"};case"str":return{t:"str",value:e.value};case"null":return{t:"null"};case"ident":return U2(t,e.path);case"arr":for(let r of e.items)Dr(r,t,n);return{t:"array"};case"unary":{let r=Dr(e.operand,t,n);return Fl(r)||n.push(Ut("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(zf,e.name)?zf[e.name]:void 0,i=e.args.map(l=>Dr(l,t,n));return r===void 0?(n.push(Ut("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(zf).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(zf).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&Wf(l,{t:"data",dt:r.params[d]}))||n.push(Ut("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=Dr(e.cond,t,n);Fl(r)||n.push(Ut("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=Dr(e.then,t,n),o=Dr(e.else,t,n);return Wf(i,o)||n.push(Ut("condition/typeMismatch","die beiden Zweige von 'if' haben verschiedene Typen","the two arms of 'if' differ in type")),i.t==="null"?o:i}case"binary":{let r=Dr(e.left,t,n),i=Dr(e.right,t,n);if(e.op==="&&"||e.op==="||")(!Fl(r)||!Fl(i))&&n.push(Ut("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?n.push(Ut("condition/inWithoutArray","'in' braucht rechts eine Liste, z. B. ['a', 'b']","'in' needs a list on its right, e.g. ['a', 'b']")):e.right.items.every(o=>Wf(r,Dr(o,t,[])))||n.push(Ut("condition/typeMismatch","ein Listeneintrag von 'in' passt nicht zum Typ des linken Operanden","a list item of 'in' does not match the left operand's type"));else if(j2.has(e.op)){let o=N_(r),a=N_(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&n.push(Ut("condition/orderedComparison",`'${e.op}' vergleicht nur Zahlen \u2014 f\xFCr Daten years_between(\u2026) verwenden`,`'${e.op}' compares only numbers \u2014 for dates use years_between(\u2026)`))}else Wf(r,i)||n.push(Ut("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(Dr,"typeOf");function dw(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(dw,"isLiteral");function q_(e){let t=[],n=s(r=>{if(r.kind==="binary"&&K2.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(dw):dw(r.right)?[r.right]:[];i.length>0&&t.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&dw(r.left)&&t.push({ident:r.right.path,literals:[r.left]})}K_(r,n)},"visit");return n(e),t}s(q_,"comparedLiterals");function G2(e,t,n){for(let{ident:r,literals:i}of q_(e)){let o=z2(r,i,t);o!==null&&n.push(o)}}s(G2,"literalIssues");function cw(e,t){let n;try{n=$t(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of q_(n)){let a=Js(i);if(!(a===null||t.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(cw,"liveLiterals");function z2(e,t,n){let r=n.fields[L_(e)]?.valueSet;if(r?.kind==="unstable")return Ut("condition/literalOnUnstable",`'${e}' ist nicht \xFCber Umgebungen stabil \u2014 vergleiche ihn mit keinem festen Wert; verzweige stattdessen \xFCber ein stabiles Merkmal`,`'${e}' is not stable across environments \u2014 compare it to no literal; branch on a stable attribute instead`);if(r?.kind!=="fixed")return null;let i=t.flatMap(a=>a.kind==="str"&&!r.values.includes(a.value)?[`'${a.value}'`]:[]);if(i.length===0)return null;let o=r.values.map(a=>`'${a}'`).join(", ");return Ut("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(z2,"valueSetIssue");function K_(e,t){switch(e.kind){case"binary":t(e.left),t(e.right);return;case"unary":t(e.operand);return;case"call":e.args.forEach(t);return;case"arr":e.items.forEach(t);return;case"if":t(e.cond),t(e.then),t(e.else);return;default:return}}s(K_,"forEachChild");function j_(e){return e.kind==="binary"&&(e.op==="=="||e.op==="!=")&&(e.left.kind==="ident"&&e.right.kind==="null"||e.left.kind==="null"&&e.right.kind==="ident")}s(j_,"isNullTest");function V_(e){return Xs(e).flatMap(t=>{let n=B_(t);return n===null?[]:[n]})}s(V_,"guardsOf");function Ll(e,t,n){switch(e.kind){case"ident":return M_(t,e.path)&&!n.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=Ll(r,t,n);if(i!==null)return i}return null;case"if":return Ll(e.then,t,new Set([...n,...V_(e.cond)]))??Ll(e.else,t,n);default:return null}}s(Ll,"unguardedNullSource");function B_(e){return!j_(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(B_,"guardedIdent");function Zs(e,t,n,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(n);for(let o of Xs(e)){Zs(o,t,i,r);let a=B_(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Zs(e.cond,t,n,r),Zs(e.then,t,new Set([...n,...V_(e.cond)]),r),Zs(e.else,t,n,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=Ll(e.left,t,n)??Ll(e.right,t,n);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!j_(e.operand)){let i=Rt(e.operand).filter(o=>M_(t,o)&&!n.has(o));i.length>0&&r(i[0],"!")}K_(e,i=>Zs(i,t,n,r))}s(Zs,"nullableReads");function uw(e,t){Qs(t);let n=[];return Zs(e,t,new Set,(r,i)=>{n.some(o=>o.identifier===r)||n.push({identifier:r,op:i})}),n}s(uw,"unguardedNullableReads");function Ut(e,t,n){return{severity:"error",code:e,message:{de:`[${e}] ${t}`,en:`[${e}] ${n}`}}}s(Ut,"error");function Ml(e){let t=Array.isArray(e.nodes)?e.nodes:[],n=new Set;for(let r of t)for(let i of Rf(r))i.key!==null&&Ls[i.leaf].involves&&n.add(i.key);return n}s(Ml,"declaredGroupKeys");var ea=of;var W2="unit.key",Y2="offer.key";function U_(e,t){return e===W2?t.unitKeys:e===Y2?t.offerKeys:null}s(U_,"liveKeyUniverse");function Hf(e){return[ht,...[...Ml(e)].sort((t,n)=>t.localeCompare(n)).map(ff)]}s(Hf,"requiredSlots");var ji=`${af("applicant.channel")} == 'staff'`;var pw=["strict","leastLoaded"];var fw=2;function G_(e){return e.some(t=>t.length===0)?{de:"nennt einen leeren Personenschl\xFCssel",en:"names an empty person key"}:new Set(e).size!==e.length?{de:"nennt eine Person zweimal",en:"names a person twice"}:e.length<fw?{de:`braucht mindestens ${fw} Personen`,en:`needs at least ${fw} people`}:null}s(G_,"rotationPoolProblem");function H2(e,t){let n=t===null?-1:e.indexOf(t);return[...e.slice(n+1),...e.slice(0,n+1)]}s(H2,"strictOrder");function z_(e){let t=H2(e.pool,e.previous).filter(i=>e.eligible.has(i));if(t.length===0)return null;if(e.mode==="strict")return t[0];let n=e.openCounts;n===void 0&&F("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=n.get(i);return o===void 0&&F(`[assignment/rotation] no open count for '${i}'`),o},"load");return t.reduce((i,o)=>r(o)<r(i)?o:i)}s(z_,"pickFromPool");function Y_(e){return e.map(t=>({slot:pI(t.slot),rules:[...t.rules]}))}s(Y_,"rulesOfStored");function H_(e){return e.map(t=>({slot:J2(t.slot),rules:[...t.rules]}))}s(H_,"storedOfRules");function J2(e){let t=mf(e);return t===null&&F(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),t}s(J2,"slotOf");function J_(e,t){let n=e?.assignmentRules;n===void 0&&F(`[assignment/noRules] ${t}: the workflow has no assignment rule`);let r=eN(n);return r.length>0&&F(`${r.join("; ")} (${t})`),Y_(n)}s(J_,"rulesOfGraph");function Q2(e){return e===ht?{slot:e,rules:[{when:ji,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(Q2,"defaultSlotRules");function Q_(e,t){let n=new Set(e.map(o=>o.slot)),r=t.filter(o=>!n.has(o)).map(Q2);return[...r.filter(o=>o.slot===ht),...e,...r.filter(o=>o.slot!==ht)]}s(Q_,"withRequiredSlots");function _t(e,t){return t===void 0?`slot '${e}'`:`slot '${e}' row #${t+1}`}s(_t,"where");function Cn(e,t){return t===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${t+1}`}s(Cn,"whereDe");function vn(e,t,n={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${t.de}`,en:`[${e}] ${t.en}`},...n}}s(vn,"issue");function W_(e){if(e===ht)return!0;let t=pf(e);return t!==null&&t.length>0}s(W_,"isKnownSlot");function Z2(e,t){Qs(ea);let n=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;W_(l)||n.push(vn("assignment/unknownSlot",{de:`'${l}' ist keine Liste \u2014 'responsible' oder 'team:<teamKey>'`,en:`'${l}' is no slot \u2014 'responsible' or 'team:<teamKey>'`},{slot:l})),r.has(l)&&n.push(vn("assignment/duplicateSlot",{de:`${Cn(l)} steht zweimal da`,en:`${_t(l)} is listed twice`},{slot:l})),r.add(l),l===ht&&a!==0&&n.push(vn("assignment/responsibleFirst",{de:`'${ht}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${ht}' must be the first slot \u2014 team rows copy it`},{slot:l})),n.push(...X2(o))});for(let o of t)r.has(o)||n.push(vn("assignment/slotMissing",{de:`${Cn(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${_t(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(t);for(let{slot:o}of e)o!==ht&&!i.has(o)&&W_(o)&&n.push(vn("assignment/unusedSlot",{de:`${Cn(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${_t(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return n}s(Z2,"validateRules");function X2({slot:e,rules:t}){let n=[];return(t.length===0||t[t.length-1].when!==null)&&n.push(vn("assignment/defaultRowMissing",{de:`${Cn(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${_t(e)} must end with a row without condition ("otherwise")`},{slot:e})),t.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<t.length-1&&n.push(vn("assignment/ruleAfterDefault",{de:`${Cn(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${_t(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=Yf(a,ea,[ji]);for(let c of d)n.push({...c,message:{de:`${c.message.de} (${Cn(e,i)})`,en:`${c.message.en} (${_t(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){F_(a)||n.push(vn("assignment/shadowedRule",{de:`${Cn(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${_t(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=t.slice(0,i).findIndex(u=>u.when!==null&&P_(u.when,a));c!==-1&&n.push(vn("assignment/shadowedRule",{de:`${Cn(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${_t(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===ht&&l.kind==="slot"&&n.push(vn("assignment/slotForwardRef",{de:`${Cn(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${ht}'`,en:`${_t(e,i)} copies '${l.slot}' \u2014 only a team slot after '${ht}' may`},o)),e===ht&&l.kind==="queue"&&n.push(vn("assignment/queueOnProcessSlot",{de:`${Cn(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${_t(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&n.push(vn("assignment/targetMissing",{de:`${Cn(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${_t(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=G_(l.configKeys);d!==null&&n.push(vn("assignment/rotationPool",{de:`${Cn(e,i)}: die Reihum-Liste ${d.de}`,en:`${_t(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!C_(a,ji))&&n.push(vn("assignment/unguardedTarget",{de:`${Cn(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${ji}' ist (oder enth\xE4lt)`,en:`${_t(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${ji}'`},o))}),n}s(X2,"rowIssues");function Z_(e,t){for(let r of t)e.some(i=>i.slot===r)||F(`[assignment/slotMissing] ${_t(r)} has no rule list`);let n=new Set(t);return e.filter(r=>n.has(r.slot))}s(Z_,"selectSlots");function eY(e,t){return D_(Z_(e,t).flatMap(n=>n.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(eY,"contextKeysOfRules");function X_(e,t,n,r){Qs(ea);let i=Z_(e,n),o=eY(e,n),a=Gf(ea.types,t,o);O_(ea,a,o);let l=[];for(let{slot:d,rules:c}of i){let u=c.findIndex((h,w)=>{if(h.when===null)return!0;for(let k of Rt(ei(h.when)))Object.hasOwn(a,k)||F(`[condition/unknownIdentifier] ${_t(d,w)} reads '${k}', which the context does not carry`);return VI(h.when,{values:a})});u===-1&&F(`[assignment/defaultRowMissing] ${_t(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:tY(d,u,p,l,r)})}return l}s(X_,"evaluateRules");function tY(e,t,n,r,i){switch(n.kind){case"person":return{kind:"value",value:i.person(n.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(n,{slot:e,row:t})};case"unassigned":return F(`[assignment/targetMissing] ${_t(e,t)} names no one`);case"queue":return e===ht&&F(`[assignment/queueOnProcessSlot] ${_t(e,t)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===ht?void 0:r.find(a=>a.slot===n.slot);return o===void 0&&F(`[assignment/slotForwardRef] ${_t(e,t)} copies '${n.slot}', which is not decided before it`),o.value}}}s(tY,"resolveTarget");var mw={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function nY(e){if(typeof e!="object"||e===null)return!1;let{kind:t,groupKey:n,...r}=e;return Object.keys(r).length>0?!1:t==="responsible"?n===void 0:t==="team"&&typeof n=="string"&&n.length>0}s(nY,"isStoredSlot");function eN(e){let t=[],n=s((r,i)=>t.push(`[assignment/shape] ${r}: ${i}`),"bad");return Array.isArray(e)?(e.forEach((r,i)=>{let o=`slots[${i}]`;if(typeof r!="object"||r===null)return n(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&n(o,`unknown field(s) ${Object.keys(d).join(", ")}`),nY(a)||n(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return n(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return n(p,"must be { when, assign }");let{when:h,assign:w,...k}=c;Object.keys(k).length>0&&n(p,`unknown field(s) ${Object.keys(k).join(", ")}`),h!==null&&typeof h!="string"&&n(p,"when must be a condition string or null (\u201Esonst\u201C)");let y=w?.kind;if(typeof w!="object"||w===null||typeof y!="string"||!Object.hasOwn(mw,y))return n(p,`assign must be one of ${Object.keys(mw).map(I=>`{kind:'${I}'}`).join(", ")}`);let v=mw[y],A=Object.keys(w);(A.some(I=>!v.includes(I))||v.some(I=>!A.includes(I)))&&n(p,`a '${y}' target has exactly the field(s) ${v.join(", ")}`);let E=w;if(y==="person"&&(typeof E.configKey!="string"||E.configKey.length===0)&&n(p,"a 'person' target needs a non-empty configKey"),y==="rotation"){let I=E.configKeys;(!Array.isArray(I)||I.some(C=>typeof C!="string"))&&n(p,"a 'rotation' target needs configKeys, a list of person keys"),pw.includes(E.mode)||n(p,`a 'rotation' target's mode is one of ${pw.map(C=>`'${C}'`).join(", ")}`)}y==="slot"&&E.slot!==ht&&n(p,`a 'slot' target copies '${ht}' and nothing else`)})}),t):(n("slots","must be a list of { slot, rules }"),t)}s(eN,"ruleShapeIssues");function tN(e){let t=e??{},n=[];if(t.teamOwnerBindings!==void 0&&n.push({de:"[assignment/legacyBindings] der Workflow tr\xE4gt noch teamOwnerBindings \u2014 die Zust\xE4ndigkeitsregel ersetzt sie; das Feld entfernen",en:"[assignment/legacyBindings] the workflow still carries teamOwnerBindings \u2014 the assignment rule replaces them; remove the field"}),t.assignmentRules===void 0)return n.push({de:"[assignment/noRules] der Workflow hat keine Zust\xE4ndigkeitsregel (graph.assignmentRules) \u2014 jeder Workflow muss sagen, wer zust\xE4ndig wird",en:"[assignment/noRules] the workflow has no assignment rule (graph.assignmentRules) \u2014 every workflow must say who becomes responsible"}),n;let r=eN(t.assignmentRules);if(r.length>0)return[...n,...r.map(o=>({de:o,en:o}))];let i=Hf({nodes:Array.isArray(t.nodes)?t.nodes:[]});for(let o of Z2(Y_(t.assignmentRules),i))o.severity==="error"&&n.push(o.message);return n}s(tN,"workflowAssignmentIssues");function Jf(e,t){let o=new Map;for(let d of e)o.set(d,0);let a=new Map,l=[];for(let d of e){if((o.get(d)??0)!==0)continue;let c=[{id:d,edges:t(d),idx:0}];for(o.set(d,1),a.set(d,null);c.length>0;){let u=c[c.length-1];if(u.idx>=u.edges.length){o.set(u.id,2),c.pop();continue}let{target:p,edge:h}=u.edges[u.idx];u.idx++;let w=o.get(p)??0;if(w===1){let k=[p],y=u.id;for(;y&&y!==p;)k.push(y),y=a.get(y)??null;k.reverse(),l.push({edge:h,source:u.id,target:p,cycle:k})}else w===0&&(o.set(p,1),a.set(p,u.id),c.push({id:p,edges:t(p),idx:0}))}}return l}s(Jf,"detectBackEdges");var hw="team:",rY=/^[a-z0-9][a-z0-9-]*$/;function iY(e){if(!e.startsWith(hw))return null;let t=e.slice(hw.length);return t.length>0?t:null}s(iY,"teamKeyOfMember");function Qf(e){return`${hw}${e}`}s(Qf,"teamMember");function ta(e){let t=e.channels;return t===void 0?[]:(Array.isArray(t)||F("graph.channels must be an array"),t)}s(ta,"readAuthoredChannels");function nN(e){return[...Ml(e)].sort()}s(nN,"derivedChannelTeamKeys");function rN(e,t){let n=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!t.has(n))return n;for(let r=2;;r++){let i=`${n}-${r}`;if(!t.has(i))return i}}s(rN,"mintChannelKey");function iN(e,t){let n=e.channels;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"channels",reason:{de:"[channels/shape] graph.channels muss eine Liste sein.",en:"[channels/shape] graph.channels must be a list."}}];let r=[],i=Ml(e),o=new Set,a=new Map;return n.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Tt(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every(A=>typeof A=="string")){r.push({path:c,reason:{de:"[channels/shape] Ein Kanal braucht key, label ({ de, en }) und members (Liste von Texten).",en:"[channels/shape] A channel needs key, label ({ de, en }) and members (a list of texts)."}});return}let p={de:`Kanal "${u.key}"`,en:`Channel "${u.key}"`};rY.test(u.key)||r.push({path:`${c}.key`,reason:{de:`[channels/invalidKey] ${p.de}: Schl\xFCssel nur aus Kleinbuchstaben, Ziffern und Bindestrich.`,en:`[channels/invalidKey] ${p.en}: key only from lowercase letters, digits and hyphens.`}}),o.has(u.key)&&r.push({path:`${c}.key`,reason:{de:`[channels/duplicateKey] ${p.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[channels/duplicateKey] ${p.en}: key is used twice.`}}),o.add(u.key);let h=Tt(u.label);if(h!=="not-localized"&&h.length===2?r.push({path:`${c}.label`,reason:{de:`[channels/emptyLabel] ${p.de}: Bezeichnung fehlt.`,en:`[channels/emptyLabel] ${p.en}: name is missing.`}}):h!=="not-localized"&&h.length>0&&r.push({path:`${c}.label`,reason:{de:`[i18n/missingTranslation] ${p.de}: Bezeichnung fehlt in: ${h.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${p.en}: name is missing in: ${h.join(", ")} \u2014 every displayed text needs German and English.`}}),u.members.length===0){r.push({path:`${c}.members`,reason:{de:`[channels/emptyMembers] ${p.de}: mindestens ein Team.`,en:`[channels/emptyMembers] ${p.en}: at least one team.`}});return}let w=[];for(let A of u.members){let E=iY(A);if(E===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${A}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${A}" is not a "team:<key>".`}});continue}if(w.includes(E)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${E}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${E}" is named twice.`}});continue}t!==void 0&&!t.has(E)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${E}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${E}" does not exist at this school (or it is the applicant group).`}}),w.push(E)}if(w.length===0)return;let k=[...w].sort().join("+"),[y]=w;w.length===1&&y!==void 0&&i.has(y)&&r.push({path:`${c}.members`,reason:{de:`[channels/duplicatesDerived] ${p.de}: Team "${y}" ist am Prozess beteiligt und hat seinen Kanal schon automatisch.`,en:`[channels/duplicatesDerived] ${p.en}: team "${y}" takes part in the process and already has its channel automatically.`}});let v=a.get(k);v!==void 0?r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMembership] ${p.de}: dieselben Teams wie Kanal "${v}" \u2014 zwei Tabs w\xE4ren derselbe Chat.`,en:`[channels/duplicateMembership] ${p.en}: the same teams as channel "${v}" \u2014 two tabs would be the same chat.`}}):a.set(k,u.key)}),r}s(iN,"channelIssues");var Hpe=Object.freeze({});function oY(e,t){return Object.freeze(Gf(Yr,e,t))}s(oY,"formContextEntries");function oN(e){return e.env??[]}s(oN,"declaredContextKeys");function sN(e,t){return oN(e).every(n=>aN(n,t?.[n]))}s(sN,"scenarioContextComplete");function aN(e,t){return I_(Yr,e,t)}s(aN,"contextValueComplete");function lN(e,t){return oY(t??{},oN(e))}s(lN,"scenarioContextEntries");function yw(e){return Dl(e)}s(yw,"isContextIdentifier");function sY(e,t,n){let r=Uf(Yr,e);if(r!==null)return{severity:"error",path:n,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return t.has(i)?null:{severity:"error",path:n,code:"env/undeclared",message:{de:`'${e}' liest den Umgebungsschl\xFCssel '${i}', den das Formular nicht in \`env\` deklariert.`,en:`'${e}' reads the environment key '${i}', which the form does not declare in \`env\`.`}}}s(sY,"contextIdentifierIssue");var gw=af("stage.key");function aY(e){let t=[],n=s(i=>i.kind==="ident"&&i.path===gw,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(n(i.left)&&i.right.kind==="str"&&t.push(i.right.value),n(i.right)&&i.left.kind==="str"&&t.push(i.left.value)),i.op==="in"&&n(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&t.push(o.value);r(i.left),r(i.right);return;case"unary":r(i.operand);return;case"if":r(i.cond),r(i.then),r(i.else);return;case"call":i.args.forEach(r);return;case"arr":i.items.forEach(r);return;default:return}},"walk");return r(e),t}s(aY,"stageKeyLiterals");function Zf(e,t,n){return t===void 0?[]:aY(e).filter(r=>!t.has(r)).map(r=>cN(r,t,n))}s(Zf,"stageKeyAstIssues");function dN(e,t){if(t===void 0)return[];let n=[];for(let r of e.testScenarios??[]){let i=r.env?.stage;typeof i?.key=="string"&&!t.has(i.key)&&n.push(cN(i.key,t,`scenario:${r.id}/env`))}return n}s(dN,"scenarioStageKeyIssues");function cN(e,t,n){let r=[...t].sort();return{severity:"error",path:n,code:"env/unknownStageKey",message:{de:`'${e}' ist kein Stufenschl\xFCssel des Programms dieses Angebots \u2014 `+(r.length>0?`bekannt: ${r.join(", ")}.`:"das Angebot hat kein Programm mit Stufen.")+` \`${gw}\` ist der Bundle-Schl\xFCssel (\`program.stages[].key\`), nie das gespeicherte \`<program>-stufe-<key>\`.`,en:`'${e}' is not a stage key of the offer's program \u2014 `+(r.length>0?`known: ${r.join(", ")}.`:"the offer has no program with stages.")+` \`${gw}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(cN,"unknownStageKeyIssue");function uN(e,t,n){let r=[];for(let i of Rt(e)){if(!yw(i))continue;let o=sY(i,t,n);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of uw(e,of))r.push({severity:"error",path:n,code:"env/unguardedNullable",message:{de:`'${o}' \xFCber '${i}', das bei manchen Bewerbungen leer ist, braucht davor eine Absicherung '${i} != null &&' \u2014 lege fest, was ein leerer Wert bedeutet.`,en:`'${o}' over '${i}', which is empty for some applications, needs a guard '${i} != null &&' before it \u2014 say what an empty value means.`}});return r}s(uN,"contextAstIssues");function fN(e,t){let n=[...lY(e)],r=new Set(e.env??[]);for(let i of e.env??[]){if(!Ss(i)){n.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${i}' geh\xF6rt nicht zum Vokabular (${xs.join(", ")}).`,en:`Declared environment key '${i}' is not in the vocabulary (${xs.join(", ")}).`}});continue}t!==void 0&&!t.has(i)&&n.push({severity:"error",path:"env",code:"env/unsupplied",message:{de:`Das Formular deklariert den Umgebungsschl\xFCssel '${i}', aber sein Host liefert ihn nicht.`,en:`The form declares environment key '${i}', but its host does not supply it.`}})}for(let i of e.testScenarios??[]){let o=[...r].filter(a=>Ss(a)&&!aN(a,i.env?.[a]));o.length>0&&n.push({severity:"error",path:`scenario:${i.id}/env`,code:"env/unsampled",message:{de:`Szenario '${i.id}' belegt den deklarierten Umgebungsschl\xFCssel ${o.map(a=>`'${a}'`).join(", ")} nicht vollst\xE4ndig \u2014 eine echte Bewerbung tr\xE4gt immer jedes seiner Felder (ein leeres als null).`,en:`Scenario '${i.id}' does not sample the declared environment key(s) ${o.map(a=>`'${a}'`).join(", ")} completely \u2014 a real application always carries every field of them (an empty one as null).`}});for(let a of Object.keys(i.env??{}))Ss(a)?r.has(a)||n.push({severity:"error",path:`scenario:${i.id}/env`,code:"env/undeclared",message:{de:`Szenario '${i.id}' belegt den Umgebungsschl\xFCssel '${a}', den das Formular nicht deklariert.`,en:`Scenario '${i.id}' samples environment key '${a}', which the form does not declare.`}}):n.push({severity:"error",path:`scenario:${i.id}/env`,code:"env/unknownKey",message:{de:`Szenario '${i.id}' belegt den unbekannten Umgebungsschl\xFCssel '${a}'.`,en:`Scenario '${i.id}' samples unknown environment key '${a}'.`}})}return n}s(fN,"formContextIssues");function lY(e){let t=[];Object.hasOwn(e,"context")&&t.push({severity:"error",path:"context",code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Formular deklariert die gelesene Umgebung als `env`.",en:"`context` is retired \u2014 a form declares the environment it reads as `env`."}});let n=e.testScenarios;for(let r of Array.isArray(n)?n:[])r!==null&&typeof r=="object"&&Object.hasOwn(r,"context")&&t.push({severity:"error",path:`scenario:${String(r.id)}/context`,code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Szenario belegt die Umgebung als `env`.",en:"`context` is retired \u2014 a scenario samples the environment as `env`."}});return t}s(lY,"retiredContextFields");function Xf(e,t,n){let r=Yf(e,t).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(n?.liveEnvKeys!==void 0)for(let o of cw(e,t)){let a=U_(o.path,n.liveEnvKeys);a===null&&F(`[condition] no live-key universe for '${o.path}' \u2014 extend liveKeyUniverse`),a.has(o.value)||i.push({de:`$env.${o.path} == '${o.value}' nennt keinen Schl\xFCssel dieses Mandanten.`,en:`$env.${o.path} == '${o.value}' names no key of this school.`})}for(let o of Zf($t(e),n?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(Xf,"envConditionFindings");function ep(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(ep,"isReviewField");function na(e){let t=[],n=[];function r(y,v){try{return $t(y)}catch(A){t.push({path:v,src:y,reason:A instanceof Error?A.message:String(A)});return}}s(r,"tryParse");function i(y,v){return{...y,visibleIf:y.visibleIf?r(y.visibleIf,`${v}.visibleIf`):void 0,requiredIf:y.requiredIf?r(y.requiredIf,`${v}.requiredIf`):void 0,disabledIf:y.disabledIf?r(y.disabledIf,`${v}.disabledIf`):void 0,defaultValue:y.defaultValue?r(y.defaultValue,`${v}.defaultValue`):void 0}}s(i,"compileField");function o(y,v){return{...y,visibleIf:y.visibleIf?r(y.visibleIf,`${v}.visibleIf`):void 0,fields:y.fields.map((A,E)=>i(A,`${v}.fields[${E}]`))}}s(o,"compileGroup");function a(y,v){return{...y,itemTemplate:y.itemTemplate.map((A,E)=>i(A,`${v}.itemTemplate[${E}]`)),effects:y.effects?.map((A,E)=>d(A,`${v}.effects[${E}]`)),itemVisibleIf:y.itemVisibleIf?r(y.itemVisibleIf,`${v}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(y,v){let A=[];return y.fields.forEach((E,I)=>{if(E.externalFlag){n.push({key:E.key,label:E.label,defaultValue:E.defaultValue?r(E.defaultValue,`${v}.fields[${I}].defaultValue`):void 0});return}A.push(i(E,`${v}.fields[${I}]`))}),{...y,visibleIf:y.visibleIf?r(y.visibleIf,`${v}.visibleIf`):void 0,fields:A,groups:y.groups?.map((E,I)=>o(E,`${v}.groups[${I}]`)),computed:y.computed?.map((E,I)=>{let C=r(E.expression,`${v}.computed[${I}].expression`);return{key:E.key,expression:C??{kind:"null"}}}),subsections:y.subsections?.map((E,I)=>l(E,`${v}.subsections[${I}]`)),repeated:y.repeated?.map((E,I)=>a(E,`${v}.repeated[${I}]`)),validators:y.validators}}s(l,"compileSection");function d(y,v){return{...y,when:y.when?r(y.when,`${v}.when`):void 0}}s(d,"compileEffect");function c(y,v){let A=r(y.when,`${v}.when`);return A?{...y,when:A}:null}s(c,"compileOutcome");let u=e.sections.map((y,v)=>l(y,`sections[${v}]`)),p=(e.effects??[]).map((y,v)=>d(y,`effects[${v}]`)),h=[],w=e.outcomes??[];for(let y=0;y<w.length;y++){let v=w[y],A=c(v,`outcomes[${y}]`);A&&h.push(A)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:n},errors:t}}s(na,"compileForm");var dY=new Set(["decision","review","governedDocument"]);function mN(e){return dY.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s(mN,"isReadinessGatedNode");function cY(e){let t=new Map,n=fY(e),r=s((i,o)=>{let a=ww(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&t.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:uY(d.bucket,n,a),section:a,type:d.type,enumSource:pN(d),repeated:!1,reviewRequired:d.reviewRequired===!0});for(let d of i.repeated??[])for(let c of d.itemTemplate){let u=`${d.key}.${c.key}`;t.set(u,{kind:"entered",key:u,label:c.label,qualifier:ww(d),section:a,type:c.type,enumSource:pN(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=Rt($t(d.expression));t.set(d.key,{kind:"computed",key:d.key,label:d.label??{de:d.key,en:d.key},qualifier:a,deps:c})}for(let d of i.subsections??[])r(d,o)},"visit");for(let i of e.sections)r(i,i);return t}s(cY,"formFieldCatalog");function pN(e){return e.type==="enum"?e:null}s(pN,"enumSourceOf");function uY(e,t,n){return e===void 0?n:t.get(e)??n}s(uY,"fieldQualifier");function fY(e){let t=new Map,n=s((r,i)=>{i===void 0||t.has(r)||t.set(r,ww(i))},"add");for(let r of gN(e))r.kind==="person"?n(r.bucket,r.display):r.kind==="organization"&&n(r.id.replace(/^o\./,""),r.display);return t}s(fY,"bucketWordings");function hN(e){return e.flatMap(t=>[t,...hN(t.subsections??[])])}s(hN,"allSections");function gN(e){return[...e.effects,...hN(e.sections).flatMap(t=>(t.repeated??[]).flatMap(n=>n.effects??[]))]}s(gN,"allEffects");function ww(e){return{label:e.label}}s(ww,"wordingOf");function yN(e){return xl(e).flatMap(({slot:t,address:n})=>{let r=YI(n);return r===null||vl.includes(r.path)?[]:[{slotId:t,owner:r.owner,fieldKey:r.path}]})}s(yN,"admissionBindingLeaves");function pY(e,t){let n=e.get(t);if(n===void 0)return null;let r=[],i=new Set,o=s(a=>{if(!i.has(a.key)&&(i.add(a.key),r.push({fieldKey:a.key,kind:a.kind}),a.kind==="computed"))for(let l of a.deps){let d=e.get(l);d!==void 0&&o(d)}},"walk");return o(n),r}s(pY,"expandKey");function mY(e){let t=new Set;for(let n of gN(e))if(!(n.kind!=="person"||n.contractParty===void 0)&&n.when!==void 0)for(let r of Rt($t(n.when)))t.add(r);return[...t]}s(mY,"contractPartyConditionKeys");function hY(e){return na(e).compiled.flags.map(t=>({key:t.key,name:t.label}))}s(hY,"formExternalFlags");function wN(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([t,n])=>[t,cY(n)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(mY(n))])),formFlagKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(hY(n).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set((n.views??[]).map(r=>r.key))]))}}s(wN,"readinessUniverse");function kw(e,t){let n=new Set;for(let r of t)for(let i of pY(e,r)??[])i.kind==="entered"&&n.add(i.fieldKey);return n}s(kw,"enteredFieldsBehind");var gY=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function yY(e){return gY.has(e)?!0:kN(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(yY,"isTextKey");function kN(e){return/^localized[A-Z]/.test(e)}s(kN,"isLegacyTwinKey");var wY=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),kY=new Set(["inputs","resolver","library"]);function np(e,t){let n=[];return bw(e,t,n),n}s(np,"findUnlocalizedTexts");function bw(e,t,n){if(Array.isArray(e)){e.forEach((i,o)=>bw(i,`${t}[${vY(i,o)}]`,n));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${t}.${i}`;if(!kY.has(i)){if(kN(i)){n.push({path:a,missing:"legacy-twin"});continue}if(yY(i)){bY(o,a,n);continue}if(wY.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&bN(d,`${a}.${l}`,n);continue}bw(o,a,n)}}}s(bw,"walk");function bY(e,t,n){e!=null&&bN(e,t,n)}s(bY,"checkText");function bN(e,t,n){let r=Tt(e);(r==="not-localized"||r.length>0)&&n.push({path:t,missing:r})}s(bN,"report");function vY(e,t){if(e!==null&&typeof e=="object"){let n=e;if(typeof n.id=="string")return n.id;if(typeof n.key=="string")return n.key}return String(t)}s(vY,"keyOf");function tp(e,t){return e==="not-localized"?t==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?t==="de"?'ist ein Zwilling der alten Form \u2014 der Text geh\xF6rt in das Feld ohne \u201Elocalized"':'is a twin of the old shape \u2014 the text belongs in the field without "localized"':t==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(tp,"describe");function vw({path:e,missing:t}){return t==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${tp(t,"de")}.`,en:`[i18n/legacyTwin] ${e} ${tp(t,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${tp(t,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${tp(t,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(vw,"unlocalizedTextReason");var xY={engagePush:["engage"]};function SY(e){let t=xY[e.type];return t===void 0?e:Object.fromEntries(Object.entries(e).filter(([n])=>!t.includes(n)))}s(SY,"withoutMachineData");function vN(e,t){return[...np(e.nodes.map(SY),"nodes"),...t===void 0?[]:np(t,`layout.${t.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:vw(r),severity:"error"}))}s(vN,"checkLocalizedTexts");var $o=5,Ro=480;function ii(e){return typeof e=="string"&&e.trim().length>0}s(ii,"isNonEmptyString");function SN(e,t,n){return Object.keys(e).filter(r=>!t.includes(r)).map(r=>({field:`result.${r}`,code:tt.unknownField,message:{de:`Unbekanntes Feld '${r}' im ${n.de}; erlaubt sind: ${t.join(", ")}.`,en:`Unknown field '${r}' in the ${n.en}; allowed: ${t.join(", ")}.`}}))}s(SN,"unknownFieldIssues");function AY(e){let t=[],n=e.title;(n===void 0||typeof n!="object"||n===null||!ii(n.de)||!ii(n.en))&&t.push({field:"result.title",code:tt.appointmentMissingTitle,message:{de:"Ein Termin-Ergebnis braucht einen neutralen Titel in beiden Sprachen ({ de, en }) \u2014 er steht in der Mail und in der Kalenderdatei der Familie, deshalb nie ein Familienname.",en:"An appointment result needs a neutral title in both languages ({ de, en }) \u2014 it appears in the email and in the family's calendar file, so never a family name."}});let r=e.durationMinutes;return(typeof r!="number"||!Number.isInteger(r)||r<$o||r>Ro)&&t.push({field:"result.durationMinutes",code:tt.appointmentInvalidDuration,message:{de:`'durationMinutes' muss eine ganze Zahl von ${$o} bis ${Ro} sein, erhalten ${JSON.stringify(r)}.`,en:`'durationMinutes' must be a whole number from ${$o} to ${Ro}, got ${JSON.stringify(r)}.`}}),t.push(...SN(e,["kind","title","durationMinutes"],{de:"Termin-Ergebnis",en:"appointment result"})),t}s(AY,"appointmentIssues");function xN(e){if(typeof e!="object"||e===null)return!1;let t=e;return ii(t.de)&&ii(t.en)}s(xN,"isBilingual");var xw=["key","type","label","writes","options","min","suggest","evidence","evidenceFrom"];function EY(e){let t=s((i,o)=>({field:i,code:tt.recordFields,message:o}),"issue");if(!Array.isArray(e)||e.length===0)return[t("result.fields",{de:"Eine Erfassung braucht mindestens ein Feld ('result.fields').",en:"A record needs at least one field ('result.fields')."})];let n=[],r=new Set;for(let[i,o]of e.entries()){let a=`result.fields[${i}]`;if(typeof o!="object"||o===null||Array.isArray(o)){n.push(t(a,{de:"Ein Feld der Erfassung muss ein Objekt sein.",en:"A field of the record must be an object."}));continue}let l=o,d=l.key;typeof d!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(d)?n.push(t(`${a}.key`,{de:`Feld-Schl\xFCssel ${JSON.stringify(d)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,en:`Field key ${JSON.stringify(d)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`})):r.has(d)?n.push(t(`${a}.key`,{de:`Feld-Schl\xFCssel "${d}" ist doppelt.`,en:`Field key "${d}" is duplicated.`})):r.add(d);let c=typeof d=="string"?`"${d}"`:`Nr. ${i+1}`,u=typeof d=="string"?`"${d}"`:`no. ${i+1}`;if(gy(l.type)||n.push(t(`${a}.type`,{de:`Feld ${c}: Typ ${JSON.stringify(l.type)} \u2014 erlaubt: ${gf.join(", ")}.`,en:`Field ${u}: type ${JSON.stringify(l.type)} \u2014 allowed: ${gf.join(", ")}.`})),xN(l.label)||n.push(t(`${a}.label`,{de:`Feld ${c} braucht ein Label in beiden Sprachen ({ de, en }).`,en:`Field ${u} needs a label in both languages ({ de, en }).`})),ii(l.writes)||n.push(t(`${a}.writes`,{de:`Feld ${c} schreibt in keinen Vorgangs-Schl\xFCssel ('writes') \u2014 ein Wert, den niemand lesen kann, geh\xF6rt nicht in eine Erfassung.`,en:`Field ${u} writes to no process key ('writes') \u2014 a value nobody can read does not belong in a record.`})),l.type==="enum"){let h=Array.isArray(l.options)?l.options:[],w=h.map(k=>k.key);(h.length<2||w.some(k=>typeof k!="string"||k.length===0)||new Set(w).size!==w.length||h.some(k=>!xN(k.label)))&&n.push(t(`${a}.options`,{de:`Feld ${c} (Auswahl) braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln und Labels in beiden Sprachen.`,en:`Field ${u} (choice) needs at least 2 options with unique keys and labels in both languages.`}))}else l.options!==void 0&&n.push(t(`${a}.options`,{de:`Feld ${c}: 'options' gibt es nur bei Typ 'enum'.`,en:`Field ${u}: 'options' exists only for type 'enum'.`}));if(l.min!==void 0&&(l.type!=="number"||typeof l.min!="number"||!Number.isInteger(l.min))&&n.push(t(`${a}.min`,{de:`Feld ${c}: 'min' gibt es nur bei Typ 'number', als ganze Zahl.`,en:`Field ${u}: 'min' exists only for type 'number', as a whole number.`})),l.evidence!==void 0&&typeof l.evidence!="boolean"&&n.push(t(`${a}.evidence`,{de:`Feld ${c}: 'evidence' ist true oder false.`,en:`Field ${u}: 'evidence' is true or false.`})),l.evidenceFrom!==void 0){let h=typeof l.min=="number"?l.min:0;(l.type!=="number"||l.evidence!==!0||typeof l.evidenceFrom!="number"||!Number.isInteger(l.evidenceFrom)||l.evidenceFrom<=h)&&n.push(t(`${a}.evidenceFrom`,{de:`Feld ${c}: 'evidenceFrom' gibt es nur bei Typ 'number' mit 'evidence', als ganze Zahl \xFCber dem Minimum (${h}) \u2014 sonst g\xE4lte der Nachweis immer.`,en:`Field ${u}: 'evidenceFrom' exists only for type 'number' with 'evidence', as a whole number above the minimum (${h}) \u2014 otherwise the proof would always apply.`}))}if(l.suggest!==void 0){let h=l.suggest,w=typeof h=="object"&&h!==null?h.kind:void 0;w==="form"&&"address"in h&&Object.keys(h).length===2&&(!xe(h.address)||ct(h.address))||w==="siblingRank"&&Object.keys(h).length===1&&l.type==="number"||n.push({field:`${a}.suggest`,code:tt.recordSuggest,message:{de:`Feld ${c}: Vorschlag ${JSON.stringify(l.suggest)} \u2014 erlaubt: { kind: 'form', address: '$node.<formular>.admission.<export>' } oder { kind: 'siblingRank' } (nur bei Typ 'number'); bekannte Arten: ${yy.join(", ")}.`,en:`Field ${u}: suggestion ${JSON.stringify(l.suggest)} \u2014 allowed: { kind: 'form', address: '$node.<form>.admission.<export>' } or { kind: 'siblingRank' } (only for type 'number'); known kinds: ${yy.join(", ")}.`}})}let p=Object.keys(l).filter(h=>!xw.includes(h));p.length>0&&n.push(t(a,{de:`Feld ${c}: unbekannte Angabe ${p.map(h=>`'${h}'`).join(", ")}; erlaubt: ${xw.join(", ")}.`,en:`Field ${u}: unknown entry ${p.map(h=>`'${h}'`).join(", ")}; allowed: ${xw.join(", ")}.`}))}return n}s(EY,"recordFieldIssues");function TY(e,t,n){let r=[],i=t.options;if(e==="choice"){let o=Array.isArray(i)?i:[],a=o.map(l=>l.key);(o.length<2||a.some(l=>typeof l!="string"||l.length===0)||new Set(a).size!==a.length)&&r.push({field:"result.options",code:tt.choiceOptions,message:{de:`Ein Auswahl-Ergebnis braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln, erhalten ${JSON.stringify(a)}.`,en:`A choice result needs at least 2 options with unique keys, got ${JSON.stringify(a)}.`}})}else i!==void 0&&r.push({field:"result.options",code:tt.choiceOptions,message:{de:`'result.options' gibt es nur bei 'choice' \u2014 ${e==="recommendation"?"eine Empfehlung hat die festen Tendenzen Positiv/Neutral/Negativ":"ein Freitext hat keine Auswahl"}.`,en:`'result.options' exists only for 'choice' \u2014 ${e==="recommendation"?"a recommendation has the fixed leanings Positive/Neutral/Negative":"a free text has no choice"}.`}});if(e==="pricedItem"){let o=t.item;if(!ii(o))r.push({field:"result.item",code:tt.pricedItemMissingItem,message:{de:"Ein Preispositions-Ergebnis nennt den Artikel, den es bepreist \u2014 'result.item' (der Schl\xFCssel des Artikels, z. B. 'tuition') fehlt.",en:"A priced-item result names the article it prices \u2014 'result.item' (the article's key, e.g. 'tuition') is missing."}});else if(n.billingItemKeys!==void 0&&!n.billingItemKeys.has(o))r.push({field:"result.item",code:tt.pricedItemUnknownItem,message:{de:`'result.item' "${o}" \u2014 kein Artikel dieses Mandanten tr\xE4gt diesen Schl\xFCssel (bekannt: ${[...n.billingItemKeys].join(", ")||"keine"}).`,en:`'result.item' "${o}" \u2014 no article of this school has this key (known: ${[...n.billingItemKeys].join(", ")||"none"}).`}});else if(n.offerProgram===null)r.push({field:"result.item",code:tt.pricedItemOfferWithoutProgram,message:{de:`'result.item' "${o}" \u2014 das Angebot ist keinem Programm zugeordnet, also geh\xF6rt kein Artikel zu ihm; dem Angebot ein Programm geben.`,en:`'result.item' "${o}" \u2014 the offer is not assigned to a program, so no article belongs to it; give the offer a program.`}});else if(n.offerProgram!==void 0&&!n.offerProgram.billingItemKeys.has(o)){let l=n.offerProgram;r.push({field:"result.item",code:tt.pricedItemNotInProgram,message:{de:`'result.item' "${o}" \u2014 der Artikel ist dem Programm \u201E${l.nameDe}\u201C des Angebots nicht zugeordnet (zugeordnet: ${[...l.billingItemKeys].join(", ")||"keine"}); unter Finanzen \u2192 Artikel zuordnen, direkt oder \xFCber ein Paket.`,en:`'result.item' "${o}" \u2014 the article is not assigned to the offer's program "${l.nameDe}" (assigned: ${[...l.billingItemKeys].join(", ")||"none"}); assign it under Finance \u2192 articles, directly or through a package.`}})}let a=t.label;(typeof a!="object"||a===null||!ii(a.de)||!ii(a.en))&&r.push({field:"result.label",code:tt.labelMissing,message:{de:"Ein Preispositions-Ergebnis braucht einen Namen f\xFCr seinen Wert in beiden Sprachen ('result.label', z. B. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 so hei\xDFt er im Workflow und in der Verdrahtung.",en:"A priced-item result needs a name for its value in both languages ('result.label', e.g. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 that is what it is called in the workflow and in the wiring."}})}else t.item!==void 0&&r.push({field:"result.item",code:tt.itemOnNonPricedItem,message:{de:`'result.item' gibt es nur bei 'pricedItem' \u2014 ein ${e}-Ergebnis bepreist keinen Artikel.`,en:`'result.item' exists only for 'pricedItem' \u2014 a ${e} result prices no article.`}});if(e==="record"?(r.push(...EY(t.fields)),t.writes!==void 0&&r.push({field:"result.writes",code:tt.writesOnProse,message:{de:"Eine Erfassung schreibt je Feld ('fields[].writes'), nie als Ganzes ('result.writes').",en:"A record writes per field ('fields[].writes'), never as a whole ('result.writes')."}}),t.label!==void 0&&r.push({field:"result.label",code:tt.unknownField,message:{de:"Eine Erfassung benennt ihre Werte je Feld ('fields[].label'), nicht als Ganzes ('result.label').",en:"A record names its values per field ('fields[].label'), not as a whole ('result.label')."}})):t.fields!==void 0&&r.push({field:"result.fields",code:tt.fieldsOnNonRecord,message:{de:`'result.fields' gibt es nur bei 'record' \u2014 ein ${e}-Ergebnis hat keine Felder.`,en:`'result.fields' exists only for 'record' \u2014 a ${e} result has no fields.`}}),e==="reduction"&&(ii(t.writes)||r.push({field:"result.writes",code:tt.reductionPrices,message:{de:"Eine Reduktion schreibt ihren Betrag in einen Vorgangs-Schl\xFCssel vom Typ reduction ('result.writes') \u2014 sonst l\xE4se ihn kein Preis.",en:"A reduction writes its amount to a process key of type reduction ('result.writes') \u2014 otherwise no price would read it."}})),t.writes!==void 0&&(e==="freetext"||e==="recommendation")&&r.push({field:"result.writes",code:tt.writesOnProse,message:{de:`'result.writes' gibt es nur bei Ergebnissen mit Wert (Auswahl, Preisposition) \u2014 ein ${e}-Ergebnis bleibt im Chat und schreibt nichts in den Vorgang.`,en:`'result.writes' exists only for results with a value (choice, priced item) \u2014 a ${e} result stays in the chat and writes nothing to the process.`}}),e==="freetext"&&t.textRequired!==void 0&&r.push({field:"result.textRequired",code:tt.textRequiredOnFreetext,message:{de:"'textRequired' auf einem Freitext-Ergebnis \u2014 der Text eines Freitexts ist immer Pflicht; die Angabe entfernen.",en:"'textRequired' on a free-text result \u2014 the text of a free text is always required; remove the entry."}}),t.chat===void 0)r.push({field:"result.chat",code:tt.chatMissing,message:{de:"Ein Aufgaben-Ergebnis steht nur im Chat \u2014 'result.chat' fehlt: 'all', 'team:<Gruppe>' oder einen Kanal des Workflows angeben.",en:"A task result appears only in the chat \u2014 'result.chat' is missing: give 'all', 'team:<group>' or a channel of the workflow."}});else{let o=t.chat,a=typeof o=="string"?Is(o):null;o==="external"||a===null?r.push({field:"result.chat",code:tt.chatExternal,message:{de:`'result.chat' ${JSON.stringify(o)} \u2014 ein Aufgaben-Ergebnis bleibt intern: erlaubt sind 'all', 'team:<Gruppe>' oder ein Kanal des Workflows, nie 'external'.`,en:`'result.chat' ${JSON.stringify(o)} \u2014 a task result stays internal: 'all', 'team:<group>' or a channel of the workflow are allowed, never 'external'.`}}):a.kind==="channel"&&!n.channelKeys.has(a.channelKey)&&r.push({field:"result.chat",code:tt.chatUnknownChannel,message:{de:`'result.chat' "${a.channelKey}" ist weder 'all' noch 'team:<Gruppe>' noch ein Kanal des Workflows (bekannt: ${[...n.channelKeys].join(", ")||"keine"}).`,en:`'result.chat' "${a.channelKey}" is neither 'all' nor 'team:<group>' nor a channel of the workflow (known: ${[...n.channelKeys].join(", ")||"none"}).`}})}return r.push(...SN(t,["kind","options","textRequired","chat","item","label","writes","fields","prices"],{de:"Aufgaben-Ergebnis",en:"task result"})),r}s(TY,"recordedIssues");function AN(e,t,n={channelKeys:new Set}){if(t===void 0)return[];if(e!=="task")return[{field:"result",code:tt.onApproval,message:{de:`'result' gilt nur f\xFCr die Art 'task' \u2014 eine '${e}' wird durch ihr Votum abgeschlossen, nicht durch ein Ergebnis.`,en:`'result' applies only to the kind 'task' \u2014 an '${e}' is completed by its vote, not by a result.`}}];if(typeof t!="object"||t===null||Array.isArray(t))return[{field:"result",code:tt.unknownKind,message:{de:`'result' muss ein Objekt mit 'kind' sein; bekannte Arten: ${$s.join(", ")}.`,en:`'result' must be an object with 'kind'; known kinds: ${$s.join(", ")}.`}}];let r=t;return NI(r.kind)?r.kind==="appointment"?AY(r):TY(r.kind,r,n):[{field:"result.kind",code:tt.unknownKind,message:{de:`Unbekannte Ergebnisart ${JSON.stringify(r.kind)}; bekannte Arten: ${$s.join(", ")}.`,en:`Unknown result kind ${JSON.stringify(r.kind)}; known kinds: ${$s.join(", ")}.`}}]}s(AN,"taskResultIssues");var Sw=60;function oi(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(oi,"error");function $Y(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"warning"}}s($Y,"warning");function EN(e){return Array.isArray(e.tasks)?e.tasks:[]}s(EN,"tasksOf");function $N(e,t){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(r=>r.action==="spawnTasks"&&Array.isArray(r.tasks)&&r.tasks.includes(t))}s($N,"spawnActionsOf");function TN(e,t){return $N(e,t).map(n=>String(n.key)).sort()}s(TN,"bindingsOf");function RN(e,t){let n=[],r=EN(e),i=new Map;for(let o of r){if(o.appointment===void 0)continue;let a=typeof o.key=="string"?o.key:"?",l=`nodes.${e.id}.tasks.${a}`,d={de:`Terminaufgabe "${a}" (Knoten "${e.id}")`,en:`Appointment task "${a}" (node "${e.id}")`},c=o.appointment,p=typeof c=="object"&&c!==null&&Object.keys(c).every($=>$==="of"||$==="dueDaysAfterEnd")&&typeof c.of=="string"?c.of:void 0,h=p===void 0?void 0:r.find($=>$.key===p),w=h?.result;if(p===void 0||h===void 0||w?.kind!=="appointment")n.push(oi(`${l}.appointment.of`,{de:`[workItems/appointmentOfUnknown] ${d.de} braucht 'appointment: { of, dueDaysAfterEnd }', und 'of' nennt eine Aufgabe desselben Knotens, die mit einem Termin abschlie\xDFt (result.kind 'appointment'); erhalten ${JSON.stringify(o.appointment)}.`,en:`[workItems/appointmentOfUnknown] ${d.en} needs 'appointment: { of, dueDaysAfterEnd }', and 'of' names a task of the same node that ends with an appointment (result.kind 'appointment'); got ${JSON.stringify(o.appointment)}.`}));else{i.set(p,(i.get(p)??0)+1);let $=h.blocks,b=[...["when","optional"].filter(R=>h[R]!==void 0),...typeof $?.node=="string"&&$.node!==e.id?["blocks"]:[]];b.length>0&&n.push(oi(`nodes.${e.id}.tasks.${p}.${b[0]}`,{de:`[workItems/appointmentTaskShape] "${p}" bucht den Termin f\xFCr ${d.de} und tr\xE4gt ${b.map(R=>R==="blocks"?"ein knoten\xFCbergreifendes 'blocks'":`'${R}'`).join(", ")} \u2014 fiele sie ohne Buchung weg oder \xFCberlebte sie ihren Knoten, wartete die Terminaufgabe f\xFCr immer bzw. f\xE4nde die Buchung keine Terminaufgabe mehr.`,en:`[workItems/appointmentTaskShape] "${p}" books the appointment for ${d.en} and carries ${b.map(R=>R==="blocks"?"a cross-node 'blocks'":`'${R}'`).join(", ")} \u2014 if it dropped out without a booking or outlived its node, the appointment task would wait forever or the booking would find no appointment task any more.`}));for(let R of $N(e,p))R.repeatable!==!0&&n.push(oi(`nodes.${e.id}.optionalActions.${String(R.key)}.repeatable`,{de:`[workItems/appointmentActionRepeatable] Die optionale Aktion "${String(R.key)}" legt "${p}" an, die den Termin f\xFCr ${d.de} bucht, und ist nicht 'repeatable: true'. Eine Absage beendet die Runde; ohne zweite Runde lie\xDFe sich die Aktion nie wieder ausl\xF6sen, und eine Entscheidung, die auf sie wartet (requiresOneOf), bliebe h\xE4ngen.`,en:`[workItems/appointmentActionRepeatable] The optional action "${String(R.key)}" creates "${p}", which books the appointment for ${d.en}, and is not 'repeatable: true'. A cancellation ends the round; without a second round the action could never be triggered again, and a decision waiting for it (requiresOneOf) would hang.`}));TN(e,a).join(",")!==TN(e,p).join(",")&&n.push(oi(`${l}.appointment.of`,{de:`[workItems/appointmentTaskBinding] ${d.de} geh\xF6rt zu anderen optionalen Aktionen als "${p}", die ihren Termin bucht \u2014 beide Zeilen sind eine Runde: entweder beide in derselben Aktion (spawnTasks) oder beide in keiner.`,en:`[workItems/appointmentTaskBinding] ${d.en} belongs to different optional actions than "${p}", which books its appointment \u2014 both rows are one round: either both in the same action (spawnTasks) or both in none.`}))}let k=c?.dueDaysAfterEnd;(typeof k!="number"||!Number.isInteger(k)||k<0||k>Sw)&&n.push(oi(`${l}.appointment.dueDaysAfterEnd`,{de:`[workItems/appointmentTaskDue] ${d.de}: 'dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${Sw} \u2014 die Tage nach dem Terminende, bis die Aufgabe f\xE4llig ist; erhalten ${JSON.stringify(k)}.`,en:`[workItems/appointmentTaskDue] ${d.en}: 'dueDaysAfterEnd' is a whole number from 0 to ${Sw} \u2014 the days after the appointment ends until the task is due; got ${JSON.stringify(k)}.`})),o.params?.dueInDays!==void 0&&n.push(oi(`${l}.params.dueInDays`,{de:`[workItems/appointmentTaskDue] ${d.de} tr\xE4gt 'params.dueInDays' neben 'appointment.dueDaysAfterEnd' \u2014 eine Terminaufgabe ist ab dem Terminende f\xE4llig, nie ab ihrer Anlage.`,en:`[workItems/appointmentTaskDue] ${d.en} carries 'params.dueInDays' next to 'appointment.dueDaysAfterEnd' \u2014 an appointment task is due from the end of the appointment, never from its creation.`}));let y=o.result,v=["when","optional","familyRequest","reads","locksEvidence"].filter($=>o[$]!==void 0).map($=>`'${$}'`),A=typeof o.blocks?.node=="string"&&o.blocks.node!==e.id,E=s($=>[...o.kind!=="task"?["'kind: approval'"]:[],...y===void 0||!_i(y.kind)?[$==="de"?"kein erfasstes Ergebnis (Feedback)":"no recorded result (feedback)"]:[],...v,...A?[$==="de"?"ein knoten\xFCbergreifendes 'blocks'":"a cross-node 'blocks'"]:[]],"shapeFaults");E("de").length>0&&n.push(oi(`${l}.appointment`,{de:`[workItems/appointmentTaskShape] ${d.de}: ${E("de").join(", ")} \u2014 eine Terminaufgabe ist eine Aufgabe, die mit ihrem Feedback (Freitext, Empfehlung, Auswahl) abschlie\xDFt, und sie entsteht, weil der Termin entsteht: ohne Bedingung, nicht optional, keine Nachforderung, ohne Belege (nichts l\xE4sst sie ungebunden neu entstehen) und an ihrem Knoten.`,en:`[workItems/appointmentTaskShape] ${d.en}: ${E("en").join(", ")} \u2014 an appointment task is a task that ends with its feedback (free text, recommendation, choice), and it exists because the appointment exists: no condition, not optional, no follow-up request, no evidence (nothing lets it be created again unbound) and on its own node.`}));let I=o.result?.chat,C=o.assign?.group;typeof I=="string"&&I.startsWith("team:")&&typeof C=="string"&&I!==`team:${C}`&&n.push($Y(`${l}.result.chat`,{de:`[workItems/appointmentChatUnreadable] ${d.de} schreibt ihr Feedback in "${I}", geh\xF6rt aber dem Team "${C}" \u2014 die Gastgeberin bzw. der Gastgeber (ein Mitglied von "${C}") kann das eigene Feedback dort wom\xF6glich nicht lesen. 'team:${C}' oder 'all' w\xE4hlen, oder das Team als Mitglied des Chats sicherstellen.`,en:`[workItems/appointmentChatUnreadable] ${d.en} writes its feedback to "${I}", but belongs to the team "${C}" \u2014 the host (a member of "${C}") may not be able to read their own feedback there. Choose 'team:${C}' or 'all', or make sure the team is a member of the chat.`}));for(let $ of t)for(let b of EN($)){let R=b.blocks;R?.templateKey!==a||(typeof R.node=="string"?R.node:$.id)!==e.id||n.push(oi(`nodes.${$.id}.tasks.${String(b.key)}.blocks.templateKey`,{de:`[workItems/appointmentTaskBlocked] Task "${String(b.key)}" (Knoten "${$.id}") h\xE4lt ${d.de} zur\xFCck \u2014 eine Terminaufgabe wartet nur auf ihren Termin (abgeleitet aus 'appointment.of'); ein 'blocks' auf sie entf\xE4llt.`,en:`[workItems/appointmentTaskBlocked] Task "${String(b.key)}" (node "${$.id}") holds back ${d.en} \u2014 an appointment task only waits for its appointment (derived from 'appointment.of'); a 'blocks' on it is dropped.`}))}}for(let[o,a]of i)a<2||n.push(oi(`nodes.${e.id}.tasks.${o}`,{de:`[workItems/appointmentOfTwice] ${a} Terminaufgaben auf Knoten "${e.id}" geh\xF6ren zum Termin von "${o}" \u2014 ein Termin hat eine Terminaufgabe.`,en:`[workItems/appointmentOfTwice] ${a} appointment tasks on node "${e.id}" belong to the appointment of "${o}" \u2014 an appointment has one appointment task.`}));return n}s(RN,"appointmentTaskIssues");var RY="optionalAction:";function IN(e){return`${RY}${e}:trigger`}s(IN,"optionalActionTriggerActionId");var IY="processDecide";function ON(e){let t=e.optionalActions;return t==null?[]:(Array.isArray(t)||F(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof t}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),t)}s(ON,"optionalActionBindings");function _N(e){return ON(e).map(t=>({id:IN(t.key),kind:"internal",label:t.label,surface:IY,placement:"overflow",superUserOnly:!0}))}s(_N,"optionalActionTriggers");function NN(e){let t=new Set;for(let n of ON(e))if(n.action==="spawnTasks")for(let r of n.tasks??[])t.add(r);return t}s(NN,"referencedTaskTemplateKeys");var xn={notOptionalAction:"[workItems/familyRequestNotOptionalAction]",notTask:"[workItems/familyRequestNotTask]",closedOtherwise:"[workItems/familyRequestClosedOtherwise]",blocks:"[workItems/familyRequestBlocks]",noDeadline:"[workItems/familyRequestNoDeadline]",fields:"[workItems/familyRequestFields]",unknownField:"[workItems/familyRequestUnknownField]",shape:"[workItems/familyRequestShape]",twicePerAction:"[workItems/familyRequestTwicePerAction]",deadlock:"[workItems/familyRequestOnlyWayButAsked]"};function Sn(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${t} ${n.de}`,en:`${t} ${n.en}`},severity:"error"}}s(Sn,"issue");function OY(e,t,n){return e.flatMap(r=>(Array.isArray(r.tasks)?r.tasks:[]).filter(i=>{let o=i.blocks,a=typeof o?.node=="string"?o.node:r.id;return o?.templateKey===n&&a===t}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(OY,"blockersOf");function CN(e){let{graph:t,node:n,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${n.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${Oe(t,n.id,"de")}\u201C (${n.id})`,en:`Task "${o}" on node "${Oe(t,n.id,"en")}" (${n.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Sn(`${a}.familyRequest`,xn.shape,{de:`${l.de}: 'familyRequest' muss ein Objekt { fields } oder { from } sein.`,en:`${l.en}: 'familyRequest' must be an object { fields } or { from }.`})];let c=Object.keys(i).filter(k=>k!=="fields"&&k!=="from");c.length>0&&d.push(Sn(`${a}.familyRequest.${c[0]}`,xn.shape,{de:`${l.de}: 'familyRequest' kennt nur 'fields' oder 'from', nicht ${c.map(k=>`'${k}'`).join(", ")} \u2014 was angefordert wird und der Text an die Familie werden beim Ausl\xF6sen gew\xE4hlt.`,en:`${l.en}: 'familyRequest' only knows 'fields' or 'from', not ${c.map(k=>`'${k}'`).join(", ")} \u2014 what is requested and the text to the family are chosen when the action is triggered.`}));let{fields:u,from:p}=i;u===void 0==(p===void 0)&&d.push(Sn(`${a}.familyRequest`,xn.shape,{de:`${l.de}: 'familyRequest' nennt genau eines \u2014 'fields' (die anforderbaren Felder) oder 'from' (das Formular, dessen Dateifelder alle zur Wahl stehen).`,en:`${l.en}: 'familyRequest' names exactly one \u2014 'fields' (the fields that can be requested) or 'from' (the form whose file fields are all available).`})),e.onTrigger.has(o)||d.push(Sn(`${a}.familyRequest`,xn.notOptionalAction,{de:`${l.de} fordert bei der Familie an, geh\xF6rt aber zu keiner optionalen Aktion (spawnTasks) \u2014 nur deren Ausl\xF6sen \xF6ffnet die Anfrage an die Familie.`,en:`${l.en} requests from the family but belongs to no optional action (spawnTasks) \u2014 only triggering one opens the request to the family.`})),r.kind!=="task"&&d.push(Sn(`${a}.kind`,xn.notTask,{de:`${l.de} fordert bei der Familie an und muss die Art 'task' haben, nicht ${JSON.stringify(r.kind)}.`,en:`${l.en} requests from the family and must have the kind 'task', not ${JSON.stringify(r.kind)}.`}));for(let k of["result","when","locksEvidence","gatesNode"])r[k]!==void 0&&d.push(Sn(`${a}.${k}`,xn.closedOtherwise,{de:`${l.de} wartet auf die Familie und erledigt sich mit ihrer Antwort \u2014 '${k}' passt nicht dazu.`,en:`${l.en} waits for the family and completes with their answer \u2014 '${k}' does not fit that.`}));r.blocks!==void 0&&d.push(Sn(`${a}.blocks`,xn.blocks,{de:`${l.de} wartet auf die Familie und darf nichts zur\xFCckhalten ('blocks') \u2014 sie h\xE4lt ihren Knoten schon als Aufgabe einer optionalen Aktion.`,en:`${l.en} waits for the family and must not hold anything back ('blocks') \u2014 as the task of an optional action it already holds its node.`}));for(let k of OY(t.nodes,n.id,o))d.push(Sn(`nodes.${k.nodeId}.tasks.${k.key}.blocks`,xn.blocks,{de:`Task "${k.key}" auf Knoten "${k.nodeId}" h\xE4lt ${l.de} zur\xFCck \u2014 eine Nachforderung darf nie zur\xFCckgehalten werden: zur\xFCckgehalten h\xE4tte sie keine Frist und k\xF6nnte mit der Antwort der Familie nicht erledigt werden.`,en:`Task "${k.key}" on node "${k.nodeId}" holds back ${l.en} \u2014 a follow-up request must never be held back: held back, it would have no deadline and could not be completed by the family's answer.`}));let h=r.params?.dueInDays;if((typeof h!="number"||!Number.isInteger(h)||h<1)&&d.push(Sn(`${a}.params.dueInDays`,xn.noDeadline,{de:`${l.de} fordert bei der Familie an und braucht eine Frist in ganzen Tagen ('params.dueInDays' \u2265 1) \u2014 sie ist die Frist der Familie und Anlass der Erinnerung.`,en:`${l.en} requests from the family and needs a deadline in whole days ('params.dueInDays' \u2265 1) \u2014 it is the family's deadline and the reason for the reminder.`})),u===void 0)return d;if(!Array.isArray(u)||u.length===0)return d.push(Sn(`${a}.familyRequest.fields`,xn.fields,{de:`${l.de}: 'familyRequest.fields' muss mindestens ein Feld eines Formulars nennen \u2014 oder statt dessen 'from' das Formular, dann stehen alle seine Dateifelder zur Wahl.`,en:`${l.en}: 'familyRequest.fields' must name at least one field of a form \u2014 or 'from' the form instead, then all its file fields are available.`})),d;let w=new Set;for(let k of u){if(!xe(k))continue;let y=pe(k);if(w.has(y)){d.push(Sn(`${a}.familyRequest.fields`,xn.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${je(t,k,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${je(t,k,"en")} more than once.`}));continue}w.add(y),ct(k)||d.push(Sn(`${a}.familyRequest.fields`,xn.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${je(t,k,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${je(t,k,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(CN,"familyRequestIssues");function PN(e){let t=new Set((Array.isArray(e.tasks)?e.tasks:[]).flatMap(r=>r.familyRequest!==void 0&&typeof r.key=="string"?[r.key]:[]));return(Array.isArray(e.optionalActions)?e.optionalActions:[]).flatMap((r,i)=>{if(r.action!=="spawnTasks"||!Array.isArray(r.tasks))return[];let o=r.tasks.filter(a=>typeof a=="string"&&t.has(a));return o.length<=1?[]:[Sn(`nodes.${e.id}.optionalActions.${i}.tasks`,xn.twicePerAction,{de:`Optionale Aktion \u201E${String(r.key)}\u201C auf Knoten "${e.id}" startet ${o.length} Nachforderungen (${o.join(", ")}) \u2014 ein Ausl\xF6sen fragt die Familie nach EINER Sache; h\xF6chstens eine Nachforderung je Aktion.`,en:`Optional action "${String(r.key)}" on node "${e.id}" starts ${o.length} follow-up requests (${o.join(", ")}) \u2014 one trigger asks the family for ONE thing; at most one follow-up request per action.`})]})}s(PN,"familyRequestActionIssues");function DN(e,t){let n=e.nodes,r=new Map;for(let a of n)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)ct(l)&&r.set(pe(l),l);if(r.size===0)return[];let i=s(a=>{let l=ni(t,a);return l===void 0||l!==null&&l.kind==="entered"&&l.type==="docRef"},"isFileField"),o=s(a=>{let{fields:l,from:d}=a??{};return Array.isArray(l)?l.filter(ct):!xe(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return n.flatMap(a=>{let l=Array.isArray(a.requiresOneOf)?a.requiresOneOf:[],c=(Array.isArray(a.optionalActions)?a.optionalActions:[]).filter(h=>l.includes(h.key)),u=Array.isArray(a.tasks)?a.tasks:[];return c.filter(h=>Array.isArray(h.tasks)&&c.every(w=>w===h||w.when!==void 0)).flatMap(h=>u.flatMap(w=>{if(w.familyRequest===void 0||!h.tasks.includes(w.key))return[];let k=o(w.familyRequest).filter(y=>r.has(pe(y)));return k.length===0?[]:[{...Sn(`nodes.${a.id}.requiresOneOf`,xn.deadlock,{de:`Auf Knoten \u201E${Oe(e,a.id,"de")}\u201C (${a.id}) ist die Nachforderung \u201E${String(h.key)}\u201C der einzige Weg durch 'requiresOneOf', und eine Vollst\xE4ndigkeitspr\xFCfung fragt dieselben Felder an (${k.map(y=>je(e,y,"de")).join(", ")}). Ist deren Anfrage offen, lassen sich diese Felder nicht nachfordern \u2014 die Entscheidung bliebe gesperrt. Eine zweite Aktion in 'requiresOneOf' oder andere Felder l\xF6sen das.`,en:`On node "${Oe(e,a.id,"en")}" (${a.id}) the follow-up request "${String(h.key)}" is the only way through 'requiresOneOf', and a completeness check asks for the same fields (${k.map(y=>je(e,y,"en")).join(", ")}). While its request is open, these fields cannot be requested \u2014 the decision would stay locked. A second action in 'requiresOneOf' or other fields solve this.`}),severity:"warning"}]}))})}s(DN,"familyRequestDeadlockWarnings");var Aw={key:!0,kind:!0,title:!0,assign:!0,gatesNode:!0,blocks:!0,completableIf:!0,result:!0,when:!0,onConditionReturn:!0,reads:!0,locksEvidence:!0,feedback:!0,description:!0,documents:!0,formView:!0,familyRequest:!0,optional:!0,appointment:!0,params:!0};function _Y(e){let t=Ye(e);return new Map((typeof t.workItemTemplates=="function"?t.workItemTemplates(e):[]).map(n=>[n.key,n]))}s(_Y,"intrinsicTemplatesOf");function FN(e,t,n){if(n!==void 0&&typeof n!="string")return null;let r=n??t,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Ye(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:_Y(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(FN,"resolveBlocksTargetNode");function NY(e){let t=new Map;for(let r of Zn(e.nodes)){let i=t.get(r.source)??[];i.push(r.target),t.set(r.source,i)}let n=new Map;return r=>{let i=n.get(r);if(i!==void 0)return i;let o=new Set,a=[...t.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...t.get(l)??[]))}return n.set(r,o),o}}s(NY,"reachability");function LN(e){let t=[],n=new Map;for(let o of e.nodes){let a=o;for(let l of Array.isArray(a.tasks)?a.tasks:[]){let d=typeof l.key=="string"?l.key:void 0,c=l.blocks;if(d===void 0||typeof c?.templateKey!="string")continue;let u=typeof c.node=="string"?c.node:o.id;n.set(`${o.id}::${d}`,`${u}::${c.templateKey}`)}}let r=new Map,i=s((o,a)=>{if(r.get(o)==="done")return;if(r.get(o)==="visiting"){let d=[...a.slice(a.indexOf(o)),o],[c,u]=o.split("::");t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${c}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksCycle] Zyklus im 'blocks'-Graphen: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 jedes Mitglied w\xFCrde auf ein anderes warten, keines w\xFCrde je frei.`,en:`[workItems/blocksCycle] Cycle in the 'blocks' graph: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 every member would wait for another, none would ever be released.`},severity:"error"});return}r.set(o,"visiting");let l=n.get(o);l!==void 0&&n.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of n.keys())i(o,[]);return t}s(LN,"checkBlocksCycles");function CY(e){let{requiresOneOf:t,optionalActions:n}=e;if(!Array.isArray(t)||!Array.isArray(n))return new Set;let r=new Set(t.filter(o=>typeof o=="string")),i=new Set;for(let o of n)if(!(typeof o.key!="string"||!r.has(o.key)||!Array.isArray(o.tasks)))for(let a of o.tasks)typeof a=="string"&&i.add(a);return i}s(CY,"tasksOfRequiresOneOf");function MN(e){if(typeof e!="object"||e===null)return!1;let{de:t,en:n}=e;return typeof t=="string"&&t.trim().length>0&&typeof n=="string"&&n.trim().length>0}s(MN,"isFilledBilingual");var PY=["blocks","gatesNode","locksEvidence","completableIf"];function DY(e,t){let n={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},r=[];e.feedback!==!0&&r.push(xt(`${t.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${n.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${n.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;(e.kind!=="task"||i?.kind!=="freetext")&&r.push(xt(`${t.base}.feedback`,{de:`[workItems/feedbackNeedsFreetext] ${n.de} ist eine Feedback-Aufgabe und schlie\xDFt daher mit Freitext ('result: { kind: "freetext" }'); erhalten ${e.kind!=="task"?`kind ${String(e.kind)}`:`Ergebnis ${String(i?.kind)}`}.`,en:`[workItems/feedbackNeedsFreetext] ${n.en} is a feedback task, so it closes with free text ('result: { kind: "freetext" }'); got ${e.kind!=="task"?`kind ${String(e.kind)}`:`result ${String(i?.kind)}`}.`}));let o=["blocks","gatesNode","completableIf","locksEvidence","familyRequest","appointment"].filter(a=>e[a]!==void 0);return o.length>0&&r.push(xt(`${t.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${n.de} ist eine Feedback-Aufgabe; die Antwort kommt von einer Seite ohne weitere Daten und darf deshalb nicht von ${o.join(", ")} abh\xE4ngen.`,en:`[workItems/feedbackSteersProcess] ${n.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(DY,"feedbackTaskIssues");function FY(e,t){let n=[],r={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!MN(i.skipLabel))&&n.push(xt(`${t.base}.optional.skipLabel`,{de:`[workItems/optionalSkipLabel] ${r.de} ist optional, braucht daf\xFCr '{ skipLabel: { de, en } }' \u2014 die Worte des Knopfs, mit dem die zust\xE4ndige Person ohne Ergebnis abschlie\xDFt (\u201EKeine Einsch\xE4tzung abgeben"); erhalten ${JSON.stringify(i)}.`,en:`[workItems/optionalSkipLabel] ${r.en} is optional and needs '{ skipLabel: { de, en } }' for that \u2014 the words of the button the responsible person uses to finish without a result ("Give no assessment"); got ${JSON.stringify(i)}.`})),e.kind!=="task"&&n.push(xt(`${t.base}.optional`,{de:`[workItems/optionalOnApproval] ${r.de} ist eine Freigabe \u2014 optional ist nur eine Aufgabe; eine Freigabe schlie\xDFt mit ihrem Urteil.`,en:`[workItems/optionalOnApproval] ${r.en} is an approval \u2014 only a task can be optional; an approval ends with its verdict.`}));let a=e.result;(a===void 0||typeof a.kind!="string"||!CI({kind:a.kind,writes:a.writes}))&&n.push(xt(`${t.base}.optional`,{de:`[workItems/optionalNeedsProseResult] ${r.de} ist optional, schlie\xDFt aber ${a===void 0?"ohne Ergebnis":`mit einem ${String(a.kind)}-Ergebnis${a.writes!==void 0?" mit Wert":""}`} \u2014 optional ist nur eine Aufgabe mit Freitext, Empfehlung oder einer Auswahl ohne 'writes': einen Wert, den ein sp\xE4terer Schritt liest, g\xE4be es dann nie.`,en:`[workItems/optionalNeedsProseResult] ${r.en} is optional but ends ${a===void 0?"without a result":`with a ${String(a.kind)} result${a.writes!==void 0?" with a value":""}`} \u2014 only a task with free text, a recommendation or a choice without 'writes' can be optional: a value a later step reads would then never arrive.`}));let l=PY.filter(d=>e[d]!==void 0);return l.length>0&&n.push(xt(`${t.base}.${l[0]}`,{de:`[workItems/optionalHolds] ${r.de} ist optional und tr\xE4gt ${l.map(d=>`'${d}'`).join(", ")} \u2014 auf eine optionale Aufgabe wartet nichts: sie h\xE4lt keinen Schritt zur\xFCck. Entweder optional oder zur\xFCckhaltend.`,en:`[workItems/optionalHolds] ${r.en} is optional and carries ${l.map(d=>`'${d}'`).join(", ")} \u2014 nothing waits for an optional task: it holds no step back. Either optional or holding back.`})),t.requiredByRule&&n.push(xt(`${t.base}.optional`,{de:`[workItems/optionalInRequiresOneOf] ${r.de} ist optional, geh\xF6rt aber zu einer Aktion, die 'requiresOneOf' verlangt \u2014 \u201EKeine Einsch\xE4tzung abgeben" w\xFCrde die Regel erf\xFCllen, ohne dass etwas geschehen ist.`,en:`[workItems/optionalInRequiresOneOf] ${r.en} is optional but belongs to an action that 'requiresOneOf' requires \u2014 "Give no assessment" would satisfy the rule without anything having happened.`})),n}s(FY,"optionalTaskIssues");function xt(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(xt,"issue");function qN(e,t){let n=[],r=NY(e),i=new Set(ta(e).map(o=>o.key));n.push(...DN(e,t));for(let o of e.nodes){let a=o,l=NN(a);n.push(...PN(a));let d=CY(a);n.push(...RN(a,e.nodes));for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=typeof c.key=="string"?c.key:"?",p=`nodes.${o.id}.tasks.${u}`,h=c.kind,w=c.result,k=c.blocks,y=typeof k?.node=="string"&&k.node!==o.id?k.node:void 0;if(typeof k?.templateKey=="string"){let R=typeof k.node=="string"?k.node:o.id,q=e.nodes.find(Y=>Y.id===R),J=(Array.isArray(q?.tasks)?q.tasks:[]).find(Y=>Y.key===k.templateKey)?.blocks;typeof J?.node=="string"&&J.node!==R&&n.push(xt(`${p}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${u}" auf Knoten "${o.id}" h\xE4lt "${k.templateKey}" auf Knoten "${R}" zur\xFCck \u2014 das ist selbst eine knoten\xFCbergreifende Aufgabe, die ihren Knoten \xFCberlebt; zur\xFCckgehalten k\xF6nnte sie nach dessen Verlassen weder bearbeitet noch freigegeben werden. Nur Aufgaben, die an ihrem Knoten bleiben, und intrinsische Vorlagen sind Ziele.`,en:`[workItems/blocksCrossNodeTask] Task "${u}" on node "${o.id}" holds back "${k.templateKey}" on node "${R}" \u2014 that is itself a cross-node task that outlives its node; held back, it could be neither worked nor released after the node is left. Only tasks that stay on their node and intrinsic templates are targets.`}))}if(y!==void 0){let R=y;e.nodes.some(q=>q.id===R)&&!r(o.id).has(R)&&n.push(xt(`${p}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${u}" auf Knoten "${o.id}" blockiert Knoten "${R}", der von hier aus nicht erreichbar ist \u2014 die Aufgabe entst\xFCnde erst, wenn ihr Ziel schon hinter dem Prozess liegt. Ziel ist derselbe Knoten oder ein sp\xE4terer.`,en:`[workItems/blocksTargetNotAfter] Task "${u}" on node "${o.id}" blocks node "${R}", which cannot be reached from here \u2014 the task would only be created when its target is already behind the process. The target is the same node or a later one.`})),(w===void 0||!_i(w.kind))&&n.push(xt(`${p}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${u}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${R}"), hat aber kein 'result' \u2014 eine knoten\xFCbergreifende Aufgabe \xFCberlebt ihren Knoten und wird \xFCber ihr Ergebnis abgeschlossen (Freitext, Empfehlung oder Auswahl).`,en:`[workItems/crossNodeBlocksNeedsResult] Task "${u}" on node "${o.id}" blocks another node ("${R}") but has no 'result' \u2014 a cross-node task outlives its node and is completed through its result (free text, recommendation or choice).`})),l.has(u)&&n.push(xt(`${p}.blocks.node`,{de:`[optionalAction/crossNodeBlocks] Task "${u}" geh\xF6rt zu einer optionalen Aktion (spawnTasks) auf Knoten "${o.id}" und darf keinen anderen Knoten blockieren \u2014 ihre Zeilen sind die Runde der Aktion.`,en:`[optionalAction/crossNodeBlocks] Task "${u}" belongs to an optional action (spawnTasks) on node "${o.id}" and must not block another node \u2014 its rows are the round of the action.`}))}for(let R of AN(String(h),w,{channelKeys:i,...t?.billingItemKeys!==void 0?{billingItemKeys:t.billingItemKeys}:{},...t?.offerProgram!==void 0?{offerProgram:t.offerProgram}:{}}))n.push(xt(`${p}.${R.field}`,{de:`${R.code} ${R.message.de} (Task "${u}" auf Knoten "${o.id}").`,en:`${R.code} ${R.message.en} (task "${u}" on node "${o.id}").`}));let v=c.when,A=s((R,q,_)=>{!xe(q)||ct(q)||n.push(xt(R,{de:`[workItems/evidenceNotFormField] ${_} auf Task "${u}" (Knoten "${o.id}") nennt ${je(e,q,"de")} \u2014 Bedingung und Belege einer Aufgabe sind Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[workItems/evidenceNotFormField] ${_} on task "${u}" (node "${o.id}") names ${je(e,q,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");v!==void 0?(A(`${p}.when`,v,"'when'"),c.onConditionReturn!=="respawn"&&c.onConditionReturn!=="stayClosed"&&n.push(xt(`${p}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] Task "${u}" (Knoten "${o.id}") hat eine Bedingung, aber kein 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 was bei der R\xFCckkehr der Bedingung geschieht, muss entschieden sein.`,en:`[workItems/whenNeedsOnConditionReturn] Task "${u}" (node "${o.id}") has a condition but no 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 what happens when the condition returns must be decided.`}))):c.onConditionReturn!==void 0&&n.push(xt(`${p}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' ohne 'when' auf Task "${u}" (Knoten "${o.id}") \u2014 ohne Bedingung kehrt nichts zur\xFCck.`,en:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' without 'when' on task "${u}" (node "${o.id}") \u2014 without a condition nothing returns.`}));let E=c.reads;if(E!==void 0)if(!Array.isArray(E))n.push(xt(`${p}.reads`,{de:`[workItems/readsUnknownField] 'reads' auf Task "${u}" (Knoten "${o.id}") muss eine Liste von Feldadressen sein.`,en:`[workItems/readsUnknownField] 'reads' on task "${u}" (node "${o.id}") must be a list of field addresses.`}));else for(let[R,q]of E.entries())A(`${p}.reads.${R}`,q,"'reads'");let I=c.locksEvidence,C=s((R,q)=>n.push(xt(`${p}.locksEvidence`,{de:`[workItems/${R}] Task "${u}" (Knoten "${o.id}") ${q.de}`,en:`[workItems/${R}] Task "${u}" (node "${o.id}") ${q.en}`})),"lockIssue");I!==void 0&&I!==!0&&C("locksEvidenceNotTrue",{de:`tr\xE4gt 'locksEvidence' ${JSON.stringify(I)} \u2014 nur 'true' ist erlaubt; ohne Sperre entf\xE4llt das Feld.`,en:`carries 'locksEvidence' ${JSON.stringify(I)} \u2014 only 'true' is allowed; without a lock the field is dropped.`}),I===!0&&(E===void 0&&v===void 0&&C("locksEvidenceWithoutEvidence",{de:"sperrt seine Belege, hat aber weder 'reads' noch 'when' \u2014 es gibt nichts, worauf die Entscheidung beruht.",en:"locks its evidence but has neither 'reads' nor 'when' \u2014 there is nothing the decision rests on."}),(w===void 0||!_i(w.kind))&&C("locksEvidenceNeedsRecordedResult",{de:"sperrt seine Belege, schlie\xDFt aber nicht mit einem erfassten Ergebnis (Freitext, Empfehlung, Auswahl) \u2014 nur eine Entscheidung, die das Team wieder\xF6ffnen kann, darf Belege sperren (ein Termin bleibt gebucht).",en:"locks its evidence but does not end with a recorded result (free text, recommendation, choice) \u2014 only a decision the team can reopen may lock evidence (an appointment stays booked)."}),l.has(u)&&C("locksEvidenceOnOptionalAction",{de:"geh\xF6rt zu einer optionalen Aktion (spawnTasks) \u2014 ihre Zeilen sind die Runde der Aktion, wieder\xF6ffnen l\xE4sst sie sich nicht; Belege sperrt nur eine Knotenaufgabe.",en:"belongs to an optional action (spawnTasks) \u2014 its rows are the round of the action and cannot be reopened; only a node task locks evidence."})),n.push(...CN({graph:e,node:a,task:c,onTrigger:l,specCtx:t}));let $=Object.keys(c).filter(R=>!Object.hasOwn(Aw,R));$.length>0&&n.push(xt(`${p}.${$[0]}`,{de:`[workItems/unknownKey] Task "${u}" (Knoten "${o.id}") tr\xE4gt ${$.map(R=>`'${R}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(Aw).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${u}" (node "${o.id}") carries ${$.map(R=>`'${R}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(Aw).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let b=c.description;b!==void 0&&!MN(b)&&n.push(xt(`${p}.description`,{de:`[workItems/descriptionInvalid] 'description' auf Task "${u}" (Knoten "${o.id}") braucht Text in beiden Sprachen ({ de, en }), erhalten ${JSON.stringify(b)}.`,en:`[workItems/descriptionInvalid] 'description' on task "${u}" (node "${o.id}") needs text in both languages ({ de, en }), got ${JSON.stringify(b)}.`})),c.feedback!==void 0&&n.push(...DY(c,{key:u,nodeId:o.id,base:p})),c.optional!==void 0&&n.push(...FY(c,{key:u,nodeId:o.id,base:p,requiredByRule:d.has(u)}))}}return n}s(qN,"checkNodeTasks");function KN(e){let t=e.indexOf(":"),n=t===-1?"":e.slice(0,t),r=t===-1?"":e.slice(t+1).trim();if(n==="artifact"&&r.length>0)return{kind:n,key:r};let i=mo(r);return(n==="field"||n==="document")&&i!==null?{kind:n,address:i}:ae("INVALID",{de:`Dokument-Verweis "${e}" ist ung\xFCltig \u2014 erwartet artifact:<Slot-Schl\xFCssel>, field:$node.<Formular>.admission.<Feld> oder document:$node.<Knoten>.document.`,en:`Document reference "${e}" is invalid \u2014 expected artifact:<slot key>, field:$node.<form>.admission.<field> or document:$node.<node>.document.`})}s(KN,"parseTaskDocumentRef");function Ew(e){return e.kind==="artifact"?`artifact:${e.key}`:`${e.kind}:${pe(e.address)}`}s(Ew,"taskDocumentId");function si(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(si,"issue");function jN(e){return Array.isArray(e.tasks)?e.tasks:[]}s(jN,"tasksOf");function LY(e){let t=new Map;for(let n of e){let{id:r,artifacts:i}=n;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&t.set(o.key,[...t.get(o.key)??[],{nodeId:r,slot:o}])}return t}s(LY,"artifactSlotDeclarations");function MY(e){return e.flatMap(t=>{let{id:n,artifacts:r}=t;return(Array.isArray(r)?r:[]).filter(i=>!Ff(i?.type)).map(i=>({nodeId:String(n),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(MY,"unknownArtifactSlotTypes");function VN(e){let t=[];for(let{nodeId:n,slotKey:r,type:i}of MY(e.nodes))t.push(si(`nodes.${n}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${n}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${Gs.join(", ")}.`,en:`[artifact/unknownType] Node "${n}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${Gs.join(", ")}.`}));for(let[n,r]of LY(e.nodes))for(let i of r.slice(1))t.push(si(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${n}", den schon "${r[0].nodeId}" deklariert \u2014 jeder Slot-Schl\xFCssel geh\xF6rt genau einem Knoten.`,en:`[governedDocument/slotKeyTaken] Node "${i.nodeId}" declares the document slot "${n}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return t}s(VN,"checkArtifactSlotKeys");function BN(e){if(!Array.isArray(e)||e.length===0)return null;let t=[];for(let n of e){let r=typeof n=="object"&&n!==null?n:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)t.push({kind:"artifact",key:r.key});else if((r.kind==="field"||r.kind==="document")&&i==="address,kind")t.push({kind:r.kind,address:r.address});else return null}return t}s(BN,"authoredRefs");function qY(e){return e.scope==="node"&&(e.key===kl||e.key===_s||e.key===Ns)&&e.path===void 0}s(qY,"isDocumentAddress");function UN(e){let t=[];for(let n of e.nodes)for(let r of jN(n)){if(r.documents===void 0)continue;let i=typeof r.key=="string"?r.key:"?",o=`nodes.${n.id}.tasks.${i}.documents`,a={de:`Task "${i}" (Knoten "${n.id}")`,en:`Task "${i}" (node "${n.id}")`},l=BN(r.documents);if(l===null){t.push(si(o,{de:`[workItems/documentsInvalid] 'documents' auf ${a.de} muss eine nicht leere Liste von { kind: 'artifact', key } (eigener Slot), { kind: 'field', address } (Dateifeld eines Formulars) oder { kind: 'document', address } (Dokument eines anderen Knotens) sein, erhalten ${JSON.stringify(r.documents)}.`,en:`[workItems/documentsInvalid] 'documents' on ${a.en} must be a non-empty list of { kind: 'artifact', key } (own slot), { kind: 'field', address } (file field of a form) or { kind: 'document', address } (document of another node), got ${JSON.stringify(r.documents)}.`}));continue}let d=new Set;for(let c of l){if(c.kind!=="artifact"&&!xe(c.address))continue;let u=c.kind==="artifact"?Ew(c):Ew({kind:c.kind,address:c.address});d.has(u)&&t.push(si(o,{de:`[workItems/documentsDuplicate] ${a.de} verweist zweimal auf ${u}.`,en:`[workItems/documentsDuplicate] ${a.en} refers to ${u} twice.`})),d.add(u),c.kind==="artifact"&&!nO(n,c.key)&&t.push(si(o,{de:`[workItems/documentsUnknownArtifact] ${a.de} verweist auf das Dokument "${c.key}", aber der Knoten deklariert keinen solchen Slot \u2014 das Dokument eines anderen Knotens ist { kind: 'document', address: $node.<knoten>.document }.`,en:`[workItems/documentsUnknownArtifact] ${a.en} refers to the document "${c.key}", but the node declares no such slot \u2014 the document of another node is { kind: 'document', address: $node.<node>.document }.`})),c.kind==="field"&&!ct(c.address)&&t.push(si(o,{de:`[workItems/documentsInvalid] ${a.de}: ein Feld-Dokument nennt ein Feld eines Formulars ($node.<formular>.admission.<feld>), nicht ${je(e,c.address,"de")}.`,en:`[workItems/documentsInvalid] ${a.en}: a field document names a field of a form ($node.<form>.admission.<field>), not ${je(e,c.address,"en")}.`})),c.kind==="document"&&!qY(c.address)&&t.push(si(o,{de:`[workItems/documentsInvalid] ${a.de}: ein Dokument eines anderen Knotens ist dessen ganzes Dokument ($node.<knoten>.document), nicht ${pe(c.address)}.`,en:`[workItems/documentsInvalid] ${a.en}: a document of another node is that node's whole document ($node.<node>.document), not ${pe(c.address)}.`}))}}return t}s(UN,"checkTaskDocuments");function GN(e,t){let n=[];for(let r of e.nodes)for(let i of jN(r)){let o=BN(i.documents);if(o===null)continue;let a=typeof i.key=="string"?i.key:"?",l=`nodes.${r.id}.tasks.${a}.documents`;for(let d of o){if(d.kind!=="field"||!ct(d.address))continue;let c=ni(t,d.address);if(c==null)continue;let u={de:je(e,d.address,"de"),en:je(e,d.address,"en")},p=Ks("taskDocument",qs(c));if(p==="repeated"){n.push(si(l,{de:`[workItems/documentsUnknownField] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Dokument der Anmeldung.`,en:`[workItems/documentsUnknownField] Task "${a}" (node "${r.id}") refers to the field ${u.en} \u2014 a field in a repeated group is not a single document of the application.`}));continue}p==="notDocument"&&n.push(si(l,{de:`[workItems/documentsNotDocument] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de}, das keine Datei enth\xE4lt \u2014 nur Datei-Felder (docRef) sind Dokumente.`,en:`[workItems/documentsNotDocument] Task "${a}" (node "${r.id}") refers to the field ${u.en}, which holds no file \u2014 only file fields (docRef) are documents.`}))}}return n}s(GN,"checkTaskDocumentFields");var Tw=["form","documents"],KY=/^[a-z][a-zA-Z0-9_-]*$/;function jY(e){let t=new Map,n=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])t.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){t.set(i.key,"other");for(let o of i.itemTemplate)t.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(n)},"visit");return e.sections.forEach(n),t}s(jY,"fieldPlaces");function zN(e,t,n){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!KY.test(o)){r.push({severity:"error",path:`${n(a)}.key`,code:"view.invalid-key",message:{de:`${t.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${t.en}: '${String(o)}' is no valid key (a lower-case letter first, then letters, digits, - or _).`}});return}i.has(o)&&r.push({severity:"error",path:`${n(a)}.key`,code:"view.duplicate-key",message:{de:`${t.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${t.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(zN,"keyIssues");function VY(e,t,n){return e==="document"?null:e===void 0?{severity:"error",path:n,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${t}'.`,en:`View: the form has no field '${t}'.`}}:e==="row"?{severity:"error",path:n,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${t}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${t}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:n,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${t}' enth\xE4lt keine Datei.`,en:`View: the field '${t}' holds no file.`}}}s(VY,"fieldIssue");function BY(e,t,n){let r=[];Tw.includes(e.key)&&r.push({severity:"error",path:`${t}.key`,code:"view.reserved-key",message:{de:`Der Ansichtsschl\xFCssel '${e.key}' ist f\xFCr die Standardansicht reserviert.`,en:`The view key '${e.key}' is reserved for the standard view.`}});let i=e.groups;i.length===0&&r.push({severity:"error",path:`${t}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(...zN(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${t}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${t}.groups[${l}]`,c=a.fields;c.length===0&&r.push({severity:"error",path:`${d}.fields`,code:"view.empty",message:{de:`Gruppe '${a.key}' der Ansicht '${e.key}' hat keine Felder.`,en:`Group '${a.key}' of view '${e.key}' has no fields.`}}),c.forEach((u,p)=>{let h=`${d}.fields[${p}]`,w=VY(n.get(u),u,h);w!==null&&r.push(w),o.has(u)&&r.push({severity:"error",path:h,code:"view.field-twice",message:{de:`Ansicht '${e.key}': Das Feld '${u}' steht mehrfach; eine Datei hat einen Platz.`,en:`View '${e.key}': the field '${u}' is listed more than once; a file has one place.`}}),o.add(u)})}),r}s(BY,"viewIssues");function UY(e){if(!Array.isArray(e))return"views";for(let[t,n]of e.entries()){let r=n?.groups;if(!Array.isArray(r))return`views[${t}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${t}].groups[${i}].fields`}}return null}s(UY,"malformedAt");function WN(e){let t=e.views;if(t===void 0)return[];let n=UY(t);if(n!==null)return[{severity:"error",path:n,code:"view.malformed",message:{de:`${n} hat nicht die Form einer Ansicht: views ist eine Liste von { key, label, groups }, groups eine Liste von { key, label, fields }, fields eine Liste von Feldschl\xFCsseln.`,en:`${n} is not shaped like a view: views is a list of { key, label, groups }, groups a list of { key, label, fields }, fields a list of field keys.`}}];let r=jY(e);return[...zN(t.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...t.flatMap((i,o)=>BY(i,`views[${o}]`,r))]}s(WN,"formViewIssues");function rp(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(rp,"issue");function YN(e,t,n,r){let i=e;if(i===null||typeof i!="object"||typeof i.form!="string"||typeof i.key!="string")return[rp(t,{de:`[workItems/formViewInvalid] 'formView' auf ${n.de} muss { form: <Formularknoten>, key: <Ansicht> } sein.`,en:`[workItems/formViewInvalid] 'formView' on ${n.en} must be { form: <form node>, key: <view> }.`})];let o=r?.formViewKeysByFormNode;if(o===void 0)return[];let a=o.get(i.form);return a===void 0?[rp(t,{de:`[workItems/formViewUnknownForm] ${n.de} nennt das Formular "${i.form}", aber kein Formularknoten hei\xDFt so.`,en:`[workItems/formViewUnknownForm] ${n.en} names the form "${i.form}", but no form node has that id.`})]:a.has(i.key)||Tw.includes(i.key)?[]:[rp(t,{de:`[workItems/formViewUnknown] ${n.de} nennt die Ansicht "${i.key}", aber das Formular "${i.form}" hat keine solche Ansicht.`,en:`[workItems/formViewUnknown] ${n.en} names the view "${i.key}", but the form "${i.form}" has no such view.`})]}s(YN,"viewIssues");function HN(e,t){let n=[];for(let r of e.nodes){if(r.formView!==void 0){let i={de:`Knoten "${r.id}"`,en:`node "${r.id}"`};r.type!=="decision"?n.push(rp(`nodes.${r.id}.formView`,{de:`[workItems/formViewInvalid] ${i.de}: 'formView' am Knoten gilt nur f\xFCr eine Entscheidung; eine Aufgabe tr\xE4gt ihre eigene.`,en:`[workItems/formViewInvalid] ${i.en}: 'formView' on a node applies to a decision only; a task carries its own.`})):n.push(...YN(r.formView,`nodes.${r.id}.formView`,i,t))}for(let i of Array.isArray(r.tasks)?r.tasks:[]){if(i.formView===void 0)continue;let o=String(i.key);n.push(...YN(i.formView,`nodes.${r.id}.tasks.${o}.formView`,{de:`Task "${o}" (Knoten "${r.id}")`,en:`Task "${o}" (node "${r.id}")`},t))}}return n}s(HN,"checkTaskFormViews");var Pn="traeger",JN={de:"Tr\xE4ger",en:"Provider"};function ra(e){let t=e.inputs?.[Pn];return t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0?t.value:null}s(ra,"traegerKeyOfNode");var ip={name:"input.traeger.name",address:"input.traeger.anschrift"},Ihe=Object.values(ip);var QN="governedDocument",Io="prepareDocument",ql="prepareDocument:revision",Fr="releaseApproval",Oo="documentResponse",ia="coverLetterResponse",op="confirmCoverLetter",sp="requestCoverLetterRevision",oa="coverLetterConfirmation",Lr="responseCheck",ap="returnSigned";var ZN="requestApproval";var XN="issueDocument",eC="correctInPlace",tC="rescindAndReissue",lp="requestChange";var sa="releaseArtifact",cn="signingRecovery",dp="resendESignature",_o="switchToPaper";var $w=new Set([Io,ql]),nC=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],cp=["upload","resolver","template","none"],No=1,Co=366,ai="responseDueInDays";function Po(e){let t=e.inputs?.[oa];return t?.kind==="literal"&&t.value===!0}s(Po,"coverLetterConfirmationOf");function Kl(e){let t=e.inputs?.[ai];return t?.kind==="literal"&&jl(t.value)?t.value:void 0}s(Kl,"responseDueInDaysForVocabulary");function jl(e){return typeof e=="number"&&Number.isInteger(e)&&e>=No&&e<=Co}s(jl,"isValidResponseDueInDays");var up=["generatedAt","responseDueInDays","countersignature"],Do=["release","none"],fp=["confirm","signedUpload","signedUploadChecked","eSignature"];var GY={kind:"confirm",acceptOutcomeId:"accepted",declineOutcomeId:"declined",outcomeSemantics:{accept:"granted",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!1,declineIsAnswer:!0,acceptStatus:"accepted",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Annehmen",en:"Accept"},decline:{de:"Ablehnen",en:"Decline"}}},rC={kind:"signedUpload",acceptOutcomeId:"signed",declineOutcomeId:"absage",outcomeSemantics:{accept:"other",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!0,declineIsAnswer:!1,acceptStatus:"signed",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Unterschrieben zur\xFCcksenden",en:"Return signed"},decline:{de:"Ablehnen",en:"Decline"}}},iC={...rC,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},zY={...iC,kind:"eSignature",issuesBy:"provider"},li={confirm:GY,signedUpload:rC,signedUploadChecked:iC,eSignature:zY};function di(e){let t=e.responseStrategy;if(typeof t=="string"&&t in li)return li[t];F(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(t)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(di,"responseStrategyOf");function pp(e){if(e.type!==QN||e.production!=="resolver")return!1;let t=e.responseStrategy;return typeof t=="string"&&t in li?li[t].acceptEvent==="contractEvent":!1}s(pp,"isFamilySignedContractNode");function la(e){return e.label}s(la,"governedDocTitle");function Rw(e){return e.approval==="release"?ZN:XN}s(Rw,"submitActionId");function oC(e,t,n){return{key:t,recipient:"internal",title:n,unlocks:[Rw(e)],gatesNode:!0,advancesNode:!0}}s(oC,"producerTemplate");function WY(e){return e.titles?.respond??e.label}s(WY,"responseTitle");var aa={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Iw(e){let t=di(e),n=[];if(e.production!=="none"&&n.push(oC(e,Io,e.titles?.prepare??aa),oC(e,ql,e.titles?.revise??aa)),e.approval==="release"&&n.push({key:Fr,recipient:"internal",title:e.titles?.approve??aa,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),n.push({key:Oo,recipient:"external",title:WY(e),unlocks:t.producesResponseArtifact?[t.checksReturn?ap:t.acceptOutcomeId,t.declineOutcomeId,lp]:[t.acceptOutcomeId,t.declineOutcomeId],advancesNode:!0,...Kl(e)!==void 0?{dueInDays:Kl(e)}:{}}),Po(e)){let r=la(e);n.push({key:ia,recipient:"external",title:{de:`${r.de}: Schreiben best\xE4tigen`,en:`${r.en}: confirm the letter`},unlocks:[op,sp,t.declineOutcomeId],advancesNode:!0,...Kl(e)!==void 0?{dueInDays:Kl(e)}:{}})}if(t.checksReturn&&n.push({key:Lr,recipient:"internal",title:e.titles?.check??aa,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),t.issuesBy==="provider"){let r=la(e);n.push({key:cn,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[dp,_o],gatesNode:!1,advancesNode:!1})}return n}s(Iw,"governedDocIntrinsicTemplates");function YY(e){e.production==="none"&&F(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let t=e.artifacts??[];t.length!==1&&F(`governedDocSlot: node "${e.id}" declares ${t.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let n=t[0];return(typeof n.key!="string"||n.key.length===0)&&F(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),n}s(YY,"governedDocSlot");function mp(e){return YY(e).key}s(mp,"governedDocSlotKey");var Xn="processFooter";var hp="countersign",Ow="countersign",sC="countersigned",aC="countersigning",lC="countersigned";var dC={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},Vl=["scan","eSignature"],gp="service_provider:1",cC=["countersigning","awaitingSignature","signatureStalled","done"],uC={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function fC(e){return{de:`[countersign/traegerSignatoryMissing] Die Schule zeichnet elektronisch gegen, aber f\xFCr ${e} ist keine Unterschriftsperson hinterlegt, die unterschreiben kann (Rechtstr\xE4ger \u2192 signatoryUserKey, aktives Personal der Schule).`,en:`[countersign/traegerSignatoryMissing] The school countersigns electronically, but no signatory who can sign is on file for ${e} (legal entity \u2192 signatoryUserKey, active staff of the school).`}}s(fC,"traegerSignatoryMissingReason");function er(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${t}`,reason:n,severity:"error"}}s(er,"issue");function yp(e,t){return e.nodes.filter(n=>{let r=n.contract;return n.type==="countersign"&&xe(r)&&r.scope==="node"&&r.owner===t})}s(yp,"countersignersOf");function Bl(e){return e.signing==="eSignature"}s(Bl,"isElectronic");function HY(e,t){if(t===void 0||t.sendable||!Bl(e))return[];let n=e.label?.de??e.id,r=e.label?.en||e.id;return[er(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${n}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${t.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${t.reason.en}`})]}s(HY,"countersignProviderIssues");function JY(e,t,n){if(n.scope!=="node")return[];let r=e.nodes.find(o=>o.id===n.owner);if(r===void 0)return[];let i=[];return pp(r)||i.push("sourceNotCheckedContract"),yp(e,r.id).some(o=>o.id!==t)&&i.push("twice"),i}s(JY,"countersignContractRefusals");function pC(e){let t=e.inputs?.dueInDays;return t?.kind==="literal"&&typeof t.value=="number"&&Number.isInteger(t.value)&&t.value>=1?t.value:void 0}s(pC,"validDueInDays");function QY(e,t,n){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!Vl.includes(o))return[er(e,"signing",{de:`[countersign/unknownSigning] \u201E${r}\u201C: signing ist scan oder eSignature (gefunden: ${JSON.stringify(o)}).`,en:`[countersign/unknownSigning] "${i}": signing is scan or eSignature (found: ${JSON.stringify(o)}).`})];let a=e.assign?.[cn];if(!Bl(e))return a===void 0?[]:[er(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet auf Papier gegen \u2014 \`assign.signingRecovery\` h\xE4lt keine Aufgabe und geh\xF6rt entfernt.`,en:`[countersign/recoveryAssign] "${i}" countersigns on paper \u2014 \`assign.signingRecovery\` holds no task and must be removed.`})];let l=[];return(typeof a!="string"||a.length===0)&&l.push(er(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet elektronisch gegen \u2014 wer eine gescheiterte Gegenzeichnung kl\xE4rt, fehlt: \`assign.signingRecovery\` nennt das Team.`,en:`[countersign/recoveryAssign] "${i}" countersigns electronically \u2014 who resolves a failed countersignature is missing: \`assign.signingRecovery\` names the team.`})),l.push(...ZY(e,t,n),...XY(e,t,n),...HY(e,n?.signingProvider)),l}s(QY,"signingIssues");function hC(e,t){let n=e.contract;if(!(!xe(n)||n.scope!=="node"))return t.nodes.find(r=>r.id===n.owner)}s(hC,"contractNodeOf");function ZY(e,t,n){let r=hC(e,t),i=r===void 0?null:ra(r),o=i===null?void 0:n?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[er(e,"signing",fC(o.name))]}s(ZY,"traegerSignatoryIssues");function XY(e,t,n){let r=hC(e,t);if(r===void 0)return[];let i=n?.resolverDocumentAnchors?.get(r.id);if(i===void 0)return[];let o=e.label?.de??e.id,a=e.label?.en||e.id,l=[];for(let d of i)d.documentAnchors===null?l.push(er(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage des Generators \u201E${d.pin}\u201C wurde nie auf Unterschriftsanker gelesen \u2014 Vorlage neu hochladen und den Generator neu versiegeln.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of generator "${d.pin}" was never read for signature anchors \u2014 upload the template again and seal the generator again.`})):d.documentAnchors.has(gp)||l.push(er(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${gp}/ \u2014 der Anbieter f\xE4nde f\xFCr die Schule kein Unterschriftsfeld.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of "${d.pin}" carries no anchor /unterschrift:${gp}/ \u2014 the provider would find no signature field for the school.`}));return l}s(XY,"traegerAnchorIssues");var _w=100;async function eH(e,t){let n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",t.node.id)).take(_w+1);n.length>_w&&F(`countersign node "${t.node.id}" of ${t.applicationId} holds more than ${_w} rows`);let r=n.filter(o=>o.isOpen),i=s(o=>{if(o.context.kind!=="admission")return;let a=o.context.anchor;return"templateKey"in a?a.templateKey:void 0},"templateKeyOf");return r.some(o=>i(o)===cn)?"signatureStalled":r.some(o=>i(o)===hp)?"countersigning":Bl(t.node)?"awaitingSignature":"done"}s(eH,"countersignCurrentState");var mC={[aC]:{label:ne("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:ne("Gegenzeichnung","Countersignature"),scope:"node"},external:Ze(ne("Vertrag unterschrieben","Contract signed"),"blue",ne("Die Schule zeichnet Ihren Vertrag gegen","The school is countersigning your contract"),ne("Vielen Dank f\xFCr Ihre Unterschrift. Sobald die Schule gegengezeichnet hat, finden Sie Ihr Exemplar hier.","Thank you for signing. As soon as the school has countersigned, you will find your copy here."))}},gC={inputs:s(()=>[{id:"dueInDays",label:{de:"Frist der Aufgabe (Tage)",en:"Task due in (days)"},type:"number",inspector:"literal-only"}],"inputs"),role:"user-action",effect:"side-effect",outcomes:[{id:sC,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:mC,progressEvents:Ft(mC),notificationEvents:s(()=>[{id:lC,label:{de:"Vertrag gegengezeichnet",en:"Contract countersigned"},audience:"external",required:!0,args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0}]}],"notificationEvents"),actions:s(e=>[{id:Ow,kind:"internal",label:dC,surface:Xn,availableIn:["countersigning"]},...Bl(e)?[{id:_o,kind:"internal",surface:Xn,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:hp,recipient:"internal",title:e.titles?.countersign??aa,unlocks:[Ow],advancesNode:!0,...pC(e)!==void 0?{dueInDays:pC(e)}:{}},...Bl(e)?[{key:cn,recipient:"internal",title:uC,unlocks:[_o],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),states:cC,currentState:eH,validate:s((e,t,n)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id,a=e.assign?.[hp];(typeof a!="string"||a.length===0)&&r.push(er(e,"assign",{de:`[countersign/assign] \u201E${i}": wer gegenzeichnet, fehlt \u2014 \`assign.countersign\` nennt das Team.`,en:`[countersign/assign] "${o}": who countersigns is missing \u2014 \`assign.countersign\` names the team.`})),Ti(e.titles?.countersign)||r.push(er(e,"titles",{de:`[countersign/missingTitle] \u201E${i}": der Titel der Aufgabe fehlt \u2014 \`titles.countersign\` auf Deutsch und Englisch.`,en:`[countersign/missingTitle] "${o}": the task title is missing \u2014 \`titles.countersign\` in German and English.`}));let l=e.inputs?.dueInDays;l!==void 0&&l.kind!=="unset"&&!(l.kind==="literal"&&typeof l.value=="number"&&Number.isInteger(l.value)&&l.value>=1)&&r.push(er(e,"inputs.dueInDays",{de:`[countersign/dueInDays] \u201E${i}": dueInDays ist eine ganze Zahl \u2265 1.`,en:`[countersign/dueInDays] "${o}": dueInDays is a whole number \u2265 1.`})),r.push(...QY(e,t,n));let d=e.contract;if(!xe(d))return r;let c=JY(t,e.id,d);if(c.length===0)return r;let u=t.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(er(e,"contract",{de:`[countersign/sourceNotCheckedContract] \u201E${i}" zeichnet das Dokument von \u201E${u.label?.de??u.id}" (${u.id}) gegen \u2014 gegenzeichnen l\xE4sst sich nur ein erzeugter Vertrag, den die Familie mit verbuchten Unterschriften unterschreibt (governedDocument mit production: resolver und responseStrategy: signedUploadChecked oder eSignature).`,en:`[countersign/sourceNotCheckedContract] "${o}" countersigns the document of "${u.label?.en||u.id}" (${u.id}) \u2014 only a generated contract that the family signs with booked signatures can be countersigned (governedDocument with production: resolver and responseStrategy: signedUploadChecked or eSignature).`})),c.includes("twice")){let p=yp(t,u.id).filter(h=>h.id!==e.id);r.push(er(e,"contract",{de:`[countersign/twice] \u201E${i}": \u201E${u.label?.de??u.id}" (${u.id}) wird schon von ${p.map(h=>`"${h.id}"`).join(", ")} gegengezeichnet \u2014 ein Vertrag hat eine Gegenzeichnung.`,en:`[countersign/twice] "${o}": "${u.label?.en||u.id}" (${u.id}) is already countersigned by ${p.map(h=>`"${h.id}"`).join(", ")} \u2014 a contract has one countersignature.`}))}return r},"validate")};function tH(e){return pp(e)?ra(e):null}s(tH,"traegerSignerOf");var nH=s(e=>e.type==="end"&&To(e)==="approved","isApprovedEnd");function yC(e){let t=[];for(let n of e.nodes){let r=tH(n);if(r===null)continue;let i=yp(e,n.id).map(u=>u.id),o=DO(e,n.id,new Set(i),nH);if(o===null)continue;let a=n.label?.de||n.id,l=n.label?.en||n.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${n.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${n.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${n.id}) erzeugt einen Vertrag, den der Tr\xE4ger \u201E${r}\u201C mitunterschreibt, aber keine Gegenzeichnung nennt ihn \u2014 der Vertrag w\xFCrde nie unterschrieben und nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${n.id}) generates a contract the legal entity "${r}" co-signs, but no countersignature names it \u2014 the contract would never be signed and never billed. ${d.en}`}:{de:`[countersign/missingForContract] \u201E${a}\u201C (${n.id}): ein Weg erreicht das Ende \u201E${o}\u201C (Ergebnis approved), ohne durch die Gegenzeichnung ${i.map(u=>`\u201E${u}\u201C`).join(", ")} zu laufen \u2014 dort bliebe der Vertrag ohne Unterschrift des Tr\xE4gers \u201E${r}\u201C und w\xFCrde nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${n.id}): a path reaches the end "${o}" (outcome approved) without passing the countersignature ${i.map(u=>`"${u}"`).join(", ")} \u2014 there the contract would lack the signature of the legal entity "${r}" and never be billed. ${d.en}`};t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}`,reason:c,severity:"error"})}return t}s(yC,"checkCountersignCoverage");function rH(e){let t="error",n=new Map;for(let a of Zn(e.nodes)){let l=n.get(a.source)??[];l.push({id:a.id,target:a.target}),n.set(a.source,l)}let r=[],i=new Set,o=Jf(e.nodes.map(a=>a.id),a=>(n.get(a)??[]).map(({id:l,target:d})=>({target:d,edge:l})));for(let a of o)i.has(a.edge)||(i.add(a.edge),r.push({layer:"GRAPH",kind:"cycle",path:`edge.${a.edge}`,reason:{de:`Zyklus \xFCber Kante ${a.source} \u2192 ${a.target}`,en:`Cycle through edge ${a.source} \u2192 ${a.target}`},severity:t}));return r}s(rH,"checkAcyclic");function iH(e){let t=[],n=new Set(e.nodes.map(i=>i.id)),r="error";for(let i of e.nodes){let o=i.next;if(o)for(let[a,l]of Object.entries(o))n.has(l.to)||t.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.next.${a}`,reason:{de:`${i.label.de}: next.${a} verweist auf nicht-existenten Knoten '${l.to}'`,en:`${i.label.en}: next.${a} points to a node that does not exist: '${l.to}'`},severity:"error"});if(i.type!=="end"&&!(!i.outcomes||i.outcomes.length===0))for(let a of i.outcomes)(!o||!(a.id in o))&&t.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.outcome.${a.id}`,reason:{de:`${i.label.de}: Outcome '${a.label.de}' fehlt im next-Mapping`,en:`${i.label.en}: outcome '${a.label.en}' is missing from the next mapping`},severity:r})}return t}s(iH,"checkNextTargets");function oH(e){let t=[];for(let n of e.nodes){let r=n.next;if(!r)continue;let i=zy(n),o=new Set(i?i.map(a=>a.id):[zs]);for(let a of Object.keys(r))o.has(a)||t.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${n.id}.next.${a}`,reason:{de:`${n.label.de}: next-Schl\xFCssel '${a}' ist kein g\xFCltiges Outcome dieses Knotens (erlaubt: ${[...o].join(", ")}) \u2014 die Kante w\xFCrde im Editor verschwinden`,en:`${n.label.en}: next key '${a}' is not a valid outcome of this node (allowed: ${[...o].join(", ")}) \u2014 the edge would disappear in the editor`},severity:"error"})}return t}s(oH,"checkNextOutcomesKnown");function sH(e){let t=[],n=new Set(Zn(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!n.has(o.id));return r.length===0?t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:`Mehrere Start-Knoten (${r.map(o=>o.label.de).join(", ")})`,en:`Multiple start nodes (${r.map(o=>o.label.en).join(", ")})`},severity:"warning"}),e.nodes.filter(o=>o.type==="end").length===0&&t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),t}s(sH,"checkStartEnd");function aH(e){let t=new Map;for(let r of Zn(e.nodes))t.set(r.source,(t.get(r.source)??0)+1);let n=[];for(let r of e.nodes)r.type!=="end"&&(t.get(r.id)??0)===0&&n.push({layer:"GRAPH",kind:"startEnd",path:`node.${r.id}`,reason:{de:`${r.label.de}: keine ausgehende Kante`,en:`${r.label.en}: no outgoing edge`},severity:"warning"});return n}s(aH,"checkNoOutgoingEdge");function lH(e){return e.nodes.filter(t=>!Qg(t.id)).map(t=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${t.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${mr.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${t.id}": a node id is an identifier without a dot (${mr.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(lH,"checkNodeIdFormat");function dH(e){let t=new Set(e.nodes.map(r=>r.id)),n=[];for(let r of Zn(e.nodes))t.has(r.source)||n.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Quelle '${r.source}' nicht gefunden`,en:`Edge ${r.id}: source '${r.source}' not found`},severity:"error"}),t.has(r.target)||n.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Ziel '${r.target}' nicht gefunden`,en:`Edge ${r.id}: target '${r.target}' not found`},severity:"error"});return n}s(dH,"checkEdgeEndpoints");var cH=new Set(["countersignature"]);function uH(e){let t=[],n=s((o,a)=>{t.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:{de:`[graph/retiredField] ${a.de}`,en:`[graph/retiredField] ${a.en}`},severity:"error"})},"retired"),r={de:"Preise rechnet der Vertragsgenerator (`prices`), nicht der Workflow \u2014 binde Rang und Reduktion an seine Eing\xE4nge.",en:"Prices are computed by the contract generator (`prices`), not the workflow \u2014 bind rank and reduction to its inputs."},i=e;"pricingRules"in i&&n("pricingRules",r);for(let[o,a]of(Array.isArray(i.processStore)?i.processStore:[]).entries())for(let l of["derive","absentValue"])a!==null&&typeof a=="object"&&l in a&&n(`processStore.${o}.${l}`,r);for(let o of e.nodes)for(let a of o.tasks??[]){let l=a.result;l!==null&&typeof l=="object"&&"prices"in l&&n(`nodes.${o.id}.tasks.${a.key}.result.prices`,r)}for(let o of e.nodes){let a=o,l={de:`Knoten \u201E${Oe(e,o.id,"de")}\u201C (${o.id})`,en:`Node "${Oe(e,o.id,"en")}" (${o.id})`};for(let[c,u]of Object.entries(a.next??{}))u!==null&&typeof u=="object"&&"emits"in u&&n(`nodes.${o.id}.next.${c}.emits`,{de:`${l.de}: \`next.${c}.emits\` gibt es nicht mehr \u2014 ein Ausgang routet nur; ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`next.${c}.emits\` no longer exists \u2014 an outcome only routes; a node reads data through addresses in its own fields.`});for(let c of Array.isArray(a.outcomes)?a.outcomes:[])c!==null&&typeof c=="object"&&"emits"in c&&n(`nodes.${o.id}.outcomes.${String(c.id)}.emits`,{de:`${l.de}: \`emits\` am Ausgang "${String(c.id)}" gibt es nicht mehr \u2014 ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`emits\` on the outcome "${String(c.id)}" no longer exists \u2014 a node reads data through addresses in its own fields.`});"targetFormNodeId"in a&&n(`nodes.${o.id}.targetFormNodeId`,{de:`${l.de}: \`targetFormNodeId\` gibt es nicht mehr \u2014 welches Formular freigeschaltet wird, sagt die Adresse, an die der Eingang \`inputs.target\` gebunden ist ($node.<formular>.admission).`,en:`${l.en}: \`targetFormNodeId\` no longer exists \u2014 the address the input \`inputs.target\` is bound to says which form is unlocked ($node.<form>.admission).`}),"wires"in a&&n(`nodes.${o.id}.wires`,{de:`${l.de}: Datenkanten (\`wires\`) gibt es nicht mehr \u2014 jedes Feld, das Daten eines anderen Knotens liest, tr\xE4gt selbst die volle Adresse ($node.\u2026, $task.\u2026, $env.\u2026).`,en:`${l.en}: data edges (\`wires\`) no longer exist \u2014 every field that reads data of another node carries the full address itself ($node.\u2026, $task.\u2026, $env.\u2026).`});for(let[c,u]of Object.entries(a.inputs??{}))u!==null&&typeof u=="object"&&u.kind==="binding"&&"path"in u&&n(`nodes.${o.id}.inputs.${c}.path`,{de:`${l.de}: Der Eingang \u201E${c}\u201C ist \xFCber einen Pfad (\`path\`) gebunden \u2014 eine Bindung tr\xE4gt die volle Adresse (\`address\`) dessen, was sie liest.`,en:`${l.en}: The input "${c}" is bound through a path (\`path\`) \u2014 a binding carries the full address (\`address\`) of what it reads.`});o.type==="governedDocument"&&"resolver"in a&&n(`nodes.${o.id}.resolver`,{de:`${l.de}: \`resolver\` gibt es nicht mehr \u2014 der Generator ist der Eingang \`inputs.contractGenerator\` ({ kind, key }), seine Parameter stempelt die Plattform (\`generatorStamp\`), ein im Cockpit erg\xE4nzter Parameter ist sein Eingang \`{ kind: "cockpit" }\`.`,en:`${l.en}: \`resolver\` no longer exists \u2014 the generator is the input \`inputs.contractGenerator\` ({ kind, key }), the platform stamps its parameters (\`generatorStamp\`), a parameter completed in the cockpit is its input \`{ kind: "cockpit" }\`.`});let d=a.template;if(o.type==="governedDocument"&&d!==null&&typeof d=="object")for(let c of["key","cockpitFields"])c in d&&n(`nodes.${o.id}.template.${c}`,{de:`${l.de}: \`template.${c}\` gibt es nicht mehr \u2014 ${c==="key"?"die Vorlage ist der Eingang `inputs.documentTemplate`":'ein im Cockpit erg\xE4nzter Parameter ist sein Eingang `{ kind: "cockpit" }`'}.`,en:`${l.en}: \`template.${c}\` no longer exists \u2014 ${c==="key"?"the template is the input `inputs.documentTemplate`":'a parameter completed in the cockpit is its input `{ kind: "cockpit" }`'}.`});if(o.type==="setFlag")for(let c of["target","flagKey","value"])c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es am setFlag-Knoten nicht mehr \u2014 Formular, Merkmal und Wert sind die Eing\xE4nge \`inputs.target\` (gebunden an die Adresse $node.<formular>.admission), \`inputs.flagKey\` und \`inputs.value\` (feste Werte).`,en:`${l.en}: \`${c}\` no longer exists on a setFlag node \u2014 form, flag and value are the inputs \`inputs.target\` (bound to the address $node.<form>.admission), \`inputs.flagKey\` and \`inputs.value\` (literals).`});for(let c of Object.keys(Oy[o.type]??{}))c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es als Knoteneigenschaft nicht mehr \u2014 es ist der Eingang \`inputs.${c}\` (ein fester Wert im Parameter-Bereich).`,en:`${l.en}: \`${c}\` no longer exists as a node property \u2014 it is the input \`inputs.${c}\` (a fixed value among the parameters).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=c?.assign;u===null||typeof u!="object"||!("userId"in u)||n(`nodes.${o.id}.tasks.${String(c.key)}.assign.userId`,{de:`Aufgabe "${String(c.key)}" an ${l.de}: \`assign.userId\` gibt es nicht mehr \u2014 eine Aufgabe nennt ihr Team (\`assign.group\`), nie eine feste Person.`,en:`Task "${String(c.key)}" on ${l.en}: \`assign.userId\` no longer exists \u2014 a task names its team (\`assign.group\`), never a fixed person.`})}for(let c of _y[o.type]??[])c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es nicht mehr \u2014 dieser Knotentyp liest es nicht.`,en:`${l.en}: \`${c}\` no longer exists \u2014 this node type does not read it.`});for(let[c,u]of Object.entries(vO[o.type]??{}))c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&n(`nodes.${o.id}.adoptForm`,{de:`${l.de}: \`adoptForm: true\` gibt es nicht mehr \u2014 \`adoptForm\` ist die Adresse des \xFCbernommenen Formulars ($node.<anlegender Formularknoten>.admission).`,en:`${l.en}: \`adoptForm: true\` no longer exists \u2014 \`adoptForm\` is the address of the adopted form ($node.<creating form node>.admission).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=c?.result?.kind;typeof u=="string"&&cH.has(u)&&n(`nodes.${o.id}.tasks.${String(c.key)}.result`,{de:`Aufgabe "${String(c.key)}" an ${l.de}: das Ergebnis \u201E${u}" gibt es nicht mehr \u2014 die Gegenzeichnung ist der Knotentyp \u201EUnterschrift (intern)" (countersign).`,en:`Task "${String(c.key)}" on ${l.en}: the result "${u}" no longer exists \u2014 the countersignature is the node type "Signature (internal)" (countersign).`})}}return t}s(uH,"checkRetiredDataFields");function da(e,t){return t?.wiring&&t.layout?{wiring:t.wiring,layout:t.layout}:null}s(da,"resolveLayoutContext");function fH(e,t){let n=da(e,t);if(!n)return e.nodes.some(o=>(Ye(o)?.progressEvents?.length??0)>0)?[{layer:"GRAPH",kind:"progressState",path:"graph.progressWiring",reason:{de:`Graph emittiert Progress-Events, aber (Layout, Wiring) konnte nicht aufgel\xF6st werden (Wiring ${t?.wiring?"vorhanden":"fehlt"}, Layout ${t?.layout?"vorhanden":"fehlt"}) \u2014 der Engine wirft beim Spiegeln zur Laufzeit. Der Workflow-Entwurf muss progressLayout und progressWiring tragen.`,en:`The graph emits progress events, but (layout, wiring) could not be resolved (wiring ${t?.wiring?"present":"missing"}, layout ${t?.layout?"present":"missing"}) \u2014 the engine throws at runtime when mirroring. The workflow draft must carry progressLayout and progressWiring.`},severity:"error"}]:[];let r=[];for(let i of e.nodes){let a=Ye(i)?.progressEvents;if(a)for(let l of a){let d=js(n.wiring,{id:i.id,type:i.type},l);if(!d){r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Progress-Event '${l}' ist im Wiring (Layout '${n.layout.id}') keinem (Bus, State) zugeordnet \u2014 der Engine wirft beim Spiegeln`,en:`${i.type} '${i.id}': progress event '${l}' is not mapped to any (bus, state) in the wiring (layout '${n.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=_f(n.layout,d.bus)}catch{r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf unbekannten Bus '${d.bus}' im Layout '${n.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${n.layout.id}'`},severity:"error"});continue}El(c,d.state)||r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf State '${d.state}', der nicht im Bus '${d.bus}' deklariert ist`,en:`${i.type} '${i.id}': event '${l}' points to state '${d.state}', which is not declared in bus '${d.bus}'`},severity:"error"})}}return r}s(fH,"checkProgressEventMappings");function pH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses){if(!i.boards||i.boards.length===0)continue;let o=new Set(i.unboarded??[]),a=new Set;for(let l of i.boards)for(let d of l.columns)for(let c of d.states)a.add(c),El(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.board.${l.id}.column.${d.id}.${c}`,reason:{de:`Board '${l.id}', Spalte '${d.id}' referenziert State '${c}', der nicht im Bus '${i.key}' deklariert ist`,en:`Board '${l.id}', column '${d.id}' references state '${c}', which is not declared in bus '${i.key}'`},severity:"error"});for(let l of i.states)a.has(l.id)||o.has(l.id)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.${l.id}`,reason:{de:`State '${l.id}' (${l.label.de}) erscheint in keiner Board-Spalte und nicht in 'unboarded' \u2014 nicht darstellbar`,en:`State '${l.id}' (${l.label.en}) appears in no board column and not in 'unboarded' \u2014 it cannot be displayed`},severity:"error"})}return r}s(pH,"checkProgressBoardCoverage");function mH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses)if(!(!i.boards||i.boards.length===0))for(let o of i.boards)for(let a of ze){let l=new Map;for(let d of o.columns){if(!Ti(d.label))continue;let c=d.label[a],u=c.trim().toLocaleLowerCase(a),p=l.get(u);if(p===void 0){l.set(u,d.id);continue}r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.board.${o.id}.column.${d.id}.label.${a}`,reason:{de:`Board '${o.id}' hat zwei Spalten mit dem Label '${c}' (${a}) ('${p}' und '${d.id}') \u2014 f\xFCr Lesende nicht unterscheidbar. F\xFChre die Spalten zusammen (states beider in EINE Spalte) oder vergib unterschiedliche Labels.`,en:`Board '${o.id}' has two columns with the label '${c}' (${a}) ('${p}' and '${d.id}') \u2014 readers cannot tell them apart. Merge the columns (put the states of both into ONE column) or give them different labels.`},severity:"error"})}}return r}s(mH,"checkProgressBoardDistinctLabels");function hH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses)for(let o of i.states){let a=Nf(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`Terminal-State '${o.id}' hat keine Terminal-Semantik im Bus '${i.key}' \u2014 der Engine wirft beim Versiegeln`,en:`Terminal state '${o.id}' has no terminal semantics in bus '${i.key}' \u2014 the engine throws when sealing`},severity:"error"}),!o.terminal&&a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`State '${o.id}' ist nicht terminal, hat aber Terminal-Semantik im Bus '${i.key}' \u2014 Inkonsistenz`,en:`State '${o.id}' is not terminal but has terminal semantics in bus '${i.key}' \u2014 inconsistent`},severity:"error"})}return r}s(hH,"checkProgressTerminalSemantics");function gH(e,t){let n=da(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])El(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.holdsSeat.${a}`,reason:{de:`holdsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`holdsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let a of i.commitsSeat??[])El(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat '${a}' ist nicht in holdsSeat \u2014 ein fest belegter Platz muss auch belegt sein`,en:`commitsSeat '${a}' is not in holdsSeat \u2014 a firmly committed seat must also be held`},severity:"error"}):r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`commitsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let[a,l]of Object.entries(i.terminalSemantics??{}))l.outcome==="approved"&&(o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.layout.id}.bus.${i.key}.holdsSeat`,reason:{de:`Endzustand '${a}' schlie\xDFt den Prozess positiv ab (outcome 'approved'), steht aber nicht in holdsSeat \u2014 damit z\xE4hlt er als Absage und f\xE4llt aus dem Fortschrittsbalken. Nimm '${a}' in holdsSeat (und in commitsSeat, wenn der Platz damit wirklich belegt ist) auf.`,en:`Final state '${a}' ends the process positively (outcome 'approved'), but is not in holdsSeat \u2014 so it counts as a rejection and drops out of the progress bar. Add '${a}' to holdsSeat (and to commitsSeat, if the seat is really taken by it).`},severity:"error"}))}return r}s(gH,"checkProgressSeatStates");var wp={de:"Abhilfe: nach dem Formularknoten einen review-Knoten einf\xFCgen und dessen 'reviewing' auf diesen Zustand mappen",en:"Remedy: insert a review node after the form node and map its 'reviewing' to this state"};function yH(e){return e==="both"?{de:`${wp.de} \u2014 die Spalte ist auch der Schritt, den die Familie sieht; den Zustand in die Spalte des Nachfolgers zu legen, n\xE4hme ihr diesen Schritt.`,en:`${wp.en} \u2014 the column is also the step the family sees; moving the state into the successor's column would take that step away from them.`}:{de:`${wp.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${wp.en}, or move the state into the successor's column.`}}s(yH,"passThroughRemedy");function wH(e,t){let n=da(e,t);if(!n)return[];let{layout:r,wiring:i}=n;if(!r.buses.some(v=>v.key==="process"))return[];let o=VO(r);if(!o)return[];let a=new Map(e.nodes.map(v=>[v.id,v])),l=s(v=>Ye(v).progressEvents??[],"eventsOf"),d=s(v=>Object.values(v.next??{}).map(A=>A.to),"routesOf"),c=s((v,A)=>{let E=a.get(v);if(!E||A.has(v))return null;if(l(E).length>0)return[E];if(kC[E.type]!==!1)return null;let I=d(E);if(I.length===0)return null;let C=[];for(let $ of I){let b=c($,new Set([...A,v]));if(!b)return null;C.push(...b)}return C},"firstProgressNodes"),u=s((v,A)=>{let E=[];for(let I of l(v)){let C=js(i,v,I);if(!C||C.bus!==A.bus||C.state===A.state)return null;E.push(C.state)}return[...new Set(E)].join("' / '")},"overwrites"),p=s((v,A)=>{let E=d(v);if(E.length===0)return null;let I=[];for(let C of E){let $=c(C,new Set([v.id]));if(!$)return null;for(let b of $){let R=u(b,A);if(R===null)return null;I.push({de:`'${b.id}' (${b.type}) mit '${R}'`,en:`'${b.id}' (${b.type}) with '${R}'`})}}return[...new Map(I.map(C=>[C.de,C])).values()]},"submitOverwrittenBy"),h=new Map;for(let v of e.nodes)for(let A of l(v)){let E=js(i,v,A);if(!E||E.bus!=="process")continue;let I=v.type==="form"&&A===ef?p(v,E):null,C=I?{de:`'${v.id}'.${A} erreicht ihn, und ${I.map($=>$.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${v.id}'.${A} reaches it, and ${I.map($=>$.en).join(", ")} overwrites it in the same transaction`}:null;h.set(E.state,[...h.get(E.state)??[],C])}let w=_f(r,"process"),k=new Map;for(let[v,A]of h){if(!A.every(I=>I!==null))continue;let E=[...new Map(A.map(I=>[I.de,I])).values()];k.set(v,{de:E.map(I=>I.de).join("; "),en:E.map(I=>I.en).join("; ")})}let y=[];for(let v of o.columns){if(v.states.length===0||!v.states.every(I=>k.has(I)))continue;let A=v.states.map(I=>{let C=w.holdsSeat?.includes(I)===!0,$=k.get(I);return{de:`Zustand '${I}'${C?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${$.de}`,en:`State '${I}'${C?" (is in holdsSeat, but never takes a seat)":""}: ${$.en}`}}),E=yH(o.audience);y.push({layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${o.id}.columns.${v.id}`,reason:{de:`[progress/passThroughState] Spalte \u201E${v.label.de}" ('${v.id}', Board '${o.id}') bleibt immer leer \u2014 ${A.map(I=>I.de).join("; ")}. ${E.de}`,en:`[progress/passThroughState] Column "${v.label.en}" ('${v.id}', board '${o.id}') always stays empty \u2014 ${A.map(I=>I.en).join("; ")}. ${E.en}`},severity:"warning"})}return y}s(wH,"checkProgressPassThroughColumns");function kH(e){let t=["workItems","workitems","work_items","taskTemplates"],n=[];for(let r of e.nodes){let i=r;for(let o of t){let a=i[o];a!=null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.${o}`,reason:{de:`[workItems/misnamedTasksKey] Knoten "${r.id}" deklariert "${o}" \u2014 komponierte Aufgaben werden ausschlie\xDFlich unter "tasks" gelesen. So wie es dasteht, w\xFCrde die Aufgabenkette stillschweigend nie entstehen. Benenne den Schl\xFCssel in "tasks" um.`,en:`[workItems/misnamedTasksKey] Node "${r.id}" declares "${o}" \u2014 composed tasks are read only from "tasks". As it stands, the task chain would silently never be created. Rename the key to "tasks".`},severity:"error"})}}return n}s(kH,"checkMisnamedTasksKey");function bH(e){let t=[];for(let n of e.nodes){let r=n,i=Array.isArray(r.tasks)?r.tasks:[],o=new Set;for(let c of i){let u=typeof c.key=="string"?c.key:void 0;u!==void 0&&(o.has(u)&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}`,reason:{de:`[workItems/duplicateTemplateKey] Doppelter Template-Key "${u}" auf Knoten "${r.id}".`,en:`[workItems/duplicateTemplateKey] Duplicate template key "${u}" on node "${r.id}".`},severity:"error"}),o.add(u))}let a=new Set;for(let c of Array.isArray(r.artifacts)?r.artifacts:[])typeof c.key=="string"&&a.add(`${c.key}Uploaded`);let l=Ye(n),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(n):[]).map(c=>[c.key,c]));for(let c of i){let u=typeof c.key=="string"?c.key:"?",p=typeof c.kind=="string"?c.kind:void 0;if(p===void 0||!Cl.has(p)){t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.kind`,reason:{de:`[workItems/invalidKind] Task "${u}" auf Knoten "${r.id}" hat Art ${JSON.stringify(c.kind)}; komponierbar sind: ${[...Cl].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...Cl].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.gatesNode`,reason:{de:`[workItems/gatesNodeOnTask] 'gatesNode' ist nur f\xFCr die Art 'approval' zul\xE4ssig \u2014 eine Task gated ihren Knoten nie direkt. Um eine gatende Freigabe zur\xFCckzuhalten, 'blocks' verwenden (Task "${u}" auf Knoten "${r.id}").`,en:`[workItems/gatesNodeOnTask] 'gatesNode' is only allowed for the kind 'approval' \u2014 a task never gates its node directly. To hold back a gating approval, use 'blocks' (task "${u}" on node "${r.id}").`},severity:"error"});let h=c.blocks,w=h===void 0?void 0:FN(e,r.id,h.node);if(h!==void 0&&w===null)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.node`,reason:{de:`[workItems/blocksUnknownNode] 'blocks.node' auf Task "${u}" (Knoten "${r.id}") nennt ${JSON.stringify(h.node)} \u2014 diesen Knoten gibt es im Workflow nicht.`,en:`[workItems/blocksUnknownNode] 'blocks.node' on task "${u}" (node "${r.id}") names ${JSON.stringify(h.node)} \u2014 there is no such node in the workflow.`},severity:"error"});else if(h!==void 0&&w!==void 0&&w!==null){let y=w.node.id===r.id,v=w.node.id,A=y?o:w.composedKeys,E=y?d:w.intrinsicByKey,I=w.node.assign??{};p==="approval"&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksOnApproval] 'blocks' ist auf der Art 'approval' verboten \u2014 nur Task-Zeilen d\xFCrfen einen Geschwister-Spawn zur\xFCckhalten (Approval "${u}" auf Knoten "${r.id}").`,en:`[workItems/blocksOnApproval] 'blocks' is forbidden on the kind 'approval' \u2014 only task rows may hold back a sibling spawn (approval "${u}" on node "${r.id}").`},severity:"error"});let C=h.templateKey,$=[...new Set([...A,...E.keys()])].filter(R=>!y||R!==u).join(", "),b={de:$||"keine",en:$||"none"};if(typeof C!="string"||y&&C===u||!A.has(C)&&!E.has(C))t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnknownTarget] 'blocks' muss ein Template auf dem Zielknoten benennen \u2014 komponiert ODER intrinsisch (nie sich selbst, nie ohne 'templateKey': die zielfreie Form geh\xF6rt der Maschine, nicht dem Autor). Ziel ${JSON.stringify(C)} auf Knoten "${v}"; zul\xE4ssige Ziele: ${b.de}.`,en:`[workItems/blocksUnknownTarget] 'blocks' must name a template on the target node \u2014 composed OR intrinsic (never itself, never without 'templateKey': the target-less form belongs to the engine, not the author). Target ${JSON.stringify(C)} on node "${v}"; allowed targets: ${b.en}.`},severity:"error"});else if(w.refuse(C)!==null)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:w.refuse(C),severity:"error"});else{let R=E.get(C);h.except!==void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.except`,reason:{de:`[workItems/blocksExceptRetired] 'blocks.except' auf Task "${u}" (Knoten "${r.id}") gibt es nicht mehr: eine blockierende Aufgabe sperrt die ganze Aktionsgruppe ihres Ziels (bei einer Entscheidung Freigeben, Warteliste, Ablehnen und das Nachr\xFCcken). 'except' entfernen.`,en:`[workItems/blocksExceptRetired] 'blocks.except' on task "${u}" (node "${r.id}") no longer exists: a blocking task locks the whole action group of its target (for a decision: approve, waitlist, reject and promote). Remove 'except'.`},severity:"error"}),R!==void 0&&R.recipient!=="external"&&R.verdictResolved!==!0&&typeof I[C]!="string"&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnwiredTarget] Task "${u}" auf Knoten "${r.id}" h\xE4lt "${C}" (Knoten "${v}") zur\xFCck, aber der Knoten weist "${C}" keiner Gruppe zu \u2014 ohne 'assign.${C}' entsteht diese Zeile nie: kein Team bekommt die zur\xFCckgehaltene Arbeit, niemand au\xDFer der verantwortlichen Person kann sie tun. Entweder 'assign.${C}' erg\xE4nzen oder das 'blocks' entfernen.`,en:`[workItems/blocksUnwiredTarget] Task "${u}" on node "${r.id}" holds back "${C}" (node "${v}"), but the node assigns "${C}" to no group \u2014 without 'assign.${C}' this row is never created: no team receives the held-back work, and nobody except the responsible person can do it. Either add 'assign.${C}' or remove the 'blocks'.`},severity:"error"})}}{let y=c.completableIf;if(typeof y=="string"&&y.trim().length>0){let v=y.trim().replace(/^!/,"").trim();a.has(v)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.completableIf`,reason:{de:`[workItems/unknownExport] completableIf "${y}" verweist auf unbekannten Node-Export "${v}"; bekannt: ${[...a].join(", ")||"keine"}.`,en:`[workItems/unknownExport] completableIf "${y}" refers to unknown node export "${v}"; known: ${[...a].join(", ")||"none"}.`},severity:"error"})}}let k=c.params;if(k?.commentRequired!==void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.commentRequired`,reason:{de:"[workItems/removedParam] 'params.commentRequired' wurde entfernt \u2014 Kommentar-Pflichten werden am Decision-Node ('commentRequired') autorisiert.",en:"[workItems/removedParam] 'params.commentRequired' was removed \u2014 comment requirements are authored on the decision node ('commentRequired')."},severity:"error"}),p!=="approval"){let y=[];k?.onReject!==void 0&&y.push("params.onReject"),k?.revisionGroup!==void 0&&y.push("params.revisionGroup");for(let v of y)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.${v}`,reason:{de:`[workItems/approvalOnlyField] '${v}' gilt nur f\xFCr die Art 'approval' (Task "${u}" ist '${p}').`,en:`[workItems/approvalOnlyField] '${v}' only applies to the kind 'approval' (task "${u}" is '${p}').`},severity:"error"});continue}k?.onReject!==void 0&&k.onReject!=="spawnRevision"&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.onReject`,reason:{de:`[workItems/invalidOnReject] Erwartet 'spawnRevision', erhalten ${JSON.stringify(k.onReject)}.`,en:`[workItems/invalidOnReject] Expected 'spawnRevision', got ${JSON.stringify(k.onReject)}.`},severity:"error"}),k?.onReject==="spawnRevision"&&(typeof k.revisionGroup!="string"||k.revisionGroup.length===0)&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.revisionGroup`,reason:{de:`[workItems/spawnRevisionNoTarget] Approval "${u}" mit 'params.onReject: spawnRevision' ohne 'params.revisionGroup' \u2014 die \xDCberarbeitung h\xE4tte keine Ziel-Gruppe.`,en:`[workItems/spawnRevisionNoTarget] Approval "${u}" with 'params.onReject: spawnRevision' but no 'params.revisionGroup' \u2014 the revision would have no target group.`},severity:"error"})}}return t.push(...LN(e)),t}s(bH,"checkWorkItemTemplates");var vH=new Set(["complete","approve","reject"]),kC={form:!0,decision:!0,review:!0,waitlist:!0,completenessCheck:!0,collectPayment:!0,eventTrigger:!0,join:!1,roleAssign:!1,setFlag:!1,if:!1,end:!1,countersign:!0,engagePush:!1,governedDocument:!0};function xH(e){let t=[];for(let n of e.nodes){let r=n,i=Ye(n),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(n)??[];if(o+a.length>0){let v=kC[r.type];v===void 0?t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/unknownParkSemantics] Knotentyp "${r.type}" hat keine bekannte Park-Semantik \u2014 NODE_TYPE_PARKS in validators.ts erg\xE4nzen.`,en:`[workItems/unknownParkSemantics] Node type "${r.type}" has no known parking semantics \u2014 add it to NODE_TYPE_PARKS in validators.ts.`},severity:"error"}):v||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/templatesOnNonParkingNode] Knoten "${r.id}" (Typ "${r.type}") parkt nie \u2014 seine Work-Item-Templates w\xFCrden im selben Dispatch gespawnt und storniert (totes Muster).`,en:`[workItems/templatesOnNonParkingNode] Node "${r.id}" (type "${r.type}") never parks \u2014 its work-item templates would be spawned and cancelled in the same dispatch (dead pattern).`},severity:"error"})}let l=i.actions?.(n)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(v=>[v.id,v]));for(let v of l)vH.has(v.id)&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/reservedActionId] Knotentyp "${r.type}" deklariert die Action "${v.id}" \u2014 reserviert f\xFCr den generischen Complete-/Verdict-Pfad (complete, approve, reject); die Spec muss eine andere Action-Id w\xE4hlen.`,en:`[capability/reservedActionId] Node type "${r.type}" declares the action "${v.id}" \u2014 reserved for the generic complete/verdict path (complete, approve, reject); the spec must choose a different action id.`},severity:"error"});let c=new Set(i.states??[i_]);for(let v of l)if(v.availableIn!==void 0)for(let A of v.availableIn)c.has(A)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.availableIn`,reason:{de:`[capability/unknownActionState] Action "${v.id}" auf Knotentyp "${r.type}" ist f\xFCr Zustand "${A}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${v.id}" on node type "${r.type}" is declared for state "${A}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=zy(n),p=new Set(u?u.map(v=>v.id):[zs]);for(let v of l){if(v.external===void 0)continue;let A=r_(v.external.event),E={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},I=A?v.kind==="advance"?{de:`ist als "advance" deklariert, l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 solche Aktionen sind "internal"`,en:`is declared as "advance", but does not resolve the node (event "${v.external.event}") \u2014 such actions are "internal"`}:v.outcome!==void 0?{de:`nennt das Outcome "${v.outcome}", l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 ein Outcome w\xFCrde eine zweite, stille Routing-Vokabel behaupten`,en:`names the outcome "${v.outcome}", but does not resolve the node (event "${v.external.event}") \u2014 an outcome would claim a second, silent routing vocabulary`}:v.label===void 0?E:null:v.kind!=="advance"?{de:`ist als "${v.kind}" deklariert (externe Aktionen l\xF6sen den Knoten auf und m\xFCssen "advance" sein)`,en:`is declared as "${v.kind}" (external actions resolve the node and must be "advance")`}:v.outcome===void 0?{de:"nennt kein Outcome",en:"names no outcome"}:p.has(v.outcome)?v.label===void 0?E:null:{de:`verweist auf das unbekannte Outcome "${v.outcome}" (deklariert: ${[...p].join(", ")||"keine"})`,en:`refers to the unknown outcome "${v.outcome}" (declared: ${[...p].join(", ")||"none"})`};I!==null&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.external`,reason:{de:`[capability/externalActionNeedsOutcome] Externe Aktion "${v.id}" auf Knotentyp "${r.type}" ${I.de}.`,en:`[capability/externalActionNeedsOutcome] External action "${v.id}" on node type "${r.type}" ${I.en}.`},severity:"error"})}for(let v of a){let A=v.unlocks;if(A.length===0&&v.verdictResolved!==!0&&v.informational!==!0){t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/emptyUnlocks] Intrinsisches Template "${v.key}" auf Knoten "${r.id}" schaltet keine Action frei (B5).`,en:`[capability/emptyUnlocks] Intrinsic template "${v.key}" on node "${r.id}" unlocks no action (B5).`},severity:"error"});continue}for(let E of A)d.get(E)===void 0&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/danglingUnlock] Template "${v.key}" auf Knoten "${r.id}" schaltet unbekannte Action "${E}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${v.key}" on node "${r.id}" unlocks the unknown action "${E}"; declared: ${[...d.keys()].join(", ")||"none"}.`},severity:"error"})}let h=new Set(a.map(v=>v.key));for(let v of Object.keys(r.assign??{}))h.has(v)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.assign.${v}`,reason:{de:`[capability/unknownAssignKey] assign-Key "${v}" auf Knoten "${r.id}" ist kein intrinsisches Template dieses Knotentyps; bekannt: ${[...h].join(", ")||"keine"}.`,en:`[capability/unknownAssignKey] assign key "${v}" on node "${r.id}" is not an intrinsic template of this node type; known: ${[...h].join(", ")||"none"}.`},severity:"error"});let w=l.filter(v=>v.teamAssignable===!0).map(v=>v.id);for(let v of Object.keys(r.actionTeams??{}))w.includes(v)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actionTeams.${v}`,reason:{de:`[capability/unknownActionTeam] Knoten "${r.id}" nennt ein Team f\xFCr "${v}", aber diese Aktion l\xE4sst sich hier keinem Team geben; m\xF6glich: ${w.join(", ")||"keine"}.`,en:`[capability/unknownActionTeam] Node "${r.id}" names a team for "${v}", but this action cannot be given to a team here; possible: ${w.join(", ")||"none"}.`},severity:"error"});let k=new Set;for(let v of a)if(v.recipient==="external"||typeof(r.assign??{})[v.key]=="string")for(let E of v.unlocks)k.add(E);let y=i.strictActionCoverage===!0;for(let v of l){if(k.has(v.id)||v.superUserOnly===!0)continue;let A=a.find(I=>I.unlocks.includes(v.id)),E=A!==void 0?{de:` Fehlt die Zuweisung assign.${A.key}?`,en:` Is the assignment assign.${A.key} missing?`}:{de:"",en:""};t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/superUserOnly] Action "${v.id}" auf Knoten "${r.id}" ist von keinem verdrahteten Work-Item freigeschaltet \u2014 nur die verantwortliche Person (Super-User) kann sie ausf\xFChren.${E.de}`,en:`[capability/superUserOnly] Action "${v.id}" on node "${r.id}" is unlocked by no wired work item \u2014 only the responsible person (super user) can perform it.${E.en}`},severity:y?"error":"warning"})}}return t}s(xH,"checkNodeCapabilityWiring");function SH(e){let t=new Set(zI()),n=[];for(let r of e.nodes)t.has(r.type)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.type`,reason:{de:`[graph/unknownNodeType] Knoten "${r.id}" hat den unbekannten Typ "${String(r.type)}". Registrierte Typen: ${[...t].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...t].join(", ")}.`},severity:"error"});return n}s(SH,"checkKnownNodeTypes");function AH(e,t){let n=[],r=s((a,l)=>{n.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=tI(e),o=s(a=>typeof a=="object"&&a!==null&&Object.values(a).some(l=>typeof l=="string"&&l.trim().length>0),"hasText");for(let a of e.nodes){let l=a,d=Array.isArray(l.optionalActions)?l.optionalActions:[];if(n.push(...MH(l,d)),d.length===0)continue;let c=Ye(a),u=new Set(c.optionalActionKinds??[]),p=Array.isArray(l.tasks)?l.tasks:[],h=new Map;for(let y of p)typeof y.key=="string"&&h.set(y.key,y);let w=new Set,k=new Map;for(let y of d){let v=y.key,A=typeof v=="string"&&v.trim().length>0?v:void 0,E=A??"?",I=`nodes.${l.id}.optionalActions.${E}`,C=typeof y.action=="string"?y.action:void 0;if(y.when!==void 0){let $=s(b=>r(`${I}.when`,{de:`[optionalAction/when] Optionale Aktion "${E}" auf Knoten "${l.id}": ${b.de}`,en:`[optionalAction/when] Optional action "${E}" on node "${l.id}": ${b.en}`}),"conditionFinding");if(typeof y.when!="string"||y.when.trim()==="")$({de:"Die Bedingung ist leer \u2014 ohne Bedingung das Feld weglassen.",en:"The condition is empty \u2014 without a condition, omit the field."});else for(let b of Xf(y.when,i,t))$(b)}if((C===void 0||!u.has(C))&&r(`${I}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${E}" auf Knoten "${l.id}" hat die Art ${JSON.stringify(y.action)} \u2014 `+(u.size===0?`Knotentyp "${l.type}" deklariert keine Familien (spec.optionalActionKinds fehlt).`:`Knotentyp "${l.type}" deklariert nur: ${[...u].join(", ")}.`),en:`[optionalAction/kindNotDeclared] Optional action "${E}" on node "${l.id}" has the kind ${JSON.stringify(y.action)} \u2014 `+(u.size===0?`node type "${l.type}" declares no families (spec.optionalActionKinds is missing).`:`node type "${l.type}" only declares: ${[...u].join(", ")}.`)}),A===void 0?r(`${I}.key`,{de:`[optionalAction/missingKey] Optionale Aktion auf Knoten "${l.id}" ohne (oder mit leerem) 'key' \u2014 Trigger-Action und Template-Keys w\xE4ren namenlos ('optionalAction::\u2026').`,en:`[optionalAction/missingKey] Optional action on node "${l.id}" without (or with an empty) 'key' \u2014 the trigger action and template keys would be nameless ('optionalAction::\u2026').`}):(w.has(A)&&r(`${I}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${A}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${A}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),w.add(A)),o(y.label)||r(`${I}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${E}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${E}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),C==="spawnTasks"){y.except!==void 0&&r(`${I}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${E}" auf Knoten "${l.id}" tr\xE4gt 'except' \u2014 das gibt es nicht mehr: solange die Aufgaben offen sind, ist die ganze Aktionsgruppe des Knotens gesperrt. 'except' entfernen.`,en:`[optionalAction/exceptRetired] Optional action "${E}" on node "${l.id}" carries 'except' \u2014 that no longer exists: while the tasks are open, the node's whole action group is locked. Remove 'except'.`});let $=Array.isArray(y.tasks)?y.tasks:void 0;if($===void 0||$.length===0)r(`${I}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${E}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${E}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let b=new Set,R=new Set($.filter(q=>typeof q=="string"));for(let q of $){let _=typeof q=="string"?q:void 0;if(_===void 0||_.length===0){r(`${I}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${E}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${E}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(b.has(_)){r(`${I}.tasks.${_}`,{de:`[optionalAction/duplicateTaskRef] Template "${_}" ist in der Aktion "${E}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${_}" is referenced twice in the action "${E}" on node "${l.id}".`});continue}b.add(_);let J=h.get(_);if(J===void 0){r(`${I}.tasks.${_}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${E}" auf Knoten "${l.id}" referenziert das Template "${_}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${E}" on node "${l.id}" references the template "${_}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let Y=k.get(_);Y!==void 0&&Y!==E?r(`${I}.tasks.${_}`,{de:`[optionalAction/taskDoublyBound] Template "${_}" auf Knoten "${l.id}" ist bereits von der Aktion "${Y}" referenziert \u2014 ein Template geh\xF6rt zu h\xF6chstens einer optionalen Aktion.`,en:`[optionalAction/taskDoublyBound] Template "${_}" on node "${l.id}" is already referenced by the action "${Y}" \u2014 a template belongs to at most one optional action.`}):k.set(_,E);let ue=J.blocks?.templateKey;typeof ue=="string"&&!R.has(ue)&&r(`${I}.tasks.${_}`,{de:`[optionalAction/taskRefBlocks] Template "${_}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${ue}", das nicht zur selben Aktion "${E}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${_}" on node "${l.id}" carries 'blocks' on "${ue}", which does not belong to the same action "${E}" \u2014 a reference may only hold back a reference of the SAME action (checklist order), never a template outside it.`});for(let Q of p){let re=typeof Q.key=="string"?Q.key:void 0;Q.blocks?.templateKey===_&&(re!==void 0&&R.has(re)||r(`${I}.tasks.${_}`,{de:`[optionalAction/taskRefBlocks] Template "${_}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${re!==void 0?`"${re}"`:"einem Template"} au\xDFerhalb der Aktion "${E}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${_}" on node "${l.id}" is the target of a 'blocks' from ${re!==void 0?`"${re}"`:"a template"} outside the action "${E}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return n}s(AH,"checkOptionalActions");function EH(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(EH,"literalValueType");function TH(e,t){let n=[],r=t?.notificationTemplates;for(let i of e.nodes){let o=i,a=A_(i,Ye(i)),l=o.notifications??{};if(a.length===0&&Object.keys(l).length===0)continue;let d=new Map(a.map(c=>[c.id,c]));for(let c of Object.keys(l))d.has(c)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c}`,reason:{de:`[notification/unknownEvent] Knoten "${o.id}" bindet einen Brief an das Ereignis "${c}", das der Knotentyp "${o.type}" nicht kennt. Angeboten werden: ${a.map(u=>u.id).join(", ")||"(keine)"}.`,en:`[notification/unknownEvent] Node "${o.id}" binds a letter to the event "${c}", which the node type "${o.type}" does not know. Offered: ${a.map(u=>u.id).join(", ")||"(none)"}.`},severity:"error"});for(let c of a){let u=l[c.id];if(c.required===!0&&(u===void 0||u.disabled===!0)){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c.id}`,reason:{de:`[notification/missingBinding] Knoten "${o.id}" muss beim Ereignis "${c.label.de}" (${c.id}) einen Brief verschicken \u2014 es ist ${u===void 0?"keiner gebunden":"einer gebunden, aber abgeschaltet"}.`,en:`[notification/missingBinding] Node "${o.id}" must send a letter on the event "${c.label.en}" (${c.id}) \u2014 ${u===void 0?"none is bound":"one is bound, but switched off"}.`},severity:"error"});continue}if(u===void 0||u.disabled===!0)continue;let p=`nodes.${o.id}.notifications.${c.id}`;if(c.audience!=="external"){n.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/internalAudienceUnsupported] Knoten "${o.id}": das Ereignis "${c.id}" richtet sich an die Schule, und Briefe an die Schule k\xF6nnen noch nicht zugestellt werden \u2014 der gebundene Brief "${u.templateId}" w\xFCrde den Vorgang beim Versand abbrechen.`,en:`[notification/internalAudienceUnsupported] Node "${o.id}": the event "${c.id}" is addressed to the school, and letters to the school cannot be delivered yet \u2014 the bound letter "${u.templateId}" would abort the process when it is sent.`},severity:"error"});continue}if(r===void 0)continue;let h=r.get(u.templateId);if(h===void 0){n.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/unknownTemplate] Knoten "${o.id}": der Brief "${u.templateId}" ist nicht im Katalog. Bekannt sind: ${[...r.keys()].sort().join(", ")||"(keine)"}.`,en:`[notification/unknownTemplate] Node "${o.id}": the letter "${u.templateId}" is not in the catalog. Known: ${[...r.keys()].sort().join(", ")||"(none)"}.`},severity:"error"});continue}h.audience!==void 0&&h.audience!==c.audience&&n.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/audienceMismatch] Der Brief "${h.id}" ist f\xFCr ${h.audience==="internal"?"die Schule":"die Familie"} geschrieben, das Ereignis "${c.id}" richtet sich aber an die Familie.`,en:`[notification/audienceMismatch] The letter "${h.id}" is written for ${h.audience==="internal"?"the school":"the family"}, but the event "${c.id}" is addressed to the family.`},severity:"warning"});let w=k_(c),k=new Set(h.params.map(y=>y.key));for(let y of Object.keys(u.args??{}))k.has(y)||n.push({layer:"GRAPH",kind:"nodeRule",path:`${p}.args.${y}`,reason:{de:`[notification/unknownArg] Der Brief "${h.id}" hat kein Argument "${y}" \u2014 erwartet werden: ${h.params.map(v=>v.key).join(", ")||"(keine)"}.`,en:`[notification/unknownArg] The letter "${h.id}" has no argument "${y}" \u2014 expected: ${h.params.map(v=>v.key).join(", ")||"(none)"}.`},severity:"error"});for(let y of h.params){let v=u.args?.[y.key],A=`${p}.args.${y.key}`;if(v!==void 0&&"literal"in v){let I=EH(v.literal);y.type!==void 0&&!sw(I,y.type)&&n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/argTypeMismatch] "${y.key}" erwartet ${_l(y.type).de}, festgelegt ist aber ${JSON.stringify(v.literal)} (${I}).`,en:`[notification/argTypeMismatch] "${y.key}" expects ${_l(y.type).en}, but ${JSON.stringify(v.literal)} (${I}) is set.`},severity:"error"});continue}if(v!==void 0){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unsupportedArg] "${y.key}" ist an ${JSON.stringify(v)} gebunden \u2014 ein Brief-Argument kann nur ein Festwert ({ literal }) sein oder automatisch aus ${wC(w,"de")} kommen.`,en:`[notification/unsupportedArg] "${y.key}" is bound to ${JSON.stringify(v)} \u2014 a letter argument can only be a fixed value ({ literal }) or come automatically from ${wC(w,"en")}.`},severity:"error"});continue}let E=b_(y,w.get(y.key)??[]);if(!(E.status==="resolved"||E.status==="unused")){if(E.status==="sometimes"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Der Brief "${h.id}" braucht "${y.key}" immer, ${E.source.source} liefert es aber nur manchmal. In notifications.${c.id}.args.${y.key} einen Festwert benennen \u2014 oder einen Brief w\xE4hlen, der ohne "${y.key}" auskommt.`,en:`[notification/unresolvedArg] The letter "${h.id}" always needs "${y.key}", but ${E.source.source} provides it only sometimes. Name a fixed value in notifications.${c.id}.args.${y.key} \u2014 or choose a letter that works without "${y.key}".`},severity:"error"});continue}if(E.status==="ambiguous"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/ambiguousArg] "${y.key}" hat mehrere passende Quellen \u2014 ${E.matches.map(I=>I.source).join(", ")}. In notifications.${c.id}.args.${y.key} einen Festwert setzen.`,en:`[notification/ambiguousArg] "${y.key}" has several matching sources \u2014 ${E.matches.map(I=>I.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${y.key}.`},severity:"error"});continue}n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Der Brief "${h.id}" braucht "${y.key}"${y.type!==void 0?` (${_l(y.type).de})`:""}, und der Knoten hat daf\xFCr ${E.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${E.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The letter "${h.id}" needs "${y.key}"${y.type!==void 0?` (${_l(y.type).en})`:""}, and the node has ${E.rejected.length===0?"no source for it":`only unsuitable sources for it: ${E.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`},severity:"error"})}}}}return n}s(TH,"checkNotificationBindings");function $H(e){return tN(e).map(t=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:t,severity:"error"}))}s($H,"checkAssignmentRules");function wC(e,t){let n=[...e.keys()].sort();return n.length===0?t==="de"?"(nichts)":"(nothing)":n.join(", ")}s(wC,"describeCandidates");function RH(e,t){return iN(e,t?.teamKeys).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(RH,"checkChannels");function IH(e){return rI(e).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(IH,"checkStaffInputs");function OH(e,t){let n=[];for(let r of e.nodes){let i=r.reads;if(i===void 0)continue;let o=`nodes.${r.id}.reads`,a={de:`Knoten \u201E${Oe(e,r.id,"de")}\u201C (${r.id})`,en:`Node "${Oe(e,r.id,"en")}" (${r.id})`},l=s(c=>{n.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!mN(r)){l({de:`[readiness/readsNotGated] ${a.de} (${r.type}) deklariert \`reads\`, aber die Bereitschaftspr\xFCfung h\xE4lt nur Entscheidungs-Knoten und Dokument-Knoten mit Produktion \u2014 hier w\xFCrde \`reads\` nichts bewirken.`,en:`[readiness/readsNotGated] ${a.en} (${r.type}) declares \`reads\`, but the readiness check only holds decision nodes and document nodes with production \u2014 here \`reads\` would have no effect.`});continue}if(!Array.isArray(i)){l({de:`[readiness/readsDuplicate] \`reads\` von ${a.de} muss eine Liste von Feldadressen sein, erhalten ${JSON.stringify(i)}.`,en:`[readiness/readsDuplicate] \`reads\` of ${a.en} must be a list of field addresses, got ${JSON.stringify(i)}.`});continue}let d=new Set;for(let c of i){if(!xe(c))continue;let u=pe(c);if(d.has(u)){l({de:`[readiness/readsDuplicate] ${a.de} liest ${je(e,c,"de")} mehrfach.`,en:`[readiness/readsDuplicate] ${a.en} reads ${je(e,c,"en")} more than once.`});continue}if(d.add(u),!ct(c)){l({de:`[readiness/readsUnknownField] ${a.de} liest ${je(e,c,"de")} \u2014 \`reads\` nennt nur Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[readiness/readsUnknownField] ${a.en} reads ${je(e,c,"en")} \u2014 \`reads\` only names fields of a form ($node.<form>.admission.<field>).`});continue}let p=ni(t,c);p!=null&&Ks("nodeReads",qs(p))==="repeated"&&l({de:`[readiness/readsUnknownField] ${a.de} liest ${je(e,c,"de")} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Feld der Anmeldung und kann nicht gelesen werden.`,en:`[readiness/readsUnknownField] ${a.en} reads ${je(e,c,"en")} \u2014 a field in a repeated group is not a single field of the application and cannot be read.`})}}return n}s(OH,"checkReadinessReads");function _H(e,t){let n=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=oO(r),o=bf(r);if(i===null||o===null)continue;let a=t?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${It.flagKey}`,reason:{de:`[setFlag/unknownFlag] Knoten \u201E${Oe(e,r.id,"de")}\u201C (${r.id}) setzt \u201E${o}\u201C, aber das Formular von \u201E${Oe(e,i,"de")}\u201C hat kein externes Merkmal dieses Namens`+(l.length>0?` (vorhanden: ${l.join(", ")}).`:" \u2014 es deklariert gar keins."),en:`[setFlag/unknownFlag] Node "${Oe(e,r.id,"en")}" (${r.id}) sets "${o}", but the form of "${Oe(e,i,"en")}" has no external flag of that name`+(l.length>0?` (present: ${l.join(", ")}).`:" \u2014 it declares none at all.")},severity:"error"})}return n}s(_H,"checkSetFlagKeys");function NH(e,t){let n=t?.readinessFormFieldsByFormNode,r=t?.readinessPartyConditionKeysByFormNode;if(n===void 0||r===void 0)return[];let i=[];for(let o of e.nodes){if(o.type!=="governedDocument"||o.production!=="resolver")continue;let a=o.form;if(!xe(a)||!wr(a))continue;let l=n.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=kw(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(y=>ct(y)&&y.owner===a.owner),h=kw(l,[...p.map(y=>y.path),...yN(o).filter(y=>y.owner===a.owner).map(y=>y.fieldKey)]),w=[...c].filter(y=>!h.has(y)).sort();if(w.length===0)continue;let k={de:Oe(e,a.owner,"de"),en:Oe(e,a.owner,"en")};i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.reads`,reason:{de:`[readiness/readsMissesPartyCondition] Knoten \u201E${Oe(e,o.id,"de")}\u201C (${o.id}) erzeugt ein Dokument, dessen Vertragsparteien von Angaben im Formular \u201E${k.de}\u201C abh\xE4ngen, die er weder liest noch bindet: ${w.join(", ")}. Eine Korrektur darauf h\xE4lt den Knoten nicht an und kann nach der Ausstellung eine Vertragspartei entfernen \u2014 die Felder (oder den berechneten Schl\xFCssel) aus \u201E${k.de}\u201C in \`reads\` erg\xE4nzen.`,en:`[readiness/readsMissesPartyCondition] Node "${Oe(e,o.id,"en")}" (${o.id}) generates a document whose contract parties depend on answers in the form "${k.en}" that it neither reads nor binds: ${w.join(", ")}. A correction to them does not hold the node and can remove a contract party after issuing \u2014 add the fields (or the computed key) from "${k.en}" to \`reads\`.`},severity:"warning"})}return i}s(NH,"checkReadinessPartyConditions");function Nw(e){let t=Object.keys(e.inputs??{});if(t.length===0)return[];let n=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(n?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(Us(e).map(l=>l.id));return t.filter(l=>!a.has(l))}s(Nw,"undeclaredInputKeys");function CH(e,t){return e.nodes.flatMap(n=>[...DH(e,n,Us(n),t),...PH(e,n,t)])}s(CH,"checkUnknownResources");function PH(e,t,n){let r=[],i=new Set((Ye(t).workItemTemplates?.(t)??[]).map(a=>a.key)),o=new Set((t.tasks??[]).filter(a=>a.familyRequest!==void 0).map(a=>String(a.key)));for(let a of Rf(t)){if(a.leaf==="assign{}"&&!i.has(a.owner)||a.leaf==="tasks[].assign.group"&&a.missing&&o.has(a.owner))continue;let l=Ls[a.leaf],d=`nodes.${t.id}.${a.path}`,c=s(h=>h==="de"?`Knoten \u201E${Oe(e,t.id,"de")}\u201C (${t.id}), ${l.what.de} \u201E${a.owner}\u201C`:`node "${Oe(e,t.id,"en")}" (${t.id}), ${l.what.en} "${a.owner}"`,"where");if(a.missing){if(!l.required){r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[inputs/emptyReference] ${c("de")}: der Eintrag ist leer oder kein Schl\xFCssel \u2014 ${l.consequence.de}. Team w\xE4hlen oder den Eintrag entfernen.`,en:`[inputs/emptyReference] ${c("en")}: the entry is empty or no key \u2014 ${l.consequence.en}. Choose a team or remove the entry.`}});continue}r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[workItems/needsTeam] ${c("de")}: kein Team gew\xE4hlt \u2014 ${l.consequence.de}. Jede Aufgabe geh\xF6rt der Warteschlange eines Teams.`,en:`[workItems/needsTeam] ${c("en")}: no team chosen \u2014 ${l.consequence.en}. Every task belongs to a team's queue.`}});continue}if(a.key===null)continue;let u=n?.teamKeys;if(u===void 0||u.has(a.key))continue;let p=[...u].sort().join(", ")||"\u2014";r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[inputs/unknownResource] ${c("de")}: \u201E${a.key}\u201C ist kein Team dieses Mandanten \u2014 ${l.consequence.de}. Teams: ${p}.`,en:`[inputs/unknownResource] ${c("en")}: "${a.key}" is no team of this school \u2014 ${l.consequence.en}. Teams: ${p}.`}})}return r}s(PH,"referenceIssues");function DH(e,t,n,r){let i=[];for(let o of n){if(!vf(o.type))continue;let a=Ps[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=t.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=Ps[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${Oe(e,t.id,"de")}\u201C (${t.id}) nennt im Eingang \u201E${o.label.de}\u201C ${c.de} \u201E${d.value}\u201C \u2014 diesen Schl\xFCssel kennt dieser Mandant nicht.`,en:`[inputs/unknownResource] Node "${Oe(e,t.id,"en")}" (${t.id}) names the ${c.en.toLowerCase()} "${d.value}" in its input "${o.label.en}", which does not exist in this school.`},severity:"error"})}return i}s(DH,"unknownResourceIssues");function FH(e){let t=[];for(let n of e.nodes)for(let r of Nw(n))t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${Oe(e,n.id,"de")}\u201C (${n.id}) hat einen Eingang \u201E${r}\u201C, den sein Typ nicht deklariert \u2014 ein Rest einer fr\xFCheren Einstellung (z. B. eines anderen Generators). Im Parameter-Bereich ist er nicht sichtbar; entfernen.`,en:`[inputs/undeclared] Node "${Oe(e,n.id,"en")}" (${n.id}) has an input "${r}" its type does not declare \u2014 a leftover of an earlier setting (e.g. another generator). It is not visible among the parameters; remove it.`},severity:"error"});return t}s(FH,"checkUndeclaredInputs");function LH(e){let t=[];for(let n of e.nodes){let r=new Set;for(let i of Us(n)){if(!r.has(i.id)){r.add(i.id);continue}t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${Oe(e,n.id,"de")}\u201C (${n.id}) hat den Eingang \u201E${i.id}\u201C zweimal \u2014 ein Parameter des Generators oder der Vorlage tr\xE4gt den Namen eines Eingangs des Knotentyps. Den Parameter umbenennen.`,en:`[inputs/duplicateSlot] Node "${Oe(e,n.id,"en")}" (${n.id}) has the input "${i.id}" twice \u2014 a parameter of the generator or template carries the name of an input of the node type. Rename the parameter.`},severity:"error"})}}return t}s(LH,"checkDuplicateSlots");function bC(e,t,n){let r=[],i=SH(e);if(i.length>0)return i;r.push(...lH(e)),r.push(...sH(e)),r.push(...dH(e)),r.push(...aH(e)),r.push(...rH(e)),r.push(...iH(e)),r.push(...oH(e)),r.push(...uH(e)),r.push(...WO(e,t)),r.push(...fH(e,t)),r.push(...pH(e,t)),r.push(...mH(e,t)),r.push(...vN(e,t?.layout)),r.push(...hH(e,t)),r.push(...gH(e,t)),r.push(...wH(e,t)),r.push(...MO(e,n)),r.push(...QO(e)),r.push(...n_(e)),r.push(...HO(e)),r.push(...JO(e)),r.push(...FH(e)),r.push(...CH(e,n)),r.push(...LH(e)),r.push(...kH(e)),r.push(...bH(e)),r.push(...qN(e,n)),r.push(...UN(e)),r.push(...VN(e)),r.push(...GN(e,n)),r.push(...HN(e,n)),r.push(...xH(e)),r.push(...TH(e,n)),r.push(...AH(e,n)),r.push(...$H(e)),r.push(...OH(e,n)),r.push(...NH(e,n)),r.push(..._H(e,n)),r.push(...RH(e,n)),r.push(...IH(e)),r.push(...yC(e));for(let o of e.nodes){let a=Ye(o);a.validate&&r.push(...a.validate(o,e,n))}return r}s(bC,"checkGraph");function MH(e,t){let n=e.requiresOneOf;if(n===void 0)return[];let r=`nodes.${e.id}.requiresOneOf`,i=s(d=>({layer:"GRAPH",kind:"nodeRule",path:r,reason:d,severity:"error"}),"issue");if(e.type!=="decision")return[i({de:`[decision/requiresOneOfNotDecision] Knoten "${e.id}" (Typ "${e.type}") tr\xE4gt 'requiresOneOf' \u2014 die Regel gilt nur an Entscheidungsknoten (decision).`,en:`[decision/requiresOneOfNotDecision] Node "${e.id}" (type "${e.type}") carries 'requiresOneOf' \u2014 the rule only applies to decision nodes (decision).`})];if(!Array.isArray(n)||n.length===0||n.some(d=>typeof d!="string"||d.length===0))return[i({de:`[decision/requiresOneOfEmpty] 'requiresOneOf' an Knoten "${e.id}" muss eine nicht-leere Liste von Aktions-Keys sein \u2014 sonst Feld weglassen.`,en:`[decision/requiresOneOfEmpty] 'requiresOneOf' on node "${e.id}" must be a non-empty list of action keys \u2014 otherwise omit the field.`})];let o=t.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of n){if(l.has(d)){a.push(i({de:`[decision/requiresOneOfDuplicate] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}" doppelt.`,en:`[decision/requiresOneOfDuplicate] 'requiresOneOf' on node "${e.id}" names "${d}" twice.`}));continue}l.add(d),o.includes(d)||a.push(i({de:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}", aber dieser Knoten hat keine optionale Aktion mit diesem Key \u2014 die Regel w\xE4re nie erf\xFCllbar. `+(o.length===0?"Der Knoten hat keine optionalen Aktionen.":`Optionale Aktionen dieses Knotens: ${o.join(", ")}.`),en:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' on node "${e.id}" names "${d}", but this node has no optional action with that key \u2014 the rule could never be met. `+(o.length===0?"The node has no optional actions.":`Optional actions of this node: ${o.join(", ")}.`)}))}return a}s(MH,"checkRequiresOneOf");function qH(e){return e.nodes.flatMap(t=>Nw(t).map(n=>({nodeId:t.id,key:n,binding:t.inputs?.[n]?.kind==="binding"})))}s(qH,"undeclaredInputCells");function vC(e,t){let n=qH(e).filter(o=>t.bindings||!o.binding);if(n.length===0)return{graph:e,dropped:n};let r=new Map;for(let o of n)r.set(o.nodeId,(r.get(o.nodeId)??new Set).add(o.key));let i=e.nodes.map(o=>{let a=r.get(String(o.id));if(a===void 0)return o;let l=Object.fromEntries(Object.entries(o.inputs).filter(([d])=>!a.has(d)));return{...o,inputs:l}});return{graph:{...e,nodes:i},dropped:n}}s(vC,"dropUndeclaredInputs");function Cw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Cw,"isObject");function xC(e){return Cw(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(xC,"oldShape");function SC(e){return(e?.nodes??[]).some(xC)}s(SC,"needsTemplateStampMove");function KH(e){let t=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(t)?t:null;let n=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(n)?n:null}s(KH,"stampedFields");function jH(e){let t=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:t,reason:"templateAndStamp"}};let n={...e},r=[];if("template"in e){let{template:i}=e;if(delete n.template,Cw(i))n.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:t,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete n.cockpitFields;let o=Cw(e.inputs)?{...e.inputs}:{},a=KH(n);if(a===null&&i.length>0)return{unmoved:{nodeId:t,key:i[0],reason:"noStamp"}};for(let l of i){let d=l in o&&o[l]?.kind!=="unset",c=(a??[]).find(u=>u.key===l);if(c===void 0)r.push({nodeId:t,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:t,key:l,reason:"processSource"}):d?r.push({nodeId:t,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}n.inputs=o}return{node:n,reports:r}}s(jH,"moveNode");function AC(e){let t=[],n=[],r=[],i=e.nodes.map(o=>{if(!xC(o))return o;let a=jH(o);return"unmoved"in a?(r.push(a.unmoved),o):(t.push(String(o.id)),n.push(...a.reports),a.node)});return t.length===0?{graph:e,moved:t,reports:n,unmoved:r}:{graph:{...e,nodes:i},moved:t,reports:n,unmoved:r}}s(AC,"moveTemplateStampAndCockpit");var EC=tf,VH="applicant.applicationSubmitted";function kp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(kp,"isObject");function TC(e){return kp(e)&&e.type==="form"&&typeof e.id=="string"&&!kn(e)}s(TC,"isCreatingFormNode");function BH(e){return kp(e.notifications)&&EC in e.notifications}s(BH,"hasSubmittedBinding");function Pw(e){let t={toBind:[],alreadyBound:[],malformed:[]};for(let n of e?.nodes??[])TC(n)&&(n.notifications!==void 0&&!kp(n.notifications)?t.malformed.push(n.id):BH(n)?t.alreadyBound.push(n.id):t.toBind.push(n.id));return t}s(Pw,"submitReceiptInventory");function $C(e){let{toBind:t}=Pw(e);if(t.length===0)return{graph:e,bound:[]};let n=new Set(t),r=e.nodes.map(i=>{if(!TC(i)||!n.has(i.id))return i;let o=kp(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[EC]:{templateId:VH}}}});return{graph:{...e,nodes:r},bound:t}}s($C,"bindSubmitReceipt");var Fo=["park","advance"],tr="whenNothingOwed",RC={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function IC(e){let t=e.inputs?.[tr],n=t?.kind==="literal"?t.value:void 0;return Dw(n)?n:null}s(IC,"reviewModeOrNull");function Dw(e){return Fo.includes(e)}s(Dw,"isReviewMode");function Fw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Fw,"isObject");function OC(e){return Fw(e)&&e.type==="review"&&!(Fw(e.inputs)&&tr in e.inputs)}s(OC,"lacksMode");function _C(e){return(e?.nodes??[]).some(OC)}s(_C,"needsReviewMode");function NC(e){let t=[],n=e.nodes.map(r=>{if(!OC(r))return r;t.push(r.id);let i=Fw(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[tr]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:n},set:t}}s(NC,"setReviewModePark");function bp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(bp,"isObject");function CC(e){let{notifications:t,bound:n}=Vf(e.notifications,{tasks:[]},e);return{next:t,bound:n}}s(CC,"bindingsFor");function PC(e){let t={toBind:[],malformed:[]};for(let n of e?.nodes??[])if(!(!bp(n)||typeof n.id!="string"||Hs(n).length===0)){if(n.notifications!==void 0&&!bp(n.notifications)){t.malformed.push(n.id);continue}for(let r of CC(n).bound)t.toBind.push(`${n.id}.${r}`)}return t}s(PC,"appointmentLetterInventory");function DC(e){let t=[],n=!1,r=e.nodes.map(i=>{if(!bp(i)||typeof i.id!="string"||Hs(i).length===0||i.notifications!==void 0&&!bp(i.notifications))return i;let{next:o,bound:a}=CC(i);return a.length===0?i:(n=!0,t.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return n?{graph:{...e,nodes:r},bound:t}:{graph:e,bound:[]}}s(DC,"bindAppointmentLetters");function ca(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ca,"isObject");var FC=["id","label","dataFlow"],LC=["audience","populates","stages","expectedOutcomes"];function MC(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(t=>ca(t)&&typeof t.slot=="string")}s(MC,"carriesStringSlots");function qC(e){return(e.nodes??[]).some(t=>ca(t)&&t.type==="form"&&LC.some(n=>n in t))}s(qC,"carriesRetiredFormNodeKey");var UH=[{key:"generatorPin",editor:!0,holds:RI,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:cO,what:{de:"Formular und Merkmal eines \u201EFlag setzen\u201C-Knotens als Eigenschaften",en:'form and flag of a "Set flag" node as properties'}},{key:"scalarProperties",editor:!0,holds:gO,what:{de:"Einstellungen eines Knotens als Eigenschaften statt als Eing\xE4nge",en:"a node's settings as properties instead of inputs"}},{key:"nodeConfigProperties",editor:!0,holds:AO,what:{de:"Hinweis einer Zahlung als Eigenschaft oder ein entferntes Muster-Dokument",en:"a payment's note as a property, or a removed sample document"}},{key:"outcomeWithoutSemantic",editor:!0,holds:wI,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:xI,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:SC,what:{de:"Parameter einer Vorlage am Knoten oder Cockpit-Felder als Liste",en:"a template's parameters on the node, or cockpit fields as a list"}},{key:"reviewWithoutMode",editor:!0,holds:_C,what:{de:"Pr\xFCfknoten ohne \u201EWenn nichts zu pr\xFCfen ist\u201C",en:'review nodes without "When nothing is owed"'}},{key:"taskAssignUser",editor:!1,holds:s(e=>$f(e).length>0,"holds"),what:{de:"eine Aufgabe mit fester Person (`assign.userId`)",en:"a task with a fixed person (`assign.userId`)"}},{key:"retiredGraphKey",editor:!1,holds:s(e=>FC.some(t=>t in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:MC,what:{de:"Zust\xE4ndigkeitsregeln mit Slot als Text (`responsible` / `team:<Schl\xFCssel>`)",en:"assignment rules with a slot as text (`responsible` / `team:<key>`)"}},{key:"retiredFormNodeKey",editor:!1,holds:qC,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function KC(e){if(!ca(e)||!Array.isArray(e.nodes))return[];let t=e;return UH.filter(n=>n.holds(t)).map(({key:n,what:r,editor:i})=>({key:n,what:r,editor:i}))}s(KC,"legacyGraphShapes");function jC(e,t){let n=t.answers??{},r=[],i=[],o=e,a=FC.filter($=>$ in o);if(a.length>0){let $={...o};for(let b of a)delete $[b],r.push({message:`graph.${b}: deleted (read by nothing)`});o=$}if(qC(o)&&(o={...o,nodes:o.nodes.map($=>{if(!ca($)||$.type!=="form")return $;let b=LC.filter(q=>q in $);if(b.length===0)return $;let R={...$};for(let q of b)delete R[q];return r.push({nodeId:String($.id),message:`form node: deleted ${b.map(q=>`\`${q}\``).join(", ")} (read by nothing)`}),R})}),MC(o)){let $=o.assignmentRules.map((b,R)=>{if(!ca(b)||typeof b.slot!="string")return b;let q=mf(b.slot);return q===null?(i.push({code:"assignment/slotUnknown",answer:"edit",message:`assignmentRules[${R}].slot "${b.slot}" is neither \`responsible\` nor \`team:<key>\` \u2014 edit it by hand`}),b):(r.push({message:`assignmentRules[${R}].slot "${b.slot}" \u2192 ${JSON.stringify(q)}`}),{...b,slot:q})});o={...o,assignmentRules:$}}let l=II(o);o=l.graph;for(let $ of l.moved)r.push({nodeId:$,message:"generator / template pin moved into its input"});for(let $ of l.unmoved)i.push({code:`generatorPin/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${$.reason}) \u2014 edit the node by hand`});let d=uO(o);o=d.graph;for(let $ of d.moved)r.push({nodeId:$,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let $ of d.unmoved)i.push({code:`setFlag/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${$.reason}) \u2014 edit the node by hand`});let c=yO(o);o=c.graph;for(let $ of c.moved)r.push({nodeId:$,message:"scalar settings moved into inputs"});for(let $ of c.unmoved)i.push({code:`scalar/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let u=EO(o);o=u.graph;for(let $ of u.moved)r.push({nodeId:$,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let $ of u.unmoved)i.push({code:`nodeConfig/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let p=AC(o);o=p.graph;for(let $ of p.moved){let b=o.nodes.find(_=>ca(_)&&_.id===$),R=b?.inputs?.documentTemplate,q=R?.kind==="literal"&&typeof R.value=="string"?R.value:null;r.push({nodeId:$,message:b!==void 0&&"templateStamp"in b&&q!==null?`template parameters moved onto \`templateStamp\` / cockpit list into cells \u2014 the record \`${q}\` must declare the same parameters (tenant catalog \`documentTemplates[].parameters\` / \`templates:setParameters\`) before publish, else [governedDocument/templateWithoutParameters]`:"cockpit list moved into `{ kind: 'cockpit' }` cells"})}for(let $ of p.reports)r.push({nodeId:$.nodeId,message:`cockpit field \`${$.key??""}\` deleted (${$.reason}: ${$.reason==="unknownKey"?"the stamp declares no such parameter":$.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let $ of p.unmoved)i.push({code:`templateStamp/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.reason==="noStamp"?"the cockpit list cannot be judged: the node carries no parameter stamp \u2014 run `offer workflow restamp-pins` against the environment, then upgrade again":$.reason==="templateAndStamp"?"the node carries both `template` and `templateStamp` \u2014 delete one by hand":"`template` is no object \u2014 edit the node by hand"});let h=SI(o);o=h.graph;for(let $ of h.moved)r.push({nodeId:$,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let $ of h.unmoved)i.push({code:`eventTrigger/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${$.reason}) \u2014 edit the node by hand`});let w=kI(o,n.semantics);o=w.graph;for(let $ of w.written){if($.source==="formerDefault"){r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,value:$.semantic}});continue}r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (${$.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let $ of w.refused)i.push({code:$.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:$.nodeId,answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,candidates:$.allowed,message:$.answer===void 0?`${$.nodeType} outcome \`${$.outcomeId}\` ran as "${py($.outcomeId)??""}", which a ${$.nodeType} outcome may no longer carry \u2014 say which one it is`:`${$.nodeType} outcome \`${$.outcomeId}\`: "${$.answer}" is not a meaning a ${$.nodeType} outcome may carry`});for(let $ of w.invalid)i.push({code:"outcome/semanticInvalid",nodeId:$.nodeId,answer:"edit",candidates:wn,message:`outcome \`${$.outcomeId}\` carries the semantic "${$.value}", which is no meaning \u2014 edit it`});let k=TI(o,t.selection,n.waitlistPolicy);o=k.graph;for(let $ of k.moved){let b=$.policy.waitlistOrder;r.push({nodeId:$.nodeId,message:`waitlist policy into inputs: ${GH($.policy)} (${$.source==="answer"?"answered":$.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...$.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:$.nodeId,value:b}}:{}})}for(let $ of k.refused)i.push({code:`waitlist/${$.reason}`,nodeId:$.nodeId,answer:"waitlistPolicy",answerKey:$.nodeId,candidates:Hn,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});if($O(o)){let $=RO(o,n.payee);o=$.graph;for(let b of $.set)r.push({nodeId:b.nodeId,message:`online payment: payee "${b.payee}" (answered)`});for(let b of $.refused)i.push({code:"collectPayment/payeeMissing",nodeId:b,answer:"payee",answerKey:b,message:"an online payment names the Tr\xE4ger its money goes to \u2014 say its key (a `legal_entities.configKey` of the tenant)"})}for(let $ of Pw(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:$,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let y=$C(o);o=y.graph;for(let $ of y.bound)r.push({nodeId:$,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let v=NC(o);o=v.graph;for(let $ of v.set)r.push({nodeId:$,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let $ of PC(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:$,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let A=DC(o);o=A.graph;for(let $ of A.bound){let b=$.indexOf(".");r.push({nodeId:$.slice(0,b),message:`appointment letter bound to \`notifications.${$.slice(b+1)}\` (the standard letter, sent by code before)`})}let E=$f(o).filter($=>!$.hasTeam);for(let $ of E)i.push({code:"task/userWithoutTeam",nodeId:$.nodeId,answer:"edit",message:`task \`${$.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let I=IO(o);o=I.graph;for(let $ of I.dropped.filter(b=>b.hasTeam))r.push({nodeId:$.nodeId,message:`task \`${$.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let C=vC(o,{bindings:!0});o=C.graph;for(let $ of C.dropped){if(!$.binding){r.push({nodeId:$.nodeId,message:`input \`${$.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:$.nodeId,message:`input \`${$.key}\` deleted (DEFAULT \u2014 a binding no slot declares: no slot handed its value to the node, but the readiness gate waited for it; the node no longer waits for that value)`,defaulted:{answer:"undeclaredBinding",answerKey:`${$.nodeId}.${$.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(jC,"upgradeGraph");function GH(e){return`waitlistOrder=${e.waitlistOrder}`}s(GH,"formatPolicy");function ci(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ci,"isObject");var VC="admission.generic",BC=Object.keys(uf).filter(e=>e!=="label");function UC(e){return ci(e.smartforms)?Object.entries(e.smartforms):[]}s(UC,"smartformEntries");function zH(e){let t=[];UC(e.index).some(([,i])=>ci(i)&&"outcomeFnRef"in i)&&t.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let n=Object.keys(e.manifest).filter(i=>Object.hasOwn(yl,i));if(n.length>0){let i=n.map(o=>`\`${o}\``).join(", ");t.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>BC.some(o=>o in i))&&t.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"});let r=e.workflow;return r!==void 0&&(ci(r.progressWiring)&&"layoutId"in r.progressWiring&&t.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),t.push(...KC(r.graph).map(i=>i.what))),t}s(zH,"legacyBundleShapes");function xp(e,t){let n=zH(e);n.length!==0&&ae("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${t} stammt aus einem \xE4lteren Bundle-Format (${n.map(r=>r.de).join("; ")}). Zuerst \`plexus-cli offer upgrade --dir <Bundle>\` ausf\xFChren (Probelauf, beantwortet die offenen Fragen), dann mit \`--write\` schreiben und erneut pr\xFCfen.`,en:`offer: ${t} is in an older bundle format (${n.map(r=>r.en).join("; ")}). Run \`plexus-cli offer upgrade --dir <bundle>\` first (a dry run that asks what it cannot decide), then write with \`--write\` and validate again.`})}s(xp,"assertBundleCurrent");function vp(e){let t=s(n=>Array.isArray(n)?n.map(t):ci(n)?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(vp,"canonical");function GC(e,t={}){let n=[],r=[],i=e.index,o=UC(i);if(o.some(([,u])=>ci(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!ci(h)||Object.keys(h).length===0){u[p]=h;continue}let{outcomeFnRef:w,...k}=h;if(Object.keys(k).length>0||w!==void 0&&w!==VC){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(y=>`\`${y}\``).join(", ")} \u2014 only \`outcomeFnRef: ${VC}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}n.push({file:"bundle.yaml",message:`smartforms.${p}.outcomeFnRef deleted (a form routes by its own declared outcomes)`}),u[p]={}}i={...i,smartforms:u}}let a={},l=e.workflow,d;for(let[u,p]of Object.entries(e.manifest)){if(u==="selection"){d=p,n.push({file:"manifest.json",message:"`selection` deleted (its queue policy goes to the waitlist node's inputs; release strategy and deadline were read by nothing)"});continue}if(u==="progressLayout"){l===void 0?n.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},n.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):vp(l.progressLayout)===vp(p)?n.push({file:"manifest.json",message:"`progressLayout` deleted (workflow.json carries the same layout)"}):(r.push({file:"manifest.json",code:"manifest/progressLayoutTwice",answer:"edit",message:"`progressLayout` differs from workflow.json `progressLayout` \u2014 keep one by hand"}),a[u]=p);continue}let h=Object.hasOwn(yl,u)?yl[u]:void 0;if(h===void 0){r.push({file:"manifest.json",code:"manifest/unknownKey",answer:"edit",message:`unknown key \`${u}\` \u2014 manifest.json carries no key; decide by hand where it belongs`}),a[u]=p;continue}n.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(ci(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},n.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(ci(u)&&Array.isArray(u.nodes)){let p=jC(u,{selection:d,answers:t});l={...l,graph:p.graph},n.push(...p.changes.map(h=>({...h,file:"workflow.json"}))),r.push(...p.refusals.map(h=>({...h,file:"workflow.json"})))}else r.push({file:"workflow.json",code:"workflow/graphShape",answer:"edit",message:"`graph` is no object with a node list"})}let c=e.smartforms;if(c!==void 0){let u={};for(let[p,h]of Object.entries(c)){let w={...h},k=`smartforms/${p}.json`;for(let y of BC)if(y in h){if(y==="outcomeIds"){let v=Array.isArray(h.outcomes)?h.outcomes.map(A=>ci(A)?A.id:void 0):[];if(vp([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==vp(v.map(String).sort())){r.push({file:k,code:"smartform/outcomeIdsDiffer",answer:"edit",message:"`outcomeIds` differs from the ids of `outcomes[]` \u2014 reconcile them by hand"});continue}}delete w[y],n.push({file:k,message:`\`${y}\` deleted (${uf[y].en})`})}u[p]=w}c=u}return{bundle:{index:i,manifest:a,...c!==void 0?{smartforms:c}:{},...l!==void 0?{workflow:l}:{}},changes:n,refusals:r}}s(GC,"upgradeOfferBundle");var WH={createManifest:x.workflow.createManifest,publishManifest:x.workflow.publishManifest,publishOfferInternal:x.workflow.publishOfferInternal,publishOfferExternal:x.workflow.publishOfferExternal,getOfferPublishState:x.workflow.getOfferPublishState,upsertCustomField:x.admission.upsertCustomField,upsertDerivedAttributeRule:x.admission.upsertDerivedAttributeRule,createSmartForm:x.forms.createSmartForm,getSmartFormBySlug:x.forms.getSmartFormBySlug,saveSmartFormDraft:x.forms.saveSmartFormDraft,publishSmartForm:x.forms.publishSmartForm,createWorkflow:x.workflow.createWorkflow,getWorkflowGraph:x.workflow.getWorkflowGraph,saveWorkflowDraft:x.workflow.saveWorkflowDraft,publishWorkflow:x.workflow.publishWorkflow},Bye={createManifest:Xt.workflow.createManifestInternal,publishManifest:Xt.workflow.publishManifestInternal,publishOfferInternal:Xt.workflow.publishOfferInternalInternal,publishOfferExternal:Xt.workflow.publishOfferExternalInternal,getOfferPublishState:Xt.workflow.getOfferPublishStateInternal,upsertCustomField:Xt.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:Xt.admission.upsertDerivedAttributeRuleInternal,createSmartForm:Xt.forms.createSmartFormInternal,getSmartFormBySlug:Xt.forms.getSmartFormBySlugInternal,saveSmartFormDraft:Xt.forms.saveSmartFormDraftInternal,publishSmartForm:Xt.forms.publishSmartFormInternal,createWorkflow:Xt.workflow.createWorkflowInternal,getWorkflowGraph:Xt.workflow.getWorkflowGraphInternal,saveWorkflowDraft:Xt.workflow.saveWorkflowDraftInternal,publishWorkflow:Xt.workflow.publishWorkflowInternal};function Lw(e,t){for(let[n,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&ae("INVALID",{de:`offer: ${t}: smartforms.${n} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${t}: smartforms.${n} must be an empty mapping ({}).`});let i=Object.keys(r);if(i.length===0)continue;let o=i.map(l=>`\`${l}\``).join(", "),a=i.includes("outcomeFnRef");ae("INVALID",{de:`offer: ${t}: smartforms.${n} enth\xE4lt unbekannte Schl\xFCssel ${o} \u2014 der Eintrag muss leer sein ({}).${a?" `outcomeFnRef` geh\xF6rt nicht mehr zum Bundle-Format: ein Formular entscheidet \xFCber seine eigenen Ergebnisse. Die Zeile l\xF6schen.":""}`,en:`offer: ${t}: smartforms.${n} carries unknown key(s) ${o} \u2014 the entry must be empty ({}).${a?" `outcomeFnRef` is no longer part of the bundle format: a form routes by its own declared outcomes. Delete the line.":""}`})}}s(Lw,"assertSmartformEntries");function zC(e){let t=s(n=>Array.isArray(n)?n.map(t):n&&typeof n=="object"?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(zC,"canonicalJson");function WC(e,t){return t==null?!0:zC(e)!==zC(t)}s(WC,"changed");async function YC(e,t,n,r={},i=WH){let{index:o}=t;xp({index:o,manifest:t.manifest,...t.smartforms!==void 0?{smartforms:t.smartforms}:{},...t.workflow!==void 0?{workflow:t.workflow}:{}},`bundle of ${o.slugs.manifest}`),Lw(o,`bundle of ${o.slugs.manifest}`);let a=cf(t.manifest);a.length>0&&ae("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11203
11203
|
- ${a.join(`
|
|
11204
11204
|
- `)}`,en:`offer: manifest.json of ${o.slugs.manifest} is invalid:
|
|
11205
11205
|
- ${a.join(`
|
|
@@ -11465,6 +11465,6 @@ ${n.length} unusable ${o}:
|
|
|
11465
11465
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11466
11466
|
`),i.length>0&&this.context.stdout.write(` ${i.length} without any login account \u2014 plexus-cli platform users provision --tenant <slug> --email <email> --name <name>
|
|
11467
11467
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11468
|
-
`);return n.length>0?1:0}},GE=class extends cr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let n=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function bV(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(bV,"requireOnOff");var vV=[RE,IE,OE,_E,NE,CE,PE,DE,FE,LE,ru,ME,qE,KE,jE,VE,BE,UE,GE];function xV(e){return e.de??e.en??Object.values(e)[0]??""}s(xV,"titleDe");function JZ(e){return{id:e._id,kind:e.kind,status:e.status,title:xV(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(JZ,"row");var QZ=["id","kind","status","title","assignee","group","outcome"],YE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(JZ),QZ),0}},HE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:xV(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},JE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},QE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},ZE=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},SV=[YE,HE,JE,QE,ZE];var iu=[...NR,...OP,...jP,...BD,...VD,...hF,...xF,...vF,...wV,...vV,...yV,...rj,...dj,...mP,...uF,...sV,...OR,...iI,...XC,...EF,...AF,...RF,...IF,...dF,...HD,...SV,...ZM,...jq,...tj,...Vq,...Bj,...Qj,...cj,...kj,...xj,...Tj,...Rj,...eV,...cV,...YR];for(let e of iu){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:XT(e.usage.category,t.join(" "))})}var AV="0.1.148";function EV(){return iu.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=HT[so(n)];return{path:n,effect:ao(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(EV,"plexusCommandCatalog");import rs from"node:path";function ZZ(e){let t=at()?.workspaceRoot??process.cwd(),n=rs.resolve(t,e),r=rs.relative(t,n);if(rs.isAbsolute(e)||r===".."||r.startsWith(`..${rs.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(ZZ,"workspacePath");function XZ(e){let{absolute:t,relative:n}=ZZ(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of Rr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=rs.join(o,a.name);if(a.isDirectory()?i(l):r.push(rs.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return Ge(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Dt(rs.dirname(t),{recursive:!0}),Ge(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return as(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(XZ,"plexusWorkspace");function TV(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=pl[n];if(!o||!Object.hasOwn(pl,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(Gg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Gg[i.path],skillHash:Zu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return XZ(i)},"executePlexusAgentTool")}s(TV,"createPlexusAgentToolExecutor");var Oh=TV({inspectCommand:RV,executeCommand:IV});function _h(){let e=new us({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:AV});e.register(Ja.HelpCommand),e.register(Ja.VersionCommand);for(let n of iu)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return n9(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(_h,"createPlexusCli");function n9(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&tl[n]===r&&ot(t,n,r),n in tl&&ao(n)==="confirm"&&!nl(e)&&t.write(`plexus-cli: \`${tl[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11468
|
+
`);return n.length>0?1:0}},GE=class extends cr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let n=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function bV(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(bV,"requireOnOff");var vV=[RE,IE,OE,_E,NE,CE,PE,DE,FE,LE,ru,ME,qE,KE,jE,VE,BE,UE,GE];function xV(e){return e.de??e.en??Object.values(e)[0]??""}s(xV,"titleDe");function JZ(e){return{id:e._id,kind:e.kind,status:e.status,title:xV(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(JZ,"row");var QZ=["id","kind","status","title","assignee","group","outcome"],YE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(JZ),QZ),0}},HE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:xV(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},JE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},QE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},ZE=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},SV=[YE,HE,JE,QE,ZE];var iu=[...NR,...OP,...jP,...BD,...VD,...hF,...xF,...vF,...wV,...vV,...yV,...rj,...dj,...mP,...uF,...sV,...OR,...iI,...XC,...EF,...AF,...RF,...IF,...dF,...HD,...SV,...ZM,...jq,...tj,...Vq,...Bj,...Qj,...cj,...kj,...xj,...Tj,...Rj,...eV,...cV,...YR];for(let e of iu){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:XT(e.usage.category,t.join(" "))})}var AV="0.1.150";function EV(){return iu.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=HT[so(n)];return{path:n,effect:ao(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(EV,"plexusCommandCatalog");import rs from"node:path";function ZZ(e){let t=at()?.workspaceRoot??process.cwd(),n=rs.resolve(t,e),r=rs.relative(t,n);if(rs.isAbsolute(e)||r===".."||r.startsWith(`..${rs.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(ZZ,"workspacePath");function XZ(e){let{absolute:t,relative:n}=ZZ(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of Rr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=rs.join(o,a.name);if(a.isDirectory()?i(l):r.push(rs.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return Ge(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Dt(rs.dirname(t),{recursive:!0}),Ge(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return as(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(XZ,"plexusWorkspace");function TV(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=pl[n];if(!o||!Object.hasOwn(pl,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(Gg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Gg[i.path],skillHash:Zu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return XZ(i)},"executePlexusAgentTool")}s(TV,"createPlexusAgentToolExecutor");var Oh=TV({inspectCommand:RV,executeCommand:IV});function _h(){let e=new us({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:AV});e.register(Ja.HelpCommand),e.register(Ja.VersionCommand);for(let n of iu)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return n9(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(_h,"createPlexusCli");function n9(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&tl[n]===r&&ot(t,n,r),n in tl&&ao(n)==="confirm"&&!nl(e)&&t.write(`plexus-cli: \`${tl[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11469
11469
|
`)}s(n9,"noteRetiredPath");function RV(e){let t=_h().process(ja(e),{executePlexusAgentTool:Oh}),n=t.path.join(" ");if(n.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=EV().find(l=>l.path===n);if(!r){if(n===""||n==="--help"||n==="--version")return{path:n,writes:!1,host:"shared"};throw new Error(`plexus: command ${n} has no host classification.`)}let i=t,o=r.effect==="callKind"?tm(ba(va),i.fn??"",i.kind):void 0,a=qu(n,{confirm:nl(t),callKind:o});return{...r,writes:a}}s(RV,"inspectPlexusCommand");async function IV(e,t){if(t)return tT(t,()=>IV(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let n="",r="",i=_h();if(at()){let l=RV(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(ja(e.argv),{executePlexusAgentTool:Oh,stdin:t9.from(e.stdin===void 0?[]:[e.stdin]),stdout:new $V({write(l,d,c){n+=String(l),c()}}),stderr:new $V({write(l,d,c){r+=String(l),c()}})}),stdout:n,stderr:r}}s(IV,"executePlexusCommand");sT({source:r9.join(import.meta.dirname,"skill")});_h().runExit(ja(process.argv.slice(2)),{executePlexusAgentTool:Oh});
|
|
11470
11470
|
//# sourceMappingURL=cli.mjs.map
|