@smartkomm/plexus-cli 0.1.76 → 0.1.77

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
@@ -590,7 +590,7 @@ Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --
590
590
  | \`--node <value>\` | Node id (default: the application's current nodes) |
591
591
  | \`--action <value>\` (required) | Action id, e.g. load-scenario:standard, auto-fill-files, submit-form |
592
592
  | \`--auto-submit\` | Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads) |
593
- | \`--param <value>\` | 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 (upload-signed-document) |
593
+ | \`--param <value>\` | 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\`) |
594
594
 
595
595
  ## Agents (offline)
596
596
 
@@ -9652,10 +9652,10 @@ plexus-cli --env staging --tenant test test-actions run --application <applicati
9652
9652
  plexus-cli --env staging --tenant test test-actions list --application <applicationId> # submit-form no longer disabled?
9653
9653
  plexus-cli --env staging --tenant test test-actions run --application <applicationId> --action submit-form
9654
9654
 
9655
- # An action that asks a question first (the popover's dialog) runs with its answer as a param \u2014
9656
- # upload the signed copy with the contract terms confirmed:
9655
+ # Upload the signed copy \u2014 no question: the contract terms are the family's
9656
+ # to confirm, the protocol records \u201Enicht abgefragt \xB7 Testaktion\u201C:
9657
9657
  plexus-cli --env staging --tenant test test-actions run --application <applicationId> \\
9658
- --action upload-signed-document --param confirmed=true
9658
+ --action upload-signed-document
9659
9659
 
9660
9660
  # Application-wide actions (listed under \u201E(Bewerbung)\u201C), e.g. become responsible:
9661
9661
  plexus-cli --env staging --tenant test test-actions run --application <applicationId> --action takeResponsibility
@@ -9677,8 +9677,8 @@ then shows what the next node offers.
9677
9677
  that switch is \`--no-auto-submit\`, never \`--param autoSubmit=\u2026\` (refused).
9678
9678
  - \`--param key=value\` (repeatable) sends the action's params; each value is JSON where it
9679
9679
  parses (\`true\`, \`3\`, \`{"a":1}\`), else text \u2014 quote a number meant as text (\`--param note='"007"'\`).
9680
- An action that declares a question (\`upload-signed-document\`, the contract terms) is refused
9681
- by the server without \`--param confirmed=true\`, and refused WITH it when it asks nothing.
9680
+ An action that declares a question (\`confirm\` in \`test-actions list\`) runs with its answer
9681
+ as \`--param confirmed=true\`. \`upload-signed-document\` asks none.
9682
9682
  - Not a test application, or no \`testActions.run\`: refused with that reason (never an empty
9683
9683
  list). An unknown \`--node\`: refused with the node id.
9684
9684
  - The UI label of \`auto-fill-files\` is \u201EFile-Felder mit Dummy f\xFCllen\u201C.
@@ -10509,7 +10509,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
10509
10509
  ## Related
10510
10510
  - Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
10511
10511
  \`plexus-cli platform imports cleanup-orphaned --help\`.
10512
- `};var Uu="294fa2510acc6baca9ba47a7055ce5bb23e415e18a7f414ff92927b3461b8163",$g=Q$;var Rg=class extends Se{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:Uu,tools:el}),0}},Ig=class extends Se{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=p.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 t=JSON.parse(await Tg(this.context.stdin)),n=await this.context.executePlexusAgentTool(this.tool,t);return this.print(n),0}},Z$=[Rg,Ig];var Og=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Voe=new Set(Og.map(e=>e.key));function eR(e,t,n,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===t);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${t}" (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 ${t} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===n||l.runId===n);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${n}" 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(eR,"resolveStartTarget");function FV(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(FV,"applicantText");function tR(e){return e.map(t=>({id:t.application._id,status:t.deletedAt?`${t.application.status} (gel\xF6scht)`:t.application.status,state:t.currentProcessStateId??"",applicant:FV(t.applicantName),test:t.application.testMode===!0?"test":""}))}s(tR,"applicationRows");var X$=Og.map(e=>e.email);function nR(e,t,n,r){if(n===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(n!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(Sg(e,t)&&(r===void 0||!X$.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${X$.join(", ")} (--applicant) \u2014 never a real family's`)}s(nR,"assertStartApplicant");function rR(e){let t={};for(let{address:n,...r}of e.entries)t[n]=r;return{applicationId:e.applicationId,store:t}}s(rR,"processStoreJson");function LV(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.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(t=>`${t.partKey}: contract ${t.contractId} \xB7 ${t.revision===null?"keine Fassung":`Fassung ${t.revision.revisionNumber}`} \xB7 ${t.contractStatus}`).join("; ")}}s(LV,"refText");function MV(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?LV(e.ref):JSON.stringify(e.value)}s(MV,"holds");function iR(e){return e.entries.map(t=>({address:t.address,state:t.state,holds:MV(t),producer:t.producer?.label??"",written:t.writtenAt===void 0?"":new Date(t.writtenAt).toISOString()}))}s(iR,"storeRows");function Vu(e){let t={},n={};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(n,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);n[o]=a;try{t[o]=JSON.parse(a)}catch{t[o]=a}}return{values:t,raw:n}}s(Vu,"parseKv");var oR="started",Gu="submitted",zu="submitted",sR="load-scenario:";var aR="(Bewerbung)";function lR(e){return{nodeId:aR,actions:e.map(t=>({id:t.id,label:{de:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`,en:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`},...t.disabledReason===void 0?{}:{disabledReason:t.disabledReason}}))}}s(lR,"sharedAsList");function dR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(dR,"disabledText");function cR(e){return e.flatMap(({nodeId:t,actions:n})=>n.map(r=>({node:t,action:r.id,label:r.label.de,disabled:dR(r)})))}s(cR,"actionRows");function uR(e,t,n=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===t));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 "${t}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${t}" 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===t);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${t}" on ${i} is disabled: ${dR(a)}`);if(i!==aR)return i;let l=n[0];if(l===void 0)throw new Error(`test-actions run: "${t}" needs a current node \u2014 the application has none`);return l}s(uR,"nodeOfferingAction");function fR(e,t,n){if(e.startsWith(sR)){if(Object.hasOwn(n,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:t,...n}}return Object.keys(n).length===0?void 0:{...n}}s(fR,"runParams");async function qV(e,t){let n=await e.query(x.workflow.getInstance,{applicationId:t});if(n===null)throw new Error(`test-actions: application ${t} has no workflow instance`);return n.instance.currentNodeIds}s(qV,"currentNodeIds");function KV(e,t){switch(t){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${t} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(KV,"refusalText");async function Wu(e,t,n){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:t});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${KV(t,r.reason)}`);let i=[];for(let o of n){let a=await e.query(x.workflow.listTestActions,{applicationId:t,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,lR(r.actions)]}s(Wu,"actionsOf");async function pR(e,t,n){return n!==void 0?[n]:await qV(e,t)}s(pR,"nodesOf");var Pg=class extends C{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=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let t=await this.caller(),n=await Wu(t,this.application,await pR(t,this.application,this.node));return this.print(n,cR,["node","action","label","disabled"]),0}},_g=class extends C{static{s(this,"TestActionsRunCommand")}application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.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=p.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=p.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=p.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 (upload-signed-document)"});async execute(){let t=fR(this.action,this.autoSubmit,Vu(this.param??[]).values),n=await this.caller(),r=this.application,i=await pR(n,this.application,this.node),o=uR(await Wu(n,r,i),this.action,i);return await n.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...t===void 0?{}:{params:t}}),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}},mR=[Pg,_g];var ze=["de","en"];function fs(e,t){return ze.every(n=>e[n]===t[n])}s(fs,"sameText");function Et(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let t=e;return Object.keys(t).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=t[r];return typeof i!="string"||i.trim()===""})}s(Et,"missingLocales");function xi(e){let t=Et(e);return t!=="not-localized"&&t.length===0}s(xi,"isLocalizedText");function tl(e,t){let n={};for(let r of ze){let i=e.map(o=>o[r]);n[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?t(i,r):""}return n}s(tl,"composeTexts");var dr=/^[a-z][A-Za-z0-9]*$/;function Cg(e){return typeof e=="string"&&dr.test(e)}s(Cg,"isNodeId");function ps(e,t){Cg(e)||N(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${dr.source}.`);let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}s(ps,"makeNodeId");var Si="$env";function se(e){if(e.scope==="env")return`${Si}.${e.key}`;let t=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?t:`${t}.${e.path}`}s(se,"formatAddress");var Or=/^[a-z][a-zA-Z0-9_]*$/,jV=/^[A-Za-z_][A-Za-z0-9_]*$/;function po(e){return typeof e=="string"&&e.split(".").every(t=>jV.test(t))}s(po,"isPath");function Yr(e){if(!e.startsWith("$"))return null;let t=e.slice(1).split("."),[n,...r]=t;switch(n){case"env":{let i=r.join(".");return r.length>0&&po(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Or.test(i)?null:hR({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Or.test(o)||(n==="node"?!dr.test(i):!Or.test(i))?null:hR({scope:n,owner:i,key:o},a)}default:return null}}s(Yr,"tryParseAddress");function hR(e,t){if(t.length===0)return e;let n=t.join(".");return po(n)?{...e,path:n}:null}s(hR,"withPath");function ve(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=t.scope==="env"?["scope","key"]:t.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(t).some(r=>!n.includes(r))||t.path!==void 0&&!po(t.path))return!1;switch(t.scope){case"env":return po(t.key);case"derived":return typeof t.key=="string"&&Or.test(t.key);case"node":return typeof t.owner=="string"&&dr.test(t.owner)&&typeof t.key=="string"&&Or.test(t.key);case"task":return typeof t.owner=="string"&&Or.test(t.owner)&&typeof t.key=="string"&&Or.test(t.key);default:return!1}}s(ve,"isAddress");var Hr={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"}},ms=Object.keys(Hr);function hs(e){return Object.hasOwn(Hr,e)}s(hs,"isEnvKey");var BV=["self-service","staff"];function gR(e,t){return{kind:"fixed",values:e,labels:t}}s(gR,"fixedSet");var Yu={of:"applicant.language",withoutValue:"de"},Jr={"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:Yu},"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:Yu},"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:Yu},"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:Yu},"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:gR(ze,{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:gR(BV,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Hu={types:Hr,fields:Jr},Ju=ms.flatMap(e=>Object.keys(Hr[e]).map(t=>`${e}.${t}`));function cr(e){return Object.hasOwn(Jr,e)}s(cr,"isEnvLeaf");function Qu(e){return`${Si}.${e}`}s(Qu,"envIdentifier");function mo(e){let t=Jr[e],[n,r]=e.split("."),i=Hr[n][r];i===void 0&&N(`[env] leaf "${e}" has no type`);let o=t.valueSet;return{leaf:e,type:i,label:t.label,nullable:t.nullable,...t.absent===void 0?{}:{absent:t.absent},...t.nameLanguage===void 0?{}:{nameLanguage:t.nameLanguage},...t.cohortBound===void 0?{}:{cohortBound:t.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&N(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(mo,"envLeaf");var yR="staffInput";var UV=["boolean"],nl=/^[a-z][A-Za-z0-9]*$/;function Zu(e){return e.staffInputs??[]}s(Zu,"staffInputsOf");function Xu(e){return`${yR}.${e}`}s(Xu,"staffInputLeaf");function wR(e){return`${Si}.${Xu(e)}`}s(wR,"staffInputIdentifier");function VV(e){let t=`${yR}.`;return e.startsWith(t)?e.slice(t.length):null}s(VV,"staffInputKeyOfLeaf");function rl(e,t){let n=VV(t);return n===null?void 0:Zu(e).find(r=>r.key===n)}s(rl,"declaredStaffInput");function GV(e){return[...Zu(e).map(t=>({leaf:Xu(t.key),type:t.type,label:t.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Ju.map(t=>{let n=mo(t);return{leaf:t,type:n.type,label:n.label,valueSet:Jr[t].valueSet,nullable:n.nullable,cohortBound:n.cohortBound===!0}})]}s(GV,"envLeavesFor");function kR(e){return GV(e).filter(t=>!t.cohortBound)}s(kR,"conditionEnvLeaves");function bR(e){let t={},n={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of kR(e)){let[l="",d=""]=r.split(".");t[l]={...t[l]??{},[d]:i},n[r]={valueSet:o,nullable:a}}return{types:t,fields:n}}s(bR,"envConditionSchemaFor");function vR(e){let t=e.staffInputs;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let n=[],r=new Set;return t.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){n.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}"`};nl.test(l.key)||n.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)&&n.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),UV.includes(l.type)||n.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=Et(l.label);c==="not-localized"?n.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&&n.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(", ")}.`}})}),n}s(vR,"staffInputIssues");var Bg={required:!0,description:"Offer slug (its offerKey)"},Ng=class extends C{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=p.String("--offer",Bg);testOnly=p.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let t=await this.caller(),n=await t.query(x.admission.listForAngebot,{client:this.requireTenant(t),offerKey:this.offer}),r=tR(n).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},Dg=class extends C{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=p.String("--offer",Bg);async execute(){let t=await this.caller(),n=await t.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(t),offerKey:this.offer});return this.print(n,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},Fg=class extends C{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=p.String({required:!0});async execute(){let t=await this.caller(),n=this.application,r=await t.query(x.admission.get,{applicationId:n});if(r===null)throw new Error(`applications show: no application ${n} (or not visible to you)`);let i=await t.query(x.workflow.getInstance,{applicationId:n});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:n},{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}},Lg=class extends C{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, $derived\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=p.String({required:!0});async execute(){let n=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(rR(n),()=>iR(n),["address","state","holds","producer","written"]),0}},Mg=class extends C{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=p.String("--offer",Bg);run=p.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=p.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=p.String("--party",{description:"Applicant party id"});applicant=p.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=p.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=p.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=p.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 t=await this.caller();nR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let n=this.requireTenant(t),r=eR(await t.query(x.admission.listAdmissionTree,{client:n}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await t.query(x.applicants.partyByEmail,{client:n,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 t.mutation(x.admission.staffStartApplicationForParty,{client:n,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:SR(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await t.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 Wu(t,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}},qg=class extends C{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)"});application=p.String({required:!0});async execute(){return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},n=>[{key:"discarded",value:n.discarded}]),0}},Kg=class extends C{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=p.String({required:!0});async execute(){let n=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(n,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}},jg=class extends C{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=p.String({required:!0});input=p.String("--input",{required:!0,description:"key=true|false"});reason=p.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let t=await this.caller(),[{key:n,value:r}]=SR([this.input]);return await t.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:n,value:r,reason:this.reason}),this.print({application:this.application,key:n,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},xR=[Ng,Dg,Fg,Lg,Mg,qg,Kg,jg];function SR(e){return e.map(t=>{let[n="",r,...i]=t.split("=");if(!nl.test(n)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${t}": expected key=true or key=false`);return{key:n,value:r==="true"}})}s(SR,"parseStaffInputs");var Lt="contractGenerator",ho="documentTemplate";function il(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return(t.kind==="generator"||t.kind==="package")&&typeof t.key=="string"&&t.key.length>0&&(t.revision===void 0||typeof t.revision=="number"&&Number.isInteger(t.revision)&&t.revision>0)&&n.every(r=>r==="kind"||r==="key"||r==="revision")}s(il,"isGeneratorRef");function AR(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(AR,"literalOf");function Qr(e){let t=AR(e,Lt);return il(t)?t:null}s(Qr,"generatorRefOfNode");function ur(e){let t=AR(e,ho);return typeof t=="string"&&t.length>0?t:null}s(ur,"documentTemplateKeyOfNode");function ER(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(ER,"generatorRefLabel");var zV=["formExports","generatorStamp"];function TR(e,t,n){let r=e.inputs?.[Lt];(r?.kind!=="literal"||!il(r.value))&&N(`applyGeneratorStamp: the node names no generator in inputs.${Lt} \u2014 a stamp derives from it`),n.freezeRevision&&t.revision!==void 0&&(e.inputs[Lt]={kind:"literal",value:{...r.value,revision:t.revision}}),e.generatorStamp={inputSchema:t.inputSchema,parties:t.parties,schemaDigest:t.schemaDigest,...t.parts===void 0?{}:{parts:t.parts}}}s(TR,"applyGeneratorStamp");var WV=["reads"];function gs(e){if(e===null||typeof e!="object")return e;let t={...e};return Array.isArray(t.nodes)&&(t.nodes=t.nodes.map(n=>{if(n===null||typeof n!="object")return n;let r={...n};for(let i of zV)delete r[i];for(let i of WV)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),t}s(gs,"comparableWorkflowGraph");var ol={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 ef(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(t=>{let n=ol[t];return n!==void 0?`manifest: \`${t}\` is no longer part of manifest.json (${n.en}). Delete the line.`:`manifest: unknown key \`${t}\` \u2014 manifest.json carries no key.`})}s(ef,"manifestIssues");function YV(e){let t=[],n=e.buses;if(!Array.isArray(n))return t;let r=n.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return t;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:"?";t.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return t}s(YV,"validateProgressLayoutExternalCopy");function $R(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let t=e.buses;return!Array.isArray(t)||!t.some(n=>!!n&&typeof n=="object"&&n.key==="process")?["progressLayout: the layout must declare the `process` bus"]:YV(e)}s($R,"progressLayoutIssues");var RR=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var HV=new Set(["sections","effects","outcomes","testScenarios","env"]),tf={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 IR(e,t){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${t}: die Formulardefinition muss ein Objekt sein.`,en:`${t}: the form definition must be an object.`}];let n=[];for(let i of Object.keys(e)){if(HV.has(i))continue;let o=tf[i];n.push(o!==void 0?{de:`${t}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${t}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${t}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${t}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||n.push({de:`${t}: \`${i}\` muss eine Liste sein.`,en:`${t}: \`${i}\` must be a list.`});return n}s(IR,"smartFormDefinitionShapeIssues");var bn=["granted","rejected","waitlisted","other"];function Ai(e){return typeof e=="string"&&bn.includes(e)}s(Ai,"isOutcomeSemantic");var Wn=["arrival","manual"],OR={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function JV(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(JV,"literal");function Ug(e){let t=JV(e,"waitlistOrder");return Wn.includes(t)?{waitlistOrder:t}:null}s(Ug,"waitlistPolicyOrNull");var ht="responsible",Vg="team:";function nf(e){return`${Vg}${e}`}s(nf,"teamSlot");function rf(e){return e.startsWith(Vg)?e.slice(Vg.length):null}s(rf,"teamKeyOfSlot");function PR(e){return e.kind==="responsible"?ht:nf(e.groupKey)}s(PR,"slotIdOf");function of(e){if(e===ht)return{kind:"responsible"};let t=rf(e);return t===null||t.length===0?null:{kind:"team",groupKey:t}}s(of,"slotOfId");var Gg="review",zg="checkField",_R="reviewed",CR="reviewing",sf=["rejected","waitlisted"];function Wg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Wg,"isObject");var QV=new Set(["decision",Gg]),NR={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Yg(e){return Object.hasOwn(NR,e)?NR[e]:void 0}s(Yg,"legacySemanticOfId");function ZV(e){return e===Gg?bn.filter(t=>!sf.includes(t)):bn}s(ZV,"allowedSemanticsFor");var XV="other";function DR(e){return Wg(e)&&QV.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(DR,"outcomesOf");function FR(e){return(e?.nodes??[]).some(t=>DR(t).some(n=>Wg(n)&&!("semantic"in n)))}s(FR,"needsOutcomeSemantics");function LR(e,t={}){let n=[],r=[],i=[],o=e.nodes.map(a=>{let l=DR(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),f=ZV(u),m=!1,y=l.map(k=>{if(!Wg(k))return k;let g=String(k.id);if("semantic"in k)return Ai(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let v=`${c}.${g}`,A=Object.hasOwn(t,v)?t[v]:void 0;if(A!==void 0)return f.includes(A)?(n.push({nodeId:c,outcomeId:g,semantic:A,source:"answer"}),m=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f,answer:A}),k);let R=Yg(g),E=R??XV;return f.includes(E)?(n.push({nodeId:c,outcomeId:g,semantic:E,source:R===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f}),k)});return m?{...d,outcomes:y}:a});return n.length===0?{graph:e,written:n,refused:r,invalid:i}:{graph:{...e,nodes:o},written:n,refused:r,invalid:i}}s(LR,"addOutcomeSemantics");var fr="bewerbungOffen";function go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(go,"isObject");var Hg=["event","effect"];function MR(e){return go(e)&&e.type==="eventTrigger"}s(MR,"isTrigger");function qR(e){let t=go(e.inputs)?e.inputs:{};return"outcomes"in e||Hg.some(n=>n in e||n in t)}s(qR,"oldShape");function KR(e){return(e?.nodes??[]).some(t=>MR(t)&&qR(t))}s(KR,"needsEventTriggerStartMove");function eG(e){let t=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>go(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===fr))return{unmoved:{nodeId:t,reason:"outcomesNotStart"}};let i=Object.keys(go(e.next)?e.next:{});if(!(i.length===1&&i[0]===fr))return{unmoved:{nodeId:t,reason:"nextNotStart"}};let o=go(e.inputs)?{...e.inputs}:{};for(let l of Hg){let d=o[l];if(go(d)&&d.kind==="binding")return{unmoved:{nodeId:t,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Hg)delete a[l],delete o[l];return go(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(eG,"moveNode");function jR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!MR(i)||!qR(i))return i;let o=eG(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(jR,"moveEventTriggerStart");function sl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(sl,"isObject");var BR={waitlistOrder:"arrival"};function UR(e){return!sl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(sl(e.inputs)?e.inputs:{}))}s(UR,"lacksPolicy");function tG(e){return(e?.nodes??[]).some(UR)}s(tG,"needsWaitlistPolicyMove");function Jg(e){return sl(e)&&Wn.includes(e.waitlistOrder)}s(Jg,"isWaitlistPolicy");function nG(e){if(e===void 0)return{policy:BR,stated:!1};if(!sl(e))return"malformed";let t=e.waitlistOrder;return t!==void 0&&!Wn.includes(t)?"malformed":{policy:{waitlistOrder:t??BR.waitlistOrder},stated:t!==void 0}}s(nG,"policyOfSelection");function VR(e,t,n={}){let r=[],i=[];if(!tG(e))return{graph:e,moved:r,refused:i};let o=nG(t),a=e.nodes.map(l=>{if(!UR(l))return l;let d=l,c=String(d.id),u=sl(d.inputs)?{...d.inputs}:{},f=Object.hasOwn(n,c)?n[c]:void 0,m,y;if(f!==void 0)m=f,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},r.push({nodeId:c,policy:m,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(VR,"moveWaitlistPolicyToInputs");function yo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(yo,"isObject");var rG=[Lt,ho],iG=["inputSchema","parties","schemaDigest","parts"];function GR(e){return yo(e)&&e.type==="governedDocument"&&("resolver"in e||yo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(GR,"oldShape");function zR(e){return(e?.nodes??[]).some(GR)}s(zR,"needsGeneratorInputMove");function oG(e){let t=yo(e.inputs)?{...e.inputs}:{},n={...e},r;if("resolver"in e){let i=e.resolver;if(!yo(i))return{unmoved:"resolverNotObject"};if(Lt in t)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((yo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>yo(d)&&rG.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};t[Lt]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(iG.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(n.generatorStamp=l),r=i.cockpitFields,delete n.resolver}if(yo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ho in t)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};t[ho]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}n.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};n.cockpitFields=r}return n.inputs=t,{node:n}}s(oG,"moveNode");function WR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!GR(i))return i;let o=oG(i);return"unmoved"in o?(n.push({nodeId:String(i.id),reason:o.unmoved}),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(WR,"moveGeneratorPinsToInputs");var YR=/^\d{4}-\d{2}-\d{2}$/;function pr(e,t){return{de:e,en:t}}s(pr,"issue");function wo(e){if(typeof e!="object"||e===null)return pr("keine Reduktion","not a reduction");let t=e;if(t.kind==="none")return Object.keys(t).length===1?null:pr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(t.kind!=="amount")return pr(`unbekannte Art ${JSON.stringify(t.kind)}`,`unknown kind ${JSON.stringify(t.kind)}`);let{amount:n,activeFrom:r,activeTo:i}=t;return typeof n!="number"||!Number.isFinite(n)||n<=0?pr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((n*100).toFixed(6)))?typeof r!="string"||!YR.test(r)?pr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!YR.test(i)?pr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?pr("das Ende liegt vor dem Beginn","the end is before the start"):t.floorTotal!==void 0&&(typeof t.floorTotal!="number"||!Number.isSafeInteger(t.floorTotal)||t.floorTotal<0)?pr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):t.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(t.pricePeriod))?pr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(t).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?pr("unbekannte Angaben","unknown details"):null:pr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(wo,"reductionShapeIssue");function Ei(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.itemKey=="string"&&t.itemKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||wo(t.reduction)===null&&t.reduction.kind==="amount")}s(Ei,"isPricedItemValue");var ys=["freetext","recommendation","choice","pricedItem","record","reduction"],ws=[...ys,"appointment"];function JR(e){return typeof e=="string"&&ws.includes(e)}s(JR,"isTaskResultKind");function Ti(e){return typeof e=="string"&&ys.includes(e)}s(Ti,"isRecordedTaskResultKind");function ks(e){return Ti(e.kind)}s(ks,"isRecordedTaskResult");var af=["number","boolean","enum"];function Qg(e){return typeof e=="string"&&af.includes(e)}s(Qg,"isRecordFieldType");var Zg=["form","siblingRank"];var Zr={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 ko(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(ko,"isProseResult");function lf(e){return e.kind==="record"?(e.fields??[]).filter(t=>typeof t.writes=="string"&&t.writes.length>0&&Qg(t.type)).map(t=>({key:t.writes,valueType:t.type,field:t})):sG(e)}s(lf,"draftResultStoreWrites");function sG(e){let t=Zr[e.kind].valueType;return e.writes===void 0||t===null?[]:[{key:e.writes,valueType:t}]}s(sG,"singleStoreWrite");var HR="team:";function bs(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(HR)){let t=e.slice(HR.length);return t.length===0?null:{kind:"team",groupKey:t}}return{kind:"channel",channelKey:e}}s(bs,"parseTaskResultChat");var Ye={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]",filesOnKind:"[taskResult/filesOnKind]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var aG=new Set(["if","else","in","true","false","null"]),lG=new Set(["==","!=","<=",">=","&&","||"]);function dG(e){return e>="0"&&e<="9"}s(dG,"isDigit");function cG(e){return/[a-zA-Z_$]/.test(e)}s(cG,"isIdentStart");function uG(e){return/[a-zA-Z0-9_.$]/.test(e)}s(uG,"isIdentCont");function fG(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(r===" "||r===" "||r===`
10512
+ `};var Uu="ce2de206277140c6f8822e31eff2be7aee6a4c42da9893b3f395debf3f24143f",$g=Q$;var Rg=class extends Se{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:Uu,tools:el}),0}},Ig=class extends Se{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=p.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 t=JSON.parse(await Tg(this.context.stdin)),n=await this.context.executePlexusAgentTool(this.tool,t);return this.print(n),0}},Z$=[Rg,Ig];var Og=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Voe=new Set(Og.map(e=>e.key));function eR(e,t,n,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===t);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${t}" (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 ${t} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===n||l.runId===n);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${n}" 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(eR,"resolveStartTarget");function FV(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(FV,"applicantText");function tR(e){return e.map(t=>({id:t.application._id,status:t.deletedAt?`${t.application.status} (gel\xF6scht)`:t.application.status,state:t.currentProcessStateId??"",applicant:FV(t.applicantName),test:t.application.testMode===!0?"test":""}))}s(tR,"applicationRows");var X$=Og.map(e=>e.email);function nR(e,t,n,r){if(n===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(n!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(Sg(e,t)&&(r===void 0||!X$.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${X$.join(", ")} (--applicant) \u2014 never a real family's`)}s(nR,"assertStartApplicant");function rR(e){let t={};for(let{address:n,...r}of e.entries)t[n]=r;return{applicationId:e.applicationId,store:t}}s(rR,"processStoreJson");function LV(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.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(t=>`${t.partKey}: contract ${t.contractId} \xB7 ${t.revision===null?"keine Fassung":`Fassung ${t.revision.revisionNumber}`} \xB7 ${t.contractStatus}`).join("; ")}}s(LV,"refText");function MV(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?LV(e.ref):JSON.stringify(e.value)}s(MV,"holds");function iR(e){return e.entries.map(t=>({address:t.address,state:t.state,holds:MV(t),producer:t.producer?.label??"",written:t.writtenAt===void 0?"":new Date(t.writtenAt).toISOString()}))}s(iR,"storeRows");function Vu(e){let t={},n={};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(n,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);n[o]=a;try{t[o]=JSON.parse(a)}catch{t[o]=a}}return{values:t,raw:n}}s(Vu,"parseKv");var oR="started",Gu="submitted",zu="submitted",sR="load-scenario:";var aR="(Bewerbung)";function lR(e){return{nodeId:aR,actions:e.map(t=>({id:t.id,label:{de:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`,en:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`},...t.disabledReason===void 0?{}:{disabledReason:t.disabledReason}}))}}s(lR,"sharedAsList");function dR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(dR,"disabledText");function cR(e){return e.flatMap(({nodeId:t,actions:n})=>n.map(r=>({node:t,action:r.id,label:r.label.de,disabled:dR(r)})))}s(cR,"actionRows");function uR(e,t,n=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===t));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 "${t}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${t}" 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===t);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${t}" on ${i} is disabled: ${dR(a)}`);if(i!==aR)return i;let l=n[0];if(l===void 0)throw new Error(`test-actions run: "${t}" needs a current node \u2014 the application has none`);return l}s(uR,"nodeOfferingAction");function fR(e,t,n){if(e.startsWith(sR)){if(Object.hasOwn(n,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:t,...n}}return Object.keys(n).length===0?void 0:{...n}}s(fR,"runParams");async function qV(e,t){let n=await e.query(x.workflow.getInstance,{applicationId:t});if(n===null)throw new Error(`test-actions: application ${t} has no workflow instance`);return n.instance.currentNodeIds}s(qV,"currentNodeIds");function KV(e,t){switch(t){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${t} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(KV,"refusalText");async function Wu(e,t,n){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:t});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${KV(t,r.reason)}`);let i=[];for(let o of n){let a=await e.query(x.workflow.listTestActions,{applicationId:t,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,lR(r.actions)]}s(Wu,"actionsOf");async function pR(e,t,n){return n!==void 0?[n]:await qV(e,t)}s(pR,"nodesOf");var Pg=class extends C{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=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let t=await this.caller(),n=await Wu(t,this.application,await pR(t,this.application,this.node));return this.print(n,cR,["node","action","label","disabled"]),0}},_g=class extends C{static{s(this,"TestActionsRunCommand")}application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.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=p.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=p.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=p.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 t=fR(this.action,this.autoSubmit,Vu(this.param??[]).values),n=await this.caller(),r=this.application,i=await pR(n,this.application,this.node),o=uR(await Wu(n,r,i),this.action,i);return await n.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...t===void 0?{}:{params:t}}),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}},mR=[Pg,_g];var ze=["de","en"];function fs(e,t){return ze.every(n=>e[n]===t[n])}s(fs,"sameText");function Et(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let t=e;return Object.keys(t).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=t[r];return typeof i!="string"||i.trim()===""})}s(Et,"missingLocales");function xi(e){let t=Et(e);return t!=="not-localized"&&t.length===0}s(xi,"isLocalizedText");function tl(e,t){let n={};for(let r of ze){let i=e.map(o=>o[r]);n[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?t(i,r):""}return n}s(tl,"composeTexts");var dr=/^[a-z][A-Za-z0-9]*$/;function Cg(e){return typeof e=="string"&&dr.test(e)}s(Cg,"isNodeId");function ps(e,t){Cg(e)||N(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${dr.source}.`);let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}s(ps,"makeNodeId");var Si="$env";function se(e){if(e.scope==="env")return`${Si}.${e.key}`;let t=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?t:`${t}.${e.path}`}s(se,"formatAddress");var Or=/^[a-z][a-zA-Z0-9_]*$/,jV=/^[A-Za-z_][A-Za-z0-9_]*$/;function po(e){return typeof e=="string"&&e.split(".").every(t=>jV.test(t))}s(po,"isPath");function Yr(e){if(!e.startsWith("$"))return null;let t=e.slice(1).split("."),[n,...r]=t;switch(n){case"env":{let i=r.join(".");return r.length>0&&po(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Or.test(i)?null:hR({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Or.test(o)||(n==="node"?!dr.test(i):!Or.test(i))?null:hR({scope:n,owner:i,key:o},a)}default:return null}}s(Yr,"tryParseAddress");function hR(e,t){if(t.length===0)return e;let n=t.join(".");return po(n)?{...e,path:n}:null}s(hR,"withPath");function ve(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=t.scope==="env"?["scope","key"]:t.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(t).some(r=>!n.includes(r))||t.path!==void 0&&!po(t.path))return!1;switch(t.scope){case"env":return po(t.key);case"derived":return typeof t.key=="string"&&Or.test(t.key);case"node":return typeof t.owner=="string"&&dr.test(t.owner)&&typeof t.key=="string"&&Or.test(t.key);case"task":return typeof t.owner=="string"&&Or.test(t.owner)&&typeof t.key=="string"&&Or.test(t.key);default:return!1}}s(ve,"isAddress");var Hr={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"}},ms=Object.keys(Hr);function hs(e){return Object.hasOwn(Hr,e)}s(hs,"isEnvKey");var BV=["self-service","staff"];function gR(e,t){return{kind:"fixed",values:e,labels:t}}s(gR,"fixedSet");var Yu={of:"applicant.language",withoutValue:"de"},Jr={"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:Yu},"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:Yu},"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:Yu},"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:Yu},"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:gR(ze,{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:gR(BV,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Hu={types:Hr,fields:Jr},Ju=ms.flatMap(e=>Object.keys(Hr[e]).map(t=>`${e}.${t}`));function cr(e){return Object.hasOwn(Jr,e)}s(cr,"isEnvLeaf");function Qu(e){return`${Si}.${e}`}s(Qu,"envIdentifier");function mo(e){let t=Jr[e],[n,r]=e.split("."),i=Hr[n][r];i===void 0&&N(`[env] leaf "${e}" has no type`);let o=t.valueSet;return{leaf:e,type:i,label:t.label,nullable:t.nullable,...t.absent===void 0?{}:{absent:t.absent},...t.nameLanguage===void 0?{}:{nameLanguage:t.nameLanguage},...t.cohortBound===void 0?{}:{cohortBound:t.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&N(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(mo,"envLeaf");var yR="staffInput";var UV=["boolean"],nl=/^[a-z][A-Za-z0-9]*$/;function Zu(e){return e.staffInputs??[]}s(Zu,"staffInputsOf");function Xu(e){return`${yR}.${e}`}s(Xu,"staffInputLeaf");function wR(e){return`${Si}.${Xu(e)}`}s(wR,"staffInputIdentifier");function VV(e){let t=`${yR}.`;return e.startsWith(t)?e.slice(t.length):null}s(VV,"staffInputKeyOfLeaf");function rl(e,t){let n=VV(t);return n===null?void 0:Zu(e).find(r=>r.key===n)}s(rl,"declaredStaffInput");function GV(e){return[...Zu(e).map(t=>({leaf:Xu(t.key),type:t.type,label:t.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Ju.map(t=>{let n=mo(t);return{leaf:t,type:n.type,label:n.label,valueSet:Jr[t].valueSet,nullable:n.nullable,cohortBound:n.cohortBound===!0}})]}s(GV,"envLeavesFor");function kR(e){return GV(e).filter(t=>!t.cohortBound)}s(kR,"conditionEnvLeaves");function bR(e){let t={},n={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of kR(e)){let[l="",d=""]=r.split(".");t[l]={...t[l]??{},[d]:i},n[r]={valueSet:o,nullable:a}}return{types:t,fields:n}}s(bR,"envConditionSchemaFor");function vR(e){let t=e.staffInputs;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let n=[],r=new Set;return t.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){n.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}"`};nl.test(l.key)||n.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)&&n.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),UV.includes(l.type)||n.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=Et(l.label);c==="not-localized"?n.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&&n.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(", ")}.`}})}),n}s(vR,"staffInputIssues");var Bg={required:!0,description:"Offer slug (its offerKey)"},Ng=class extends C{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=p.String("--offer",Bg);testOnly=p.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let t=await this.caller(),n=await t.query(x.admission.listForAngebot,{client:this.requireTenant(t),offerKey:this.offer}),r=tR(n).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},Dg=class extends C{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=p.String("--offer",Bg);async execute(){let t=await this.caller(),n=await t.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(t),offerKey:this.offer});return this.print(n,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},Fg=class extends C{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=p.String({required:!0});async execute(){let t=await this.caller(),n=this.application,r=await t.query(x.admission.get,{applicationId:n});if(r===null)throw new Error(`applications show: no application ${n} (or not visible to you)`);let i=await t.query(x.workflow.getInstance,{applicationId:n});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:n},{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}},Lg=class extends C{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, $derived\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=p.String({required:!0});async execute(){let n=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(rR(n),()=>iR(n),["address","state","holds","producer","written"]),0}},Mg=class extends C{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=p.String("--offer",Bg);run=p.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=p.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=p.String("--party",{description:"Applicant party id"});applicant=p.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=p.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=p.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=p.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 t=await this.caller();nR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let n=this.requireTenant(t),r=eR(await t.query(x.admission.listAdmissionTree,{client:n}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await t.query(x.applicants.partyByEmail,{client:n,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 t.mutation(x.admission.staffStartApplicationForParty,{client:n,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:SR(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await t.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 Wu(t,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}},qg=class extends C{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)"});application=p.String({required:!0});async execute(){return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},n=>[{key:"discarded",value:n.discarded}]),0}},Kg=class extends C{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=p.String({required:!0});async execute(){let n=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(n,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}},jg=class extends C{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=p.String({required:!0});input=p.String("--input",{required:!0,description:"key=true|false"});reason=p.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let t=await this.caller(),[{key:n,value:r}]=SR([this.input]);return await t.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:n,value:r,reason:this.reason}),this.print({application:this.application,key:n,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},xR=[Ng,Dg,Fg,Lg,Mg,qg,Kg,jg];function SR(e){return e.map(t=>{let[n="",r,...i]=t.split("=");if(!nl.test(n)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${t}": expected key=true or key=false`);return{key:n,value:r==="true"}})}s(SR,"parseStaffInputs");var Lt="contractGenerator",ho="documentTemplate";function il(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return(t.kind==="generator"||t.kind==="package")&&typeof t.key=="string"&&t.key.length>0&&(t.revision===void 0||typeof t.revision=="number"&&Number.isInteger(t.revision)&&t.revision>0)&&n.every(r=>r==="kind"||r==="key"||r==="revision")}s(il,"isGeneratorRef");function AR(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(AR,"literalOf");function Qr(e){let t=AR(e,Lt);return il(t)?t:null}s(Qr,"generatorRefOfNode");function ur(e){let t=AR(e,ho);return typeof t=="string"&&t.length>0?t:null}s(ur,"documentTemplateKeyOfNode");function ER(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(ER,"generatorRefLabel");var zV=["formExports","generatorStamp"];function TR(e,t,n){let r=e.inputs?.[Lt];(r?.kind!=="literal"||!il(r.value))&&N(`applyGeneratorStamp: the node names no generator in inputs.${Lt} \u2014 a stamp derives from it`),n.freezeRevision&&t.revision!==void 0&&(e.inputs[Lt]={kind:"literal",value:{...r.value,revision:t.revision}}),e.generatorStamp={inputSchema:t.inputSchema,parties:t.parties,schemaDigest:t.schemaDigest,...t.parts===void 0?{}:{parts:t.parts}}}s(TR,"applyGeneratorStamp");var WV=["reads"];function gs(e){if(e===null||typeof e!="object")return e;let t={...e};return Array.isArray(t.nodes)&&(t.nodes=t.nodes.map(n=>{if(n===null||typeof n!="object")return n;let r={...n};for(let i of zV)delete r[i];for(let i of WV)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),t}s(gs,"comparableWorkflowGraph");var ol={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 ef(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(t=>{let n=ol[t];return n!==void 0?`manifest: \`${t}\` is no longer part of manifest.json (${n.en}). Delete the line.`:`manifest: unknown key \`${t}\` \u2014 manifest.json carries no key.`})}s(ef,"manifestIssues");function YV(e){let t=[],n=e.buses;if(!Array.isArray(n))return t;let r=n.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return t;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:"?";t.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return t}s(YV,"validateProgressLayoutExternalCopy");function $R(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let t=e.buses;return!Array.isArray(t)||!t.some(n=>!!n&&typeof n=="object"&&n.key==="process")?["progressLayout: the layout must declare the `process` bus"]:YV(e)}s($R,"progressLayoutIssues");var RR=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var HV=new Set(["sections","effects","outcomes","testScenarios","env"]),tf={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 IR(e,t){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${t}: die Formulardefinition muss ein Objekt sein.`,en:`${t}: the form definition must be an object.`}];let n=[];for(let i of Object.keys(e)){if(HV.has(i))continue;let o=tf[i];n.push(o!==void 0?{de:`${t}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${t}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${t}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${t}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||n.push({de:`${t}: \`${i}\` muss eine Liste sein.`,en:`${t}: \`${i}\` must be a list.`});return n}s(IR,"smartFormDefinitionShapeIssues");var bn=["granted","rejected","waitlisted","other"];function Ai(e){return typeof e=="string"&&bn.includes(e)}s(Ai,"isOutcomeSemantic");var Wn=["arrival","manual"],OR={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function JV(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(JV,"literal");function Ug(e){let t=JV(e,"waitlistOrder");return Wn.includes(t)?{waitlistOrder:t}:null}s(Ug,"waitlistPolicyOrNull");var ht="responsible",Vg="team:";function nf(e){return`${Vg}${e}`}s(nf,"teamSlot");function rf(e){return e.startsWith(Vg)?e.slice(Vg.length):null}s(rf,"teamKeyOfSlot");function PR(e){return e.kind==="responsible"?ht:nf(e.groupKey)}s(PR,"slotIdOf");function of(e){if(e===ht)return{kind:"responsible"};let t=rf(e);return t===null||t.length===0?null:{kind:"team",groupKey:t}}s(of,"slotOfId");var Gg="review",zg="checkField",_R="reviewed",CR="reviewing",sf=["rejected","waitlisted"];function Wg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Wg,"isObject");var QV=new Set(["decision",Gg]),NR={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Yg(e){return Object.hasOwn(NR,e)?NR[e]:void 0}s(Yg,"legacySemanticOfId");function ZV(e){return e===Gg?bn.filter(t=>!sf.includes(t)):bn}s(ZV,"allowedSemanticsFor");var XV="other";function DR(e){return Wg(e)&&QV.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(DR,"outcomesOf");function FR(e){return(e?.nodes??[]).some(t=>DR(t).some(n=>Wg(n)&&!("semantic"in n)))}s(FR,"needsOutcomeSemantics");function LR(e,t={}){let n=[],r=[],i=[],o=e.nodes.map(a=>{let l=DR(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),f=ZV(u),m=!1,y=l.map(k=>{if(!Wg(k))return k;let g=String(k.id);if("semantic"in k)return Ai(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let v=`${c}.${g}`,A=Object.hasOwn(t,v)?t[v]:void 0;if(A!==void 0)return f.includes(A)?(n.push({nodeId:c,outcomeId:g,semantic:A,source:"answer"}),m=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f,answer:A}),k);let R=Yg(g),E=R??XV;return f.includes(E)?(n.push({nodeId:c,outcomeId:g,semantic:E,source:R===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f}),k)});return m?{...d,outcomes:y}:a});return n.length===0?{graph:e,written:n,refused:r,invalid:i}:{graph:{...e,nodes:o},written:n,refused:r,invalid:i}}s(LR,"addOutcomeSemantics");var fr="bewerbungOffen";function go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(go,"isObject");var Hg=["event","effect"];function MR(e){return go(e)&&e.type==="eventTrigger"}s(MR,"isTrigger");function qR(e){let t=go(e.inputs)?e.inputs:{};return"outcomes"in e||Hg.some(n=>n in e||n in t)}s(qR,"oldShape");function KR(e){return(e?.nodes??[]).some(t=>MR(t)&&qR(t))}s(KR,"needsEventTriggerStartMove");function eG(e){let t=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>go(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===fr))return{unmoved:{nodeId:t,reason:"outcomesNotStart"}};let i=Object.keys(go(e.next)?e.next:{});if(!(i.length===1&&i[0]===fr))return{unmoved:{nodeId:t,reason:"nextNotStart"}};let o=go(e.inputs)?{...e.inputs}:{};for(let l of Hg){let d=o[l];if(go(d)&&d.kind==="binding")return{unmoved:{nodeId:t,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Hg)delete a[l],delete o[l];return go(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(eG,"moveNode");function jR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!MR(i)||!qR(i))return i;let o=eG(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(jR,"moveEventTriggerStart");function sl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(sl,"isObject");var BR={waitlistOrder:"arrival"};function UR(e){return!sl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(sl(e.inputs)?e.inputs:{}))}s(UR,"lacksPolicy");function tG(e){return(e?.nodes??[]).some(UR)}s(tG,"needsWaitlistPolicyMove");function Jg(e){return sl(e)&&Wn.includes(e.waitlistOrder)}s(Jg,"isWaitlistPolicy");function nG(e){if(e===void 0)return{policy:BR,stated:!1};if(!sl(e))return"malformed";let t=e.waitlistOrder;return t!==void 0&&!Wn.includes(t)?"malformed":{policy:{waitlistOrder:t??BR.waitlistOrder},stated:t!==void 0}}s(nG,"policyOfSelection");function VR(e,t,n={}){let r=[],i=[];if(!tG(e))return{graph:e,moved:r,refused:i};let o=nG(t),a=e.nodes.map(l=>{if(!UR(l))return l;let d=l,c=String(d.id),u=sl(d.inputs)?{...d.inputs}:{},f=Object.hasOwn(n,c)?n[c]:void 0,m,y;if(f!==void 0)m=f,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},r.push({nodeId:c,policy:m,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(VR,"moveWaitlistPolicyToInputs");function yo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(yo,"isObject");var rG=[Lt,ho],iG=["inputSchema","parties","schemaDigest","parts"];function GR(e){return yo(e)&&e.type==="governedDocument"&&("resolver"in e||yo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(GR,"oldShape");function zR(e){return(e?.nodes??[]).some(GR)}s(zR,"needsGeneratorInputMove");function oG(e){let t=yo(e.inputs)?{...e.inputs}:{},n={...e},r;if("resolver"in e){let i=e.resolver;if(!yo(i))return{unmoved:"resolverNotObject"};if(Lt in t)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((yo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>yo(d)&&rG.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};t[Lt]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(iG.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(n.generatorStamp=l),r=i.cockpitFields,delete n.resolver}if(yo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ho in t)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};t[ho]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}n.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};n.cockpitFields=r}return n.inputs=t,{node:n}}s(oG,"moveNode");function WR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!GR(i))return i;let o=oG(i);return"unmoved"in o?(n.push({nodeId:String(i.id),reason:o.unmoved}),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(WR,"moveGeneratorPinsToInputs");var YR=/^\d{4}-\d{2}-\d{2}$/;function pr(e,t){return{de:e,en:t}}s(pr,"issue");function wo(e){if(typeof e!="object"||e===null)return pr("keine Reduktion","not a reduction");let t=e;if(t.kind==="none")return Object.keys(t).length===1?null:pr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(t.kind!=="amount")return pr(`unbekannte Art ${JSON.stringify(t.kind)}`,`unknown kind ${JSON.stringify(t.kind)}`);let{amount:n,activeFrom:r,activeTo:i}=t;return typeof n!="number"||!Number.isFinite(n)||n<=0?pr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((n*100).toFixed(6)))?typeof r!="string"||!YR.test(r)?pr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!YR.test(i)?pr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?pr("das Ende liegt vor dem Beginn","the end is before the start"):t.floorTotal!==void 0&&(typeof t.floorTotal!="number"||!Number.isSafeInteger(t.floorTotal)||t.floorTotal<0)?pr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):t.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(t.pricePeriod))?pr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(t).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?pr("unbekannte Angaben","unknown details"):null:pr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(wo,"reductionShapeIssue");function Ei(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.itemKey=="string"&&t.itemKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||wo(t.reduction)===null&&t.reduction.kind==="amount")}s(Ei,"isPricedItemValue");var ys=["freetext","recommendation","choice","pricedItem","record","reduction"],ws=[...ys,"appointment"];function JR(e){return typeof e=="string"&&ws.includes(e)}s(JR,"isTaskResultKind");function Ti(e){return typeof e=="string"&&ys.includes(e)}s(Ti,"isRecordedTaskResultKind");function ks(e){return Ti(e.kind)}s(ks,"isRecordedTaskResult");var af=["number","boolean","enum"];function Qg(e){return typeof e=="string"&&af.includes(e)}s(Qg,"isRecordFieldType");var Zg=["form","siblingRank"];var Zr={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 ko(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(ko,"isProseResult");function lf(e){return e.kind==="record"?(e.fields??[]).filter(t=>typeof t.writes=="string"&&t.writes.length>0&&Qg(t.type)).map(t=>({key:t.writes,valueType:t.type,field:t})):sG(e)}s(lf,"draftResultStoreWrites");function sG(e){let t=Zr[e.kind].valueType;return e.writes===void 0||t===null?[]:[{key:e.writes,valueType:t}]}s(sG,"singleStoreWrite");var HR="team:";function bs(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(HR)){let t=e.slice(HR.length);return t.length===0?null:{kind:"team",groupKey:t}}return{kind:"channel",channelKey:e}}s(bs,"parseTaskResultChat");var Ye={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]",filesOnKind:"[taskResult/filesOnKind]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var aG=new Set(["if","else","in","true","false","null"]),lG=new Set(["==","!=","<=",">=","&&","||"]);function dG(e){return e>="0"&&e<="9"}s(dG,"isDigit");function cG(e){return/[a-zA-Z_$]/.test(e)}s(cG,"isIdentStart");function uG(e){return/[a-zA-Z0-9_.$]/.test(e)}s(uG,"isIdentCont");function fG(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(r===" "||r===" "||r===`
10513
10513
  `||r==="\r"){n++;continue}if(r==="'"){let o=n+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&&N(`Unterminated string at ${n}`),t.push({t:"str",v:a}),n=o+1;continue}if(dG(r)){let o=n;for(;o<e.length&&/[0-9.]/.test(e.charAt(o));)o++;t.push({t:"num",v:Number(e.slice(n,o))}),n=o;continue}if(cG(r)){let o=n;for(;o<e.length&&uG(e.charAt(o));)o++;let a=e.slice(n,o);aG.has(a)?t.push({t:"kw",v:a}):t.push({t:"ident",v:a}),n=o;continue}let i=e.slice(n,n+2);if(lG.has(i)){t.push({t:"op",v:i}),n+=2;continue}if("<>!".includes(r)){t.push({t:"op",v:r}),n++;continue}if("()[],".includes(r)){t.push({t:"punct",v:r}),n++;continue}N(`Unexpected char '${r}' at ${n}`)}return t}s(fG,"tokenise");var QR=1e4,ZR=128;function vs(e){e.depth++,e.depth>ZR&&N(`Expression nesting too deep (> ${ZR})`)}s(vs,"enterDepth");function iI(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(iI,"peek");function Mt(e){let t=e.tokens[e.pos];return t||N(`Unexpected end at ${e.pos}`),e.pos++,t}s(Mt,"take");function qt(e,t,n){let r=iI(e);return!(!r||r.t!==t||n!==void 0&&r.v!==n)}s(qt,"match");function bo(e,t,n){return qt(e,t,n)||N(`Expected ${t}${n?`:${n}`:""} at ${e.pos}`),Mt(e)}s(bo,"expect");function ei(e){vs(e);try{return qt(e,"kw","if")?pG(e):mG(e)}finally{e.depth--}}s(ei,"parseExpr");function pG(e){bo(e,"kw","if"),bo(e,"punct","(");let t=ei(e);bo(e,"punct",")");let n=ei(e);bo(e,"kw","else");let r=ei(e);return{kind:"if",cond:t,then:n,else:r}}s(pG,"parseIf");function mG(e){let t=XR(e),n=0;try{for(;qt(e,"op","||");){Mt(e),vs(e),n++;let r=XR(e);t={kind:"binary",op:"||",left:t,right:r}}}finally{e.depth-=n}return t}s(mG,"parseLogicOr");function XR(e){let t=eI(e),n=0;try{for(;qt(e,"op","&&");){Mt(e),vs(e),n++;let r=eI(e);t={kind:"binary",op:"&&",left:t,right:r}}}finally{e.depth-=n}return t}s(XR,"parseLogicAnd");function eI(e){let t=tI(e),n=0;try{for(;qt(e,"op","==")||qt(e,"op","!=");){let r=Mt(e).v;vs(e),n++;let i=tI(e);t={kind:"binary",op:r,left:t,right:i}}}finally{e.depth-=n}return t}s(eI,"parseEquality");function tI(e){let t=ey(e),n=0;try{for(;qt(e,"op","<")||qt(e,"op","<=")||qt(e,"op",">")||qt(e,"op",">=")||qt(e,"kw","in");){let r=Mt(e),i=r.t==="kw"?"in":r.v;vs(e),n++;let o=ey(e);t={kind:"binary",op:i,left:t,right:o}}}finally{e.depth-=n}return t}s(tI,"parseCompare");function ey(e){if(qt(e,"op","!")){Mt(e),vs(e);try{return{kind:"unary",op:"!",operand:ey(e)}}finally{e.depth--}}return hG(e)}s(ey,"parseUnary");function hG(e){let t=iI(e);if(t||N("Unexpected end"),t.t==="num")return Mt(e),{kind:"num",value:t.v};if(t.t==="str")return Mt(e),{kind:"str",value:t.v};if(t.t==="kw"&&t.v==="true")return Mt(e),{kind:"bool",value:!0};if(t.t==="kw"&&t.v==="false")return Mt(e),{kind:"bool",value:!1};if(t.t==="kw"&&t.v==="null")return Mt(e),{kind:"null"};if(t.t==="punct"&&t.v==="("){Mt(e);let n=ei(e);return bo(e,"punct",")"),n}if(t.t==="punct"&&t.v==="["){Mt(e);let n=[];if(!qt(e,"punct","]"))for(n.push(ei(e));qt(e,"punct",",");)Mt(e),n.push(ei(e));return bo(e,"punct","]"),{kind:"arr",items:n}}if(t.t==="ident"){let n=t.v;if(Mt(e),qt(e,"punct","(")){Mt(e);let r=[];if(!qt(e,"punct",")"))for(r.push(ei(e));qt(e,"punct",",");)Mt(e),r.push(ei(e));return bo(e,"punct",")"),{kind:"call",name:n,args:r}}return{kind:"ident",path:n}}N(`Unexpected token at ${e.pos}`)}s(hG,"parsePrimary");function Kt(e){e.length>QR&&N(`Expression too long (${e.length} > ${QR})`);let t={tokens:fG(e),pos:0,depth:0},n=ei(t);return t.pos<t.tokens.length&&N(`Unexpected trailing token at ${t.pos}`),n}s(Kt,"parseExpression");var gG=new Map([["today",()=>new Date().toISOString().slice(0,10)],["years_between",(e,t)=>{if(typeof e!="string"||typeof t!="string")return null;let n=new Date(e),r=new Date(t);if(isNaN(n.getTime())||isNaN(r.getTime()))return null;let i=r.getFullYear()-n.getFullYear(),o=r.getMonth()-n.getMonth();return(o<0||o===0&&r.getDate()<n.getDate())&&i--,i}],["length",e=>typeof e=="string"||Array.isArray(e)?e.length:0]]);function gt(e,t){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 n=Object.hasOwn(t.values,e.path)?t.values[e.path]:void 0;return n===void 0?null:n}case"arr":return e.items.map(n=>gt(n,t));case"unary":{let n=gt(e.operand,t);return!$i(n)}case"call":{let n=t.functions!==void 0&&Object.hasOwn(t.functions,e.name)?t.functions[e.name]:gG.get(e.name);n||N(`Unknown function '${e.name}'`);let r=e.args.map(i=>gt(i,t));return n(...r)}case"binary":return yG(e.op,e.left,e.right,t);case"if":return $i(gt(e.cond,t))?gt(e.then,t):gt(e.else,t)}}s(gt,"evaluate");function yG(e,t,n,r){if(e==="&&"){let a=gt(t,r);return $i(a)?$i(gt(n,r)):!1}if(e==="||"){let a=gt(t,r);return $i(a)?!0:$i(gt(n,r))}let i=gt(t,r),o=gt(n,r);switch(e){case"==":return Xg(i,o);case"!=":return!Xg(i,o);case"<":{let[a,l]=df(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=df(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=df(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=df(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>Xg(a,i)):!1}}s(yG,"evalBinary");function df(e,t){return[nI(e),nI(t)]}s(df,"orderedOperands");function nI(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"){if(e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}return null}s(nI,"numericOperand");function Xg(e,t){return e===t?!0:e==null||t==null?!1:typeof e=="number"&&typeof t=="string"?e===Number(t):typeof e=="string"&&typeof t=="number"?Number(e)===t:!1}s(Xg,"looseEq");function $i(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s($i,"truthy");function kt(e){let t=new Set;return Xr(e,t),[...t]}s(kt,"dependencies");function Xr(e,t){switch(e.kind){case"ident":t.add(e.path);return;case"call":e.args.forEach(n=>Xr(n,t));return;case"arr":e.items.forEach(n=>Xr(n,t));return;case"unary":Xr(e.operand,t);return;case"binary":Xr(e.left,t),Xr(e.right,t);return;case"if":Xr(e.cond,t),Xr(e.then,t),Xr(e.else,t);return;default:return}}s(Xr,"walk");var rI=new Map;function mr(e){let t=rI.get(e);return t||(t=Kt(e),rI.set(e,t)),t}s(mr,"parseCached");function wG(e,t){return gt(mr(e),t)}s(wG,"evalExpression");function oI(e,t){return $i(wG(e,t))}s(oI,"evalBoolean");function cf(e){let t=e.pricingRules;return t===void 0?[]:(Array.isArray(t)||N("graph.pricingRules must be an array \u2014 the graph validator refuses anything else"),t)}s(cf,"pricingRuleSets");function ty(e){return e.derive!==void 0}s(ty,"isDerivedKey");function kG(e,t){let n=cf(e);return(t.rules??[]).map(r=>{let i=n.find(o=>o.key===r);return i===void 0&&N(`[process] derivation names the unknown rule set "${r}" \u2014 publish refuses that`),i})}s(kG,"ruleSetsOfDerivation");function aI(e){return[...new Set(e.rows.flatMap(t=>kt(mr(t.when))))]}s(aI,"ruleSetDependencies");function lI(e){let t=Yr(e);return t!==null&&se(t)===e?t:null}s(lI,"ruleIdentifierAddress");function ny(e,t){let r=[...new Set(kG(e,t).flatMap(aI))].map(o=>{let a=lI(o);return a===null&&N(`[address/bareIdentifier] rule identifier "${o}" is no address \u2014 publish refuses that`),{address:a,id:o,role:"rule"}}),i=t.reduction;return i===void 0?r:(ve(i)||N(`[address/bareIdentifier] derive.reduction ${JSON.stringify(i)} is no address \u2014 publish refuses that`),[...r,{address:i,id:se(i),role:"reduction"}])}s(ny,"derivationSources");function dI(e,t){let n=cf(e);for(let r of t.rules??[]){let i=n.find(o=>o.key===r);if(i===void 0||i.rows.some(o=>al(o.when)!==null)||aI(i).some(o=>lI(o)===null))return null}return t.reduction!==void 0&&!ve(t.reduction)?null:ny(e,t)}s(dI,"draftDerivationSources");function al(e){if(typeof e!="string"||e.trim().length===0)return"leere Bedingung";try{return mr(e),null}catch(t){return t instanceof Error?t.message:String(t)}}s(al,"conditionIssue");function sI(e){return e.item!==void 0&&e.group===void 0?{kind:"item",key:e.item}:e.group!==void 0&&e.item===void 0?{kind:"group",key:e.group}:null}s(sI,"rowTarget");function ry(e){if(e.byStage===void 0){let t=sI(e);return t===null?[]:[{...t,stages:null}]}return e.item!==void 0||e.group!==void 0?[]:e.byStage.flatMap(t=>{let n=sI(t);return n===null?[]:[{...n,stages:t.stages}]})}s(ry,"derivationTargets");function cI(e,t){t!==null&&(typeof t=="object"||typeof t=="function")&&Object.hasOwn(t,"exports")&&N(`[workflow/registry] node type "${e}": custom spec.exports is unsupported; use artifact-slot exports.`)}s(cI,"assertNoCustomNodeExports");var iy=null;function uI(e){for(let[t,n]of Object.entries(e))cI(t,n);iy=e}s(uI,"setSpecs");function fI(){return iy||N("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),iy}s(fI,"requireSpecs");function He(e){let t=fI(),n=t[e.type];return n===void 0&&ae("INVALID",{de:`[workflow/registry] Unbekannter Knotentyp "${String(e.type)}" (Knoten "${String(e.id)}"). Registrierte Typen: ${Object.keys(t).sort().join(", ")}.`,en:`[workflow/registry] Unknown node type "${String(e.type)}" (node "${String(e.id)}"). Registered types: ${Object.keys(t).sort().join(", ")}.`}),n}s(He,"specFor");function pI(){return Object.keys(fI()).sort()}s(pI,"registeredNodeTypes");var mI=Ju.filter(e=>Jr[e].cohortBound!==!0);function oy(e){return cr(e)&&Jr[e].cohortBound!==!0}s(oy,"isEnvAddressLeaf");function sy(e){return mo(e).type}s(sy,"envType");function ay(e){return mo(e).label}s(ay,"envLabel");function uf(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};case"derived":return{scope:"derived",key:e.key}}}s(uf,"addressBase");function xs(e){return e.scope==="node"&&e.key===nn&&e.path===void 0}s(xs,"isInstanceAddress");function lt(e){return ve(e)&&e.scope==="node"&&e.key===nn&&e.path!==void 0}s(lt,"isFormFieldAddress");function hI(e){return lt(e)?{owner:e.owner,path:e.path}:null}s(hI,"formFieldOf");function ly(e){return kt(mr(e)).map(t=>{if(!t.startsWith("$"))return{identifier:t,address:null,reason:"bareIdentifier"};let n=Yr(t);return n===null?{identifier:t,address:null,reason:"shape"}:{identifier:t,address:n}})}s(ly,"expressionAddresses");var nn="admission",ul="document",Ss="contract",As="contracts",gI="payment",dy=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var cn={id:"identity",type:"identity",label:"display",sublabel:"display",library:"display",outcomes:"control",outputLabels:"display",inputs:"input",next:"control",tasks:"config",assign:"reference",optionalActions:"config",artifacts:"config",notifications:"config"},ole={join:{...cn},end:{...cn},eventTrigger:{...cn},form:{...cn,adoptForm:"address",formExports:"stamp"},roleAssign:{...cn},setFlag:{...cn},if:{...cn,condition:"address"},countersign:{...cn,contract:"address",titles:"display",signing:"config"},engagePush:{...cn,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...cn,commentRequired:"config",decisionAsTask:"config",reads:"address",requiresOneOf:"config"},review:{...cn,reads:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...cn},completenessCheck:{...cn,requires:"address",deadline:"config"},collectPayment:{...cn},governedDocument:{...cn,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 Pr(e){return Array.isArray(e)?e:[]}s(Pr,"listOf");function jt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(jt,"record");function yI(e){switch(e.type){case"countersign":return["contract"];case"engagePush":return["form","contract","payment"];case"governedDocument":return e.production==="resolver"?["form"]:[];default:return[]}}s(yI,"dataSourceFieldsOf");function wI(e){return e.type==="engagePush"?["form"]:yI(e)}s(wI,"requiredDataSourceFields");var bG={setFlag:{target:"setFlagTarget"}};function fl(e,t={}){let n=[],r=e,i=`nodes.${e.id}`,o=s((d,c,u,f={})=>{n.push({kind:d,at:c,nodeId:e.id,value:u,judgedTogether:null,...f})},"field"),a=new Map(t.slotTypes===!1?[]:(He(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=bG[e.type]??{};for(let[d,c]of Object.entries(jt(r.inputs)??{})){let u=jt(c);if(u?.kind!=="binding")continue;let f="address"in u?u.address:u.path,m=l[d];if(m!==void 0){o(m,`${i}.inputs.${d}`,f);continue}let y=a.get(d);o("binding",`${i}.inputs.${d}`,f,y!==void 0?{expectedType:y}:{})}for(let[d,c]of Pr(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of Pr(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 yI(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 Pr(r.tasks).entries())n.push(...kI(e.id,c,d));return n}s(fl,"nodeAddressFields");function kI(e,t,n){let r=jt(t);if(r===null)return[];let i=[],o=typeof r.key=="string"?r.key:String(n),a=`nodes.${e}.tasks.${o}`,l=s((f,m,y,k={})=>{i.push({kind:f,at:m,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[f,m]of Pr(r.reads).entries())l("taskReads",`${a}.reads.${f}`,m,{judgedTogether:d});for(let[f,m]of Pr(r.documents).entries()){let y=jt(m);y===null||y.kind==="artifact"||l("taskDocument",`${a}.documents.${f}`,"address"in y?y.address:y.key)}let c=jt(r.familyRequest);if(c!==null){for(let[f,m]of Pr(c.fields).entries())l("familyRequestFields",`${a}.familyRequest.fields.${f}`,m,{judgedTogether:`${a}.familyRequest.fields`});c.from!==void 0&&l("familyRequestFrom",`${a}.familyRequest.from`,c.from)}let u=jt(r.result);if(u?.kind==="record")for(let[f,m]of Pr(u.fields).entries()){let y=jt(jt(m)?.suggest);if(y?.kind!=="form")continue;let k=jt(m)?.type;l("suggest",`${a}.result.fields.${f}.suggest`,"address"in y?y.address:y.key,typeof k=="string"?{expectedType:k}:{})}return i}s(kI,"taskAddressFields");function ff(e){let t=[];for(let[n,r]of Pr(e.processStore).entries()){let i=jt(jt(r)?.derive);if(i?.reduction!==void 0){let o=String(jt(r)?.key);t.push({kind:"reduction",at:`processStore.${n}.derive.reduction`,nodeId:null,priceKey:o,value:i.reduction,judgedTogether:null})}}for(let[n,r]of Pr(e.pricingRules).entries())for(let[i,o]of Pr(jt(r)?.rows).entries())t.push({kind:"pricingRule",at:`pricingRules.${n}.rows.${i}.when`,nodeId:null,value:jt(o)?.when,judgedTogether:null});return t}s(ff,"priceAddressFields");function Es(e){return cy(e)?(pf(e.value)??[]).flatMap(t=>t.address===null?[]:[t.address]):ve(e.value)?[e.value]:[]}s(Es,"addressesInField");function cy(e){return e.kind==="pricingRule"||e.kind==="condition"}s(cy,"isExpressionField");function pf(e){return al(e)===null?ly(e):null}s(pf,"ruleConditionAddresses");function vn(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(vn,"adoptsForm");function bI(e){if(e.type!=="form"||vn({type:e.type,adoptForm:e.adoptForm}))return;let t=e.inputs?.smartForm;return t?.kind==="literal"&&typeof t.value=="string"&&t.value!==""?t.value:void 0}s(bI,"createdSmartFormSlug");function vG(e,t){return e.type!=="governedDocument"||e.production!=="resolver"||t!==ul?t:e.generatorStamp?.parts!==void 0?As:Ss}s(vG,"addressKeyOfPort");function uy(e){let t=e.result;return t===void 0||!ks(t)?[]:lf(t).map(n=>n.key)}s(uy,"storeWritesOf");function dl(e,t){return(Array.isArray(e.processStore)?e.processStore:[]).find(n=>n.key===t)}s(dl,"declaredKey");function _r(e,t){let n=[];if(!vn(t))for(let r of He(t).outputs?.(t)??[])n.push({address:{scope:"node",owner:t.id,key:vG(t,r.name)},type:r.type,...r.label!==void 0?{label:r.label}:{},nodeId:t.id,nodePort:r});for(let r of Array.isArray(t.tasks)?t.tasks:[])for(let i of uy(r)){let o=dl(e,i);n.push({address:{scope:"task",owner:r.key,key:i},type:o?.type??"unknown",...o!==void 0?{label:o.label}:{},nodeId:t.id})}return n}s(_r,"producedAddresses");function vI(e,t,n){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===t&&uy(i).includes(n))return{nodeId:r.id,template:i};return null}s(vI,"taskWriter");function Cr(e,t,n){return vI(e,t,n)?.nodeId??null}s(Cr,"taskOwnerNode");function cl(e,t){let n=dl(e,t)?.derive;if(n===void 0)return null;let r=Array.isArray(e.pricingRules)?e.pricingRules:[],i=[];for(let a of n.rules??[]){let l=r.find(d=>d.key===a);if(l===void 0)return null;for(let d of l.rows){let c=pf(d.when);if(c===null)return null;for(let u of c)u.address!==null&&i.push(u.address)}}let o=n.reduction;return ve(o)&&i.push(o),xG(i)}s(cl,"derivedSources");function xG(e){let t=new Set;return e.filter(n=>{let r=se(n);return t.has(r)?!1:(t.add(r),!0)})}s(xG,"dedupe");function SG(e){return fl(e,{slotTypes:!1}).flatMap(t=>Es(t).map(n=>({address:n,field:t})))}s(SG,"writtenAddressesOf");function vo(e,t){let n=[],r=new Set,i=s((l,d,c,u)=>{let f=`${se(l)}|${d}|${c.at}|${u===void 0?"":se(u)}`;r.has(f)||(r.add(f),n.push({address:l,origin:d,field:c,...u!==void 0?{via:u}:{}}))},"push"),o=s((l,d,c=new Set)=>{let u=se(l);if(!c.has(u)){if(c.add(u),l.scope==="task"){let f=vI(e,l.owner,l.key);if(f===null)return;for(let m of kI(f.nodeId,f.template))if(!(m.kind!=="taskWhen"&&m.kind!=="taskReads"))for(let y of Es(m))i(y,"evidence",d,l)}if(l.scope==="derived")for(let f of cl(e,l.key)??[])i(f,"derivedSource",d,l),o(f,d,c)}},"carried");for(let{address:l,field:d}of SG(t))i(l,"written",d),o(l,d);let a=new Set((Array.isArray(t.tasks)?t.tasks:[]).flatMap(l=>uy(l).map(d=>`${l.key}.${d}`)));for(let l of ff(e))if(!(l.kind!=="reduction"||!ve(l.value)||l.value.scope!=="task")&&a.has(`${l.value.owner}.${l.value.key}`))for(let d of cl(e,l.priceKey)??[])d.scope==="task"&&a.has(`${d.owner}.${d.key}`)||(i(d,"priceCheck",l,{scope:"derived",key:l.priceKey}),o(d,l));return n}s(vo,"addressReadsOf");function fy(e,t){switch(t.scope){case"env":return cr(t.key)?sy(t.key):rl(e,t.key)?.type;case"derived":case"task":{if(t.path!==void 0||t.scope==="task"&&Cr(e,t.owner,t.key)===null)return;let n=dl(e,t.key);return n===void 0||t.scope==="derived"!=(n.derive!==void 0)?void 0:n.type}case"node":{let n=e.nodes.find(i=>i.id===t.owner);if(n===void 0)return;let r=_r(e,n).find(i=>i.address.scope==="node"&&i.address.key===t.key);return r===void 0?void 0:t.path===void 0?r.type:r.nodePort?.schema?.find(i=>i.key===t.path)?.type}}}s(fy,"addressType");function ll(e,t){let n=jt(e)?.[t];return typeof n=="string"&&n.length>0?n:void 0}s(ll,"labelText");function Oe(e,t,n){let r=e.nodes.find(i=>i.id===t);return ll(r?.label,n)??t}s(Oe,"nodeDisplayName");function xo(e,t,n){for(let r of e.nodes){let i=(Array.isArray(r.tasks)?r.tasks:[]).find(o=>o.key===t);if(i!==void 0)return ll(i.title,n)??t}return t}s(xo,"taskDisplayName");function Be(e,t,n){let r=[];switch(t.scope){case"env":r.push(cr(t.key)?ay(t.key)[n]:rl(e,t.key)?.label[n]??t.key);break;case"derived":r.push(ll(dl(e,t.key)?.label,n)??t.key);break;case"task":r.push(xo(e,t.owner,n),ll(dl(e,t.key)?.label,n)??t.key);break;case"node":{r.push(Oe(e,t.owner,n));let i=e.nodes.find(a=>a.id===t.owner),o=i===void 0?void 0:_r(e,i).find(a=>a.address.scope==="node"&&a.address.key===t.key);r.push(ll(o?.label,n)??t.key);break}}return t.scope!=="env"&&t.path!==void 0&&r.push(t.path),`${r.join(" \u203A ")} (${se(t)})`}s(Be,"displayAddress");var pl=["beneficiary","signers"];function xI(e,t){return Array.isArray(e.artifacts)&&e.artifacts.some(n=>n?.key===t)}s(xI,"ownsSlot");function ml(e){let t=[];for(let[n,r]of Object.entries(jt(e.inputs)??{})){let i=jt(r);i?.kind==="binding"&&ve(i.address)&&t.push({slot:n,address:i.address})}return t}s(ml,"bindingAddresses");function SI(e,t){return ml(e).find(n=>n.slot===t)?.address??null}s(SI,"bindingAddressAt");function AI(e,t){let n=s(i=>i.scope==="node"&&i.owner===t||i.scope==="task"&&Cr(e,i.owner,i.key)===t,"names");return[...e.nodes.filter(i=>i.id!==t).flatMap(i=>fl(i,{slotTypes:!1})),...ff(e)].flatMap(i=>Es(i).filter(n).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(AI,"addressesNaming");var Tt={target:"target",flagKey:"flagKey",value:"value"};function AG(e){return SI(e,Tt.target)}s(AG,"setFlagTarget");function EI(e){let t=AG(e);return t!==null&&xs(t)?t.owner:null}s(EI,"setFlagTargetOwner");function mf(e){let t=e.inputs?.[Tt.flagKey];return t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0?t.value:null}s(mf,"setFlagKey");function TI(e){let t=e.inputs?.[Tt.value];if(t===void 0||t.kind==="unset")return!0;if(t.kind==="literal"&&typeof t.value=="boolean")return t.value;N(`[setFlag/valueType] setFlag node "${String(e.id)}": \`${Tt.value}\` is no yes/no literal \u2014 publish refuses that`)}s(TI,"setFlagValue");function $I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s($I,"isObject");var RI=["target","flagKey","value"];function II(e){return $I(e)&&e.type==="setFlag"&&RI.some(t=>t in e)}s(II,"oldShape");function OI(e){return(e?.nodes??[]).some(II)}s(OI,"needsSetFlagInputMove");function EG(e){let t=$I(e.inputs)?{...e.inputs}:{};if(RI.some(a=>a in e&&Tt[a]in t))return{unmoved:"inputExists"};if("target"in e&&!ve(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:n,flagKey:r,value:i,...o}=e;return n!==void 0&&(t[Tt.target]={kind:"binding",address:n}),typeof r=="string"&&r.length>0&&(t[Tt.flagKey]={kind:"literal",value:r}),i!==void 0&&(t[Tt.value]={kind:"literal",value:i}),{node:{...o,inputs:t}}}s(EG,"moveNode");function PI(e){let t=[],n=[],r=e.nodes.map(i=>{if(!II(i))return i;let o=EG(i);return"unmoved"in o?(n.push({nodeId:String(i.id),reason:o.unmoved}),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(PI,"moveSetFlagConfigToInputs");function _I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(_I,"isObject");var py={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},my={review:["allowSkipInTest"]};function CI(e){return py[String(e)]??{}}s(CI,"movesOf");function NI(e){return my[String(e)]??[]}s(NI,"deadOf");function DI(e){return _I(e)&&[...Object.keys(CI(e.type)),...NI(e.type)].some(t=>t in e)}s(DI,"oldShape");function FI(e){return(e?.nodes??[]).some(DI)}s(FI,"needsScalarInputMove");function TG(e,t){return t==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===t}s(TG,"wellTyped");function $G(e){let t=_I(e.inputs)?{...e.inputs}:{},n={...e};for(let[r,i]of Object.entries(CI(e.type))){if(!(r in e))continue;let o=e[r];if(r in t)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!(i==="string"&&o==="")&&!TG(o,i))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueWrongType"}};o!==""&&(t[r]={kind:"literal",value:o}),delete n[r]}for(let r of NI(e.type))delete n[r];return n.inputs=t,{node:n}}s($G,"moveNode");function LI(e){let t=[],n=[],r=e.nodes.map(i=>{if(!DI(i))return i;let o=$G(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(LI,"moveScalarConfigToInputs");var Ts={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 hf(e){return typeof e=="string"&&Object.hasOwn(Ts,e)}s(hf,"isResourceType");var ble=Object.keys(Ts).filter(e=>Ts[e].existence.check==="generic");function MI(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.groupKey=="string"&&t.groupKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||wo(t.reduction)===null&&t.reduction.kind==="amount")&&Object.keys(t).every(n=>n==="groupKey"||n==="grantKeys"||n==="reduction")}s(MI,"isPricedGroupValue");var hy=["street","hausnr","plz","ort","land"];function qI(e){return hy.includes(e)}s(qI,"isAddressPart");var RG=["municipality","municipalityKey","district","districtKey"],gy=[...hy,...RG],yy={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"},$s=Object.keys(yy);function Ri(e){return typeof e=="string"&&e in yy}s(Ri,"isValueType");function xn(e){return e===void 0?void 0:yy[e]}s(xn,"dataTypeOf");function gf(e,t){let n=xn(e),r=xn(t);return n!==void 0&&n===r}s(gf,"valueTypesCompatible");function yf(e){return e===null?"null is not a text in both languages":hl(e,{type:"localizedText"})}s(yf,"completeLocalizedTextIssue");function hl(e,t){if(hf(t.type)&&!Ri(t.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${t.type} key`;let n=xn(t.type),r=JSON.stringify(e),i=`slot type "${t.type}" takes a binding, not a literal`;if(n===void 0||n==="composite"||n==="file"||n==="edge")return i;if(e===null)return null;switch(n){case"text":return typeof e=="string"?null:`${r} is not a text (slot type "${t.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=(t.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 MI(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 il(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=wo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(hl,"literalTypeIssue");function KI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(KI,"isObject");var IG={collectPayment:{reason:"reason"}},OG={governedDocument:["mockAutoProduce"]},jI={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 wy(e){return IG[String(e)]??{}}s(wy,"movesOf");function BI(e){return OG[String(e)]??[]}s(BI,"deadOf");function UI(e){return KI(e)&&[...Object.keys(wy(e.type)),...BI(e.type)].some(t=>t in e)}s(UI,"oldShape");function VI(e){return(e?.nodes??[]).some(UI)}s(VI,"needsNodeConfigInputMove");function PG(e){return yf(e)===null}s(PG,"isCompleteText");function _G(e){let t=KI(e.inputs)?{...e.inputs}:{},n={...e};for(let[r,i]of Object.entries(wy(e.type)))if(r in e){if(i in t)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!PG(e[r]))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueNotLocalized"}};t[i]={kind:"literal",value:e[r]},delete n[r]}for(let r of BI(e.type))delete n[r];return Object.keys(wy(e.type)).some(r=>r in e)&&(n.inputs=t),{node:n}}s(_G,"moveNode");function GI(e){let t=[],n=[],r=e.nodes.map(i=>{if(!UI(i))return i;let o=_G(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(GI,"moveNodeConfigToInputs");var ky="collectPayment",Rs=["online","separate"];function wf(e){return Rs.includes(e)}s(wf,"isCollectPaymentSettlement");var Is="paid",by="skipPayment",Ii="article",Yn="settlement",Oi="reason",Hn="payee",vy=["one_time"];function kf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(kf,"isObject");function zI(e){if(!kf(e)||e.type!==ky)return!1;let t=kf(e.inputs)?e.inputs:{},n=t[Yn];return!kf(n)||n.kind!=="literal"||n.value!=="online"?!1:!(Hn in t)}s(zI,"isOnlinePaymentWithoutPayee");function WI(e){return(e?.nodes??[]).some(zI)}s(WI,"needsPayee");function YI(e,t={}){let n=[],r=[],i=e.nodes.map(o=>{if(!zI(o))return o;let a=String(o.id),l=Object.hasOwn(t,a)?t[a]:void 0;if(l===void 0||l==="")return r.push(a),o;n.push({nodeId:a,payee:l});let d=kf(o.inputs)?o.inputs:{};return{...o,inputs:{...d,[Hn]:{kind:"literal",value:l}}}});return n.length===0?{graph:e,set:n,refused:r}:{graph:{...e,nodes:i},set:n,refused:r}}s(YI,"setPayeeOnOnlinePayments");function bf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(bf,"isObject");function xy(e){return bf(e)&&bf(e.assign)&&"userId"in e.assign}s(xy,"namesUser");function vf(e){return(e?.nodes??[]).flatMap(t=>bf(t)&&Array.isArray(t.tasks)?t.tasks.filter(xy).map(n=>({nodeId:String(t.id),taskKey:String(n.key),hasTeam:typeof n.assign.group=="string"&&n.assign.group.length>0})):[])}s(vf,"taskUserAssignments");function HI(e){let t=vf(e);if(t.length===0)return{graph:e,dropped:t};let n=e.nodes.map(r=>{if(!bf(r)||!Array.isArray(r.tasks)||!r.tasks.some(xy))return r;let i=r.tasks.map(o=>{if(!xy(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:n},dropped:t}}s(HI,"dropTaskAssignUserIds");var Os={"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"}},"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"}},"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"}}},Sy=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function JI(e,t){if(typeof t!="string"||t.length===0)return null;if(e==="key")return t;let n=bs(t);return n?.kind==="team"?n.groupKey:null}s(JI,"decodeKey");function CG(e){let t=/^(tasks|optionalActions)\[\](?:\.([a-zA-Z]+))?\.([a-zA-Z]+)$/.exec(e);return t===null&&N(`[resource] unreadable reference leaf "${e}"`),{list:t[1],field:t[2]??null,key:t[3]}}s(CG,"locate");function xf(e){let t=[],n=e;for(let[r,i]of Object.entries(Sy(n.assign)??{})){let o=JI("key",i);t.push({path:`assign.${r}`,leaf:"assign{}",owner:r,key:o,missing:typeof i!="string"||i.length===0})}for(let r of Object.keys(Os)){if(r==="assign{}")continue;let i=Os[r],{list:o,field:a,key:l}=CG(r);for(let d of Array.isArray(n[o])?n[o]:[]){let c=Sy(d);if(c===null||typeof c.key!="string")continue;let f=(a===null?c:Sy(c[a]))?.[l];if(f===void 0&&!i.required)continue;let m=typeof f!="string"||f.length===0;t.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:JI(i.codec,f),missing:m})}}return t}s(xf,"nodeResourceReferences");var QI=s(e=>(e??[]).map(t=>`\u201E${t}\u201C`).join(", "),"list"),ZI=s(e=>(e??[]).map(t=>`"${t}"`).join(", "),"listEn"),NG={"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 (${QI(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 (${ZI(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 (${QI(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 (${ZI(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 Ps(e,t,n){let{problem:r,remedy:i}=NG[e][n](t);return`[${e}] ${r} ${i}`}s(Ps,"addressMessage");function _n(e){let t=[];for(let n of e){let r=n.next;if(r)for(let[i,o]of Object.entries(r))t.push({id:`${n.id}|${i}`,source:n.id,target:o.to,sourceBranchId:i})}return t}s(_n,"derivedEdges");function Sf(e,t,n){if(t===n)return!0;let r=new Map,i=new Set;for(let l of _n(e.nodes)){let d=r.get(l.source)??[];d.push(l.target),r.set(l.source,d),i.add(l.target)}let o=e.nodes.filter(l=>!i.has(l.id)&&l.id!==t).map(l=>l.id),a=new Set(o);for(;o.length>0;){let l=o.shift();if(l===n)return!1;for(let d of r.get(l)??[])d===t||a.has(d)||(a.add(d),o.push(d))}return!0}s(Sf,"dominates");function XI(e,t,n){if(t===n)return!0;let r=new Map;for(let a of _n(e.nodes)){let l=r.get(a.source)??[];l.push(a.target),r.set(a.source,l)}let i=[t],o=new Set(i);for(;i.length>0;){let a=i.shift();for(let l of r.get(a)??[]){if(l===n)return!0;o.has(l)||(o.add(l),i.push(l))}}return!1}s(XI,"reaches");function Ay(e,t){let n=[],r=s(a=>({address:a.address,type:a.type,...a.label!==void 0?{label:a.label}:{},nodeId:a.nodeId}),"toVisible");for(let a of e.nodes)if(Sf(e,a.id,t))for(let l of _r(e,a))n.push(r(l));for(let a of mI)n.push({address:{scope:"env",key:a},type:sy(a),label:ay(a),nodeId:null});for(let a of Zu(e))n.push({address:{scope:"env",key:Xu(a.key)},type:a.type,label:a.label,nodeId:null});let i=new Set(n.map(a=>se(a.address))),o=(Array.isArray(e.processStore)?e.processStore:[]).filter(a=>a.derive!==void 0);for(let a=!0;a;){a=!1;for(let l of o){let d=se({scope:"derived",key:l.key});if(i.has(d))continue;let c=cl(e,l.key);c===null||!c.every(u=>i.has(se(uf(u))))||(n.push({address:{scope:"derived",key:l.key},type:l.type,label:l.label,nodeId:null}),i.add(d),a=!0)}}return n}s(Ay,"visibleAddressesAt");function Nr(e,t){let n=e?.readinessFormFieldsByFormNode?.get(t.owner);if(n!==void 0)return n.get(t.path)??null}s(Nr,"formFieldEntryOf");var eO={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"},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"},reduction:{de:"Erm\xE4\xDFigung des Preises",en:"Reduction of the price"},pricingRule:{de:"Preisregel",en:"Pricing rule"}},DG=new Set(["nodeReads","requires","taskReads","taskDocument","familyRequestFields"]);function FG(e,t,n){let r=[];t.taskKey!==void 0&&r.push(`${n==="de"?"Aufgabe":"task"} \u201E${xo(e,t.taskKey,n)}\u201C`);let i=t.kind==="binding"?` \u201E${t.at.split(".").pop()}\u201C`:"";return r.push(`${eO[t.kind][n]}${i}`),r.join(" \u203A ")}s(FG,"addressFieldWhere");function gl(e,t,n){let r=FG(e,t,n);return t.nodeId===null?r:`\u201E${Oe(e,t.nodeId,n)}\u201C \u203A ${r}`}s(gl,"whereOf");function tO(e,t,n){if(t.scope==="node")return Oe(e,t.owner,n);if(t.scope==="task")return xo(e,t.owner,n)}s(tO,"producerName");function nO(e,t){let n=[],r=new Set,i=s((l,d,c)=>{let u={de:Ps(l,c("de"),"de"),en:Ps(l,c("en"),"en")},f=`${d}|${u.de}`;r.has(f)||(r.add(f),n.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=>fl(l)),...ff(e)];for(let l of a){let d=s(c=>gl(e,l,c),"where");for(let c of LG(e,l,i))qG(e,l,c,i)&&(jG(e,l,c,t,i),dy.has(l.kind)&&!UG(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:Be(e,c,u)})))}return VG(e,i),GG(e,a,i),HG(e,i),QG(e,i),n}s(nO,"checkAddresses");function LG(e,t,n){let r=s(i=>gl(e,t,i),"where");if(cy(t)){let i=pf(t.value)??[];for(let o of i)o.address===null&&n(o.reason==="bareIdentifier"?"address/bareIdentifier":"address/shape",t.at,a=>({where:r(a),address:o.identifier}));return Es(t)}return typeof t.value=="string"?(n("address/bareIdentifier",t.at,i=>({where:r(i),address:t.value})),[]):ve(t.value)?[t.value]:(n("address/shape",t.at,i=>({where:r(i),address:JSON.stringify(t.value)??"undefined"})),[])}s(LG,"checkFieldShape");function rO(e,t,n,r){let i=tO(e,n,r);return{where:gl(e,t,r),address:Be(e,n,r),...i!==void 0?{producer:i}:{}}}s(rO,"addressParams");function MG(e,t,n){return oy(t)?null:rl(e,t)!==void 0?n==="condition"||n==="binding"?null:"address/staffInputConditionOnly":cr(t)?"address/envCohortBound":"address/unknownKey"}s(MG,"envAddressRefusal");function qG(e,t,n,r){let i=s(o=>rO(e,t,n,o),"params");switch(n.scope){case"env":{let o=MG(e,n.key,t.kind);return o===null?!0:(r(o,t.at,i),!1)}case"derived":return(e.processStore??[]).find(a=>a.key===n.key)?.derive!==void 0?!0:(r("address/unknownKey",t.at,i),!1);case"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===n.owner))?(e.processStore??[]).some(a=>a.key===n.key&&a.derive===void 0)?Cr(e,n.owner,n.key)===null?(r("address/ownerNotWriter",t.at,i),!1):!0:(r("address/unknownKey",t.at,i),!1):(r("address/unknownOwner",t.at,i),!1);case"node":{let o=e.nodes.find(a=>a.id===n.owner);return o===void 0?(r("address/unknownOwner",t.at,i),!1):_r(e,o).some(a=>a.address.scope==="node"&&a.address.key===n.key)?!0:(r(dy.has(t.kind)&&vn(o)?"address/notFormInstance":"address/unknownKey",t.at,i),!1)}}}s(qG,"resolves");function KG(e,t){return e===void 0||t===void 0||xn(t)===void 0?!0:xn(e)!==void 0&&gf(e,t)}s(KG,"addressTypeFits");function jG(e,t,n,r,i){let o=s(l=>rO(e,t,n,l),"params");if(n.scope!=="env"&&n.path!==void 0&&!BG(e,t,n,r)){i("address/pathNotInTarget",t.at,o);return}if(t.expectedType===void 0)return;let a=fy(e,n);KG(a,t.expectedType)||i("address/typeMismatch",t.at,l=>({...o(l),expected:t.expectedType,actual:a}))}s(jG,"checkPathAndType");function BG(e,t,n,r){if(n.scope!=="node")return!1;if(fy(e,n)!==void 0)return!0;if(n.key!==nn)return!1;if(!DG.has(t.kind))return e.nodes.find(o=>o.id===n.owner)?.formExports===void 0;let i=r?.readinessFormFieldsByFormNode?.get(n.owner);return i===void 0||i.has(n.path)}s(BG,"pathExists");function UG(e,t){if(!xs(t))return!1;let n=e.get(t.owner);return n!==void 0&&n.type==="form"&&!vn(n)}s(UG,"isCreatingFormInstance");function VG(e,t){for(let n of e.nodes){let r=new Set(fl(n).map(i=>i.kind));for(let i of wI(n))r.has(i)||t("address/missing",`nodes.${n.id}.${i}`,o=>({where:`\u201E${Oe(e,n.id,o)}\u201C \u203A ${eO[i][o]}`}))}}s(VG,"checkRequiredFields");function GG(e,t,n){let r=new Map;for(let i of t)if(i.judgedTogether!==null)for(let o of Es(i)){if(o.scope!=="node"||o.key!==nn)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||n("address/mixedForms",i,l=>({where:gl(e,o[0].field,l),names:a.map(d=>Oe(e,d,l))}))}}s(GG,"checkMixedForms");function zG(e,t){return e.type==="engagePush"&&t.kind==="payment"}s(zG,"readSkipsAbsentProducer");function WG(e,t,n){return t!==n&&XI(e,t,n)}s(WG,"precedesOnSomePath");function YG(e,t,n,r){let i=uf(n.address);return r.has(se(i))||!JG(e,i)?!0:n.origin==="written"&&i.scope==="node"&&zG(t,n.field)&&WG(e,i.owner,t.id)}s(YG,"readPassesVisibility");function HG(e,t){for(let n of e.nodes){let r=vo(e,n);if(r.length===0)continue;let i=new Set(Ay(e,n.id).map(o=>se(o.address)));for(let o of r){let a=uf(o.address);if(YG(e,n,o,i))continue;let l=a.scope==="task"?Cr(e,a.owner,a.key):a.scope==="node"?a.owner:null;t("address/notVisible",o.field.at,d=>({where:gl(e,o.field,d),address:Be(e,o.address,d),producer:tO(e,a,d)??Be(e,a,d),...l!==null?{producerNode:Oe(e,l,d)}:{},reader:Oe(e,n.id,d)}))}}}s(HG,"checkVisibility");function JG(e,t){if(t.scope==="env")return oy(t.key);if(t.scope==="derived")return cl(e,t.key)!==null;let n=se(t);return e.nodes.some(r=>_r(e,r).some(i=>se(i.address)===n))}s(JG,"producedSomewhere");function QG(e,t){let n=new Map;for(let r of e.nodes){let i=new Set(_r(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"||!Or.test(l)){t("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${Oe(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=n.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),n.set(l,d)}}for(let[r,i]of n)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)t("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${Oe(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${xo(e,r,a)}\u201C`,names:i.map(l=>Oe(e,l.nodeId,a))}))}s(QG,"checkTaskKeys");function Af(e,t){return e.label[t]??""}s(Af,"wordingIn");function Pi(e,t){let n=iO(e,t),r=Af(e.qualifier,t);return n===""||r===""&&Af(e.qualifier,"de")!==""?"":r===""?n:`${r} \xB7 ${n}`}s(Pi,"fieldLabelIn");function iO(e,t){return Af(e,t)}s(iO,"fieldOwnLabelIn");function _i(e){return{key:e.key,kind:e.kind,type:e.kind==="entered"?e.type:null,repeated:e.kind==="entered"&&e.repeated,name:{de:Pi(e,"de"),en:Pi(e,"en")}}}s(_i,"catalogField");function Ci(e,t,n){switch(e){case"nodeReads":return t.repeated?"repeated":n==="review"&&t.kind==="computed"?"computed":null;case"requires":return t.repeated?"repeated":t.kind==="computed"?"computed":t.name.en===""?"untranslated":null;case"taskDocument":return t.repeated?"repeated":t.kind==="entered"&&t.type==="docRef"?null:"notDocument";case"taskReads":case"familyRequestFields":return null}}s(Ci,"catalogFieldRefusal");function Ef(e,t){let n=e.buses.find(r=>r.key===t);return n||N(`[progress] layout '${e.id}' has no bus '${t}'`),n}s(Ef,"progressBus");function yl(e,t){return e.states.some(n=>n.id===t)}s(yl,"isBusState");function oO(e,t){let n=e.terminalSemantics?.[t];return n||N(`[progress] no terminal semantics for state '${t}' on bus '${e.key}'`),n}s(oO,"terminalSemantics");function Tf(e,t){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,t)}s(Tf,"hasTerminalSemantics");function ZG(e,t){return(e.boards??[]).find(n=>n.audience===t||n.audience==="both")??null}s(ZG,"boardForAudience");function sO(e){return ZG(Ef(e,"process"),"internal")}s(sO,"internalProcessBoard");function _s(e,t,n){let r=null;for(let i of e.mappings)if(i.event===n)if("nodeId"in i.match){if(i.match.nodeId===t.id)return{bus:i.bus,state:i.state}}else i.match.nodeType===t.type&&(r=i);return r?{bus:r.bus,state:r.state}:null}s(_s,"resolveProgressEvent");var Cs={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},ti=Object.keys(Cs);function So(e){return Object.hasOwn(Cs,e)}s(So,"isEndNodeOutcome");var Ey={approved:{de:"Angenommen",en:"Admitted"},rejected:{de:"Abgelehnt",en:"Rejected"},withdrawn:{de:"Zur\xFCckgezogen",en:"Withdrawn"},expired:{de:"Abgelaufen",en:"Expired"}};var Ni=["commit","discard"],yde=w.union(...Ni.map(e=>w.literal(e)));function $f(e){return typeof e=="string"&&Ni.includes(e)}s($f,"isApplicationDataDecision");function Ct(e){return Object.keys(e)}s(Ct,"progressEventsOf");var ne=s((e,t)=>({de:e,en:t}),"lt"),Xe=s((e,t,n,r,i=null,o=null)=>({chipLabel:e,tone:t,nextAction:i,affordance:o,title:n,body:r}),"ex"),aO={key:"eingeschrieben",label:ne("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},Rf={key:"abgesagt",label:ne("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},lO={key:"abgelehnt",label:ne("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var dO={enrolled:{label:ne("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:aO,external:Xe(ne("Eingeschrieben","Enrolled"),"green",ne("Sie sind eingeschrieben!","You are enrolled!"),ne("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:ne("Abgesagt","Declined"),tone:"red",terminal:{lifecycleStatus:"completed",outcome:"rejected"},phase:Rf,external:Xe(ne("Abgesagt","Declined"),"red",ne("Die Bewerbung wurde beendet","The application has ended"),ne("Ihre Bewerbung wurde nicht fortgef\xFChrt.","Your application was not continued."))}},cO={role:"effect",effect:"pure",progressDefaults:dO,progressEvents:Ct(dO),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:ti.map(e=>({value:e,label:Ey[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=>[...XG(e),...ez(e),...tz(e)],"validate")},Ns=s((e,t,n,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${t}`,reason:{de:n,en:r},severity:"error"}),"nodeIssue");function Ty(e){let t=e.inputs?.applicationOutcome;return t?.kind==="literal"&&t.value!=null?String(t.value):null}s(Ty,"literalOutcome");function XG(e){if(e.type!=="end")return[];let t=e.inputs?.applicationOutcome;if(t===void 0||t.kind==="unset")return[];let n=Ty(e);return n===null?[Ns(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`)]:So(n)?[]:[Ns(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${n}' ist kein Ausgang eines Endknotens (${ti.join("|")}) \u2014 die Warteliste endet \xFCber das closed-Outcome ihres Wartelistenknotens`,`[end/applicationOutcome] ${e.label.en}: '${n}' is not an outcome of an end node (${ti.join("|")}) \u2014 the waitlist ends through the closed outcome of its waitlist node`)]}s(XG,"checkEndApplicationOutcome");function ez(e){if(e.type!=="end")return[];let t=e.inputs?.dataDecision;return!t||t.kind!=="literal"||t.value==null?[Ns(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)`)]:$f(t.value)?[]:[Ns(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision '${String(t.value)}' ist ung\xFCltig (${Ni.join("|")})`,`[end/dataDecision] ${e.label.en}: dataDecision '${String(t.value)}' is invalid (${Ni.join("|")})`)]}s(ez,"checkEndDataDecision");function tz(e){if(e.type!=="end")return[];let t=Ty(e);if(t===null||!So(t)||t==="approved")return[];let n=e.inputs?.dataDecision;if(n?.kind!=="literal"||n.value!=="commit")return[];let r=Ey[t];return[{...Ns(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(tz,"checkEndCommitWithoutApproval");function uO(e,t){if(!t?.layout||!t.wiring)return[];let n=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=Ty(r);if(i===null||!So(i))continue;let o=Cs[i],a=_s(t.wiring,r,o);if(a===null)continue;let l=t.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Tf(l,a.state))continue;let d=oO(l,a.state).outcome;d!==i&&n.push(Ns(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 n}s(uO,"checkEndOutcomeMatchesTerminal");function Ds(e){let t=He(e);return typeof t.inputs=="function"?t.inputs(e):[]}s(Ds,"inputSlots");function nz(e,t){return Ds(e).find(n=>n.id===t)}s(nz,"findInputSlot");function rz(e,t){let n=nz(e,t);if(!n)return{source:"missing",spec:{id:t,label:{de:t,en:t},type:"string"},unknownSlot:!0};let r=e.inputs?.[t]??{kind:"unset"};return r.kind==="binding"&&ve(r.address)?{source:"binding",spec:n,address:r.address}:r.kind==="literal"?{source:"literal",spec:n,value:r.value}:r.kind==="cockpit"&&n.deferrable===!0?{source:"cockpit",spec:n}:n.defaultValue!==void 0?{source:"default",spec:n,value:n.defaultValue}:n.required?{source:"missing",spec:n}:{source:"optional",spec:n}}s(rz,"resolveInput");function fO(e){return Ds(e).filter(t=>rz(e,t.id).source==="missing")}s(fO,"missingRequiredInputs");var iz=["personRef","formRef","documentRef","docRef"];function oz(e){let t=He(e);return typeof t.inputs!="function"?[]:t.inputs(e).map(n=>({id:n.id,type:n.type}))}s(oz,"listInputs");function pO(e){let t=[];for(let n of e.nodes)for(let r of oz(n))!iz.includes(r.type)||n.inputs?.[r.id]?.kind!=="literal"||t.push({layer:"GRAPH",kind:"modelError",path:`node.${n.id}.param.${r.id}`,reason:{de:`${n.label.de}: Literal f\xFCr referenztypisierten Slot "${r.id}" ist verboten \u2014 der Slot wird an eine Adresse gebunden`,en:`${n.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 t}s(pO,"findParamValueRefSlotErrors");function mO(e){let t=[];for(let n of e.nodes){let r=He(n);if(typeof r.inputs=="function")for(let i of r.inputs(n)){let o=n.inputs?.[i.id];if(o?.kind==="cockpit"&&i.deferrable!==!0){t.push({layer:"GRAPH",kind:"modelError",path:`nodes.${n.id}.inputs.${i.id}`,reason:{de:`[inputs/notDeferrable] ${n.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] ${n.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")&&t.push({layer:"GRAPH",kind:"modelError",path:`nodes.${n.id}.inputs.${i.id}`,reason:i.inspector==="literal-only"?{de:`[inputs/inspectorKind] ${n.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] ${n.label.en}: Parameter "${i.label.en}" is a fixed value \u2014 it cannot be bound to an address.`}:{de:`[inputs/inspectorKind] ${n.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] ${n.label.en}: Parameter "${i.label.en}" is bound to an address \u2014 a fixed value is not possible here.`},severity:"error"})}}return t}s(mO,"findInspectorKindErrors");function hO(e){let t=[];for(let n of e.nodes)for(let r of fO(n))t.push({layer:"GRAPH",kind:"contractGap",path:`node.${n.id}.input.${r.id}`,reason:{de:`${n.label.de}: Pflicht-Slot "${r.label.de}" nicht gesetzt`,en:`${n.label.en}: Required slot "${r.label.en}" is not set`},severity:"error"});return t}s(hO,"findMissingRequiredInputs");function If(e){let t=e.processStore;return t===void 0?[]:(Array.isArray(t)||N("graph.processStore must be an array \u2014 the graph validator refuses anything else"),t)}s(If,"processStoreKeys");function yO(e){let t=[];for(let n of e.tasks??[]){let r=n.result;if(!(r===void 0||!ks(r)))for(let i of lf(r))t.push({key:i.key,nodeId:e.id,taskKey:n.key,template:n,result:r,valueType:i.valueType,...i.field!==void 0?{fieldKey:i.field.key}:{}})}return t}s(yO,"storeWritersOn");function wO(e){let t=new Map;for(let n of e.nodes)for(let r of yO(n)){let i=t.get(r.key)??[];i.push(r),t.set(r.key,i)}return t}s(wO,"processStoreWriters");function sz(e,t,n){for(let r of e.nodes){let i=yO(r).find(o=>o.taskKey===t&&o.key===n);if(i!==void 0)return i}return null}s(sz,"writerAt");function gO(e,t,n){(t.scope!=="task"||t.path!==void 0)&&N(`[process] ${n}: ${se(t)} is no task value`);let r=sz(e,t.owner,t.key);return r===null&&N(`[address/ownerNotWriter] ${n}: task "${t.owner}" writes no "${t.key}" \u2014 publish refuses that`),{key:t.key,nodeId:r.nodeId,taskKey:r.taskKey,...r.fieldKey!==void 0?{fieldKey:r.fieldKey}:{}}}s(gO,"sourceOfAddress");function $y(e,t){(t.scope!=="task"&&t.scope!=="derived"||t.path!==void 0)&&N(`[process] ${se(t)} is no store address`);let n=If(e).find(o=>o.key===t.key);n===void 0&&N(`[address/unknownKey] ${se(t)}: "${t.key}" is not declared in processStore`);let r={key:n.key,type:n.type,label:n.label,audience:n.audience};if(t.scope==="task")return ty(n)&&N(`[address/unknownKey] ${se(t)}: "${t.key}" is a derived price \u2014 read it as $derived`),{...r,sources:[gO(e,t,se(t))]};ty(n)||N(`[address/unknownKey] ${se(t)}: "${t.key}" is a written value \u2014 read it as $task`);let i=ny(e,n.derive).map(o=>gO(e,o.address,se(t)));return{...r,sources:i,derive:n.derive}}s($y,"processLeafOf");var Ry=new Set(["enum","pricedItem","number","boolean","reduction"]),Iy=new Set(["pricedItem","pricedGroup"]),Oy=new Set(["number","boolean","enum"]),De={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",ruleSet:"[process/ruleSet]",ruleCondition:"[process/ruleCondition]",ruleSource:"[process/ruleSource]",ruleReadsAbsent:"[process/ruleReadsAbsent]",absentValue:"[process/absentValue]",derive:"[process/derive]",derivedHasWriter:"[process/derivedHasWriter]",ruleGrantUnknown:"[process/ruleGrantUnknown]",ruleGrantUnused:"[process/ruleGrantUnused]",derivePriceUnknown:"[process/derivePriceUnknown]",derivePriceNotInProgram:"[process/derivePriceNotInProgram]",derivePriceOfferWithoutProgram:"[process/derivePriceOfferWithoutProgram]",deriveStageUnknown:"[process/deriveStageUnknown]",deriveStageUncovered:"[process/deriveStageUncovered]",reductionPrices:"[process/reductionPrices]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function Fe(e,t,n,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${t} ${n}`,en:`${t} ${r}`},severity:"error"}}s(Fe,"err");function kO(e,t={}){let n=[],r=If(e),i=new Map(r.map(d=>[d.key,d])),o=new Set;for(let[d,c]of r.entries()){let u=`processStore[${d}]`;if(typeof c.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(c.key)){n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(c.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(c.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}o.has(c.key)&&n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" ist doppelt deklariert.`,`Process key "${c.key}" is declared twice.`)),o.add(c.key),(c.derive!==void 0?!Iy.has(c.type):!Ry.has(c.type))&&n.push(c.derive!==void 0?Fe(u,De.derive,`Vorgangs-Schl\xFCssel "${c.key}" ist abgeleitet, hat aber den Typ "${c.type}" \u2014 abgeleitet wird nur ein Preis: ${[...Iy].join(", ")}.`,`Process key "${c.key}" is derived but has the type "${c.type}" \u2014 only a price can be derived: ${[...Iy].join(", ")}.`):Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" hat den Typ "${c.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...Ry].join(", ")}${c.type==="pricedGroup"?" (ein Paket wird abgeleitet: derive)":""}.`,`Process key "${c.key}" has the type "${c.type}" \u2014 the process only stores results with a value: ${[...Ry].join(", ")}${c.type==="pricedGroup"?" (a package is derived: derive)":""}.`)),(!c.label?.de?.trim()||!c.label?.en?.trim())&&n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" braucht ein Label in beiden Sprachen.`,`Process key "${c.key}" needs a label in both languages.`)),c.audience!=="internal"&&c.audience!=="printable"&&n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${c.key}": audience must be 'internal' or 'printable'.`))}let a=wO(e);for(let d of e.nodes)for(let c of d.tasks??[]){let u=c.result;u?.kind==="pricedItem"&&u.writes===void 0&&n.push(Fe(`node.${d.id}.tasks.${c.key}.result.writes`,De.pricedItemWritesNothing,`Aufgabe "${c.key}" (Knoten "${d.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${c.key}" (node "${d.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[d,c]of a){let u=i.get(d);for(let f of c){let m=f.fieldKey===void 0?`node.${f.nodeId}.tasks.${f.taskKey}.result.writes`:`node.${f.nodeId}.tasks.${f.taskKey}.result.fields.${f.fieldKey}.writes`;if(u===void 0){n.push(Fe(m,De.unknownKey,`${f.fieldKey===void 0?"":`Feld "${f.fieldKey}" der `}Aufgabe "${f.taskKey}" schreibt "${d}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${f.fieldKey===void 0?"Task":`Field "${f.fieldKey}" of task`} "${f.taskKey}" writes "${d}", but the workflow declares no such process key (graph.processStore).`));continue}if(f.valueType!==u.type){let y=f.fieldKey===void 0?`Aufgabe "${f.taskKey}"`:`Feld "${f.fieldKey}" der Aufgabe "${f.taskKey}"`,k=f.fieldKey===void 0?`Task "${f.taskKey}"`:`Field "${f.fieldKey}" of task "${f.taskKey}"`;n.push(Fe(m,De.writerTypeMismatch,`${y} liefert ${f.valueType}, der Vorgangs-Schl\xFCssel "${d}" ist aber als ${u.type} deklariert.`,`${k} delivers ${f.valueType}, but the process key "${d}" is declared as ${u.type}.`))}}if(c.length>1){let f=c.map(m=>`${m.nodeId}/${m.taskKey}${m.fieldKey===void 0?"":`.${m.fieldKey}`}`).join(", ");n.push(Fe(`processStore.${d}`,De.secondWriter,`Vorgangs-Schl\xFCssel "${d}" wird ${c.length}-mal geschrieben (${f}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${d}" is written ${c.length} times (${f}) \u2014 exactly one writer per key.`))}}for(let d of r){if(d.derive!==void 0){if(a.has(d.key)){let c=a.get(d.key).map(u=>`${u.nodeId}/${u.taskKey}`).join(", ");n.push(Fe(`processStore.${d.key}`,De.derivedHasWriter,`Vorgangs-Schl\xFCssel "${d.key}" wird abgeleitet (derive) \u2014 keine Aufgabe darf ihn schreiben (${c}).`,`Process key "${d.key}" is derived (derive) \u2014 no task may write it (${c}).`))}continue}a.has(d.key)||n.push(Fe(`processStore.${d.key}`,De.noWriter,`Vorgangs-Schl\xFCssel "${d.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${d.key}" is declared, but no task writes it ('result.writes').`))}n.push(...az(e,r,a,t));let l=new Map;for(let d of e.nodes){let c=He(d),u=typeof c.inputs=="function"?c.inputs(d):[];for(let f of u){let m=d.inputs?.[f.id];if(m?.kind!=="binding")continue;let y=lz(e,m.address);if(y===null)continue;let k=`node.${d.id}.input.${f.id}`,g=se(m.address);for(let A of y.sources){let R=l.get(A.key)??new Set;R.add(d.id),l.set(A.key,R)}if(y.audience==="internal"&&n.push(Fe(k,De.internalInDocument,`${d.label.de}: "${f.id}" liest den internen Vorgangs-Schl\xFCssel "${y.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${d.label.en}: "${f.id}" reads the internal process key "${y.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`)),y.derive!==void 0)continue;let v=dz(a,y.sources[0].key,y.sources[0].taskKey);if(v.template.when!==void 0&&f.required===!0&&f.defaultValue===void 0&&n.push(Fe(k,De.absentWithoutDefault,`${d.label.de}: "${f.id}" ist Pflicht und an ${g} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${Of(v.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${d.label.en}: "${f.id}" is required and bound to ${g}, but the writing task only exists under a condition (when: ${Of(v.template.when)}) \u2014 without a default value the field would stay empty forever.`)),v.result.kind==="pricedItem"&&f.defaultValue!==void 0){let A=f.defaultValue;(!Ei(A)||A.itemKey!==v.result.item||A.grantKeys.length>0)&&n.push(Fe(k,De.defaultItemMismatch,`${d.label.de}: der Vorgabewert von "${f.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.`,`${d.label.en}: the default value of "${f.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[d,c]of l){let u=a.get(d)[0],f=u.template.blocks,m=f===void 0?void 0:f.node??u.nodeId,y=m!==void 0&&c.has(m)&&(()=>{let g=e.nodes.find(v=>v.id===m);return g!==void 0&&He(g).processHoldTemplate?.(g)===f.templateKey})(),k=`node.${u.nodeId}.tasks.${u.taskKey}.blocks`;if(!y){let g=[...c][0],v=e.nodes.find(R=>R.id===g),A=He(v).processHoldTemplate?.(v)??"?";n.push(Fe(k,De.writerMustBlock,`Die Aufgabe "${u.taskKey}" schreibt "${d}", h\xE4lt aber keinen der lesenden Knoten (${[...c].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${g===u.nodeId?"":`node: '${g}', `}templateKey: '${A}' }, sonst arbeitet er, bevor der Wert existiert.`,`The task "${u.taskKey}" writes "${d}" but holds back none of the reading nodes (${[...c].join(", ")}) \u2014 it must block the first one, e.g. blocks: { ${g===u.nodeId?"":`node: '${g}', `}templateKey: '${A}' }, otherwise it works before the value exists.`));continue}for(let g of c)g===m||Sf(e,m,g)||n.push(Fe(k,De.writerMustBlock,`"${g}" liest "${d}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${m}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${g}" reads "${d}" but does not lie behind the held-back node "${m}" \u2014 on a path past it, it would read the value before it is settled.`))}return n}s(kO,"processBindingIssues");function az(e,t,n,r){let i=[],o=new Map(t.map(u=>[u.key,u])),a=cf(e),l=new Set;for(let[u,f]of a.entries()){let m=`pricingRules[${u}]`;if((typeof f.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(f.key)||l.has(f.key))&&i.push(Fe(m,De.ruleSet,`Regelgruppe ${JSON.stringify(f.key)} \u2014 ein eindeutiger Schl\xFCssel aus Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Rule group ${JSON.stringify(f.key)} \u2014 a unique key of letters, digits and _, starting with a lowercase letter.`)),l.add(f.key),(!f.label?.de?.trim()||!f.label?.en?.trim())&&i.push(Fe(m,De.ruleSet,`Regelgruppe "${f.key}" braucht ein Label in beiden Sprachen.`,`Rule group "${f.key}" needs a label in both languages.`)),!Array.isArray(f.rows)||f.rows.length===0){i.push(Fe(m,De.ruleSet,`Regelgruppe "${f.key}" hat keine Zeilen.`,`Rule group "${f.key}" has no rows.`));continue}for(let[y,k]of f.rows.entries()){let g=`${m}.rows[${y}]`;(!Array.isArray(k.grants)||k.grants.length===0||k.grants.some(A=>typeof A!="string"||A.length===0))&&i.push(Fe(g,De.ruleSet,`Regelgruppe "${f.key}", Zeile ${y+1}: nennt keine Rabattvorlage \u2014 eine Zeile ohne Rabatt ist die fehlende Zeile.`,`Rule group "${f.key}", row ${y+1}: names no discount template \u2014 a row without a discount is the missing row.`));let v=al(k.when);if(v!==null){i.push(Fe(g,De.ruleCondition,`Regelgruppe "${f.key}", Zeile ${y+1}: Bedingung ${JSON.stringify(k.when)} \u2014 ${v}.`,`Rule group "${f.key}", row ${y+1}: condition ${JSON.stringify(k.when)} \u2014 ${v==="leere Bedingung"?"empty condition":v}.`));continue}for(let{identifier:A,address:R}of ly(k.when)){if(R===null)continue;let E=cz(R,o,n);if(E==="ruleSource")i.push(Fe(g,De.ruleSource,`Regelgruppe "${f.key}", Zeile ${y+1}: liest ${A} \u2014 eine Bedingung liest nur Werte, die eine Aufgabe schreibt ($task.<aufgabe>.<schl\xFCssel>), vom Typ ${[...Oy].join(", ")}.`,`Rule group "${f.key}", row ${y+1}: reads ${A} \u2014 a condition only reads values that a task writes ($task.<task>.<key>), of type ${[...Oy].join(", ")}.`));else if(E==="ruleReadsAbsent"){let I=n.get(R.key).find(F=>F.taskKey===R.owner);i.push(Fe(g,De.ruleReadsAbsent,`Regelgruppe "${f.key}" liest ${A}, dessen Aufgabe entfallen kann (${I.template.when!==void 0?`when: ${Of(I.template.when)}`:"sie endet mit ihrem Knoten"}) \u2014 der Schl\xFCssel muss sagen, wof\xFCr er ohne Aufgabe steht ('absentValue'), sonst entschiede die Regel still \xFCber einen fehlenden Wert.`,`Rule group "${f.key}" reads ${A}, whose task can lapse (${I.template.when!==void 0?`when: ${Of(I.template.when)}`:"it ends with its node"}) \u2014 the key must say what it stands for without a task ('absentValue'), otherwise the rule would silently decide on a missing value.`))}}}}for(let u of t){if(u.absentValue===void 0)continue;let f=`processStore.${u.key}.absentValue`;if(!(u.type==="number"&&typeof u.absentValue=="number"||u.type==="boolean"&&typeof u.absentValue=="boolean"||u.type==="enum"&&typeof u.absentValue=="string"&&u.absentValue.length>0)){i.push(Fe(f,De.absentValue,`Vorgangs-Schl\xFCssel "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} passt nicht zum Typ.`,`Process key "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} does not fit the type.`));continue}let y=n.get(u.key)?.[0];y!==void 0&&!bO(y)&&i.push(Fe(f,De.absentValue,`Vorgangs-Schl\xFCssel "${u.key}": seine Aufgabe ist immer geschuldet und \xFCberlebt ihren Knoten \u2014 ein absentValue w\xFCrde nie gelesen.`,`Process key "${u.key}": its task is always owed and outlives its node \u2014 an absentValue would never be read.`))}let d=[];for(let u of t){let f=u.derive;if(f===void 0)continue;let m=`processStore.${u.key}.derive`,y=u.type==="pricedGroup"?"group":"item",k=[f.item,f.group,f.byStage].filter(F=>F!==void 0).length,g=ry(f),v=f.byStage??[];(k!==1||g.length===0||g.length!==Math.max(v.length,1)||g.some(F=>F.kind!==y))&&i.push(Fe(m,De.derive,`"${u.key}" (${u.type}) leitet ${y==="group"?"ein Paket ab: genau 'group' oder 'byStage' mit je einem 'group'":"einen Artikel ab: genau 'item' oder 'byStage' mit je einem 'item'"}.`,`"${u.key}" (${u.type}) derives ${y==="group"?"a package: exactly 'group' or 'byStage' with one 'group' each":"an article: exactly 'item' or 'byStage' with one 'item' each"}.`));let A=new Set;for(let[F,b]of v.entries()){if(!Array.isArray(b.stages)||b.stages.length===0){i.push(Fe(`${m}.byStage[${F}]`,De.derive,`"${u.key}": die Zeile ${F+1} nennt keine Stufe.`,`"${u.key}": row ${F+1} names no stage.`));continue}for(let $ of b.stages)A.has($)&&i.push(Fe(`${m}.byStage[${F}]`,De.derive,`"${u.key}": die Stufe "${$}" steht in mehr als einer Zeile \u2014 welcher Preis gilt, w\xE4re geraten.`,`"${u.key}": the stage "${$}" is in more than one row \u2014 which price applies would be a guess.`)),A.add($)}let R=new Set;for(let F of f.rules??[]){let b=a.find($=>$.key===F);if(b===void 0){i.push(Fe(m,De.derive,`"${u.key}" nennt die Regelgruppe "${F}", die der Workflow nicht deklariert (bekannt: ${a.map($=>$.key).join(", ")||"keine"}).`,`"${u.key}" names the rule group "${F}", which the workflow does not declare (known: ${a.map($=>$.key).join(", ")||"none"}).`));continue}for(let $ of b.rows??[])for(let q of $.grants??[])R.add(q)}let E=f.reduction;ve(E)&&(uz(E,o)||i.push(Fe(m,De.derive,`"${u.key}": Reduktion ${se(E)} ist kein von einer Aufgabe geschriebener Wert vom Typ reduction ($task.<aufgabe>.<schl\xFCssel>).`,`"${u.key}": reduction ${se(E)} is not a value of type reduction written by a task ($task.<task>.<key>).`)));for(let F of g)d.push({key:u.key,target:F,grants:R}),(F.kind==="item"?r.billingItemKeys?.has(F.key):r.groupArticleKeys?.has(F.key))===!1?i.push(Fe(m,De.derivePriceUnknown,`"${u.key}": ${F.kind==="item"?"der Artikel":"das Paket"} "${F.key}" ist nicht im Katalog des Mandanten.`,`"${u.key}": the ${F.kind==="item"?"article":"package"} "${F.key}" is not in the school's catalog.`)):r.offerProgram===null?i.push(Fe(m,De.derivePriceOfferWithoutProgram,`"${u.key}": das Angebot ist keinem Programm zugeordnet, also geh\xF6rt ${F.kind==="item"?"kein Artikel":"kein Paket"} zu ihm; dem Angebot ein Programm geben.`,`"${u.key}": the offer is not assigned to a program, so no ${F.kind==="item"?"article":"package"} belongs to it; give the offer a program.`)):r.offerProgram!==void 0&&((F.kind==="item"?r.offerProgram.billingItemKeys:r.offerProgram.groupKeys).has(F.key)||i.push(Fe(m,De.derivePriceNotInProgram,`"${u.key}": ${F.kind==="item"?"der Artikel":"das Paket"} "${F.key}" ist dem Programm \u201E${r.offerProgram.nameDe}\u201C des Angebots nicht zugeordnet${F.kind==="group"?" oder wird nicht angeboten":""} (unter Finanzen \u2192 Artikel zuordnen).`,`"${u.key}": the ${F.kind==="item"?"article":"package"} "${F.key}" is not assigned to the offer's program "${r.offerProgram.nameDe}"${F.kind==="group"?" or is not offered":""} (under Finance \u2192 assign articles).`)));let I=r.offerProgram?.stageKeys;if(f.byStage!==void 0&&I!==void 0){let F=[...A].filter($=>!I.all.has($));F.length>0&&i.push(Fe(m,De.deriveStageUnknown,`"${u.key}": ${F.map($=>`"${$}"`).join(", ")} ist keine Stufe des Programms \u201E${r.offerProgram.nameDe}\u201C (Stufen: ${[...I.all].join(", ")||"keine"}).`,`"${u.key}": ${F.map($=>`"${$}"`).join(", ")} ${F.length===1?"is not a stage":"are not stages"} of the program "${r.offerProgram.nameDe}" (stages: ${[...I.all].join(", ")||"none"}).`));let b=[...I.active].filter($=>!A.has($));b.length>0&&i.push(Fe(m,De.deriveStageUncovered,`"${u.key}": f\xFCr ${b.map($=>`"${$}"`).join(", ")} nennt byStage keinen ${y==="group"?"Paket":"Artikel"} \u2014 diese Stufe h\xE4tte keinen Preis.`,`"${u.key}": for ${b.map($=>`"${$}"`).join(", ")} byStage names no ${y==="group"?"package":"article"} \u2014 that stage would have no price.`))}}for(let u of n.values())for(let f of u){if(f.result.kind!=="reduction"||f.result.prices===void 0||f.result.writes===void 0)continue;let m=`node.${f.nodeId}.tasks.${f.taskKey}.result.prices`,k=o.get(f.result.prices)?.derive?.reduction;ve(k)&&k.scope==="task"&&k.owner===f.taskKey&&k.key===f.result.writes||i.push(Fe(m,De.reductionPrices,`Aufgabe "${f.taskKey}" senkt "${f.result.prices}" \u2014 das muss ein abgeleiteter Preis sein, dessen derive.reduction $task.${f.taskKey}.${f.result.writes} ist.`,`Task "${f.taskKey}" reduces "${f.result.prices}" \u2014 that must be a derived price whose derive.reduction is $task.${f.taskKey}.${f.result.writes}.`))}let c=r.grantTemplates;if(c!==void 0){let u=new Set(a.flatMap(f=>(f.rows??[]).flatMap(m=>m.grants??[])));for(let f of u){let m=c.get(f);if(m===void 0){i.push(Fe("pricingRules",De.ruleGrantUnknown,`Eine Regelgruppe vergibt "${f}", aber keine Rabattvorlage des Mandanten tr\xE4gt diesen Schl\xFCssel.`,`A rule group grants "${f}", but no discount template of the school has this key.`));continue}d.some(({target:k,grants:g})=>{if(!g.has(f))return!1;if(k.kind==="item")return m.itemKeys.includes(k.key);let v=r.groupArticleKeys?.get(k.key);return m.itemKeys.some(A=>v?.has(A))})||i.push(Fe("pricingRules",De.ruleGrantUnused,`Die Rabattvorlage "${f}" (gebunden an Artikel "${m.itemKeys.join(", ")}") wird vergeben, aber kein abgeleiteter Preis, der ihre Regelgruppe liest, enth\xE4lt ihr Ziel \u2014 sie wirkte nirgends.`,`The discount template "${f}" (bound to article "${m.itemKeys.join(", ")}") is granted, but no derived price reading its rule group contains its target \u2014 it would have no effect anywhere.`))}}return i}s(az,"derivedPriceIssues");function lz(e,t){if(!ve(t)||t.scope!=="task"&&t.scope!=="derived"||t.path!==void 0)return null;let n=If(e).find(o=>o.key===t.key);if(n===void 0||t.scope==="derived"!=(n.derive!==void 0))return null;if(t.scope==="task")return Cr(e,t.owner,t.key)===null?null:$y(e,t);let r=dI(e,n.derive),i=s(o=>o.scope==="task"&&o.path===void 0&&Cr(e,o.owner,o.key)!==null,"resolvable");return r!==null&&r.every(o=>i(o.address))?$y(e,t):null}s(lz,"draftLeafOf");function dz(e,t,n){let r=e.get(t)?.find(i=>i.taskKey===n);return r===void 0&&N(`[process] the leaf of "${t}" names task "${n}", which does not write it`),r}s(dz,"writerOf");function Of(e){return ve(e)?se(e):JSON.stringify(e)}s(Of,"shown");function cz(e,t,n){let r=e.scope==="task"&&e.path===void 0?t.get(e.key):void 0;if(e.scope==="task"&&e.path===void 0&&r===void 0)return null;if(e.scope!=="task"||r===void 0||r.derive!==void 0||!Oy.has(r.type))return"ruleSource";let i=n.get(r.key)?.find(o=>o.taskKey===e.owner);return i!==void 0&&bO(i)&&r.absentValue===void 0?"ruleReadsAbsent":null}s(cz,"ruleSourceRefusal");function uz(e,t){let n=e.scope==="task"&&e.path===void 0?t.get(e.key):void 0;return n!==void 0&&n.type==="reduction"&&n.derive===void 0}s(uz,"isReductionValue");function bO(e){return e.template.when!==void 0||e.template.blocks?.node===void 0}s(bO,"writerMayBeNotOwed");function Py(e){let t=He(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:t.outcomes&&t.outcomes.length>0?[...t.outcomes]:null}s(Py,"nodeOutcomes");var fz=["documentChangeRequested","documentReturned"];function vO(e){return fz.includes(e)}s(vO,"isNonAdvancingExternalEvent");var Fs=["offer","contract"];function Pf(e){return typeof e=="string"&&Fs.includes(e)}s(Pf,"isArtifactSlotType");var xO="open",Ls="done";function _y(e){let t={};for(let n of ze)t[n]=e(n);return t}s(_y,"localized");var SO=[{key:"tenantSlug",type:"string"}];var pz=/^(\d{4})-(\d{2})-(\d{2})$/;function mz(e){return e>=1900&&e<=2100}s(mz,"isSupportedYear");function hz(e,t,n){let r=new Date(Date.UTC(e,t-1,n));return r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n}s(hz,"isRealDate");function Cy(e){if(typeof e!="string")return null;let t=pz.exec(e);if(t===null)return null;let[,n,r,i]=t;return n===void 0||r===void 0||i===void 0||!mz(Number(n))||!hz(Number(n),Number(r),Number(i))?null:{year:n,month:r,day:i}}s(Cy,"isoDateParts");var gz="Europe/Berlin";function EO(){return gz}s(EO,"tenantTimeZone");var AO=new Map;function yz(e){let t=AO.get(e);if(t)return t;let n;try{n=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{ae("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return AO.set(e,n),n}s(yz,"formatterFor");function wz(e,t){let n=new Map(yz(e).formatToParts(new Date(t)).map(a=>[a.type,a.value])),r=s(a=>{let l=n.get(a);return l===void 0&&N(`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(t/1e3)*1e3}s(wz,"zoneOffsetAt");function Ny(e,t){let n=e+wz(t,e);return{wallClock:new Date(n).toISOString().slice(0,19),timeZone:t}}s(Ny,"instantToLocalDateTime");var Dy=3;function TO(e){return Ny(e,EO()).wallClock.slice(0,10)}s(TO,"localIsoDate");var _f=["login","security","admission","tasks","deadlines","schoolMessages","staffTasks","staffAppointments","staffDeadlines","staffWaitlist","familyMessages","mentions"],$O=w.union(..._f.map(e=>w.literal(e)));var Oce=w.union(w.literal("admission"),w.literal("tasks"),w.literal("staff"),w.literal("chat")),Fy=["loginOnly","all"],Pce=w.union(w.literal("loginOnly"),w.literal("all"));function RO(e){return typeof e=="string"&&Fy.includes(e)}s(RO,"isMailLevel");var wl="subject";function IO(e){return e.category==="login"}s(IO,"isSignInLetter");var dt={key:"schoolName",label:"Name der Schule"},OO={de:"Zu Ihren Bewerbungen",en:"View your applications"},vt={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:OO},Ly={key:vt.key,label:vt.label,link:!0,actionLabel:OO},PO={key:"authorName",label:"Name der schreibenden Person"},Ms={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},kl={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"}},bz={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"}},_O={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"}},CO={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},vz={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function Le(e){return{key:wl,label:"Betreff",default:e}}s(Le,"subjectSlot");var Di=w.object({de:w.string(),en:w.string()}),$t={tenantSlug:w.string(),applicationId:w.id("applications")},xz=w.object({tenantSlug:w.string()}),Sz={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:xz,channels:["email"],portalVisible:!0,placeholders:[dt,vt],slots:[Le({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:
10514
10514
 
10515
10515
  {{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
@@ -10984,6 +10984,6 @@ ${n.length} unusable ${o}:
10984
10984
  `),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
10985
10985
  `),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>
10986
10986
  `)}else this.context.stdout.write(`No unusable identities.
10987
- `);return n.length>0?1:0}},uE=class extends or{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=p.String({required:!0});async execute(){let n=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function ij(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(ij,"requireOnOff");var oj=[YA,HA,JA,QA,ZA,XA,eE,tE,nE,rE,Yc,iE,oE,sE,aE,lE,dE,cE,uE];function sj(e){return e.de??e.en??Object.values(e)[0]??""}s(sj,"titleDe");function GQ(e){return{id:e._id,kind:e.kind,status:e.status,title:sj(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(GQ,"row");var zQ=["id","kind","status","title","assignee","group","outcome"],mE=class extends C{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=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(GQ),zQ),0}},hE=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:sj(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}},gE=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},yE=class extends C{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=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},wE=class extends C{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=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},aj=[mE,hE,gE,yE,wE];var Hc=[...Z$,...V_,...tC,...mN,...pN,...KN,...WN,...zN,...nj,...oj,...tj,...Hq,...R_,...FN,...VK,...J$,...xR,...E_,...JN,...HN,...XN,...eD,...NN,...bN,...aj,...Y0,...CM,...Wq,...NM,...$K,...DK,...Jq,...oK,...lK,...cK,...fK,...MK,...YK,...mR];for(let e of Hc){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:kT(e.usage.category,t.join(" "))})}var lj="0.1.76";function dj(){return Hc.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=hT[so(n)];return{path:n,effect:ao(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(dj,"plexusCommandCatalog");import Ho from"node:path";function WQ(e){let t=at()?.workspaceRoot??process.cwd(),n=Ho.resolve(t,e),r=Ho.relative(t,n);if(Ho.isAbsolute(e)||r===".."||r.startsWith(`..${Ho.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(WQ,"workspacePath");function YQ(e){let{absolute:t,relative:n}=WQ(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of Ar(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Ho.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ho.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return Je(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return _t(Ho.dirname(t),{recursive:!0}),Je(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Xo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(YQ,"plexusWorkspace");function cj(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=el[n];if(!o||!Object.hasOwn(el,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn($g,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:$g[i.path],skillHash:Uu}}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 YQ(i)},"executePlexusAgentTool")}s(cj,"createPlexusAgentToolExecutor");var fh=cj({inspectCommand:fj,executeCommand:pj});function ph(){let e=new rs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:lj});e.register(La.HelpCommand),e.register(La.VersionCommand);for(let n of Hc)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return QQ(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(ph,"createPlexusCli");function QQ(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Ba[n]===r&&ot(t,n,r),n in Ba&&ao(n)==="confirm"&&!Ua(e)&&t.write(`plexus-cli: \`${Ba[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
10987
+ `);return n.length>0?1:0}},uE=class extends or{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=p.String({required:!0});async execute(){let n=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function ij(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(ij,"requireOnOff");var oj=[YA,HA,JA,QA,ZA,XA,eE,tE,nE,rE,Yc,iE,oE,sE,aE,lE,dE,cE,uE];function sj(e){return e.de??e.en??Object.values(e)[0]??""}s(sj,"titleDe");function GQ(e){return{id:e._id,kind:e.kind,status:e.status,title:sj(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(GQ,"row");var zQ=["id","kind","status","title","assignee","group","outcome"],mE=class extends C{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=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(GQ),zQ),0}},hE=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(x.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:sj(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}},gE=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},yE=class extends C{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=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},wE=class extends C{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=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(x.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},aj=[mE,hE,gE,yE,wE];var Hc=[...Z$,...V_,...tC,...mN,...pN,...KN,...WN,...zN,...nj,...oj,...tj,...Hq,...R_,...FN,...VK,...J$,...xR,...E_,...JN,...HN,...XN,...eD,...NN,...bN,...aj,...Y0,...CM,...Wq,...NM,...$K,...DK,...Jq,...oK,...lK,...cK,...fK,...MK,...YK,...mR];for(let e of Hc){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:kT(e.usage.category,t.join(" "))})}var lj="0.1.77";function dj(){return Hc.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=hT[so(n)];return{path:n,effect:ao(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(dj,"plexusCommandCatalog");import Ho from"node:path";function WQ(e){let t=at()?.workspaceRoot??process.cwd(),n=Ho.resolve(t,e),r=Ho.relative(t,n);if(Ho.isAbsolute(e)||r===".."||r.startsWith(`..${Ho.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(WQ,"workspacePath");function YQ(e){let{absolute:t,relative:n}=WQ(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of Ar(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Ho.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ho.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return Je(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return _t(Ho.dirname(t),{recursive:!0}),Je(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Xo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(YQ,"plexusWorkspace");function cj(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=el[n];if(!o||!Object.hasOwn(el,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn($g,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:$g[i.path],skillHash:Uu}}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 YQ(i)},"executePlexusAgentTool")}s(cj,"createPlexusAgentToolExecutor");var fh=cj({inspectCommand:fj,executeCommand:pj});function ph(){let e=new rs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:lj});e.register(La.HelpCommand),e.register(La.VersionCommand);for(let n of Hc)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return QQ(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(ph,"createPlexusCli");function QQ(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Ba[n]===r&&ot(t,n,r),n in Ba&&ao(n)==="confirm"&&!Ua(e)&&t.write(`plexus-cli: \`${Ba[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
10988
10988
  `)}s(QQ,"noteRetiredPath");function fj(e){let t=ph().process(Ra(e),{executePlexusAgentTool:fh}),n=t.path.join(" ");if(n.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=dj().find(l=>l.path===n);if(!r){if(n===""||n==="--help"||n==="--version")return{path:n,writes:!1,host:"shared"};throw new Error(`plexus: command ${n} has no host classification.`)}let i=t,o=r.effect==="callKind"?Op(oa(sa),i.fn??"",i.kind):void 0,a=Ou(n,{confirm:Ua(t),callKind:o});return{...r,writes:a}}s(fj,"inspectPlexusCommand");async function pj(e,t){if(t)return vE(t,()=>pj(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let n="",r="",i=ph();if(at()){let l=fj(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(Ra(e.argv),{executePlexusAgentTool:fh,stdin:JQ.from(e.stdin===void 0?[]:[e.stdin]),stdout:new uj({write(l,d,c){n+=String(l),c()}}),stderr:new uj({write(l,d,c){r+=String(l),c()}})}),stdout:n,stderr:r}}s(pj,"executePlexusCommand");TE({source:ZQ.join(import.meta.dirname,"skill")});ph().runExit(Ra(process.argv.slice(2)),{executePlexusAgentTool:fh});
10989
10989
  //# sourceMappingURL=cli.mjs.map