@smartkomm/plexus-cli 0.1.242 → 0.1.243
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/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -11370,7 +11370,7 @@ The link is valid for {{gueltigkeit}} and works once. Afterwards you are signed
|
|
|
11370
11370
|
|
|
11371
11371
|
{{einstellungenLink}}`,en:`Open Plexus and, in the user menu, \u201CSettings\u201D \u2192 \u201CSignature\u201D:
|
|
11372
11372
|
|
|
11373
|
-
{{einstellungenLink}}`}}]},xk=[NY,qY,VY,BY,UY,HY,YY,xH,AH,DH,LH,qH,VH,GH,WH,JH,XH,tJ,iJ,EH,TH,$H,oJ,sJ,aJ,JY,QY,eH,nH,iH,dH,fH,sH,hH,bH,PH,TJ,RJ,DY,LY,dJ,uJ,pJ,hJ,yJ,kJ,vJ];function Sk(e){let n=xk.find(t=>t.id===e);return n===void 0&&F(`notifications: unknown letter "${e}"`),n}s(Sk,"letterDefFor");function Ak(e){return xk.some(n=>n.id===e)}s(Ak,"hasLetterDef");function Ek(e,n){return n===void 0?!0:Op(e,n)}s(Ek,"letterArgCompatible");function ud(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${dt(e)} (${e})`,en:`${dt(e)} (${e})`}}s(ud,"letterArgTypeLabel");function IN(e){let n=new Map,t=s((r,i)=>{let o=n.get(r);o===void 0?n.set(r,[i]):o.push(i)},"add");for(let r of e.args)t(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of mN)t(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return n}s(IN,"eventArgSources");function ON(e,n){let t=e.type===void 0?[...n]:n.filter(r=>Ek(r.type,e.type));if(t.length>1)return{status:"ambiguous",matches:t};if(t.length===1){let r=t[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...n]}:{status:"unused"}}s(ON,"resolveLetterParam");var Tk=["booked","rescheduled","cancelled"],IJ={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},PN=":";function NN(e,n){return`${e}${PN}${n}`}s(NN,"appointmentEventId");function OJ(e){let n=e.lastIndexOf(PN);if(n<=0)return null;let t=e.slice(n+1);return Tk.includes(t)?{taskKey:e.slice(0,n),kind:t}:null}s(OJ,"parseAppointmentEventId");var _N={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function ka(e){return Array.isArray(e.tasks)?e.tasks.filter(n=>typeof n?.key=="string"&&n.result?.kind==="appointment"):[]}s(ka,"appointmentTasksOf");function _J(e){return Tk.map(n=>({id:NN(e.key,n),label:{de:`${_N[n].de} \u2013 \u201E${e.title.de}\u201C`,en:`${_N[n].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(_J,"appointmentTaskEvents");function CN(e,n){let t=n.notificationEvents?.(e)??[],r=ka(e).flatMap(_J);return r.length===0?t:[...t,...r]}s(CN,"nodeNotificationEvents");function PJ(e){return Object.fromEntries(Tk.map(n=>[NN(e,n),{templateId:IJ[n]}]))}s(PJ,"defaultAppointmentBindings");function NJ(e,n){if(e===void 0)return{notifications:e,dropped:[]};let t=[],r={};for(let[i,o]of Object.entries(e))OJ(i)?.taskKey===n?t.push(i):r[i]=o;return t.length===0?{notifications:e,dropped:t}:{notifications:Object.keys(r).length===0?void 0:r,dropped:t}}s(NJ,"withoutAppointmentBindings");function rm(e,n,t){let r=new Set(ka(n).map(d=>d.key)),i=new Set(ka(t).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=NJ(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(PJ(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(rm,"syncAppointmentBindings");function CJ(e){return e.kind==="task"&&!("title"in e)}s(CJ,"isLegacyFreeTodoContext");function $k(e){let{context:n}=e;if(CJ(n)&&F(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),n.kind==="task")return{...e,context:n,kind:"task",createdVia:"human",partyId:n.partyId};let{anchor:t,task:r,kind:i,title:o,description:a,...l}=n,d=t.scope==="node"?{nodeId:t.nodeId,templateKey:t.templateKey,gatesNode:t.gatesNode,blocks:t.blocks}:t.scope==="application"?{scope:"application",templateKey:t.templateKey}:t.scope==="crossNode"?{scope:"application",nodeId:t.nodeId,templateKey:t.templateKey,blocks:t.blocks}:{};return{...e,context:n,...l,...d,...r??{},kind:i}}s($k,"readWorkItem");async function ba(e,n){let t;if(n.nodeId!==void 0){let r=n.nodeId;t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(n.isOpen!==void 0){let r=n.isOpen;t=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",n.applicationId).eq("isOpen",r)).collect()}else t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",n.applicationId)).collect();return t.filter(r=>n.isOpen===void 0||r.isOpen===n.isOpen).map($k)}s(ba,"listWorkItemsForApplication");var vye=m.union(m.literal("approved"),m.literal("rejected")),fd=new Set(["task","approval"]);function FJ(e,n){switch(e){case"task":return n?.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:n?.gatesNode??!0};default:F(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...fd].join(", ")}`)}}s(FJ,"expandComposedTask");for(let e of["task","approval"]){let n=FJ(e);n.kind==="approval"!=(n.isApproval===!0)&&F(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var DN=zi,to=`${DN}.`,LJ=new Set(["text","number","date","boolean","option","edge"]);function im(e,n){let t=e[n];return t===void 0&&F(`[env/unknownKey] no environment key '${n}'`),typeof t=="string"?null:Object.keys(t)}s(im,"contextFields");function FN(e,n){return Object.hasOwn(e,n)}s(FN,"isContextKey");function LN(e){let n=[];for(let t of Object.keys(e)){let r=im(e,t);if(r===null)n.push(t);else for(let i of r)n.push(`${t}.${i}`)}return n}s(LN,"leafPaths");function pd(e,n){let[t="",r,...i]=n.split(".");if(!FN(e,t)||i.length>0)return;let o=e[t];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s(pd,"leafType");function MN(e){let n=new Set;for(let t of e){let r=va(t);r!==null&&n.add(r.split(".")[0])}return[...n]}s(MN,"contextKeysOf");function va(e){return e.startsWith(to)?e.slice(to.length):null}s(va,"contextPathOf");function md(e){return e===DN||e.startsWith(to)}s(md,"isContextIdentifier");function om(e,n){let t=va(n)??"",[r=""]=t.split("."),i=Object.keys(e);if(!FN(e,r))return{code:"env/unknownKey",message:{de:`'${n}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${n}' names no environment key \u2014 known: ${i.join(", ")}.`}};if(pd(e,t)!==void 0)return null;let o=im(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${n}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${to}${r}'.`,en:`'${n}': environment key '${r}' is a single value \u2014 read it as '${to}${r}'.`}:{de:`'${n}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${n}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(om,"identifierIssue");function sm(e,n,t=Object.keys(e)){let r={};for(let i of t){let o=im(e,i),a=Object.hasOwn(n,i)?n[i]:void 0;if(a===void 0&&F(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${to}${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[`${to}${i}.${l}`]=d}}return r}s(sm,"flatten");function qN(e,n,t){if(t===void 0)return!1;let r=im(e,n);return r===null?!0:typeof t=="object"&&t!==null&&r.every(i=>t[i]!==void 0)}s(qN,"contextValueComplete");function MJ(e,n){switch(n){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(MJ,"valueMatchesDataType");function KN(e,n,t=Object.keys(e.types)){let r=new Set(t);for(let i of LN(e.types)){if(!r.has(i.split(".")[0]))continue;let o=n[`${to}${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=dt(pd(e.types,i));MJ(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(KN,"assertContextValues");function qJ(e){let n=[],t=LN(e.types);for(let r of t){let i=pd(e.types,r),o=dt(i);if(!Hi(i)||o===void 0||!LJ.has(o)){n.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){n.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&n.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&n.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))t.includes(r)||n.push(`field spec '${r}' names no leaf of the schema`);return n}s(qJ,"schemaIssues");function xa(e){let n=qJ(e);n.length>0&&F(`[env/schema] ${n.join("; ")}`)}s(xa,"assertSchema");var am={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function ro(e){return JSON.stringify(e)}s(ro,"canonical");function Aa(e){return e.kind==="binary"&&e.op==="&&"?[...Aa(e.left),...Aa(e.right)]:[e]}s(Aa,"conjuncts");function BN(e,n){let t;try{t=Fn(e)}catch{return!1}let r=ro(Fn(n));return Aa(t).some(i=>ro(i)===r)}s(BN,"hasConjunct");function UN(e,n){try{return ro(Fn(e))===ro(Fn(n))}catch{return!1}}s(UN,"sameCondition");function GN(e){let n=[];for(let t of e)n.push(...Ln(yi(t)));return MN(n)}s(GN,"contextKeysRead");function zN(e){try{return Ln(Fn(e)).some(md)}catch{return!1}}s(zN,"readsContext");var KJ=/^\d{4}-\d{2}-\d{2}$/,jJ=new Set(["==","!=","<","<=",">",">=","in"]),VJ=new Set(["<","<=",">",">="]);function dm(e,n,t=[]){xa(n);let r;try{r=Fn(e)}catch(a){let l=a.message;return[et("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of Ln(r)){if(!md(a)){i.push(et("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=om(n.types,a);l!==null&&i.push(et("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=ei(r,n,i);hd(o)||i.push(et("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),zJ(r,n,i);for(let{identifier:a,op:l}of Ok(r,n))i.push(et("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(...BJ(r,t)),i}s(dm,"conditionIssues");function BJ(e,n){let t=Aa(e).map(ro);return n.flatMap(r=>{let i=Fn(r),o=UJ(i);return o===null||!t.includes(ro(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(BJ,"guardFormHints");function UJ(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let n={...e,left:e.right,right:e.left};return ro(n)===ro(e)?null:n}s(UJ,"mirror");function hd(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(hd,"isBooleanish");function WN(e){let n=va(e);return n===null&&F(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),n}s(WN,"contextPath");function YN(e,n){let t=va(n);return t!==null&&e.fields[t]?.nullable===!0}s(YN,"isNullableLeaf");function GJ(e,n){let t=dt(pd(e.types,WN(n)));return t===void 0?{t:"unknown"}:{t:"data",dt:t}}s(GJ,"identType");function lm(e,n){return e.t==="unknown"||n.t==="unknown"||e.t==="null"||n.t==="null"?!0:e.t==="array"||n.t==="array"?!1:e.t==="str"&&n.t==="str"?!0:e.t==="str"?jN(e.value,n.dt):n.t==="str"?jN(n.value,e.dt):e.dt===n.dt}s(lm,"fits");function jN(e,n){return n==="text"||n==="option"||n==="edge"?!0:n==="date"?KJ.test(e):!1}s(jN,"strFits");function VN(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(VN,"orderedCategory");function ei(e,n,t){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 GJ(n,e.path);case"arr":for(let r of e.items)ei(r,n,t);return{t:"array"};case"unary":{let r=ei(e.operand,n,t);return hd(r)||t.push(et("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(am,e.name)?am[e.name]:void 0,i=e.args.map(l=>ei(l,n,t));return r===void 0?(t.push(et("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(am).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(am).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&lm(l,{t:"data",dt:r.params[d]}))||t.push(et("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=ei(e.cond,n,t);hd(r)||t.push(et("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=ei(e.then,n,t),o=ei(e.else,n,t);return lm(i,o)||t.push(et("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=ei(e.left,n,t),i=ei(e.right,n,t);if(e.op==="&&"||e.op==="||")(!hd(r)||!hd(i))&&t.push(et("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?t.push(et("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=>lm(r,ei(o,n,[])))||t.push(et("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(VJ.has(e.op)){let o=VN(r),a=VN(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&t.push(et("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 lm(r,i)||t.push(et("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(ei,"typeOf");function Rk(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(Rk,"isLiteral");function HN(e){let n=[],t=s(r=>{if(r.kind==="binary"&&jJ.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(Rk):Rk(r.right)?[r.right]:[];i.length>0&&n.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&Rk(r.left)&&n.push({ident:r.right.path,literals:[r.left]})}JN(r,t)},"visit");return t(e),n}s(HN,"comparedLiterals");function zJ(e,n,t){for(let{ident:r,literals:i}of HN(e)){let o=WJ(r,i,n);o!==null&&t.push(o)}}s(zJ,"literalIssues");function Ik(e,n){let t;try{t=Fn(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of HN(t)){let a=va(i);if(!(a===null||n.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(Ik,"liveLiterals");function WJ(e,n,t){let r=t.fields[WN(e)]?.valueSet;if(r?.kind==="unstable")return et("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=n.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 et("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(WJ,"valueSetIssue");function JN(e,n){switch(e.kind){case"binary":n(e.left),n(e.right);return;case"unary":n(e.operand);return;case"call":e.args.forEach(n);return;case"arr":e.items.forEach(n);return;case"if":n(e.cond),n(e.then),n(e.else);return;default:return}}s(JN,"forEachChild");function QN(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(QN,"isNullTest");function ZN(e){return Aa(e).flatMap(n=>{let t=XN(n);return t===null?[]:[t]})}s(ZN,"guardsOf");function gd(e,n,t){switch(e.kind){case"ident":return YN(n,e.path)&&!t.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=gd(r,n,t);if(i!==null)return i}return null;case"if":return gd(e.then,n,new Set([...t,...ZN(e.cond)]))??gd(e.else,n,t);default:return null}}s(gd,"unguardedNullSource");function XN(e){return!QN(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(XN,"guardedIdent");function Sa(e,n,t,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(t);for(let o of Aa(e)){Sa(o,n,i,r);let a=XN(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Sa(e.cond,n,t,r),Sa(e.then,n,new Set([...t,...ZN(e.cond)]),r),Sa(e.else,n,t,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=gd(e.left,n,t)??gd(e.right,n,t);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!QN(e.operand)){let i=Ln(e.operand).filter(o=>YN(n,o)&&!t.has(o));i.length>0&&r(i[0],"!")}JN(e,i=>Sa(i,n,t,r))}s(Sa,"nullableReads");function Ok(e,n){xa(n);let t=[];return Sa(e,n,new Set,(r,i)=>{t.some(o=>o.identifier===r)||t.push({identifier:r,op:i})}),t}s(Ok,"unguardedNullableReads");function et(e,n,t){return{severity:"error",code:e,message:{de:`[${e}] ${n}`,en:`[${e}] ${t}`}}}s(et,"error");function yd(e){let n=Array.isArray(e.nodes)?e.nodes:[],t=new Set;for(let r of n)for(let i of jp(r))i.key!==null&&aa[i.leaf].involves&&t.add(i.key);return t}s(yd,"declaredGroupKeys");var Ea=cp;var YJ="unit.key",HJ="offer.key";function eC(e,n){return e===YJ?n.unitKeys:e===HJ?n.offerKeys:null}s(eC,"liveKeyUniverse");function cm(e){return[wn,...[...yd(e)].sort((n,t)=>n.localeCompare(t)).map(yp)]}s(cm,"requiredSlots");var io=`${fp("applicant.channel")} == 'staff'`;var Pk=["strict","leastLoaded"];var _k=2;function nC(e){return e.some(n=>n.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<_k?{de:`braucht mindestens ${_k} Personen`,en:`needs at least ${_k} people`}:null}s(nC,"rotationPoolProblem");function JJ(e,n){let t=n===null?-1:e.indexOf(n);return[...e.slice(t+1),...e.slice(0,t+1)]}s(JJ,"strictOrder");function tC(e){let n=JJ(e.pool,e.previous).filter(i=>e.eligible.has(i));if(n.length===0)return null;if(e.mode==="strict")return n[0];let t=e.openCounts;t===void 0&&F("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=t.get(i);return o===void 0&&F(`[assignment/rotation] no open count for '${i}'`),o},"load");return n.reduce((i,o)=>r(o)<r(i)?o:i)}s(tC,"pickFromPool");function iC(e){return e.map(n=>({slot:HO(n.slot),rules:[...n.rules]}))}s(iC,"rulesOfStored");function oC(e){return e.map(n=>({slot:QJ(n.slot),rules:[...n.rules]}))}s(oC,"storedOfRules");function QJ(e){let n=kp(e);return n===null&&F(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),n}s(QJ,"slotOf");function sC(e,n){let t=e?.assignmentRules;t===void 0&&F(`[assignment/noRules] ${n}: the workflow has no assignment rule`);let r=cC(t);return r.length>0&&F(`${r.join("; ")} (${n})`),iC(t)}s(sC,"rulesOfGraph");function ZJ(e){return e===wn?{slot:e,rules:[{when:io,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(ZJ,"defaultSlotRules");function aC(e,n){let t=new Set(e.map(o=>o.slot)),r=n.filter(o=>!t.has(o)).map(ZJ);return[...r.filter(o=>o.slot===wn),...e,...r.filter(o=>o.slot!==wn)]}s(aC,"withRequiredSlots");function qn(e,n){return n===void 0?`slot '${e}'`:`slot '${e}' row #${n+1}`}s(qn,"where");function jt(e,n){return n===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${n+1}`}s(jt,"whereDe");function Ot(e,n,t={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${n.de}`,en:`[${e}] ${n.en}`},...t}}s(Ot,"issue");function rC(e){if(e===wn)return!0;let n=wp(e);return n!==null&&n.length>0}s(rC,"isKnownSlot");function XJ(e,n){xa(Ea);let t=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;rC(l)||t.push(Ot("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)&&t.push(Ot("assignment/duplicateSlot",{de:`${jt(l)} steht zweimal da`,en:`${qn(l)} is listed twice`},{slot:l})),r.add(l),l===wn&&a!==0&&t.push(Ot("assignment/responsibleFirst",{de:`'${wn}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${wn}' must be the first slot \u2014 team rows copy it`},{slot:l})),t.push(...e6(o))});for(let o of n)r.has(o)||t.push(Ot("assignment/slotMissing",{de:`${jt(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${qn(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(n);for(let{slot:o}of e)o!==wn&&!i.has(o)&&rC(o)&&t.push(Ot("assignment/unusedSlot",{de:`${jt(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${qn(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return t}s(XJ,"validateRules");function e6({slot:e,rules:n}){let t=[];return(n.length===0||n[n.length-1].when!==null)&&t.push(Ot("assignment/defaultRowMissing",{de:`${jt(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${qn(e)} must end with a row without condition ("otherwise")`},{slot:e})),n.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<n.length-1&&t.push(Ot("assignment/ruleAfterDefault",{de:`${jt(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${qn(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=dm(a,Ea,[io]);for(let c of d)t.push({...c,message:{de:`${c.message.de} (${jt(e,i)})`,en:`${c.message.en} (${qn(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){zN(a)||t.push(Ot("assignment/shadowedRule",{de:`${jt(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${qn(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=n.slice(0,i).findIndex(u=>u.when!==null&&UN(u.when,a));c!==-1&&t.push(Ot("assignment/shadowedRule",{de:`${jt(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${qn(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===wn&&l.kind==="slot"&&t.push(Ot("assignment/slotForwardRef",{de:`${jt(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${wn}'`,en:`${qn(e,i)} copies '${l.slot}' \u2014 only a team slot after '${wn}' may`},o)),e===wn&&l.kind==="queue"&&t.push(Ot("assignment/queueOnProcessSlot",{de:`${jt(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${qn(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&t.push(Ot("assignment/targetMissing",{de:`${jt(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${qn(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=nC(l.configKeys);d!==null&&t.push(Ot("assignment/rotationPool",{de:`${jt(e,i)}: die Reihum-Liste ${d.de}`,en:`${qn(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!BN(a,io))&&t.push(Ot("assignment/unguardedTarget",{de:`${jt(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${io}' ist (oder enth\xE4lt)`,en:`${qn(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${io}'`},o))}),t}s(e6,"rowIssues");function lC(e,n){for(let r of n)e.some(i=>i.slot===r)||F(`[assignment/slotMissing] ${qn(r)} has no rule list`);let t=new Set(n);return e.filter(r=>t.has(r.slot))}s(lC,"selectSlots");function n6(e,n){return GN(lC(e,n).flatMap(t=>t.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(n6,"contextKeysOfRules");function dC(e,n,t,r){xa(Ea);let i=lC(e,t),o=n6(e,t),a=sm(Ea.types,n,o);KN(Ea,a,o);let l=[];for(let{slot:d,rules:c}of i){let u=c.findIndex((h,y)=>{if(h.when===null)return!0;for(let k of Ln(yi(h.when)))Object.hasOwn(a,k)||F(`[condition/unknownIdentifier] ${qn(d,y)} reads '${k}', which the context does not carry`);return A_(h.when,{values:a})});u===-1&&F(`[assignment/defaultRowMissing] ${qn(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:t6(d,u,p,l,r)})}return l}s(dC,"evaluateRules");function t6(e,n,t,r,i){switch(t.kind){case"person":return{kind:"value",value:i.person(t.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(t,{slot:e,row:n})};case"unassigned":return F(`[assignment/targetMissing] ${qn(e,n)} names no one`);case"queue":return e===wn&&F(`[assignment/queueOnProcessSlot] ${qn(e,n)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===wn?void 0:r.find(a=>a.slot===t.slot);return o===void 0&&F(`[assignment/slotForwardRef] ${qn(e,n)} copies '${t.slot}', which is not decided before it`),o.value}}}s(t6,"resolveTarget");var Nk={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function r6(e){if(typeof e!="object"||e===null)return!1;let{kind:n,groupKey:t,...r}=e;return Object.keys(r).length>0?!1:n==="responsible"?t===void 0:n==="team"&&typeof t=="string"&&t.length>0}s(r6,"isStoredSlot");function cC(e){let n=[],t=s((r,i)=>n.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 t(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&t(o,`unknown field(s) ${Object.keys(d).join(", ")}`),r6(a)||t(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return t(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return t(p,"must be { when, assign }");let{when:h,assign:y,...k}=c;Object.keys(k).length>0&&t(p,`unknown field(s) ${Object.keys(k).join(", ")}`),h!==null&&typeof h!="string"&&t(p,"when must be a condition string or null (\u201Esonst\u201C)");let w=y?.kind;if(typeof y!="object"||y===null||typeof w!="string"||!Object.hasOwn(Nk,w))return t(p,`assign must be one of ${Object.keys(Nk).map(R=>`{kind:'${R}'}`).join(", ")}`);let b=Nk[w],E=Object.keys(y);(E.some(R=>!b.includes(R))||b.some(R=>!E.includes(R)))&&t(p,`a '${w}' target has exactly the field(s) ${b.join(", ")}`);let T=y;if(w==="person"&&(typeof T.configKey!="string"||T.configKey.length===0)&&t(p,"a 'person' target needs a non-empty configKey"),w==="rotation"){let R=T.configKeys;(!Array.isArray(R)||R.some(P=>typeof P!="string"))&&t(p,"a 'rotation' target needs configKeys, a list of person keys"),Pk.includes(T.mode)||t(p,`a 'rotation' target's mode is one of ${Pk.map(P=>`'${P}'`).join(", ")}`)}w==="slot"&&T.slot!==wn&&t(p,`a 'slot' target copies '${wn}' and nothing else`)})}),n):(t("slots","must be a list of { slot, rules }"),n)}s(cC,"ruleShapeIssues");function uC(e){let n=e??{},t=[];if(n.teamOwnerBindings!==void 0&&t.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"}),n.assignmentRules===void 0)return t.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"}),t;let r=cC(n.assignmentRules);if(r.length>0)return[...t,...r.map(o=>({de:o,en:o}))];let i=cm({nodes:Array.isArray(n.nodes)?n.nodes:[]});for(let o of XJ(iC(n.assignmentRules),i))o.severity==="error"&&t.push(o.message);return t}s(uC,"workflowAssignmentIssues");function um(e,n){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:n(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 y=o.get(p)??0;if(y===1){let k=[p],w=u.id;for(;w&&w!==p;)k.push(w),w=a.get(w)??null;k.reverse(),l.push({edge:h,source:u.id,target:p,cycle:k})}else y===0&&(o.set(p,1),a.set(p,u.id),c.push({id:p,edges:n(p),idx:0}))}}return l}s(um,"detectBackEdges");var Ck="team:",i6=/^[a-z0-9][a-z0-9-]*$/;function o6(e){if(!e.startsWith(Ck))return null;let n=e.slice(Ck.length);return n.length>0?n:null}s(o6,"teamKeyOfMember");function fm(e){return`${Ck}${e}`}s(fm,"teamMember");function Ta(e){let n=e.channels;return n===void 0?[]:(Array.isArray(n)||F("graph.channels must be an array"),n)}s(Ta,"readAuthoredChannels");function fC(e){return[...yd(e)].sort()}s(fC,"derivedChannelTeamKeys");function pC(e,n){let t=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!n.has(t))return t;for(let r=2;;r++){let i=`${t}-${r}`;if(!n.has(i))return i}}s(pC,"mintChannelKey");function mC(e,n){let t=e.channels;if(t===void 0)return[];if(!Array.isArray(t))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=yd(e),o=new Set,a=new Map;return t.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Dn(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every(E=>typeof E=="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}"`};i6.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=Dn(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 y=[];for(let E of u.members){let T=o6(E);if(T===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${E}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${E}" is not a "team:<key>".`}});continue}if(y.includes(T)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${T}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${T}" is named twice.`}});continue}n!==void 0&&!n.has(T)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${T}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${T}" does not exist at this school (or it is the applicant group).`}}),y.push(T)}if(y.length===0)return;let k=[...y].sort().join("+"),[w]=y;y.length===1&&w!==void 0&&i.has(w)&&r.push({path:`${c}.members`,reason:{de:`[channels/duplicatesDerived] ${p.de}: Team "${w}" ist am Prozess beteiligt und hat seinen Kanal schon automatisch.`,en:`[channels/duplicatesDerived] ${p.en}: team "${w}" takes part in the process and already has its channel automatically.`}});let b=a.get(k);b!==void 0?r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMembership] ${p.de}: dieselben Teams wie Kanal "${b}" \u2014 zwei Tabs w\xE4ren derselbe Chat.`,en:`[channels/duplicateMembership] ${p.en}: the same teams as channel "${b}" \u2014 two tabs would be the same chat.`}}):a.set(k,u.key)}),r}s(mC,"channelIssues");var gwe=Object.freeze({});function s6(e,n){return Object.freeze(sm(ui,e,n))}s(s6,"formContextEntries");function hC(e){return e.env??[]}s(hC,"declaredContextKeys");function gC(e,n){return hC(e).every(t=>yC(t,n?.[t]))}s(gC,"scenarioContextComplete");function yC(e,n){return qN(ui,e,n)}s(yC,"contextValueComplete");function wC(e,n){return s6(n??{},hC(e))}s(wC,"scenarioContextEntries");function Fk(e){return md(e)}s(Fk,"isContextIdentifier");function a6(e,n,t){let r=om(ui,e);if(r!==null)return{severity:"error",path:t,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return n.has(i)?null:{severity:"error",path:t,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(a6,"contextIdentifierIssue");var Dk=fp("stage.key");function l6(e){let n=[],t=s(i=>i.kind==="ident"&&i.path===Dk,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(t(i.left)&&i.right.kind==="str"&&n.push(i.right.value),t(i.right)&&i.left.kind==="str"&&n.push(i.left.value)),i.op==="in"&&t(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&n.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),n}s(l6,"stageKeyLiterals");function pm(e,n,t){return n===void 0?[]:l6(e).filter(r=>!n.has(r)).map(r=>bC(r,n,t))}s(pm,"stageKeyAstIssues");function kC(e,n){if(n===void 0)return[];let t=[];for(let r of e.testScenarios??[]){let i=r.env?.stage;typeof i?.key=="string"&&!n.has(i.key)&&t.push(bC(i.key,n,`scenario:${r.id}/env`))}return t}s(kC,"scenarioStageKeyIssues");function bC(e,n,t){let r=[...n].sort();return{severity:"error",path:t,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.")+` \`${Dk}\` 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.")+` \`${Dk}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(bC,"unknownStageKeyIssue");function vC(e,n,t){let r=[];for(let i of Ln(e)){if(!Fk(i))continue;let o=a6(i,n,t);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of Ok(e,cp))r.push({severity:"error",path:t,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(vC,"contextAstIssues");function xC(e,n){let t=[...d6(e)],r=new Set(e.env??[]);for(let i of e.env??[]){if(!Ys(i)){t.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${i}' geh\xF6rt nicht zum Vokabular (${Ws.join(", ")}).`,en:`Declared environment key '${i}' is not in the vocabulary (${Ws.join(", ")}).`}});continue}n!==void 0&&!n.has(i)&&t.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=>Ys(a)&&!yC(a,i.env?.[a]));o.length>0&&t.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??{}))Ys(a)?r.has(a)||t.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.`}}):t.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 t}s(xC,"formContextIssues");function d6(e){let n=[];Object.hasOwn(e,"context")&&n.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 t=e.testScenarios;for(let r of Array.isArray(t)?t:[])r!==null&&typeof r=="object"&&Object.hasOwn(r,"context")&&n.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 n}s(d6,"retiredContextFields");function mm(e,n,t){let r=dm(e,n).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(t?.liveEnvKeys!==void 0)for(let o of Ik(e,n)){let a=eC(o.path,t.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 pm(Fn(e),t?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(mm,"envConditionFindings");function hm(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(hm,"isReviewField");function $a(e){let n=[],t=[];function r(w,b){try{return Fn(w)}catch(E){n.push({path:b,src:w,reason:E instanceof Error?E.message:String(E)});return}}s(r,"tryParse");function i(w,b){return{...w,visibleIf:w.visibleIf?r(w.visibleIf,`${b}.visibleIf`):void 0,requiredIf:w.requiredIf?r(w.requiredIf,`${b}.requiredIf`):void 0,disabledIf:w.disabledIf?r(w.disabledIf,`${b}.disabledIf`):void 0,defaultValue:w.defaultValue?r(w.defaultValue,`${b}.defaultValue`):void 0}}s(i,"compileField");function o(w,b){return{...w,visibleIf:w.visibleIf?r(w.visibleIf,`${b}.visibleIf`):void 0,fields:w.fields.map((E,T)=>i(E,`${b}.fields[${T}]`))}}s(o,"compileGroup");function a(w,b){return{...w,itemTemplate:w.itemTemplate.map((E,T)=>i(E,`${b}.itemTemplate[${T}]`)),effects:w.effects?.map((E,T)=>d(E,`${b}.effects[${T}]`)),itemVisibleIf:w.itemVisibleIf?r(w.itemVisibleIf,`${b}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(w,b){let E=[];return w.fields.forEach((T,R)=>{if(T.externalFlag){t.push({key:T.key,label:T.label,defaultValue:T.defaultValue?r(T.defaultValue,`${b}.fields[${R}].defaultValue`):void 0});return}E.push(i(T,`${b}.fields[${R}]`))}),{...w,visibleIf:w.visibleIf?r(w.visibleIf,`${b}.visibleIf`):void 0,fields:E,groups:w.groups?.map((T,R)=>o(T,`${b}.groups[${R}]`)),computed:w.computed?.map((T,R)=>{let P=r(T.expression,`${b}.computed[${R}].expression`);return{key:T.key,expression:P??{kind:"null"}}}),subsections:w.subsections?.map((T,R)=>l(T,`${b}.subsections[${R}]`)),repeated:w.repeated?.map((T,R)=>a(T,`${b}.repeated[${R}]`)),validators:w.validators}}s(l,"compileSection");function d(w,b){return{...w,when:w.when?r(w.when,`${b}.when`):void 0}}s(d,"compileEffect");function c(w,b){let E=r(w.when,`${b}.when`);return E?{...w,when:E}:null}s(c,"compileOutcome");let u=e.sections.map((w,b)=>l(w,`sections[${b}]`)),p=(e.effects??[]).map((w,b)=>d(w,`effects[${b}]`)),h=[],y=e.outcomes??[];for(let w=0;w<y.length;w++){let b=y[w],E=c(b,`outcomes[${w}]`);E&&h.push(E)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:t},errors:n}}s($a,"compileForm");var c6=new Set(["decision","review","governedDocument"]);function AC(e){return c6.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s(AC,"isReadinessGatedNode");function u6(e){let n=new Map,t=p6(e),r=s((i,o)=>{let a=Lk(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&n.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:f6(d.bucket,t,a),section:a,type:d.type,enumSource:SC(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}`;n.set(u,{kind:"entered",key:u,label:c.label,qualifier:Lk(d),section:a,type:c.type,enumSource:SC(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=Ln(Fn(d.expression));n.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 n}s(u6,"formFieldCatalog");function SC(e){return e.type==="enum"?e:null}s(SC,"enumSourceOf");function f6(e,n,t){return e===void 0?t:n.get(e)??t}s(f6,"fieldQualifier");function p6(e){let n=new Map,t=s((r,i)=>{i===void 0||n.has(r)||n.set(r,Lk(i))},"add");for(let r of TC(e))r.kind==="person"?t(r.bucket,r.display):r.kind==="organization"&&t(r.id.replace(/^o\./,""),r.display);return n}s(p6,"bucketWordings");function EC(e){return e.flatMap(n=>[n,...EC(n.subsections??[])])}s(EC,"allSections");function TC(e){return[...e.effects,...EC(e.sections).flatMap(n=>(n.repeated??[]).flatMap(t=>t.effects??[]))]}s(TC,"allEffects");function Lk(e){return{label:e.label}}s(Lk,"wordingOf");function $C(e){return Xl(e).flatMap(({slot:n,address:t})=>{let r=O_(t);return r===null||Zl.includes(r.path)?[]:[{slotId:n,owner:r.owner,fieldKey:r.path}]})}s($C,"admissionBindingLeaves");function m6(e,n){let t=e.get(n);if(t===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(t),r}s(m6,"expandKey");function h6(e){let n=new Set;for(let t of TC(e))if(!(t.kind!=="person"||t.contractParty===void 0)&&t.when!==void 0)for(let r of Ln(Fn(t.when)))n.add(r);return[...n]}s(h6,"contractPartyConditionKeys");function g6(e){return $a(e).compiled.flags.map(n=>({key:n.key,name:n.label}))}s(g6,"formExternalFlags");function RC(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([n,t])=>[n,u6(t)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(h6(t))])),formFlagKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(g6(t).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set((t.views??[]).map(r=>r.key))]))}}s(RC,"readinessUniverse");function Mk(e,n){let t=new Set;for(let r of n)for(let i of m6(e,r)??[])i.kind==="entered"&&t.add(i.fieldKey);return t}s(Mk,"enteredFieldsBehind");var y6=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function w6(e){return y6.has(e)?!0:IC(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(w6,"isTextKey");function IC(e){return/^localized[A-Z]/.test(e)}s(IC,"isLegacyTwinKey");var k6=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),b6=new Set(["inputs","resolver","library"]);function ym(e,n){let t=[];return qk(e,n,t),t}s(ym,"findUnlocalizedTexts");function qk(e,n,t){if(Array.isArray(e)){e.forEach((i,o)=>qk(i,`${n}[${x6(i,o)}]`,t));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${n}.${i}`;if(!b6.has(i)){if(IC(i)){t.push({path:a,missing:"legacy-twin"});continue}if(w6(i)){v6(o,a,t);continue}if(k6.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&OC(d,`${a}.${l}`,t);continue}qk(o,a,t)}}}s(qk,"walk");function v6(e,n,t){e!=null&&OC(e,n,t)}s(v6,"checkText");function OC(e,n,t){let r=Dn(e);(r==="not-localized"||r.length>0)&&t.push({path:n,missing:r})}s(OC,"report");function x6(e,n){if(e!==null&&typeof e=="object"){let t=e;if(typeof t.id=="string")return t.id;if(typeof t.key=="string")return t.key}return String(n)}s(x6,"keyOf");function gm(e,n){return e==="not-localized"?n==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?n==="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"':n==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(gm,"describe");function Kk({path:e,missing:n}){return n==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${gm(n,"de")}.`,en:`[i18n/legacyTwin] ${e} ${gm(n,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${gm(n,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${gm(n,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(Kk,"unlocalizedTextReason");var S6={engagePush:["engage"]};function A6(e){let n=S6[e.type];return n===void 0?e:Object.fromEntries(Object.entries(e).filter(([t])=>!n.includes(t)))}s(A6,"withoutMachineData");function _C(e,n){return[...ym(e.nodes.map(A6),"nodes"),...n===void 0?[]:ym(n,`layout.${n.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:Kk(r),severity:"error"}))}s(_C,"checkLocalizedTexts");var E6="optionalAction:";function PC(e){return`${E6}${e}:trigger`}s(PC,"optionalActionTriggerActionId");var T6="processDecide";function NC(e){let n=e.optionalActions;return n==null?[]:(Array.isArray(n)||F(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof n}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),n)}s(NC,"optionalActionBindings");function CC(e){return NC(e).map(n=>({id:PC(n.key),kind:"internal",label:n.label,surface:T6,placement:"overflow",superUserOnly:!0}))}s(CC,"optionalActionTriggers");function DC(e){let n=e.tasks;return Array.isArray(n)?n:[]}s(DC,"authoredTemplates");function FC(e){let n=e?.result;return n?.kind!=="appointment"?[]:n.participants?.feedback?.tasks??[]}s(FC,"personTasksOf");function jk(e){let n=DC(e);return NC(e).map(t=>{let r=new Set(t.tasks??[]),i=new Set;for(let o of r)for(let a of FC(n.find(l=>l.key===o)))i.add(a);return{binding:t,tasks:r,personTasks:i,keys:new Set([...r,...i])}})}s(jk,"optionalActionMembership");function $6(e){let n=new Set;for(let t of DC(e))for(let r of FC(t))n.add(r);return n}s($6,"personRowTemplateKeys");function LC(e){let n=new Set($6(e));for(let{keys:t}of jk(e))for(let r of t)n.add(r);return n}s(LC,"referencedTaskTemplateKeys");var Rr={shape:"[taskInput/shape]",notInRound:"[taskInput/notInRound]",notRecord:"[taskInput/notRecord]",prefillNotDeclared:"[taskInput/prefillNotDeclared]",prefillType:"[taskInput/prefillType]",feedbackTasks:"[appointment/feedbackTasks]",feedbackOptional:"[appointment/feedbackOptional]",recordAssignment:"[taskResult/recordAssignment]"},Vk=60;function Ra(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Ra,"error");function Jo(e){return Array.isArray(e.tasks)?e.tasks:[]}s(Jo,"tasksOf");function MC(e){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(t=>t.action==="spawnTasks")}s(MC,"spawnBindingsOf");function wd(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}s(wd,"stringList");function ni(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(ni,"record");function Uk(e){let n=ni(e?.result);return n?.kind==="appointment"?ni(n.participants):null}s(Uk,"participantsOf");function Bk(e){return wd(ni(Uk(e)?.feedback)?.tasks)}s(Bk,"feedbackTasksOf");function qC(e,n){return jk(e).find(t=>t.keys.has(n))}s(qC,"roundOf");function R6(e,n,t){let r=s(u=>({code:Rr.notInRound,reason:u}),"notInRound"),i=qC(e,n);if(i===void 0)return r({de:`Aufgabe "${n}" geh\xF6rt zu keiner optionalen Aktion \u2014 Vorgaben liest nur eine Aufgabe einer Runde.`,en:`Task "${n}" belongs to no optional action \u2014 only a task of a round reads inputs.`});if(t.scope!=="task"||t.path!==void 0)return r({de:`${de(t)} ist kein Wert einer Aufgabe ($task.<aufgabe>.<schl\xFCssel>).`,en:`${de(t)} is no value of a task ($task.<task>.<key>).`});let{binding:o}=i,a=t.owner;if(a===n)return r({de:`Aufgabe "${n}" liest ihren eigenen Wert.`,en:`Task "${n}" reads its own value.`});let l=Jo(e).find(u=>u.key===a),d=ni(l?.blocks),c=i.tasks.has(a)&&d?.templateKey===n&&(d.node===void 0||d.node===e.id);return a!==o.input&&!c?r({de:`"${a}" ist weder die Eingabe der Aktion "${o.key}" noch eine ihrer Aufgaben, die "${n}" per 'blocks' zur\xFCckh\xE4lt \u2014 der Wert st\xFCnde nicht fest, wenn die Aufgabe \xF6ffnet.`,en:`"${a}" is neither the input of the action "${o.key}" nor one of its tasks that holds "${n}" through 'blocks' \u2014 the value would not be settled when the task opens.`}):ni(l?.result)?.kind!=="record"?{code:Rr.notRecord,reason:{de:`"${a}" hat kein Ergebnis vom Typ 'record' \u2014 Vorgaben sind Felder einer Eingabe.`,en:`"${a}" has no result of kind 'record' \u2014 inputs are fields of an input task.`}}:null}s(R6,"taskInputRefusal");function I6(e,n){if(n.scope!=="task")return;let t=Jo(e).find(i=>i.key===n.owner),r=ni(t?.result);if(r?.kind==="record")return(Array.isArray(r.fields)?r.fields:[]).map(ni).find(i=>i?.writes===n.key)??void 0}s(I6,"writerField");function O6(e,n,t){let r=String(n.key);if(n.inputs===void 0)return[];if(!Array.isArray(n.inputs))return[Ra(`${t}.inputs`,Rr.shape,{de:"'inputs' ist eine Liste von Adressen.",en:"'inputs' is a list of addresses."})];let i=[],o=new Set;for(let[a,l]of n.inputs.entries()){if(!we(l))continue;let d=de(l);if(o.has(d)){i.push(Ra(`${t}.inputs.${a}`,Rr.shape,{de:`${d} steht zweimal in 'inputs'.`,en:`${d} is listed twice in 'inputs'.`}));continue}o.add(d);let c=R6(e,r,l);c!==null&&i.push(Ra(`${t}.inputs.${a}`,c.code,c.reason))}return i}s(O6,"inputIssues");function _6(e,n,t,r){let i=t;if(fN(r))return Bk(i).length===1?null:{code:Rr.prefillType,reason:{de:"Ein Team belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A team prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."}};let o=Array.isArray(i.inputs)?i.inputs.filter(we).map(de):[];if(!we(r)||!o.includes(de(r)))return{code:Rr.prefillNotDeclared,reason:{de:"Die Vorbelegung der Teilnehmenden ist keine der Vorgaben ('inputs') der Aufgabe.",en:"The participants' prefill is none of the task's inputs ('inputs')."}};let a=s(c=>({code:Rr.prefillType,reason:c}),"prefillType"),l=Bk(i),d=Ql(e,r);if(d===void 0)return null;if(dt(d)==="staffUser")return l.length===1?null:a({de:"Eine Personenliste belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A list of persons prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."});if(d==="taskAssignment"){let u=wd(I6(n,r)?.tasks).filter(p=>!l.includes(p));return u.length===0?null:a({de:`Die Zuordnung ordnet ${u.map(p=>`"${p}"`).join(", ")} zu, die 'feedback.tasks' nicht nennt.`,en:`The assignment assigns ${u.map(p=>`"${p}"`).join(", ")}, which 'feedback.tasks' does not name.`})}return a({de:`Vorbelegt werden Teilnehmende nur aus Personen ('person') oder einer Zuordnung ('assignment'), nicht aus "${d}".`,en:`Participants are prefilled only from persons ('person') or an assignment ('assignment'), not from "${d}".`})}s(_6,"participantPrefillRefusal");function P6(e,n,t,r){let i=Uk(t)?.prefill;if(i===void 0)return[];let o=_6(e,n,t,i);return o===null?[]:[Ra(`${r}.result.participants.prefill`,o.code,o.reason)]}s(P6,"prefillIssues");function N6(e,n){return MC(e).some(t=>wd(t.tasks).includes(n))}s(N6,"belongsToOptionalAction");function C6(e,n,t){let r=n.key,i=Jo(e).find(c=>c.key===t),o=s(c=>({code:Rr.feedbackTasks,reason:c}),"feedbackTasks");if(i===void 0)return[o({de:`"${t}" ist keine Aufgabe dieses Knotens.`,en:`"${t}" is no task of this node.`})];let a=[];i.feedback!==!0&&a.push(o({de:`"${t}" ist keine Feedback-Aufgabe ('feedback: true').`,en:`"${t}" is no feedback task ('feedback: true').`})),MC(e).some(c=>wd(c.tasks).includes(t))&&a.push(o({de:`"${t}" steht in den Aufgaben einer optionalen Aktion \u2014 eine Personenzeile entsteht nur beim Buchen.`,en:`"${t}" is among an optional action's tasks \u2014 a person row exists only through a booking.`}));let l=Jo(e).find(c=>c.key!==r&&Bk(c).includes(t));l!==void 0&&a.push(o({de:`"${t}" wird auch von "${String(l.key)}" angelegt \u2014 jede Feedback-Art geh\xF6rt zu genau einem Termin.`,en:`"${t}" is also created by "${String(l.key)}" \u2014 each feedback kind belongs to exactly one appointment.`}));let d=["when","blocks","appointment"].filter(c=>i[c]!==void 0);return d.length>0&&a.push(o({de:`"${t}" tr\xE4gt ${d.map(c=>`'${c}'`).join(", ")} \u2014 eine Personenzeile entsteht nur beim Buchen und h\xE4lt nur ihre Runde.`,en:`"${t}" carries ${d.map(c=>`'${c}'`).join(", ")} \u2014 a person row exists only through a booking and holds only its round.`})),i.optional!==void 0&&a.push({code:Rr.feedbackOptional,reason:{de:`"${t}" ist optional \u2014 eine Personenzeile h\xE4lt ihre Runde und damit die Pause, sie kann nicht \xFCbersprungen werden.`,en:`"${t}" is optional \u2014 a person row holds its round and with it the pause; it cannot be skipped.`}}),a}s(C6,"participantFeedbackRefusals");function D6(e,n,t){let r=Uk(n);if(r===null||r.feedback===void 0)return[];let i=String(n.key),o=`${t}.result.participants.feedback`,a=ni(r.feedback),l=a?.tasks,d=[],c=s((p,h,y=Rr.feedbackTasks)=>d.push(Ra(p,y,h)),"fail");if(!Array.isArray(l)||l.length===0||l.some(p=>typeof p!="string")||new Set(l).size!==l.length)return c(`${o}.tasks`,{de:"'feedback.tasks' nennt mindestens eine Feedback-Aufgabe, jede einmal.",en:"'feedback.tasks' names at least one feedback task, each once."}),d;let u=a?.dueDaysAfterEnd;(typeof u!="number"||!Number.isInteger(u)||u<0||u>Vk)&&c(`${o}.dueDaysAfterEnd`,{de:`'feedback.dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${Vk}.`,en:`'feedback.dueDaysAfterEnd' is a whole number from 0 to ${Vk}.`}),N6(e,i)||c(o,{de:`Aufgabe "${i}" legt Personenzeilen an, geh\xF6rt aber zu keiner optionalen Aktion \u2014 Personenzeilen geh\xF6ren zur Runde einer Aktion.`,en:`Task "${i}" creates person rows but belongs to no optional action \u2014 person rows belong to an action's round.`});for(let p of l)for(let h of C6(e,n,p))c(`${o}.tasks`,h.reason,h.code);return d}s(D6,"feedbackIssues");function F6(e,n){let t=qC(e,n)?.personTasks??new Set;return Jo(e).filter(r=>r.feedback===!0&&typeof r.key=="string"&&t.has(r.key)).map(r=>r.key)}s(F6,"assignableFeedbackTasks");function L6(e,n,t){let r=ni(n.result);if(r?.kind!=="record"||!Array.isArray(r.fields))return[];let i=F6(e,String(n.key)),o=new Map(Jo(e).map(l=>[l.key,l])),a=[];for(let[l,d]of r.fields.entries()){let c=ni(d);if(c?.type!=="assignment")continue;let u=wd(c.tasks).filter(p=>o.get(p)?.feedback===!0&&!i.includes(p));u.length!==0&&a.push(Ra(`${t}.result.fields.${l}.tasks`,Rr.recordAssignment,{de:`Feld "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} legt kein Termin derselben optionalen Aktion an ('participants.feedback.tasks') \u2014 die Zuordnung h\xE4tte keine Zeile, die sie erh\xE4lt.`,en:`Field "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} is created by no appointment of the same optional action ('participants.feedback.tasks') \u2014 the assignment would have no row to receive it.`}))}return a}s(L6,"assignmentIssues");function KC(e,n){let t=[];for(let r of Jo(n)){if(typeof r.key!="string")continue;let i=`nodes.${n.id}.tasks.${r.key}`;t.push(...O6(n,r,i)),t.push(...P6(e,n,r,i)),t.push(...D6(n,r,i)),t.push(...L6(n,r,i))}return t}s(KC,"taskInputIssues");var _t={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 Pt(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Pt,"issue");function M6(e,n,t){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===t&&a===n}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(M6,"blockersOf");function jC(e){let{graph:n,node:t,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${t.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${_e(n,t.id,"de")}\u201C (${t.id})`,en:`Task "${o}" on node "${_e(n,t.id,"en")}" (${t.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Pt(`${a}.familyRequest`,_t.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(Pt(`${a}.familyRequest.${c[0]}`,_t.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(Pt(`${a}.familyRequest`,_t.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(Pt(`${a}.familyRequest`,_t.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(Pt(`${a}.kind`,_t.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(Pt(`${a}.${k}`,_t.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(Pt(`${a}.blocks`,_t.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 M6(n.nodes,t.id,o))d.push(Pt(`nodes.${k.nodeId}.tasks.${k.key}.blocks`,_t.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(Pt(`${a}.params.dueInDays`,_t.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(Pt(`${a}.familyRequest.fields`,_t.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 y=new Set;for(let k of u){if(!we(k))continue;let w=de(k);if(y.has(w)){d.push(Pt(`${a}.familyRequest.fields`,_t.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${je(n,k,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${je(n,k,"en")} more than once.`}));continue}y.add(w),un(k)||d.push(Pt(`${a}.familyRequest.fields`,_t.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${je(n,k,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${je(n,k,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(jC,"familyRequestIssues");function VC(e){let n=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"&&n.has(a));return o.length<=1?[]:[Pt(`nodes.${e.id}.optionalActions.${i}.tasks`,_t.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(VC,"familyRequestActionIssues");function BC(e,n){let t=e.nodes,r=new Map;for(let a of t)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)un(l)&&r.set(de(l),l);if(r.size===0)return[];let i=s(a=>{let l=Xr(n,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(un):!we(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return t.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(y=>y===h||y.when!==void 0)).flatMap(h=>u.flatMap(y=>{if(y.familyRequest===void 0||!h.tasks.includes(y.key))return[];let k=o(y.familyRequest).filter(w=>r.has(de(w)));return k.length===0?[]:[{...Pt(`nodes.${a.id}.requiresOneOf`,_t.deadlock,{de:`Auf Knoten \u201E${_e(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(w=>je(e,w,"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 "${_e(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(w=>je(e,w,"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(BC,"familyRequestDeadlockWarnings");var Gk={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,view:!0,familyRequest:!0,optional:!0,appointment:!0,inputs:!0,params:!0},zk={appointment:s((e,n)=>({de:`Aufgabe "${e}" an ${n.de}: \`appointment\` (Terminaufgabe) wird nicht mehr ver\xF6ffentlicht \u2014 ein Termin hat k\xFCnftig keine Leitung, die sie hielte. Was die Teilnehmenden nach dem Termin festhalten, ist je Person eine R\xFCckmeldung (\`result.participants.feedback\` der Terminvereinbarung).`,en:`Task "${e}" on ${n.en}: \`appointment\` (appointment task) is no longer published \u2014 an appointment will have no lead to hold it. What the participants record after the appointment is one feedback per person (\`result.participants.feedback\` of the booking task).`}),"appointment")};function q6(e){let n=Je(e);return new Map((typeof n.workItemTemplates=="function"?n.workItemTemplates(e):[]).map(t=>[t.key,t]))}s(q6,"intrinsicTemplatesOf");function UC(e,n,t){if(t!==void 0&&typeof t!="string")return null;let r=t??n,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Je(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:q6(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(UC,"resolveBlocksTargetNode");function K6(e){let n=new Map;for(let r of or(e.nodes)){let i=n.get(r.source)??[];i.push(r.target),n.set(r.source,i)}let t=new Map;return r=>{let i=t.get(r);if(i!==void 0)return i;let o=new Set,a=[...n.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...n.get(l)??[]))}return t.set(r,o),o}}s(K6,"reachability");function GC(e){let n=[],t=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;t.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("::");n.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=t.get(o);l!==void 0&&t.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of t.keys())i(o,[]);return n}s(GC,"checkBlocksCycles");function j6(e){let{requiresOneOf:n,optionalActions:t}=e;if(!Array.isArray(n)||!Array.isArray(t))return new Set;let r=new Set(n.filter(o=>typeof o=="string")),i=new Set;for(let o of t)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(j6,"tasksOfRequiresOneOf");function zC(e){if(typeof e!="object"||e===null)return!1;let{de:n,en:t}=e;return typeof n=="string"&&n.trim().length>0&&typeof t=="string"&&t.trim().length>0}s(zC,"isFilledBilingual");var V6=["blocks","gatesNode","locksEvidence","completableIf"];function B6(e,n){let t={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},r=[];e.feedback!==!0&&r.push(_n(`${n.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${t.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${t.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;if(e.kind!=="task"||typeof i?.kind!="string"||!_w({kind:i.kind,writes:i.writes})){let a=e.kind==="task"&&i?.writes!==void 0,l={de:e.kind!=="task"?`kind ${String(e.kind)}`:`Ergebnis ${String(i?.kind)}${a?" mit writes":""}`,en:e.kind!=="task"?`kind ${String(e.kind)}`:`result ${String(i?.kind)}${a?" with writes":""}`};r.push(_n(`${n.base}.feedback`,{de:`[workItems/feedbackNeedsProse] ${t.de} ist eine Feedback-Aufgabe und schlie\xDFt daher mit Freitext, einer Empfehlung oder einer Auswahl ohne 'writes' \u2014 ein Wert, den ein sp\xE4terer Schritt liest, k\xE4me von einem wom\xF6glich weitergeleiteten Link; erhalten ${l.de}.`,en:`[workItems/feedbackNeedsProse] ${t.en} is a feedback task, so it closes with free text, a recommendation or a choice without 'writes' \u2014 a value a later step reads would come from a link that may have been forwarded; got ${l.en}.`}))}let o=["blocks","gatesNode","completableIf","locksEvidence","familyRequest"].filter(a=>e[a]!==void 0);return o.length>0&&r.push(_n(`${n.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${t.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] ${t.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(B6,"feedbackTaskIssues");function U6(e,n){let t=[],r={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!zC(i.skipLabel))&&t.push(_n(`${n.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"&&t.push(_n(`${n.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"||!_w({kind:a.kind,writes:a.writes}))&&t.push(_n(`${n.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=V6.filter(d=>e[d]!==void 0);return l.length>0&&t.push(_n(`${n.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.`})),n.requiredByRule&&t.push(_n(`${n.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.`})),t}s(U6,"optionalTaskIssues");function _n(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(_n,"issue");function WC(e,n){let t=[],r=K6(e),i=new Set(Ta(e).map(o=>o.key));t.push(...BC(e,n));for(let o of e.nodes){let a=o,l=LC(a);t.push(...VC(a));let d=j6(a);t.push(...KC(e,a));let c=new Map((Array.isArray(a.tasks)?a.tasks:[]).filter(u=>typeof u.key=="string").map(u=>[u.key,{feedback:u.feedback===!0}]));for(let u of Array.isArray(a.tasks)?a.tasks:[]){let p=typeof u.key=="string"?u.key:"?",h=`nodes.${o.id}.tasks.${p}`,y=u.kind,k=u.result,w=u.blocks,b=typeof w?.node=="string"&&w.node!==o.id?w.node:void 0;if(typeof w?.templateKey=="string"){let N=typeof w.node=="string"?w.node:o.id,A=e.nodes.find(oe=>oe.id===N),U=(Array.isArray(A?.tasks)?A.tasks:[]).find(oe=>oe.key===w.templateKey)?.blocks;typeof U?.node=="string"&&U.node!==N&&t.push(_n(`${h}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${p}" auf Knoten "${o.id}" h\xE4lt "${w.templateKey}" auf Knoten "${N}" 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 "${p}" on node "${o.id}" holds back "${w.templateKey}" on node "${N}" \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(b!==void 0){let N=b;e.nodes.some(A=>A.id===N)&&!r(o.id).has(N)&&t.push(_n(`${h}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${p}" auf Knoten "${o.id}" blockiert Knoten "${N}", 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 "${p}" on node "${o.id}" blocks node "${N}", 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.`})),(k===void 0||!Xs(k.kind))&&t.push(_n(`${h}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${N}"), 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 "${p}" on node "${o.id}" blocks another node ("${N}") 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(p)&&t.push(_n(`${h}.blocks.node`,{de:`[optionalAction/crossNodeBlocks] Task "${p}" 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 "${p}" 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 N of cN(String(y),k,{channelKeys:i,nodeTasks:c,...n?.billingItemKeys!==void 0?{billingItemKeys:n.billingItemKeys}:{},...n?.offerProgram!==void 0?{offerProgram:n.offerProgram}:{}}))t.push(_n(`${h}.${N.field}`,{de:`${N.code} ${N.message.de} (Task "${p}" auf Knoten "${o.id}").`,en:`${N.code} ${N.message.en} (task "${p}" on node "${o.id}").`}));let E=u.when,T=s((N,A,M)=>{!we(A)||un(A)||t.push(_n(N,{de:`[workItems/evidenceNotFormField] ${M} auf Task "${p}" (Knoten "${o.id}") nennt ${je(e,A,"de")} \u2014 Bedingung und Belege einer Aufgabe sind Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[workItems/evidenceNotFormField] ${M} on task "${p}" (node "${o.id}") names ${je(e,A,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");E!==void 0?(T(`${h}.when`,E,"'when'"),u.onConditionReturn!=="respawn"&&u.onConditionReturn!=="stayClosed"&&t.push(_n(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] Task "${p}" (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 "${p}" (node "${o.id}") has a condition but no 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 what happens when the condition returns must be decided.`}))):u.onConditionReturn!==void 0&&t.push(_n(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' ohne 'when' auf Task "${p}" (Knoten "${o.id}") \u2014 ohne Bedingung kehrt nichts zur\xFCck.`,en:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' without 'when' on task "${p}" (node "${o.id}") \u2014 without a condition nothing returns.`}));let R=u.reads;if(R!==void 0)if(!Array.isArray(R))t.push(_n(`${h}.reads`,{de:`[workItems/readsUnknownField] 'reads' auf Task "${p}" (Knoten "${o.id}") muss eine Liste von Feldadressen sein.`,en:`[workItems/readsUnknownField] 'reads' on task "${p}" (node "${o.id}") must be a list of field addresses.`}));else for(let[N,A]of R.entries())T(`${h}.reads.${N}`,A,"'reads'");let P=u.locksEvidence,L=s((N,A)=>t.push(_n(`${h}.locksEvidence`,{de:`[workItems/${N}] Task "${p}" (Knoten "${o.id}") ${A.de}`,en:`[workItems/${N}] Task "${p}" (node "${o.id}") ${A.en}`})),"lockIssue");P!==void 0&&P!==!0&&L("locksEvidenceNotTrue",{de:`tr\xE4gt 'locksEvidence' ${JSON.stringify(P)} \u2014 nur 'true' ist erlaubt; ohne Sperre entf\xE4llt das Feld.`,en:`carries 'locksEvidence' ${JSON.stringify(P)} \u2014 only 'true' is allowed; without a lock the field is dropped.`}),P===!0&&(R===void 0&&E===void 0&&L("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."}),(k===void 0||!Xs(k.kind))&&L("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(p)&&L("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."})),t.push(...jC({graph:e,node:a,task:u,onTrigger:l,specCtx:n}));let _=Object.keys(u).filter(N=>!Object.hasOwn(Gk,N)&&!Object.hasOwn(zk,N));_.length>0&&t.push(_n(`${h}.${_[0]}`,{de:`[workItems/unknownKey] Task "${p}" (Knoten "${o.id}") tr\xE4gt ${_.map(N=>`'${N}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(Gk).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${p}" (node "${o.id}") carries ${_.map(N=>`'${N}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(Gk).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let v=u.description;v!==void 0&&!zC(v)&&t.push(_n(`${h}.description`,{de:`[workItems/descriptionInvalid] 'description' auf Task "${p}" (Knoten "${o.id}") braucht Text in beiden Sprachen ({ de, en }), erhalten ${JSON.stringify(v)}.`,en:`[workItems/descriptionInvalid] 'description' on task "${p}" (node "${o.id}") needs text in both languages ({ de, en }), got ${JSON.stringify(v)}.`})),u.feedback!==void 0&&t.push(...B6(u,{key:p,nodeId:o.id,base:h})),u.optional!==void 0&&t.push(...U6(u,{key:p,nodeId:o.id,base:h,requiredByRule:d.has(p)}))}}return t}s(WC,"checkNodeTasks");function YC(e){let n=e.indexOf(":"),t=n===-1?"":e.slice(0,n),r=n===-1?"":e.slice(n+1).trim();if(t==="artifact"&&r.length>0)return{kind:t,key:r};let i=ci(r);return t==="field"&&i!==null?{kind:t,address:i}:ae("INVALID",{de:`Dokument-Verweis "${e}" ist ung\xFCltig \u2014 erwartet artifact:<Slot-Schl\xFCssel> (auch der Slot eines anderen Knotens) oder field:$node.<Formular>.admission.<Feld>.`,en:`Document reference "${e}" is invalid \u2014 expected artifact:<slot key> (another node's slot too) or field:$node.<form>.admission.<field>.`})}s(YC,"parseTaskDocumentRef");function Wk(e){return e.kind==="artifact"?`artifact:${e.key}`:`field:${de(e.address)}`}s(Wk,"taskDocumentId");function vi(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(vi,"issue");function HC(e){return Array.isArray(e.tasks)?e.tasks:[]}s(HC,"tasksOf");function kd(e){let n=new Map;for(let t of e){let{id:r,artifacts:i}=t;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&n.set(o.key,[...n.get(o.key)??[],{nodeId:r,slot:o}])}return n}s(kd,"artifactSlotDeclarations");function G6(e){return e.flatMap(n=>{let{id:t,artifacts:r}=n;return(Array.isArray(r)?r:[]).filter(i=>!Jp(i?.type)).map(i=>({nodeId:String(t),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(G6,"unknownArtifactSlotTypes");function JC(e){let n=[];for(let{nodeId:t,slotKey:r,type:i}of G6(e.nodes))n.push(vi(`nodes.${t}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${t}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${ga.join(", ")}.`,en:`[artifact/unknownType] Node "${t}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${ga.join(", ")}.`}));for(let[t,r]of kd(e.nodes))for(let i of r.slice(1))n.push(vi(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${t}", 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 "${t}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return n}s(JC,"checkArtifactSlotKeys");function z6(e,n,t,r=kd(e.nodes)){let i=r.get(n)?.[0]?.nodeId;return i===void 0?{reason:"unknown"}:da(e,i,t)?null:{reason:"notBefore",owner:i}}s(z6,"slotLinkRefusal");function QC(e){if(!Array.isArray(e)||e.length===0)return null;let n=[];for(let t of e){let r=typeof t=="object"&&t!==null?t:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)n.push({kind:"artifact",key:r.key});else if(r.kind==="field"&&i==="address,kind")n.push({kind:"field",address:r.address});else return null}return n}s(QC,"authoredRefs");function ZC(e){let n=[],t=kd(e.nodes);for(let r of e.nodes)for(let i of HC(r)){if(i.documents===void 0)continue;let o=typeof i.key=="string"?i.key:"?",a=`nodes.${r.id}.tasks.${o}.documents`,l={de:`Task "${o}" (Knoten "${r.id}")`,en:`Task "${o}" (node "${r.id}")`},d=QC(i.documents);if(d===null){n.push(vi(a,{de:`[workItems/documentsInvalid] 'documents' auf ${l.de} muss eine nicht leere Liste von { kind: 'artifact', key } (Dokument-Slot eines Knotens) oder { kind: 'field', address } (Dateifeld eines Formulars) sein, erhalten ${JSON.stringify(i.documents)} \u2014 ein { kind: 'document', address } schreibt \`plexus-cli offer upgrade\` auf den Slot um.`,en:`[workItems/documentsInvalid] 'documents' on ${l.en} must be a non-empty list of { kind: 'artifact', key } (document slot of a node) or { kind: 'field', address } (file field of a form), got ${JSON.stringify(i.documents)} \u2014 \`plexus-cli offer upgrade\` rewrites a { kind: 'document', address } onto its slot.`}));continue}let c=new Set;for(let u of d){if(u.kind!=="artifact"&&!we(u.address))continue;let p=u.kind==="artifact"?Wk(u):Wk({kind:"field",address:u.address});if(c.has(p)&&n.push(vi(a,{de:`[workItems/documentsDuplicate] ${l.de} verweist zweimal auf ${p}.`,en:`[workItems/documentsDuplicate] ${l.en} refers to ${p} twice.`})),c.add(p),u.kind==="artifact"){let h=z6(e,u.key,r.id,t);h?.reason==="unknown"?n.push(vi(a,{de:`[workItems/documentsUnknownArtifact] ${l.de} verweist auf das Dokument "${u.key}", aber kein Knoten deklariert einen solchen Slot.`,en:`[workItems/documentsUnknownArtifact] ${l.en} refers to the document "${u.key}", but no node declares such a slot.`})):h?.reason==="notBefore"&&n.push(vi(a,{de:`[workItems/documentsNotBefore] ${l.de} verweist auf das Dokument "${u.key}" des Knotens "${h.owner}", der nicht auf jedem Weg vor "${r.id}" liegt \u2014 auf einem Weg an ihm vorbei g\xE4be es das Dokument nie.`,en:`[workItems/documentsNotBefore] ${l.en} refers to the document "${u.key}" of node "${h.owner}", which does not lie on every path before "${r.id}" \u2014 on a path around it the document would never exist.`}))}u.kind==="field"&&!un(u.address)&&n.push(vi(a,{de:`[workItems/documentsInvalid] ${l.de}: ein Feld-Dokument nennt ein Feld eines Formulars ($node.<formular>.admission.<feld>), nicht ${je(e,u.address,"de")}.`,en:`[workItems/documentsInvalid] ${l.en}: a field document names a field of a form ($node.<form>.admission.<field>), not ${je(e,u.address,"en")}.`}))}}return n}s(ZC,"checkTaskDocuments");function XC(e,n){let t=[];for(let r of e.nodes)for(let i of HC(r)){let o=QC(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"||!un(d.address))continue;let c=Xr(n,d.address);if(c==null)continue;let u={de:je(e,d.address,"de"),en:je(e,d.address,"en")},p=ua("taskDocument",ca(c));if(p==="repeated"){t.push(vi(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"&&t.push(vi(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 t}s(XC,"checkTaskDocumentFields");var Hk=["form","artifact","field"],Oa=["coverLetter","contract"],eD=/^[A-Za-z0-9_.-]+$/;function W6(e){return Oa.includes(e)}s(W6,"isArtifactPart");function Ia(e){return ae("INVALID",{de:`Ansichts-Adresse "${e}" ist ung\xFCltig \u2014 erwartet form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Oa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`View address "${e}" is invalid \u2014 expected form:<form node>#<view>, artifact:<slot>[#${Oa.join("|")}] or field:$node.<form>.admission.<field>.`})}s(Ia,"invalid");function Jk(e){let n=e.indexOf(":");if(n===-1)return Ia(e);let t=e.slice(0,n),r=e.slice(n+1);if(t==="field"){let l=ci(r);return l===null?Ia(e):{kind:t,address:l}}let i=r.indexOf("#"),o=i===-1?r:r.slice(0,i),a=i===-1?null:r.slice(i+1);return eD.test(o)?t==="form"?a!==null&&eD.test(a)?{kind:t,form:o,view:a}:Ia(e):t==="artifact"?a===null?{kind:t,slot:o}:W6(a)?{kind:t,slot:o,part:a}:Ia(e):Ia(e):Ia(e)}s(Jk,"parseViewAddress");function nD(e){let n=H6(e);if(n===null)return null;let t=Y6(n);return t!==null&&JSON.stringify(Yk(t))===JSON.stringify(Yk(e))?t:null}s(nD,"viewAddressOf");function Y6(e){try{return Jk(e)}catch{return null}}s(Y6,"tryParseViewAddress");function H6(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e;if(n.kind==="form"&&typeof n.form=="string"&&typeof n.view=="string")return`form:${n.form}#${n.view}`;if(n.kind==="artifact"&&typeof n.slot=="string")return n.part===void 0?`artifact:${n.slot}`:typeof n.part=="string"?`artifact:${n.slot}#${n.part}`:null;if(n.kind==="field"&&n.address!==null&&typeof n.address=="object"){let t=n.address;return typeof t.scope!="string"||typeof t.key!="string"?null:`field:${de(t)}`}return null}s(H6,"spellingOf");function Yk(e){return e===null||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).sort(([n],[t])=>n<t?-1:n>t?1:0).map(([n,t])=>[n,Yk(t)]))}s(Yk,"canonical");function tD(e){switch(e.kind){case"form":return`form:${e.form}#${e.view}`;case"artifact":return e.part===void 0?`artifact:${e.slot}`:`artifact:${e.slot}#${e.part}`;case"field":return`field:${de(e.address)}`}}s(tD,"formatViewAddress");var Qk=["form","documents"],J6=/^[a-z][a-zA-Z0-9_-]*$/;function Q6(e){let n=new Map,t=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])n.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){n.set(i.key,"other");for(let o of i.itemTemplate)n.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(t)},"visit");return e.sections.forEach(t),n}s(Q6,"fieldPlaces");function rD(e,n,t){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!J6.test(o)){r.push({severity:"error",path:`${t(a)}.key`,code:"view.invalid-key",message:{de:`${n.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${n.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:`${t(a)}.key`,code:"view.duplicate-key",message:{de:`${n.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${n.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(rD,"keyIssues");function Z6(e,n,t){return e==="document"?null:e===void 0?{severity:"error",path:t,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${n}'.`,en:`View: the form has no field '${n}'.`}}:e==="row"?{severity:"error",path:t,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${n}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${n}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:t,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${n}' enth\xE4lt keine Datei.`,en:`View: the field '${n}' holds no file.`}}}s(Z6,"fieldIssue");function X6(e,n,t){let r=[];Qk.includes(e.key)&&r.push({severity:"error",path:`${n}.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:`${n}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(...rD(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${n}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${n}.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}]`,y=Z6(t.get(u),u,h);y!==null&&r.push(y),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(X6,"viewIssues");function e4(e){if(!Array.isArray(e))return"views";for(let[n,t]of e.entries()){let r=t?.groups;if(!Array.isArray(r))return`views[${n}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${n}].groups[${i}].fields`}}return null}s(e4,"malformedAt");function iD(e){let n=e.views;if(n===void 0)return[];let t=e4(n);if(t!==null)return[{severity:"error",path:t,code:"view.malformed",message:{de:`${t} 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:`${t} 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=Q6(e);return[...rD(n.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...n.flatMap((i,o)=>X6(i,`views[${o}]`,r))]}s(iD,"formViewIssues");function _a(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(_a,"issue");function oD(e,n,t,r,i){let o=nD(e);if(o===null)return[_a(n,{de:`[view/invalid] 'view' auf ${t.de} ist keine Ansichts-Adresse \u2014 erwartet { kind: ${Hk.join(" | ")}, \u2026 }: form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Oa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] 'view' on ${t.en} is no view address \u2014 expected { kind: ${Hk.join(" | ")}, \u2026 }: form:<form node>#<view>, artifact:<slot>[#${Oa.join("|")}] or field:$node.<form>.admission.<field>.`})];let a=tD(o);switch(o.kind){case"artifact":return r.has(o.slot)?[]:[_a(n,{de:`[view/unknownSlot] ${t.de} nennt "${a}", aber kein Knoten dieses Graphen hat den Dokument-Slot "${o.slot}".`,en:`[view/unknownSlot] ${t.en} names "${a}", but no node of this graph has the document slot "${o.slot}".`})];case"form":case"field":{let l=o.kind==="form"?o.form:o.address.scope==="node"?o.address.owner:null;if(l===null)return[_a(n,{de:`[view/invalid] ${t.de} nennt "${a}" \u2014 ein Dateifeld liegt in einem Formular: field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] ${t.en} names "${a}" \u2014 a file field lives in a form: field:$node.<form>.admission.<field>.`})];let d=i?.formViewKeysByFormNode;if(d===void 0)return[];let c=d.get(l);return c===void 0?[_a(n,{de:`[view/unknownForm] ${t.de} nennt "${a}", aber kein Formularknoten hei\xDFt so.`,en:`[view/unknownForm] ${t.en} names "${a}", but no form node has that id.`})]:o.kind==="field"?[]:c.has(o.view)||Qk.includes(o.view)?[]:[_a(n,{de:`[view/unknownView] ${t.de} nennt "${a}", aber das Formular "${o.form}" hat keine Ansicht "${o.view}".`,en:`[view/unknownView] ${t.en} names "${a}", but the form "${o.form}" has no view "${o.view}".`})]}}}s(oD,"viewIssues");function sD(e,n){let t=[],r=new Set(kd(e.nodes).keys());for(let i of e.nodes){if(i.view!==void 0){let o={de:`Knoten "${i.id}"`,en:`node "${i.id}"`};i.type!=="decision"?t.push(_a(`nodes.${i.id}.view`,{de:`[view/invalid] ${o.de}: 'view' am Knoten gilt nur f\xFCr eine Entscheidung; eine Aufgabe tr\xE4gt ihre eigene.`,en:`[view/invalid] ${o.en}: 'view' on a node applies to a decision only; a task carries its own.`})):t.push(...oD(i.view,`nodes.${i.id}.view`,o,r,n))}for(let o of Array.isArray(i.tasks)?i.tasks:[]){if(o.view===void 0)continue;let a=String(o.key);t.push(...oD(o.view,`nodes.${i.id}.tasks.${a}.view`,{de:`Task "${a}" (Knoten "${i.id}")`,en:`Task "${a}" (node "${i.id}")`},r,n))}}return t}s(sD,"checkTaskViews");var Vt="traeger",aD={de:"Tr\xE4ger",en:"Provider"};function Pa(e){let n=e.inputs?.[Vt];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(Pa,"traegerKeyOfNode");var wm={name:"input.traeger.name",address:"input.traeger.anschrift"},Yke=Object.values(wm);var lD="governedDocument",Qo="prepareDocument",bd="prepareDocument:revision",Ir="releaseApproval",Zo="documentResponse",oo="coverLetterResponse",km="confirmCoverLetter",bm="requestCoverLetterRevision",Na="coverLetterConfirmation",ti="responseCheck",vm="returnSigned";var dD="requestApproval";var cD="issueDocument",uD="correctInPlace",fD="rescindAndReissue",xm="requestChange";var Ca="releaseArtifact",bt="signingRecovery",Sm="resendESignature",Xo="switchToPaper";var vd=new Set([Qo,bd]),pD=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],Am=["upload","resolver","template","none"],es=1,ns=366,xi="responseDueInDays";function ts(e){let n=e.inputs?.[Na];return n?.kind==="literal"&&n.value===!0}s(ts,"coverLetterConfirmationOf");function xd(e){let n=e.inputs?.[xi];return n?.kind==="literal"&&Sd(n.value)?n.value:void 0}s(xd,"responseDueInDaysForVocabulary");function Sd(e){return typeof e=="number"&&Number.isInteger(e)&&e>=es&&e<=ns}s(Sd,"isValidResponseDueInDays");var Em=["generatedAt","responseDueInDays","countersignature"],rs=["release","none"],Tm=["confirm","signedUpload","signedUploadChecked","eSignature"];var n4={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"}}},mD={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"}}},hD={...mD,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},t4={...hD,kind:"eSignature",issuesBy:"provider"},Si={confirm:n4,signedUpload:mD,signedUploadChecked:hD,eSignature:t4};function Ai(e){let n=e.responseStrategy;if(typeof n=="string"&&n in Si)return Si[n];F(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(n)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(Ai,"responseStrategyOf");function $m(e){if(e.type!==lD||e.production!=="resolver")return!1;let n=e.responseStrategy;return typeof n=="string"&&n in Si?Si[n].acceptEvent==="contractEvent":!1}s($m,"isFamilySignedContractNode");function Fa(e){return e.label}s(Fa,"governedDocTitle");function Zk(e){return e.approval==="release"?dD:cD}s(Zk,"submitActionId");function gD(e,n,t){return{key:n,recipient:"internal",title:t,unlocks:[Zk(e)],gatesNode:!0,advancesNode:!0}}s(gD,"producerTemplate");function r4(e){return e.titles?.respond??e.label}s(r4,"responseTitle");var Da={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Rm(e){let n=Ai(e),t=[];if(e.production!=="none"&&t.push(gD(e,Qo,e.titles?.prepare??Da),gD(e,bd,e.titles?.revise??Da)),e.approval==="release"&&t.push({key:Ir,recipient:"internal",title:e.titles?.approve??Da,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),t.push({key:Zo,recipient:"external",title:r4(e),unlocks:n.producesResponseArtifact?[n.checksReturn?vm:n.acceptOutcomeId,n.declineOutcomeId,xm]:[n.acceptOutcomeId,n.declineOutcomeId],advancesNode:!0,...xd(e)!==void 0?{dueInDays:xd(e)}:{}}),ts(e)){let r=Fa(e);t.push({key:oo,recipient:"external",title:{de:`${r.de}: Angebot best\xE4tigen`,en:`${r.en}: confirm offer`},unlocks:[km,bm,n.declineOutcomeId],advancesNode:!0,...xd(e)!==void 0?{dueInDays:xd(e)}:{}})}if(n.checksReturn&&t.push({key:ti,recipient:"internal",title:e.titles?.check??Da,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),n.issuesBy==="provider"){let r=Fa(e);t.push({key:bt,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[Sm,Xo],gatesNode:!1,advancesNode:!1})}return t}s(Rm,"governedDocIntrinsicTemplates");function i4(e){e.production==="none"&&F(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let n=e.artifacts??[];n.length!==1&&F(`governedDocSlot: node "${e.id}" declares ${n.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let t=n[0];return(typeof t.key!="string"||t.key.length===0)&&F(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),t}s(i4,"governedDocSlot");function Im(e){return i4(e).key}s(Im,"governedDocSlotKey");var sr="processFooter";var Om="countersign",Xk="countersign",yD="countersigned",wD="countersigning",kD="countersigned";var bD={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},Ad=["scan","eSignature"],_m="service_provider:1",vD=["countersigning","awaitingSignature","signatureStalled","done"],xD={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function SD(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(SD,"traegerSignatoryMissingReason");function ar(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(ar,"issue");function Pm(e,n){return e.nodes.filter(t=>{let r=t.contract;return t.type==="countersign"&&we(r)&&r.scope==="node"&&r.owner===n})}s(Pm,"countersignersOf");function Ed(e){return e.signing==="eSignature"}s(Ed,"isElectronic");function o4(e,n){if(n===void 0||n.sendable||!Ed(e))return[];let t=e.label?.de??e.id,r=e.label?.en||e.id;return[ar(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${t}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${n.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${n.reason.en}`})]}s(o4,"countersignProviderIssues");function s4(e,n,t){if(t.scope!=="node")return[];let r=e.nodes.find(o=>o.id===t.owner);if(r===void 0)return[];let i=[];return $m(r)||i.push("sourceNotCheckedContract"),Pm(e,r.id).some(o=>o.id!==n)&&i.push("twice"),i}s(s4,"countersignContractRefusals");function AD(e){let n=e.inputs?.dueInDays;return n?.kind==="literal"&&typeof n.value=="number"&&Number.isInteger(n.value)&&n.value>=1?n.value:void 0}s(AD,"validDueInDays");function a4(e,n,t){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!Ad.includes(o))return[ar(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?.[bt];if(!Ed(e))return a===void 0?[]:[ar(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 a===void 0&&l.push(ar(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(...l4(e,n,t),...d4(e,n,t),...o4(e,t?.signingProvider)),l}s(a4,"signingIssues");function TD(e,n){let t=e.contract;if(!(!we(t)||t.scope!=="node"))return n.nodes.find(r=>r.id===t.owner)}s(TD,"contractNodeOf");function l4(e,n,t){let r=TD(e,n),i=r===void 0?null:Pa(r),o=i===null?void 0:t?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[ar(e,"signing",SD(o.name))]}s(l4,"traegerSignatoryIssues");function d4(e,n,t){let r=TD(e,n);if(r===void 0)return[];let i=t?.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(ar(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(_m)||l.push(ar(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${_m}/ \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:${_m}/ \u2014 the provider would find no signature field for the school.`}));return l}s(d4,"traegerAnchorIssues");var eb=100;async function c4(e,n){let t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",n.node.id)).take(eb+1);t.length>eb&&F(`countersign node "${n.node.id}" of ${n.applicationId} holds more than ${eb} rows`);let r=t.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)===bt)?"signatureStalled":r.some(o=>i(o)===Om)?"countersigning":Ed(n.node)?"awaitingSignature":"done"}s(c4,"countersignCurrentState");var ED={[wD]:{label:te("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:te("Gegenzeichnung","Countersignature"),scope:"node"},external:nn(te("Vertrag unterschrieben","Contract signed"),"blue",te("Die Schule zeichnet Ihren Vertrag gegen","The school is countersigning your contract"),te("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."))}},$D={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:yD,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:ED,progressEvents:Gn(ED),notificationEvents:s(()=>[{id:kD,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:Xk,kind:"internal",label:bD,surface:sr,availableIn:["countersigning"]},...Ed(e)?[{id:Xo,kind:"internal",surface:sr,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:Om,recipient:"internal",title:e.titles?.countersign??Da,unlocks:[Xk],advancesNode:!0,...AD(e)!==void 0?{dueInDays:AD(e)}:{}},...Ed(e)?[{key:bt,recipient:"internal",title:xD,unlocks:[Xo],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),states:vD,currentState:c4,validate:s((e,n,t)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id;e.assign?.[Om]===void 0&&r.push(ar(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.`})),Ui(e.titles?.countersign)||r.push(ar(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(ar(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(...a4(e,n,t));let d=e.contract;if(!we(d))return r;let c=s4(n,e.id,d);if(c.length===0)return r;let u=n.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(ar(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=Pm(n,u.id).filter(h=>h.id!==e.id);r.push(ar(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 u4(e){return $m(e)?Pa(e):null}s(u4,"traegerSignerOf");var f4=s(e=>e.type==="end"&&Go(e)==="approved","isApprovedEnd");function RD(e){let n=[];for(let t of e.nodes){let r=u4(t);if(r===null)continue;let i=Pm(e,t.id).map(u=>u.id),o=MP(e,t.id,new Set(i),f4);if(o===null)continue;let a=t.label?.de||t.id,l=t.label?.en||t.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${t.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${t.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${t.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}" (${t.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 (${t.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}" (${t.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}`};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}`,reason:c,severity:"error"})}return n}s(RD,"checkCountersignCoverage");var p4=[{key:"blocks",why:{de:"sie h\xE4lt nichts zur\xFCck, sie ist mit dem Ausl\xF6sen erledigt",en:"it holds nothing back, it is done with the press"}},{key:"when",why:{de:"sie entsteht bei jedem Ausl\xF6sen",en:"it is created on every press"}},{key:"optional",why:{de:"wer ausl\xF6st, beantwortet sie immer",en:"whoever presses always answers it"}},{key:"appointment",why:{de:"sie wird beim Ausl\xF6sen beantwortet, nicht bei einem Termin",en:"it is answered at the press, not at an appointment"}},{key:"familyRequest",why:{de:"sie fragt nicht die Familie",en:"it does not ask the family"}},{key:"feedback",why:{de:"sie beantwortet die ausl\xF6sende Person, nicht ein Link",en:"the presser answers it, not a link"}},{key:"completableIf",why:{de:"sie wird beim Ausl\xF6sen erledigt, eine Vorbedingung w\xFCrde jedes Ausl\xF6sen ablehnen",en:"it is completed at the press, a precondition would refuse every press"}},{key:"locksEvidence",why:{de:"eine offene Korrektur w\xFCrde jedes Ausl\xF6sen ablehnen",en:"an open correction would refuse every press"}}];function ID(e){let{nodeId:n,bindingKey:t,binding:r}=e,i=[],o=`nodes.${n}.optionalActions.${t}.input`,a=s((u,p=o)=>{i.push({layer:"GRAPH",kind:"nodeRule",path:p,severity:"error",reason:{de:`[optionalAction/input] Optionale Aktion "${t}" auf Knoten "${n}": ${u.de}`,en:`[optionalAction/input] Optional action "${t}" on node "${n}": ${u.en}`}})},"push");if(r.input===void 0)return r.submitLabel!==void 0&&a({de:"'submitLabel' beschriftet das Absenden des Eingabedialogs \u2014 ohne 'input' \xF6ffnet das Ausl\xF6sen keinen Dialog.",en:"'submitLabel' names the input dialog's submit button \u2014 without 'input' the press opens no dialog."},`nodes.${n}.optionalActions.${t}.submitLabel`),i;let l=r.input;if(typeof l!="string"||l.trim().length===0)return a({de:"'input' muss der Schl\xFCssel einer ihrer Aufgaben sein.",en:"'input' must be the key of one of its tasks."}),i;let d=Array.isArray(r.tasks)?r.tasks:[];if(!d.includes(l))return a({de:`Die Eingabe "${l}" ist keine ihrer Aufgaben ('tasks') \u2014 die Eingabe geh\xF6rt zur Runde der Aktion.`,en:`The input "${l}" is none of its tasks ('tasks') \u2014 the input belongs to the action's round.`}),i;let c=s(u=>{let p=e.templates.find(h=>h.key===u);return p!==void 0&&p.optional===void 0&&p.blocks===void 0},"holdsNode");d.some(u=>u!==l&&c(u))||a({de:`Neben der Eingabe "${l}" hat die Aktion keine Aufgabe, die den Schritt zur\xFCckh\xE4lt (weder 'optional' noch hinter 'blocks') \u2014 die Runde w\xE4re mit dem Ausl\xF6sen schon erledigt.`,en:`Besides the input "${l}" the action has no task that holds the step (neither 'optional' nor behind 'blocks') \u2014 the round would be done with the press.`});for(let u of m4({nodeId:n,binding:r,templates:e.templates,input:l}))a(u);return i}s(ID,"optionalActionInputIssues");function m4(e){let{nodeId:n,binding:t,templates:r,input:i}=e,o=r.find(u=>u.key===i);if(o===void 0)return[];let a=[];o.result?.kind!=="record"&&a.push({de:`Die Eingabe "${i}" braucht ein Ergebnis der Art 'record' \u2014 nur dessen Werte lesen die anderen Aufgaben der Runde.`,en:`The input "${i}" needs a result of kind 'record' \u2014 only its values are read by the round's other tasks.`});let l=o.assign?.group;typeof t.trigger!="string"?a.push({de:"Mit einer Eingabe braucht die Aktion ein 'trigger'-Team \u2014 die Eingabe ist eine Aufgabe dieses Teams.",en:"With an input the action needs a 'trigger' team \u2014 the input is a task of that team."}):l!==void 0&&l!==t.trigger&&a.push({de:`Die Eingabe "${i}" geh\xF6rt dem Team "${String(l)}", ausgel\xF6st wird die Aktion vom Team "${t.trigger}" \u2014 wer ausl\xF6st, beantwortet die Eingabe, also ist es dasselbe Team.`,en:`The input "${i}" belongs to the team "${String(l)}", the action is pressed by the team "${t.trigger}" \u2014 whoever presses answers the input, so it is the same team.`});let d=o.result,c=d?.fields;for(let u of Array.isArray(c)?c:[])u.evidence===!0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" verlangt eine Datei ('evidence') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" demands a file ('evidence') \u2014 the press carries values only.`}),u.suggest!==void 0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" tr\xE4gt einen Vorschlag ('suggest') \u2014 eine Abweichung verlangt eine Begr\xFCndung, das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" carries a suggestion ('suggest') \u2014 a departure demands a reason, the press carries values only.`});d?.textRequired===!0&&a.push({de:`Die Eingabe "${i}" verlangt einen Text ('textRequired') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The input "${i}" demands a text ('textRequired') \u2014 the press carries values only.`});for(let{key:u,why:p}of p4)o[u]!==void 0&&a.push({de:`Die Eingabe "${i}" tr\xE4gt '${u}' \u2014 ${p.de}.`,en:`The input "${i}" carries '${u}' \u2014 ${p.en}.`});for(let u of r){let p=u.blocks;p?.templateKey!==i||p.node!==void 0&&p.node!==n||a.push({de:`"${String(u.key)}" h\xE4lt die Eingabe "${i}" per 'blocks' zur\xFCck \u2014 sie ist beim Anlegen der Runde schon erledigt, es gibt nichts zur\xFCckzuhalten.`,en:`"${String(u.key)}" holds the input "${i}" back through 'blocks' \u2014 it is already done when the round is created, there is nothing to hold back.`})}return a}s(m4,"optionalActionInputRefusals");function h4(e){let n="error",t=new Map;for(let a of or(e.nodes)){let l=t.get(a.source)??[];l.push({id:a.id,target:a.target}),t.set(a.source,l)}let r=[],i=new Set,o=um(e.nodes.map(a=>a.id),a=>(t.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:n}));return r}s(h4,"checkAcyclic");function g4(e){let n=[],t=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))t.has(l.to)||n.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))&&n.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 n}s(g4,"checkNextTargets");function y4(e){let n=[];for(let t of e.nodes){let r=t.next;if(!r)continue;let i=mk(t),o=new Set(i?i.map(a=>a.id):[ya]);for(let a of Object.keys(r))o.has(a)||n.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${t.id}.next.${a}`,reason:{de:`${t.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:`${t.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 n}s(y4,"checkNextOutcomesKnown");function w4(e){let n=[],t=new Set(or(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!t.has(o.id));return r.length===0?n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&n.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&&n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),n}s(w4,"checkStartEnd");function k4(e){let n=new Map;for(let r of or(e.nodes))n.set(r.source,(n.get(r.source)??0)+1);let t=[];for(let r of e.nodes)r.type!=="end"&&(n.get(r.id)??0)===0&&t.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 t}s(k4,"checkNoOutgoingEdge");function b4(e){return e.nodes.filter(n=>!cw(n.id)).map(n=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${n.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${Sr.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${n.id}": a node id is an identifier without a dot (${Sr.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(b4,"checkNodeIdFormat");function v4(e){let n=new Set(e.nodes.map(r=>r.id)),t=[];for(let r of or(e.nodes))n.has(r.source)||t.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"}),n.has(r.target)||t.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 t}s(v4,"checkEdgeEndpoints");function x4(e){let n=[];for(let t of e.nodes)for(let r of t.tasks??[]){let i=r.result;i===null||typeof i!="object"||!(Hp in i)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.tasks.${r.key}.result.${Hp}`,reason:{de:`[graph/retiredField] Aufgabe "${r.key}": \`primaryHostTeams\` hei\xDFt jetzt \`primaryParticipantTeams\` \u2014 der alte Name wird nicht mehr gelesen, die Teilnehmer-Auswahl zeigt die Teams nicht oben. Bitte umbenennen.`,en:`[graph/retiredField] Task "${r.key}": \`primaryHostTeams\` is now called \`primaryParticipantTeams\` \u2014 the old name is no longer read, so the participant picker does not list the teams first. Please rename it.`},severity:"error"})}return n}s(x4,"checkRenamedFields");var S4=new Set(["countersignature"]);function A4(e){let n=[],t=s((o,a)=>{n.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&&t("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&&t(`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&&t(`nodes.${o.id}.tasks.${a.key}.result.prices`,r)}for(let o of e.nodes){let a=o,l={de:`Knoten \u201E${_e(e,o.id,"de")}\u201C (${o.id})`,en:`Node "${_e(e,o.id,"en")}" (${o.id})`};for(let[c,u]of Object.entries(a.next??{}))u!==null&&typeof u=="object"&&"emits"in u&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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(Uw[o.type]??{}))c in a&&t(`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:[]){if(c===null||typeof c!="object")continue;let u=String(c.key),p=c.assign;p!==null&&typeof p=="object"&&"userId"in p&&t(`nodes.${o.id}.tasks.${u}.assign.userId`,{de:`Aufgabe "${u}" an ${l.de}: \`assign.userId\` gibt es nicht mehr \u2014 eine Aufgabe nennt ihr Team (\`assign.group\`), nie eine feste Person.`,en:`Task "${u}" on ${l.en}: \`assign.userId\` no longer exists \u2014 a task names its team (\`assign.group\`), never a fixed person.`});for(let[h,y]of Object.entries(zk))h in c&&t(`nodes.${o.id}.tasks.${u}.${h}`,y(u,l))}for(let c of Gw[o.type]??[])c in a&&t(`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(tP[o.type]??{}))c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&t(`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"&&S4.has(u)&&t(`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 n}s(A4,"checkRetiredDataFields");function La(e,n){return n?.wiring&&n.layout?{wiring:n.wiring,layout:n.layout}:null}s(La,"resolveLayoutContext");function E4(e,n){let t=La(e,n);if(!t)return e.nodes.some(o=>(Je(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 ${n?.wiring?"vorhanden":"fehlt"}, Layout ${n?.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 ${n?.wiring?"present":"missing"}, layout ${n?.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=Je(i)?.progressEvents;if(a)for(let l of a){let d=fa(t.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 '${t.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 '${t.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=Up(t.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 '${t.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${t.layout.id}'`},severity:"error"});continue}sd(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(E4,"checkProgressEventMappings");function T4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.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),sd(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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.${t.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(T4,"checkProgressBoardCoverage");function $4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)if(!(!i.boards||i.boards.length===0))for(let o of i.boards)for(let a of Ye){let l=new Map;for(let d of o.columns){if(!Ui(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.${t.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($4,"checkProgressBoardDistinctLabels");function R4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)for(let o of i.states){let a=Gp(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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.${t.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(R4,"checkProgressTerminalSemantics");function I4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])sd(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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??[])sd(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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.${t.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.${t.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(I4,"checkProgressSeatStates");var Nm={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 O4(e){return e==="both"?{de:`${Nm.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:`${Nm.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:`${Nm.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${Nm.en}, or move the state into the successor's column.`}}s(O4,"passThroughRemedy");function _4(e,n){let t=La(e,n);if(!t)return[];let{layout:r,wiring:i}=t;if(!r.buses.some(b=>b.key==="process"))return[];let o=GP(r);if(!o)return[];let a=new Map(e.nodes.map(b=>[b.id,b])),l=s(b=>Je(b).progressEvents??[],"eventsOf"),d=s(b=>Object.values(b.next??{}).map(E=>E.to),"routesOf"),c=s((b,E)=>{let T=a.get(b);if(!T||E.has(b))return null;if(l(T).length>0)return[T];if(_D[T.type]!==!1)return null;let R=d(T);if(R.length===0)return null;let P=[];for(let L of R){let _=c(L,new Set([...E,b]));if(!_)return null;P.push(..._)}return P},"firstProgressNodes"),u=s((b,E)=>{let T=[];for(let R of l(b)){let P=fa(i,b,R);if(!P||P.bus!==E.bus||P.state===E.state)return null;T.push(P.state)}return[...new Set(T)].join("' / '")},"overwrites"),p=s((b,E)=>{let T=d(b);if(T.length===0)return null;let R=[];for(let P of T){let L=c(P,new Set([b.id]));if(!L)return null;for(let _ of L){let v=u(_,E);if(v===null)return null;R.push({de:`'${_.id}' (${_.type}) mit '${v}'`,en:`'${_.id}' (${_.type}) with '${v}'`})}}return[...new Map(R.map(P=>[P.de,P])).values()]},"submitOverwrittenBy"),h=new Map;for(let b of e.nodes)for(let E of l(b)){let T=fa(i,b,E);if(!T||T.bus!=="process")continue;let R=b.type==="form"&&E===sp?p(b,T):null,P=R?{de:`'${b.id}'.${E} erreicht ihn, und ${R.map(L=>L.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${b.id}'.${E} reaches it, and ${R.map(L=>L.en).join(", ")} overwrites it in the same transaction`}:null;h.set(T.state,[...h.get(T.state)??[],P])}let y=Up(r,"process"),k=new Map;for(let[b,E]of h){if(!E.every(R=>R!==null))continue;let T=[...new Map(E.map(R=>[R.de,R])).values()];k.set(b,{de:T.map(R=>R.de).join("; "),en:T.map(R=>R.en).join("; ")})}let w=[];for(let b of o.columns){if(b.states.length===0||!b.states.every(R=>k.has(R)))continue;let E=b.states.map(R=>{let P=y.holdsSeat?.includes(R)===!0,L=k.get(R);return{de:`Zustand '${R}'${P?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${L.de}`,en:`State '${R}'${P?" (is in holdsSeat, but never takes a seat)":""}: ${L.en}`}}),T=O4(o.audience);w.push({layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${o.id}.columns.${b.id}`,reason:{de:`[progress/passThroughState] Spalte \u201E${b.label.de}" ('${b.id}', Board '${o.id}') bleibt immer leer \u2014 ${E.map(R=>R.de).join("; ")}. ${T.de}`,en:`[progress/passThroughState] Column "${b.label.en}" ('${b.id}', board '${o.id}') always stays empty \u2014 ${E.map(R=>R.en).join("; ")}. ${T.en}`},severity:"warning"})}return w}s(_4,"checkProgressPassThroughColumns");function P4(e){let n=["workItems","workitems","work_items","taskTemplates"],t=[];for(let r of e.nodes){let i=r;for(let o of n){let a=i[o];a!=null&&t.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 t}s(P4,"checkMisnamedTasksKey");function N4(e){let n=[];for(let t of e.nodes){let r=t,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)&&n.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=Je(t),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(t):[]).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||!fd.has(p)){n.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: ${[...fd].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...fd].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&n.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,y=h===void 0?void 0:UC(e,r.id,h.node);if(h!==void 0&&y===null)n.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&&y!==void 0&&y!==null){let w=y.node.id===r.id,b=y.node.id,E=w?o:y.composedKeys,T=w?d:y.intrinsicByKey,R=y.node.assign??{};p==="approval"&&n.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 P=h.templateKey,L=[...new Set([...E,...T.keys()])].filter(v=>!w||v!==u).join(", "),_={de:L||"keine",en:L||"none"};if(typeof P!="string"||w&&P===u||!E.has(P)&&!T.has(P))n.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(P)} auf Knoten "${b}"; zul\xE4ssige Ziele: ${_.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(P)} on node "${b}"; allowed targets: ${_.en}.`},severity:"error"});else if(y.refuse(P)!==null)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:y.refuse(P),severity:"error"});else{let v=T.get(P);h.except!==void 0&&n.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"}),v!==void 0&&v.recipient!=="external"&&v.verdictResolved!==!0&&R[P]===void 0&&n.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 "${P}" (Knoten "${b}") zur\xFCck, aber der Knoten weist "${P}" keiner Gruppe zu \u2014 ohne 'assign.${P}' entsteht diese Zeile nie: kein Team bekommt die zur\xFCckgehaltene Arbeit, niemand au\xDFer der verantwortlichen Person kann sie tun. Entweder 'assign.${P}' erg\xE4nzen oder das 'blocks' entfernen.`,en:`[workItems/blocksUnwiredTarget] Task "${u}" on node "${r.id}" holds back "${P}" (node "${b}"), but the node assigns "${P}" to no group \u2014 without 'assign.${P}' this row is never created: no team receives the held-back work, and nobody except the responsible person can do it. Either add 'assign.${P}' or remove the 'blocks'.`},severity:"error"})}}{let w=c.completableIf;if(typeof w=="string"&&w.trim().length>0){let b=w.trim().replace(/^!/,"").trim();a.has(b)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.completableIf`,reason:{de:`[workItems/unknownExport] completableIf "${w}" verweist auf unbekannten Node-Export "${b}"; bekannt: ${[...a].join(", ")||"keine"}.`,en:`[workItems/unknownExport] completableIf "${w}" refers to unknown node export "${b}"; known: ${[...a].join(", ")||"none"}.`},severity:"error"})}}let k=c.params;if(k?.commentRequired!==void 0&&n.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 w=[];k?.onReject!==void 0&&w.push("params.onReject"),k?.revisionGroup!==void 0&&w.push("params.revisionGroup");for(let b of w)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.${b}`,reason:{de:`[workItems/approvalOnlyField] '${b}' gilt nur f\xFCr die Art 'approval' (Task "${u}" ist '${p}').`,en:`[workItems/approvalOnlyField] '${b}' only applies to the kind 'approval' (task "${u}" is '${p}').`},severity:"error"});continue}k?.onReject!==void 0&&k.onReject!=="spawnRevision"&&n.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)&&n.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 n.push(...GC(e)),n}s(N4,"checkWorkItemTemplates");var C4=new Set(["complete","approve","reject"]),_D={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 D4(e){let n=[];for(let t of e.nodes){let r=t,i=Je(t),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(t)??[];if(o+a.length>0){let b=_D[r.type];b===void 0?n.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"}):b||n.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?.(t)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(b=>[b.id,b]));for(let b of l)C4.has(b.id)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}`,reason:{de:`[capability/reservedActionId] Knotentyp "${r.type}" deklariert die Action "${b.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 "${b.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??[pN]);for(let b of l)if(b.availableIn!==void 0)for(let E of b.availableIn)c.has(E)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}.availableIn`,reason:{de:`[capability/unknownActionState] Action "${b.id}" auf Knotentyp "${r.type}" ist f\xFCr Zustand "${E}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${b.id}" on node type "${r.type}" is declared for state "${E}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=mk(t),p=new Set(u?u.map(b=>b.id):[ya]);for(let b of l){if(b.external===void 0)continue;let E=uN(b.external.event),T={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},R=E?b.kind==="advance"?{de:`ist als "advance" deklariert, l\xF6st den Knoten aber nicht auf (Ereignis "${b.external.event}") \u2014 solche Aktionen sind "internal"`,en:`is declared as "advance", but does not resolve the node (event "${b.external.event}") \u2014 such actions are "internal"`}:b.outcome!==void 0?{de:`nennt das Outcome "${b.outcome}", l\xF6st den Knoten aber nicht auf (Ereignis "${b.external.event}") \u2014 ein Outcome w\xFCrde eine zweite, stille Routing-Vokabel behaupten`,en:`names the outcome "${b.outcome}", but does not resolve the node (event "${b.external.event}") \u2014 an outcome would claim a second, silent routing vocabulary`}:b.label===void 0?T:null:b.kind!=="advance"?{de:`ist als "${b.kind}" deklariert (externe Aktionen l\xF6sen den Knoten auf und m\xFCssen "advance" sein)`,en:`is declared as "${b.kind}" (external actions resolve the node and must be "advance")`}:b.outcome===void 0?{de:"nennt kein Outcome",en:"names no outcome"}:p.has(b.outcome)?b.label===void 0?T:null:{de:`verweist auf das unbekannte Outcome "${b.outcome}" (deklariert: ${[...p].join(", ")||"keine"})`,en:`refers to the unknown outcome "${b.outcome}" (declared: ${[...p].join(", ")||"none"})`};R!==null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}.external`,reason:{de:`[capability/externalActionNeedsOutcome] Externe Aktion "${b.id}" auf Knotentyp "${r.type}" ${R.de}.`,en:`[capability/externalActionNeedsOutcome] External action "${b.id}" on node type "${r.type}" ${R.en}.`},severity:"error"})}for(let b of a){let E=b.unlocks;if(E.length===0&&b.verdictResolved!==!0&&b.informational!==!0){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${b.key}.unlocks`,reason:{de:`[capability/emptyUnlocks] Intrinsisches Template "${b.key}" auf Knoten "${r.id}" schaltet keine Action frei (B5).`,en:`[capability/emptyUnlocks] Intrinsic template "${b.key}" on node "${r.id}" unlocks no action (B5).`},severity:"error"});continue}for(let T of E)d.get(T)===void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${b.key}.unlocks`,reason:{de:`[capability/danglingUnlock] Template "${b.key}" auf Knoten "${r.id}" schaltet unbekannte Action "${T}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${b.key}" on node "${r.id}" unlocks the unknown action "${T}"; declared: ${[...d.keys()].join(", ")||"none"}.`},severity:"error"})}let h=new Set(a.map(b=>b.key));for(let b of Object.keys(r.assign??{}))h.has(b)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.assign.${b}`,reason:{de:`[capability/unknownAssignKey] assign-Key "${b}" auf Knoten "${r.id}" ist kein intrinsisches Template dieses Knotentyps; bekannt: ${[...h].join(", ")||"keine"}.`,en:`[capability/unknownAssignKey] assign key "${b}" on node "${r.id}" is not an intrinsic template of this node type; known: ${[...h].join(", ")||"none"}.`},severity:"error"});for(let[b,E]of Object.entries(r.assign??{})){if(E===void 0)continue;let T=`nodes.${r.id}.assign.${b}`,R={de:`Team der Vorlage "${b}" (Knoten "${r.id}")`,en:`team of the template "${b}" (node "${r.id}")`};n.push(...RP(E,T,R));for(let[P,L]of(Array.isArray(E)?E:[]).entries()){let _=L?.when;_==null||!we(_)||un(_)||n.push({layer:"GRAPH",kind:"nodeRule",path:`${T}.${P}.when`,severity:"error",reason:{de:`[assign/conditionNotFormField] ${R.de}, Zeile ${P+1}: die Bedingung nennt ${je(e,_,"de")} \u2014 ein Team wird nach einem Ja/Nein-Feld eines Formulars gew\xE4hlt ($node.<formular>.admission.<feld>).`,en:`[assign/conditionNotFormField] ${R.en}, row ${P+1}: the condition names ${je(e,_,"en")} \u2014 a team is chosen by a yes/no field of a form ($node.<form>.admission.<field>).`}})}}let y=l.filter(b=>b.teamAssignable===!0).map(b=>b.id);for(let b of Object.keys(r.actionTeams??{}))y.includes(b)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actionTeams.${b}`,reason:{de:`[capability/unknownActionTeam] Knoten "${r.id}" nennt ein Team f\xFCr "${b}", aber diese Aktion l\xE4sst sich hier keinem Team geben; m\xF6glich: ${y.join(", ")||"keine"}.`,en:`[capability/unknownActionTeam] Node "${r.id}" names a team for "${b}", but this action cannot be given to a team here; possible: ${y.join(", ")||"none"}.`},severity:"error"});let k=new Set;for(let b of a)if(b.recipient==="external"||(r.assign??{})[b.key]!==void 0)for(let T of b.unlocks)k.add(T);let w=i.strictActionCoverage===!0;for(let b of l){if(k.has(b.id)||b.superUserOnly===!0)continue;let E=a.find(R=>R.unlocks.includes(b.id)),T=E!==void 0?{de:` Fehlt die Zuweisung assign.${E.key}?`,en:` Is the assignment assign.${E.key} missing?`}:{de:"",en:""};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}`,reason:{de:`[capability/superUserOnly] Action "${b.id}" auf Knoten "${r.id}" ist von keinem verdrahteten Work-Item freigeschaltet \u2014 nur die verantwortliche Person (Super-User) kann sie ausf\xFChren.${T.de}`,en:`[capability/superUserOnly] Action "${b.id}" on node "${r.id}" is unlocked by no wired work item \u2014 only the responsible person (super user) can perform it.${T.en}`},severity:w?"error":"warning"})}}return n}s(D4,"checkNodeCapabilityWiring");function F4(e){let n=new Set(R_()),t=[];for(let r of e.nodes)n.has(r.type)||t.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: ${[...n].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...n].join(", ")}.`},severity:"error"});return t}s(F4,"checkKnownNodeTypes");function L4(e,n){let t=[],r=s((a,l)=>{t.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=LO(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(t.push(...X4(l,d)),d.length===0)continue;let c=Je(a),u=new Set(c.optionalActionKinds??[]),p=Array.isArray(l.tasks)?l.tasks:[],h=new Map;for(let w of p)typeof w.key=="string"&&h.set(w.key,w);let y=new Set,k=new Map;for(let w of d){let b=w.key,E=typeof b=="string"&&b.trim().length>0?b:void 0,T=E??"?",R=`nodes.${l.id}.optionalActions.${T}`,P=typeof w.action=="string"?w.action:void 0;if(w.when!==void 0){let L=s(_=>r(`${R}.when`,{de:`[optionalAction/when] Optionale Aktion "${T}" auf Knoten "${l.id}": ${_.de}`,en:`[optionalAction/when] Optional action "${T}" on node "${l.id}": ${_.en}`}),"conditionFinding");if(typeof w.when!="string"||w.when.trim()==="")L({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 _ of mm(w.when,i,n))L(_)}if((P===void 0||!u.has(P))&&r(`${R}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${T}" auf Knoten "${l.id}" hat die Art ${JSON.stringify(w.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 "${T}" on node "${l.id}" has the kind ${JSON.stringify(w.action)} \u2014 `+(u.size===0?`node type "${l.type}" declares no families (spec.optionalActionKinds is missing).`:`node type "${l.type}" only declares: ${[...u].join(", ")}.`)}),E===void 0?r(`${R}.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').`}):(y.has(E)&&r(`${R}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${E}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${E}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),y.add(E)),o(w.label)||r(`${R}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${T}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${T}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),P==="skipRule"){t.push(...q4(l,w,R,T,d));continue}if(P==="spawnTasks"){w.except!==void 0&&r(`${R}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${T}" 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 "${T}" 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'.`}),t.push(...ID({nodeId:l.id,bindingKey:T,binding:w,templates:p})),t.push(...M4(l.id,w,R,T,h));let L=Array.isArray(w.tasks)?w.tasks:void 0;if(L===void 0||L.length===0)r(`${R}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${T}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let _=new Set,v=new Set(L.filter(N=>typeof N=="string"));for(let N of L){let A=typeof N=="string"?N:void 0;if(A===void 0||A.length===0){r(`${R}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(_.has(A)){r(`${R}.tasks.${A}`,{de:`[optionalAction/duplicateTaskRef] Template "${A}" ist in der Aktion "${T}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${A}" is referenced twice in the action "${T}" on node "${l.id}".`});continue}_.add(A);let M=h.get(A);if(M===void 0){r(`${R}.tasks.${A}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert das Template "${A}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" references the template "${A}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let U=k.get(A);U!==void 0&&U!==T?r(`${R}.tasks.${A}`,{de:`[optionalAction/taskDoublyBound] Template "${A}" auf Knoten "${l.id}" ist bereits von der Aktion "${U}" referenziert \u2014 ein Template geh\xF6rt zu h\xF6chstens einer optionalen Aktion.`,en:`[optionalAction/taskDoublyBound] Template "${A}" on node "${l.id}" is already referenced by the action "${U}" \u2014 a template belongs to at most one optional action.`}):k.set(A,T);let oe=M.blocks?.templateKey;typeof oe=="string"&&!v.has(oe)&&r(`${R}.tasks.${A}`,{de:`[optionalAction/taskRefBlocks] Template "${A}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${oe}", das nicht zur selben Aktion "${T}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${A}" on node "${l.id}" carries 'blocks' on "${oe}", which does not belong to the same action "${T}" \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===A&&(re!==void 0&&v.has(re)||r(`${R}.tasks.${A}`,{de:`[optionalAction/taskRefBlocks] Template "${A}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${re!==void 0?`"${re}"`:"einem Template"} au\xDFerhalb der Aktion "${T}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${A}" on node "${l.id}" is the target of a 'blocks' from ${re!==void 0?`"${re}"`:"a template"} outside the action "${T}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return t}s(L4,"checkOptionalActions");function M4(e,n,t,r,i){if(n.auto===void 0)return[];let o=s((d,c,u,p)=>({layer:"GRAPH",kind:"nodeRule",path:d,reason:{de:`[optionalAction/${c}] Optionale Aktion "${r}" auf Knoten "${e}": ${u}`,en:`[optionalAction/${c}] Optional action "${r}" on node "${e}": ${p}`},severity:"error"}),"issue");if(typeof n.auto!="boolean")return[o(`${t}.auto`,"autoType","'auto' ist true oder false.","'auto' is true or false.")];if(!n.auto)return[];let a=[];for(let d of["input","submitLabel"])n[d]!==void 0&&a.push(o(`${t}.${d}`,"autoInput",`startet beim Betreten des Schritts, niemand f\xFCllt den Dialog \u2014 '${d}' entfernen.`,`starts when the step is entered, nobody fills in the dialog \u2014 remove '${d}'.`));let l=Array.isArray(n.tasks)?n.tasks:[];for(let d of l)typeof d=="string"&&i.get(d)?.familyRequest!==void 0&&a.push(o(`${t}.tasks.${d}`,"autoFamilyRequest",`startet beim Betreten des Schritts, aber \u201E${d}\u201C fragt die Familie \u2014 was gefragt wird, w\xE4hlt erst ein Klick.`,`starts when the step is entered, but "${d}" asks the family \u2014 what it asks is chosen only by a click.`));return a}s(M4,"autoIssues");function q4(e,n,t,r,i){let o=[],a=s((u,p,h,y)=>{o.push({layer:"GRAPH",kind:"nodeRule",path:u,reason:{de:`[optionalAction/${p}] Optionale Aktion "${r}" auf Knoten "${e.id}": ${h}`,en:`[optionalAction/${p}] Optional action "${r}" on node "${e.id}": ${y}`},severity:"error"})},"push"),l=Array.isArray(e.requiresOneOf)?e.requiresOneOf:[];l.length===0&&a(`${t}.action`,"skipRuleWithoutRule","\xFCberspringt die Entscheidungsregel, aber der Knoten hat keine (`requiresOneOf`).","skips the decision rule, but the node has none (`requiresOneOf`)."),l.includes(n.key)&&a(`nodes.${e.id}.requiresOneOf`,"skipRuleListed","steht selbst in `requiresOneOf` \u2014 die Regel, die sie aufhebt, kann sie nicht erf\xFCllen.","is itself listed in `requiresOneOf` \u2014 it cannot meet the rule it lifts.");let d=e.assign?.decision;(!Array.isArray(d)||d.length===0)&&a(`${t}.action`,"skipRuleNeedsDecisionRow","braucht eine Entscheidungszeile (`assign.decision`), die festh\xE4lt, wer die Regel aufgehoben hat.","needs a decision row (`assign.decision`) that records who lifted the rule."),i.find(u=>u.action==="skipRule")!==n&&a(`${t}.action`,"skipRuleTwice","ist die zweite Aktion dieser Art am Knoten \u2014 eine reicht.","is the second action of this kind on the node \u2014 one is enough.");for(let u of["tasks","input","repeatable","submitLabel","auto"])n[u]!==void 0&&a(`${t}.${u}`,"skipRuleShape",`tr\xE4gt '${u}' \u2014 sie legt keine Aufgaben an.`,`carries '${u}' \u2014 it creates no tasks.`);return o}s(q4,"skipRuleIssues");function K4(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(K4,"literalValueType");function j4(e,n){let t=[],r=n?.notificationTemplates;for(let i of e.nodes){let o=i,a=CN(i,Je(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)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c}`,reason:{de:`[notification/unknownEvent] Knoten "${o.id}" bindet eine Benachrichtigung 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 notification 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)){t.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}) eine Benachrichtigung verschicken \u2014 es ist ${u===void 0?"keine gebunden":"eine gebunden, aber abgeschaltet"}.`,en:`[notification/missingBinding] Node "${o.id}" must send a notification 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"){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/internalAudienceUnsupported] Knoten "${o.id}": das Ereignis "${c.id}" richtet sich an die Schule, und Benachrichtigungen an die Schule k\xF6nnen noch nicht zugestellt werden \u2014 die gebundene Benachrichtigung "${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 notifications to the school cannot be delivered yet \u2014 the bound notification "${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){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/unknownTemplate] Knoten "${o.id}": die Benachrichtigung "${u.templateId}" ist nicht im Katalog. Bekannt sind: ${[...r.keys()].sort().join(", ")||"(keine)"}.`,en:`[notification/unknownTemplate] Node "${o.id}": the notification "${u.templateId}" is not in the catalog. Known: ${[...r.keys()].sort().join(", ")||"(none)"}.`},severity:"error"});continue}h.audience!==void 0&&h.audience!==c.audience&&t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/audienceMismatch] Die Benachrichtigung "${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 notification "${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 y=IN(c),k=new Set(h.params.map(w=>w.key));for(let w of Object.keys(u.args??{}))k.has(w)||t.push({layer:"GRAPH",kind:"nodeRule",path:`${p}.args.${w}`,reason:{de:`[notification/unknownArg] Die Benachrichtigung "${h.id}" hat kein Argument "${w}" \u2014 erwartet werden: ${h.params.map(b=>b.key).join(", ")||"(keine)"}.`,en:`[notification/unknownArg] The notification "${h.id}" has no argument "${w}" \u2014 expected: ${h.params.map(b=>b.key).join(", ")||"(none)"}.`},severity:"error"});for(let w of h.params){let b=u.args?.[w.key],E=`${p}.args.${w.key}`;if(b!==void 0&&"literal"in b){let R=K4(b.literal);w.type!==void 0&&!Ek(R,w.type)&&t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/argTypeMismatch] "${w.key}" erwartet ${ud(w.type).de}, festgelegt ist aber ${JSON.stringify(b.literal)} (${R}).`,en:`[notification/argTypeMismatch] "${w.key}" expects ${ud(w.type).en}, but ${JSON.stringify(b.literal)} (${R}) is set.`},severity:"error"});continue}if(b!==void 0){t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/unsupportedArg] "${w.key}" ist an ${JSON.stringify(b)} gebunden \u2014 ein Argument einer Benachrichtigung kann nur ein Festwert ({ literal }) sein oder automatisch aus ${OD(y,"de")} kommen.`,en:`[notification/unsupportedArg] "${w.key}" is bound to ${JSON.stringify(b)} \u2014 a notification argument can only be a fixed value ({ literal }) or come automatically from ${OD(y,"en")}.`},severity:"error"});continue}let T=ON(w,y.get(w.key)??[]);if(!(T.status==="resolved"||T.status==="unused")){if(T.status==="sometimes"){t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${w.key}" immer, ${T.source.source} liefert es aber nur manchmal. In notifications.${c.id}.args.${w.key} einen Festwert benennen \u2014 oder eine Benachrichtigung w\xE4hlen, die ohne "${w.key}" auskommt.`,en:`[notification/unresolvedArg] The notification "${h.id}" always needs "${w.key}", but ${T.source.source} provides it only sometimes. Name a fixed value in notifications.${c.id}.args.${w.key} \u2014 or choose a notification that works without "${w.key}".`},severity:"error"});continue}if(T.status==="ambiguous"){t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/ambiguousArg] "${w.key}" hat mehrere passende Quellen \u2014 ${T.matches.map(R=>R.source).join(", ")}. In notifications.${c.id}.args.${w.key} einen Festwert setzen.`,en:`[notification/ambiguousArg] "${w.key}" has several matching sources \u2014 ${T.matches.map(R=>R.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${w.key}.`},severity:"error"});continue}t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${w.key}"${w.type!==void 0?` (${ud(w.type).de})`:""}, und der Knoten hat daf\xFCr ${T.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${T.rejected.map(R=>`${R.source} (${R.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The notification "${h.id}" needs "${w.key}"${w.type!==void 0?` (${ud(w.type).en})`:""}, and the node has ${T.rejected.length===0?"no source for it":`only unsuitable sources for it: ${T.rejected.map(R=>`${R.source} (${R.type})`).join(", ")}`}.`},severity:"error"})}}}}return t}s(j4,"checkNotificationBindings");function V4(e){return uC(e).map(n=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:n,severity:"error"}))}s(V4,"checkAssignmentRules");function OD(e,n){let t=[...e.keys()].sort();return t.length===0?n==="de"?"(nichts)":"(nothing)":t.join(", ")}s(OD,"describeCandidates");function B4(e,n){return mC(e,n?.teamKeys).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(B4,"checkChannels");function U4(e){return qO(e).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(U4,"checkStaffInputs");function G4(e,n){let t=[];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${_e(e,r.id,"de")}\u201C (${r.id})`,en:`Node "${_e(e,r.id,"en")}" (${r.id})`},l=s(c=>{t.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!AC(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(!we(c))continue;let u=de(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),!un(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=Xr(n,c);p!=null&&ua("nodeReads",ca(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 t}s(G4,"checkReadinessReads");function z4(e,n){let t=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=K_(r),o=Rp(r);if(i===null||o===null)continue;let a=n?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${Mn.flagKey}`,reason:{de:`[setFlag/unknownFlag] Knoten \u201E${_e(e,r.id,"de")}\u201C (${r.id}) setzt \u201E${o}\u201C, aber das Formular von \u201E${_e(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 "${_e(e,r.id,"en")}" (${r.id}) sets "${o}", but the form of "${_e(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 t}s(z4,"checkSetFlagKeys");function W4(e,n){let t=n?.readinessFormFieldsByFormNode,r=n?.readinessPartyConditionKeysByFormNode;if(t===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(!we(a)||!$r(a))continue;let l=t.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=Mk(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(w=>un(w)&&w.owner===a.owner),h=Mk(l,[...p.map(w=>w.path),...$C(o).filter(w=>w.owner===a.owner).map(w=>w.fieldKey)]),y=[...c].filter(w=>!h.has(w)).sort();if(y.length===0)continue;let k={de:_e(e,a.owner,"de"),en:_e(e,a.owner,"en")};i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.reads`,reason:{de:`[readiness/readsMissesPartyCondition] Knoten \u201E${_e(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: ${y.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 "${_e(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: ${y.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(W4,"checkReadinessPartyConditions");function nb(e){let n=Object.keys(e.inputs??{});if(n.length===0)return[];let t=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(t?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(ha(e).map(l=>l.id));return n.filter(l=>!a.has(l))}s(nb,"undeclaredInputKeys");function Y4(e,n){return e.nodes.flatMap(t=>[...J4(e,t,ha(t),n),...H4(e,t,n)])}s(Y4,"checkUnknownResources");function H4(e,n,t){let r=[],i=new Set((Je(n).workItemTemplates?.(n)??[]).map(a=>a.key)),o=new Set((n.tasks??[]).filter(a=>a.familyRequest!==void 0).map(a=>String(a.key)));for(let a of jp(n)){if(a.leaf==="assign{}"&&!i.has(a.owner)||a.leaf==="tasks[].assign.group"&&a.missing&&o.has(a.owner))continue;let l=aa[a.leaf],d=`nodes.${n.id}.${a.path}`,c=s(h=>h==="de"?`Knoten \u201E${_e(e,n.id,"de")}\u201C (${n.id}), ${l.what.de} \u201E${a.owner}\u201C`:`node "${_e(e,n.id,"en")}" (${n.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=t?.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(H4,"referenceIssues");function J4(e,n,t,r){let i=[];for(let o of t){if(!Ip(o.type))continue;let a=ia[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=n.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=ia[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${_e(e,n.id,"de")}\u201C (${n.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 "${_e(e,n.id,"en")}" (${n.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(J4,"unknownResourceIssues");function Q4(e){let n=[];for(let t of e.nodes)for(let r of nb(t))n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${_e(e,t.id,"de")}\u201C (${t.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 "${_e(e,t.id,"en")}" (${t.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 n}s(Q4,"checkUndeclaredInputs");function Z4(e){let n=[];for(let t of e.nodes){let r=new Set;for(let i of ha(t)){if(!r.has(i.id)){r.add(i.id);continue}n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${_e(e,t.id,"de")}\u201C (${t.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 "${_e(e,t.id,"en")}" (${t.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 n}s(Z4,"checkDuplicateSlots");function PD(e,n,t){let r=[],i=F4(e);if(i.length>0)return i;r.push(...b4(e)),r.push(...w4(e)),r.push(...v4(e)),r.push(...k4(e)),r.push(...h4(e)),r.push(...g4(e)),r.push(...y4(e)),r.push(...A4(e)),r.push(...x4(e)),r.push(...JP(e,n)),r.push(...E4(e,n)),r.push(...T4(e,n)),r.push(...$4(e,n)),r.push(..._C(e,n?.layout)),r.push(...R4(e,n)),r.push(...I4(e,n)),r.push(..._4(e,n)),r.push(...jP(e,t)),r.push(...eN(e)),r.push(...oN(e)),r.push(...ZP(e)),r.push(...XP(e)),r.push(...Q4(e)),r.push(...Y4(e,t)),r.push(...Z4(e)),r.push(...P4(e)),r.push(...N4(e)),r.push(...WC(e,t)),r.push(...ZC(e)),r.push(...JC(e)),r.push(...XC(e,t)),r.push(...sD(e,t)),r.push(...D4(e)),r.push(...j4(e,t)),r.push(...L4(e,t)),r.push(...V4(e)),r.push(...G4(e,t)),r.push(...W4(e,t)),r.push(...z4(e,t)),r.push(...B4(e,t)),r.push(...U4(e)),r.push(...RD(e));for(let o of e.nodes){let a=Je(o);a.validate&&r.push(...a.validate(o,e,t))}return r}s(PD,"checkGraph");function X4(e,n){let t=e.requiresOneOf;if(t===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(t)||t.length===0||t.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=n.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of t){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(X4,"checkRequiresOneOf");function e3(e){return e.nodes.flatMap(n=>nb(n).map(t=>({nodeId:n.id,key:t,binding:n.inputs?.[t]?.kind==="binding"})))}s(e3,"undeclaredInputCells");function ND(e,n){let t=e3(e).filter(o=>n.bindings||!o.binding);if(t.length===0)return{graph:e,dropped:t};let r=new Map;for(let o of t)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:t}}s(ND,"dropUndeclaredInputs");function tb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(tb,"isObject");function CD(e){return tb(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(CD,"oldShape");function DD(e){return(e?.nodes??[]).some(CD)}s(DD,"needsTemplateStampMove");function n3(e){let n=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(n)?n:null;let t=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(t)?t:null}s(n3,"stampedFields");function t3(e){let n=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:n,reason:"templateAndStamp"}};let t={...e},r=[];if("template"in e){let{template:i}=e;if(delete t.template,tb(i))t.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:n,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete t.cockpitFields;let o=tb(e.inputs)?{...e.inputs}:{},a=n3(t);if(a===null&&i.length>0)return{unmoved:{nodeId:n,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:n,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:n,key:l,reason:"processSource"}):d?r.push({nodeId:n,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}t.inputs=o}return{node:t,reports:r}}s(t3,"moveNode");function FD(e){let n=[],t=[],r=[],i=e.nodes.map(o=>{if(!CD(o))return o;let a=t3(o);return"unmoved"in a?(r.push(a.unmoved),o):(n.push(String(o.id)),t.push(...a.reports),a.node)});return n.length===0?{graph:e,moved:n,reports:t,unmoved:r}:{graph:{...e,nodes:i},moved:n,reports:t,unmoved:r}}s(FD,"moveTemplateStampAndCockpit");var LD=ap,r3="applicant.applicationSubmitted";function Cm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Cm,"isObject");function MD(e){return Cm(e)&&e.type==="form"&&typeof e.id=="string"&&!It(e)}s(MD,"isCreatingFormNode");function i3(e){return Cm(e.notifications)&&LD in e.notifications}s(i3,"hasSubmittedBinding");function rb(e){let n={toBind:[],alreadyBound:[],malformed:[]};for(let t of e?.nodes??[])MD(t)&&(t.notifications!==void 0&&!Cm(t.notifications)?n.malformed.push(t.id):i3(t)?n.alreadyBound.push(t.id):n.toBind.push(t.id));return n}s(rb,"submitReceiptInventory");function qD(e){let{toBind:n}=rb(e);if(n.length===0)return{graph:e,bound:[]};let t=new Set(n),r=e.nodes.map(i=>{if(!MD(i)||!t.has(i.id))return i;let o=Cm(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[LD]:{templateId:r3}}}});return{graph:{...e,nodes:r},bound:n}}s(qD,"bindSubmitReceipt");var is=["park","advance"],lr="whenNothingOwed",KD={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function jD(e){let n=e.inputs?.[lr],t=n?.kind==="literal"?n.value:void 0;return ib(t)?t:null}s(jD,"reviewModeOrNull");function ib(e){return is.includes(e)}s(ib,"isReviewMode");function ob(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ob,"isObject");function VD(e){return ob(e)&&e.type==="review"&&!(ob(e.inputs)&&lr in e.inputs)}s(VD,"lacksMode");function BD(e){return(e?.nodes??[]).some(VD)}s(BD,"needsReviewMode");function UD(e){let n=[],t=e.nodes.map(r=>{if(!VD(r))return r;n.push(r.id);let i=ob(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[lr]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:t},set:n}}s(UD,"setReviewModePark");function Dm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Dm,"isObject");function GD(e){let{notifications:n,bound:t}=rm(e.notifications,{tasks:[]},e);return{next:n,bound:t}}s(GD,"bindingsFor");function zD(e){let n={toBind:[],malformed:[]};for(let t of e?.nodes??[])if(!(!Dm(t)||typeof t.id!="string"||ka(t).length===0)){if(t.notifications!==void 0&&!Dm(t.notifications)){n.malformed.push(t.id);continue}for(let r of GD(t).bound)n.toBind.push(`${t.id}.${r}`)}return n}s(zD,"appointmentLetterInventory");function WD(e){let n=[],t=!1,r=e.nodes.map(i=>{if(!Dm(i)||typeof i.id!="string"||ka(i).length===0||i.notifications!==void 0&&!Dm(i.notifications))return i;let{next:o,bound:a}=GD(i);return a.length===0?i:(t=!0,n.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return t?{graph:{...e,nodes:r},bound:n}:{graph:e,bound:[]}}s(WD,"bindAppointmentLetters");function Ma(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ma,"isObject");var YD=["id","label","dataFlow"],HD=["audience","populates","stages","expectedOutcomes"];function JD(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(n=>Ma(n)&&typeof n.slot=="string")}s(JD,"carriesStringSlots");function QD(e){return(e.nodes??[]).some(n=>Ma(n)&&n.type==="form"&&HD.some(t=>t in n))}s(QD,"carriesRetiredFormNodeKey");var o3=[{key:"generatorPin",editor:!0,holds:c_,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:G_,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:Q_,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:oP,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:e_,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:i_,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:DD,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:"paymentSettlement",editor:!0,holds:fP,what:{de:"Zahlungsknoten mit \u201EAbrechnung\u201C (`inputs.settlement`) statt \u201EZahlungsweg\u201C (`inputs.mode`)",en:'payment node with "Settlement" (`inputs.settlement`) instead of "Payment mode" (`inputs.mode`)'}},{key:"documentRef",editor:!0,holds:AP,what:{de:"Dokument eines anderen Knotens als `document:$node.<Knoten>.document` statt als Slot `artifact:<Slot>`",en:"another node's document as `document:$node.<node>.document` instead of the slot `artifact:<slot>`"}},{key:"formView",editor:!0,holds:gP,what:{de:"Ansicht einer Aufgabe als `formView` statt als Ansichts-Adresse `view`",en:"a task's view as `formView` instead of the view address `view`"}},{key:"nodeAssignString",editor:!0,holds:xP,what:{de:"Team einer Knoten-Aufgabe als Text (`assign.<Vorlage>`) statt als Regelliste",en:"a node task's team as text (`assign.<template>`) instead of a rule list"}},{key:"reviewWithoutMode",editor:!0,holds:BD,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=>qp(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=>YD.some(n=>n in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:JD,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:QD,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function ZD(e){if(!Ma(e)||!Array.isArray(e.nodes))return[];let n=e;return o3.filter(t=>t.holds(n)).map(({key:t,what:r,editor:i})=>({key:t,what:r,editor:i}))}s(ZD,"legacyGraphShapes");function XD(e,n){let t=n.answers??{},r=[],i=[],o=e,a=YD.filter(A=>A in o);if(a.length>0){let A={...o};for(let M of a)delete A[M],r.push({message:`graph.${M}: deleted (read by nothing)`});o=A}if(QD(o)&&(o={...o,nodes:o.nodes.map(A=>{if(!Ma(A)||A.type!=="form")return A;let M=HD.filter(oe=>oe in A);if(M.length===0)return A;let U={...A};for(let oe of M)delete U[oe];return r.push({nodeId:String(A.id),message:`form node: deleted ${M.map(oe=>`\`${oe}\``).join(", ")} (read by nothing)`}),U})}),JD(o)){let A=o.assignmentRules.map((M,U)=>{if(!Ma(M)||typeof M.slot!="string")return M;let oe=kp(M.slot);return oe===null?(i.push({code:"assignment/slotUnknown",answer:"edit",message:`assignmentRules[${U}].slot "${M.slot}" is neither \`responsible\` nor \`team:<key>\` \u2014 edit it by hand`}),M):(r.push({message:`assignmentRules[${U}].slot "${M.slot}" \u2192 ${JSON.stringify(oe)}`}),{...M,slot:oe})});o={...o,assignmentRules:A}}let l=u_(o);o=l.graph;for(let A of l.moved)r.push({nodeId:A,message:"generator / template pin moved into its input"});for(let A of l.unmoved)i.push({code:`generatorPin/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${A.reason}) \u2014 edit the node by hand`});let d=z_(o);o=d.graph;for(let A of d.moved)r.push({nodeId:A,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let A of d.unmoved)i.push({code:`setFlag/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${A.reason}) \u2014 edit the node by hand`});let c=Z_(o);o=c.graph;for(let A of c.moved)r.push({nodeId:A,message:"scalar settings moved into inputs"});for(let A of c.unmoved)i.push({code:`scalar/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`\`${A.key}\` cannot be moved into an input (${A.reason}) \u2014 edit the node by hand`});let u=sP(o);o=u.graph;for(let A of u.moved)r.push({nodeId:A,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let A of u.unmoved)i.push({code:`nodeConfig/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`\`${A.key}\` cannot be moved into an input (${A.reason}) \u2014 edit the node by hand`});let p=FD(o);o=p.graph;for(let A of p.moved){let M=o.nodes.find(Q=>Ma(Q)&&Q.id===A),U=M?.inputs?.documentTemplate,oe=U?.kind==="literal"&&typeof U.value=="string"?U.value:null;r.push({nodeId:A,message:M!==void 0&&"templateStamp"in M&&oe!==null?`template parameters moved onto \`templateStamp\` / cockpit list into cells \u2014 the record \`${oe}\` 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 A of p.reports)r.push({nodeId:A.nodeId,message:`cockpit field \`${A.key??""}\` deleted (${A.reason}: ${A.reason==="unknownKey"?"the stamp declares no such parameter":A.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let A of p.unmoved)i.push({code:`templateStamp/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:A.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":A.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=o_(o);o=h.graph;for(let A of h.moved)r.push({nodeId:A,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let A of h.unmoved)i.push({code:`eventTrigger/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${A.reason}) \u2014 edit the node by hand`});let y=n_(o,t.semantics);o=y.graph;for(let A of y.written){if(A.source==="formerDefault"){r.push({nodeId:A.nodeId,message:`outcome \`${A.outcomeId}\`: semantic "${A.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${A.nodeId}.${A.outcomeId}`,value:A.semantic}});continue}r.push({nodeId:A.nodeId,message:`outcome \`${A.outcomeId}\`: semantic "${A.semantic}" (${A.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let A of y.refused)i.push({code:A.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:A.nodeId,answer:"semantic",answerKey:`${A.nodeId}.${A.outcomeId}`,candidates:A.allowed,message:A.answer===void 0?`${A.nodeType} outcome \`${A.outcomeId}\` ran as "${Tw(A.outcomeId)??""}", which a ${A.nodeType} outcome may no longer carry \u2014 say which one it is`:`${A.nodeType} outcome \`${A.outcomeId}\`: "${A.answer}" is not a meaning a ${A.nodeType} outcome may carry`});for(let A of y.invalid)i.push({code:"outcome/semanticInvalid",nodeId:A.nodeId,answer:"edit",candidates:Rt,message:`outcome \`${A.outcomeId}\` carries the semantic "${A.value}", which is no meaning \u2014 edit it`});let k=l_(o,n.selection,t.waitlistPolicy);o=k.graph;for(let A of k.moved){let M=A.policy.waitlistOrder;r.push({nodeId:A.nodeId,message:`waitlist policy into inputs: ${s3(A.policy)} (${A.source==="answer"?"answered":A.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...A.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:A.nodeId,value:M}}:{}})}for(let A of k.refused)i.push({code:`waitlist/${A.reason}`,nodeId:A.nodeId,answer:"waitlistPolicy",answerKey:A.nodeId,candidates:rr,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});let w=pP(o);o=w.graph;for(let A of w.moved)r.push({nodeId:A,message:"payment: `inputs.settlement` \u2192 `inputs.mode` (separate \u2192 manual)"});for(let A of w.refused)i.push({code:`collectPayment/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:A.reason==="bothCells"?"the payment node carries both `inputs.settlement` and `inputs.mode` \u2014 delete `settlement` by hand":"`inputs.settlement` is no literal online | separate \u2014 set `inputs.mode` by hand"});let b=yP(o);o=b.graph;for(let A of b.moved)r.push({nodeId:A.split(".")[0],message:`\`formView\` \u2192 \`view\` (${A})`});for(let A of b.refused){let M=A.taskKey===void 0?"the node":`task "${A.taskKey}"`;i.push({code:`view/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:A.reason==="bothFields"?`${M} carries both \`formView\` and \`view\` \u2014 delete \`formView\` by hand`:`${M}'s \`formView\` is no { form, key } \u2014 set \`view\` by hand`})}let E=SP(o);o=E.graph;for(let A of E.moved)r.push({nodeId:A.nodeId,message:`\`assign.${A.templateKey}\`: team \u2192 rule list`});for(let A of E.refused)i.push({code:"assign/shape",nodeId:A.nodeId,answer:"edit",message:`\`assign.${A.templateKey}\` is neither a team key nor a rule list \u2014 set it by hand`});let T=EP(o);o=T.graph;for(let A of T.moved)r.push({nodeId:A.split(".")[0],message:`documents: \`document:$node.<node>.document\` \u2192 \`artifact:<slot>\` (${A})`});for(let A of T.refused)i.push({code:`workItems/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`task "${A.taskKey}" links a document whose node declares no single slot \u2014 name the slot as \`artifact:<slot>\` by hand`});if(lP(o)){let A=dP(o,t.payee);o=A.graph;for(let M of A.set)r.push({nodeId:M.nodeId,message:`online payment: payee "${M.payee}" (answered)`});for(let M of A.refused)i.push({code:"collectPayment/payeeMissing",nodeId:M,answer:"payee",answerKey:M,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 A of rb(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:A,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let R=qD(o);o=R.graph;for(let A of R.bound)r.push({nodeId:A,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let P=UD(o);o=P.graph;for(let A of P.set)r.push({nodeId:A,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let A of zD(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:A,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let L=WD(o);o=L.graph;for(let A of L.bound){let M=A.indexOf(".");r.push({nodeId:A.slice(0,M),message:`appointment letter bound to \`notifications.${A.slice(M+1)}\` (the standard letter, sent by code before)`})}let _=qp(o).filter(A=>!A.hasTeam);for(let A of _)i.push({code:"task/userWithoutTeam",nodeId:A.nodeId,answer:"edit",message:`task \`${A.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let v=TP(o);o=v.graph;for(let A of v.dropped.filter(M=>M.hasTeam))r.push({nodeId:A.nodeId,message:`task \`${A.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let N=ND(o,{bindings:!0});o=N.graph;for(let A of N.dropped){if(!A.binding){r.push({nodeId:A.nodeId,message:`input \`${A.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:A.nodeId,message:`input \`${A.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:`${A.nodeId}.${A.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(XD,"upgradeGraph");function s3(e){return`waitlistOrder=${e.waitlistOrder}`}s(s3,"formatPolicy");function Ei(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ei,"isObject");var eF="admission.generic",nF=Object.keys(gp).filter(e=>e!=="label");function tF(e){return Ei(e.smartforms)?Object.entries(e.smartforms):[]}s(tF,"smartformEntries");function a3(e){let n=[];tF(e.index).some(([,i])=>Ei(i)&&"outcomeFnRef"in i)&&n.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let t=Object.keys(e.manifest).filter(i=>Object.hasOwn(Yl,i));if(t.length>0){let i=t.map(o=>`\`${o}\``).join(", ");n.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>nF.some(o=>o in i))&&n.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"});let r=e.workflow;return r!==void 0&&(Ei(r.progressWiring)&&"layoutId"in r.progressWiring&&n.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),n.push(...ZD(r.graph).map(i=>i.what))),n}s(a3,"legacyBundleShapes");function Lm(e,n){let t=a3(e);t.length!==0&&ae("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${n} stammt aus einem \xE4lteren Bundle-Format (${t.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: ${n} is in an older bundle format (${t.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(Lm,"assertBundleCurrent");function Fm(e){let n=s(t=>Array.isArray(t)?t.map(n):Ei(t)?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(Fm,"canonical");function rF(e,n={}){let t=[],r=[],i=e.index,o=tF(i);if(o.some(([,u])=>Ei(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!Ei(h)||Object.keys(h).length===0){u[p]=h;continue}let{outcomeFnRef:y,...k}=h;if(Object.keys(k).length>0||y!==void 0&&y!==eF){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(w=>`\`${w}\``).join(", ")} \u2014 only \`outcomeFnRef: ${eF}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}t.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,t.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?t.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},t.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):Fm(l.progressLayout)===Fm(p)?t.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}t.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(Ei(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},t.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(Ei(u)&&Array.isArray(u.nodes)){let p=XD(u,{selection:d,answers:n});l={...l,graph:p.graph},t.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 y={...h},k=`smartforms/${p}.json`;for(let w of nF)if(w in h){if(w==="outcomeIds"){let b=Array.isArray(h.outcomes)?h.outcomes.map(E=>Ei(E)?E.id:void 0):[];if(Fm([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==Fm(b.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 y[w],t.push({file:k,message:`\`${w}\` deleted (${gp[w].en})`})}u[p]=y}c=u}return{bundle:{index:i,manifest:a,...c!==void 0?{smartforms:c}:{},...l!==void 0?{workflow:l}:{}},changes:t,refusals:r}}s(rF,"upgradeOfferBundle");var l3={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},yxe={createManifest:lt.workflow.createManifestInternal,publishManifest:lt.workflow.publishManifestInternal,publishOfferInternal:lt.workflow.publishOfferInternalInternal,publishOfferExternal:lt.workflow.publishOfferExternalInternal,getOfferPublishState:lt.workflow.getOfferPublishStateInternal,upsertCustomField:lt.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:lt.admission.upsertDerivedAttributeRuleInternal,createSmartForm:lt.forms.createSmartFormInternal,getSmartFormBySlug:lt.forms.getSmartFormBySlugInternal,saveSmartFormDraft:lt.forms.saveSmartFormDraftInternal,publishSmartForm:lt.forms.publishSmartFormInternal,createWorkflow:lt.workflow.createWorkflowInternal,getWorkflowGraph:lt.workflow.getWorkflowGraphInternal,saveWorkflowDraft:lt.workflow.saveWorkflowDraftInternal,publishWorkflow:lt.workflow.publishWorkflowInternal};function sb(e,n){for(let[t,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&ae("INVALID",{de:`offer: ${n}: smartforms.${t} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${n}: smartforms.${t} 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: ${n}: smartforms.${t} 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: ${n}: smartforms.${t} 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(sb,"assertSmartformEntries");function iF(e){let n=s(t=>Array.isArray(t)?t.map(n):t&&typeof t=="object"?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(iF,"canonicalJson");function oF(e,n){return n==null?!0:iF(e)!==iF(n)}s(oF,"changed");async function sF(e,n,t,r={},i=l3){let{index:o}=n;Lm({index:o,manifest:n.manifest,...n.smartforms!==void 0?{smartforms:n.smartforms}:{},...n.workflow!==void 0?{workflow:n.workflow}:{}},`bundle of ${o.slugs.manifest}`),sb(o,`bundle of ${o.slugs.manifest}`);let a=hp(n.manifest);a.length>0&&ae("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11373
|
+
{{einstellungenLink}}`}}]},xk=[NY,qY,VY,BY,UY,HY,YY,xH,AH,DH,LH,qH,VH,GH,WH,JH,XH,tJ,iJ,EH,TH,$H,oJ,sJ,aJ,JY,QY,eH,nH,iH,dH,fH,sH,hH,bH,PH,TJ,RJ,DY,LY,dJ,uJ,pJ,hJ,yJ,kJ,vJ];function Sk(e){let n=xk.find(t=>t.id===e);return n===void 0&&F(`notifications: unknown letter "${e}"`),n}s(Sk,"letterDefFor");function Ak(e){return xk.some(n=>n.id===e)}s(Ak,"hasLetterDef");function Ek(e,n){return n===void 0?!0:Op(e,n)}s(Ek,"letterArgCompatible");function ud(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${dt(e)} (${e})`,en:`${dt(e)} (${e})`}}s(ud,"letterArgTypeLabel");function IN(e){let n=new Map,t=s((r,i)=>{let o=n.get(r);o===void 0?n.set(r,[i]):o.push(i)},"add");for(let r of e.args)t(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of mN)t(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return n}s(IN,"eventArgSources");function ON(e,n){let t=e.type===void 0?[...n]:n.filter(r=>Ek(r.type,e.type));if(t.length>1)return{status:"ambiguous",matches:t};if(t.length===1){let r=t[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...n]}:{status:"unused"}}s(ON,"resolveLetterParam");var Tk=["booked","rescheduled","cancelled"],IJ={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},PN=":";function NN(e,n){return`${e}${PN}${n}`}s(NN,"appointmentEventId");function OJ(e){let n=e.lastIndexOf(PN);if(n<=0)return null;let t=e.slice(n+1);return Tk.includes(t)?{taskKey:e.slice(0,n),kind:t}:null}s(OJ,"parseAppointmentEventId");var _N={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function ka(e){return Array.isArray(e.tasks)?e.tasks.filter(n=>typeof n?.key=="string"&&n.result?.kind==="appointment"):[]}s(ka,"appointmentTasksOf");function _J(e){return Tk.map(n=>({id:NN(e.key,n),label:{de:`${_N[n].de} \u2013 \u201E${e.title.de}\u201C`,en:`${_N[n].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(_J,"appointmentTaskEvents");function CN(e,n){let t=n.notificationEvents?.(e)??[],r=ka(e).flatMap(_J);return r.length===0?t:[...t,...r]}s(CN,"nodeNotificationEvents");function PJ(e){return Object.fromEntries(Tk.map(n=>[NN(e,n),{templateId:IJ[n]}]))}s(PJ,"defaultAppointmentBindings");function NJ(e,n){if(e===void 0)return{notifications:e,dropped:[]};let t=[],r={};for(let[i,o]of Object.entries(e))OJ(i)?.taskKey===n?t.push(i):r[i]=o;return t.length===0?{notifications:e,dropped:t}:{notifications:Object.keys(r).length===0?void 0:r,dropped:t}}s(NJ,"withoutAppointmentBindings");function rm(e,n,t){let r=new Set(ka(n).map(d=>d.key)),i=new Set(ka(t).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=NJ(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(PJ(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(rm,"syncAppointmentBindings");function CJ(e){return e.kind==="task"&&!("title"in e)}s(CJ,"isLegacyFreeTodoContext");function $k(e){let{context:n}=e;if(CJ(n)&&F(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),n.kind==="task")return{...e,context:n,kind:"task",createdVia:"human",partyId:n.partyId};let{anchor:t,task:r,kind:i,title:o,description:a,...l}=n,d=t.scope==="node"?{nodeId:t.nodeId,templateKey:t.templateKey,gatesNode:t.gatesNode,blocks:t.blocks}:t.scope==="application"?{scope:"application",templateKey:t.templateKey}:t.scope==="crossNode"?{scope:"application",nodeId:t.nodeId,templateKey:t.templateKey,blocks:t.blocks}:{};return{...e,context:n,...l,...d,...r??{},kind:i}}s($k,"readWorkItem");async function ba(e,n){let t;if(n.nodeId!==void 0){let r=n.nodeId;t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(n.isOpen!==void 0){let r=n.isOpen;t=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",n.applicationId).eq("isOpen",r)).collect()}else t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",n.applicationId)).collect();return t.filter(r=>n.isOpen===void 0||r.isOpen===n.isOpen).map($k)}s(ba,"listWorkItemsForApplication");var vye=m.union(m.literal("approved"),m.literal("rejected")),fd=new Set(["task","approval"]);function FJ(e,n){switch(e){case"task":return n?.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:n?.gatesNode??!0};default:F(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...fd].join(", ")}`)}}s(FJ,"expandComposedTask");for(let e of["task","approval"]){let n=FJ(e);n.kind==="approval"!=(n.isApproval===!0)&&F(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var DN=zi,to=`${DN}.`,LJ=new Set(["text","number","date","boolean","option","edge"]);function im(e,n){let t=e[n];return t===void 0&&F(`[env/unknownKey] no environment key '${n}'`),typeof t=="string"?null:Object.keys(t)}s(im,"contextFields");function FN(e,n){return Object.hasOwn(e,n)}s(FN,"isContextKey");function LN(e){let n=[];for(let t of Object.keys(e)){let r=im(e,t);if(r===null)n.push(t);else for(let i of r)n.push(`${t}.${i}`)}return n}s(LN,"leafPaths");function pd(e,n){let[t="",r,...i]=n.split(".");if(!FN(e,t)||i.length>0)return;let o=e[t];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s(pd,"leafType");function MN(e){let n=new Set;for(let t of e){let r=va(t);r!==null&&n.add(r.split(".")[0])}return[...n]}s(MN,"contextKeysOf");function va(e){return e.startsWith(to)?e.slice(to.length):null}s(va,"contextPathOf");function md(e){return e===DN||e.startsWith(to)}s(md,"isContextIdentifier");function om(e,n){let t=va(n)??"",[r=""]=t.split("."),i=Object.keys(e);if(!FN(e,r))return{code:"env/unknownKey",message:{de:`'${n}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${n}' names no environment key \u2014 known: ${i.join(", ")}.`}};if(pd(e,t)!==void 0)return null;let o=im(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${n}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${to}${r}'.`,en:`'${n}': environment key '${r}' is a single value \u2014 read it as '${to}${r}'.`}:{de:`'${n}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${n}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(om,"identifierIssue");function sm(e,n,t=Object.keys(e)){let r={};for(let i of t){let o=im(e,i),a=Object.hasOwn(n,i)?n[i]:void 0;if(a===void 0&&F(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${to}${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[`${to}${i}.${l}`]=d}}return r}s(sm,"flatten");function qN(e,n,t){if(t===void 0)return!1;let r=im(e,n);return r===null?!0:typeof t=="object"&&t!==null&&r.every(i=>t[i]!==void 0)}s(qN,"contextValueComplete");function MJ(e,n){switch(n){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(MJ,"valueMatchesDataType");function KN(e,n,t=Object.keys(e.types)){let r=new Set(t);for(let i of LN(e.types)){if(!r.has(i.split(".")[0]))continue;let o=n[`${to}${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=dt(pd(e.types,i));MJ(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(KN,"assertContextValues");function qJ(e){let n=[],t=LN(e.types);for(let r of t){let i=pd(e.types,r),o=dt(i);if(!Hi(i)||o===void 0||!LJ.has(o)){n.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){n.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&n.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&n.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))t.includes(r)||n.push(`field spec '${r}' names no leaf of the schema`);return n}s(qJ,"schemaIssues");function xa(e){let n=qJ(e);n.length>0&&F(`[env/schema] ${n.join("; ")}`)}s(xa,"assertSchema");var am={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function ro(e){return JSON.stringify(e)}s(ro,"canonical");function Aa(e){return e.kind==="binary"&&e.op==="&&"?[...Aa(e.left),...Aa(e.right)]:[e]}s(Aa,"conjuncts");function BN(e,n){let t;try{t=Fn(e)}catch{return!1}let r=ro(Fn(n));return Aa(t).some(i=>ro(i)===r)}s(BN,"hasConjunct");function UN(e,n){try{return ro(Fn(e))===ro(Fn(n))}catch{return!1}}s(UN,"sameCondition");function GN(e){let n=[];for(let t of e)n.push(...Ln(yi(t)));return MN(n)}s(GN,"contextKeysRead");function zN(e){try{return Ln(Fn(e)).some(md)}catch{return!1}}s(zN,"readsContext");var KJ=/^\d{4}-\d{2}-\d{2}$/,jJ=new Set(["==","!=","<","<=",">",">=","in"]),VJ=new Set(["<","<=",">",">="]);function dm(e,n,t=[]){xa(n);let r;try{r=Fn(e)}catch(a){let l=a.message;return[et("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of Ln(r)){if(!md(a)){i.push(et("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=om(n.types,a);l!==null&&i.push(et("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=ei(r,n,i);hd(o)||i.push(et("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),zJ(r,n,i);for(let{identifier:a,op:l}of Ok(r,n))i.push(et("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(...BJ(r,t)),i}s(dm,"conditionIssues");function BJ(e,n){let t=Aa(e).map(ro);return n.flatMap(r=>{let i=Fn(r),o=UJ(i);return o===null||!t.includes(ro(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(BJ,"guardFormHints");function UJ(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let n={...e,left:e.right,right:e.left};return ro(n)===ro(e)?null:n}s(UJ,"mirror");function hd(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(hd,"isBooleanish");function WN(e){let n=va(e);return n===null&&F(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),n}s(WN,"contextPath");function YN(e,n){let t=va(n);return t!==null&&e.fields[t]?.nullable===!0}s(YN,"isNullableLeaf");function GJ(e,n){let t=dt(pd(e.types,WN(n)));return t===void 0?{t:"unknown"}:{t:"data",dt:t}}s(GJ,"identType");function lm(e,n){return e.t==="unknown"||n.t==="unknown"||e.t==="null"||n.t==="null"?!0:e.t==="array"||n.t==="array"?!1:e.t==="str"&&n.t==="str"?!0:e.t==="str"?jN(e.value,n.dt):n.t==="str"?jN(n.value,e.dt):e.dt===n.dt}s(lm,"fits");function jN(e,n){return n==="text"||n==="option"||n==="edge"?!0:n==="date"?KJ.test(e):!1}s(jN,"strFits");function VN(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(VN,"orderedCategory");function ei(e,n,t){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 GJ(n,e.path);case"arr":for(let r of e.items)ei(r,n,t);return{t:"array"};case"unary":{let r=ei(e.operand,n,t);return hd(r)||t.push(et("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(am,e.name)?am[e.name]:void 0,i=e.args.map(l=>ei(l,n,t));return r===void 0?(t.push(et("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(am).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(am).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&lm(l,{t:"data",dt:r.params[d]}))||t.push(et("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=ei(e.cond,n,t);hd(r)||t.push(et("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=ei(e.then,n,t),o=ei(e.else,n,t);return lm(i,o)||t.push(et("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=ei(e.left,n,t),i=ei(e.right,n,t);if(e.op==="&&"||e.op==="||")(!hd(r)||!hd(i))&&t.push(et("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?t.push(et("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=>lm(r,ei(o,n,[])))||t.push(et("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(VJ.has(e.op)){let o=VN(r),a=VN(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&t.push(et("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 lm(r,i)||t.push(et("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(ei,"typeOf");function Rk(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(Rk,"isLiteral");function HN(e){let n=[],t=s(r=>{if(r.kind==="binary"&&jJ.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(Rk):Rk(r.right)?[r.right]:[];i.length>0&&n.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&Rk(r.left)&&n.push({ident:r.right.path,literals:[r.left]})}JN(r,t)},"visit");return t(e),n}s(HN,"comparedLiterals");function zJ(e,n,t){for(let{ident:r,literals:i}of HN(e)){let o=WJ(r,i,n);o!==null&&t.push(o)}}s(zJ,"literalIssues");function Ik(e,n){let t;try{t=Fn(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of HN(t)){let a=va(i);if(!(a===null||n.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(Ik,"liveLiterals");function WJ(e,n,t){let r=t.fields[WN(e)]?.valueSet;if(r?.kind==="unstable")return et("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=n.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 et("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(WJ,"valueSetIssue");function JN(e,n){switch(e.kind){case"binary":n(e.left),n(e.right);return;case"unary":n(e.operand);return;case"call":e.args.forEach(n);return;case"arr":e.items.forEach(n);return;case"if":n(e.cond),n(e.then),n(e.else);return;default:return}}s(JN,"forEachChild");function QN(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(QN,"isNullTest");function ZN(e){return Aa(e).flatMap(n=>{let t=XN(n);return t===null?[]:[t]})}s(ZN,"guardsOf");function gd(e,n,t){switch(e.kind){case"ident":return YN(n,e.path)&&!t.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=gd(r,n,t);if(i!==null)return i}return null;case"if":return gd(e.then,n,new Set([...t,...ZN(e.cond)]))??gd(e.else,n,t);default:return null}}s(gd,"unguardedNullSource");function XN(e){return!QN(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(XN,"guardedIdent");function Sa(e,n,t,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(t);for(let o of Aa(e)){Sa(o,n,i,r);let a=XN(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Sa(e.cond,n,t,r),Sa(e.then,n,new Set([...t,...ZN(e.cond)]),r),Sa(e.else,n,t,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=gd(e.left,n,t)??gd(e.right,n,t);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!QN(e.operand)){let i=Ln(e.operand).filter(o=>YN(n,o)&&!t.has(o));i.length>0&&r(i[0],"!")}JN(e,i=>Sa(i,n,t,r))}s(Sa,"nullableReads");function Ok(e,n){xa(n);let t=[];return Sa(e,n,new Set,(r,i)=>{t.some(o=>o.identifier===r)||t.push({identifier:r,op:i})}),t}s(Ok,"unguardedNullableReads");function et(e,n,t){return{severity:"error",code:e,message:{de:`[${e}] ${n}`,en:`[${e}] ${t}`}}}s(et,"error");function yd(e){let n=Array.isArray(e.nodes)?e.nodes:[],t=new Set;for(let r of n)for(let i of jp(r))i.key!==null&&aa[i.leaf].involves&&t.add(i.key);return t}s(yd,"declaredGroupKeys");var Ea=cp;var YJ="unit.key",HJ="offer.key";function eC(e,n){return e===YJ?n.unitKeys:e===HJ?n.offerKeys:null}s(eC,"liveKeyUniverse");function cm(e){return[wn,...[...yd(e)].sort((n,t)=>n.localeCompare(t)).map(yp)]}s(cm,"requiredSlots");var io=`${fp("applicant.channel")} == 'staff'`;var Pk=["strict","leastLoaded"];var _k=2;function nC(e){return e.some(n=>n.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<_k?{de:`braucht mindestens ${_k} Personen`,en:`needs at least ${_k} people`}:null}s(nC,"rotationPoolProblem");function JJ(e,n){let t=n===null?-1:e.indexOf(n);return[...e.slice(t+1),...e.slice(0,t+1)]}s(JJ,"strictOrder");function tC(e){let n=JJ(e.pool,e.previous).filter(i=>e.eligible.has(i));if(n.length===0)return null;if(e.mode==="strict")return n[0];let t=e.openCounts;t===void 0&&F("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=t.get(i);return o===void 0&&F(`[assignment/rotation] no open count for '${i}'`),o},"load");return n.reduce((i,o)=>r(o)<r(i)?o:i)}s(tC,"pickFromPool");function iC(e){return e.map(n=>({slot:HO(n.slot),rules:[...n.rules]}))}s(iC,"rulesOfStored");function oC(e){return e.map(n=>({slot:QJ(n.slot),rules:[...n.rules]}))}s(oC,"storedOfRules");function QJ(e){let n=kp(e);return n===null&&F(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),n}s(QJ,"slotOf");function sC(e,n){let t=e?.assignmentRules;t===void 0&&F(`[assignment/noRules] ${n}: the workflow has no assignment rule`);let r=cC(t);return r.length>0&&F(`${r.join("; ")} (${n})`),iC(t)}s(sC,"rulesOfGraph");function ZJ(e){return e===wn?{slot:e,rules:[{when:io,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(ZJ,"defaultSlotRules");function aC(e,n){let t=new Set(e.map(o=>o.slot)),r=n.filter(o=>!t.has(o)).map(ZJ);return[...r.filter(o=>o.slot===wn),...e,...r.filter(o=>o.slot!==wn)]}s(aC,"withRequiredSlots");function qn(e,n){return n===void 0?`slot '${e}'`:`slot '${e}' row #${n+1}`}s(qn,"where");function jt(e,n){return n===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${n+1}`}s(jt,"whereDe");function Ot(e,n,t={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${n.de}`,en:`[${e}] ${n.en}`},...t}}s(Ot,"issue");function rC(e){if(e===wn)return!0;let n=wp(e);return n!==null&&n.length>0}s(rC,"isKnownSlot");function XJ(e,n){xa(Ea);let t=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;rC(l)||t.push(Ot("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)&&t.push(Ot("assignment/duplicateSlot",{de:`${jt(l)} steht zweimal da`,en:`${qn(l)} is listed twice`},{slot:l})),r.add(l),l===wn&&a!==0&&t.push(Ot("assignment/responsibleFirst",{de:`'${wn}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${wn}' must be the first slot \u2014 team rows copy it`},{slot:l})),t.push(...e6(o))});for(let o of n)r.has(o)||t.push(Ot("assignment/slotMissing",{de:`${jt(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${qn(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(n);for(let{slot:o}of e)o!==wn&&!i.has(o)&&rC(o)&&t.push(Ot("assignment/unusedSlot",{de:`${jt(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${qn(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return t}s(XJ,"validateRules");function e6({slot:e,rules:n}){let t=[];return(n.length===0||n[n.length-1].when!==null)&&t.push(Ot("assignment/defaultRowMissing",{de:`${jt(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${qn(e)} must end with a row without condition ("otherwise")`},{slot:e})),n.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<n.length-1&&t.push(Ot("assignment/ruleAfterDefault",{de:`${jt(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${qn(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=dm(a,Ea,[io]);for(let c of d)t.push({...c,message:{de:`${c.message.de} (${jt(e,i)})`,en:`${c.message.en} (${qn(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){zN(a)||t.push(Ot("assignment/shadowedRule",{de:`${jt(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${qn(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=n.slice(0,i).findIndex(u=>u.when!==null&&UN(u.when,a));c!==-1&&t.push(Ot("assignment/shadowedRule",{de:`${jt(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${qn(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===wn&&l.kind==="slot"&&t.push(Ot("assignment/slotForwardRef",{de:`${jt(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${wn}'`,en:`${qn(e,i)} copies '${l.slot}' \u2014 only a team slot after '${wn}' may`},o)),e===wn&&l.kind==="queue"&&t.push(Ot("assignment/queueOnProcessSlot",{de:`${jt(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${qn(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&t.push(Ot("assignment/targetMissing",{de:`${jt(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${qn(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=nC(l.configKeys);d!==null&&t.push(Ot("assignment/rotationPool",{de:`${jt(e,i)}: die Reihum-Liste ${d.de}`,en:`${qn(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!BN(a,io))&&t.push(Ot("assignment/unguardedTarget",{de:`${jt(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${io}' ist (oder enth\xE4lt)`,en:`${qn(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${io}'`},o))}),t}s(e6,"rowIssues");function lC(e,n){for(let r of n)e.some(i=>i.slot===r)||F(`[assignment/slotMissing] ${qn(r)} has no rule list`);let t=new Set(n);return e.filter(r=>t.has(r.slot))}s(lC,"selectSlots");function n6(e,n){return GN(lC(e,n).flatMap(t=>t.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(n6,"contextKeysOfRules");function dC(e,n,t,r){xa(Ea);let i=lC(e,t),o=n6(e,t),a=sm(Ea.types,n,o);KN(Ea,a,o);let l=[];for(let{slot:d,rules:c}of i){let u=c.findIndex((h,y)=>{if(h.when===null)return!0;for(let k of Ln(yi(h.when)))Object.hasOwn(a,k)||F(`[condition/unknownIdentifier] ${qn(d,y)} reads '${k}', which the context does not carry`);return A_(h.when,{values:a})});u===-1&&F(`[assignment/defaultRowMissing] ${qn(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:t6(d,u,p,l,r)})}return l}s(dC,"evaluateRules");function t6(e,n,t,r,i){switch(t.kind){case"person":return{kind:"value",value:i.person(t.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(t,{slot:e,row:n})};case"unassigned":return F(`[assignment/targetMissing] ${qn(e,n)} names no one`);case"queue":return e===wn&&F(`[assignment/queueOnProcessSlot] ${qn(e,n)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===wn?void 0:r.find(a=>a.slot===t.slot);return o===void 0&&F(`[assignment/slotForwardRef] ${qn(e,n)} copies '${t.slot}', which is not decided before it`),o.value}}}s(t6,"resolveTarget");var Nk={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function r6(e){if(typeof e!="object"||e===null)return!1;let{kind:n,groupKey:t,...r}=e;return Object.keys(r).length>0?!1:n==="responsible"?t===void 0:n==="team"&&typeof t=="string"&&t.length>0}s(r6,"isStoredSlot");function cC(e){let n=[],t=s((r,i)=>n.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 t(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&t(o,`unknown field(s) ${Object.keys(d).join(", ")}`),r6(a)||t(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return t(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return t(p,"must be { when, assign }");let{when:h,assign:y,...k}=c;Object.keys(k).length>0&&t(p,`unknown field(s) ${Object.keys(k).join(", ")}`),h!==null&&typeof h!="string"&&t(p,"when must be a condition string or null (\u201Esonst\u201C)");let w=y?.kind;if(typeof y!="object"||y===null||typeof w!="string"||!Object.hasOwn(Nk,w))return t(p,`assign must be one of ${Object.keys(Nk).map(R=>`{kind:'${R}'}`).join(", ")}`);let b=Nk[w],E=Object.keys(y);(E.some(R=>!b.includes(R))||b.some(R=>!E.includes(R)))&&t(p,`a '${w}' target has exactly the field(s) ${b.join(", ")}`);let T=y;if(w==="person"&&(typeof T.configKey!="string"||T.configKey.length===0)&&t(p,"a 'person' target needs a non-empty configKey"),w==="rotation"){let R=T.configKeys;(!Array.isArray(R)||R.some(P=>typeof P!="string"))&&t(p,"a 'rotation' target needs configKeys, a list of person keys"),Pk.includes(T.mode)||t(p,`a 'rotation' target's mode is one of ${Pk.map(P=>`'${P}'`).join(", ")}`)}w==="slot"&&T.slot!==wn&&t(p,`a 'slot' target copies '${wn}' and nothing else`)})}),n):(t("slots","must be a list of { slot, rules }"),n)}s(cC,"ruleShapeIssues");function uC(e){let n=e??{},t=[];if(n.teamOwnerBindings!==void 0&&t.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"}),n.assignmentRules===void 0)return t.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"}),t;let r=cC(n.assignmentRules);if(r.length>0)return[...t,...r.map(o=>({de:o,en:o}))];let i=cm({nodes:Array.isArray(n.nodes)?n.nodes:[]});for(let o of XJ(iC(n.assignmentRules),i))o.severity==="error"&&t.push(o.message);return t}s(uC,"workflowAssignmentIssues");function um(e,n){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:n(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 y=o.get(p)??0;if(y===1){let k=[p],w=u.id;for(;w&&w!==p;)k.push(w),w=a.get(w)??null;k.reverse(),l.push({edge:h,source:u.id,target:p,cycle:k})}else y===0&&(o.set(p,1),a.set(p,u.id),c.push({id:p,edges:n(p),idx:0}))}}return l}s(um,"detectBackEdges");var Ck="team:",i6=/^[a-z0-9][a-z0-9-]*$/;function o6(e){if(!e.startsWith(Ck))return null;let n=e.slice(Ck.length);return n.length>0?n:null}s(o6,"teamKeyOfMember");function fm(e){return`${Ck}${e}`}s(fm,"teamMember");function Ta(e){let n=e.channels;return n===void 0?[]:(Array.isArray(n)||F("graph.channels must be an array"),n)}s(Ta,"readAuthoredChannels");function fC(e){return[...yd(e)].sort()}s(fC,"derivedChannelTeamKeys");function pC(e,n){let t=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!n.has(t))return t;for(let r=2;;r++){let i=`${t}-${r}`;if(!n.has(i))return i}}s(pC,"mintChannelKey");function mC(e,n){let t=e.channels;if(t===void 0)return[];if(!Array.isArray(t))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=yd(e),o=new Set,a=new Map;return t.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Dn(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every(E=>typeof E=="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}"`};i6.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=Dn(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 y=[];for(let E of u.members){let T=o6(E);if(T===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${E}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${E}" is not a "team:<key>".`}});continue}if(y.includes(T)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${T}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${T}" is named twice.`}});continue}n!==void 0&&!n.has(T)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${T}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${T}" does not exist at this school (or it is the applicant group).`}}),y.push(T)}if(y.length===0)return;let k=[...y].sort().join("+"),[w]=y;y.length===1&&w!==void 0&&i.has(w)&&r.push({path:`${c}.members`,reason:{de:`[channels/duplicatesDerived] ${p.de}: Team "${w}" ist am Prozess beteiligt und hat seinen Kanal schon automatisch.`,en:`[channels/duplicatesDerived] ${p.en}: team "${w}" takes part in the process and already has its channel automatically.`}});let b=a.get(k);b!==void 0?r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMembership] ${p.de}: dieselben Teams wie Kanal "${b}" \u2014 zwei Tabs w\xE4ren derselbe Chat.`,en:`[channels/duplicateMembership] ${p.en}: the same teams as channel "${b}" \u2014 two tabs would be the same chat.`}}):a.set(k,u.key)}),r}s(mC,"channelIssues");var gwe=Object.freeze({});function s6(e,n){return Object.freeze(sm(ui,e,n))}s(s6,"formContextEntries");function hC(e){return e.env??[]}s(hC,"declaredContextKeys");function gC(e,n){return hC(e).every(t=>yC(t,n?.[t]))}s(gC,"scenarioContextComplete");function yC(e,n){return qN(ui,e,n)}s(yC,"contextValueComplete");function wC(e,n){return s6(n??{},hC(e))}s(wC,"scenarioContextEntries");function Fk(e){return md(e)}s(Fk,"isContextIdentifier");function a6(e,n,t){let r=om(ui,e);if(r!==null)return{severity:"error",path:t,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return n.has(i)?null:{severity:"error",path:t,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(a6,"contextIdentifierIssue");var Dk=fp("stage.key");function l6(e){let n=[],t=s(i=>i.kind==="ident"&&i.path===Dk,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(t(i.left)&&i.right.kind==="str"&&n.push(i.right.value),t(i.right)&&i.left.kind==="str"&&n.push(i.left.value)),i.op==="in"&&t(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&n.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),n}s(l6,"stageKeyLiterals");function pm(e,n,t){return n===void 0?[]:l6(e).filter(r=>!n.has(r)).map(r=>bC(r,n,t))}s(pm,"stageKeyAstIssues");function kC(e,n){if(n===void 0)return[];let t=[];for(let r of e.testScenarios??[]){let i=r.env?.stage;typeof i?.key=="string"&&!n.has(i.key)&&t.push(bC(i.key,n,`scenario:${r.id}/env`))}return t}s(kC,"scenarioStageKeyIssues");function bC(e,n,t){let r=[...n].sort();return{severity:"error",path:t,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.")+` \`${Dk}\` 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.")+` \`${Dk}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(bC,"unknownStageKeyIssue");function vC(e,n,t){let r=[];for(let i of Ln(e)){if(!Fk(i))continue;let o=a6(i,n,t);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of Ok(e,cp))r.push({severity:"error",path:t,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(vC,"contextAstIssues");function xC(e,n){let t=[...d6(e)],r=new Set(e.env??[]);for(let i of e.env??[]){if(!Ys(i)){t.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${i}' geh\xF6rt nicht zum Vokabular (${Ws.join(", ")}).`,en:`Declared environment key '${i}' is not in the vocabulary (${Ws.join(", ")}).`}});continue}n!==void 0&&!n.has(i)&&t.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=>Ys(a)&&!yC(a,i.env?.[a]));o.length>0&&t.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??{}))Ys(a)?r.has(a)||t.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.`}}):t.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 t}s(xC,"formContextIssues");function d6(e){let n=[];Object.hasOwn(e,"context")&&n.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 t=e.testScenarios;for(let r of Array.isArray(t)?t:[])r!==null&&typeof r=="object"&&Object.hasOwn(r,"context")&&n.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 n}s(d6,"retiredContextFields");function mm(e,n,t){let r=dm(e,n).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(t?.liveEnvKeys!==void 0)for(let o of Ik(e,n)){let a=eC(o.path,t.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 pm(Fn(e),t?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(mm,"envConditionFindings");function hm(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(hm,"isReviewField");function $a(e){let n=[],t=[];function r(w,b){try{return Fn(w)}catch(E){n.push({path:b,src:w,reason:E instanceof Error?E.message:String(E)});return}}s(r,"tryParse");function i(w,b){return{...w,visibleIf:w.visibleIf?r(w.visibleIf,`${b}.visibleIf`):void 0,requiredIf:w.requiredIf?r(w.requiredIf,`${b}.requiredIf`):void 0,disabledIf:w.disabledIf?r(w.disabledIf,`${b}.disabledIf`):void 0,defaultValue:w.defaultValue?r(w.defaultValue,`${b}.defaultValue`):void 0}}s(i,"compileField");function o(w,b){return{...w,visibleIf:w.visibleIf?r(w.visibleIf,`${b}.visibleIf`):void 0,fields:w.fields.map((E,T)=>i(E,`${b}.fields[${T}]`))}}s(o,"compileGroup");function a(w,b){return{...w,itemTemplate:w.itemTemplate.map((E,T)=>i(E,`${b}.itemTemplate[${T}]`)),effects:w.effects?.map((E,T)=>d(E,`${b}.effects[${T}]`)),itemVisibleIf:w.itemVisibleIf?r(w.itemVisibleIf,`${b}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(w,b){let E=[];return w.fields.forEach((T,R)=>{if(T.externalFlag){t.push({key:T.key,label:T.label,defaultValue:T.defaultValue?r(T.defaultValue,`${b}.fields[${R}].defaultValue`):void 0});return}E.push(i(T,`${b}.fields[${R}]`))}),{...w,visibleIf:w.visibleIf?r(w.visibleIf,`${b}.visibleIf`):void 0,fields:E,groups:w.groups?.map((T,R)=>o(T,`${b}.groups[${R}]`)),computed:w.computed?.map((T,R)=>{let P=r(T.expression,`${b}.computed[${R}].expression`);return{key:T.key,expression:P??{kind:"null"}}}),subsections:w.subsections?.map((T,R)=>l(T,`${b}.subsections[${R}]`)),repeated:w.repeated?.map((T,R)=>a(T,`${b}.repeated[${R}]`)),validators:w.validators}}s(l,"compileSection");function d(w,b){return{...w,when:w.when?r(w.when,`${b}.when`):void 0}}s(d,"compileEffect");function c(w,b){let E=r(w.when,`${b}.when`);return E?{...w,when:E}:null}s(c,"compileOutcome");let u=e.sections.map((w,b)=>l(w,`sections[${b}]`)),p=(e.effects??[]).map((w,b)=>d(w,`effects[${b}]`)),h=[],y=e.outcomes??[];for(let w=0;w<y.length;w++){let b=y[w],E=c(b,`outcomes[${w}]`);E&&h.push(E)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:t},errors:n}}s($a,"compileForm");var c6=new Set(["decision","review","governedDocument"]);function AC(e){return c6.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s(AC,"isReadinessGatedNode");function u6(e){let n=new Map,t=p6(e),r=s((i,o)=>{let a=Lk(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&n.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:f6(d.bucket,t,a),section:a,type:d.type,enumSource:SC(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}`;n.set(u,{kind:"entered",key:u,label:c.label,qualifier:Lk(d),section:a,type:c.type,enumSource:SC(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=Ln(Fn(d.expression));n.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 n}s(u6,"formFieldCatalog");function SC(e){return e.type==="enum"?e:null}s(SC,"enumSourceOf");function f6(e,n,t){return e===void 0?t:n.get(e)??t}s(f6,"fieldQualifier");function p6(e){let n=new Map,t=s((r,i)=>{i===void 0||n.has(r)||n.set(r,Lk(i))},"add");for(let r of TC(e))r.kind==="person"?t(r.bucket,r.display):r.kind==="organization"&&t(r.id.replace(/^o\./,""),r.display);return n}s(p6,"bucketWordings");function EC(e){return e.flatMap(n=>[n,...EC(n.subsections??[])])}s(EC,"allSections");function TC(e){return[...e.effects,...EC(e.sections).flatMap(n=>(n.repeated??[]).flatMap(t=>t.effects??[]))]}s(TC,"allEffects");function Lk(e){return{label:e.label}}s(Lk,"wordingOf");function $C(e){return Xl(e).flatMap(({slot:n,address:t})=>{let r=O_(t);return r===null||Zl.includes(r.path)?[]:[{slotId:n,owner:r.owner,fieldKey:r.path}]})}s($C,"admissionBindingLeaves");function m6(e,n){let t=e.get(n);if(t===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(t),r}s(m6,"expandKey");function h6(e){let n=new Set;for(let t of TC(e))if(!(t.kind!=="person"||t.contractParty===void 0)&&t.when!==void 0)for(let r of Ln(Fn(t.when)))n.add(r);return[...n]}s(h6,"contractPartyConditionKeys");function g6(e){return $a(e).compiled.flags.map(n=>({key:n.key,name:n.label}))}s(g6,"formExternalFlags");function RC(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([n,t])=>[n,u6(t)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(h6(t))])),formFlagKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(g6(t).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set((t.views??[]).map(r=>r.key))]))}}s(RC,"readinessUniverse");function Mk(e,n){let t=new Set;for(let r of n)for(let i of m6(e,r)??[])i.kind==="entered"&&t.add(i.fieldKey);return t}s(Mk,"enteredFieldsBehind");var y6=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function w6(e){return y6.has(e)?!0:IC(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(w6,"isTextKey");function IC(e){return/^localized[A-Z]/.test(e)}s(IC,"isLegacyTwinKey");var k6=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),b6=new Set(["inputs","resolver","library"]);function ym(e,n){let t=[];return qk(e,n,t),t}s(ym,"findUnlocalizedTexts");function qk(e,n,t){if(Array.isArray(e)){e.forEach((i,o)=>qk(i,`${n}[${x6(i,o)}]`,t));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${n}.${i}`;if(!b6.has(i)){if(IC(i)){t.push({path:a,missing:"legacy-twin"});continue}if(w6(i)){v6(o,a,t);continue}if(k6.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&OC(d,`${a}.${l}`,t);continue}qk(o,a,t)}}}s(qk,"walk");function v6(e,n,t){e!=null&&OC(e,n,t)}s(v6,"checkText");function OC(e,n,t){let r=Dn(e);(r==="not-localized"||r.length>0)&&t.push({path:n,missing:r})}s(OC,"report");function x6(e,n){if(e!==null&&typeof e=="object"){let t=e;if(typeof t.id=="string")return t.id;if(typeof t.key=="string")return t.key}return String(n)}s(x6,"keyOf");function gm(e,n){return e==="not-localized"?n==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?n==="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"':n==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(gm,"describe");function Kk({path:e,missing:n}){return n==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${gm(n,"de")}.`,en:`[i18n/legacyTwin] ${e} ${gm(n,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${gm(n,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${gm(n,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(Kk,"unlocalizedTextReason");var S6={engagePush:["engage"]};function A6(e){let n=S6[e.type];return n===void 0?e:Object.fromEntries(Object.entries(e).filter(([t])=>!n.includes(t)))}s(A6,"withoutMachineData");function _C(e,n){return[...ym(e.nodes.map(A6),"nodes"),...n===void 0?[]:ym(n,`layout.${n.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:Kk(r),severity:"error"}))}s(_C,"checkLocalizedTexts");var E6="optionalAction:";function PC(e){return`${E6}${e}:trigger`}s(PC,"optionalActionTriggerActionId");var T6="processDecide";function NC(e){let n=e.optionalActions;return n==null?[]:(Array.isArray(n)||F(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof n}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),n)}s(NC,"optionalActionBindings");function CC(e){return NC(e).map(n=>({id:PC(n.key),kind:"internal",label:n.label,surface:T6,placement:"overflow",superUserOnly:!0}))}s(CC,"optionalActionTriggers");function DC(e){let n=e.tasks;return Array.isArray(n)?n:[]}s(DC,"authoredTemplates");function FC(e){let n=e?.result;return n?.kind!=="appointment"?[]:n.participants?.feedback?.tasks??[]}s(FC,"personTasksOf");function jk(e){let n=DC(e);return NC(e).map(t=>{let r=new Set(t.tasks??[]),i=new Set;for(let o of r)for(let a of FC(n.find(l=>l.key===o)))i.add(a);return{binding:t,tasks:r,personTasks:i,keys:new Set([...r,...i])}})}s(jk,"optionalActionMembership");function $6(e){let n=new Set;for(let t of DC(e))for(let r of FC(t))n.add(r);return n}s($6,"personRowTemplateKeys");function LC(e){let n=new Set($6(e));for(let{keys:t}of jk(e))for(let r of t)n.add(r);return n}s(LC,"referencedTaskTemplateKeys");var Rr={shape:"[taskInput/shape]",notInRound:"[taskInput/notInRound]",notRecord:"[taskInput/notRecord]",prefillNotDeclared:"[taskInput/prefillNotDeclared]",prefillType:"[taskInput/prefillType]",feedbackTasks:"[appointment/feedbackTasks]",feedbackOptional:"[appointment/feedbackOptional]",recordAssignment:"[taskResult/recordAssignment]"},Vk=60;function Ra(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Ra,"error");function Jo(e){return Array.isArray(e.tasks)?e.tasks:[]}s(Jo,"tasksOf");function MC(e){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(t=>t.action==="spawnTasks")}s(MC,"spawnBindingsOf");function wd(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}s(wd,"stringList");function ni(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(ni,"record");function Uk(e){let n=ni(e?.result);return n?.kind==="appointment"?ni(n.participants):null}s(Uk,"participantsOf");function Bk(e){return wd(ni(Uk(e)?.feedback)?.tasks)}s(Bk,"feedbackTasksOf");function qC(e,n){return jk(e).find(t=>t.keys.has(n))}s(qC,"roundOf");function R6(e,n,t){let r=s(u=>({code:Rr.notInRound,reason:u}),"notInRound"),i=qC(e,n);if(i===void 0)return r({de:`Aufgabe "${n}" geh\xF6rt zu keiner optionalen Aktion \u2014 Vorgaben liest nur eine Aufgabe einer Runde.`,en:`Task "${n}" belongs to no optional action \u2014 only a task of a round reads inputs.`});if(t.scope!=="task"||t.path!==void 0)return r({de:`${de(t)} ist kein Wert einer Aufgabe ($task.<aufgabe>.<schl\xFCssel>).`,en:`${de(t)} is no value of a task ($task.<task>.<key>).`});let{binding:o}=i,a=t.owner;if(a===n)return r({de:`Aufgabe "${n}" liest ihren eigenen Wert.`,en:`Task "${n}" reads its own value.`});let l=Jo(e).find(u=>u.key===a),d=ni(l?.blocks),c=i.tasks.has(a)&&d?.templateKey===n&&(d.node===void 0||d.node===e.id);return a!==o.input&&!c?r({de:`"${a}" ist weder die Eingabe der Aktion "${o.key}" noch eine ihrer Aufgaben, die "${n}" per 'blocks' zur\xFCckh\xE4lt \u2014 der Wert st\xFCnde nicht fest, wenn die Aufgabe \xF6ffnet.`,en:`"${a}" is neither the input of the action "${o.key}" nor one of its tasks that holds "${n}" through 'blocks' \u2014 the value would not be settled when the task opens.`}):ni(l?.result)?.kind!=="record"?{code:Rr.notRecord,reason:{de:`"${a}" hat kein Ergebnis vom Typ 'record' \u2014 Vorgaben sind Felder einer Eingabe.`,en:`"${a}" has no result of kind 'record' \u2014 inputs are fields of an input task.`}}:null}s(R6,"taskInputRefusal");function I6(e,n){if(n.scope!=="task")return;let t=Jo(e).find(i=>i.key===n.owner),r=ni(t?.result);if(r?.kind==="record")return(Array.isArray(r.fields)?r.fields:[]).map(ni).find(i=>i?.writes===n.key)??void 0}s(I6,"writerField");function O6(e,n,t){let r=String(n.key);if(n.inputs===void 0)return[];if(!Array.isArray(n.inputs))return[Ra(`${t}.inputs`,Rr.shape,{de:"'inputs' ist eine Liste von Adressen.",en:"'inputs' is a list of addresses."})];let i=[],o=new Set;for(let[a,l]of n.inputs.entries()){if(!we(l))continue;let d=de(l);if(o.has(d)){i.push(Ra(`${t}.inputs.${a}`,Rr.shape,{de:`${d} steht zweimal in 'inputs'.`,en:`${d} is listed twice in 'inputs'.`}));continue}o.add(d);let c=R6(e,r,l);c!==null&&i.push(Ra(`${t}.inputs.${a}`,c.code,c.reason))}return i}s(O6,"inputIssues");function _6(e,n,t,r){let i=t;if(fN(r))return Bk(i).length===1?null:{code:Rr.prefillType,reason:{de:"Ein Team belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A team prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."}};let o=Array.isArray(i.inputs)?i.inputs.filter(we).map(de):[];if(!we(r)||!o.includes(de(r)))return{code:Rr.prefillNotDeclared,reason:{de:"Die Vorbelegung der Teilnehmenden ist keine der Vorgaben ('inputs') der Aufgabe.",en:"The participants' prefill is none of the task's inputs ('inputs')."}};let a=s(c=>({code:Rr.prefillType,reason:c}),"prefillType"),l=Bk(i),d=Ql(e,r);if(d===void 0)return null;if(dt(d)==="staffUser")return l.length===1?null:a({de:"Eine Personenliste belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A list of persons prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."});if(d==="taskAssignment"){let u=wd(I6(n,r)?.tasks).filter(p=>!l.includes(p));return u.length===0?null:a({de:`Die Zuordnung ordnet ${u.map(p=>`"${p}"`).join(", ")} zu, die 'feedback.tasks' nicht nennt.`,en:`The assignment assigns ${u.map(p=>`"${p}"`).join(", ")}, which 'feedback.tasks' does not name.`})}return a({de:`Vorbelegt werden Teilnehmende nur aus Personen ('person') oder einer Zuordnung ('assignment'), nicht aus "${d}".`,en:`Participants are prefilled only from persons ('person') or an assignment ('assignment'), not from "${d}".`})}s(_6,"participantPrefillRefusal");function P6(e,n,t,r){let i=Uk(t)?.prefill;if(i===void 0)return[];let o=_6(e,n,t,i);return o===null?[]:[Ra(`${r}.result.participants.prefill`,o.code,o.reason)]}s(P6,"prefillIssues");function N6(e,n){return MC(e).some(t=>wd(t.tasks).includes(n))}s(N6,"belongsToOptionalAction");function C6(e,n,t){let r=n.key,i=Jo(e).find(c=>c.key===t),o=s(c=>({code:Rr.feedbackTasks,reason:c}),"feedbackTasks");if(i===void 0)return[o({de:`"${t}" ist keine Aufgabe dieses Knotens.`,en:`"${t}" is no task of this node.`})];let a=[];i.feedback!==!0&&a.push(o({de:`"${t}" ist keine Feedback-Aufgabe ('feedback: true').`,en:`"${t}" is no feedback task ('feedback: true').`})),MC(e).some(c=>wd(c.tasks).includes(t))&&a.push(o({de:`"${t}" steht in den Aufgaben einer optionalen Aktion \u2014 eine Personenzeile entsteht nur beim Buchen.`,en:`"${t}" is among an optional action's tasks \u2014 a person row exists only through a booking.`}));let l=Jo(e).find(c=>c.key!==r&&Bk(c).includes(t));l!==void 0&&a.push(o({de:`"${t}" wird auch von "${String(l.key)}" angelegt \u2014 jede Feedback-Art geh\xF6rt zu genau einem Termin.`,en:`"${t}" is also created by "${String(l.key)}" \u2014 each feedback kind belongs to exactly one appointment.`}));let d=["when","blocks"].filter(c=>i[c]!==void 0);return d.length>0&&a.push(o({de:`"${t}" tr\xE4gt ${d.map(c=>`'${c}'`).join(", ")} \u2014 eine Personenzeile entsteht nur beim Buchen und h\xE4lt nur ihre Runde.`,en:`"${t}" carries ${d.map(c=>`'${c}'`).join(", ")} \u2014 a person row exists only through a booking and holds only its round.`})),i.optional!==void 0&&a.push({code:Rr.feedbackOptional,reason:{de:`"${t}" ist optional \u2014 eine Personenzeile h\xE4lt ihre Runde und damit die Pause, sie kann nicht \xFCbersprungen werden.`,en:`"${t}" is optional \u2014 a person row holds its round and with it the pause; it cannot be skipped.`}}),a}s(C6,"participantFeedbackRefusals");function D6(e,n,t){let r=Uk(n);if(r===null||r.feedback===void 0)return[];let i=String(n.key),o=`${t}.result.participants.feedback`,a=ni(r.feedback),l=a?.tasks,d=[],c=s((p,h,y=Rr.feedbackTasks)=>d.push(Ra(p,y,h)),"fail");if(!Array.isArray(l)||l.length===0||l.some(p=>typeof p!="string")||new Set(l).size!==l.length)return c(`${o}.tasks`,{de:"'feedback.tasks' nennt mindestens eine Feedback-Aufgabe, jede einmal.",en:"'feedback.tasks' names at least one feedback task, each once."}),d;let u=a?.dueDaysAfterEnd;(typeof u!="number"||!Number.isInteger(u)||u<0||u>Vk)&&c(`${o}.dueDaysAfterEnd`,{de:`'feedback.dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${Vk}.`,en:`'feedback.dueDaysAfterEnd' is a whole number from 0 to ${Vk}.`}),N6(e,i)||c(o,{de:`Aufgabe "${i}" legt Personenzeilen an, geh\xF6rt aber zu keiner optionalen Aktion \u2014 Personenzeilen geh\xF6ren zur Runde einer Aktion.`,en:`Task "${i}" creates person rows but belongs to no optional action \u2014 person rows belong to an action's round.`});for(let p of l)for(let h of C6(e,n,p))c(`${o}.tasks`,h.reason,h.code);return d}s(D6,"feedbackIssues");function F6(e,n){let t=qC(e,n)?.personTasks??new Set;return Jo(e).filter(r=>r.feedback===!0&&typeof r.key=="string"&&t.has(r.key)).map(r=>r.key)}s(F6,"assignableFeedbackTasks");function L6(e,n,t){let r=ni(n.result);if(r?.kind!=="record"||!Array.isArray(r.fields))return[];let i=F6(e,String(n.key)),o=new Map(Jo(e).map(l=>[l.key,l])),a=[];for(let[l,d]of r.fields.entries()){let c=ni(d);if(c?.type!=="assignment")continue;let u=wd(c.tasks).filter(p=>o.get(p)?.feedback===!0&&!i.includes(p));u.length!==0&&a.push(Ra(`${t}.result.fields.${l}.tasks`,Rr.recordAssignment,{de:`Feld "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} legt kein Termin derselben optionalen Aktion an ('participants.feedback.tasks') \u2014 die Zuordnung h\xE4tte keine Zeile, die sie erh\xE4lt.`,en:`Field "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} is created by no appointment of the same optional action ('participants.feedback.tasks') \u2014 the assignment would have no row to receive it.`}))}return a}s(L6,"assignmentIssues");function KC(e,n){let t=[];for(let r of Jo(n)){if(typeof r.key!="string")continue;let i=`nodes.${n.id}.tasks.${r.key}`;t.push(...O6(n,r,i)),t.push(...P6(e,n,r,i)),t.push(...D6(n,r,i)),t.push(...L6(n,r,i))}return t}s(KC,"taskInputIssues");var _t={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 Pt(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Pt,"issue");function M6(e,n,t){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===t&&a===n}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(M6,"blockersOf");function jC(e){let{graph:n,node:t,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${t.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${_e(n,t.id,"de")}\u201C (${t.id})`,en:`Task "${o}" on node "${_e(n,t.id,"en")}" (${t.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Pt(`${a}.familyRequest`,_t.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(Pt(`${a}.familyRequest.${c[0]}`,_t.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(Pt(`${a}.familyRequest`,_t.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(Pt(`${a}.familyRequest`,_t.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(Pt(`${a}.kind`,_t.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(Pt(`${a}.${k}`,_t.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(Pt(`${a}.blocks`,_t.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 M6(n.nodes,t.id,o))d.push(Pt(`nodes.${k.nodeId}.tasks.${k.key}.blocks`,_t.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(Pt(`${a}.params.dueInDays`,_t.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(Pt(`${a}.familyRequest.fields`,_t.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 y=new Set;for(let k of u){if(!we(k))continue;let w=de(k);if(y.has(w)){d.push(Pt(`${a}.familyRequest.fields`,_t.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${je(n,k,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${je(n,k,"en")} more than once.`}));continue}y.add(w),un(k)||d.push(Pt(`${a}.familyRequest.fields`,_t.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${je(n,k,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${je(n,k,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(jC,"familyRequestIssues");function VC(e){let n=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"&&n.has(a));return o.length<=1?[]:[Pt(`nodes.${e.id}.optionalActions.${i}.tasks`,_t.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(VC,"familyRequestActionIssues");function BC(e,n){let t=e.nodes,r=new Map;for(let a of t)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)un(l)&&r.set(de(l),l);if(r.size===0)return[];let i=s(a=>{let l=Xr(n,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(un):!we(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return t.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(y=>y===h||y.when!==void 0)).flatMap(h=>u.flatMap(y=>{if(y.familyRequest===void 0||!h.tasks.includes(y.key))return[];let k=o(y.familyRequest).filter(w=>r.has(de(w)));return k.length===0?[]:[{...Pt(`nodes.${a.id}.requiresOneOf`,_t.deadlock,{de:`Auf Knoten \u201E${_e(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(w=>je(e,w,"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 "${_e(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(w=>je(e,w,"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(BC,"familyRequestDeadlockWarnings");var Gk={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,view:!0,familyRequest:!0,optional:!0,inputs:!0,params:!0},zk={appointment:s((e,n)=>({de:`Aufgabe "${e}" an ${n.de}: \`appointment\` (Terminaufgabe) gibt es nicht mehr \u2014 ein Termin hat keine Leitung, die sie hielte. Was die Teilnehmenden nach dem Termin festhalten, ist je Person eine R\xFCckmeldung (\`result.participants.feedback\` der Terminvereinbarung).`,en:`Task "${e}" on ${n.en}: \`appointment\` (appointment task) no longer exists \u2014 an appointment has no lead to hold it. What the participants record after the appointment is one feedback per person (\`result.participants.feedback\` of the booking task).`}),"appointment")};function q6(e){let n=Je(e);return new Map((typeof n.workItemTemplates=="function"?n.workItemTemplates(e):[]).map(t=>[t.key,t]))}s(q6,"intrinsicTemplatesOf");function UC(e,n,t){if(t!==void 0&&typeof t!="string")return null;let r=t??n,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Je(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:q6(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(UC,"resolveBlocksTargetNode");function K6(e){let n=new Map;for(let r of or(e.nodes)){let i=n.get(r.source)??[];i.push(r.target),n.set(r.source,i)}let t=new Map;return r=>{let i=t.get(r);if(i!==void 0)return i;let o=new Set,a=[...n.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...n.get(l)??[]))}return t.set(r,o),o}}s(K6,"reachability");function GC(e){let n=[],t=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;t.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("::");n.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=t.get(o);l!==void 0&&t.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of t.keys())i(o,[]);return n}s(GC,"checkBlocksCycles");function j6(e){let{requiresOneOf:n,optionalActions:t}=e;if(!Array.isArray(n)||!Array.isArray(t))return new Set;let r=new Set(n.filter(o=>typeof o=="string")),i=new Set;for(let o of t)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(j6,"tasksOfRequiresOneOf");function zC(e){if(typeof e!="object"||e===null)return!1;let{de:n,en:t}=e;return typeof n=="string"&&n.trim().length>0&&typeof t=="string"&&t.trim().length>0}s(zC,"isFilledBilingual");var V6=["blocks","gatesNode","locksEvidence","completableIf"];function B6(e,n){let t={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},r=[];e.feedback!==!0&&r.push(_n(`${n.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${t.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${t.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;if(e.kind!=="task"||typeof i?.kind!="string"||!_w({kind:i.kind,writes:i.writes})){let a=e.kind==="task"&&i?.writes!==void 0,l={de:e.kind!=="task"?`kind ${String(e.kind)}`:`Ergebnis ${String(i?.kind)}${a?" mit writes":""}`,en:e.kind!=="task"?`kind ${String(e.kind)}`:`result ${String(i?.kind)}${a?" with writes":""}`};r.push(_n(`${n.base}.feedback`,{de:`[workItems/feedbackNeedsProse] ${t.de} ist eine Feedback-Aufgabe und schlie\xDFt daher mit Freitext, einer Empfehlung oder einer Auswahl ohne 'writes' \u2014 ein Wert, den ein sp\xE4terer Schritt liest, k\xE4me von einem wom\xF6glich weitergeleiteten Link; erhalten ${l.de}.`,en:`[workItems/feedbackNeedsProse] ${t.en} is a feedback task, so it closes with free text, a recommendation or a choice without 'writes' \u2014 a value a later step reads would come from a link that may have been forwarded; got ${l.en}.`}))}let o=["blocks","gatesNode","completableIf","locksEvidence","familyRequest"].filter(a=>e[a]!==void 0);return o.length>0&&r.push(_n(`${n.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${t.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] ${t.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(B6,"feedbackTaskIssues");function U6(e,n){let t=[],r={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!zC(i.skipLabel))&&t.push(_n(`${n.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"&&t.push(_n(`${n.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"||!_w({kind:a.kind,writes:a.writes}))&&t.push(_n(`${n.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=V6.filter(d=>e[d]!==void 0);return l.length>0&&t.push(_n(`${n.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.`})),n.requiredByRule&&t.push(_n(`${n.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.`})),t}s(U6,"optionalTaskIssues");function _n(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(_n,"issue");function WC(e,n){let t=[],r=K6(e),i=new Set(Ta(e).map(o=>o.key));t.push(...BC(e,n));for(let o of e.nodes){let a=o,l=LC(a);t.push(...VC(a));let d=j6(a);t.push(...KC(e,a));let c=new Map((Array.isArray(a.tasks)?a.tasks:[]).filter(u=>typeof u.key=="string").map(u=>[u.key,{feedback:u.feedback===!0}]));for(let u of Array.isArray(a.tasks)?a.tasks:[]){let p=typeof u.key=="string"?u.key:"?",h=`nodes.${o.id}.tasks.${p}`,y=u.kind,k=u.result,w=u.blocks,b=typeof w?.node=="string"&&w.node!==o.id?w.node:void 0;if(typeof w?.templateKey=="string"){let N=typeof w.node=="string"?w.node:o.id,A=e.nodes.find(oe=>oe.id===N),U=(Array.isArray(A?.tasks)?A.tasks:[]).find(oe=>oe.key===w.templateKey)?.blocks;typeof U?.node=="string"&&U.node!==N&&t.push(_n(`${h}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${p}" auf Knoten "${o.id}" h\xE4lt "${w.templateKey}" auf Knoten "${N}" 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 "${p}" on node "${o.id}" holds back "${w.templateKey}" on node "${N}" \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(b!==void 0){let N=b;e.nodes.some(A=>A.id===N)&&!r(o.id).has(N)&&t.push(_n(`${h}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${p}" auf Knoten "${o.id}" blockiert Knoten "${N}", 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 "${p}" on node "${o.id}" blocks node "${N}", 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.`})),(k===void 0||!Xs(k.kind))&&t.push(_n(`${h}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${N}"), 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 "${p}" on node "${o.id}" blocks another node ("${N}") 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(p)&&t.push(_n(`${h}.blocks.node`,{de:`[optionalAction/crossNodeBlocks] Task "${p}" 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 "${p}" 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 N of cN(String(y),k,{channelKeys:i,nodeTasks:c,...n?.billingItemKeys!==void 0?{billingItemKeys:n.billingItemKeys}:{},...n?.offerProgram!==void 0?{offerProgram:n.offerProgram}:{}}))t.push(_n(`${h}.${N.field}`,{de:`${N.code} ${N.message.de} (Task "${p}" auf Knoten "${o.id}").`,en:`${N.code} ${N.message.en} (task "${p}" on node "${o.id}").`}));let E=u.when,T=s((N,A,M)=>{!we(A)||un(A)||t.push(_n(N,{de:`[workItems/evidenceNotFormField] ${M} auf Task "${p}" (Knoten "${o.id}") nennt ${je(e,A,"de")} \u2014 Bedingung und Belege einer Aufgabe sind Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[workItems/evidenceNotFormField] ${M} on task "${p}" (node "${o.id}") names ${je(e,A,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");E!==void 0?(T(`${h}.when`,E,"'when'"),u.onConditionReturn!=="respawn"&&u.onConditionReturn!=="stayClosed"&&t.push(_n(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] Task "${p}" (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 "${p}" (node "${o.id}") has a condition but no 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 what happens when the condition returns must be decided.`}))):u.onConditionReturn!==void 0&&t.push(_n(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' ohne 'when' auf Task "${p}" (Knoten "${o.id}") \u2014 ohne Bedingung kehrt nichts zur\xFCck.`,en:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' without 'when' on task "${p}" (node "${o.id}") \u2014 without a condition nothing returns.`}));let R=u.reads;if(R!==void 0)if(!Array.isArray(R))t.push(_n(`${h}.reads`,{de:`[workItems/readsUnknownField] 'reads' auf Task "${p}" (Knoten "${o.id}") muss eine Liste von Feldadressen sein.`,en:`[workItems/readsUnknownField] 'reads' on task "${p}" (node "${o.id}") must be a list of field addresses.`}));else for(let[N,A]of R.entries())T(`${h}.reads.${N}`,A,"'reads'");let P=u.locksEvidence,L=s((N,A)=>t.push(_n(`${h}.locksEvidence`,{de:`[workItems/${N}] Task "${p}" (Knoten "${o.id}") ${A.de}`,en:`[workItems/${N}] Task "${p}" (node "${o.id}") ${A.en}`})),"lockIssue");P!==void 0&&P!==!0&&L("locksEvidenceNotTrue",{de:`tr\xE4gt 'locksEvidence' ${JSON.stringify(P)} \u2014 nur 'true' ist erlaubt; ohne Sperre entf\xE4llt das Feld.`,en:`carries 'locksEvidence' ${JSON.stringify(P)} \u2014 only 'true' is allowed; without a lock the field is dropped.`}),P===!0&&(R===void 0&&E===void 0&&L("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."}),(k===void 0||!Xs(k.kind))&&L("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(p)&&L("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."})),t.push(...jC({graph:e,node:a,task:u,onTrigger:l,specCtx:n}));let _=Object.keys(u).filter(N=>!Object.hasOwn(Gk,N)&&!Object.hasOwn(zk,N));_.length>0&&t.push(_n(`${h}.${_[0]}`,{de:`[workItems/unknownKey] Task "${p}" (Knoten "${o.id}") tr\xE4gt ${_.map(N=>`'${N}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(Gk).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${p}" (node "${o.id}") carries ${_.map(N=>`'${N}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(Gk).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let v=u.description;v!==void 0&&!zC(v)&&t.push(_n(`${h}.description`,{de:`[workItems/descriptionInvalid] 'description' auf Task "${p}" (Knoten "${o.id}") braucht Text in beiden Sprachen ({ de, en }), erhalten ${JSON.stringify(v)}.`,en:`[workItems/descriptionInvalid] 'description' on task "${p}" (node "${o.id}") needs text in both languages ({ de, en }), got ${JSON.stringify(v)}.`})),u.feedback!==void 0&&t.push(...B6(u,{key:p,nodeId:o.id,base:h})),u.optional!==void 0&&t.push(...U6(u,{key:p,nodeId:o.id,base:h,requiredByRule:d.has(p)}))}}return t}s(WC,"checkNodeTasks");function YC(e){let n=e.indexOf(":"),t=n===-1?"":e.slice(0,n),r=n===-1?"":e.slice(n+1).trim();if(t==="artifact"&&r.length>0)return{kind:t,key:r};let i=ci(r);return t==="field"&&i!==null?{kind:t,address:i}:ae("INVALID",{de:`Dokument-Verweis "${e}" ist ung\xFCltig \u2014 erwartet artifact:<Slot-Schl\xFCssel> (auch der Slot eines anderen Knotens) oder field:$node.<Formular>.admission.<Feld>.`,en:`Document reference "${e}" is invalid \u2014 expected artifact:<slot key> (another node's slot too) or field:$node.<form>.admission.<field>.`})}s(YC,"parseTaskDocumentRef");function Wk(e){return e.kind==="artifact"?`artifact:${e.key}`:`field:${de(e.address)}`}s(Wk,"taskDocumentId");function vi(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(vi,"issue");function HC(e){return Array.isArray(e.tasks)?e.tasks:[]}s(HC,"tasksOf");function kd(e){let n=new Map;for(let t of e){let{id:r,artifacts:i}=t;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&n.set(o.key,[...n.get(o.key)??[],{nodeId:r,slot:o}])}return n}s(kd,"artifactSlotDeclarations");function G6(e){return e.flatMap(n=>{let{id:t,artifacts:r}=n;return(Array.isArray(r)?r:[]).filter(i=>!Jp(i?.type)).map(i=>({nodeId:String(t),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(G6,"unknownArtifactSlotTypes");function JC(e){let n=[];for(let{nodeId:t,slotKey:r,type:i}of G6(e.nodes))n.push(vi(`nodes.${t}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${t}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${ga.join(", ")}.`,en:`[artifact/unknownType] Node "${t}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${ga.join(", ")}.`}));for(let[t,r]of kd(e.nodes))for(let i of r.slice(1))n.push(vi(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${t}", 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 "${t}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return n}s(JC,"checkArtifactSlotKeys");function z6(e,n,t,r=kd(e.nodes)){let i=r.get(n)?.[0]?.nodeId;return i===void 0?{reason:"unknown"}:da(e,i,t)?null:{reason:"notBefore",owner:i}}s(z6,"slotLinkRefusal");function QC(e){if(!Array.isArray(e)||e.length===0)return null;let n=[];for(let t of e){let r=typeof t=="object"&&t!==null?t:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)n.push({kind:"artifact",key:r.key});else if(r.kind==="field"&&i==="address,kind")n.push({kind:"field",address:r.address});else return null}return n}s(QC,"authoredRefs");function ZC(e){let n=[],t=kd(e.nodes);for(let r of e.nodes)for(let i of HC(r)){if(i.documents===void 0)continue;let o=typeof i.key=="string"?i.key:"?",a=`nodes.${r.id}.tasks.${o}.documents`,l={de:`Task "${o}" (Knoten "${r.id}")`,en:`Task "${o}" (node "${r.id}")`},d=QC(i.documents);if(d===null){n.push(vi(a,{de:`[workItems/documentsInvalid] 'documents' auf ${l.de} muss eine nicht leere Liste von { kind: 'artifact', key } (Dokument-Slot eines Knotens) oder { kind: 'field', address } (Dateifeld eines Formulars) sein, erhalten ${JSON.stringify(i.documents)} \u2014 ein { kind: 'document', address } schreibt \`plexus-cli offer upgrade\` auf den Slot um.`,en:`[workItems/documentsInvalid] 'documents' on ${l.en} must be a non-empty list of { kind: 'artifact', key } (document slot of a node) or { kind: 'field', address } (file field of a form), got ${JSON.stringify(i.documents)} \u2014 \`plexus-cli offer upgrade\` rewrites a { kind: 'document', address } onto its slot.`}));continue}let c=new Set;for(let u of d){if(u.kind!=="artifact"&&!we(u.address))continue;let p=u.kind==="artifact"?Wk(u):Wk({kind:"field",address:u.address});if(c.has(p)&&n.push(vi(a,{de:`[workItems/documentsDuplicate] ${l.de} verweist zweimal auf ${p}.`,en:`[workItems/documentsDuplicate] ${l.en} refers to ${p} twice.`})),c.add(p),u.kind==="artifact"){let h=z6(e,u.key,r.id,t);h?.reason==="unknown"?n.push(vi(a,{de:`[workItems/documentsUnknownArtifact] ${l.de} verweist auf das Dokument "${u.key}", aber kein Knoten deklariert einen solchen Slot.`,en:`[workItems/documentsUnknownArtifact] ${l.en} refers to the document "${u.key}", but no node declares such a slot.`})):h?.reason==="notBefore"&&n.push(vi(a,{de:`[workItems/documentsNotBefore] ${l.de} verweist auf das Dokument "${u.key}" des Knotens "${h.owner}", der nicht auf jedem Weg vor "${r.id}" liegt \u2014 auf einem Weg an ihm vorbei g\xE4be es das Dokument nie.`,en:`[workItems/documentsNotBefore] ${l.en} refers to the document "${u.key}" of node "${h.owner}", which does not lie on every path before "${r.id}" \u2014 on a path around it the document would never exist.`}))}u.kind==="field"&&!un(u.address)&&n.push(vi(a,{de:`[workItems/documentsInvalid] ${l.de}: ein Feld-Dokument nennt ein Feld eines Formulars ($node.<formular>.admission.<feld>), nicht ${je(e,u.address,"de")}.`,en:`[workItems/documentsInvalid] ${l.en}: a field document names a field of a form ($node.<form>.admission.<field>), not ${je(e,u.address,"en")}.`}))}}return n}s(ZC,"checkTaskDocuments");function XC(e,n){let t=[];for(let r of e.nodes)for(let i of HC(r)){let o=QC(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"||!un(d.address))continue;let c=Xr(n,d.address);if(c==null)continue;let u={de:je(e,d.address,"de"),en:je(e,d.address,"en")},p=ua("taskDocument",ca(c));if(p==="repeated"){t.push(vi(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"&&t.push(vi(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 t}s(XC,"checkTaskDocumentFields");var Hk=["form","artifact","field"],Oa=["coverLetter","contract"],eD=/^[A-Za-z0-9_.-]+$/;function W6(e){return Oa.includes(e)}s(W6,"isArtifactPart");function Ia(e){return ae("INVALID",{de:`Ansichts-Adresse "${e}" ist ung\xFCltig \u2014 erwartet form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Oa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`View address "${e}" is invalid \u2014 expected form:<form node>#<view>, artifact:<slot>[#${Oa.join("|")}] or field:$node.<form>.admission.<field>.`})}s(Ia,"invalid");function Jk(e){let n=e.indexOf(":");if(n===-1)return Ia(e);let t=e.slice(0,n),r=e.slice(n+1);if(t==="field"){let l=ci(r);return l===null?Ia(e):{kind:t,address:l}}let i=r.indexOf("#"),o=i===-1?r:r.slice(0,i),a=i===-1?null:r.slice(i+1);return eD.test(o)?t==="form"?a!==null&&eD.test(a)?{kind:t,form:o,view:a}:Ia(e):t==="artifact"?a===null?{kind:t,slot:o}:W6(a)?{kind:t,slot:o,part:a}:Ia(e):Ia(e):Ia(e)}s(Jk,"parseViewAddress");function nD(e){let n=H6(e);if(n===null)return null;let t=Y6(n);return t!==null&&JSON.stringify(Yk(t))===JSON.stringify(Yk(e))?t:null}s(nD,"viewAddressOf");function Y6(e){try{return Jk(e)}catch{return null}}s(Y6,"tryParseViewAddress");function H6(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e;if(n.kind==="form"&&typeof n.form=="string"&&typeof n.view=="string")return`form:${n.form}#${n.view}`;if(n.kind==="artifact"&&typeof n.slot=="string")return n.part===void 0?`artifact:${n.slot}`:typeof n.part=="string"?`artifact:${n.slot}#${n.part}`:null;if(n.kind==="field"&&n.address!==null&&typeof n.address=="object"){let t=n.address;return typeof t.scope!="string"||typeof t.key!="string"?null:`field:${de(t)}`}return null}s(H6,"spellingOf");function Yk(e){return e===null||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).sort(([n],[t])=>n<t?-1:n>t?1:0).map(([n,t])=>[n,Yk(t)]))}s(Yk,"canonical");function tD(e){switch(e.kind){case"form":return`form:${e.form}#${e.view}`;case"artifact":return e.part===void 0?`artifact:${e.slot}`:`artifact:${e.slot}#${e.part}`;case"field":return`field:${de(e.address)}`}}s(tD,"formatViewAddress");var Qk=["form","documents"],J6=/^[a-z][a-zA-Z0-9_-]*$/;function Q6(e){let n=new Map,t=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])n.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){n.set(i.key,"other");for(let o of i.itemTemplate)n.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(t)},"visit");return e.sections.forEach(t),n}s(Q6,"fieldPlaces");function rD(e,n,t){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!J6.test(o)){r.push({severity:"error",path:`${t(a)}.key`,code:"view.invalid-key",message:{de:`${n.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${n.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:`${t(a)}.key`,code:"view.duplicate-key",message:{de:`${n.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${n.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(rD,"keyIssues");function Z6(e,n,t){return e==="document"?null:e===void 0?{severity:"error",path:t,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${n}'.`,en:`View: the form has no field '${n}'.`}}:e==="row"?{severity:"error",path:t,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${n}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${n}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:t,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${n}' enth\xE4lt keine Datei.`,en:`View: the field '${n}' holds no file.`}}}s(Z6,"fieldIssue");function X6(e,n,t){let r=[];Qk.includes(e.key)&&r.push({severity:"error",path:`${n}.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:`${n}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(...rD(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${n}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${n}.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}]`,y=Z6(t.get(u),u,h);y!==null&&r.push(y),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(X6,"viewIssues");function e4(e){if(!Array.isArray(e))return"views";for(let[n,t]of e.entries()){let r=t?.groups;if(!Array.isArray(r))return`views[${n}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${n}].groups[${i}].fields`}}return null}s(e4,"malformedAt");function iD(e){let n=e.views;if(n===void 0)return[];let t=e4(n);if(t!==null)return[{severity:"error",path:t,code:"view.malformed",message:{de:`${t} 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:`${t} 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=Q6(e);return[...rD(n.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...n.flatMap((i,o)=>X6(i,`views[${o}]`,r))]}s(iD,"formViewIssues");function _a(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(_a,"issue");function oD(e,n,t,r,i){let o=nD(e);if(o===null)return[_a(n,{de:`[view/invalid] 'view' auf ${t.de} ist keine Ansichts-Adresse \u2014 erwartet { kind: ${Hk.join(" | ")}, \u2026 }: form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Oa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] 'view' on ${t.en} is no view address \u2014 expected { kind: ${Hk.join(" | ")}, \u2026 }: form:<form node>#<view>, artifact:<slot>[#${Oa.join("|")}] or field:$node.<form>.admission.<field>.`})];let a=tD(o);switch(o.kind){case"artifact":return r.has(o.slot)?[]:[_a(n,{de:`[view/unknownSlot] ${t.de} nennt "${a}", aber kein Knoten dieses Graphen hat den Dokument-Slot "${o.slot}".`,en:`[view/unknownSlot] ${t.en} names "${a}", but no node of this graph has the document slot "${o.slot}".`})];case"form":case"field":{let l=o.kind==="form"?o.form:o.address.scope==="node"?o.address.owner:null;if(l===null)return[_a(n,{de:`[view/invalid] ${t.de} nennt "${a}" \u2014 ein Dateifeld liegt in einem Formular: field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] ${t.en} names "${a}" \u2014 a file field lives in a form: field:$node.<form>.admission.<field>.`})];let d=i?.formViewKeysByFormNode;if(d===void 0)return[];let c=d.get(l);return c===void 0?[_a(n,{de:`[view/unknownForm] ${t.de} nennt "${a}", aber kein Formularknoten hei\xDFt so.`,en:`[view/unknownForm] ${t.en} names "${a}", but no form node has that id.`})]:o.kind==="field"?[]:c.has(o.view)||Qk.includes(o.view)?[]:[_a(n,{de:`[view/unknownView] ${t.de} nennt "${a}", aber das Formular "${o.form}" hat keine Ansicht "${o.view}".`,en:`[view/unknownView] ${t.en} names "${a}", but the form "${o.form}" has no view "${o.view}".`})]}}}s(oD,"viewIssues");function sD(e,n){let t=[],r=new Set(kd(e.nodes).keys());for(let i of e.nodes){if(i.view!==void 0){let o={de:`Knoten "${i.id}"`,en:`node "${i.id}"`};i.type!=="decision"?t.push(_a(`nodes.${i.id}.view`,{de:`[view/invalid] ${o.de}: 'view' am Knoten gilt nur f\xFCr eine Entscheidung; eine Aufgabe tr\xE4gt ihre eigene.`,en:`[view/invalid] ${o.en}: 'view' on a node applies to a decision only; a task carries its own.`})):t.push(...oD(i.view,`nodes.${i.id}.view`,o,r,n))}for(let o of Array.isArray(i.tasks)?i.tasks:[]){if(o.view===void 0)continue;let a=String(o.key);t.push(...oD(o.view,`nodes.${i.id}.tasks.${a}.view`,{de:`Task "${a}" (Knoten "${i.id}")`,en:`Task "${a}" (node "${i.id}")`},r,n))}}return t}s(sD,"checkTaskViews");var Vt="traeger",aD={de:"Tr\xE4ger",en:"Provider"};function Pa(e){let n=e.inputs?.[Vt];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(Pa,"traegerKeyOfNode");var wm={name:"input.traeger.name",address:"input.traeger.anschrift"},Yke=Object.values(wm);var lD="governedDocument",Qo="prepareDocument",bd="prepareDocument:revision",Ir="releaseApproval",Zo="documentResponse",oo="coverLetterResponse",km="confirmCoverLetter",bm="requestCoverLetterRevision",Na="coverLetterConfirmation",ti="responseCheck",vm="returnSigned";var dD="requestApproval";var cD="issueDocument",uD="correctInPlace",fD="rescindAndReissue",xm="requestChange";var Ca="releaseArtifact",bt="signingRecovery",Sm="resendESignature",Xo="switchToPaper";var vd=new Set([Qo,bd]),pD=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],Am=["upload","resolver","template","none"],es=1,ns=366,xi="responseDueInDays";function ts(e){let n=e.inputs?.[Na];return n?.kind==="literal"&&n.value===!0}s(ts,"coverLetterConfirmationOf");function xd(e){let n=e.inputs?.[xi];return n?.kind==="literal"&&Sd(n.value)?n.value:void 0}s(xd,"responseDueInDaysForVocabulary");function Sd(e){return typeof e=="number"&&Number.isInteger(e)&&e>=es&&e<=ns}s(Sd,"isValidResponseDueInDays");var Em=["generatedAt","responseDueInDays","countersignature"],rs=["release","none"],Tm=["confirm","signedUpload","signedUploadChecked","eSignature"];var n4={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"}}},mD={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"}}},hD={...mD,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},t4={...hD,kind:"eSignature",issuesBy:"provider"},Si={confirm:n4,signedUpload:mD,signedUploadChecked:hD,eSignature:t4};function Ai(e){let n=e.responseStrategy;if(typeof n=="string"&&n in Si)return Si[n];F(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(n)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(Ai,"responseStrategyOf");function $m(e){if(e.type!==lD||e.production!=="resolver")return!1;let n=e.responseStrategy;return typeof n=="string"&&n in Si?Si[n].acceptEvent==="contractEvent":!1}s($m,"isFamilySignedContractNode");function Fa(e){return e.label}s(Fa,"governedDocTitle");function Zk(e){return e.approval==="release"?dD:cD}s(Zk,"submitActionId");function gD(e,n,t){return{key:n,recipient:"internal",title:t,unlocks:[Zk(e)],gatesNode:!0,advancesNode:!0}}s(gD,"producerTemplate");function r4(e){return e.titles?.respond??e.label}s(r4,"responseTitle");var Da={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Rm(e){let n=Ai(e),t=[];if(e.production!=="none"&&t.push(gD(e,Qo,e.titles?.prepare??Da),gD(e,bd,e.titles?.revise??Da)),e.approval==="release"&&t.push({key:Ir,recipient:"internal",title:e.titles?.approve??Da,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),t.push({key:Zo,recipient:"external",title:r4(e),unlocks:n.producesResponseArtifact?[n.checksReturn?vm:n.acceptOutcomeId,n.declineOutcomeId,xm]:[n.acceptOutcomeId,n.declineOutcomeId],advancesNode:!0,...xd(e)!==void 0?{dueInDays:xd(e)}:{}}),ts(e)){let r=Fa(e);t.push({key:oo,recipient:"external",title:{de:`${r.de}: Angebot best\xE4tigen`,en:`${r.en}: confirm offer`},unlocks:[km,bm,n.declineOutcomeId],advancesNode:!0,...xd(e)!==void 0?{dueInDays:xd(e)}:{}})}if(n.checksReturn&&t.push({key:ti,recipient:"internal",title:e.titles?.check??Da,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),n.issuesBy==="provider"){let r=Fa(e);t.push({key:bt,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[Sm,Xo],gatesNode:!1,advancesNode:!1})}return t}s(Rm,"governedDocIntrinsicTemplates");function i4(e){e.production==="none"&&F(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let n=e.artifacts??[];n.length!==1&&F(`governedDocSlot: node "${e.id}" declares ${n.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let t=n[0];return(typeof t.key!="string"||t.key.length===0)&&F(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),t}s(i4,"governedDocSlot");function Im(e){return i4(e).key}s(Im,"governedDocSlotKey");var sr="processFooter";var Om="countersign",Xk="countersign",yD="countersigned",wD="countersigning",kD="countersigned";var bD={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},Ad=["scan","eSignature"],_m="service_provider:1",vD=["countersigning","awaitingSignature","signatureStalled","done"],xD={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function SD(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(SD,"traegerSignatoryMissingReason");function ar(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(ar,"issue");function Pm(e,n){return e.nodes.filter(t=>{let r=t.contract;return t.type==="countersign"&&we(r)&&r.scope==="node"&&r.owner===n})}s(Pm,"countersignersOf");function Ed(e){return e.signing==="eSignature"}s(Ed,"isElectronic");function o4(e,n){if(n===void 0||n.sendable||!Ed(e))return[];let t=e.label?.de??e.id,r=e.label?.en||e.id;return[ar(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${t}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${n.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${n.reason.en}`})]}s(o4,"countersignProviderIssues");function s4(e,n,t){if(t.scope!=="node")return[];let r=e.nodes.find(o=>o.id===t.owner);if(r===void 0)return[];let i=[];return $m(r)||i.push("sourceNotCheckedContract"),Pm(e,r.id).some(o=>o.id!==n)&&i.push("twice"),i}s(s4,"countersignContractRefusals");function AD(e){let n=e.inputs?.dueInDays;return n?.kind==="literal"&&typeof n.value=="number"&&Number.isInteger(n.value)&&n.value>=1?n.value:void 0}s(AD,"validDueInDays");function a4(e,n,t){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!Ad.includes(o))return[ar(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?.[bt];if(!Ed(e))return a===void 0?[]:[ar(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 a===void 0&&l.push(ar(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(...l4(e,n,t),...d4(e,n,t),...o4(e,t?.signingProvider)),l}s(a4,"signingIssues");function TD(e,n){let t=e.contract;if(!(!we(t)||t.scope!=="node"))return n.nodes.find(r=>r.id===t.owner)}s(TD,"contractNodeOf");function l4(e,n,t){let r=TD(e,n),i=r===void 0?null:Pa(r),o=i===null?void 0:t?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[ar(e,"signing",SD(o.name))]}s(l4,"traegerSignatoryIssues");function d4(e,n,t){let r=TD(e,n);if(r===void 0)return[];let i=t?.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(ar(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(_m)||l.push(ar(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${_m}/ \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:${_m}/ \u2014 the provider would find no signature field for the school.`}));return l}s(d4,"traegerAnchorIssues");var eb=100;async function c4(e,n){let t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",n.node.id)).take(eb+1);t.length>eb&&F(`countersign node "${n.node.id}" of ${n.applicationId} holds more than ${eb} rows`);let r=t.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)===bt)?"signatureStalled":r.some(o=>i(o)===Om)?"countersigning":Ed(n.node)?"awaitingSignature":"done"}s(c4,"countersignCurrentState");var ED={[wD]:{label:te("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:te("Gegenzeichnung","Countersignature"),scope:"node"},external:nn(te("Vertrag unterschrieben","Contract signed"),"blue",te("Die Schule zeichnet Ihren Vertrag gegen","The school is countersigning your contract"),te("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."))}},$D={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:yD,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:ED,progressEvents:Gn(ED),notificationEvents:s(()=>[{id:kD,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:Xk,kind:"internal",label:bD,surface:sr,availableIn:["countersigning"]},...Ed(e)?[{id:Xo,kind:"internal",surface:sr,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:Om,recipient:"internal",title:e.titles?.countersign??Da,unlocks:[Xk],advancesNode:!0,...AD(e)!==void 0?{dueInDays:AD(e)}:{}},...Ed(e)?[{key:bt,recipient:"internal",title:xD,unlocks:[Xo],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),states:vD,currentState:c4,validate:s((e,n,t)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id;e.assign?.[Om]===void 0&&r.push(ar(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.`})),Ui(e.titles?.countersign)||r.push(ar(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(ar(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(...a4(e,n,t));let d=e.contract;if(!we(d))return r;let c=s4(n,e.id,d);if(c.length===0)return r;let u=n.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(ar(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=Pm(n,u.id).filter(h=>h.id!==e.id);r.push(ar(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 u4(e){return $m(e)?Pa(e):null}s(u4,"traegerSignerOf");var f4=s(e=>e.type==="end"&&Go(e)==="approved","isApprovedEnd");function RD(e){let n=[];for(let t of e.nodes){let r=u4(t);if(r===null)continue;let i=Pm(e,t.id).map(u=>u.id),o=MP(e,t.id,new Set(i),f4);if(o===null)continue;let a=t.label?.de||t.id,l=t.label?.en||t.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${t.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${t.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${t.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}" (${t.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 (${t.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}" (${t.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}`};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}`,reason:c,severity:"error"})}return n}s(RD,"checkCountersignCoverage");var p4=[{key:"blocks",why:{de:"sie h\xE4lt nichts zur\xFCck, sie ist mit dem Ausl\xF6sen erledigt",en:"it holds nothing back, it is done with the press"}},{key:"when",why:{de:"sie entsteht bei jedem Ausl\xF6sen",en:"it is created on every press"}},{key:"optional",why:{de:"wer ausl\xF6st, beantwortet sie immer",en:"whoever presses always answers it"}},{key:"familyRequest",why:{de:"sie fragt nicht die Familie",en:"it does not ask the family"}},{key:"feedback",why:{de:"sie beantwortet die ausl\xF6sende Person, nicht ein Link",en:"the presser answers it, not a link"}},{key:"completableIf",why:{de:"sie wird beim Ausl\xF6sen erledigt, eine Vorbedingung w\xFCrde jedes Ausl\xF6sen ablehnen",en:"it is completed at the press, a precondition would refuse every press"}},{key:"locksEvidence",why:{de:"eine offene Korrektur w\xFCrde jedes Ausl\xF6sen ablehnen",en:"an open correction would refuse every press"}}];function ID(e){let{nodeId:n,bindingKey:t,binding:r}=e,i=[],o=`nodes.${n}.optionalActions.${t}.input`,a=s((u,p=o)=>{i.push({layer:"GRAPH",kind:"nodeRule",path:p,severity:"error",reason:{de:`[optionalAction/input] Optionale Aktion "${t}" auf Knoten "${n}": ${u.de}`,en:`[optionalAction/input] Optional action "${t}" on node "${n}": ${u.en}`}})},"push");if(r.input===void 0)return r.submitLabel!==void 0&&a({de:"'submitLabel' beschriftet das Absenden des Eingabedialogs \u2014 ohne 'input' \xF6ffnet das Ausl\xF6sen keinen Dialog.",en:"'submitLabel' names the input dialog's submit button \u2014 without 'input' the press opens no dialog."},`nodes.${n}.optionalActions.${t}.submitLabel`),i;let l=r.input;if(typeof l!="string"||l.trim().length===0)return a({de:"'input' muss der Schl\xFCssel einer ihrer Aufgaben sein.",en:"'input' must be the key of one of its tasks."}),i;let d=Array.isArray(r.tasks)?r.tasks:[];if(!d.includes(l))return a({de:`Die Eingabe "${l}" ist keine ihrer Aufgaben ('tasks') \u2014 die Eingabe geh\xF6rt zur Runde der Aktion.`,en:`The input "${l}" is none of its tasks ('tasks') \u2014 the input belongs to the action's round.`}),i;let c=s(u=>{let p=e.templates.find(h=>h.key===u);return p!==void 0&&p.optional===void 0&&p.blocks===void 0},"holdsNode");d.some(u=>u!==l&&c(u))||a({de:`Neben der Eingabe "${l}" hat die Aktion keine Aufgabe, die den Schritt zur\xFCckh\xE4lt (weder 'optional' noch hinter 'blocks') \u2014 die Runde w\xE4re mit dem Ausl\xF6sen schon erledigt.`,en:`Besides the input "${l}" the action has no task that holds the step (neither 'optional' nor behind 'blocks') \u2014 the round would be done with the press.`});for(let u of m4({nodeId:n,binding:r,templates:e.templates,input:l}))a(u);return i}s(ID,"optionalActionInputIssues");function m4(e){let{nodeId:n,binding:t,templates:r,input:i}=e,o=r.find(u=>u.key===i);if(o===void 0)return[];let a=[];o.result?.kind!=="record"&&a.push({de:`Die Eingabe "${i}" braucht ein Ergebnis der Art 'record' \u2014 nur dessen Werte lesen die anderen Aufgaben der Runde.`,en:`The input "${i}" needs a result of kind 'record' \u2014 only its values are read by the round's other tasks.`});let l=o.assign?.group;typeof t.trigger!="string"?a.push({de:"Mit einer Eingabe braucht die Aktion ein 'trigger'-Team \u2014 die Eingabe ist eine Aufgabe dieses Teams.",en:"With an input the action needs a 'trigger' team \u2014 the input is a task of that team."}):l!==void 0&&l!==t.trigger&&a.push({de:`Die Eingabe "${i}" geh\xF6rt dem Team "${String(l)}", ausgel\xF6st wird die Aktion vom Team "${t.trigger}" \u2014 wer ausl\xF6st, beantwortet die Eingabe, also ist es dasselbe Team.`,en:`The input "${i}" belongs to the team "${String(l)}", the action is pressed by the team "${t.trigger}" \u2014 whoever presses answers the input, so it is the same team.`});let d=o.result,c=d?.fields;for(let u of Array.isArray(c)?c:[])u.evidence===!0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" verlangt eine Datei ('evidence') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" demands a file ('evidence') \u2014 the press carries values only.`}),u.suggest!==void 0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" tr\xE4gt einen Vorschlag ('suggest') \u2014 eine Abweichung verlangt eine Begr\xFCndung, das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" carries a suggestion ('suggest') \u2014 a departure demands a reason, the press carries values only.`});d?.textRequired===!0&&a.push({de:`Die Eingabe "${i}" verlangt einen Text ('textRequired') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The input "${i}" demands a text ('textRequired') \u2014 the press carries values only.`});for(let{key:u,why:p}of p4)o[u]!==void 0&&a.push({de:`Die Eingabe "${i}" tr\xE4gt '${u}' \u2014 ${p.de}.`,en:`The input "${i}" carries '${u}' \u2014 ${p.en}.`});for(let u of r){let p=u.blocks;p?.templateKey!==i||p.node!==void 0&&p.node!==n||a.push({de:`"${String(u.key)}" h\xE4lt die Eingabe "${i}" per 'blocks' zur\xFCck \u2014 sie ist beim Anlegen der Runde schon erledigt, es gibt nichts zur\xFCckzuhalten.`,en:`"${String(u.key)}" holds the input "${i}" back through 'blocks' \u2014 it is already done when the round is created, there is nothing to hold back.`})}return a}s(m4,"optionalActionInputRefusals");function h4(e){let n="error",t=new Map;for(let a of or(e.nodes)){let l=t.get(a.source)??[];l.push({id:a.id,target:a.target}),t.set(a.source,l)}let r=[],i=new Set,o=um(e.nodes.map(a=>a.id),a=>(t.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:n}));return r}s(h4,"checkAcyclic");function g4(e){let n=[],t=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))t.has(l.to)||n.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))&&n.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 n}s(g4,"checkNextTargets");function y4(e){let n=[];for(let t of e.nodes){let r=t.next;if(!r)continue;let i=mk(t),o=new Set(i?i.map(a=>a.id):[ya]);for(let a of Object.keys(r))o.has(a)||n.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${t.id}.next.${a}`,reason:{de:`${t.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:`${t.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 n}s(y4,"checkNextOutcomesKnown");function w4(e){let n=[],t=new Set(or(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!t.has(o.id));return r.length===0?n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&n.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&&n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),n}s(w4,"checkStartEnd");function k4(e){let n=new Map;for(let r of or(e.nodes))n.set(r.source,(n.get(r.source)??0)+1);let t=[];for(let r of e.nodes)r.type!=="end"&&(n.get(r.id)??0)===0&&t.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 t}s(k4,"checkNoOutgoingEdge");function b4(e){return e.nodes.filter(n=>!cw(n.id)).map(n=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${n.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${Sr.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${n.id}": a node id is an identifier without a dot (${Sr.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(b4,"checkNodeIdFormat");function v4(e){let n=new Set(e.nodes.map(r=>r.id)),t=[];for(let r of or(e.nodes))n.has(r.source)||t.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"}),n.has(r.target)||t.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 t}s(v4,"checkEdgeEndpoints");function x4(e){let n=[];for(let t of e.nodes)for(let r of t.tasks??[]){let i=r.result;i===null||typeof i!="object"||!(Hp in i)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.tasks.${r.key}.result.${Hp}`,reason:{de:`[graph/retiredField] Aufgabe "${r.key}": \`primaryHostTeams\` hei\xDFt jetzt \`primaryParticipantTeams\` \u2014 der alte Name wird nicht mehr gelesen, die Teilnehmer-Auswahl zeigt die Teams nicht oben. Bitte umbenennen.`,en:`[graph/retiredField] Task "${r.key}": \`primaryHostTeams\` is now called \`primaryParticipantTeams\` \u2014 the old name is no longer read, so the participant picker does not list the teams first. Please rename it.`},severity:"error"})}return n}s(x4,"checkRenamedFields");var S4=new Set(["countersignature"]);function A4(e){let n=[],t=s((o,a)=>{n.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&&t("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&&t(`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&&t(`nodes.${o.id}.tasks.${a.key}.result.prices`,r)}for(let o of e.nodes){let a=o,l={de:`Knoten \u201E${_e(e,o.id,"de")}\u201C (${o.id})`,en:`Node "${_e(e,o.id,"en")}" (${o.id})`};for(let[c,u]of Object.entries(a.next??{}))u!==null&&typeof u=="object"&&"emits"in u&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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&&t(`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(Uw[o.type]??{}))c in a&&t(`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:[]){if(c===null||typeof c!="object")continue;let u=String(c.key),p=c.assign;p!==null&&typeof p=="object"&&"userId"in p&&t(`nodes.${o.id}.tasks.${u}.assign.userId`,{de:`Aufgabe "${u}" an ${l.de}: \`assign.userId\` gibt es nicht mehr \u2014 eine Aufgabe nennt ihr Team (\`assign.group\`), nie eine feste Person.`,en:`Task "${u}" on ${l.en}: \`assign.userId\` no longer exists \u2014 a task names its team (\`assign.group\`), never a fixed person.`});for(let[h,y]of Object.entries(zk))h in c&&t(`nodes.${o.id}.tasks.${u}.${h}`,y(u,l))}for(let c of Gw[o.type]??[])c in a&&t(`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(tP[o.type]??{}))c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&t(`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"&&S4.has(u)&&t(`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 n}s(A4,"checkRetiredDataFields");function La(e,n){return n?.wiring&&n.layout?{wiring:n.wiring,layout:n.layout}:null}s(La,"resolveLayoutContext");function E4(e,n){let t=La(e,n);if(!t)return e.nodes.some(o=>(Je(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 ${n?.wiring?"vorhanden":"fehlt"}, Layout ${n?.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 ${n?.wiring?"present":"missing"}, layout ${n?.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=Je(i)?.progressEvents;if(a)for(let l of a){let d=fa(t.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 '${t.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 '${t.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=Up(t.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 '${t.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${t.layout.id}'`},severity:"error"});continue}sd(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(E4,"checkProgressEventMappings");function T4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.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),sd(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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.${t.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(T4,"checkProgressBoardCoverage");function $4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)if(!(!i.boards||i.boards.length===0))for(let o of i.boards)for(let a of Ye){let l=new Map;for(let d of o.columns){if(!Ui(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.${t.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($4,"checkProgressBoardDistinctLabels");function R4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)for(let o of i.states){let a=Gp(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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.${t.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(R4,"checkProgressTerminalSemantics");function I4(e,n){let t=La(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])sd(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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??[])sd(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.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.${t.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.${t.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(I4,"checkProgressSeatStates");var Nm={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 O4(e){return e==="both"?{de:`${Nm.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:`${Nm.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:`${Nm.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${Nm.en}, or move the state into the successor's column.`}}s(O4,"passThroughRemedy");function _4(e,n){let t=La(e,n);if(!t)return[];let{layout:r,wiring:i}=t;if(!r.buses.some(b=>b.key==="process"))return[];let o=GP(r);if(!o)return[];let a=new Map(e.nodes.map(b=>[b.id,b])),l=s(b=>Je(b).progressEvents??[],"eventsOf"),d=s(b=>Object.values(b.next??{}).map(E=>E.to),"routesOf"),c=s((b,E)=>{let T=a.get(b);if(!T||E.has(b))return null;if(l(T).length>0)return[T];if(_D[T.type]!==!1)return null;let R=d(T);if(R.length===0)return null;let P=[];for(let L of R){let _=c(L,new Set([...E,b]));if(!_)return null;P.push(..._)}return P},"firstProgressNodes"),u=s((b,E)=>{let T=[];for(let R of l(b)){let P=fa(i,b,R);if(!P||P.bus!==E.bus||P.state===E.state)return null;T.push(P.state)}return[...new Set(T)].join("' / '")},"overwrites"),p=s((b,E)=>{let T=d(b);if(T.length===0)return null;let R=[];for(let P of T){let L=c(P,new Set([b.id]));if(!L)return null;for(let _ of L){let v=u(_,E);if(v===null)return null;R.push({de:`'${_.id}' (${_.type}) mit '${v}'`,en:`'${_.id}' (${_.type}) with '${v}'`})}}return[...new Map(R.map(P=>[P.de,P])).values()]},"submitOverwrittenBy"),h=new Map;for(let b of e.nodes)for(let E of l(b)){let T=fa(i,b,E);if(!T||T.bus!=="process")continue;let R=b.type==="form"&&E===sp?p(b,T):null,P=R?{de:`'${b.id}'.${E} erreicht ihn, und ${R.map(L=>L.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${b.id}'.${E} reaches it, and ${R.map(L=>L.en).join(", ")} overwrites it in the same transaction`}:null;h.set(T.state,[...h.get(T.state)??[],P])}let y=Up(r,"process"),k=new Map;for(let[b,E]of h){if(!E.every(R=>R!==null))continue;let T=[...new Map(E.map(R=>[R.de,R])).values()];k.set(b,{de:T.map(R=>R.de).join("; "),en:T.map(R=>R.en).join("; ")})}let w=[];for(let b of o.columns){if(b.states.length===0||!b.states.every(R=>k.has(R)))continue;let E=b.states.map(R=>{let P=y.holdsSeat?.includes(R)===!0,L=k.get(R);return{de:`Zustand '${R}'${P?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${L.de}`,en:`State '${R}'${P?" (is in holdsSeat, but never takes a seat)":""}: ${L.en}`}}),T=O4(o.audience);w.push({layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${o.id}.columns.${b.id}`,reason:{de:`[progress/passThroughState] Spalte \u201E${b.label.de}" ('${b.id}', Board '${o.id}') bleibt immer leer \u2014 ${E.map(R=>R.de).join("; ")}. ${T.de}`,en:`[progress/passThroughState] Column "${b.label.en}" ('${b.id}', board '${o.id}') always stays empty \u2014 ${E.map(R=>R.en).join("; ")}. ${T.en}`},severity:"warning"})}return w}s(_4,"checkProgressPassThroughColumns");function P4(e){let n=["workItems","workitems","work_items","taskTemplates"],t=[];for(let r of e.nodes){let i=r;for(let o of n){let a=i[o];a!=null&&t.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 t}s(P4,"checkMisnamedTasksKey");function N4(e){let n=[];for(let t of e.nodes){let r=t,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)&&n.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=Je(t),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(t):[]).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||!fd.has(p)){n.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: ${[...fd].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...fd].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&n.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,y=h===void 0?void 0:UC(e,r.id,h.node);if(h!==void 0&&y===null)n.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&&y!==void 0&&y!==null){let w=y.node.id===r.id,b=y.node.id,E=w?o:y.composedKeys,T=w?d:y.intrinsicByKey,R=y.node.assign??{};p==="approval"&&n.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 P=h.templateKey,L=[...new Set([...E,...T.keys()])].filter(v=>!w||v!==u).join(", "),_={de:L||"keine",en:L||"none"};if(typeof P!="string"||w&&P===u||!E.has(P)&&!T.has(P))n.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(P)} auf Knoten "${b}"; zul\xE4ssige Ziele: ${_.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(P)} on node "${b}"; allowed targets: ${_.en}.`},severity:"error"});else if(y.refuse(P)!==null)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:y.refuse(P),severity:"error"});else{let v=T.get(P);h.except!==void 0&&n.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"}),v!==void 0&&v.recipient!=="external"&&v.verdictResolved!==!0&&R[P]===void 0&&n.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 "${P}" (Knoten "${b}") zur\xFCck, aber der Knoten weist "${P}" keiner Gruppe zu \u2014 ohne 'assign.${P}' entsteht diese Zeile nie: kein Team bekommt die zur\xFCckgehaltene Arbeit, niemand au\xDFer der verantwortlichen Person kann sie tun. Entweder 'assign.${P}' erg\xE4nzen oder das 'blocks' entfernen.`,en:`[workItems/blocksUnwiredTarget] Task "${u}" on node "${r.id}" holds back "${P}" (node "${b}"), but the node assigns "${P}" to no group \u2014 without 'assign.${P}' this row is never created: no team receives the held-back work, and nobody except the responsible person can do it. Either add 'assign.${P}' or remove the 'blocks'.`},severity:"error"})}}{let w=c.completableIf;if(typeof w=="string"&&w.trim().length>0){let b=w.trim().replace(/^!/,"").trim();a.has(b)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.completableIf`,reason:{de:`[workItems/unknownExport] completableIf "${w}" verweist auf unbekannten Node-Export "${b}"; bekannt: ${[...a].join(", ")||"keine"}.`,en:`[workItems/unknownExport] completableIf "${w}" refers to unknown node export "${b}"; known: ${[...a].join(", ")||"none"}.`},severity:"error"})}}let k=c.params;if(k?.commentRequired!==void 0&&n.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 w=[];k?.onReject!==void 0&&w.push("params.onReject"),k?.revisionGroup!==void 0&&w.push("params.revisionGroup");for(let b of w)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.${b}`,reason:{de:`[workItems/approvalOnlyField] '${b}' gilt nur f\xFCr die Art 'approval' (Task "${u}" ist '${p}').`,en:`[workItems/approvalOnlyField] '${b}' only applies to the kind 'approval' (task "${u}" is '${p}').`},severity:"error"});continue}k?.onReject!==void 0&&k.onReject!=="spawnRevision"&&n.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)&&n.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 n.push(...GC(e)),n}s(N4,"checkWorkItemTemplates");var C4=new Set(["complete","approve","reject"]),_D={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 D4(e){let n=[];for(let t of e.nodes){let r=t,i=Je(t),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(t)??[];if(o+a.length>0){let b=_D[r.type];b===void 0?n.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"}):b||n.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?.(t)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(b=>[b.id,b]));for(let b of l)C4.has(b.id)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}`,reason:{de:`[capability/reservedActionId] Knotentyp "${r.type}" deklariert die Action "${b.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 "${b.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??[pN]);for(let b of l)if(b.availableIn!==void 0)for(let E of b.availableIn)c.has(E)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}.availableIn`,reason:{de:`[capability/unknownActionState] Action "${b.id}" auf Knotentyp "${r.type}" ist f\xFCr Zustand "${E}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${b.id}" on node type "${r.type}" is declared for state "${E}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=mk(t),p=new Set(u?u.map(b=>b.id):[ya]);for(let b of l){if(b.external===void 0)continue;let E=uN(b.external.event),T={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},R=E?b.kind==="advance"?{de:`ist als "advance" deklariert, l\xF6st den Knoten aber nicht auf (Ereignis "${b.external.event}") \u2014 solche Aktionen sind "internal"`,en:`is declared as "advance", but does not resolve the node (event "${b.external.event}") \u2014 such actions are "internal"`}:b.outcome!==void 0?{de:`nennt das Outcome "${b.outcome}", l\xF6st den Knoten aber nicht auf (Ereignis "${b.external.event}") \u2014 ein Outcome w\xFCrde eine zweite, stille Routing-Vokabel behaupten`,en:`names the outcome "${b.outcome}", but does not resolve the node (event "${b.external.event}") \u2014 an outcome would claim a second, silent routing vocabulary`}:b.label===void 0?T:null:b.kind!=="advance"?{de:`ist als "${b.kind}" deklariert (externe Aktionen l\xF6sen den Knoten auf und m\xFCssen "advance" sein)`,en:`is declared as "${b.kind}" (external actions resolve the node and must be "advance")`}:b.outcome===void 0?{de:"nennt kein Outcome",en:"names no outcome"}:p.has(b.outcome)?b.label===void 0?T:null:{de:`verweist auf das unbekannte Outcome "${b.outcome}" (deklariert: ${[...p].join(", ")||"keine"})`,en:`refers to the unknown outcome "${b.outcome}" (declared: ${[...p].join(", ")||"none"})`};R!==null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}.external`,reason:{de:`[capability/externalActionNeedsOutcome] Externe Aktion "${b.id}" auf Knotentyp "${r.type}" ${R.de}.`,en:`[capability/externalActionNeedsOutcome] External action "${b.id}" on node type "${r.type}" ${R.en}.`},severity:"error"})}for(let b of a){let E=b.unlocks;if(E.length===0&&b.verdictResolved!==!0&&b.informational!==!0){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${b.key}.unlocks`,reason:{de:`[capability/emptyUnlocks] Intrinsisches Template "${b.key}" auf Knoten "${r.id}" schaltet keine Action frei (B5).`,en:`[capability/emptyUnlocks] Intrinsic template "${b.key}" on node "${r.id}" unlocks no action (B5).`},severity:"error"});continue}for(let T of E)d.get(T)===void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${b.key}.unlocks`,reason:{de:`[capability/danglingUnlock] Template "${b.key}" auf Knoten "${r.id}" schaltet unbekannte Action "${T}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${b.key}" on node "${r.id}" unlocks the unknown action "${T}"; declared: ${[...d.keys()].join(", ")||"none"}.`},severity:"error"})}let h=new Set(a.map(b=>b.key));for(let b of Object.keys(r.assign??{}))h.has(b)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.assign.${b}`,reason:{de:`[capability/unknownAssignKey] assign-Key "${b}" auf Knoten "${r.id}" ist kein intrinsisches Template dieses Knotentyps; bekannt: ${[...h].join(", ")||"keine"}.`,en:`[capability/unknownAssignKey] assign key "${b}" on node "${r.id}" is not an intrinsic template of this node type; known: ${[...h].join(", ")||"none"}.`},severity:"error"});for(let[b,E]of Object.entries(r.assign??{})){if(E===void 0)continue;let T=`nodes.${r.id}.assign.${b}`,R={de:`Team der Vorlage "${b}" (Knoten "${r.id}")`,en:`team of the template "${b}" (node "${r.id}")`};n.push(...RP(E,T,R));for(let[P,L]of(Array.isArray(E)?E:[]).entries()){let _=L?.when;_==null||!we(_)||un(_)||n.push({layer:"GRAPH",kind:"nodeRule",path:`${T}.${P}.when`,severity:"error",reason:{de:`[assign/conditionNotFormField] ${R.de}, Zeile ${P+1}: die Bedingung nennt ${je(e,_,"de")} \u2014 ein Team wird nach einem Ja/Nein-Feld eines Formulars gew\xE4hlt ($node.<formular>.admission.<feld>).`,en:`[assign/conditionNotFormField] ${R.en}, row ${P+1}: the condition names ${je(e,_,"en")} \u2014 a team is chosen by a yes/no field of a form ($node.<form>.admission.<field>).`}})}}let y=l.filter(b=>b.teamAssignable===!0).map(b=>b.id);for(let b of Object.keys(r.actionTeams??{}))y.includes(b)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actionTeams.${b}`,reason:{de:`[capability/unknownActionTeam] Knoten "${r.id}" nennt ein Team f\xFCr "${b}", aber diese Aktion l\xE4sst sich hier keinem Team geben; m\xF6glich: ${y.join(", ")||"keine"}.`,en:`[capability/unknownActionTeam] Node "${r.id}" names a team for "${b}", but this action cannot be given to a team here; possible: ${y.join(", ")||"none"}.`},severity:"error"});let k=new Set;for(let b of a)if(b.recipient==="external"||(r.assign??{})[b.key]!==void 0)for(let T of b.unlocks)k.add(T);let w=i.strictActionCoverage===!0;for(let b of l){if(k.has(b.id)||b.superUserOnly===!0)continue;let E=a.find(R=>R.unlocks.includes(b.id)),T=E!==void 0?{de:` Fehlt die Zuweisung assign.${E.key}?`,en:` Is the assignment assign.${E.key} missing?`}:{de:"",en:""};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${b.id}`,reason:{de:`[capability/superUserOnly] Action "${b.id}" auf Knoten "${r.id}" ist von keinem verdrahteten Work-Item freigeschaltet \u2014 nur die verantwortliche Person (Super-User) kann sie ausf\xFChren.${T.de}`,en:`[capability/superUserOnly] Action "${b.id}" on node "${r.id}" is unlocked by no wired work item \u2014 only the responsible person (super user) can perform it.${T.en}`},severity:w?"error":"warning"})}}return n}s(D4,"checkNodeCapabilityWiring");function F4(e){let n=new Set(R_()),t=[];for(let r of e.nodes)n.has(r.type)||t.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: ${[...n].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...n].join(", ")}.`},severity:"error"});return t}s(F4,"checkKnownNodeTypes");function L4(e,n){let t=[],r=s((a,l)=>{t.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=LO(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(t.push(...X4(l,d)),d.length===0)continue;let c=Je(a),u=new Set(c.optionalActionKinds??[]),p=Array.isArray(l.tasks)?l.tasks:[],h=new Map;for(let w of p)typeof w.key=="string"&&h.set(w.key,w);let y=new Set,k=new Map;for(let w of d){let b=w.key,E=typeof b=="string"&&b.trim().length>0?b:void 0,T=E??"?",R=`nodes.${l.id}.optionalActions.${T}`,P=typeof w.action=="string"?w.action:void 0;if(w.when!==void 0){let L=s(_=>r(`${R}.when`,{de:`[optionalAction/when] Optionale Aktion "${T}" auf Knoten "${l.id}": ${_.de}`,en:`[optionalAction/when] Optional action "${T}" on node "${l.id}": ${_.en}`}),"conditionFinding");if(typeof w.when!="string"||w.when.trim()==="")L({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 _ of mm(w.when,i,n))L(_)}if((P===void 0||!u.has(P))&&r(`${R}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${T}" auf Knoten "${l.id}" hat die Art ${JSON.stringify(w.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 "${T}" on node "${l.id}" has the kind ${JSON.stringify(w.action)} \u2014 `+(u.size===0?`node type "${l.type}" declares no families (spec.optionalActionKinds is missing).`:`node type "${l.type}" only declares: ${[...u].join(", ")}.`)}),E===void 0?r(`${R}.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').`}):(y.has(E)&&r(`${R}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${E}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${E}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),y.add(E)),o(w.label)||r(`${R}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${T}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${T}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),P==="skipRule"){t.push(...q4(l,w,R,T,d));continue}if(P==="spawnTasks"){w.except!==void 0&&r(`${R}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${T}" 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 "${T}" 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'.`}),t.push(...ID({nodeId:l.id,bindingKey:T,binding:w,templates:p})),t.push(...M4(l.id,w,R,T,h));let L=Array.isArray(w.tasks)?w.tasks:void 0;if(L===void 0||L.length===0)r(`${R}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${T}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let _=new Set,v=new Set(L.filter(N=>typeof N=="string"));for(let N of L){let A=typeof N=="string"?N:void 0;if(A===void 0||A.length===0){r(`${R}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(_.has(A)){r(`${R}.tasks.${A}`,{de:`[optionalAction/duplicateTaskRef] Template "${A}" ist in der Aktion "${T}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${A}" is referenced twice in the action "${T}" on node "${l.id}".`});continue}_.add(A);let M=h.get(A);if(M===void 0){r(`${R}.tasks.${A}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert das Template "${A}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" references the template "${A}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let U=k.get(A);U!==void 0&&U!==T?r(`${R}.tasks.${A}`,{de:`[optionalAction/taskDoublyBound] Template "${A}" auf Knoten "${l.id}" ist bereits von der Aktion "${U}" referenziert \u2014 ein Template geh\xF6rt zu h\xF6chstens einer optionalen Aktion.`,en:`[optionalAction/taskDoublyBound] Template "${A}" on node "${l.id}" is already referenced by the action "${U}" \u2014 a template belongs to at most one optional action.`}):k.set(A,T);let oe=M.blocks?.templateKey;typeof oe=="string"&&!v.has(oe)&&r(`${R}.tasks.${A}`,{de:`[optionalAction/taskRefBlocks] Template "${A}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${oe}", das nicht zur selben Aktion "${T}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${A}" on node "${l.id}" carries 'blocks' on "${oe}", which does not belong to the same action "${T}" \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===A&&(re!==void 0&&v.has(re)||r(`${R}.tasks.${A}`,{de:`[optionalAction/taskRefBlocks] Template "${A}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${re!==void 0?`"${re}"`:"einem Template"} au\xDFerhalb der Aktion "${T}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${A}" on node "${l.id}" is the target of a 'blocks' from ${re!==void 0?`"${re}"`:"a template"} outside the action "${T}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return t}s(L4,"checkOptionalActions");function M4(e,n,t,r,i){if(n.auto===void 0)return[];let o=s((d,c,u,p)=>({layer:"GRAPH",kind:"nodeRule",path:d,reason:{de:`[optionalAction/${c}] Optionale Aktion "${r}" auf Knoten "${e}": ${u}`,en:`[optionalAction/${c}] Optional action "${r}" on node "${e}": ${p}`},severity:"error"}),"issue");if(typeof n.auto!="boolean")return[o(`${t}.auto`,"autoType","'auto' ist true oder false.","'auto' is true or false.")];if(!n.auto)return[];let a=[];for(let d of["input","submitLabel"])n[d]!==void 0&&a.push(o(`${t}.${d}`,"autoInput",`startet beim Betreten des Schritts, niemand f\xFCllt den Dialog \u2014 '${d}' entfernen.`,`starts when the step is entered, nobody fills in the dialog \u2014 remove '${d}'.`));let l=Array.isArray(n.tasks)?n.tasks:[];for(let d of l)typeof d=="string"&&i.get(d)?.familyRequest!==void 0&&a.push(o(`${t}.tasks.${d}`,"autoFamilyRequest",`startet beim Betreten des Schritts, aber \u201E${d}\u201C fragt die Familie \u2014 was gefragt wird, w\xE4hlt erst ein Klick.`,`starts when the step is entered, but "${d}" asks the family \u2014 what it asks is chosen only by a click.`));return a}s(M4,"autoIssues");function q4(e,n,t,r,i){let o=[],a=s((u,p,h,y)=>{o.push({layer:"GRAPH",kind:"nodeRule",path:u,reason:{de:`[optionalAction/${p}] Optionale Aktion "${r}" auf Knoten "${e.id}": ${h}`,en:`[optionalAction/${p}] Optional action "${r}" on node "${e.id}": ${y}`},severity:"error"})},"push"),l=Array.isArray(e.requiresOneOf)?e.requiresOneOf:[];l.length===0&&a(`${t}.action`,"skipRuleWithoutRule","\xFCberspringt die Entscheidungsregel, aber der Knoten hat keine (`requiresOneOf`).","skips the decision rule, but the node has none (`requiresOneOf`)."),l.includes(n.key)&&a(`nodes.${e.id}.requiresOneOf`,"skipRuleListed","steht selbst in `requiresOneOf` \u2014 die Regel, die sie aufhebt, kann sie nicht erf\xFCllen.","is itself listed in `requiresOneOf` \u2014 it cannot meet the rule it lifts.");let d=e.assign?.decision;(!Array.isArray(d)||d.length===0)&&a(`${t}.action`,"skipRuleNeedsDecisionRow","braucht eine Entscheidungszeile (`assign.decision`), die festh\xE4lt, wer die Regel aufgehoben hat.","needs a decision row (`assign.decision`) that records who lifted the rule."),i.find(u=>u.action==="skipRule")!==n&&a(`${t}.action`,"skipRuleTwice","ist die zweite Aktion dieser Art am Knoten \u2014 eine reicht.","is the second action of this kind on the node \u2014 one is enough.");for(let u of["tasks","input","repeatable","submitLabel","auto"])n[u]!==void 0&&a(`${t}.${u}`,"skipRuleShape",`tr\xE4gt '${u}' \u2014 sie legt keine Aufgaben an.`,`carries '${u}' \u2014 it creates no tasks.`);return o}s(q4,"skipRuleIssues");function K4(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(K4,"literalValueType");function j4(e,n){let t=[],r=n?.notificationTemplates;for(let i of e.nodes){let o=i,a=CN(i,Je(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)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c}`,reason:{de:`[notification/unknownEvent] Knoten "${o.id}" bindet eine Benachrichtigung 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 notification 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)){t.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}) eine Benachrichtigung verschicken \u2014 es ist ${u===void 0?"keine gebunden":"eine gebunden, aber abgeschaltet"}.`,en:`[notification/missingBinding] Node "${o.id}" must send a notification 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"){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/internalAudienceUnsupported] Knoten "${o.id}": das Ereignis "${c.id}" richtet sich an die Schule, und Benachrichtigungen an die Schule k\xF6nnen noch nicht zugestellt werden \u2014 die gebundene Benachrichtigung "${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 notifications to the school cannot be delivered yet \u2014 the bound notification "${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){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/unknownTemplate] Knoten "${o.id}": die Benachrichtigung "${u.templateId}" ist nicht im Katalog. Bekannt sind: ${[...r.keys()].sort().join(", ")||"(keine)"}.`,en:`[notification/unknownTemplate] Node "${o.id}": the notification "${u.templateId}" is not in the catalog. Known: ${[...r.keys()].sort().join(", ")||"(none)"}.`},severity:"error"});continue}h.audience!==void 0&&h.audience!==c.audience&&t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/audienceMismatch] Die Benachrichtigung "${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 notification "${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 y=IN(c),k=new Set(h.params.map(w=>w.key));for(let w of Object.keys(u.args??{}))k.has(w)||t.push({layer:"GRAPH",kind:"nodeRule",path:`${p}.args.${w}`,reason:{de:`[notification/unknownArg] Die Benachrichtigung "${h.id}" hat kein Argument "${w}" \u2014 erwartet werden: ${h.params.map(b=>b.key).join(", ")||"(keine)"}.`,en:`[notification/unknownArg] The notification "${h.id}" has no argument "${w}" \u2014 expected: ${h.params.map(b=>b.key).join(", ")||"(none)"}.`},severity:"error"});for(let w of h.params){let b=u.args?.[w.key],E=`${p}.args.${w.key}`;if(b!==void 0&&"literal"in b){let R=K4(b.literal);w.type!==void 0&&!Ek(R,w.type)&&t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/argTypeMismatch] "${w.key}" erwartet ${ud(w.type).de}, festgelegt ist aber ${JSON.stringify(b.literal)} (${R}).`,en:`[notification/argTypeMismatch] "${w.key}" expects ${ud(w.type).en}, but ${JSON.stringify(b.literal)} (${R}) is set.`},severity:"error"});continue}if(b!==void 0){t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/unsupportedArg] "${w.key}" ist an ${JSON.stringify(b)} gebunden \u2014 ein Argument einer Benachrichtigung kann nur ein Festwert ({ literal }) sein oder automatisch aus ${OD(y,"de")} kommen.`,en:`[notification/unsupportedArg] "${w.key}" is bound to ${JSON.stringify(b)} \u2014 a notification argument can only be a fixed value ({ literal }) or come automatically from ${OD(y,"en")}.`},severity:"error"});continue}let T=ON(w,y.get(w.key)??[]);if(!(T.status==="resolved"||T.status==="unused")){if(T.status==="sometimes"){t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${w.key}" immer, ${T.source.source} liefert es aber nur manchmal. In notifications.${c.id}.args.${w.key} einen Festwert benennen \u2014 oder eine Benachrichtigung w\xE4hlen, die ohne "${w.key}" auskommt.`,en:`[notification/unresolvedArg] The notification "${h.id}" always needs "${w.key}", but ${T.source.source} provides it only sometimes. Name a fixed value in notifications.${c.id}.args.${w.key} \u2014 or choose a notification that works without "${w.key}".`},severity:"error"});continue}if(T.status==="ambiguous"){t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/ambiguousArg] "${w.key}" hat mehrere passende Quellen \u2014 ${T.matches.map(R=>R.source).join(", ")}. In notifications.${c.id}.args.${w.key} einen Festwert setzen.`,en:`[notification/ambiguousArg] "${w.key}" has several matching sources \u2014 ${T.matches.map(R=>R.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${w.key}.`},severity:"error"});continue}t.push({layer:"GRAPH",kind:"nodeRule",path:E,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${w.key}"${w.type!==void 0?` (${ud(w.type).de})`:""}, und der Knoten hat daf\xFCr ${T.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${T.rejected.map(R=>`${R.source} (${R.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The notification "${h.id}" needs "${w.key}"${w.type!==void 0?` (${ud(w.type).en})`:""}, and the node has ${T.rejected.length===0?"no source for it":`only unsuitable sources for it: ${T.rejected.map(R=>`${R.source} (${R.type})`).join(", ")}`}.`},severity:"error"})}}}}return t}s(j4,"checkNotificationBindings");function V4(e){return uC(e).map(n=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:n,severity:"error"}))}s(V4,"checkAssignmentRules");function OD(e,n){let t=[...e.keys()].sort();return t.length===0?n==="de"?"(nichts)":"(nothing)":t.join(", ")}s(OD,"describeCandidates");function B4(e,n){return mC(e,n?.teamKeys).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(B4,"checkChannels");function U4(e){return qO(e).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(U4,"checkStaffInputs");function G4(e,n){let t=[];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${_e(e,r.id,"de")}\u201C (${r.id})`,en:`Node "${_e(e,r.id,"en")}" (${r.id})`},l=s(c=>{t.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!AC(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(!we(c))continue;let u=de(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),!un(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=Xr(n,c);p!=null&&ua("nodeReads",ca(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 t}s(G4,"checkReadinessReads");function z4(e,n){let t=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=K_(r),o=Rp(r);if(i===null||o===null)continue;let a=n?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${Mn.flagKey}`,reason:{de:`[setFlag/unknownFlag] Knoten \u201E${_e(e,r.id,"de")}\u201C (${r.id}) setzt \u201E${o}\u201C, aber das Formular von \u201E${_e(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 "${_e(e,r.id,"en")}" (${r.id}) sets "${o}", but the form of "${_e(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 t}s(z4,"checkSetFlagKeys");function W4(e,n){let t=n?.readinessFormFieldsByFormNode,r=n?.readinessPartyConditionKeysByFormNode;if(t===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(!we(a)||!$r(a))continue;let l=t.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=Mk(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(w=>un(w)&&w.owner===a.owner),h=Mk(l,[...p.map(w=>w.path),...$C(o).filter(w=>w.owner===a.owner).map(w=>w.fieldKey)]),y=[...c].filter(w=>!h.has(w)).sort();if(y.length===0)continue;let k={de:_e(e,a.owner,"de"),en:_e(e,a.owner,"en")};i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.reads`,reason:{de:`[readiness/readsMissesPartyCondition] Knoten \u201E${_e(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: ${y.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 "${_e(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: ${y.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(W4,"checkReadinessPartyConditions");function nb(e){let n=Object.keys(e.inputs??{});if(n.length===0)return[];let t=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(t?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(ha(e).map(l=>l.id));return n.filter(l=>!a.has(l))}s(nb,"undeclaredInputKeys");function Y4(e,n){return e.nodes.flatMap(t=>[...J4(e,t,ha(t),n),...H4(e,t,n)])}s(Y4,"checkUnknownResources");function H4(e,n,t){let r=[],i=new Set((Je(n).workItemTemplates?.(n)??[]).map(a=>a.key)),o=new Set((n.tasks??[]).filter(a=>a.familyRequest!==void 0).map(a=>String(a.key)));for(let a of jp(n)){if(a.leaf==="assign{}"&&!i.has(a.owner)||a.leaf==="tasks[].assign.group"&&a.missing&&o.has(a.owner))continue;let l=aa[a.leaf],d=`nodes.${n.id}.${a.path}`,c=s(h=>h==="de"?`Knoten \u201E${_e(e,n.id,"de")}\u201C (${n.id}), ${l.what.de} \u201E${a.owner}\u201C`:`node "${_e(e,n.id,"en")}" (${n.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=t?.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(H4,"referenceIssues");function J4(e,n,t,r){let i=[];for(let o of t){if(!Ip(o.type))continue;let a=ia[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=n.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=ia[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${_e(e,n.id,"de")}\u201C (${n.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 "${_e(e,n.id,"en")}" (${n.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(J4,"unknownResourceIssues");function Q4(e){let n=[];for(let t of e.nodes)for(let r of nb(t))n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${_e(e,t.id,"de")}\u201C (${t.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 "${_e(e,t.id,"en")}" (${t.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 n}s(Q4,"checkUndeclaredInputs");function Z4(e){let n=[];for(let t of e.nodes){let r=new Set;for(let i of ha(t)){if(!r.has(i.id)){r.add(i.id);continue}n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${_e(e,t.id,"de")}\u201C (${t.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 "${_e(e,t.id,"en")}" (${t.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 n}s(Z4,"checkDuplicateSlots");function PD(e,n,t){let r=[],i=F4(e);if(i.length>0)return i;r.push(...b4(e)),r.push(...w4(e)),r.push(...v4(e)),r.push(...k4(e)),r.push(...h4(e)),r.push(...g4(e)),r.push(...y4(e)),r.push(...A4(e)),r.push(...x4(e)),r.push(...JP(e,n)),r.push(...E4(e,n)),r.push(...T4(e,n)),r.push(...$4(e,n)),r.push(..._C(e,n?.layout)),r.push(...R4(e,n)),r.push(...I4(e,n)),r.push(..._4(e,n)),r.push(...jP(e,t)),r.push(...eN(e)),r.push(...oN(e)),r.push(...ZP(e)),r.push(...XP(e)),r.push(...Q4(e)),r.push(...Y4(e,t)),r.push(...Z4(e)),r.push(...P4(e)),r.push(...N4(e)),r.push(...WC(e,t)),r.push(...ZC(e)),r.push(...JC(e)),r.push(...XC(e,t)),r.push(...sD(e,t)),r.push(...D4(e)),r.push(...j4(e,t)),r.push(...L4(e,t)),r.push(...V4(e)),r.push(...G4(e,t)),r.push(...W4(e,t)),r.push(...z4(e,t)),r.push(...B4(e,t)),r.push(...U4(e)),r.push(...RD(e));for(let o of e.nodes){let a=Je(o);a.validate&&r.push(...a.validate(o,e,t))}return r}s(PD,"checkGraph");function X4(e,n){let t=e.requiresOneOf;if(t===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(t)||t.length===0||t.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=n.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of t){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(X4,"checkRequiresOneOf");function e3(e){return e.nodes.flatMap(n=>nb(n).map(t=>({nodeId:n.id,key:t,binding:n.inputs?.[t]?.kind==="binding"})))}s(e3,"undeclaredInputCells");function ND(e,n){let t=e3(e).filter(o=>n.bindings||!o.binding);if(t.length===0)return{graph:e,dropped:t};let r=new Map;for(let o of t)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:t}}s(ND,"dropUndeclaredInputs");function tb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(tb,"isObject");function CD(e){return tb(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(CD,"oldShape");function DD(e){return(e?.nodes??[]).some(CD)}s(DD,"needsTemplateStampMove");function n3(e){let n=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(n)?n:null;let t=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(t)?t:null}s(n3,"stampedFields");function t3(e){let n=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:n,reason:"templateAndStamp"}};let t={...e},r=[];if("template"in e){let{template:i}=e;if(delete t.template,tb(i))t.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:n,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete t.cockpitFields;let o=tb(e.inputs)?{...e.inputs}:{},a=n3(t);if(a===null&&i.length>0)return{unmoved:{nodeId:n,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:n,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:n,key:l,reason:"processSource"}):d?r.push({nodeId:n,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}t.inputs=o}return{node:t,reports:r}}s(t3,"moveNode");function FD(e){let n=[],t=[],r=[],i=e.nodes.map(o=>{if(!CD(o))return o;let a=t3(o);return"unmoved"in a?(r.push(a.unmoved),o):(n.push(String(o.id)),t.push(...a.reports),a.node)});return n.length===0?{graph:e,moved:n,reports:t,unmoved:r}:{graph:{...e,nodes:i},moved:n,reports:t,unmoved:r}}s(FD,"moveTemplateStampAndCockpit");var LD=ap,r3="applicant.applicationSubmitted";function Cm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Cm,"isObject");function MD(e){return Cm(e)&&e.type==="form"&&typeof e.id=="string"&&!It(e)}s(MD,"isCreatingFormNode");function i3(e){return Cm(e.notifications)&&LD in e.notifications}s(i3,"hasSubmittedBinding");function rb(e){let n={toBind:[],alreadyBound:[],malformed:[]};for(let t of e?.nodes??[])MD(t)&&(t.notifications!==void 0&&!Cm(t.notifications)?n.malformed.push(t.id):i3(t)?n.alreadyBound.push(t.id):n.toBind.push(t.id));return n}s(rb,"submitReceiptInventory");function qD(e){let{toBind:n}=rb(e);if(n.length===0)return{graph:e,bound:[]};let t=new Set(n),r=e.nodes.map(i=>{if(!MD(i)||!t.has(i.id))return i;let o=Cm(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[LD]:{templateId:r3}}}});return{graph:{...e,nodes:r},bound:n}}s(qD,"bindSubmitReceipt");var is=["park","advance"],lr="whenNothingOwed",KD={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function jD(e){let n=e.inputs?.[lr],t=n?.kind==="literal"?n.value:void 0;return ib(t)?t:null}s(jD,"reviewModeOrNull");function ib(e){return is.includes(e)}s(ib,"isReviewMode");function ob(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ob,"isObject");function VD(e){return ob(e)&&e.type==="review"&&!(ob(e.inputs)&&lr in e.inputs)}s(VD,"lacksMode");function BD(e){return(e?.nodes??[]).some(VD)}s(BD,"needsReviewMode");function UD(e){let n=[],t=e.nodes.map(r=>{if(!VD(r))return r;n.push(r.id);let i=ob(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[lr]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:t},set:n}}s(UD,"setReviewModePark");function Dm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Dm,"isObject");function GD(e){let{notifications:n,bound:t}=rm(e.notifications,{tasks:[]},e);return{next:n,bound:t}}s(GD,"bindingsFor");function zD(e){let n={toBind:[],malformed:[]};for(let t of e?.nodes??[])if(!(!Dm(t)||typeof t.id!="string"||ka(t).length===0)){if(t.notifications!==void 0&&!Dm(t.notifications)){n.malformed.push(t.id);continue}for(let r of GD(t).bound)n.toBind.push(`${t.id}.${r}`)}return n}s(zD,"appointmentLetterInventory");function WD(e){let n=[],t=!1,r=e.nodes.map(i=>{if(!Dm(i)||typeof i.id!="string"||ka(i).length===0||i.notifications!==void 0&&!Dm(i.notifications))return i;let{next:o,bound:a}=GD(i);return a.length===0?i:(t=!0,n.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return t?{graph:{...e,nodes:r},bound:n}:{graph:e,bound:[]}}s(WD,"bindAppointmentLetters");function Ma(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ma,"isObject");var YD=["id","label","dataFlow"],HD=["audience","populates","stages","expectedOutcomes"];function JD(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(n=>Ma(n)&&typeof n.slot=="string")}s(JD,"carriesStringSlots");function QD(e){return(e.nodes??[]).some(n=>Ma(n)&&n.type==="form"&&HD.some(t=>t in n))}s(QD,"carriesRetiredFormNodeKey");var o3=[{key:"generatorPin",editor:!0,holds:c_,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:G_,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:Q_,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:oP,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:e_,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:i_,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:DD,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:"paymentSettlement",editor:!0,holds:fP,what:{de:"Zahlungsknoten mit \u201EAbrechnung\u201C (`inputs.settlement`) statt \u201EZahlungsweg\u201C (`inputs.mode`)",en:'payment node with "Settlement" (`inputs.settlement`) instead of "Payment mode" (`inputs.mode`)'}},{key:"documentRef",editor:!0,holds:AP,what:{de:"Dokument eines anderen Knotens als `document:$node.<Knoten>.document` statt als Slot `artifact:<Slot>`",en:"another node's document as `document:$node.<node>.document` instead of the slot `artifact:<slot>`"}},{key:"formView",editor:!0,holds:gP,what:{de:"Ansicht einer Aufgabe als `formView` statt als Ansichts-Adresse `view`",en:"a task's view as `formView` instead of the view address `view`"}},{key:"nodeAssignString",editor:!0,holds:xP,what:{de:"Team einer Knoten-Aufgabe als Text (`assign.<Vorlage>`) statt als Regelliste",en:"a node task's team as text (`assign.<template>`) instead of a rule list"}},{key:"reviewWithoutMode",editor:!0,holds:BD,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=>qp(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=>YD.some(n=>n in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:JD,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:QD,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function ZD(e){if(!Ma(e)||!Array.isArray(e.nodes))return[];let n=e;return o3.filter(t=>t.holds(n)).map(({key:t,what:r,editor:i})=>({key:t,what:r,editor:i}))}s(ZD,"legacyGraphShapes");function XD(e,n){let t=n.answers??{},r=[],i=[],o=e,a=YD.filter(A=>A in o);if(a.length>0){let A={...o};for(let M of a)delete A[M],r.push({message:`graph.${M}: deleted (read by nothing)`});o=A}if(QD(o)&&(o={...o,nodes:o.nodes.map(A=>{if(!Ma(A)||A.type!=="form")return A;let M=HD.filter(oe=>oe in A);if(M.length===0)return A;let U={...A};for(let oe of M)delete U[oe];return r.push({nodeId:String(A.id),message:`form node: deleted ${M.map(oe=>`\`${oe}\``).join(", ")} (read by nothing)`}),U})}),JD(o)){let A=o.assignmentRules.map((M,U)=>{if(!Ma(M)||typeof M.slot!="string")return M;let oe=kp(M.slot);return oe===null?(i.push({code:"assignment/slotUnknown",answer:"edit",message:`assignmentRules[${U}].slot "${M.slot}" is neither \`responsible\` nor \`team:<key>\` \u2014 edit it by hand`}),M):(r.push({message:`assignmentRules[${U}].slot "${M.slot}" \u2192 ${JSON.stringify(oe)}`}),{...M,slot:oe})});o={...o,assignmentRules:A}}let l=u_(o);o=l.graph;for(let A of l.moved)r.push({nodeId:A,message:"generator / template pin moved into its input"});for(let A of l.unmoved)i.push({code:`generatorPin/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${A.reason}) \u2014 edit the node by hand`});let d=z_(o);o=d.graph;for(let A of d.moved)r.push({nodeId:A,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let A of d.unmoved)i.push({code:`setFlag/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${A.reason}) \u2014 edit the node by hand`});let c=Z_(o);o=c.graph;for(let A of c.moved)r.push({nodeId:A,message:"scalar settings moved into inputs"});for(let A of c.unmoved)i.push({code:`scalar/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`\`${A.key}\` cannot be moved into an input (${A.reason}) \u2014 edit the node by hand`});let u=sP(o);o=u.graph;for(let A of u.moved)r.push({nodeId:A,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let A of u.unmoved)i.push({code:`nodeConfig/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`\`${A.key}\` cannot be moved into an input (${A.reason}) \u2014 edit the node by hand`});let p=FD(o);o=p.graph;for(let A of p.moved){let M=o.nodes.find(Q=>Ma(Q)&&Q.id===A),U=M?.inputs?.documentTemplate,oe=U?.kind==="literal"&&typeof U.value=="string"?U.value:null;r.push({nodeId:A,message:M!==void 0&&"templateStamp"in M&&oe!==null?`template parameters moved onto \`templateStamp\` / cockpit list into cells \u2014 the record \`${oe}\` 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 A of p.reports)r.push({nodeId:A.nodeId,message:`cockpit field \`${A.key??""}\` deleted (${A.reason}: ${A.reason==="unknownKey"?"the stamp declares no such parameter":A.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let A of p.unmoved)i.push({code:`templateStamp/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:A.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":A.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=o_(o);o=h.graph;for(let A of h.moved)r.push({nodeId:A,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let A of h.unmoved)i.push({code:`eventTrigger/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${A.reason}) \u2014 edit the node by hand`});let y=n_(o,t.semantics);o=y.graph;for(let A of y.written){if(A.source==="formerDefault"){r.push({nodeId:A.nodeId,message:`outcome \`${A.outcomeId}\`: semantic "${A.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${A.nodeId}.${A.outcomeId}`,value:A.semantic}});continue}r.push({nodeId:A.nodeId,message:`outcome \`${A.outcomeId}\`: semantic "${A.semantic}" (${A.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let A of y.refused)i.push({code:A.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:A.nodeId,answer:"semantic",answerKey:`${A.nodeId}.${A.outcomeId}`,candidates:A.allowed,message:A.answer===void 0?`${A.nodeType} outcome \`${A.outcomeId}\` ran as "${Tw(A.outcomeId)??""}", which a ${A.nodeType} outcome may no longer carry \u2014 say which one it is`:`${A.nodeType} outcome \`${A.outcomeId}\`: "${A.answer}" is not a meaning a ${A.nodeType} outcome may carry`});for(let A of y.invalid)i.push({code:"outcome/semanticInvalid",nodeId:A.nodeId,answer:"edit",candidates:Rt,message:`outcome \`${A.outcomeId}\` carries the semantic "${A.value}", which is no meaning \u2014 edit it`});let k=l_(o,n.selection,t.waitlistPolicy);o=k.graph;for(let A of k.moved){let M=A.policy.waitlistOrder;r.push({nodeId:A.nodeId,message:`waitlist policy into inputs: ${s3(A.policy)} (${A.source==="answer"?"answered":A.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...A.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:A.nodeId,value:M}}:{}})}for(let A of k.refused)i.push({code:`waitlist/${A.reason}`,nodeId:A.nodeId,answer:"waitlistPolicy",answerKey:A.nodeId,candidates:rr,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});let w=pP(o);o=w.graph;for(let A of w.moved)r.push({nodeId:A,message:"payment: `inputs.settlement` \u2192 `inputs.mode` (separate \u2192 manual)"});for(let A of w.refused)i.push({code:`collectPayment/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:A.reason==="bothCells"?"the payment node carries both `inputs.settlement` and `inputs.mode` \u2014 delete `settlement` by hand":"`inputs.settlement` is no literal online | separate \u2014 set `inputs.mode` by hand"});let b=yP(o);o=b.graph;for(let A of b.moved)r.push({nodeId:A.split(".")[0],message:`\`formView\` \u2192 \`view\` (${A})`});for(let A of b.refused){let M=A.taskKey===void 0?"the node":`task "${A.taskKey}"`;i.push({code:`view/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:A.reason==="bothFields"?`${M} carries both \`formView\` and \`view\` \u2014 delete \`formView\` by hand`:`${M}'s \`formView\` is no { form, key } \u2014 set \`view\` by hand`})}let E=SP(o);o=E.graph;for(let A of E.moved)r.push({nodeId:A.nodeId,message:`\`assign.${A.templateKey}\`: team \u2192 rule list`});for(let A of E.refused)i.push({code:"assign/shape",nodeId:A.nodeId,answer:"edit",message:`\`assign.${A.templateKey}\` is neither a team key nor a rule list \u2014 set it by hand`});let T=EP(o);o=T.graph;for(let A of T.moved)r.push({nodeId:A.split(".")[0],message:`documents: \`document:$node.<node>.document\` \u2192 \`artifact:<slot>\` (${A})`});for(let A of T.refused)i.push({code:`workItems/${A.reason}`,nodeId:A.nodeId,answer:"edit",message:`task "${A.taskKey}" links a document whose node declares no single slot \u2014 name the slot as \`artifact:<slot>\` by hand`});if(lP(o)){let A=dP(o,t.payee);o=A.graph;for(let M of A.set)r.push({nodeId:M.nodeId,message:`online payment: payee "${M.payee}" (answered)`});for(let M of A.refused)i.push({code:"collectPayment/payeeMissing",nodeId:M,answer:"payee",answerKey:M,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 A of rb(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:A,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let R=qD(o);o=R.graph;for(let A of R.bound)r.push({nodeId:A,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let P=UD(o);o=P.graph;for(let A of P.set)r.push({nodeId:A,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let A of zD(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:A,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let L=WD(o);o=L.graph;for(let A of L.bound){let M=A.indexOf(".");r.push({nodeId:A.slice(0,M),message:`appointment letter bound to \`notifications.${A.slice(M+1)}\` (the standard letter, sent by code before)`})}let _=qp(o).filter(A=>!A.hasTeam);for(let A of _)i.push({code:"task/userWithoutTeam",nodeId:A.nodeId,answer:"edit",message:`task \`${A.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let v=TP(o);o=v.graph;for(let A of v.dropped.filter(M=>M.hasTeam))r.push({nodeId:A.nodeId,message:`task \`${A.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let N=ND(o,{bindings:!0});o=N.graph;for(let A of N.dropped){if(!A.binding){r.push({nodeId:A.nodeId,message:`input \`${A.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:A.nodeId,message:`input \`${A.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:`${A.nodeId}.${A.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(XD,"upgradeGraph");function s3(e){return`waitlistOrder=${e.waitlistOrder}`}s(s3,"formatPolicy");function Ei(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ei,"isObject");var eF="admission.generic",nF=Object.keys(gp).filter(e=>e!=="label");function tF(e){return Ei(e.smartforms)?Object.entries(e.smartforms):[]}s(tF,"smartformEntries");function a3(e){let n=[];tF(e.index).some(([,i])=>Ei(i)&&"outcomeFnRef"in i)&&n.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let t=Object.keys(e.manifest).filter(i=>Object.hasOwn(Yl,i));if(t.length>0){let i=t.map(o=>`\`${o}\``).join(", ");n.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>nF.some(o=>o in i))&&n.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"});let r=e.workflow;return r!==void 0&&(Ei(r.progressWiring)&&"layoutId"in r.progressWiring&&n.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),n.push(...ZD(r.graph).map(i=>i.what))),n}s(a3,"legacyBundleShapes");function Lm(e,n){let t=a3(e);t.length!==0&&ae("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${n} stammt aus einem \xE4lteren Bundle-Format (${t.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: ${n} is in an older bundle format (${t.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(Lm,"assertBundleCurrent");function Fm(e){let n=s(t=>Array.isArray(t)?t.map(n):Ei(t)?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(Fm,"canonical");function rF(e,n={}){let t=[],r=[],i=e.index,o=tF(i);if(o.some(([,u])=>Ei(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!Ei(h)||Object.keys(h).length===0){u[p]=h;continue}let{outcomeFnRef:y,...k}=h;if(Object.keys(k).length>0||y!==void 0&&y!==eF){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(w=>`\`${w}\``).join(", ")} \u2014 only \`outcomeFnRef: ${eF}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}t.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,t.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?t.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},t.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):Fm(l.progressLayout)===Fm(p)?t.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}t.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(Ei(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},t.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(Ei(u)&&Array.isArray(u.nodes)){let p=XD(u,{selection:d,answers:n});l={...l,graph:p.graph},t.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 y={...h},k=`smartforms/${p}.json`;for(let w of nF)if(w in h){if(w==="outcomeIds"){let b=Array.isArray(h.outcomes)?h.outcomes.map(E=>Ei(E)?E.id:void 0):[];if(Fm([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==Fm(b.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 y[w],t.push({file:k,message:`\`${w}\` deleted (${gp[w].en})`})}u[p]=y}c=u}return{bundle:{index:i,manifest:a,...c!==void 0?{smartforms:c}:{},...l!==void 0?{workflow:l}:{}},changes:t,refusals:r}}s(rF,"upgradeOfferBundle");var l3={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},yxe={createManifest:lt.workflow.createManifestInternal,publishManifest:lt.workflow.publishManifestInternal,publishOfferInternal:lt.workflow.publishOfferInternalInternal,publishOfferExternal:lt.workflow.publishOfferExternalInternal,getOfferPublishState:lt.workflow.getOfferPublishStateInternal,upsertCustomField:lt.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:lt.admission.upsertDerivedAttributeRuleInternal,createSmartForm:lt.forms.createSmartFormInternal,getSmartFormBySlug:lt.forms.getSmartFormBySlugInternal,saveSmartFormDraft:lt.forms.saveSmartFormDraftInternal,publishSmartForm:lt.forms.publishSmartFormInternal,createWorkflow:lt.workflow.createWorkflowInternal,getWorkflowGraph:lt.workflow.getWorkflowGraphInternal,saveWorkflowDraft:lt.workflow.saveWorkflowDraftInternal,publishWorkflow:lt.workflow.publishWorkflowInternal};function sb(e,n){for(let[t,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&ae("INVALID",{de:`offer: ${n}: smartforms.${t} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${n}: smartforms.${t} 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: ${n}: smartforms.${t} 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: ${n}: smartforms.${t} 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(sb,"assertSmartformEntries");function iF(e){let n=s(t=>Array.isArray(t)?t.map(n):t&&typeof t=="object"?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(iF,"canonicalJson");function oF(e,n){return n==null?!0:iF(e)!==iF(n)}s(oF,"changed");async function sF(e,n,t,r={},i=l3){let{index:o}=n;Lm({index:o,manifest:n.manifest,...n.smartforms!==void 0?{smartforms:n.smartforms}:{},...n.workflow!==void 0?{workflow:n.workflow}:{}},`bundle of ${o.slugs.manifest}`),sb(o,`bundle of ${o.slugs.manifest}`);let a=hp(n.manifest);a.length>0&&ae("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11374
11374
|
- ${a.join(`
|
|
11375
11375
|
- `)}`,en:`offer: manifest.json of ${o.slugs.manifest} is invalid:
|
|
11376
11376
|
- ${a.join(`
|
|
@@ -11638,6 +11638,6 @@ ${t.length} unusable ${o}:
|
|
|
11638
11638
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11639
11639
|
`),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>
|
|
11640
11640
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11641
|
-
`);return t.length>0?1:0}},h$=class extends wr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=$.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 t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function $U(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s($U,"requireOnOff");var RU=[ZT,XT,e$,n$,t$,r$,i$,o$,s$,a$,Ku,l$,d$,c$,u$,f$,p$,m$,h$];function IU(e){return e.de??e.en??Object.values(e)[0]??""}s(IU,"titleDe");function mee(e){return{id:e._id,kind:e.kind,status:e.status,title:IU(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(mee,"row");var hee=["id","kind","status","title","assignee","group","outcome"],w$=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...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(mee),hee),0}},k$=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=$.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:IU(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}},b$=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,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}},v$=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,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}},x$=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,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}},OU=[w$,k$,b$,v$,x$];var ju=[...dO,...VF,...QF,...XL,...ZL,...E0,...P0,..._0,...EU,...RU,...AU,...dB,...hB,...TF,...v0,...fU,...aO,...KO,...uF,...D0,...C0,...M0,...q0,...k0,...o0,...OU,...nj,...Uj,...aB,...Gj,...HB,...rU,...gB,...EB,...RB,...PB,...CB,...sU,...yU,...OO];for(let e of ju){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:SR(e.usage.category,n.join(" "))})}var _U="0.1.242";function PU(){return ju.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=kR[$o(t)];return{path:t,effect:Ro(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(PU,"plexusCommandCatalog");import As from"node:path";function gee(e){let n=cn()?.workspaceRoot??process.cwd(),t=As.resolve(n,e),r=As.relative(n,t);if(As.isAbsolute(e)||r===".."||r.startsWith(`..${As.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(gee,"workspacePath");function yee(e){let{absolute:n,relative:t}=gee(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of qr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=As.join(o,a.name);if(a.isDirectory()?i(l):r.push(As.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);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:t,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:t,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 ze(n,a,"utf8"),{path:t,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 Bn(As.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Rs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(yee,"plexusWorkspace");function NU(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Ul[t];if(!o||!Object.hasOwn(Ul,t))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(t==="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(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(rw,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:rw[i.path],skillHash:Zf}}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 yee(i)},"executePlexusAgentTool")}s(NU,"createPlexusAgentToolExecutor");var Kg=NU({inspectCommand:DU,executeCommand:FU});function jg(){let e=new Ps({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_U});e.register(El.HelpCommand),e.register(El.VersionCommand);for(let t of ju)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return bee(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(jg,"createPlexusCli");function bee(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&Il[t]===r&&ln(n,t,r),t in Il&&Ro(t)==="confirm"&&!Ol(e)&&n.write(`plexus-cli: \`${Il[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11641
|
+
`);return t.length>0?1:0}},h$=class extends wr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=$.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 t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function $U(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s($U,"requireOnOff");var RU=[ZT,XT,e$,n$,t$,r$,i$,o$,s$,a$,Ku,l$,d$,c$,u$,f$,p$,m$,h$];function IU(e){return e.de??e.en??Object.values(e)[0]??""}s(IU,"titleDe");function mee(e){return{id:e._id,kind:e.kind,status:e.status,title:IU(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(mee,"row");var hee=["id","kind","status","title","assignee","group","outcome"],w$=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...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(mee),hee),0}},k$=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=$.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:IU(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}},b$=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,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}},v$=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,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}},x$=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=$.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 n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,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}},OU=[w$,k$,b$,v$,x$];var ju=[...dO,...VF,...QF,...XL,...ZL,...E0,...P0,..._0,...EU,...RU,...AU,...dB,...hB,...TF,...v0,...fU,...aO,...KO,...uF,...D0,...C0,...M0,...q0,...k0,...o0,...OU,...nj,...Uj,...aB,...Gj,...HB,...rU,...gB,...EB,...RB,...PB,...CB,...sU,...yU,...OO];for(let e of ju){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:SR(e.usage.category,n.join(" "))})}var _U="0.1.243";function PU(){return ju.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=kR[$o(t)];return{path:t,effect:Ro(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(PU,"plexusCommandCatalog");import As from"node:path";function gee(e){let n=cn()?.workspaceRoot??process.cwd(),t=As.resolve(n,e),r=As.relative(n,t);if(As.isAbsolute(e)||r===".."||r.startsWith(`..${As.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(gee,"workspacePath");function yee(e){let{absolute:n,relative:t}=gee(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of qr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=As.join(o,a.name);if(a.isDirectory()?i(l):r.push(As.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);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:t,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:t,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 ze(n,a,"utf8"),{path:t,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 Bn(As.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Rs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(yee,"plexusWorkspace");function NU(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Ul[t];if(!o||!Object.hasOwn(Ul,t))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(t==="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(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(rw,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:rw[i.path],skillHash:Zf}}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 yee(i)},"executePlexusAgentTool")}s(NU,"createPlexusAgentToolExecutor");var Kg=NU({inspectCommand:DU,executeCommand:FU});function jg(){let e=new Ps({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_U});e.register(El.HelpCommand),e.register(El.VersionCommand);for(let t of ju)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return bee(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(jg,"createPlexusCli");function bee(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&Il[t]===r&&ln(n,t,r),t in Il&&Ro(t)==="confirm"&&!Ol(e)&&n.write(`plexus-cli: \`${Il[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11642
11642
|
`)}s(bee,"noteRetiredPath");function DU(e){let n=jg().process(gl(e),{executePlexusAgentTool:Kg}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=PU().find(l=>l.path===t);if(!r){if(t===""||t==="--help"||t==="--version")return{path:t,writes:!1,host:"shared"};throw new Error(`plexus: command ${t} has no host classification.`)}let i=n,o=r.effect==="callKind"?mh(Ya(Ha),i.fn??"",i.kind):void 0,a=xf(t,{confirm:Ol(n),callKind:o});return{...r,writes:a}}s(DU,"inspectPlexusCommand");async function FU(e,n){if(n)return A$(n,()=>FU(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 t="",r="",i=jg();if(cn()){let l=DU(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(gl(e.argv),{executePlexusAgentTool:Kg,stdin:kee.from(e.stdin===void 0?[]:[e.stdin]),stdout:new CU({write(l,d,c){t+=String(l),c()}}),stderr:new CU({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(FU,"executePlexusCommand");I$({source:vee.join(import.meta.dirname,"skill")});jg().runExit(gl(process.argv.slice(2)),{executePlexusAgentTool:Kg});
|
|
11643
11643
|
//# sourceMappingURL=cli.mjs.map
|