@smartkomm/plexus-cli 0.1.185 → 0.1.186

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 CHANGED
@@ -9921,8 +9921,11 @@ required fields. A secret not given stays as it is. Remove one with
9921
9921
  already started keeps talking to the account it started on \u2014 poll, reconcile,
9922
9922
  void and its callbacks included. \`delete\` is refused while one is open.
9923
9923
  - **The account is part of an open Vorgang.** While one is open, changing
9924
- DocuSign's \`--user-id\` or inSign's \`--base-url\` / \`--owner-id\` is refused;
9925
- rotating the password or HMAC key is allowed.
9924
+ DocuSign's \`--user-id\` or inSign's \`--base-url\` / \`--owner-id\` is refused.
9925
+ Changing the password or HMAC key of the ACTIVE connection is refused as well while an offer
9926
+ requires \`eSignature\` (the save is a direct overwrite; the school has one connection per
9927
+ provider). Without the other provider: first switch the offers to paper, change, test, switch
9928
+ back. A rotation that keeps the connection (\`reseal\`) is a different thing and is not affected.
9926
9929
  - **\`test\` fails on an inSign account that exists.** Both calls of the test
9927
9930
  (\`/configure/get/version\`, \`/get/usersessions\`) need \`ROLE_INSIGN_CONTROLLER\`;
9928
9931
  per the OpenAPI a user without the role is refused (the symptom itself is not
@@ -10993,7 +10996,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
10993
10996
  ## Related
10994
10997
  - Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
10995
10998
  \`plexus-cli platform imports cleanup-orphaned --help\`.
10996
- `};var gf="f65b497a138f9db5a599e1149e2954be4f56c87cd329f1be946c4e294047df90",uy=oI;var fy=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:gf,tools:Al}),0}},py=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await cy(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},sI=[fy,py];var my=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],wde=new Set(my.map(e=>e.key));function lI(e,n,t,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===n);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${n}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${n} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===t||l.runId===t);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${t}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(lI,"resolveStartTarget");function Yz(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(Yz,"applicantText");function dI(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:Yz(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(dI,"applicationRows");var aI=my.map(e=>e.email);function cI(e,n,t,r){if(t===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(ay(e,n)&&(r===void 0||!aI.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${aI.join(", ")} (--applicant) \u2014 never a real family's`)}s(cI,"assertStartApplicant");function uI(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(uI,"processStoreJson");function Hz(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(Hz,"refText");function Jz(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?Hz(e.ref):JSON.stringify(e.value)}s(Jz,"holds");function fI(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:Jz(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(fI,"storeRows");function yf(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(yf,"parseKv");var pI="started",wf="submitted",kf="submitted",mI="load-scenario:";var hI="(Bewerbung)";function gI(e){return{nodeId:hI,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(gI,"sharedAsList");function yI(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(yI,"disabledText");function wI(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:yI(r)})))}s(wI,"actionRows");function kI(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${n}" on ${i} is disabled: ${yI(a)}`);if(i!==hI)return i;let l=t[0];if(l===void 0)throw new Error(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(kI,"nodeOfferingAction");function bI(e,n,t){if(e.startsWith(mI)){if(Object.hasOwn(t,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(bI,"runParams");async function Qz(e,n){let t=await e.query(x.workflow.getInstance,{applicationId:n});if(t===null)throw new Error(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(Qz,"currentNodeIds");function Zz(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(Zz,"refusalText");async function bf(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${Zz(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(x.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,gI(r.actions)]}s(bf,"actionsOf");async function vI(e,n,t){return t!==void 0?[t]:await Qz(e,n)}s(vI,"nodesOf");var hy=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await bf(n,this.application,await vI(n,this.application,this.node));return this.print(t,wI,["node","action","label","disabled"]),0}},gy=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=bI(this.action,this.autoSubmit,yf(this.param??[]).values),t=await this.caller(),r=this.application,i=await vI(t,this.application,this.node),o=kI(await bf(t,r,i),this.action,i);return await t.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},xI=[hy,gy];var We=["de","en"];function Is(e,n){return We.every(t=>e[t]===n[t])}s(Is,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!We.includes(r))?"not-localized":We.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function Pi(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s(Pi,"isLocalizedText");function El(e,n){let t={};for(let r of We){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(El,"composeTexts");var hr=/^[a-z][A-Za-z0-9]*$/;function yy(e){return typeof e=="string"&&hr.test(e)}s(yy,"isNodeId");function Os(e,n){yy(e)||L(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${hr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(Os,"makeNodeId");var Di="$env";function ue(e){if(e.scope==="env")return`${Di}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(ue,"formatAddress");var Ci=/^[a-z][a-zA-Z0-9_]*$/,Xz=/^[A-Za-z_][A-Za-z0-9_]*$/;function vo(e){return typeof e=="string"&&e.split(".").every(n=>Xz.test(n))}s(vo,"isPath");function Qr(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&vo(i)?{scope:"env",key:i}:null}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Ci.test(o)||(t==="node"?!hr.test(i):!Ci.test(i))?null:eW({scope:t,owner:i,key:o},a)}default:return null}}s(Qr,"tryParseAddress");function eW(e,n){if(n.length===0)return e;let t=n.join(".");return vo(t)?{...e,path:t}:null}s(eW,"withPath");function be(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!vo(n.path))return!1;switch(n.scope){case"env":return vo(n.key);case"node":return typeof n.owner=="string"&&hr.test(n.owner)&&typeof n.key=="string"&&Ci.test(n.key);case"task":return typeof n.owner=="string"&&Ci.test(n.owner)&&typeof n.key=="string"&&Ci.test(n.key);default:return!1}}s(be,"isAddress");var Zr={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},_s=Object.keys(Zr);function Ns(e){return Object.hasOwn(Zr,e)}s(Ns,"isEnvKey");var nW=["self-service","staff"];function SI(e,n){return{kind:"fixed",values:e,labels:n}}s(SI,"fixedSet");var vf={of:"applicant.language",withoutValue:"de"},Xr={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:vf},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:vf},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:vf},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:vf},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:SI(We,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:SI(nW,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},xf={types:Zr,fields:Xr},Sf=_s.flatMap(e=>Object.keys(Zr[e]).map(n=>`${e}.${n}`));function Ht(e){return Object.hasOwn(Xr,e)}s(Ht,"isEnvLeaf");function Af(e){return`${Di}.${e}`}s(Af,"envIdentifier");function xo(e){let n=Xr[e],[t,r]=e.split("."),i=Zr[t][r];i===void 0&&L(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&L(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(xo,"envLeaf");var AI="staffInput";var tW=["boolean"],Tl=/^[a-z][A-Za-z0-9]*$/;function Ef(e){return e.staffInputs??[]}s(Ef,"staffInputsOf");function Tf(e){return`${AI}.${e}`}s(Tf,"staffInputLeaf");function EI(e){return`${Di}.${Tf(e)}`}s(EI,"staffInputIdentifier");function rW(e){let n=`${AI}.`;return e.startsWith(n)?e.slice(n.length):null}s(rW,"staffInputKeyOfLeaf");function Ps(e,n){let t=rW(n);return t===null?void 0:Ef(e).find(r=>r.key===t)}s(Ps,"declaredStaffInput");function TI(e){return[...Ef(e).map(n=>({leaf:Tf(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Sf.map(n=>{let t=xo(n);return{leaf:n,type:t.type,label:t.label,valueSet:Xr[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(TI,"envLeavesFor");function $I(e){return TI(e).filter(n=>!n.cohortBound)}s($I,"conditionEnvLeaves");function RI(e){return OI($I(e))}s(RI,"envConditionSchemaFor");function iW(e){return TI(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(iW,"offerConditionEnvLeaves");function II(e){return OI(iW(e))}s(II,"offerConditionSchemaFor");function OI(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(OI,"schemaOfLeaves");function _I(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Tl.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),tW.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Rn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(_I,"staffInputIssues");var $y={required:!0,description:"Offer slug (its offerKey)"},wy=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",$y);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(x.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=dI(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},ky=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",$y);async execute(){let n=await this.caller(),t=await n.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},by=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},vy=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(uI(t),()=>fI(t),["address","state","holds","producer","written"]),0}},xy=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",$y);run=f.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=f.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();cI(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=lI(await n.query(x.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await n.query(x.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(x.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:PI(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await n.query(x.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await bf(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},Sy=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=oW(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(x.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new Error(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(x.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function oW(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new Error(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(oW,"parseDays");var Ay=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=T.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},Ey=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},Ty=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=PI([this.input]);return await n.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},NI=[wy,ky,by,vy,xy,Sy,Ay,Ey,Ty];function PI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!Tl.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(PI,"parseStaffInputs");var Vn="contractGenerator",So="documentTemplate";function $l(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return(n.kind==="generator"||n.kind==="package")&&typeof n.key=="string"&&n.key.length>0&&(n.revision===void 0||typeof n.revision=="number"&&Number.isInteger(n.revision)&&n.revision>0)&&t.every(r=>r==="kind"||r==="key"||r==="revision")}s($l,"isGeneratorRef");function CI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(CI,"literalOf");function ei(e){let n=CI(e,Vn);return $l(n)?n:null}s(ei,"generatorRefOfNode");function gr(e){let n=CI(e,So);return typeof n=="string"&&n.length>0?n:null}s(gr,"documentTemplateKeyOfNode");function DI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(DI,"generatorRefLabel");var sW=["formExports","generatorStamp"];function FI(e,n,t){let r=e.inputs?.[Vn];(r?.kind!=="literal"||!$l(r.value))&&L(`applyGeneratorStamp: the node names no generator in inputs.${Vn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Vn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts},...n.coverLetter===void 0?{}:{coverLetter:n.coverLetter}}}s(FI,"applyGeneratorStamp");var aW=["reads"];function Cs(e){if(e===null||typeof e!="object")return e;let n={...e};return Array.isArray(n.nodes)&&(n.nodes=n.nodes.map(t=>{if(t===null||typeof t!="object")return t;let r={...t};for(let i of sW)delete r[i];for(let i of aW)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(Cs,"comparableWorkflowGraph");var Rl={id:{de:"die Identit\xE4t ist der Slug des Angebots (bundle.yaml slugs.manifest)",en:"the identity is the offer's slug (bundle.yaml slugs.manifest)"},label:{de:"der Titel steht in bundle.yaml `label`",en:"the title is bundle.yaml `label`"},version:{de:"die Revision z\xE4hlt die Datenbank",en:"the database counts the revision"},applicantMode:{de:"von nichts gelesen",en:"read by nothing"},signatureLevel:{de:"von nichts gelesen",en:"read by nothing"},roleInstances:{de:"die Rollen kommen aus den Formular-Effekten",en:"roles come from the form effects"},leistungen:{de:"von nichts gelesen",en:"read by nothing"},capacity:{de:"die Kapazit\xE4t geh\xF6rt der Kohorte (program.runs[].capacities)",en:"capacity belongs to the cohort (program.runs[].capacities)"},progressLayoutId:{de:"von nichts gelesen",en:"read by nothing"},bewerbungsfenster:{de:"die Kohorte besitzt die \xD6ffnung (isOpen / applicationOpensAt)",en:"the cohort owns opening (isOpen / applicationOpensAt)"},selection:{de:"die Reihenfolge ist der Eingang `waitlistOrder` des Wartelistenknotens (automatisches Nachr\xFCcken gibt es nicht mehr; Freigabe-Strategie und Stichtag las nichts)",en:"the order is the waitlist node's input `waitlistOrder` (automatic promotion is gone; release strategy and deadline were read by nothing)"},progressLayout:{de:"das Fortschrittslayout geh\xF6rt zum Workflow: den Block nach workflow.json `progressLayout` verschieben (ohne Workflow l\xF6schen)",en:"the progress layout belongs to the workflow: move the block to workflow.json `progressLayout` (without a workflow: delete it)"}};function $f(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=Rl[n];return t!==void 0?`manifest: \`${n}\` is no longer part of manifest.json (${t.en}). Delete the line.`:`manifest: unknown key \`${n}\` \u2014 manifest.json carries no key.`})}s($f,"manifestIssues");function lW(e){let n=[],t=e.buses;if(!Array.isArray(t))return n;let r=t.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return n;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";n.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return n}s(lW,"validateProgressLayoutExternalCopy");function LI(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let n=e.buses;return!Array.isArray(n)||!n.some(t=>!!t&&typeof t=="object"&&t.key==="process")?["progressLayout: the layout must declare the `process` bus"]:lW(e)}s(LI,"progressLayoutIssues");var MI=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var dW=new Set(["sections","effects","outcomes","testScenarios","env","views"]),Rf={id:{de:"der Schl\xFCssel des Formulars ist sein Slug",en:"the form's key is its slug"},label:{de:"der Name steht in der Formularzeile (createSmartForm.label)",en:"the name is the form row's (createSmartForm.label)"},outcomeIds:{de:"die Ergebnisse sind die ids von outcomes[]",en:"the outcomes are the ids of outcomes[]"},schoolSlug:{de:"von nichts gelesen",en:"read by nothing"}};function qI(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${n}: die Formulardefinition muss ein Objekt sein.`,en:`${n}: the form definition must be an object.`}];let t=[];for(let i of Object.keys(e)){if(dW.has(i))continue;let o=Rf[i];t.push(o!==void 0?{de:`${n}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${n}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${n}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${n}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||t.push({de:`${n}: \`${i}\` muss eine Liste sein.`,en:`${n}: \`${i}\` must be a list.`});return t}s(qI,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Fi(e){return typeof e=="string"&&bt.includes(e)}s(Fi,"isOutcomeSemantic");var Jt=["arrival","manual"],KI={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function cW(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(cW,"literal");function Ry(e){let n=cW(e,"waitlistOrder");return Jt.includes(n)?{waitlistOrder:n}:null}s(Ry,"waitlistPolicyOrNull");var gn="responsible",Iy="team:";function If(e){return`${Iy}${e}`}s(If,"teamSlot");function Of(e){return e.startsWith(Iy)?e.slice(Iy.length):null}s(Of,"teamKeyOfSlot");function jI(e){return e.kind==="responsible"?gn:If(e.groupKey)}s(jI,"slotIdOf");function _f(e){if(e===gn)return{kind:"responsible"};let n=Of(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(_f,"slotOfId");var Oy="review",_y="checkField",VI="reviewed",BI="reviewing",Nf=["rejected","waitlisted"];function Ny(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ny,"isObject");var uW=new Set(["decision",Oy]),UI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Py(e){return Object.hasOwn(UI,e)?UI[e]:void 0}s(Py,"legacySemanticOfId");function fW(e){return e===Oy?bt.filter(n=>!Nf.includes(n)):bt}s(fW,"allowedSemanticsFor");var pW="other";function GI(e){return Ny(e)&&uW.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(GI,"outcomesOf");function zI(e){return(e?.nodes??[]).some(n=>GI(n).some(t=>Ny(t)&&!("semantic"in t)))}s(zI,"needsOutcomeSemantics");function WI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=GI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=fW(u),h=!1,y=l.map(k=>{if(!Ny(k))return k;let w=String(k.id);if("semantic"in k)return Fi(k.semantic)||i.push({nodeId:c,outcomeId:w,value:String(k.semantic)}),k;let v=`${c}.${w}`,A=Object.hasOwn(n,v)?n[v]:void 0;if(A!==void 0)return p.includes(A)?(t.push({nodeId:c,outcomeId:w,semantic:A,source:"answer"}),h=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p,answer:A}),k);let E=Py(w),R=E??pW;return p.includes(R)?(t.push({nodeId:c,outcomeId:w,semantic:R,source:E===void 0?"formerDefault":"legacyTable"}),h=!0,{...k,semantic:R}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p}),k)});return h?{...d,outcomes:y}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(WI,"addOutcomeSemantics");var yr="bewerbungOffen";function Ao(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ao,"isObject");var Cy=["event","effect"];function YI(e){return Ao(e)&&e.type==="eventTrigger"}s(YI,"isTrigger");function HI(e){let n=Ao(e.inputs)?e.inputs:{};return"outcomes"in e||Cy.some(t=>t in e||t in n)}s(HI,"oldShape");function JI(e){return(e?.nodes??[]).some(n=>YI(n)&&HI(n))}s(JI,"needsEventTriggerStartMove");function mW(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>Ao(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===yr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(Ao(e.next)?e.next:{});if(!(i.length===1&&i[0]===yr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=Ao(e.inputs)?{...e.inputs}:{};for(let l of Cy){let d=o[l];if(Ao(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Cy)delete a[l],delete o[l];return Ao(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(mW,"moveNode");function QI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!YI(i)||!HI(i))return i;let o=mW(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(QI,"moveEventTriggerStart");function Il(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Il,"isObject");var ZI={waitlistOrder:"arrival"};function XI(e){return!Il(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(Il(e.inputs)?e.inputs:{}))}s(XI,"lacksPolicy");function hW(e){return(e?.nodes??[]).some(XI)}s(hW,"needsWaitlistPolicyMove");function Dy(e){return Il(e)&&Jt.includes(e.waitlistOrder)}s(Dy,"isWaitlistPolicy");function gW(e){if(e===void 0)return{policy:ZI,stated:!1};if(!Il(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Jt.includes(n)?"malformed":{policy:{waitlistOrder:n??ZI.waitlistOrder},stated:n!==void 0}}s(gW,"policyOfSelection");function eO(e,n,t={}){let r=[],i=[];if(!hW(e))return{graph:e,moved:r,refused:i};let o=gW(n),a=e.nodes.map(l=>{if(!XI(l))return l;let d=l,c=String(d.id),u=Il(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,y;if(p!==void 0)h=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(eO,"moveWaitlistPolicyToInputs");function Eo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Eo,"isObject");var yW=[Vn,So],wW=["inputSchema","parties","schemaDigest","parts"];function nO(e){return Eo(e)&&e.type==="governedDocument"&&("resolver"in e||Eo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(nO,"oldShape");function tO(e){return(e?.nodes??[]).some(nO)}s(tO,"needsGeneratorInputMove");function kW(e){let n=Eo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!Eo(i))return{unmoved:"resolverNotObject"};if(Vn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((Eo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>Eo(d)&&yW.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Vn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(wW.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(t.generatorStamp=l),r=i.cockpitFields,delete t.resolver}if(Eo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(So in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[So]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}t.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};t.cockpitFields=r}return t.inputs=n,{node:t}}s(kW,"moveNode");function rO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!nO(i))return i;let o=kW(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(rO,"moveGeneratorPinsToInputs");var iO=/^\d{4}-\d{2}-\d{2}$/;function wr(e,n){return{de:e,en:n}}s(wr,"issue");function To(e){if(typeof e!="object"||e===null)return wr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:wr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return wr(`unbekannte Art ${JSON.stringify(n.kind)}`,`unknown kind ${JSON.stringify(n.kind)}`);let{amount:t,activeFrom:r,activeTo:i}=n;return typeof t!="number"||!Number.isFinite(t)||t<=0?wr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((t*100).toFixed(6)))?typeof r!="string"||!iO.test(r)?wr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!iO.test(i)?wr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?wr("das Ende liegt vor dem Beginn","the end is before the start"):n.floorTotal!==void 0&&(typeof n.floorTotal!="number"||!Number.isSafeInteger(n.floorTotal)||n.floorTotal<0)?wr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):n.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(n.pricePeriod))?wr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?wr("unbekannte Angaben","unknown details"):null:wr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(To,"reductionShapeIssue");function Li(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||To(n.reduction)===null&&n.reduction.kind==="amount")}s(Li,"isPricedItemValue");var Ds=["freetext","recommendation","choice","pricedItem","record","reduction"],Fs=[...Ds,"appointment"];function sO(e){return typeof e=="string"&&Fs.includes(e)}s(sO,"isTaskResultKind");function Mi(e){return typeof e=="string"&&Ds.includes(e)}s(Mi,"isRecordedTaskResultKind");function Ls(e){return Mi(e.kind)}s(Ls,"isRecordedTaskResult");var Pf=["number","boolean","enum","text","person","assignment"];function Fy(e){return typeof e=="string"&&Pf.includes(e)}s(Fy,"isRecordFieldType");function aO(e){return e==="number"||e==="boolean"||e==="enum"}s(aO,"isSuggestibleFieldType");var Ly=["form","siblingRank"],Cf=500;function bW(e){switch(e.type){case"number":case"boolean":case"enum":return e.type;case"text":return"string";case"person":return e.multiple===!0?"staffUserList":"staffUser";case"assignment":return"taskAssignment"}}s(bW,"recordFieldValueType");var ni={freetext:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Freitext",en:"Free text"}},recommendation:{choiceValueType:"enum",valueType:null,textValueType:"string",label:{de:"Empfehlung",en:"Recommendation"}},choice:{choiceValueType:"enum",valueType:"enum",textValueType:"string",label:{de:"Auswahl",en:"Choice"}},pricedItem:{choiceValueType:"enum",valueType:"pricedItem",textValueType:"string",label:{de:"Preisposition",en:"Priced item"}},reduction:{choiceValueType:null,valueType:"reduction",textValueType:"string",label:{de:"Reduktion",en:"Reduction"}},record:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Erfassung",en:"Record"}},appointment:{choiceValueType:null,valueType:null,textValueType:null,label:{de:"Termin",en:"Appointment"}}};function lO(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(lO,"isProseResult");function Df(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&Fy(n.type)).map(n=>({key:n.writes,valueType:bW(n),field:n})):vW(e)}s(Df,"draftResultStoreWrites");function vW(e){let n=ni[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(vW,"singleStoreWrite");var oO="team:";function Ms(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(oO)){let n=e.slice(oO.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ms,"parseTaskResultChat");var Ue={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",recordText:"[taskResult/recordText]",recordPerson:"[taskResult/recordPerson]",recordAssignment:"[taskResult/recordAssignment]",reductionPrices:"[taskResult/reductionPrices]"};var xW=new Set(["if","else","in","true","false","null"]),SW=new Set(["==","!=","<=",">=","&&","||"]);function AW(e){return e>="0"&&e<="9"}s(AW,"isDigit");function EW(e){return/[a-zA-Z_$]/.test(e)}s(EW,"isIdentStart");function TW(e){return/[a-zA-Z0-9_.$]/.test(e)}s(TW,"isIdentCont");function $W(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
10999
+ `};var gf="05c2e0da139625d4b08ca3795381cb7caf13d5f4502acd9482f8001b2035797e",uy=oI;var fy=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:gf,tools:Al}),0}},py=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await cy(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},sI=[fy,py];var my=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],wde=new Set(my.map(e=>e.key));function lI(e,n,t,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===n);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${n}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${n} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===t||l.runId===t);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${t}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(lI,"resolveStartTarget");function Yz(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(Yz,"applicantText");function dI(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:Yz(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(dI,"applicationRows");var aI=my.map(e=>e.email);function cI(e,n,t,r){if(t===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(ay(e,n)&&(r===void 0||!aI.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${aI.join(", ")} (--applicant) \u2014 never a real family's`)}s(cI,"assertStartApplicant");function uI(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(uI,"processStoreJson");function Hz(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(Hz,"refText");function Jz(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?Hz(e.ref):JSON.stringify(e.value)}s(Jz,"holds");function fI(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:Jz(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(fI,"storeRows");function yf(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(yf,"parseKv");var pI="started",wf="submitted",kf="submitted",mI="load-scenario:";var hI="(Bewerbung)";function gI(e){return{nodeId:hI,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(gI,"sharedAsList");function yI(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(yI,"disabledText");function wI(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:yI(r)})))}s(wI,"actionRows");function kI(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${n}" on ${i} is disabled: ${yI(a)}`);if(i!==hI)return i;let l=t[0];if(l===void 0)throw new Error(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(kI,"nodeOfferingAction");function bI(e,n,t){if(e.startsWith(mI)){if(Object.hasOwn(t,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(bI,"runParams");async function Qz(e,n){let t=await e.query(x.workflow.getInstance,{applicationId:n});if(t===null)throw new Error(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(Qz,"currentNodeIds");function Zz(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(Zz,"refusalText");async function bf(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${Zz(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(x.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,gI(r.actions)]}s(bf,"actionsOf");async function vI(e,n,t){return t!==void 0?[t]:await Qz(e,n)}s(vI,"nodesOf");var hy=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await bf(n,this.application,await vI(n,this.application,this.node));return this.print(t,wI,["node","action","label","disabled"]),0}},gy=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=bI(this.action,this.autoSubmit,yf(this.param??[]).values),t=await this.caller(),r=this.application,i=await vI(t,this.application,this.node),o=kI(await bf(t,r,i),this.action,i);return await t.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},xI=[hy,gy];var We=["de","en"];function Is(e,n){return We.every(t=>e[t]===n[t])}s(Is,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!We.includes(r))?"not-localized":We.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function Pi(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s(Pi,"isLocalizedText");function El(e,n){let t={};for(let r of We){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(El,"composeTexts");var hr=/^[a-z][A-Za-z0-9]*$/;function yy(e){return typeof e=="string"&&hr.test(e)}s(yy,"isNodeId");function Os(e,n){yy(e)||L(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${hr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(Os,"makeNodeId");var Di="$env";function ue(e){if(e.scope==="env")return`${Di}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(ue,"formatAddress");var Ci=/^[a-z][a-zA-Z0-9_]*$/,Xz=/^[A-Za-z_][A-Za-z0-9_]*$/;function vo(e){return typeof e=="string"&&e.split(".").every(n=>Xz.test(n))}s(vo,"isPath");function Qr(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&vo(i)?{scope:"env",key:i}:null}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Ci.test(o)||(t==="node"?!hr.test(i):!Ci.test(i))?null:eW({scope:t,owner:i,key:o},a)}default:return null}}s(Qr,"tryParseAddress");function eW(e,n){if(n.length===0)return e;let t=n.join(".");return vo(t)?{...e,path:t}:null}s(eW,"withPath");function be(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!vo(n.path))return!1;switch(n.scope){case"env":return vo(n.key);case"node":return typeof n.owner=="string"&&hr.test(n.owner)&&typeof n.key=="string"&&Ci.test(n.key);case"task":return typeof n.owner=="string"&&Ci.test(n.owner)&&typeof n.key=="string"&&Ci.test(n.key);default:return!1}}s(be,"isAddress");var Zr={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},_s=Object.keys(Zr);function Ns(e){return Object.hasOwn(Zr,e)}s(Ns,"isEnvKey");var nW=["self-service","staff"];function SI(e,n){return{kind:"fixed",values:e,labels:n}}s(SI,"fixedSet");var vf={of:"applicant.language",withoutValue:"de"},Xr={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:vf},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:vf},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:vf},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:vf},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:SI(We,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:SI(nW,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},xf={types:Zr,fields:Xr},Sf=_s.flatMap(e=>Object.keys(Zr[e]).map(n=>`${e}.${n}`));function Ht(e){return Object.hasOwn(Xr,e)}s(Ht,"isEnvLeaf");function Af(e){return`${Di}.${e}`}s(Af,"envIdentifier");function xo(e){let n=Xr[e],[t,r]=e.split("."),i=Zr[t][r];i===void 0&&L(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&L(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(xo,"envLeaf");var AI="staffInput";var tW=["boolean"],Tl=/^[a-z][A-Za-z0-9]*$/;function Ef(e){return e.staffInputs??[]}s(Ef,"staffInputsOf");function Tf(e){return`${AI}.${e}`}s(Tf,"staffInputLeaf");function EI(e){return`${Di}.${Tf(e)}`}s(EI,"staffInputIdentifier");function rW(e){let n=`${AI}.`;return e.startsWith(n)?e.slice(n.length):null}s(rW,"staffInputKeyOfLeaf");function Ps(e,n){let t=rW(n);return t===null?void 0:Ef(e).find(r=>r.key===t)}s(Ps,"declaredStaffInput");function TI(e){return[...Ef(e).map(n=>({leaf:Tf(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Sf.map(n=>{let t=xo(n);return{leaf:n,type:t.type,label:t.label,valueSet:Xr[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(TI,"envLeavesFor");function $I(e){return TI(e).filter(n=>!n.cohortBound)}s($I,"conditionEnvLeaves");function RI(e){return OI($I(e))}s(RI,"envConditionSchemaFor");function iW(e){return TI(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(iW,"offerConditionEnvLeaves");function II(e){return OI(iW(e))}s(II,"offerConditionSchemaFor");function OI(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(OI,"schemaOfLeaves");function _I(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Tl.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),tW.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Rn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(_I,"staffInputIssues");var $y={required:!0,description:"Offer slug (its offerKey)"},wy=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",$y);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(x.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=dI(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},ky=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",$y);async execute(){let n=await this.caller(),t=await n.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},by=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},vy=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(uI(t),()=>fI(t),["address","state","holds","producer","written"]),0}},xy=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",$y);run=f.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=f.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();cI(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=lI(await n.query(x.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await n.query(x.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(x.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:PI(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await n.query(x.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await bf(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},Sy=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=oW(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(x.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new Error(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(x.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function oW(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new Error(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(oW,"parseDays");var Ay=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=T.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},Ey=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},Ty=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=PI([this.input]);return await n.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},NI=[wy,ky,by,vy,xy,Sy,Ay,Ey,Ty];function PI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!Tl.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(PI,"parseStaffInputs");var Vn="contractGenerator",So="documentTemplate";function $l(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return(n.kind==="generator"||n.kind==="package")&&typeof n.key=="string"&&n.key.length>0&&(n.revision===void 0||typeof n.revision=="number"&&Number.isInteger(n.revision)&&n.revision>0)&&t.every(r=>r==="kind"||r==="key"||r==="revision")}s($l,"isGeneratorRef");function CI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(CI,"literalOf");function ei(e){let n=CI(e,Vn);return $l(n)?n:null}s(ei,"generatorRefOfNode");function gr(e){let n=CI(e,So);return typeof n=="string"&&n.length>0?n:null}s(gr,"documentTemplateKeyOfNode");function DI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(DI,"generatorRefLabel");var sW=["formExports","generatorStamp"];function FI(e,n,t){let r=e.inputs?.[Vn];(r?.kind!=="literal"||!$l(r.value))&&L(`applyGeneratorStamp: the node names no generator in inputs.${Vn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Vn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts},...n.coverLetter===void 0?{}:{coverLetter:n.coverLetter}}}s(FI,"applyGeneratorStamp");var aW=["reads"];function Cs(e){if(e===null||typeof e!="object")return e;let n={...e};return Array.isArray(n.nodes)&&(n.nodes=n.nodes.map(t=>{if(t===null||typeof t!="object")return t;let r={...t};for(let i of sW)delete r[i];for(let i of aW)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(Cs,"comparableWorkflowGraph");var Rl={id:{de:"die Identit\xE4t ist der Slug des Angebots (bundle.yaml slugs.manifest)",en:"the identity is the offer's slug (bundle.yaml slugs.manifest)"},label:{de:"der Titel steht in bundle.yaml `label`",en:"the title is bundle.yaml `label`"},version:{de:"die Revision z\xE4hlt die Datenbank",en:"the database counts the revision"},applicantMode:{de:"von nichts gelesen",en:"read by nothing"},signatureLevel:{de:"von nichts gelesen",en:"read by nothing"},roleInstances:{de:"die Rollen kommen aus den Formular-Effekten",en:"roles come from the form effects"},leistungen:{de:"von nichts gelesen",en:"read by nothing"},capacity:{de:"die Kapazit\xE4t geh\xF6rt der Kohorte (program.runs[].capacities)",en:"capacity belongs to the cohort (program.runs[].capacities)"},progressLayoutId:{de:"von nichts gelesen",en:"read by nothing"},bewerbungsfenster:{de:"die Kohorte besitzt die \xD6ffnung (isOpen / applicationOpensAt)",en:"the cohort owns opening (isOpen / applicationOpensAt)"},selection:{de:"die Reihenfolge ist der Eingang `waitlistOrder` des Wartelistenknotens (automatisches Nachr\xFCcken gibt es nicht mehr; Freigabe-Strategie und Stichtag las nichts)",en:"the order is the waitlist node's input `waitlistOrder` (automatic promotion is gone; release strategy and deadline were read by nothing)"},progressLayout:{de:"das Fortschrittslayout geh\xF6rt zum Workflow: den Block nach workflow.json `progressLayout` verschieben (ohne Workflow l\xF6schen)",en:"the progress layout belongs to the workflow: move the block to workflow.json `progressLayout` (without a workflow: delete it)"}};function $f(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=Rl[n];return t!==void 0?`manifest: \`${n}\` is no longer part of manifest.json (${t.en}). Delete the line.`:`manifest: unknown key \`${n}\` \u2014 manifest.json carries no key.`})}s($f,"manifestIssues");function lW(e){let n=[],t=e.buses;if(!Array.isArray(t))return n;let r=t.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return n;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";n.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return n}s(lW,"validateProgressLayoutExternalCopy");function LI(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let n=e.buses;return!Array.isArray(n)||!n.some(t=>!!t&&typeof t=="object"&&t.key==="process")?["progressLayout: the layout must declare the `process` bus"]:lW(e)}s(LI,"progressLayoutIssues");var MI=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var dW=new Set(["sections","effects","outcomes","testScenarios","env","views"]),Rf={id:{de:"der Schl\xFCssel des Formulars ist sein Slug",en:"the form's key is its slug"},label:{de:"der Name steht in der Formularzeile (createSmartForm.label)",en:"the name is the form row's (createSmartForm.label)"},outcomeIds:{de:"die Ergebnisse sind die ids von outcomes[]",en:"the outcomes are the ids of outcomes[]"},schoolSlug:{de:"von nichts gelesen",en:"read by nothing"}};function qI(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${n}: die Formulardefinition muss ein Objekt sein.`,en:`${n}: the form definition must be an object.`}];let t=[];for(let i of Object.keys(e)){if(dW.has(i))continue;let o=Rf[i];t.push(o!==void 0?{de:`${n}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${n}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${n}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${n}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||t.push({de:`${n}: \`${i}\` muss eine Liste sein.`,en:`${n}: \`${i}\` must be a list.`});return t}s(qI,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Fi(e){return typeof e=="string"&&bt.includes(e)}s(Fi,"isOutcomeSemantic");var Jt=["arrival","manual"],KI={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function cW(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(cW,"literal");function Ry(e){let n=cW(e,"waitlistOrder");return Jt.includes(n)?{waitlistOrder:n}:null}s(Ry,"waitlistPolicyOrNull");var gn="responsible",Iy="team:";function If(e){return`${Iy}${e}`}s(If,"teamSlot");function Of(e){return e.startsWith(Iy)?e.slice(Iy.length):null}s(Of,"teamKeyOfSlot");function jI(e){return e.kind==="responsible"?gn:If(e.groupKey)}s(jI,"slotIdOf");function _f(e){if(e===gn)return{kind:"responsible"};let n=Of(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(_f,"slotOfId");var Oy="review",_y="checkField",VI="reviewed",BI="reviewing",Nf=["rejected","waitlisted"];function Ny(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ny,"isObject");var uW=new Set(["decision",Oy]),UI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Py(e){return Object.hasOwn(UI,e)?UI[e]:void 0}s(Py,"legacySemanticOfId");function fW(e){return e===Oy?bt.filter(n=>!Nf.includes(n)):bt}s(fW,"allowedSemanticsFor");var pW="other";function GI(e){return Ny(e)&&uW.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(GI,"outcomesOf");function zI(e){return(e?.nodes??[]).some(n=>GI(n).some(t=>Ny(t)&&!("semantic"in t)))}s(zI,"needsOutcomeSemantics");function WI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=GI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=fW(u),h=!1,y=l.map(k=>{if(!Ny(k))return k;let w=String(k.id);if("semantic"in k)return Fi(k.semantic)||i.push({nodeId:c,outcomeId:w,value:String(k.semantic)}),k;let v=`${c}.${w}`,A=Object.hasOwn(n,v)?n[v]:void 0;if(A!==void 0)return p.includes(A)?(t.push({nodeId:c,outcomeId:w,semantic:A,source:"answer"}),h=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p,answer:A}),k);let E=Py(w),R=E??pW;return p.includes(R)?(t.push({nodeId:c,outcomeId:w,semantic:R,source:E===void 0?"formerDefault":"legacyTable"}),h=!0,{...k,semantic:R}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p}),k)});return h?{...d,outcomes:y}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(WI,"addOutcomeSemantics");var yr="bewerbungOffen";function Ao(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ao,"isObject");var Cy=["event","effect"];function YI(e){return Ao(e)&&e.type==="eventTrigger"}s(YI,"isTrigger");function HI(e){let n=Ao(e.inputs)?e.inputs:{};return"outcomes"in e||Cy.some(t=>t in e||t in n)}s(HI,"oldShape");function JI(e){return(e?.nodes??[]).some(n=>YI(n)&&HI(n))}s(JI,"needsEventTriggerStartMove");function mW(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>Ao(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===yr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(Ao(e.next)?e.next:{});if(!(i.length===1&&i[0]===yr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=Ao(e.inputs)?{...e.inputs}:{};for(let l of Cy){let d=o[l];if(Ao(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Cy)delete a[l],delete o[l];return Ao(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(mW,"moveNode");function QI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!YI(i)||!HI(i))return i;let o=mW(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(QI,"moveEventTriggerStart");function Il(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Il,"isObject");var ZI={waitlistOrder:"arrival"};function XI(e){return!Il(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(Il(e.inputs)?e.inputs:{}))}s(XI,"lacksPolicy");function hW(e){return(e?.nodes??[]).some(XI)}s(hW,"needsWaitlistPolicyMove");function Dy(e){return Il(e)&&Jt.includes(e.waitlistOrder)}s(Dy,"isWaitlistPolicy");function gW(e){if(e===void 0)return{policy:ZI,stated:!1};if(!Il(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Jt.includes(n)?"malformed":{policy:{waitlistOrder:n??ZI.waitlistOrder},stated:n!==void 0}}s(gW,"policyOfSelection");function eO(e,n,t={}){let r=[],i=[];if(!hW(e))return{graph:e,moved:r,refused:i};let o=gW(n),a=e.nodes.map(l=>{if(!XI(l))return l;let d=l,c=String(d.id),u=Il(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,y;if(p!==void 0)h=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(eO,"moveWaitlistPolicyToInputs");function Eo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Eo,"isObject");var yW=[Vn,So],wW=["inputSchema","parties","schemaDigest","parts"];function nO(e){return Eo(e)&&e.type==="governedDocument"&&("resolver"in e||Eo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(nO,"oldShape");function tO(e){return(e?.nodes??[]).some(nO)}s(tO,"needsGeneratorInputMove");function kW(e){let n=Eo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!Eo(i))return{unmoved:"resolverNotObject"};if(Vn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((Eo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>Eo(d)&&yW.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Vn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(wW.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(t.generatorStamp=l),r=i.cockpitFields,delete t.resolver}if(Eo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(So in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[So]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}t.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};t.cockpitFields=r}return t.inputs=n,{node:t}}s(kW,"moveNode");function rO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!nO(i))return i;let o=kW(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(rO,"moveGeneratorPinsToInputs");var iO=/^\d{4}-\d{2}-\d{2}$/;function wr(e,n){return{de:e,en:n}}s(wr,"issue");function To(e){if(typeof e!="object"||e===null)return wr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:wr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return wr(`unbekannte Art ${JSON.stringify(n.kind)}`,`unknown kind ${JSON.stringify(n.kind)}`);let{amount:t,activeFrom:r,activeTo:i}=n;return typeof t!="number"||!Number.isFinite(t)||t<=0?wr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((t*100).toFixed(6)))?typeof r!="string"||!iO.test(r)?wr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!iO.test(i)?wr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?wr("das Ende liegt vor dem Beginn","the end is before the start"):n.floorTotal!==void 0&&(typeof n.floorTotal!="number"||!Number.isSafeInteger(n.floorTotal)||n.floorTotal<0)?wr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):n.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(n.pricePeriod))?wr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?wr("unbekannte Angaben","unknown details"):null:wr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(To,"reductionShapeIssue");function Li(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||To(n.reduction)===null&&n.reduction.kind==="amount")}s(Li,"isPricedItemValue");var Ds=["freetext","recommendation","choice","pricedItem","record","reduction"],Fs=[...Ds,"appointment"];function sO(e){return typeof e=="string"&&Fs.includes(e)}s(sO,"isTaskResultKind");function Mi(e){return typeof e=="string"&&Ds.includes(e)}s(Mi,"isRecordedTaskResultKind");function Ls(e){return Mi(e.kind)}s(Ls,"isRecordedTaskResult");var Pf=["number","boolean","enum","text","person","assignment"];function Fy(e){return typeof e=="string"&&Pf.includes(e)}s(Fy,"isRecordFieldType");function aO(e){return e==="number"||e==="boolean"||e==="enum"}s(aO,"isSuggestibleFieldType");var Ly=["form","siblingRank"],Cf=500;function bW(e){switch(e.type){case"number":case"boolean":case"enum":return e.type;case"text":return"string";case"person":return e.multiple===!0?"staffUserList":"staffUser";case"assignment":return"taskAssignment"}}s(bW,"recordFieldValueType");var ni={freetext:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Freitext",en:"Free text"}},recommendation:{choiceValueType:"enum",valueType:null,textValueType:"string",label:{de:"Empfehlung",en:"Recommendation"}},choice:{choiceValueType:"enum",valueType:"enum",textValueType:"string",label:{de:"Auswahl",en:"Choice"}},pricedItem:{choiceValueType:"enum",valueType:"pricedItem",textValueType:"string",label:{de:"Preisposition",en:"Priced item"}},reduction:{choiceValueType:null,valueType:"reduction",textValueType:"string",label:{de:"Reduktion",en:"Reduction"}},record:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Erfassung",en:"Record"}},appointment:{choiceValueType:null,valueType:null,textValueType:null,label:{de:"Termin",en:"Appointment"}}};function lO(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(lO,"isProseResult");function Df(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&Fy(n.type)).map(n=>({key:n.writes,valueType:bW(n),field:n})):vW(e)}s(Df,"draftResultStoreWrites");function vW(e){let n=ni[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(vW,"singleStoreWrite");var oO="team:";function Ms(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(oO)){let n=e.slice(oO.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ms,"parseTaskResultChat");var Ue={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",recordText:"[taskResult/recordText]",recordPerson:"[taskResult/recordPerson]",recordAssignment:"[taskResult/recordAssignment]",reductionPrices:"[taskResult/reductionPrices]"};var xW=new Set(["if","else","in","true","false","null"]),SW=new Set(["==","!=","<=",">=","&&","||"]);function AW(e){return e>="0"&&e<="9"}s(AW,"isDigit");function EW(e){return/[a-zA-Z_$]/.test(e)}s(EW,"isIdentStart");function TW(e){return/[a-zA-Z0-9_.$]/.test(e)}s(TW,"isIdentCont");function $W(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
10997
11000
  `||r==="\r"){t++;continue}if(r==="'"){let o=t+1,a="";for(;o<e.length&&e.charAt(o)!=="'";)e.charAt(o)==="\\"&&o+1<e.length?(a+=e.charAt(o+1),o+=2):(a+=e.charAt(o),o++);o>=e.length&&L(`Unterminated string at ${t}`),n.push({t:"str",v:a}),t=o+1;continue}if(AW(r)){let o=t;for(;o<e.length&&/[0-9.]/.test(e.charAt(o));)o++;n.push({t:"num",v:Number(e.slice(t,o))}),t=o;continue}if(EW(r)){let o=t;for(;o<e.length&&TW(e.charAt(o));)o++;let a=e.slice(t,o);xW.has(a)?n.push({t:"kw",v:a}):n.push({t:"ident",v:a}),t=o;continue}let i=e.slice(t,t+2);if(SW.has(i)){n.push({t:"op",v:i}),t+=2;continue}if("<>!".includes(r)){n.push({t:"op",v:r}),t++;continue}if("()[],".includes(r)){n.push({t:"punct",v:r}),t++;continue}L(`Unexpected char '${r}' at ${t}`)}return n}s($W,"tokenise");var dO=1e4,cO=128;function qs(e){e.depth++,e.depth>cO&&L(`Expression nesting too deep (> ${cO})`)}s(qs,"enterDepth");function gO(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(gO,"peek");function Bn(e){let n=e.tokens[e.pos];return n||L(`Unexpected end at ${e.pos}`),e.pos++,n}s(Bn,"take");function Un(e,n,t){let r=gO(e);return!(!r||r.t!==n||t!==void 0&&r.v!==t)}s(Un,"match");function $o(e,n,t){return Un(e,n,t)||L(`Expected ${n}${t?`:${t}`:""} at ${e.pos}`),Bn(e)}s($o,"expect");function ri(e){qs(e);try{return Un(e,"kw","if")?RW(e):IW(e)}finally{e.depth--}}s(ri,"parseExpr");function RW(e){$o(e,"kw","if"),$o(e,"punct","(");let n=ri(e);$o(e,"punct",")");let t=ri(e);$o(e,"kw","else");let r=ri(e);return{kind:"if",cond:n,then:t,else:r}}s(RW,"parseIf");function IW(e){let n=uO(e),t=0;try{for(;Un(e,"op","||");){Bn(e),qs(e),t++;let r=uO(e);n={kind:"binary",op:"||",left:n,right:r}}}finally{e.depth-=t}return n}s(IW,"parseLogicOr");function uO(e){let n=fO(e),t=0;try{for(;Un(e,"op","&&");){Bn(e),qs(e),t++;let r=fO(e);n={kind:"binary",op:"&&",left:n,right:r}}}finally{e.depth-=t}return n}s(uO,"parseLogicAnd");function fO(e){let n=pO(e),t=0;try{for(;Un(e,"op","==")||Un(e,"op","!=");){let r=Bn(e).v;qs(e),t++;let i=pO(e);n={kind:"binary",op:r,left:n,right:i}}}finally{e.depth-=t}return n}s(fO,"parseEquality");function pO(e){let n=qy(e),t=0;try{for(;Un(e,"op","<")||Un(e,"op","<=")||Un(e,"op",">")||Un(e,"op",">=")||Un(e,"kw","in");){let r=Bn(e),i=r.t==="kw"?"in":r.v;qs(e),t++;let o=qy(e);n={kind:"binary",op:i,left:n,right:o}}}finally{e.depth-=t}return n}s(pO,"parseCompare");function qy(e){if(Un(e,"op","!")){Bn(e),qs(e);try{return{kind:"unary",op:"!",operand:qy(e)}}finally{e.depth--}}return OW(e)}s(qy,"parseUnary");function OW(e){let n=gO(e);if(n||L("Unexpected end"),n.t==="num")return Bn(e),{kind:"num",value:n.v};if(n.t==="str")return Bn(e),{kind:"str",value:n.v};if(n.t==="kw"&&n.v==="true")return Bn(e),{kind:"bool",value:!0};if(n.t==="kw"&&n.v==="false")return Bn(e),{kind:"bool",value:!1};if(n.t==="kw"&&n.v==="null")return Bn(e),{kind:"null"};if(n.t==="punct"&&n.v==="("){Bn(e);let t=ri(e);return $o(e,"punct",")"),t}if(n.t==="punct"&&n.v==="["){Bn(e);let t=[];if(!Un(e,"punct","]"))for(t.push(ri(e));Un(e,"punct",",");)Bn(e),t.push(ri(e));return $o(e,"punct","]"),{kind:"arr",items:t}}if(n.t==="ident"){let t=n.v;if(Bn(e),Un(e,"punct","(")){Bn(e);let r=[];if(!Un(e,"punct",")"))for(r.push(ri(e));Un(e,"punct",",");)Bn(e),r.push(ri(e));return $o(e,"punct",")"),{kind:"call",name:t,args:r}}return{kind:"ident",path:t}}L(`Unexpected token at ${e.pos}`)}s(OW,"parsePrimary");function In(e){e.length>dO&&L(`Expression too long (${e.length} > ${dO})`);let n={tokens:$W(e),pos:0,depth:0},t=ri(n);return n.pos<n.tokens.length&&L(`Unexpected trailing token at ${n.pos}`),t}s(In,"parseExpression");var _W=new Map([["today",()=>new Date().toISOString().slice(0,10)],["years_between",(e,n)=>{if(typeof e!="string"||typeof n!="string")return null;let t=new Date(e),r=new Date(n);if(isNaN(t.getTime())||isNaN(r.getTime()))return null;let i=r.getFullYear()-t.getFullYear(),o=r.getMonth()-t.getMonth();return(o<0||o===0&&r.getDate()<t.getDate())&&i--,i}],["length",e=>typeof e=="string"||Array.isArray(e)?e.length:0]]);function yn(e,n){switch(e.kind){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"null":return null;case"ident":{let t=Object.hasOwn(n.values,e.path)?n.values[e.path]:void 0;return t===void 0?null:t}case"arr":return e.items.map(t=>yn(t,n));case"unary":{let t=yn(e.operand,n);return!Ro(t)}case"call":{let t=n.functions!==void 0&&Object.hasOwn(n.functions,e.name)?n.functions[e.name]:_W.get(e.name);t||L(`Unknown function '${e.name}'`);let r=e.args.map(i=>yn(i,n));return t(...r)}case"binary":return NW(e.op,e.left,e.right,n);case"if":return Ro(yn(e.cond,n))?yn(e.then,n):yn(e.else,n)}}s(yn,"evaluate");function NW(e,n,t,r){if(e==="&&"){let a=yn(n,r);return Ro(a)?Ro(yn(t,r)):!1}if(e==="||"){let a=yn(n,r);return Ro(a)?!0:Ro(yn(t,r))}let i=yn(n,r),o=yn(t,r);switch(e){case"==":return My(i,o);case"!=":return!My(i,o);case"<":{let[a,l]=Ff(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=Ff(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=Ff(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=Ff(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>My(a,i)):!1}}s(NW,"evalBinary");function Ff(e,n){return[mO(e),mO(n)]}s(Ff,"orderedOperands");function mO(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"){if(e.trim()==="")return null;let n=Number(e);return Number.isFinite(n)?n:null}return null}s(mO,"numericOperand");function My(e,n){return e===n?!0:e==null||n==null?!1:typeof e=="number"&&typeof n=="string"?e===Number(n):typeof e=="string"&&typeof n=="number"?Number(e)===n:!1}s(My,"looseEq");function Ro(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(Ro,"truthy");function On(e){let n=new Set;return ti(e,n),[...n]}s(On,"dependencies");function ti(e,n){switch(e.kind){case"ident":n.add(e.path);return;case"call":e.args.forEach(t=>ti(t,n));return;case"arr":e.items.forEach(t=>ti(t,n));return;case"unary":ti(e.operand,n);return;case"binary":ti(e.left,n),ti(e.right,n);return;case"if":ti(e.cond,n),ti(e.then,n),ti(e.else,n);return;default:return}}s(ti,"walk");var hO=new Map;function ii(e){let n=hO.get(e);return n||(n=In(e),hO.set(e,n)),n}s(ii,"parseCached");function PW(e,n){return yn(ii(e),n)}s(PW,"evalExpression");function yO(e,n){return Ro(PW(e,n))}s(yO,"evalBoolean");function wO(e,n){n!==null&&(typeof n=="object"||typeof n=="function")&&Object.hasOwn(n,"exports")&&L(`[workflow/registry] node type "${e}": custom spec.exports is unsupported; use artifact-slot exports.`)}s(wO,"assertNoCustomNodeExports");var Ky=null;function kO(e){for(let[n,t]of Object.entries(e))wO(n,t);Ky=e}s(kO,"setSpecs");function bO(){return Ky||L("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),Ky}s(bO,"requireSpecs");function He(e){let n=bO(),t=n[e.type];return t===void 0&&se("INVALID",{de:`[workflow/registry] Unbekannter Knotentyp "${String(e.type)}" (Knoten "${String(e.id)}"). Registrierte Typen: ${Object.keys(n).sort().join(", ")}.`,en:`[workflow/registry] Unknown node type "${String(e.type)}" (node "${String(e.id)}"). Registered types: ${Object.keys(n).sort().join(", ")}.`}),t}s(He,"specFor");function vO(){return Object.keys(bO()).sort()}s(vO,"registeredNodeTypes");var xO=Sf.filter(e=>Xr[e].cohortBound!==!0);function jy(e){return Ht(e)&&Xr[e].cohortBound!==!0}s(jy,"isEnvAddressLeaf");function Vy(e){return xo(e).type}s(Vy,"envType");function By(e){return xo(e).label}s(By,"envLabel");function Uy(e){if(e.scope==="env"||e.path===void 0)return e;switch(e.scope){case"node":return{scope:"node",owner:e.owner,key:e.key};case"task":return{scope:"task",owner:e.owner,key:e.key}}}s(Uy,"addressBase");function kr(e){return e.scope==="node"&&e.key===nt&&e.path===void 0}s(kr,"isInstanceAddress");function un(e){return be(e)&&e.scope==="node"&&e.key===nt&&e.path!==void 0}s(un,"isFormFieldAddress");function SO(e){return un(e)?{owner:e.owner,path:e.path}:null}s(SO,"formFieldOf");function CW(e){return On(ii(e)).map(n=>{if(!n.startsWith("$"))return{identifier:n,address:null,reason:"bareIdentifier"};let t=Qr(n);return t===null?{identifier:n,address:null,reason:"shape"}:{identifier:n,address:t}})}s(CW,"expressionAddresses");var nt="admission",Gy="document",Mf="contract",qf="contracts",AO="payment",zy=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var dt={id:"identity",type:"identity",label:"display",sublabel:"display",library:"display",outcomes:"control",outputLabels:"display",inputs:"input",next:"control",tasks:"config",assign:"reference",actionTeams:"reference",optionalActions:"config",artifacts:"config",notifications:"config"},$ue={join:{...dt},end:{...dt},eventTrigger:{...dt},form:{...dt,adoptForm:"address",formExports:"stamp"},roleAssign:{...dt},setFlag:{...dt},if:{...dt,condition:"address"},countersign:{...dt,contract:"address",titles:"display",signing:"config"},engagePush:{...dt,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...dt,commentRequired:"config",decisionAsTask:"config",reads:"address",view:"config",requiresOneOf:"config"},review:{...dt,form:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...dt},completenessCheck:{...dt,requires:"address",deadline:"config"},collectPayment:{...dt},governedDocument:{...dt,production:"config",form:"address",generatorStamp:"stamp",templateStamp:"stamp",approval:"config",confirmBeforeIssue:"config",confirmContractTerms:"config",contractTermsQuestionText:"display",responseStrategy:"config",titles:"display",responseLabels:"display",reads:"address"}};function oi(e){return Array.isArray(e)?e:[]}s(oi,"listOf");function Pt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(Pt,"record");function EO(e){switch(e.type){case"countersign":return["contract"];case"engagePush":return["form","contract","payment"];case"governedDocument":return e.production==="resolver"?["form"]:[];case"review":return["form"];default:return[]}}s(EO,"dataSourceFieldsOf");function TO(e){return e.type==="review"?[]:e.type==="engagePush"?["form"]:EO(e)}s(TO,"requiredDataSourceFields");var DW={setFlag:{target:"setFlagTarget"}};function Ol(e,n={}){let t=[],r=e,i=`nodes.${e.id}`,o=s((d,c,u,p={})=>{t.push({kind:d,at:c,nodeId:e.id,value:u,judgedTogether:null,...p})},"field"),a=new Map(n.slotTypes===!1?[]:(He(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=DW[e.type]??{};for(let[d,c]of Object.entries(Pt(r.inputs)??{})){let u=Pt(c);if(u?.kind!=="binding")continue;let p="address"in u?u.address:u.path,h=l[d];if(h!==void 0){o(h,`${i}.inputs.${d}`,p);continue}let y=a.get(d);o("binding",`${i}.inputs.${d}`,p,y!==void 0?{expectedType:y}:{})}for(let[d,c]of oi(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of oi(r.requires).entries())o("requires",`${i}.requires.${d}`,c,{judgedTogether:`${i}.requires`});e.type==="form"&&r.adoptForm!==void 0&&o("adoptForm",`${i}.adoptForm`,r.adoptForm);for(let d of EO(e))r[d]!==void 0&&o(d,`${i}.${d}`,r[d]);e.type==="if"&&r.condition!==void 0&&o("condition",`${i}.condition`,r.condition);for(let[d,c]of oi(r.tasks).entries())t.push(...$O(e.id,c,d));for(let[d,c]of oi(r.optionalActions).entries()){let u=Pt(c);u?.when!==void 0&&o("optionalActionWhen",FW(e.id,typeof u.key=="string"?u.key:String(d)),u.when)}return t}s(Ol,"nodeAddressFields");function FW(e,n){return`nodes.${e}.optionalActions.${n}.when`}s(FW,"optionalActionWhenPath");function $O(e,n,t){let r=Pt(n);if(r===null)return[];let i=[],o=typeof r.key=="string"?r.key:String(t),a=`nodes.${e}.tasks.${o}`,l=s((p,h,y,k={})=>{i.push({kind:p,at:h,nodeId:e,taskKey:o,value:y,judgedTogether:null,...k})},"field"),d=`${a}.evidence`;r.when!==void 0&&l("taskWhen",`${a}.when`,r.when,{expectedType:"boolean",judgedTogether:d});for(let[p,h]of oi(r.reads).entries())l("taskReads",`${a}.reads.${p}`,h,{judgedTogether:d});for(let[p,h]of oi(r.inputs).entries())l("taskInput",`${a}.inputs.${p}`,h);for(let[p,h]of oi(r.documents).entries()){let y=Pt(h);y===null||y.kind!=="field"||l("taskDocument",`${a}.documents.${p}`,y.address)}let c=Pt(r.familyRequest);if(c!==null){for(let[p,h]of oi(c.fields).entries())l("familyRequestFields",`${a}.familyRequest.fields.${p}`,h,{judgedTogether:`${a}.familyRequest.fields`});c.from!==void 0&&l("familyRequestFrom",`${a}.familyRequest.from`,c.from)}let u=Pt(r.result);if(u?.kind==="record")for(let[p,h]of oi(u.fields).entries()){let y=Pt(Pt(h)?.suggest);if(y?.kind!=="form")continue;let k=Pt(h)?.type;l("suggest",`${a}.result.fields.${p}.suggest`,"address"in y?y.address:y.key,typeof k=="string"?{expectedType:k}:{})}return i}s($O,"taskAddressFields");function Ks(e){return Wy(e)?(Yy(e.value)??[]).flatMap(n=>n.address===null?[]:[n.address]):be(e.value)?[e.value]:[]}s(Ks,"addressesInField");function Wy(e){return e.kind==="condition"||e.kind==="optionalActionWhen"}s(Wy,"isExpressionField");function Yy(e){if(typeof e!="string"||e.trim().length===0)return null;try{ii(e)}catch{return null}return CW(e)}s(Yy,"conditionAddresses");function vt(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(vt,"adoptsForm");function RO(e){if(e.type!=="form"||vt({type:e.type,adoptForm:e.adoptForm}))return;let n=e.inputs?.smartForm;return n?.kind==="literal"&&typeof n.value=="string"&&n.value!==""?n.value:void 0}s(RO,"createdSmartFormSlug");function LW(e,n){return e.type!=="governedDocument"||e.production!=="resolver"||n!==Gy?n:e.generatorStamp?.parts!==void 0?qf:Mf}s(LW,"addressKeyOfPort");function IO(e){let n=e.result;return n===void 0||!Ls(n)?[]:Df(n).map(t=>t.key)}s(IO,"storeWritesOf");function Hy(e,n){return(Array.isArray(e.processStore)?e.processStore:[]).find(t=>t.key===n)}s(Hy,"declaredKey");function Fr(e,n){let t=[];if(!vt(n))for(let r of He(n).outputs?.(n)??[])t.push({address:{scope:"node",owner:n.id,key:LW(n,r.name)},type:r.type,...r.label!==void 0?{label:r.label}:{},nodeId:n.id,nodePort:r});for(let r of Array.isArray(n.tasks)?n.tasks:[])for(let i of IO(r)){let o=Hy(e,i);t.push({address:{scope:"task",owner:r.key,key:i},type:o?.type??"unknown",...o!==void 0?{label:o.label}:{},nodeId:n.id})}return t}s(Fr,"producedAddresses");function OO(e,n,t){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===n&&IO(i).includes(t))return{nodeId:r.id,template:i};return null}s(OO,"taskWriter");function si(e,n,t){return OO(e,n,t)?.nodeId??null}s(si,"taskOwnerNode");function MW(e){return Ol(e,{slotTypes:!1}).flatMap(n=>Ks(n).map(t=>({address:t,field:n})))}s(MW,"writtenAddressesOf");function Io(e,n){let t=[],r=new Set,i=s((a,l,d,c)=>{let u=`${ue(a)}|${l}|${d.at}|${c===void 0?"":ue(c)}`;r.has(u)||(r.add(u),t.push({address:a,origin:l,field:d,...c!==void 0?{via:c}:{}}))},"push"),o=s((a,l)=>{if(a.scope!=="task")return;let d=OO(e,a.owner,a.key);if(d!==null){for(let c of $O(d.nodeId,d.template))if(!(c.kind!=="taskWhen"&&c.kind!=="taskReads"))for(let u of Ks(c))i(u,"evidence",l,a)}},"carried");for(let{address:a,field:l}of MW(n))i(a,"written",l),o(a,l);return t}s(Io,"addressReadsOf");function _l(e,n){switch(n.scope){case"env":return Ht(n.key)?Vy(n.key):Ps(e,n.key)?.type;case"task":return n.path!==void 0||si(e,n.owner,n.key)===null?void 0:Hy(e,n.key)?.type;case"node":{let t=e.nodes.find(i=>i.id===n.owner);if(t===void 0)return;let r=Fr(e,t).find(i=>i.address.scope==="node"&&i.address.key===n.key);return r===void 0?void 0:n.path===void 0?r.type:r.nodePort?.schema?.find(i=>i.key===n.path)?.type}}}s(_l,"addressType");function Lf(e,n){let t=Pt(e)?.[n];return typeof t=="string"&&t.length>0?t:void 0}s(Lf,"labelText");function _e(e,n,t){let r=e.nodes.find(i=>i.id===n);return Lf(r?.label,t)??n}s(_e,"nodeDisplayName");function Oo(e,n,t){for(let r of e.nodes){let i=(Array.isArray(r.tasks)?r.tasks:[]).find(o=>o.key===n);if(i!==void 0)return Lf(i.title,t)??n}return n}s(Oo,"taskDisplayName");function je(e,n,t){let r=[];switch(n.scope){case"env":r.push(Ht(n.key)?By(n.key)[t]:Ps(e,n.key)?.label[t]??n.key);break;case"task":r.push(Oo(e,n.owner,t),Lf(Hy(e,n.key)?.label,t)??n.key);break;case"node":{r.push(_e(e,n.owner,t));let i=e.nodes.find(a=>a.id===n.owner),o=i===void 0?void 0:Fr(e,i).find(a=>a.address.scope==="node"&&a.address.key===n.key);r.push(Lf(o?.label,t)??n.key);break}}return n.scope!=="env"&&n.path!==void 0&&r.push(n.path),`${r.join(" \u203A ")} (${ue(n)})`}s(je,"displayAddress");var Nl=["beneficiary","signers"];function Pl(e){let n=[];for(let[t,r]of Object.entries(Pt(e.inputs)??{})){let i=Pt(r);i?.kind==="binding"&&be(i.address)&&n.push({slot:t,address:i.address})}return n}s(Pl,"bindingAddresses");function _O(e,n){return Pl(e).find(t=>t.slot===n)?.address??null}s(_O,"bindingAddressAt");function NO(e,n){let t=s(i=>i.scope==="node"&&i.owner===n||i.scope==="task"&&si(e,i.owner,i.key)===n,"names");return e.nodes.filter(i=>i.id!==n).flatMap(i=>Ol(i,{slotTypes:!1})).flatMap(i=>Ks(i).filter(t).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(NO,"addressesNaming");var _n={target:"target",flagKey:"flagKey",value:"value"};function qW(e){return _O(e,_n.target)}s(qW,"setFlagTarget");function PO(e){let n=qW(e);return n!==null&&kr(n)?n.owner:null}s(PO,"setFlagTargetOwner");function Kf(e){let n=e.inputs?.[_n.flagKey];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(Kf,"setFlagKey");function CO(e){let n=e.inputs?.[_n.value];if(n===void 0||n.kind==="unset")return!0;if(n.kind==="literal"&&typeof n.value=="boolean")return n.value;L(`[setFlag/valueType] setFlag node "${String(e.id)}": \`${_n.value}\` is no yes/no literal \u2014 publish refuses that`)}s(CO,"setFlagValue");function DO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(DO,"isObject");var FO=["target","flagKey","value"];function LO(e){return DO(e)&&e.type==="setFlag"&&FO.some(n=>n in e)}s(LO,"oldShape");function MO(e){return(e?.nodes??[]).some(LO)}s(MO,"needsSetFlagInputMove");function KW(e){let n=DO(e.inputs)?{...e.inputs}:{};if(FO.some(a=>a in e&&_n[a]in n))return{unmoved:"inputExists"};if("target"in e&&!be(e.target))return{unmoved:"targetNotAddress"};if("flagKey"in e&&typeof e.flagKey!="string")return{unmoved:"flagKeyNotString"};if("value"in e&&typeof e.value!="boolean")return{unmoved:"valueNotBoolean"};let{target:t,flagKey:r,value:i,...o}=e;return t!==void 0&&(n[_n.target]={kind:"binding",address:t}),typeof r=="string"&&r.length>0&&(n[_n.flagKey]={kind:"literal",value:r}),i!==void 0&&(n[_n.value]={kind:"literal",value:i}),{node:{...o,inputs:n}}}s(KW,"moveNode");function qO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!LO(i))return i;let o=KW(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(qO,"moveSetFlagConfigToInputs");function KO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(KO,"isObject");var Jy={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},Qy={review:["allowSkipInTest"]};function jO(e){return Jy[String(e)]??{}}s(jO,"movesOf");function VO(e){return Qy[String(e)]??[]}s(VO,"deadOf");function BO(e){return KO(e)&&[...Object.keys(jO(e.type)),...VO(e.type)].some(n=>n in e)}s(BO,"oldShape");function UO(e){return(e?.nodes??[]).some(BO)}s(UO,"needsScalarInputMove");function jW(e,n){return n==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===n}s(jW,"wellTyped");function VW(e){let n=KO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(jO(e.type))){if(!(r in e))continue;let o=e[r];if(r in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!(i==="string"&&o==="")&&!jW(o,i))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueWrongType"}};o!==""&&(n[r]={kind:"literal",value:o}),delete t[r]}for(let r of VO(e.type))delete t[r];return t.inputs=n,{node:t}}s(VW,"moveNode");function GO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!BO(i))return i;let o=VW(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(GO,"moveScalarConfigToInputs");var js={team:{label:{de:"Team",en:"Team"},optionSource:"tenantTeams",existence:{check:"generic",catalog:"teamKeys"}},roleKey:{label:{de:"Rolle",en:"Role"},optionSource:"tenantRoles",existence:{check:"node",codes:["roleAssign/unknownRoleKey","completenessCheck/unknownRole"]}},article:{label:{de:"Artikel",en:"Article"},optionSource:"programArticles",existence:{check:"node",codes:["collectPayment/unknownArticle"]}},legalEntity:{label:{de:"Tr\xE4ger",en:"Legal entity"},optionSource:"tenantTraeger",existence:{check:"node",codes:["governedDocument/unknownTraeger","collectPayment/unknownPayee"]}},contractGenerator:{label:{de:"Vertragsgenerator",en:"Contract generator"},optionSource:"tenantGenerators",existence:{check:"publish",by:"admittedGeneratorByKey"}},documentTemplate:{label:{de:"Dokumentvorlage",en:"Document template"},optionSource:"tenantDocumentTemplates",existence:{check:"publish",by:"governedDocument/unknownTemplate"}},smartForm:{label:{de:"Formular",en:"Form"},optionSource:"offerSmartForms",existence:{check:"publish",by:"form/unknownSmartForm"}},unit:{label:{de:"Einrichtung",en:"Unit"},optionSource:"tenantUnits",existence:{check:"generic",catalog:"unitKeys"}},formFlag:{label:{de:"Merkmal im Formular",en:"Flag in the form"},optionSource:"targetFormFlags",existence:{check:"node",codes:["setFlag/unknownFlag"]}}};function jf(e){return typeof e=="string"&&Object.hasOwn(js,e)}s(jf,"isResourceType");var Vue=Object.keys(js).filter(e=>js[e].existence.check==="generic");function zO(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.groupKey=="string"&&n.groupKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||To(n.reduction)===null&&n.reduction.kind==="amount")&&Object.keys(n).every(t=>t==="groupKey"||t==="grantKeys"||t==="reduction")}s(zO,"isPricedGroupValue");var Zy=["street","hausnr","plz","ort","land"];function WO(e){return Zy.includes(e)}s(WO,"isAddressPart");var BW=["municipality","municipalityKey","district","districtKey"],Xy=[...Zy,...BW],ew={string:"text",email:"text",tel:"text",number:"number",date:"date",boolean:"boolean",consent:"boolean",enum:"option",address:"composite",docRef:"file",party:"edge",personRef:"edge",personList:"edge",roleKey:"roleKey",pricedItem:"pricedItem",pricedGroup:"pricedGroup",reduction:"reduction",article:"article",legalEntity:"legalEntity",contractGenerator:"contractGenerator",documentTemplate:"documentTemplate",localizedText:"localizedText",staffUser:"staffUser",staffUserList:"staffUser",taskAssignment:"taskAssignment"},Vs=Object.keys(ew);function qi(e){return typeof e=="string"&&e in ew}s(qi,"isValueType");function tt(e){return e===void 0?void 0:ew[e]}s(tt,"dataTypeOf");function Vf(e,n){let t=tt(e),r=tt(n);return t!==void 0&&t===r}s(Vf,"valueTypesCompatible");function _o(e){return e===null?"null is not a text in both languages":Cl(e,{type:"localizedText"})}s(_o,"completeLocalizedTextIssue");function Cl(e,n){if(jf(n.type)&&!qi(n.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${n.type} key`;let t=tt(n.type),r=JSON.stringify(e),i=`slot type "${n.type}" takes a binding, not a literal`;if(t===void 0||t==="composite"||t==="file"||t==="edge"||t==="staffUser"||t==="taskAssignment")return i;if(e===null)return null;switch(t){case"text":return typeof e=="string"?null:`${r} is not a text (slot type "${n.type}")`;case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)?null:`${r} is not a date YYYY-MM-DD`;case"number":return typeof e=="number"&&Number.isFinite(e)?null:`${r} is not a number`;case"boolean":return typeof e=="boolean"?null:`${r} is not true/false`;case"option":{if(typeof e!="string")return`${r} is not an option value`;let o=(n.enumOptions??[]).map(a=>a.value);return o.length===0||o.includes(e)?null:`${r} is not one of the options ${o.join(", ")}`}case"pricedItem":{let o=e;return typeof o=="object"&&typeof o.itemKey=="string"&&o.itemKey.length>0&&Array.isArray(o.grantKeys)&&o.grantKeys.every(a=>typeof a=="string")?null:`${r} is not a priced item {"itemKey":\u2026,"grantKeys":[\u2026]}`}case"pricedGroup":return zO(e)?null:`${r} is not a priced group {"groupKey":\u2026,"grantKeys":[\u2026]}`;case"article":return typeof e=="string"&&e.length>0?null:`${r} is not an article key`;case"legalEntity":return typeof e=="string"&&e.length>0?null:`${r} is not a legal entity key`;case"contractGenerator":return $l(e)?null:`${r} is not a contract generator {"kind":"generator"|"package","key":\u2026,"revision"?:n}`;case"documentTemplate":return typeof e=="string"&&e.length>0?null:`${r} is not a document template key`;case"roleKey":return typeof e=="string"&&e.length>0?null:`${r} is not a role key`;case"localizedText":{let o=e,a=s(l=>typeof l=="string"&&l.trim().length>0,"filled");return typeof o=="object"&&Object.keys(o).sort().join(",")==="de,en"&&a(o.de)&&a(o.en)?null:`${r} is not a text in both languages {"de":\u2026,"en":\u2026}`}case"reduction":{let o=To(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(Cl,"literalTypeIssue");function YO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(YO,"isObject");var UW={collectPayment:{reason:"reason"}},GW={governedDocument:["mockAutoProduce"]},HO={collectPayment:{reason:{de:"`reason` gibt es als Knoteneigenschaft nicht mehr \u2014 der Hinweis f\xFCr die Familie ist der Eingang `inputs.reason` (ein fester Text auf Deutsch und Englisch im Parameter-Bereich).",en:"`reason` no longer exists as a node property \u2014 the note for the family is the input `inputs.reason` (a fixed text in German and English among the parameters)."}},governedDocument:{template:{de:"`template` gibt es am Knoten nicht mehr \u2014 die Parameter geh\xF6ren der Vorlage (ihr Datensatz, `plexus-cli catalog` documentTemplates[].parameters) und werden beim Speichern und Ver\xF6ffentlichen als `templateStamp` \xFCbernommen.",en:"`template` no longer exists on the node \u2014 the parameters belong to the template (its record, `plexus-cli catalog` documentTemplates[].parameters) and are stamped as `templateStamp` on save and publish."},cockpitFields:{de:'`cockpitFields` gibt es nicht mehr \u2014 ein Parameter, der im Cockpit erg\xE4nzt wird, ist sein Eingang `{ kind: "cockpit" }` (im Parameter-Bereich \u201Eim Cockpit erg\xE4nzen").',en:'`cockpitFields` no longer exists \u2014 a parameter completed in the cockpit is its input `{ kind: "cockpit" }` ("complete in the cockpit" among the parameters).'},mockAutoProduce:{de:"`mockAutoProduce` gibt es nicht mehr \u2014 das Muster-Dokument, das ein Upload-Knoten beim Eintritt selbst einstellte, ist entfernt; das Dokument kommt aus einem Upload.",en:"`mockAutoProduce` no longer exists \u2014 the sample document an upload node put on its slot by itself on entry is removed; the document comes from an upload."}}};function nw(e){return UW[String(e)]??{}}s(nw,"movesOf");function JO(e){return GW[String(e)]??[]}s(JO,"deadOf");function QO(e){return YO(e)&&[...Object.keys(nw(e.type)),...JO(e.type)].some(n=>n in e)}s(QO,"oldShape");function ZO(e){return(e?.nodes??[]).some(QO)}s(ZO,"needsNodeConfigInputMove");function zW(e){return _o(e)===null}s(zW,"isCompleteText");function WW(e){let n=YO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(nw(e.type)))if(r in e){if(i in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!zW(e[r]))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueNotLocalized"}};n[i]={kind:"literal",value:e[r]},delete t[r]}for(let r of JO(e.type))delete t[r];return Object.keys(nw(e.type)).some(r=>r in e)&&(t.inputs=n),{node:t}}s(WW,"moveNode");function XO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!QO(i))return i;let o=WW(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(XO,"moveNodeConfigToInputs");var Dl="collectPayment",Bs=["online","manual"];function Bf(e){return Bs.includes(e)}s(Bf,"isCollectPaymentMode");var No="paid",tw="skipPayment",rw="confirmPayment",Ki="article",rt="mode",ji="reason",Qt="payee",iw=["one_time"];function Uf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Uf,"isObject");function e_(e){if(!Uf(e)||e.type!==Dl)return!1;let n=Uf(e.inputs)?e.inputs:{},t=n[rt];return!Uf(t)||t.kind!=="literal"||t.value!=="online"?!1:!(Qt in n)}s(e_,"isOnlinePaymentWithoutPayee");function n_(e){return(e?.nodes??[]).some(e_)}s(n_,"needsPayee");function t_(e,n={}){let t=[],r=[],i=e.nodes.map(o=>{if(!e_(o))return o;let a=String(o.id),l=Object.hasOwn(n,a)?n[a]:void 0;if(l===void 0||l==="")return r.push(a),o;t.push({nodeId:a,payee:l});let d=Uf(o.inputs)?o.inputs:{};return{...o,inputs:{...d,[Qt]:{kind:"literal",value:l}}}});return t.length===0?{graph:e,set:t,refused:r}:{graph:{...e,nodes:i},set:t,refused:r}}s(t_,"setPayeeOnOnlinePayments");var r_="settlement",YW={online:"online",separate:"manual"};function ow(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ow,"isObject");function i_(e){return ow(e)&&e.type===Dl&&ow(e.inputs)&&r_ in e.inputs}s(i_,"carriesSettlement");function o_(e){return(e?.nodes??[]).some(i_)}s(o_,"needsPaymentModeRename");function s_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!i_(i))return i;let o=String(i.id),{[r_]:a,...l}=i.inputs;if(rt in l)return t.push({nodeId:o,reason:"bothCells"}),i;let d=ow(a)&&a.kind==="literal"&&typeof a.value=="string"?YW[a.value]:void 0;return d===void 0?(t.push({nodeId:o,reason:"unknownValue"}),i):(n.push(o),{...i,inputs:{...l,[rt]:{...a,value:d}}})});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(s_,"renameSettlementToMode");var l_="formView";function Gf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Gf,"isObject");function sw(e){return Array.isArray(e.tasks)?e.tasks:[]}s(sw,"tasksOf");function Fl(e){return Gf(e)&&l_ in e}s(Fl,"carriesFormView");function d_(e){return(e?.nodes??[]).some(n=>Fl(n)||Gf(n)&&sw(n).some(Fl))}s(d_,"needsFormViewMove");function a_(e){let{[l_]:n,...t}=e;return"view"in t?"bothFields":!Gf(n)||typeof n.form!="string"||typeof n.key!="string"?"malformed":{...t,view:{kind:"form",form:n.form,view:n.key}}}s(a_,"moved");function c_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!Gf(i))return i;let o=String(i.id),a=i;if(Fl(a)){let l=a_(a);typeof l=="string"?t.push({nodeId:o,reason:l}):(a=l,n.push(o))}return sw(a).some(Fl)&&(a={...a,tasks:sw(a).map(l=>{if(!Fl(l))return l;let d=String(l.key),c=a_(l);return typeof c=="string"?(t.push({nodeId:o,taskKey:d,reason:c}),l):(n.push(`${o}.${d}`),c)})}),a});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(c_,"moveFormViewToView");function Lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Lr,"isObject");function aw(e){return Array.isArray(e.tasks)?e.tasks:[]}s(aw,"tasksOf");function Ll(e){return Lr(e)&&Array.isArray(e.documents)?e.documents:[]}s(Ll,"documentsOf");function Ml(e){return Lr(e)&&e.kind==="document"}s(Ml,"isDocumentRef");function u_(e){return(e?.nodes??[]).some(n=>Lr(n)&&aw(n).some(t=>Ll(t).some(Ml)))}s(u_,"needsDocumentRefMove");function HW(e,n){let t=n.address;if(!Lr(t)||t.scope!=="node"||typeof t.owner!="string"||t.path!==void 0||t.key!=="document"&&t.key!=="contract"&&t.key!=="contracts")return null;let r=e.find(a=>Lr(a)&&a.id===t.owner),i=Lr(r)&&Array.isArray(r.artifacts)?r.artifacts:[];if(i.length!==1)return null;let o=Lr(i[0])?i[0].key:void 0;return typeof o=="string"&&o.length>0?o:null}s(HW,"slotOf");function f_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!Lr(i)||!aw(i).some(a=>Ll(a).some(Ml)))return i;let o=String(i.id);return{...i,tasks:aw(i).map(a=>{if(!Lr(a)||!Ll(a).some(Ml))return a;let l=String(a.key),d=Ll(a).map(p=>Ml(p)?HW(e.nodes,p):void 0);if(d.includes(null))return t.push({nodeId:o,taskKey:l,reason:"noSlot"}),a;let c=new Set,u=Ll(a).flatMap((p,h)=>{let y=Ml(p)?{kind:"artifact",key:d[h]}:p;if(!Lr(y)||y.kind!=="artifact")return[y];let k=String(y.key);return c.has(k)?[]:(c.add(k),[y])});return n.push(`${o}.${l}`),{...a,documents:u}})}});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(f_,"moveDocumentRefsToArtifact");function zf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(zf,"isObject");function lw(e){return zf(e)&&zf(e.assign)&&"userId"in e.assign}s(lw,"namesUser");function Wf(e){return(e?.nodes??[]).flatMap(n=>zf(n)&&Array.isArray(n.tasks)?n.tasks.filter(lw).map(t=>({nodeId:String(n.id),taskKey:String(t.key),hasTeam:typeof t.assign.group=="string"&&t.assign.group.length>0})):[])}s(Wf,"taskUserAssignments");function p_(e){let n=Wf(e);if(n.length===0)return{graph:e,dropped:n};let t=e.nodes.map(r=>{if(!zf(r)||!Array.isArray(r.tasks)||!r.tasks.some(lw))return r;let i=r.tasks.map(o=>{if(!lw(o))return o;let{userId:a,...l}=o.assign,{assign:d,...c}=o;return Object.keys(l).length===0?c:{...c,assign:l}});return{...r,tasks:i}});return{graph:{...e,nodes:t},dropped:n}}s(p_,"dropTaskAssignUserIds");var Us={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"actionTeams{}":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Knoten-Aktion ausf\xFChren darf",en:"team that may perform the node action"},consequence:{de:"au\xDFer der zust\xE4ndigen Person darf niemand die Aktion ausf\xFChren",en:"nobody but the responsible person may perform the action"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"tasks[].result.primaryHostTeams":{kind:"team",codec:"key",involves:!1,required:!1,list:!0,what:{de:"Team oben in der Gastgeber-Auswahl",en:"team listed first in the host picker"},consequence:{de:"die Gastgeber-Auswahl kann das Team nicht oben zeigen",en:"the host picker cannot list the team first"}},"optionalActions[].trigger":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Aktion ausl\xF6sen darf",en:"team that may trigger the action"},consequence:{de:"niemand au\xDFer der Prozessverantwortung kann die Aktion ausl\xF6sen",en:"nobody but the process owner can trigger the action"}}},dw=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function cw(e,n){if(typeof n!="string"||n.length===0)return null;if(e==="key")return n;let t=Ms(n);return t?.kind==="team"?t.groupKey:null}s(cw,"decodeKey");var m_={"assign{}":"assign","actionTeams{}":"actionTeams"},JW=s(e=>e in m_,"isMapLeaf");function QW(e){let n=/^(tasks|optionalActions)\[\](?:\.([a-zA-Z]+))?\.([a-zA-Z]+)$/.exec(e);return n===null&&L(`[resource] unreadable reference leaf "${e}"`),{list:n[1],field:n[2]??null,key:n[3]}}s(QW,"locate");function Yf(e){let n=[],t=e;for(let[r,i]of Object.entries(m_))for(let[o,a]of Object.entries(dw(t[i])??{}))n.push({path:`${i}.${o}`,leaf:r,owner:o,key:cw("key",a),missing:typeof a!="string"||a.length===0});for(let r of Object.keys(Us)){if(JW(r))continue;let i=Us[r],{list:o,field:a,key:l}=QW(r);for(let d of Array.isArray(t[o])?t[o]:[]){let c=dw(d);if(c===null||typeof c.key!="string")continue;let p=(a===null?c:dw(c[a]))?.[l];if(p===void 0&&!i.required)continue;let h=`${o}.${c.key}${a===null?"":`.${a}`}.${l}`;if(i.list===!0){if(!Array.isArray(p)){n.push({path:h,leaf:r,owner:c.key,key:null,missing:!0});continue}let k=c.key;p.forEach((w,v)=>{n.push({path:`${h}.${v}`,leaf:r,owner:k,index:v,key:cw(i.codec,w),missing:typeof w!="string"||w.length===0})});continue}let y=typeof p!="string"||p.length===0;n.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:cw(i.codec,p),missing:y})}}return n}s(Yf,"nodeResourceReferences");var h_=s(e=>(e??[]).map(n=>`\u201E${n}\u201C`).join(", "),"list"),g_=s(e=>(e??[]).map(n=>`"${n}"`).join(", "),"listEn"),ZW={"address/shape":{de:s(e=>({problem:`${e.where}: \u201E${e.address}\u201C ist keine g\xFCltige Adresse.`,remedy:"W\xE4hle die Adresse in der Auswahl neu."}),"de"),en:s(e=>({problem:`${e.where}: "${e.address}" is not a valid address.`,remedy:"Choose the address again from the picker."}),"en")},"address/missing":{de:s(e=>({problem:`${e.where}: Hier fehlt die Adresse, ohne die dieser Schritt nicht arbeiten kann.`,remedy:"W\xE4hle sie in der Auswahl."}),"de"),en:s(e=>({problem:`${e.where}: The address this step cannot work without is missing.`,remedy:"Choose it from the picker."}),"en")},"address/bareIdentifier":{de:s(e=>({problem:`${e.where}: \u201E${e.address}\u201C nennt nur einen Schl\xFCssel, nicht, wer ihn erzeugt.`,remedy:"W\xE4hle in der Auswahl die volle Adresse, z. B. das Feld aus dem Formular, das es erfasst."}),"de"),en:s(e=>({problem:`${e.where}: "${e.address}" names a key only, not who produces it.`,remedy:"Choose the full address from the picker, e.g. the field from the form that collects it."}),"en")},"address/unknownOwner":{de:s(e=>({problem:`${e.where}: ${e.address} nennt einen Knoten oder eine Aufgabe, die es im Ablauf nicht gibt.`,remedy:"W\xE4hle eine Adresse aus der Auswahl."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} names a node or task the workflow does not have.`,remedy:"Choose an address from the picker."}),"en")},"address/unknownKey":{de:s(e=>({problem:`${e.where}: ${e.producer??"der Erzeuger"} erzeugt ${e.address} nicht.`,remedy:"W\xE4hle einen Wert, den der Erzeuger tats\xE4chlich liefert."}),"de"),en:s(e=>({problem:`${e.where}: ${e.producer??"the producer"} does not produce ${e.address}.`,remedy:"Choose a value the producer actually delivers."}),"en")},"address/envCohortBound":{de:s(e=>({problem:`${e.where}: ${e.address} \xE4ndert sich, wenn Stufe oder Schuljahr gewechselt werden \u2014 ein Dokument, das den Wert druckt, w\xFCrde das nicht bemerken.`,remedy:"Lies den Wert \xFCber ein Formularfeld, das ihn berechnet (z. B. \u201EKlassenstufe\u201C): ein Wechsel friert es neu ein und h\xE4lt ein gedrucktes Dokument an."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} changes when the application's stage or school year is changed \u2014 a document printing it would not notice.`,remedy:'Read it through a form field that computes it (e.g. "Grade"): a change re-freezes it and holds a printed document.'}),"en")},"address/staffInputConditionOnly":{de:s(e=>({problem:`${e.where}: ${e.address} ist eine interne Angabe beim Anlegen \u2014 sie lenkt eine Weiche (\u201EWenn\u201C-Knoten) oder f\xFCllt einen Parameter eines Knotens.`,remedy:"Lies sie in der Bedingung eines \u201EWenn\u201C-Knotens oder binde einen Parameter des Knotens daran (z. B. im Vertrag); Formulare, Aufgaben und Regeln lesen sie nicht."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} is a staff input set at the start \u2014 it steers a branch (an "If" node) or fills a node's parameter.`,remedy:'Read it in the condition of an "If" node or bind a node parameter to it (e.g. in the contract); forms, tasks and rules do not read it.'}),"en")},"address/ownerNotWriter":{de:s(e=>({problem:`${e.where}: Die Aufgabe \u201E${e.producer}\u201C schreibt ${e.address} nicht.`,remedy:"W\xE4hle den Wert \xFCber seinen Schl\xFCssel; die schreibende Aufgabe folgt daraus."}),"de"),en:s(e=>({problem:`${e.where}: The task "${e.producer}" does not write ${e.address}.`,remedy:"Choose the value by its key; the writing task follows from it."}),"en")},"address/taskOwnerTaken":{de:s(e=>({problem:`${e.where}: Den Aufgaben-Schl\xFCssel gibt es mehrfach (${h_(e.names)}), und eine dieser Aufgaben schreibt Prozesswerte.`,remedy:"Gib der schreibenden Aufgabe einen Schl\xFCssel, den keine andere Aufgabe tr\xE4gt."}),"de"),en:s(e=>({problem:`${e.where}: The task key is used more than once (${g_(e.names)}), and one of these tasks writes process values.`,remedy:"Give the writing task a key no other task carries."}),"en")},"address/notVisible":{de:s(e=>({problem:e.producerNode!==void 0&&e.producerNode!==e.producer?`${e.where}: ${e.address} \u2014 \u201E${e.producer}\u201C h\xE4ngt an \u201E${e.producerNode}\u201C, das nicht auf jedem Weg vor \u201E${e.reader}\u201C liegt.`:`${e.where}: ${e.address} \u2014 \u201E${e.producer}\u201C liegt nicht auf jedem Weg vor \u201E${e.reader}\u201C.`,remedy:`Lies nur, was auf jedem Weg vor \u201E${e.reader}\u201C entsteht, oder ordne die Schritte so, dass der Erzeuger immer vorher l\xE4uft.`}),"de"),en:s(e=>({problem:e.producerNode!==void 0&&e.producerNode!==e.producer?`${e.where}: ${e.address} \u2014 "${e.producer}" hangs on "${e.producerNode}", which does not lie before "${e.reader}" on every path.`:`${e.where}: ${e.address} \u2014 "${e.producer}" does not lie before "${e.reader}" on every path.`,remedy:`Read only what is produced before "${e.reader}" on every path, or order the steps so the producer always runs first.`}),"en")},"address/pathNotInTarget":{de:s(e=>({problem:`${e.where}: ${e.address} \u2014 ${e.producer??"der Erzeuger"} hat dieses Feld nicht.`,remedy:"W\xE4hle ein Feld, das es dort gibt."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} \u2014 ${e.producer??"the producer"} has no such field.`,remedy:"Choose a field that exists there."}),"en")},"address/typeMismatch":{de:s(e=>({problem:`${e.where}: erwartet ${e.expected}, ${e.address} ist ${e.actual}.`,remedy:`W\xE4hle einen Wert vom Typ ${e.expected}.`}),"de"),en:s(e=>({problem:`${e.where}: expects ${e.expected}, ${e.address} is ${e.actual}.`,remedy:`Choose a value of type ${e.expected}.`}),"en")},"address/notFormInstance":{de:s(e=>({problem:`${e.where}: ${e.address} ist kein ganzes Formular.`,remedy:"W\xE4hle das Formular des Knotens, der es anlegt \u2014 ohne Feld, nicht den Knoten, der es \xFCbernimmt."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} is not a whole form.`,remedy:"Choose the form of the node that creates it \u2014 without a field, not the node that continues it."}),"en")},"address/mixedForms":{de:s(e=>({problem:`${e.where}: Die Liste liest Felder aus mehreren Formularen (${h_(e.names)}), beurteilt wird sie aber an einem Formular.`,remedy:"W\xE4hle alle Felder dieser Liste aus demselben Formular."}),"de"),en:s(e=>({problem:`${e.where}: The list reads fields of several forms (${g_(e.names)}) but is judged on one.`,remedy:"Choose every field of this list from the same form."}),"en")},"workItems/keyFormat":{de:s(e=>({problem:`${e.where}: Der Aufgaben-Schl\xFCssel \u201E${e.address}\u201C hat nicht die Form ^[a-z][a-zA-Z0-9_]*$.`,remedy:"Benenne die Aufgabe in camelCase um, z. B. \u201EgeschwisterRang\u201C."}),"de"),en:s(e=>({problem:`${e.where}: The task key "${e.address}" does not match ^[a-z][a-zA-Z0-9_]*$.`,remedy:'Rename the task in camelCase, e.g. "siblingRank".'}),"en")}};function Gs(e,n,t){let{problem:r,remedy:i}=ZW[e][t](n);return`[${e}] ${r} ${i}`}s(Gs,"addressMessage");function Zt(e){let n=[];for(let t of e){let r=t.next;if(r)for(let[i,o]of Object.entries(r))n.push({id:`${t.id}|${i}`,source:t.id,target:o.to,sourceBranchId:i})}return n}s(Zt,"derivedEdges");function uw(e){let n=new Map;for(let t of Zt(e.nodes)){let r=n.get(t.source)??[];r.push(t.target),n.set(t.source,r)}return n}s(uw,"successorsOf");function zs(e,n,t){if(n===t)return!0;let r=uw(e),i=new Set([...r.values()].flat()),o=e.nodes.filter(l=>!i.has(l.id)&&l.id!==n).map(l=>l.id),a=new Set(o);for(;o.length>0;){let l=o.shift();if(l===t)return!1;for(let d of r.get(l)??[])d===n||a.has(d)||(a.add(d),o.push(d))}return!0}s(zs,"dominates");function y_(e,n,t){if(n===t)return!0;let r=uw(e),i=[n],o=new Set(i);for(;i.length>0;){let a=i.shift();for(let l of r.get(a)??[]){if(l===t)return!0;o.has(l)||(o.add(l),i.push(l))}}return!1}s(y_,"reaches");function w_(e,n,t,r){let i=new Map(e.nodes.map(d=>[d.id,d])),o=uw(e),a=[n],l=new Set(a);for(;a.length>0;){let d=a.shift();for(let c of o.get(d)??[]){if(l.has(c)||t.has(c))continue;l.add(c);let u=i.get(c);if(u!==void 0&&r(u))return c;a.push(c)}}return null}s(w_,"reachedAvoiding");function fw(e,n){let t=[],r=s(i=>({address:i.address,type:i.type,...i.label!==void 0?{label:i.label}:{},nodeId:i.nodeId}),"toVisible");for(let i of e.nodes)if(zs(e,i.id,n))for(let o of Fr(e,i))t.push(r(o));for(let i of xO)t.push({address:{scope:"env",key:i},type:Vy(i),label:By(i),nodeId:null});for(let i of Ef(e))t.push({address:{scope:"env",key:Tf(i.key)},type:i.type,label:i.label,nodeId:null});return t}s(fw,"visibleAddressesAt");function ai(e,n){let t=e?.readinessFormFieldsByFormNode?.get(n.owner);if(t!==void 0)return t.get(n.path)??null}s(ai,"formFieldEntryOf");var k_={binding:{de:"Eingang",en:"Input"},condition:{de:"Bedingung",en:"Condition"},nodeReads:{de:"Gelesene Felder",en:"Fields read"},requires:{de:"Geforderte Felder",en:"Required fields"},adoptForm:{de:"\xDCbernommenes Formular",en:"Continued form"},setFlagTarget:{de:"Freizuschaltendes Formular",en:"Form to unlock"},form:{de:"Formular",en:"Form"},contract:{de:"Vertrag",en:"Contract"},payment:{de:"Zahlung",en:"Payment"},taskWhen:{de:"Bedingung",en:"Condition"},optionalActionWhen:{de:"Bedingung der optionalen Aktion",en:"Condition of the optional action"},taskReads:{de:"Gelesene Felder der Aufgabe",en:"Fields the task reads"},taskDocument:{de:"Dokumente",en:"Documents"},familyRequestFields:{de:"Nachforderbare Felder",en:"Requestable fields"},familyRequestFrom:{de:"Nachforderung aus",en:"Request from"},suggest:{de:"Vorschlag",en:"Suggestion"},taskInput:{de:"Vorgaben",en:"Inputs"}},XW=new Set(["nodeReads","requires","taskReads","taskDocument","familyRequestFields"]);function e1(e,n,t){let r=[];n.taskKey!==void 0&&r.push(`${t==="de"?"Aufgabe":"task"} \u201E${Oo(e,n.taskKey,t)}\u201C`);let i=n.kind==="binding"?` \u201E${n.at.split(".").pop()}\u201C`:"";return r.push(`${k_[n.kind][t]}${i}`),r.join(" \u203A ")}s(e1,"addressFieldWhere");function ql(e,n,t){let r=e1(e,n,t);return`\u201E${_e(e,n.nodeId,t)}\u201C \u203A ${r}`}s(ql,"whereOf");function b_(e,n,t){if(n.scope==="node")return _e(e,n.owner,t);if(n.scope==="task")return Oo(e,n.owner,t)}s(b_,"producerName");function v_(e,n){let t=[],r=new Set,i=s((l,d,c)=>{let u={de:Gs(l,c("de"),"de"),en:Gs(l,c("en"),"en")},p=`${d}|${u.de}`;r.has(p)||(r.add(p),t.push({layer:"GRAPH",kind:"nodeRule",path:d,reason:u,severity:"error"}))},"report"),o=new Map(e.nodes.map(l=>[l.id,l])),a=[...e.nodes.flatMap(l=>Ol(l))];for(let l of a){let d=s(c=>ql(e,l,c),"where");for(let c of n1(e,l,i))r1(e,l,c,i)&&(o1(e,l,c,n,i),zy.has(l.kind)&&!a1(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:je(e,c,u)})))}return l1(e,i),d1(e,a,i),p1(e,i),h1(e,i),t}s(v_,"checkAddresses");function n1(e,n,t){let r=s(i=>ql(e,n,i),"where");if(Wy(n)){let i=Yy(n.value)??[];for(let o of i)o.address===null&&t(o.reason==="bareIdentifier"?"address/bareIdentifier":"address/shape",n.at,a=>({where:r(a),address:o.identifier}));return Ks(n)}return typeof n.value=="string"?(t("address/bareIdentifier",n.at,i=>({where:r(i),address:n.value})),[]):be(n.value)?[n.value]:(t("address/shape",n.at,i=>({where:r(i),address:JSON.stringify(n.value)??"undefined"})),[])}s(n1,"checkFieldShape");function x_(e,n,t,r){let i=b_(e,t,r);return{where:ql(e,n,r),address:je(e,t,r),...i!==void 0?{producer:i}:{}}}s(x_,"addressParams");function t1(e,n,t){return jy(n)||t==="optionalActionWhen"&&(Ps(e,n)!==void 0||Ht(n))?null:Ps(e,n)!==void 0?t==="condition"||t==="binding"?null:"address/staffInputConditionOnly":Ht(n)?"address/envCohortBound":"address/unknownKey"}s(t1,"envAddressRefusal");function r1(e,n,t,r){let i=s(o=>x_(e,n,t,o),"params");switch(t.scope){case"env":{let o=t1(e,t.key,n.kind);return o===null?!0:(r(o,n.at,i),!1)}case"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===t.owner))?(e.processStore??[]).some(a=>a.key===t.key)?si(e,t.owner,t.key)===null?(r("address/ownerNotWriter",n.at,i),!1):!0:(r("address/unknownKey",n.at,i),!1):(r("address/unknownOwner",n.at,i),!1);case"node":{let o=e.nodes.find(a=>a.id===t.owner);return o===void 0?(r("address/unknownOwner",n.at,i),!1):Fr(e,o).some(a=>a.address.scope==="node"&&a.address.key===t.key)?!0:(r(zy.has(n.kind)&&vt(o)?"address/notFormInstance":"address/unknownKey",n.at,i),!1)}}}s(r1,"resolves");function i1(e,n){return e===void 0||n===void 0||tt(n)===void 0?!0:tt(e)!==void 0&&Vf(e,n)}s(i1,"addressTypeFits");function o1(e,n,t,r,i){let o=s(l=>x_(e,n,t,l),"params");if(t.scope!=="env"&&t.path!==void 0&&!s1(e,n,t,r)){i("address/pathNotInTarget",n.at,o);return}if(n.expectedType===void 0)return;let a=_l(e,t);i1(a,n.expectedType)||i("address/typeMismatch",n.at,l=>({...o(l),expected:n.expectedType,actual:a}))}s(o1,"checkPathAndType");function s1(e,n,t,r){if(t.scope!=="node")return!1;if(_l(e,t)!==void 0)return!0;if(t.key!==nt)return!1;if(!XW.has(n.kind))return e.nodes.find(o=>o.id===t.owner)?.formExports===void 0;let i=r?.readinessFormFieldsByFormNode?.get(t.owner);return i===void 0||i.has(t.path)}s(s1,"pathExists");function a1(e,n){if(!kr(n))return!1;let t=e.get(n.owner);return t!==void 0&&t.type==="form"&&!vt(t)}s(a1,"isCreatingFormInstance");function l1(e,n){for(let t of e.nodes){let r=new Set(Ol(t).map(i=>i.kind));for(let i of TO(t))r.has(i)||n("address/missing",`nodes.${t.id}.${i}`,o=>({where:`\u201E${_e(e,t.id,o)}\u201C \u203A ${k_[i][o]}`}))}}s(l1,"checkRequiredFields");function d1(e,n,t){let r=new Map;for(let i of n)if(i.judgedTogether!==null)for(let o of Ks(i)){if(o.scope!=="node"||o.key!==nt)continue;let a=r.get(i.judgedTogether)??[];a.push({field:i,owner:o.owner}),r.set(i.judgedTogether,a)}for(let[i,o]of r){let a=[...new Set(o.map(l=>l.owner))];a.length<2||t("address/mixedForms",i,l=>({where:ql(e,o[0].field,l),names:a.map(d=>_e(e,d,l))}))}}s(d1,"checkMixedForms");function c1(e,n){return e.type==="engagePush"&&n.kind==="payment"}s(c1,"readSkipsAbsentProducer");function u1(e,n,t){return n!==t&&y_(e,n,t)}s(u1,"precedesOnSomePath");function f1(e,n,t,r){let i=Uy(t.address);return r.has(ue(i))||!m1(e,i)?!0:t.origin==="written"&&i.scope==="node"&&c1(n,t.field)&&u1(e,i.owner,n.id)}s(f1,"readPassesVisibility");function p1(e,n){for(let t of e.nodes){let r=Io(e,t);if(r.length===0)continue;let i=new Set(fw(e,t.id).map(o=>ue(o.address)));for(let o of r){let a=Uy(o.address);if(f1(e,t,o,i))continue;let l=a.scope==="task"?si(e,a.owner,a.key):a.scope==="node"?a.owner:null;n("address/notVisible",o.field.at,d=>({where:ql(e,o.field,d),address:je(e,o.address,d),producer:b_(e,a,d)??je(e,a,d),...l!==null?{producerNode:_e(e,l,d)}:{},reader:_e(e,t.id,d)}))}}}s(p1,"checkVisibility");function m1(e,n){if(n.scope==="env")return jy(n.key);let t=ue(n);return e.nodes.some(r=>Fr(e,r).some(i=>ue(i.address)===t))}s(m1,"producedSomewhere");function h1(e,n){let t=new Map;for(let r of e.nodes){let i=new Set(Fr(e,r).flatMap(o=>o.address.scope==="task"?[o.address.owner]:[]));for(let[o,a]of(r.tasks??[]).entries()){let l=a.key;if(typeof l!="string"||!Ci.test(l)){n("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${_e(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=t.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),t.set(l,d)}}for(let[r,i]of t)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)n("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${_e(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${Oo(e,r,a)}\u201C`,names:i.map(l=>_e(e,l.nodeId,a))}))}s(h1,"checkTaskKeys");function Hf(e,n){return e.label[n]??""}s(Hf,"wordingIn");function Vi(e,n){let t=S_(e,n),r=Hf(e.qualifier,n);return t===""||r===""&&Hf(e.qualifier,"de")!==""?"":r===""?t:`${r} \xB7 ${t}`}s(Vi,"fieldLabelIn");function S_(e,n){return Hf(e,n)}s(S_,"fieldOwnLabelIn");function Ws(e){return{key:e.key,kind:e.kind,type:e.kind==="entered"?e.type:null,repeated:e.kind==="entered"&&e.repeated,reviewRequired:e.kind==="entered"&&e.reviewRequired,name:{de:Vi(e,"de"),en:Vi(e,"en")}}}s(Ws,"catalogField");function Ys(e,n){switch(e){case"nodeReads":return n.repeated?"repeated":null;case"requires":return n.repeated?"repeated":n.kind==="computed"?"computed":n.name.en===""?"untranslated":null;case"taskDocument":return n.repeated?"repeated":n.kind==="entered"&&n.type==="docRef"?null:"notDocument";case"taskReads":case"familyRequestFields":return null}}s(Ys,"catalogFieldRefusal");function Jf(e,n){let t=e.buses.find(r=>r.key===n);return t||L(`[progress] layout '${e.id}' has no bus '${n}'`),t}s(Jf,"progressBus");function Kl(e,n){return e.states.some(t=>t.id===n)}s(Kl,"isBusState");function A_(e,n){let t=e.terminalSemantics?.[n];return t||L(`[progress] no terminal semantics for state '${n}' on bus '${e.key}'`),t}s(A_,"terminalSemantics");function Qf(e,n){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,n)}s(Qf,"hasTerminalSemantics");function g1(e,n){return(e.boards??[]).find(t=>t.audience===n||t.audience==="both")??null}s(g1,"boardForAudience");function E_(e){return g1(Jf(e,"process"),"internal")}s(E_,"internalProcessBoard");function Hs(e,n,t){let r=null;for(let i of e.mappings)if(i.event===t)if("nodeId"in i.match){if(i.match.nodeId===n.id)return{bus:i.bus,state:i.state}}else i.match.nodeType===n.type&&(r=i);return r?{bus:r.bus,state:r.state}:null}s(Hs,"resolveProgressEvent");var Js={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},li=Object.keys(Js);function Po(e){return Object.hasOwn(Js,e)}s(Po,"isEndNodeOutcome");var pw={approved:{de:"Angenommen",en:"Admitted"},rejected:{de:"Abgelehnt",en:"Rejected"},withdrawn:{de:"Zur\xFCckgezogen",en:"Withdrawn"},expired:{de:"Abgelaufen",en:"Expired"}};var Bi=["commit","discard"],zfe=m.union(...Bi.map(e=>m.literal(e)));function Zf(e){return typeof e=="string"&&Bi.includes(e)}s(Zf,"isApplicationDataDecision");function Ln(e){return Object.keys(e)}s(Ln,"progressEventsOf");var te=s((e,n)=>({de:e,en:n}),"lt"),Xe=s((e,n,t,r,i=null,o=null)=>({chipLabel:e,tone:n,nextAction:i,affordance:o,title:t,body:r}),"ex"),T_={key:"eingeschrieben",label:te("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},Xf={key:"abgesagt",label:te("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},$_={key:"abgelehnt",label:te("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var R_={enrolled:{label:te("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:T_,external:Xe(te("Eingeschrieben","Enrolled"),"green",te("Sie sind eingeschrieben!","You are enrolled!"),te("Ihre Anmeldung ist abgeschlossen und Ihr Platz ist gesichert. Wir freuen uns auf Sie.","Your enrolment is complete and your place is secured. We look forward to welcoming you."))},declined:{label:te("Abgesagt","Declined"),tone:"red",terminal:{lifecycleStatus:"completed",outcome:"rejected"},phase:Xf,external:Xe(te("Abgesagt","Declined"),"red",te("Die Bewerbung wurde beendet","The application has ended"),te("Ihre Bewerbung wurde nicht fortgef\xFChrt.","Your application was not continued."))}},I_={role:"effect",effect:"pure",progressDefaults:R_,progressEvents:Ln(R_),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:li.map(e=>({value:e,label:pw[e]}))},{id:"dataDecision",label:{de:"Erfasste Daten",en:"Captured data"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"commit",label:{de:"\xDCbernehmen",en:"Keep"}},{value:"discard",label:{de:"Verwerfen",en:"Discard"}}]}],"inputs"),notificationEvents:s(()=>[{id:"reached",label:{de:"Verfahren abgeschlossen",en:"Process completed"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"outcome",type:"string",required:!0}]}],"notificationEvents"),validate:s(e=>[...y1(e),...w1(e),...k1(e)],"validate")},Qs=s((e,n,t,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${n}`,reason:{de:t,en:r},severity:"error"}),"nodeIssue");function Co(e){let n=e.inputs?.applicationOutcome;return n?.kind==="literal"&&n.value!=null?String(n.value):null}s(Co,"literalOutcome");function y1(e){if(e.type!=="end")return[];let n=e.inputs?.applicationOutcome;if(n===void 0||n.kind==="unset")return[];let t=Co(e);return t===null?[Qs(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: das Ergebnis ist kein fester Wert \u2014 die Engine kann den Abschluss nicht ableiten`,`[end/applicationOutcome] ${e.label.en}: the application outcome is no fixed value \u2014 the engine cannot derive the terminal`)]:Po(t)?[]:[Qs(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${t}' ist kein Ausgang eines Endknotens (${li.join("|")}) \u2014 die Warteliste endet \xFCber das closed-Outcome ihres Wartelistenknotens`,`[end/applicationOutcome] ${e.label.en}: '${t}' is not an outcome of an end node (${li.join("|")}) \u2014 the waitlist ends through the closed outcome of its waitlist node`)]}s(y1,"checkEndApplicationOutcome");function w1(e){if(e.type!=="end")return[];let n=e.inputs?.dataDecision;return!n||n.kind!=="literal"||n.value==null?[Qs(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision fehlt \u2014 der Endknoten muss festlegen, ob die erfassten Daten \xFCbernommen (commit) oder verworfen (discard) werden`,`[end/dataDecision] ${e.label.en}: dataDecision is missing \u2014 the end node must decide whether the collected data is kept (commit) or discarded (discard)`)]:Zf(n.value)?[]:[Qs(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision '${String(n.value)}' ist ung\xFCltig (${Bi.join("|")})`,`[end/dataDecision] ${e.label.en}: dataDecision '${String(n.value)}' is invalid (${Bi.join("|")})`)]}s(w1,"checkEndDataDecision");function k1(e){if(e.type!=="end")return[];let n=Co(e);if(n===null||!Po(n)||n==="approved")return[];let t=e.inputs?.dataDecision;if(t?.kind!=="literal"||t.value!=="commit")return[];let r=pw[n];return[{...Qs(e,"dataDecision",`[end/commitWithoutApproval] ${e.label.de}: Ende ohne Zusage \xFCbernimmt die erfassten Daten (commit) \u2014 Personen und Beziehungen bleiben nach dem Ergebnis \u201E${r.de}" bestehen. Gewollt? Sonst discard.`,`[end/commitWithoutApproval] ${e.label.en}: end without admission keeps the captured data (commit) \u2014 persons and relationships remain after the outcome "${r.en}". Intended? Otherwise discard.`),severity:"warning"}]}s(k1,"checkEndCommitWithoutApproval");function O_(e,n){if(!n?.layout||!n.wiring)return[];let t=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=Co(r);if(i===null||!Po(i))continue;let o=Js[i],a=Hs(n.wiring,r,o);if(a===null)continue;let l=n.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Qf(l,a.state))continue;let d=A_(l,a.state).outcome;d!==i&&t.push(Qs(r,"applicationOutcome",`[end/outcomeMismatch] ${r.label.de}: das Ergebnis \u201E${i}" passt nicht zum Endzustand \u201E${a.state}" (Bus ${a.bus}), der \u201E${String(d)}" besiegelt \u2014 Ergebnis oder Verdrahtung angleichen.`,`[end/outcomeMismatch] ${r.label.en}: the outcome "${i}" does not match the final state "${a.state}" (bus ${a.bus}), which seals "${String(d)}" \u2014 align the outcome or the wiring.`))}return t}s(O_,"checkEndOutcomeMatchesTerminal");function Zs(e){let n=He(e);return typeof n.inputs=="function"?n.inputs(e):[]}s(Zs,"inputSlots");function b1(e,n){return Zs(e).find(t=>t.id===n)}s(b1,"findInputSlot");function v1(e,n){let t=b1(e,n);if(!t)return{source:"missing",spec:{id:n,label:{de:n,en:n},type:"string"},unknownSlot:!0};let r=e.inputs?.[n]??{kind:"unset"};return r.kind==="binding"&&be(r.address)?{source:"binding",spec:t,address:r.address}:r.kind==="literal"?{source:"literal",spec:t,value:r.value}:r.kind==="cockpit"&&t.deferrable===!0?{source:"cockpit",spec:t}:t.defaultValue!==void 0?{source:"default",spec:t,value:t.defaultValue}:t.required?{source:"missing",spec:t}:{source:"optional",spec:t}}s(v1,"resolveInput");function __(e){return Zs(e).filter(n=>v1(e,n.id).source==="missing")}s(__,"missingRequiredInputs");var x1=["personRef","formRef","documentRef","docRef"];function S1(e){let n=He(e);return typeof n.inputs!="function"?[]:n.inputs(e).map(t=>({id:t.id,type:t.type}))}s(S1,"listInputs");function N_(e){let n=[];for(let t of e.nodes)for(let r of S1(t))!x1.includes(r.type)||t.inputs?.[r.id]?.kind!=="literal"||n.push({layer:"GRAPH",kind:"modelError",path:`node.${t.id}.param.${r.id}`,reason:{de:`${t.label.de}: Literal f\xFCr referenztypisierten Slot "${r.id}" ist verboten \u2014 der Slot wird an eine Adresse gebunden`,en:`${t.label.en}: A literal for the reference-typed slot "${r.id}" is not allowed \u2014 the slot is bound to an address`},severity:"error"});return n}s(N_,"findParamValueRefSlotErrors");function P_(e){let n=[];for(let t of e.nodes){let r=He(t);if(typeof r.inputs=="function")for(let i of r.inputs(t)){let o=t.inputs?.[i.id];if(o?.kind==="cockpit"&&i.deferrable!==!0){n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/notDeferrable] ${t.label.de}: Parameter \u201E${i.label.de}\u201C l\xE4sst sich nicht im Cockpit erg\xE4nzen \u2014 nur Parameter eines Generators oder einer Vorlage.`,en:`[inputs/notDeferrable] ${t.label.en}: Parameter "${i.label.en}" cannot be completed in the cockpit \u2014 only parameters of a generator or a template can.`},severity:"error"});continue}(i.inspector==="literal-only"&&o?.kind==="binding"||i.inspector==="binding-only"&&o?.kind==="literal")&&n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:i.inspector==="literal-only"?{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C ist ein fester Wert \u2014 eine Bindung an eine Adresse ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is a fixed value \u2014 it cannot be bound to an address.`}:{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C wird an eine Adresse gebunden \u2014 ein fester Wert ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is bound to an address \u2014 a fixed value is not possible here.`},severity:"error"})}}return n}s(P_,"findInspectorKindErrors");function C_(e){let n=[];for(let t of e.nodes)for(let r of __(t))n.push({layer:"GRAPH",kind:"contractGap",path:`node.${t.id}.input.${r.id}`,reason:{de:`${t.label.de}: Pflicht-Slot "${r.label.de}" nicht gesetzt`,en:`${t.label.en}: Required slot "${r.label.en}" is not set`},severity:"error"});return n}s(C_,"findMissingRequiredInputs");function ep(e){let n=e.processStore;return n===void 0?[]:(Array.isArray(n)||L("graph.processStore must be an array \u2014 the graph validator refuses anything else"),n)}s(ep,"processStoreKeys");function D_(e){let n=[];for(let t of e.tasks??[]){let r=t.result;if(!(r===void 0||!Ls(r)))for(let i of Df(r))n.push({key:i.key,nodeId:e.id,taskKey:t.key,template:t,result:r,valueType:i.valueType,...i.field!==void 0?{fieldKey:i.field.key}:{}})}return n}s(D_,"storeWritersOn");function F_(e){let n=new Map;for(let t of e.nodes)for(let r of D_(t)){let i=n.get(r.key)??[];i.push(r),n.set(r.key,i)}return n}s(F_,"processStoreWriters");function A1(e,n,t){for(let r of e.nodes){let i=D_(r).find(o=>o.taskKey===n&&o.key===t);if(i!==void 0)return i}return null}s(A1,"writerAt");function E1(e,n,t){(n.scope!=="task"||n.path!==void 0)&&L(`[process] ${t}: ${ue(n)} is no task value`);let r=A1(e,n.owner,n.key);return r===null&&L(`[address/ownerNotWriter] ${t}: task "${n.owner}" writes no "${n.key}" \u2014 publish refuses that`),{key:n.key,nodeId:r.nodeId,taskKey:r.taskKey,...r.fieldKey!==void 0?{fieldKey:r.fieldKey}:{}}}s(E1,"sourceOfAddress");function L_(e,n){(n.scope!=="task"||n.path!==void 0)&&L(`[process] ${ue(n)} is no store address`);let t=ep(e).find(r=>r.key===n.key);return t===void 0&&L(`[address/unknownKey] ${ue(n)}: "${n.key}" is not declared in processStore`),{key:t.key,type:t.type,label:t.label,audience:t.audience,source:E1(e,n,ue(n))}}s(L_,"processLeafOf");var mw=new Set(["enum","pricedItem","number","boolean","reduction","string","staffUser","staffUserList","taskAssignment"]),ct={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function ut(e,n,t,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${n} ${t}`,en:`${n} ${r}`},severity:"error"}}s(ut,"err");function q_(e){let n=[],t=ep(e),r=new Map(t.map(l=>[l.key,l])),i=new Set;for(let[l,d]of t.entries()){let c=`processStore[${l}]`;if(typeof d.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(d.key)){n.push(ut(c,ct.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(d.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(d.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}i.has(d.key)&&n.push(ut(c,ct.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" ist doppelt deklariert.`,`Process key "${d.key}" is declared twice.`)),i.add(d.key),mw.has(d.type)||n.push(ut(c,ct.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" hat den Typ "${d.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...mw].join(", ")}.`,`Process key "${d.key}" has the type "${d.type}" \u2014 the process only stores results with a value: ${[...mw].join(", ")}.`)),(!d.label?.de?.trim()||!d.label?.en?.trim())&&n.push(ut(c,ct.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" braucht ein Label in beiden Sprachen.`,`Process key "${d.key}" needs a label in both languages.`)),d.audience!=="internal"&&d.audience!=="printable"&&n.push(ut(c,ct.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${d.key}": audience must be 'internal' or 'printable'.`))}let o=F_(e);for(let l of e.nodes)for(let d of l.tasks??[]){let c=d.result;c?.kind==="pricedItem"&&c.writes===void 0&&n.push(ut(`node.${l.id}.tasks.${d.key}.result.writes`,ct.pricedItemWritesNothing,`Aufgabe "${d.key}" (Knoten "${l.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${d.key}" (node "${l.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[l,d]of o){let c=r.get(l);for(let u of d){let p=u.fieldKey===void 0?`node.${u.nodeId}.tasks.${u.taskKey}.result.writes`:`node.${u.nodeId}.tasks.${u.taskKey}.result.fields.${u.fieldKey}.writes`;if(c===void 0){n.push(ut(p,ct.unknownKey,`${u.fieldKey===void 0?"":`Feld "${u.fieldKey}" der `}Aufgabe "${u.taskKey}" schreibt "${l}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${u.fieldKey===void 0?"Task":`Field "${u.fieldKey}" of task`} "${u.taskKey}" writes "${l}", but the workflow declares no such process key (graph.processStore).`));continue}if(u.valueType!==c.type){let h=u.fieldKey===void 0?`Aufgabe "${u.taskKey}"`:`Feld "${u.fieldKey}" der Aufgabe "${u.taskKey}"`,y=u.fieldKey===void 0?`Task "${u.taskKey}"`:`Field "${u.fieldKey}" of task "${u.taskKey}"`;n.push(ut(p,ct.writerTypeMismatch,`${h} liefert ${u.valueType}, der Vorgangs-Schl\xFCssel "${l}" ist aber als ${c.type} deklariert.`,`${y} delivers ${u.valueType}, but the process key "${l}" is declared as ${c.type}.`))}}if(d.length>1){let u=d.map(p=>`${p.nodeId}/${p.taskKey}${p.fieldKey===void 0?"":`.${p.fieldKey}`}`).join(", ");n.push(ut(`processStore.${l}`,ct.secondWriter,`Vorgangs-Schl\xFCssel "${l}" wird ${d.length}-mal geschrieben (${u}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${l}" is written ${d.length} times (${u}) \u2014 exactly one writer per key.`))}}for(let l of t)o.has(l.key)||n.push(ut(`processStore.${l.key}`,ct.noWriter,`Vorgangs-Schl\xFCssel "${l.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${l.key}" is declared, but no task writes it ('result.writes').`));let a=new Map;for(let l of e.nodes){let d=He(l),c=typeof d.inputs=="function"?d.inputs(l):[];for(let u of c){let p=l.inputs?.[u.id];if(p?.kind!=="binding")continue;let h=T1(e,p.address);if(h===null)continue;let y=`node.${l.id}.input.${u.id}`,k=ue(p.address),w=a.get(h.source.key)??new Set;w.add(l.id),a.set(h.source.key,w),h.audience==="internal"&&n.push(ut(y,ct.internalInDocument,`${l.label.de}: "${u.id}" liest den internen Vorgangs-Schl\xFCssel "${h.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${l.label.en}: "${u.id}" reads the internal process key "${h.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`));let v=$1(o,h.source.key,h.source.taskKey);if(v.template.when!==void 0&&u.required===!0&&u.defaultValue===void 0&&n.push(ut(y,ct.absentWithoutDefault,`${l.label.de}: "${u.id}" ist Pflicht und an ${k} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${M_(v.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${l.label.en}: "${u.id}" is required and bound to ${k}, but the writing task only exists under a condition (when: ${M_(v.template.when)}) \u2014 without a default value the field would stay empty forever.`)),v.result.kind==="pricedItem"&&u.defaultValue!==void 0){let A=u.defaultValue;(!Li(A)||A.itemKey!==v.result.item||A.grantKeys.length>0)&&n.push(ut(y,ct.defaultItemMismatch,`${l.label.de}: der Vorgabewert von "${u.id}" muss der Artikel der schreibenden Aufgabe ohne Erm\xE4\xDFigung sein ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 sonst rechnete die Familie ohne Antrag einen anderen Artikel als mit.`,`${l.label.en}: the default value of "${u.id}" must be the article of the writing task without a reduction ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 otherwise the family would be charged a different article without an application than with one.`))}}}for(let[l,d]of a){let c=o.get(l)[0],u=c.template.blocks,p=u===void 0?void 0:u.node??c.nodeId,h=p!==void 0&&(()=>{let k=e.nodes.find(w=>w.id===p);return k!==void 0&&He(k).processHoldTemplate?.(k)===u.templateKey})(),y=`node.${c.nodeId}.tasks.${c.taskKey}.blocks`;if(!h){let k=[...d][0],w=e.nodes.find(A=>A.id===k),v=He(w).processHoldTemplate?.(w)??"?";n.push(ut(y,ct.writerMustBlock,`Die Aufgabe "${c.taskKey}" schreibt "${l}", h\xE4lt aber keinen der lesenden Knoten (${[...d].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${k===c.nodeId?"":`node: '${k}', `}templateKey: '${v}' }, sonst arbeitet er, bevor der Wert existiert.`,`The task "${c.taskKey}" writes "${l}" but holds back none of the reading nodes (${[...d].join(", ")}) \u2014 it must block the first one, e.g. blocks: { ${k===c.nodeId?"":`node: '${k}', `}templateKey: '${v}' }, otherwise it works before the value exists.`));continue}for(let k of d)k===p||zs(e,p,k)||n.push(ut(y,ct.writerMustBlock,`"${k}" liest "${l}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${p}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${k}" reads "${l}" but does not lie behind the held-back node "${p}" \u2014 on a path past it, it would read the value before it is settled.`))}return n}s(q_,"processBindingIssues");function T1(e,n){return!be(n)||n.scope!=="task"||n.path!==void 0||!ep(e).some(t=>t.key===n.key)||si(e,n.owner,n.key)===null?null:L_(e,n)}s(T1,"draftLeafOf");function $1(e,n,t){let r=e.get(n)?.find(i=>i.taskKey===t);return r===void 0&&L(`[process] the leaf of "${n}" names task "${t}", which does not write it`),r}s($1,"writerOf");function M_(e){return be(e)?ue(e):JSON.stringify(e)}s(M_,"shown");function hw(e){let n=He(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:n.outcomes&&n.outcomes.length>0?[...n.outcomes]:null}s(hw,"nodeOutcomes");var R1=["documentChangeRequested","documentReturned","coverLetterConfirmed","coverLetterRevisionRequested"];function K_(e){return R1.includes(e)}s(K_,"isNonAdvancingExternalEvent");var Xs=["offer","contract"];function np(e){return typeof e=="string"&&Xs.includes(e)}s(np,"isArtifactSlotType");var j_="open",ea="done";function gw(e){let n={};for(let t of We)n[t]=e(t);return n}s(gw,"localized");var V_=[{key:"tenantSlug",type:"string"}];var I1=/^(\d{4})-(\d{2})-(\d{2})$/;function O1(e){return e>=1900&&e<=2100}s(O1,"isSupportedYear");function _1(e,n,t){let r=new Date(Date.UTC(e,n-1,t));return r.getUTCFullYear()===e&&r.getUTCMonth()===n-1&&r.getUTCDate()===t}s(_1,"isRealDate");function yw(e){if(typeof e!="string")return null;let n=I1.exec(e);if(n===null)return null;let[,t,r,i]=n;return t===void 0||r===void 0||i===void 0||!O1(Number(t))||!_1(Number(t),Number(r),Number(i))?null:{year:t,month:r,day:i}}s(yw,"isoDateParts");var N1="Europe/Berlin";function U_(){return N1}s(U_,"tenantTimeZone");var B_=new Map;function P1(e){let n=B_.get(e);if(n)return n;let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{se("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return B_.set(e,t),t}s(P1,"formatterFor");function C1(e,n){let t=new Map(P1(e).formatToParts(new Date(n)).map(a=>[a.type,a.value])),r=s(a=>{let l=t.get(a);return l===void 0&&L(`Zeitzone "${e}" liefert kein Feld ${a}.`),Number(l)},"read"),i=r("hour")%24;return Date.UTC(r("year"),r("month")-1,r("day"),i,r("minute"),r("second"))-Math.floor(n/1e3)*1e3}s(C1,"zoneOffsetAt");function ww(e,n){let t=e+C1(n,e);return{wallClock:new Date(t).toISOString().slice(0,19),timeZone:n}}s(ww,"instantToLocalDateTime");var kw=3;function G_(e){return ww(e,U_()).wallClock.slice(0,10)}s(G_,"localIsoDate");var tp=["login","security","admission","tasks","deadlines","schoolMessages","staffAssigned","staffTeamQueue","staffFeedback","staffAppointments","staffDeadlines","staffWaitlist","staffUnassigned","familyMessages","mentions"],z_=m.union(...tp.map(e=>m.literal(e)));var rme=m.union(m.literal("admission"),m.literal("tasks"),m.literal("staff"),m.literal("chat")),bw=["loginOnly","all"],ime=m.union(m.literal("loginOnly"),m.literal("all"));function W_(e){return typeof e=="string"&&bw.includes(e)}s(W_,"isMailLevel");function Y_(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=30}s(Y_,"isUnassignedTaskNoticeDays");function H_(e){return e*864e5}s(H_,"unassignedTaskNoticeMs");var ame=H_(3),lme=H_(1);var jl="subject";function J_(e){return e.category==="login"}s(J_,"isSignInLetter");var dn={key:"schoolName",label:"Name der Schule"},Z_={de:"Zu Ihren Bewerbungen",en:"View your applications"},vn={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:Z_},vw={key:vn.key,label:vn.label,link:!0,actionLabel:Z_},X_={key:"authorName",label:"Name der schreibenden Person"},Do={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},Vl={key:"anmeldeLink",label:"Anmeldelink",required:!0,link:!0,actionLabel:{de:"Jetzt anmelden",en:"Sign in now"},previewValue:{de:"https://beispiel.plexus.schule/anmelden?token=BEISPIEL",en:"https://beispiel.plexus.schule/anmelden?token=BEISPIEL"}},F1={key:"passwortLink",label:"Link zum neuen Passwort",required:!0,link:!0,actionLabel:{de:"Neues Passwort festlegen",en:"Set a new password"},previewValue:{de:"https://beispiel.plexus.schule/login/reset?token=BEISPIEL",en:"https://beispiel.plexus.schule/login/reset?token=BEISPIEL"}},eN={key:"bestaetigungsLink",label:"Best\xE4tigungslink",required:!0,link:!0,actionLabel:{de:"E-Mail best\xE4tigen",en:"Confirm email address"},previewValue:{de:"https://beispiel.plexus.schule/bestaetigen?token=BEISPIEL",en:"https://beispiel.plexus.schule/bestaetigen?token=BEISPIEL"}},Bl={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},nN={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},L1={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function $e(e){return{key:jl,label:"Betreff",default:e}}s($e,"subjectSlot");var Ui=m.object({de:m.string(),en:m.string()}),Sn={tenantSlug:m.string(),applicationId:m.id("applications")},M1=m.object({tenantSlug:m.string()}),q1={id:"applicant.welcome",category:"admission",label:"Willkommen",occasion:{de:"Sobald f\xFCr eine Familie ein Zugang angelegt wurde",en:"As soon as an account has been created for a family"},audience:"external",frame:"letter",timeline:"correspondence",paramsValidator:M1,channels:["email"],portalVisible:!0,placeholders:[dn,vn],slots:[$e({de:"Willkommen \u2014 Ihre Bewerbung bei uns",en:"Welcome \u2014 your application"}),{key:"intro",label:"Einleitung",multiline:!0,default:{de:`vielen Dank f\xFCr Ihre Registrierung bei {{schoolName}}. \xDCber den folgenden Link k\xF6nnen Sie jederzeit Ihre Bewerbungen einsehen und fortsetzen:
10998
11001
 
10999
11002
  {{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
@@ -11512,6 +11515,6 @@ ${t.length} unusable ${o}:
11512
11515
  `),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
11513
11516
  `),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>
11514
11517
  `)}else this.context.stdout.write(`No unusable identities.
11515
- `);return t.length>0?1:0}},kT=class extends cr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let 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 gB(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(gB,"requireOnOff");var yB=[tT,rT,iT,oT,sT,aT,lT,dT,cT,uT,bu,fT,pT,mT,hT,gT,yT,wT,kT];function wB(e){return e.de??e.en??Object.values(e)[0]??""}s(wB,"titleDe");function kX(e){return{id:e._id,kind:e.kind,status:e.status,title:wB(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(kX,"row");var bX=["id","kind","status","title","assignee","group","outcome"],xT=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let 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(kX),bX),0}},ST=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let 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:wB(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}},AT=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let 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}},ET=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let 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}},TT=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let 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}},kB=[xT,ST,AT,ET,TT];var vu=[...sI,...AD,...DD,...LF,...FF,...dL,...gL,...hL,...mB,...yB,...pB,...Zj,...iV,...lD,...oL,...nB,...iI,...NI,...WC,...kL,...wL,...xL,...SL,...rL,...BF,...kB,...zq,...DK,...Jj,...FK,...MV,...zV,...oV,...mV,...yV,...vV,...SV,...HV,...sB,...xI];for(let e of vu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:$$(e.usage.category,n.join(" "))})}var bB="0.1.185";function vB(){return vu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=S$[ho(t)];return{path:t,effect:go(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(vB,"plexusCommandCatalog");import fs from"node:path";function vX(e){let n=ln()?.workspaceRoot??process.cwd(),t=fs.resolve(n,e),r=fs.relative(n,t);if(fs.isAbsolute(e)||r===".."||r.startsWith(`..${fs.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(vX,"workspacePath");function xX(e){let{absolute:n,relative:t}=vX(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Or(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=fs.join(o,a.name);if(a.isDirectory()?i(l):r.push(fs.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 Fn(fs.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return gs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(xX,"plexusWorkspace");function xB(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=Al[t];if(!o||!Object.hasOwn(Al,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(uy,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:uy[i.path],skillHash:gf}}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 xX(i)},"executePlexusAgentTool")}s(xB,"createPlexusAgentToolExecutor");var Jh=xB({inspectCommand:AB,executeCommand:EB});function Qh(){let e=new bs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:bB});e.register(al.HelpCommand),e.register(al.VersionCommand);for(let t of vu)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 EX(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(Qh,"createPlexusCli");function EX(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&fl[t]===r&&sn(n,t,r),t in fl&&go(t)==="confirm"&&!pl(e)&&n.write(`plexus-cli: \`${fl[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
11518
+ `);return t.length>0?1:0}},kT=class extends cr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let 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 gB(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(gB,"requireOnOff");var yB=[tT,rT,iT,oT,sT,aT,lT,dT,cT,uT,bu,fT,pT,mT,hT,gT,yT,wT,kT];function wB(e){return e.de??e.en??Object.values(e)[0]??""}s(wB,"titleDe");function kX(e){return{id:e._id,kind:e.kind,status:e.status,title:wB(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(kX,"row");var bX=["id","kind","status","title","assignee","group","outcome"],xT=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let 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(kX),bX),0}},ST=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let 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:wB(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}},AT=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let 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}},ET=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let 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}},TT=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let 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}},kB=[xT,ST,AT,ET,TT];var vu=[...sI,...AD,...DD,...LF,...FF,...dL,...gL,...hL,...mB,...yB,...pB,...Zj,...iV,...lD,...oL,...nB,...iI,...NI,...WC,...kL,...wL,...xL,...SL,...rL,...BF,...kB,...zq,...DK,...Jj,...FK,...MV,...zV,...oV,...mV,...yV,...vV,...SV,...HV,...sB,...xI];for(let e of vu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:$$(e.usage.category,n.join(" "))})}var bB="0.1.186";function vB(){return vu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=S$[ho(t)];return{path:t,effect:go(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(vB,"plexusCommandCatalog");import fs from"node:path";function vX(e){let n=ln()?.workspaceRoot??process.cwd(),t=fs.resolve(n,e),r=fs.relative(n,t);if(fs.isAbsolute(e)||r===".."||r.startsWith(`..${fs.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(vX,"workspacePath");function xX(e){let{absolute:n,relative:t}=vX(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Or(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=fs.join(o,a.name);if(a.isDirectory()?i(l):r.push(fs.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 Fn(fs.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return gs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(xX,"plexusWorkspace");function xB(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=Al[t];if(!o||!Object.hasOwn(Al,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(uy,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:uy[i.path],skillHash:gf}}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 xX(i)},"executePlexusAgentTool")}s(xB,"createPlexusAgentToolExecutor");var Jh=xB({inspectCommand:AB,executeCommand:EB});function Qh(){let e=new bs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:bB});e.register(al.HelpCommand),e.register(al.VersionCommand);for(let t of vu)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 EX(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(Qh,"createPlexusCli");function EX(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&fl[t]===r&&sn(n,t,r),t in fl&&go(t)==="confirm"&&!pl(e)&&n.write(`plexus-cli: \`${fl[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
11516
11519
  `)}s(EX,"noteRetiredPath");function AB(e){let n=Qh().process(Za(e),{executePlexusAgentTool:Jh}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=vB().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"?vm(Oa(_a),i.fn??"",i.kind):void 0,a=tf(t,{confirm:pl(n),callKind:o});return{...r,writes:a}}s(AB,"inspectPlexusCommand");async function EB(e,n){if(n)return IT(n,()=>EB(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=Qh();if(ln()){let l=AB(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(Za(e.argv),{executePlexusAgentTool:Jh,stdin:AX.from(e.stdin===void 0?[]:[e.stdin]),stdout:new SB({write(l,d,c){t+=String(l),c()}}),stderr:new SB({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(EB,"executePlexusCommand");CT({source:TX.join(import.meta.dirname,"skill")});Qh().runExit(Za(process.argv.slice(2)),{executePlexusAgentTool:Jh});
11517
11520
  //# sourceMappingURL=cli.mjs.map
@@ -1 +1 @@
1
- f65b497a138f9db5a599e1149e2954be4f56c87cd329f1be946c4e294047df90
1
+ 05c2e0da139625d4b08ca3795381cb7caf13d5f4502acd9482f8001b2035797e
@@ -84,8 +84,11 @@ required fields. A secret not given stays as it is. Remove one with
84
84
  already started keeps talking to the account it started on — poll, reconcile,
85
85
  void and its callbacks included. `delete` is refused while one is open.
86
86
  - **The account is part of an open Vorgang.** While one is open, changing
87
- DocuSign's `--user-id` or inSign's `--base-url` / `--owner-id` is refused;
88
- rotating the password or HMAC key is allowed.
87
+ DocuSign's `--user-id` or inSign's `--base-url` / `--owner-id` is refused.
88
+ Changing the password or HMAC key of the ACTIVE connection is refused as well while an offer
89
+ requires `eSignature` (the save is a direct overwrite; the school has one connection per
90
+ provider). Without the other provider: first switch the offers to paper, change, test, switch
91
+ back. A rotation that keeps the connection (`reseal`) is a different thing and is not affected.
89
92
  - **`test` fails on an inSign account that exists.** Both calls of the test
90
93
  (`/configure/get/version`, `/get/usersessions`) need `ROLE_INSIGN_CONTROLLER`;
91
94
  per the OpenAPI a user without the role is refused (the symptom itself is not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartkomm/plexus-cli",
3
- "version": "0.1.185",
3
+ "version": "0.1.186",
4
4
  "description": "Unified Plexus admin + admission-offer config CLI (Convex backend).",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",