@smartkomm/plexus-cli 0.1.130 → 0.1.132
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
|
@@ -4570,7 +4570,7 @@ reason is gone.
|
|
|
4570
4570
|
|
|
4571
4571
|
## Related
|
|
4572
4572
|
- [Start a test application and drive it end to end](./start-a-test-application.md)
|
|
4573
|
-
`,"references/applications/inspect-process-store.md":"# Inspect an application's process store\n\n**When to use:** see what the process of ONE application has produced and what it is still\nwaiting for \u2014 a form instance, a document, a contract with its current revision, a payment,\na value a task wrote (`$task.<task>.<key>`), a derived price (`$derived.<key>`) and the\napplication's facts (`$env.applicant.language`). Typical questions: why a contract input is\nempty, why a price \u201Ewartet\", which revision a contract node points at, whether a task value\ncounts after a re-open. Replaces raw `call processStoreView:get`.\n\n## Prerequisites\n- `--tenant`; the token's user holds `bewerbungsmanagement.applications.manage` (the query is\n staff-only: it shows every value whatever its `audience`).\n- The application id (`applications list --offer <slug>`).\n- Read-only: no `--env` guard, works against prod with the usual token.\n\n## Steps\n```bash\nE=\"--env staging --tenant test\"\n\n# One row per address: state, what it holds, producing node, when written.\nplexus-cli $E applications store <applicationId>\n\n# The same as JSON, keyed by the canonical address \u2014 the shape the cockpit's\n# \u201EProzessdaten\" block (Graph tab, manage grant) shows.\nplexus-cli $E applications store <applicationId> --json\n```\n\n## Reading it\n- **Every address of the PINNED graph** is listed \u2014 the application's own version, not the\n live head: `$node.<node>.<key>` for each node result, `$task.<task>.<key>` for each value a\n task writes, `$derived.<key>` for each derived price, then `$env.*`.\n- **State is resolved, never the newest row:**\n - `present` \u2014 the producer's result; for a task value the entry of the task row that is\n currently effective (`writtenByTaskId`, `writtenAt`); for a price the computed value.\n - `pending` \u2014 not there yet. A task value or a price names the reason (\u201E\u2026 ist noch offen\",\n \u201E\u2026 ist noch nicht erreicht\"); a `$node` result that its node has not written yet has none.\n A form instance in `draft` is `present` with `state: draft`.\n - `absent` \u2014 none is coming: the writing task is not owed (its condition is false), or the\n application has no applicant account (`$env.applicant.language`).\n- **Refs are resolved live:** `form` \u2192 instance and its state; `document` \u2192 the slot and its\n newest file; `contract` \u2192 contract id, current revision (`revisionNumber`) and\n `contractStatus` (`signed` / `inSignature` / `withdrawn` / `draft` / `active`, derived in that precedence).\n\n## Verify\n- A completed store-writing task shows `present` with its `writtenByTaskId`; re-open it and\n the address turns `pending` \u2014 the old entry stays as history but no longer counts.\n\n## Gotchas\n- **Never hand the output to the family.** It carries internal values (a need-based tier,\n a reduction) that no family surface shows.\n- **A redacted application is refused** (\u201EDie Daten dieser Bewerbung wurden gel\xF6scht.\") \u2014\n its process data are deleted; the view never answers with an empty store.\n- **Texts are German** (reasons, producer labels) \u2014 they are the resolvers' own texts.\n- **Forbidden** for a member with only `applications.read`: the view needs the manage grant.\n- A `bug` naming `[process]` (a ref whose target is gone, a done task without its entry) is a\n data defect, not a display problem \u2014 report it to the platform operator with the\n application id and the address.\n\n## Related\n- [Start a test application and drive it end to end](./start-a-test-application.md)\n- [Addresses in a workflow](../offer/addresses.md) \u2014 what the addresses mean and who may read them\n","references/applications/start-a-test-application.md":"# Start a test application and drive it end to end\n\n**When to use:** check an offer from the terminal the way a family would go through it \u2014\nstart a test application, load a form scenario and submit, run the next step's actions,\nlook at the result, throw the application away. Replaces raw `call\nadmission:staffStartApplicationForParty` / `workflow:runTestAction` / `admission:discardTest`.\n\n## Prerequisites\n- `--env` named on the command line for every writing verb (`start-test`, `discard-test`,\n `test-actions run`) \u2014 the configured default is not enough. Prod additionally needs\n `--allow-prod`, and there a test application starts only for the tenant's test account\n (`test@example.com`, see [Use a tenant's test account](../users/use-test-account.md)).\n- `--tenant`; the token's user holds `bewerbungsmanagement.applications.manage` and\n `bewerbungsmanagement.testActions.run` \u2014 the server asks for both to start in test mode,\n and the second for every test action.\n- The applicant: an existing account of this school (`--applicant <login address>`) or its\n party id (`--party`). Creating an account has no verb (it needs the cockpit's password flow).\n- School year and level by **key or id** \u2014 never by name (`applications start-test` lists\n both when one does not match).\n\n## Steps\n```bash\nE=\"--env staging --tenant test\"\n\n# 1. Start (always test mode); prints the application id and what test mode offers now.\nplexus-cli $E applications start-test --offer grundschule-havelland \\\n --run <runKey|runId> --stage klasse-1 --applicant test@example.com\n# An offer that declares staff inputs needs each one, once:\n# --staff-input staffApplication=false (see ../offer/staff-input-if-node.md)\n\n# 2. Load a scenario and submit (file fields are stubbed first; runs asynchronously).\nplexus-cli $E test-actions run --application <id> --action load-scenario:standard\n\n# 3. See where it stands and what the next node offers; run an action there.\nplexus-cli $E applications show <id>\nplexus-cli $E test-actions list --application <id>\nplexus-cli $E test-actions run --application <id> --action takeResponsibility\n\n# 4. Throw it away.\nplexus-cli $E applications discard-test <id>\n```\n\nReading verbs (no `--env` needed beyond the usual resolution):\n```bash\nplexus-cli $E applications list --offer grundschule-havelland [--test-only]\nplexus-cli $E applications counts --offer grundschule-havelland\n```\n\n## Verify\n- `applications show <id>` prints `test: ja`, the current nodes and the status.\n- After step 2, `test-actions list` shows the next node's actions (the submit lands a moment\n after `run` returns \u2014 file fills are a scheduled action).\n- After step 4, `applications list --offer \u2026 --test-only` no longer lists it.\n\n## Idempotency / gotchas\n- `start-test` creates a new application on every call; `discard-test` on a real application\n is refused by the server.\n- `--run`/`--stage` match a key or an id only; a display name is refused with the list of\n what exists. A closed school year is refused.\n- Without `--version` the application runs on the offer's live generation (as in the cockpit).\n `plexus-cli offer versions --offer <slug>` lists every generation (draft, internal, live,\n archived) with the `offerVersionId` that `--version` takes.\n- On prod: `--allow-prod`, and only `--applicant test@example.com` \u2014 a test run must never land\n in a real family's portal.\n\n## Related\n- [Drive a test application through test mode](../test-actions/drive-a-test-application.md) \xB7\n [Author a form's test scenarios](../offer/author-form-scenarios.md)\n","references/audit/answer-access-request.md":`# Answer a data-subject access request: who viewed this application?
|
|
4573
|
+
`,"references/applications/inspect-process-store.md":"# Inspect an application's process store\n\n**When to use:** see what the process of ONE application has produced and what it is still\nwaiting for \u2014 a form instance, a document, a contract with its current revision, a payment,\na value a task wrote (`$task.<task>.<key>`), a derived price (`$derived.<key>`) and the\napplication's facts (`$env.applicant.language`). Typical questions: why a contract input is\nempty, why a price \u201Ewartet\", which revision a contract node points at, whether a task value\ncounts after a re-open. Replaces raw `call processStoreView:get`.\n\n## Prerequisites\n- `--tenant`; the token's user holds `bewerbungsmanagement.applications.manage` (the query is\n staff-only: it shows every value whatever its `audience`).\n- The application id (`applications list --offer <slug>`).\n- Read-only: no `--env` guard, works against prod with the usual token.\n\n## Steps\n```bash\nE=\"--env staging --tenant test\"\n\n# One row per address: state, what it holds, producing node, when written.\nplexus-cli $E applications store <applicationId>\n\n# The same as JSON, keyed by the canonical address \u2014 the shape the cockpit's\n# \u201EProzessdaten\" block (Graph tab, manage grant) shows.\nplexus-cli $E applications store <applicationId> --json\n```\n\n## Reading it\n- **Every address of the PINNED graph** is listed \u2014 the application's own version, not the\n live head: `$node.<node>.<key>` for each node result, `$task.<task>.<key>` for each value a\n task writes, `$derived.<key>` for each derived price, then `$env.*`.\n- **State is resolved, never the newest row:**\n - `present` \u2014 the producer's result; for a task value the entry of the task row that is\n currently effective (`writtenByTaskId`, `writtenAt`); for a price the computed value.\n - `pending` \u2014 not there yet. A task value or a price names the reason (\u201E\u2026 ist noch offen\",\n \u201E\u2026 ist noch nicht erreicht\"); a `$node` result that its node has not written yet has none.\n A form instance in `draft` is `present` with `state: draft`.\n - `absent` \u2014 none is coming: the writing task is not owed (its condition is false), or the\n application has no applicant account (`$env.applicant.language`).\n- **Refs are resolved live:** `form` \u2192 instance and its state; `document` \u2192 the slot and its\n newest file; `contract` \u2192 contract id, current revision (`revisionNumber`) and\n `contractStatus` (`signed` / `inSignature` / `withdrawn` / `draft` / `active`, derived in that precedence).\n\n## Verify\n- A completed store-writing task shows `present` with its `writtenByTaskId`; re-open it and\n the address turns `pending` \u2014 the old entry stays as history but no longer counts.\n\n## Gotchas\n- **Never hand the output to the family.** It carries internal values (a need-based tier,\n a reduction) that no family surface shows.\n- **A redacted application is refused** (\u201EDie Daten dieser Bewerbung wurden gel\xF6scht.\") \u2014\n its process data are deleted; the view never answers with an empty store.\n- **Texts are German** (reasons, producer labels) \u2014 they are the resolvers' own texts.\n- **Forbidden** for a member with only `applications.read`: the view needs the manage grant.\n- A `bug` naming `[process]` (a ref whose target is gone, a done task without its entry) is a\n data defect, not a display problem \u2014 report it to the platform operator with the\n application id and the address.\n\n## Related\n- [Start a test application and drive it end to end](./start-a-test-application.md)\n- [Addresses in a workflow](../offer/addresses.md) \u2014 what the addresses mean and who may read them\n","references/applications/start-a-test-application.md":"# Start a test application and drive it end to end\n\n**When to use:** check an offer from the terminal the way a family would go through it \u2014\nstart a test application, load a form scenario and submit, run the next step's actions,\nlook at the result, throw the application away. Replaces raw `call\nadmission:staffStartApplicationForParty` / `workflow:runTestAction` / `admission:discardTest`.\n\n## Prerequisites\n- `--env` named on the command line for every writing verb (`start-test`, `discard-test`,\n `test-actions run`) \u2014 the configured default is not enough. Prod additionally needs\n `--allow-prod`, and there a test application starts only for the tenant's test account\n (`test@example.com`, see [Use a tenant's test account](../users/use-test-account.md)).\n- `--tenant`; the token's user holds `bewerbungsmanagement.applications.manage` and\n `bewerbungsmanagement.testActions.run` \u2014 the server asks for both to start in test mode,\n and the second for every test action.\n- The applicant: an existing account of this school (`--applicant <login address>`) or its\n party id (`--party`). Creating an account has no verb (it needs the cockpit's password flow).\n- School year and level by **key or id** \u2014 never by name (`applications start-test` lists\n both when one does not match).\n\n## Steps\n```bash\nE=\"--env staging --tenant test\"\n\n# 1. Start (always test mode); prints the application id and what test mode offers now.\nplexus-cli $E applications start-test --offer grundschule-havelland \\\n --run <runKey|runId> --stage klasse-1 --applicant test@example.com\n# An offer that declares staff inputs needs each one, once:\n# --staff-input staffApplication=false (see ../offer/staff-input-if-node.md)\n\n# 2. Load a scenario and submit (file fields are stubbed first; runs asynchronously).\nplexus-cli $E test-actions run --application <id> --action load-scenario:standard\n\n# 3. See where it stands and what the next node offers; run an action there.\nplexus-cli $E applications show <id>\nplexus-cli $E test-actions list --application <id>\nplexus-cli $E test-actions run --application <id> --action takeResponsibility\n\n# 4. Throw it away.\nplexus-cli $E applications discard-test <id>\n```\n\nReading verbs (no `--env` needed beyond the usual resolution):\n```bash\nplexus-cli $E applications list --offer grundschule-havelland [--test-only]\nplexus-cli $E applications counts --offer grundschule-havelland\n```\n\n## Verify\n- `applications show <id>` prints `test: ja`, the current nodes and the status.\n- After step 2, `test-actions list` shows the next node's actions (the submit lands a moment\n after `run` returns \u2014 file fills are a scheduled action).\n- After step 4, `applications list --offer \u2026 --test-only` no longer lists it.\n\n## Idempotency / gotchas\n- `start-test` creates a new application on every call; `discard-test` on a real application\n is refused by the server.\n- `--run`/`--stage` match a key or an id only; a display name is refused with the list of\n what exists. A closed school year is refused.\n- Without `--version` the application runs on the offer's live generation (as in the cockpit).\n `plexus-cli offer versions --offer <slug>` lists every generation (draft, internal, live,\n archived) with the `offerVersionId` that `--version` takes.\n- On prod: `--allow-prod`, and only `--applicant test@example.com` \u2014 a test run must never land\n in a real family's portal.\n- A test application mails nobody, staff and appointment hosts included: each letter\n about it is rendered and recorded, and its delivery settles `skipped` / `test_application`.\n Read it with `platform notifications show <deliveryId>`. Mail that went out before that rule\n survives `discard-test` (`notifications.discardedTestApplicationId`); its calendar entry is not\n cancelled, because a CANCEL would be real mail again.\n\n## Related\n- [Drive a test application through test mode](../test-actions/drive-a-test-application.md) \xB7\n [Author a form's test scenarios](../offer/author-form-scenarios.md)\n","references/audit/answer-access-request.md":`# Answer a data-subject access request: who viewed this application?
|
|
4574
4574
|
|
|
4575
4575
|
**When to use:** an applicant (or their parent) asks *"who looked at my child's
|
|
4576
4576
|
application, and when?"* \u2014 an Art. 15 DSGVO request \u2014 and you must produce the
|
|
@@ -10962,7 +10962,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
|
|
|
10962
10962
|
## Related
|
|
10963
10963
|
- Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
|
|
10964
10964
|
\`plexus-cli platform imports cleanup-orphaned --help\`.
|
|
10965
|
-
`};var Zu="655cbe614f0e81f3e0f0b5ab0775dc136a3516986df216ebc13a44839b190855",Wg=FR;var Hg=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=$.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Zu,tools:dl}),0}},Yg=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=$.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await zg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},LR=[Hg,Yg];var Jg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Yae=new Set(Jg.map(e=>e.key));function qR(e,n,t,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===n);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${n}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${n} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===t||l.runId===t);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${t}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(qR,"resolveStartTarget");function sz(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(sz,"applicantText");function KR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:sz(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(KR,"applicationRows");var MR=Jg.map(e=>e.email);function jR(e,n,t,r){if(t===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(Vg(e,n)&&(r===void 0||!MR.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${MR.join(", ")} (--applicant) \u2014 never a real family's`)}s(jR,"assertStartApplicant");function BR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(BR,"processStoreJson");function az(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(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.revisionNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(az,"refText");function lz(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?az(e.ref):JSON.stringify(e.value)}s(lz,"holds");function VR(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:lz(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(VR,"storeRows");function Xu(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(Xu,"parseKv");var UR="started",ef="submitted",nf="submitted",GR="load-scenario:";var zR="(Bewerbung)";function WR(e){return{nodeId:zR,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(WR,"sharedAsList");function HR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(HR,"disabledText");function YR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:HR(r)})))}s(YR,"actionRows");function JR(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${n}" on ${i} is disabled: ${HR(a)}`);if(i!==zR)return i;let l=t[0];if(l===void 0)throw new Error(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(JR,"nodeOfferingAction");function QR(e,n,t){if(e.startsWith(GR)){if(Object.hasOwn(t,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(QR,"runParams");async function dz(e,n){let t=await e.query(x.workflow.getInstance,{applicationId:n});if(t===null)throw new Error(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(dz,"currentNodeIds");function cz(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(cz,"refusalText");async function tf(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${cz(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(x.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,WR(r.actions)]}s(tf,"actionsOf");async function ZR(e,n,t){return t!==void 0?[t]:await dz(e,n)}s(ZR,"nodesOf");var Qg=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=$.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await tf(n,this.application,await ZR(n,this.application,this.node));return this.print(t,YR,["node","action","label","disabled"]),0}},Zg=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=$.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=QR(this.action,this.autoSubmit,Xu(this.param??[]).values),t=await this.caller(),r=this.application,i=await ZR(t,this.application,this.node),o=JR(await tf(t,r,i),this.action,i);return await t.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},XR=[Qg,Zg];var He=["de","en"];function ys(e,n){return He.every(t=>e[t]===n[t])}s(ys,"sameText");function On(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!He.includes(r))?"not-localized":He.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(On,"missingLocales");function Ri(e){let n=On(e);return n!=="not-localized"&&n.length===0}s(Ri,"isLocalizedText");function cl(e,n){let t={};for(let r of He){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(cl,"composeTexts");var pr=/^[a-z][A-Za-z0-9]*$/;function Xg(e){return typeof e=="string"&&pr.test(e)}s(Xg,"isNodeId");function ws(e,n){Xg(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${pr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(ws,"makeNodeId");var Ii="$env";function se(e){if(e.scope==="env")return`${Ii}.${e.key}`;let n=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(se,"formatAddress");var Fr=/^[a-z][a-zA-Z0-9_]*$/,uz=/^[A-Za-z_][A-Za-z0-9_]*$/;function ho(e){return typeof e=="string"&&e.split(".").every(n=>uz.test(n))}s(ho,"isPath");function Xr(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&ho(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Fr.test(i)?null:eI({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Fr.test(o)||(t==="node"?!pr.test(i):!Fr.test(i))?null:eI({scope:t,owner:i,key:o},a)}default:return null}}s(Xr,"tryParseAddress");function eI(e,n){if(n.length===0)return e;let t=n.join(".");return ho(t)?{...e,path:t}:null}s(eI,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:n.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!ho(n.path))return!1;switch(n.scope){case"env":return ho(n.key);case"derived":return typeof n.key=="string"&&Fr.test(n.key);case"node":return typeof n.owner=="string"&&pr.test(n.owner)&&typeof n.key=="string"&&Fr.test(n.key);case"task":return typeof n.owner=="string"&&Fr.test(n.owner)&&typeof n.key=="string"&&Fr.test(n.key);default:return!1}}s(we,"isAddress");var ei={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"}},ks=Object.keys(ei);function bs(e){return Object.hasOwn(ei,e)}s(bs,"isEnvKey");var fz=["self-service","staff"];function nI(e,n){return{kind:"fixed",values:e,labels:n}}s(nI,"fixedSet");var rf={of:"applicant.language",withoutValue:"de"},ni={"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:rf},"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:rf},"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:rf},"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:rf},"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:nI(He,{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:nI(fz,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},of={types:ei,fields:ni},sf=ks.flatMap(e=>Object.keys(ei[e]).map(n=>`${e}.${n}`));function Ht(e){return Object.hasOwn(ni,e)}s(Ht,"isEnvLeaf");function af(e){return`${Ii}.${e}`}s(af,"envIdentifier");function go(e){let n=ni[e],[t,r]=e.split("."),i=ei[t][r];i===void 0&&F(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&F(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(go,"envLeaf");var tI="staffInput";var pz=["boolean"],ul=/^[a-z][A-Za-z0-9]*$/;function lf(e){return e.staffInputs??[]}s(lf,"staffInputsOf");function df(e){return`${tI}.${e}`}s(df,"staffInputLeaf");function rI(e){return`${Ii}.${df(e)}`}s(rI,"staffInputIdentifier");function mz(e){let n=`${tI}.`;return e.startsWith(n)?e.slice(n.length):null}s(mz,"staffInputKeyOfLeaf");function vs(e,n){let t=mz(n);return t===null?void 0:lf(e).find(r=>r.key===t)}s(vs,"declaredStaffInput");function iI(e){return[...lf(e).map(n=>({leaf:df(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...sf.map(n=>{let t=go(n);return{leaf:n,type:t.type,label:t.label,valueSet:ni[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(iI,"envLeavesFor");function oI(e){return iI(e).filter(n=>!n.cohortBound)}s(oI,"conditionEnvLeaves");function sI(e){return lI(oI(e))}s(sI,"envConditionSchemaFor");function hz(e){return iI(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(hz,"offerConditionEnvLeaves");function aI(e){return lI(hz(e))}s(aI,"offerConditionSchemaFor");function lI(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(lI,"schemaOfLeaves");function dI(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};ul.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),pz.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=On(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(dI,"staffInputIssues");var dy={required:!0,description:"Offer slug (its offerKey)"},ey=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=$.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",dy);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(x.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=KR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},ny=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=$.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",dy);async execute(){let n=await this.caller(),t=await n.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},ty=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=$.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},ry=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=$.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=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(BR(t),()=>VR(t),["address","state","holds","producer","written"]),0}},iy=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=$.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",dy);run=f.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=f.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();jR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=qR(await n.query(x.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await n.query(x.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(x.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:uI(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await n.query(x.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await tf(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},oy=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=$.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=gz(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(x.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new Error(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(x.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function gz(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new Error(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(gz,"parseDays");var sy=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=$.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},ay=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=$.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},ly=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=$.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=uI([this.input]);return await n.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},cI=[ey,ny,ty,ry,iy,oy,sy,ay,ly];function uI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!ul.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(uI,"parseStaffInputs");var Gn="contractGenerator",yo="documentTemplate";function fl(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return(n.kind==="generator"||n.kind==="package")&&typeof n.key=="string"&&n.key.length>0&&(n.revision===void 0||typeof n.revision=="number"&&Number.isInteger(n.revision)&&n.revision>0)&&t.every(r=>r==="kind"||r==="key"||r==="revision")}s(fl,"isGeneratorRef");function fI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(fI,"literalOf");function ti(e){let n=fI(e,Gn);return fl(n)?n:null}s(ti,"generatorRefOfNode");function mr(e){let n=fI(e,yo);return typeof n=="string"&&n.length>0?n:null}s(mr,"documentTemplateKeyOfNode");function pI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(pI,"generatorRefLabel");var yz=["formExports","generatorStamp"];function mI(e,n,t){let r=e.inputs?.[Gn];(r?.kind!=="literal"||!fl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Gn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Gn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts}}}s(mI,"applyGeneratorStamp");var wz=["reads"];function xs(e){if(e===null||typeof e!="object")return e;let n={...e};return Array.isArray(n.nodes)&&(n.nodes=n.nodes.map(t=>{if(t===null||typeof t!="object")return t;let r={...t};for(let i of yz)delete r[i];for(let i of wz)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(xs,"comparableWorkflowGraph");var pl={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 cf(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=pl[n];return t!==void 0?`manifest: \`${n}\` is no longer part of manifest.json (${t.en}). Delete the line.`:`manifest: unknown key \`${n}\` \u2014 manifest.json carries no key.`})}s(cf,"manifestIssues");function kz(e){let n=[],t=e.buses;if(!Array.isArray(t))return n;let r=t.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return n;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";n.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return n}s(kz,"validateProgressLayoutExternalCopy");function hI(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let n=e.buses;return!Array.isArray(n)||!n.some(t=>!!t&&typeof t=="object"&&t.key==="process")?["progressLayout: the layout must declare the `process` bus"]:kz(e)}s(hI,"progressLayoutIssues");var gI=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var bz=new Set(["sections","effects","outcomes","testScenarios","env","views"]),uf={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 yI(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${n}: die Formulardefinition muss ein Objekt sein.`,en:`${n}: the form definition must be an object.`}];let t=[];for(let i of Object.keys(e)){if(bz.has(i))continue;let o=uf[i];t.push(o!==void 0?{de:`${n}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${n}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${n}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${n}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||t.push({de:`${n}: \`${i}\` muss eine Liste sein.`,en:`${n}: \`${i}\` must be a list.`});return t}s(yI,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Oi(e){return typeof e=="string"&&bt.includes(e)}s(Oi,"isOutcomeSemantic");var Yt=["arrival","manual"],wI={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function vz(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(vz,"literal");function cy(e){let n=vz(e,"waitlistOrder");return Yt.includes(n)?{waitlistOrder:n}:null}s(cy,"waitlistPolicyOrNull");var kn="responsible",uy="team:";function ff(e){return`${uy}${e}`}s(ff,"teamSlot");function pf(e){return e.startsWith(uy)?e.slice(uy.length):null}s(pf,"teamKeyOfSlot");function kI(e){return e.kind==="responsible"?kn:ff(e.groupKey)}s(kI,"slotIdOf");function mf(e){if(e===kn)return{kind:"responsible"};let n=pf(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(mf,"slotOfId");var fy="review",py="checkField",bI="reviewed",vI="reviewing",hf=["rejected","waitlisted"];function my(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(my,"isObject");var xz=new Set(["decision",fy]),xI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function hy(e){return Object.hasOwn(xI,e)?xI[e]:void 0}s(hy,"legacySemanticOfId");function Sz(e){return e===fy?bt.filter(n=>!hf.includes(n)):bt}s(Sz,"allowedSemanticsFor");var Az="other";function SI(e){return my(e)&&xz.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(SI,"outcomesOf");function AI(e){return(e?.nodes??[]).some(n=>SI(n).some(t=>my(t)&&!("semantic"in t)))}s(AI,"needsOutcomeSemantics");function EI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=SI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=Sz(u),h=!1,w=l.map(k=>{if(!my(k))return k;let y=String(k.id);if("semantic"in k)return Oi(k.semantic)||i.push({nodeId:c,outcomeId:y,value:String(k.semantic)}),k;let v=`${c}.${y}`,E=Object.hasOwn(n,v)?n[v]:void 0;if(E!==void 0)return p.includes(E)?(t.push({nodeId:c,outcomeId:y,semantic:E,source:"answer"}),h=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p,answer:E}),k);let A=hy(y),I=A??Az;return p.includes(I)?(t.push({nodeId:c,outcomeId:y,semantic:I,source:A===void 0?"formerDefault":"legacyTable"}),h=!0,{...k,semantic:I}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p}),k)});return h?{...d,outcomes:w}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(EI,"addOutcomeSemantics");var hr="bewerbungOffen";function wo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(wo,"isObject");var gy=["event","effect"];function TI(e){return wo(e)&&e.type==="eventTrigger"}s(TI,"isTrigger");function $I(e){let n=wo(e.inputs)?e.inputs:{};return"outcomes"in e||gy.some(t=>t in e||t in n)}s($I,"oldShape");function RI(e){return(e?.nodes??[]).some(n=>TI(n)&&$I(n))}s(RI,"needsEventTriggerStartMove");function Ez(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>wo(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===hr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(wo(e.next)?e.next:{});if(!(i.length===1&&i[0]===hr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=wo(e.inputs)?{...e.inputs}:{};for(let l of gy){let d=o[l];if(wo(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of gy)delete a[l],delete o[l];return wo(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(Ez,"moveNode");function II(e){let n=[],t=[],r=e.nodes.map(i=>{if(!TI(i)||!$I(i))return i;let o=Ez(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(II,"moveEventTriggerStart");function ml(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ml,"isObject");var OI={waitlistOrder:"arrival"};function PI(e){return!ml(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(ml(e.inputs)?e.inputs:{}))}s(PI,"lacksPolicy");function Tz(e){return(e?.nodes??[]).some(PI)}s(Tz,"needsWaitlistPolicyMove");function yy(e){return ml(e)&&Yt.includes(e.waitlistOrder)}s(yy,"isWaitlistPolicy");function $z(e){if(e===void 0)return{policy:OI,stated:!1};if(!ml(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Yt.includes(n)?"malformed":{policy:{waitlistOrder:n??OI.waitlistOrder},stated:n!==void 0}}s($z,"policyOfSelection");function _I(e,n,t={}){let r=[],i=[];if(!Tz(e))return{graph:e,moved:r,refused:i};let o=$z(n),a=e.nodes.map(l=>{if(!PI(l))return l;let d=l,c=String(d.id),u=ml(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,w;if(p!==void 0)h=p,w="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,w=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:w}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(_I,"moveWaitlistPolicyToInputs");function ko(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ko,"isObject");var Rz=[Gn,yo],Iz=["inputSchema","parties","schemaDigest","parts"];function NI(e){return ko(e)&&e.type==="governedDocument"&&("resolver"in e||ko(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(NI,"oldShape");function CI(e){return(e?.nodes??[]).some(NI)}s(CI,"needsGeneratorInputMove");function Oz(e){let n=ko(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!ko(i))return{unmoved:"resolverNotObject"};if(Gn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((ko(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>ko(d)&&Rz.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Gn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(Iz.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(t.generatorStamp=l),r=i.cockpitFields,delete t.resolver}if(ko(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(yo in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[yo]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}t.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};t.cockpitFields=r}return t.inputs=n,{node:t}}s(Oz,"moveNode");function DI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!NI(i))return i;let o=Oz(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(DI,"moveGeneratorPinsToInputs");var FI=/^\d{4}-\d{2}-\d{2}$/;function gr(e,n){return{de:e,en:n}}s(gr,"issue");function bo(e){if(typeof e!="object"||e===null)return gr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:gr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return gr(`unbekannte Art ${JSON.stringify(n.kind)}`,`unknown kind ${JSON.stringify(n.kind)}`);let{amount:t,activeFrom:r,activeTo:i}=n;return typeof t!="number"||!Number.isFinite(t)||t<=0?gr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((t*100).toFixed(6)))?typeof r!="string"||!FI.test(r)?gr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!FI.test(i)?gr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?gr("das Ende liegt vor dem Beginn","the end is before the start"):n.floorTotal!==void 0&&(typeof n.floorTotal!="number"||!Number.isSafeInteger(n.floorTotal)||n.floorTotal<0)?gr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):n.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(n.pricePeriod))?gr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?gr("unbekannte Angaben","unknown details"):null:gr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(bo,"reductionShapeIssue");function Pi(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||bo(n.reduction)===null&&n.reduction.kind==="amount")}s(Pi,"isPricedItemValue");var Ss=["freetext","recommendation","choice","pricedItem","record","reduction"],As=[...Ss,"appointment"];function MI(e){return typeof e=="string"&&As.includes(e)}s(MI,"isTaskResultKind");function _i(e){return typeof e=="string"&&Ss.includes(e)}s(_i,"isRecordedTaskResultKind");function Es(e){return _i(e.kind)}s(Es,"isRecordedTaskResult");var gf=["number","boolean","enum"];function wy(e){return typeof e=="string"&&gf.includes(e)}s(wy,"isRecordFieldType");var ky=["form","siblingRank"];var ri={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 qI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(qI,"isProseResult");function yf(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&wy(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):Pz(e)}s(yf,"draftResultStoreWrites");function Pz(e){let n=ri[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(Pz,"singleStoreWrite");var LI="team:";function Ts(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(LI)){let n=e.slice(LI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ts,"parseTaskResultChat");var Xe={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var _z=new Set(["if","else","in","true","false","null"]),Nz=new Set(["==","!=","<=",">=","&&","||"]);function Cz(e){return e>="0"&&e<="9"}s(Cz,"isDigit");function Dz(e){return/[a-zA-Z_$]/.test(e)}s(Dz,"isIdentStart");function Fz(e){return/[a-zA-Z0-9_.$]/.test(e)}s(Fz,"isIdentCont");function Lz(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
|
|
10965
|
+
`};var Zu="6d2de7f82c12e3664622b393f109d6abbee614f397954aea48cdabd4fddb8685",Wg=FR;var Hg=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=$.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Zu,tools:dl}),0}},Yg=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=$.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await zg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},LR=[Hg,Yg];var Jg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Yae=new Set(Jg.map(e=>e.key));function qR(e,n,t,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===n);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${n}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${n} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===t||l.runId===t);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${t}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(qR,"resolveStartTarget");function sz(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(sz,"applicantText");function KR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:sz(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(KR,"applicationRows");var MR=Jg.map(e=>e.email);function jR(e,n,t,r){if(t===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(Vg(e,n)&&(r===void 0||!MR.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${MR.join(", ")} (--applicant) \u2014 never a real family's`)}s(jR,"assertStartApplicant");function BR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(BR,"processStoreJson");function az(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(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.revisionNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(az,"refText");function lz(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?az(e.ref):JSON.stringify(e.value)}s(lz,"holds");function VR(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:lz(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(VR,"storeRows");function Xu(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(Xu,"parseKv");var UR="started",ef="submitted",nf="submitted",GR="load-scenario:";var zR="(Bewerbung)";function WR(e){return{nodeId:zR,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(WR,"sharedAsList");function HR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(HR,"disabledText");function YR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:HR(r)})))}s(YR,"actionRows");function JR(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${n}" on ${i} is disabled: ${HR(a)}`);if(i!==zR)return i;let l=t[0];if(l===void 0)throw new Error(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(JR,"nodeOfferingAction");function QR(e,n,t){if(e.startsWith(GR)){if(Object.hasOwn(t,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(QR,"runParams");async function dz(e,n){let t=await e.query(x.workflow.getInstance,{applicationId:n});if(t===null)throw new Error(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(dz,"currentNodeIds");function cz(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(cz,"refusalText");async function tf(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${cz(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(x.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,WR(r.actions)]}s(tf,"actionsOf");async function ZR(e,n,t){return t!==void 0?[t]:await dz(e,n)}s(ZR,"nodesOf");var Qg=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=$.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await tf(n,this.application,await ZR(n,this.application,this.node));return this.print(t,YR,["node","action","label","disabled"]),0}},Zg=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=$.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=QR(this.action,this.autoSubmit,Xu(this.param??[]).values),t=await this.caller(),r=this.application,i=await ZR(t,this.application,this.node),o=JR(await tf(t,r,i),this.action,i);return await t.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},XR=[Qg,Zg];var He=["de","en"];function ys(e,n){return He.every(t=>e[t]===n[t])}s(ys,"sameText");function On(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!He.includes(r))?"not-localized":He.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(On,"missingLocales");function Ri(e){let n=On(e);return n!=="not-localized"&&n.length===0}s(Ri,"isLocalizedText");function cl(e,n){let t={};for(let r of He){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(cl,"composeTexts");var pr=/^[a-z][A-Za-z0-9]*$/;function Xg(e){return typeof e=="string"&&pr.test(e)}s(Xg,"isNodeId");function ws(e,n){Xg(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${pr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(ws,"makeNodeId");var Ii="$env";function se(e){if(e.scope==="env")return`${Ii}.${e.key}`;let n=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(se,"formatAddress");var Fr=/^[a-z][a-zA-Z0-9_]*$/,uz=/^[A-Za-z_][A-Za-z0-9_]*$/;function ho(e){return typeof e=="string"&&e.split(".").every(n=>uz.test(n))}s(ho,"isPath");function Xr(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&ho(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Fr.test(i)?null:eI({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Fr.test(o)||(t==="node"?!pr.test(i):!Fr.test(i))?null:eI({scope:t,owner:i,key:o},a)}default:return null}}s(Xr,"tryParseAddress");function eI(e,n){if(n.length===0)return e;let t=n.join(".");return ho(t)?{...e,path:t}:null}s(eI,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:n.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!ho(n.path))return!1;switch(n.scope){case"env":return ho(n.key);case"derived":return typeof n.key=="string"&&Fr.test(n.key);case"node":return typeof n.owner=="string"&&pr.test(n.owner)&&typeof n.key=="string"&&Fr.test(n.key);case"task":return typeof n.owner=="string"&&Fr.test(n.owner)&&typeof n.key=="string"&&Fr.test(n.key);default:return!1}}s(we,"isAddress");var ei={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"}},ks=Object.keys(ei);function bs(e){return Object.hasOwn(ei,e)}s(bs,"isEnvKey");var fz=["self-service","staff"];function nI(e,n){return{kind:"fixed",values:e,labels:n}}s(nI,"fixedSet");var rf={of:"applicant.language",withoutValue:"de"},ni={"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:rf},"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:rf},"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:rf},"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:rf},"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:nI(He,{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:nI(fz,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},of={types:ei,fields:ni},sf=ks.flatMap(e=>Object.keys(ei[e]).map(n=>`${e}.${n}`));function Ht(e){return Object.hasOwn(ni,e)}s(Ht,"isEnvLeaf");function af(e){return`${Ii}.${e}`}s(af,"envIdentifier");function go(e){let n=ni[e],[t,r]=e.split("."),i=ei[t][r];i===void 0&&F(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&F(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(go,"envLeaf");var tI="staffInput";var pz=["boolean"],ul=/^[a-z][A-Za-z0-9]*$/;function lf(e){return e.staffInputs??[]}s(lf,"staffInputsOf");function df(e){return`${tI}.${e}`}s(df,"staffInputLeaf");function rI(e){return`${Ii}.${df(e)}`}s(rI,"staffInputIdentifier");function mz(e){let n=`${tI}.`;return e.startsWith(n)?e.slice(n.length):null}s(mz,"staffInputKeyOfLeaf");function vs(e,n){let t=mz(n);return t===null?void 0:lf(e).find(r=>r.key===t)}s(vs,"declaredStaffInput");function iI(e){return[...lf(e).map(n=>({leaf:df(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...sf.map(n=>{let t=go(n);return{leaf:n,type:t.type,label:t.label,valueSet:ni[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(iI,"envLeavesFor");function oI(e){return iI(e).filter(n=>!n.cohortBound)}s(oI,"conditionEnvLeaves");function sI(e){return lI(oI(e))}s(sI,"envConditionSchemaFor");function hz(e){return iI(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(hz,"offerConditionEnvLeaves");function aI(e){return lI(hz(e))}s(aI,"offerConditionSchemaFor");function lI(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(lI,"schemaOfLeaves");function dI(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};ul.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),pz.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=On(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(dI,"staffInputIssues");var dy={required:!0,description:"Offer slug (its offerKey)"},ey=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=$.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",dy);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(x.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=KR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},ny=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=$.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",dy);async execute(){let n=await this.caller(),t=await n.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},ty=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=$.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},ry=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=$.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=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(BR(t),()=>VR(t),["address","state","holds","producer","written"]),0}},iy=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=$.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",dy);run=f.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=f.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();jR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=qR(await n.query(x.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await n.query(x.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(x.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:uI(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await n.query(x.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await tf(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},oy=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=$.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=gz(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(x.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new Error(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(x.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function gz(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new Error(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(gz,"parseDays");var sy=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=$.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},ay=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=$.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},ly=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=$.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=uI([this.input]);return await n.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},cI=[ey,ny,ty,ry,iy,oy,sy,ay,ly];function uI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!ul.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(uI,"parseStaffInputs");var Gn="contractGenerator",yo="documentTemplate";function fl(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return(n.kind==="generator"||n.kind==="package")&&typeof n.key=="string"&&n.key.length>0&&(n.revision===void 0||typeof n.revision=="number"&&Number.isInteger(n.revision)&&n.revision>0)&&t.every(r=>r==="kind"||r==="key"||r==="revision")}s(fl,"isGeneratorRef");function fI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(fI,"literalOf");function ti(e){let n=fI(e,Gn);return fl(n)?n:null}s(ti,"generatorRefOfNode");function mr(e){let n=fI(e,yo);return typeof n=="string"&&n.length>0?n:null}s(mr,"documentTemplateKeyOfNode");function pI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(pI,"generatorRefLabel");var yz=["formExports","generatorStamp"];function mI(e,n,t){let r=e.inputs?.[Gn];(r?.kind!=="literal"||!fl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Gn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Gn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts}}}s(mI,"applyGeneratorStamp");var wz=["reads"];function xs(e){if(e===null||typeof e!="object")return e;let n={...e};return Array.isArray(n.nodes)&&(n.nodes=n.nodes.map(t=>{if(t===null||typeof t!="object")return t;let r={...t};for(let i of yz)delete r[i];for(let i of wz)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(xs,"comparableWorkflowGraph");var pl={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 cf(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=pl[n];return t!==void 0?`manifest: \`${n}\` is no longer part of manifest.json (${t.en}). Delete the line.`:`manifest: unknown key \`${n}\` \u2014 manifest.json carries no key.`})}s(cf,"manifestIssues");function kz(e){let n=[],t=e.buses;if(!Array.isArray(t))return n;let r=t.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return n;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";n.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return n}s(kz,"validateProgressLayoutExternalCopy");function hI(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let n=e.buses;return!Array.isArray(n)||!n.some(t=>!!t&&typeof t=="object"&&t.key==="process")?["progressLayout: the layout must declare the `process` bus"]:kz(e)}s(hI,"progressLayoutIssues");var gI=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var bz=new Set(["sections","effects","outcomes","testScenarios","env","views"]),uf={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 yI(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${n}: die Formulardefinition muss ein Objekt sein.`,en:`${n}: the form definition must be an object.`}];let t=[];for(let i of Object.keys(e)){if(bz.has(i))continue;let o=uf[i];t.push(o!==void 0?{de:`${n}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${n}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${n}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${n}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||t.push({de:`${n}: \`${i}\` muss eine Liste sein.`,en:`${n}: \`${i}\` must be a list.`});return t}s(yI,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Oi(e){return typeof e=="string"&&bt.includes(e)}s(Oi,"isOutcomeSemantic");var Yt=["arrival","manual"],wI={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function vz(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(vz,"literal");function cy(e){let n=vz(e,"waitlistOrder");return Yt.includes(n)?{waitlistOrder:n}:null}s(cy,"waitlistPolicyOrNull");var kn="responsible",uy="team:";function ff(e){return`${uy}${e}`}s(ff,"teamSlot");function pf(e){return e.startsWith(uy)?e.slice(uy.length):null}s(pf,"teamKeyOfSlot");function kI(e){return e.kind==="responsible"?kn:ff(e.groupKey)}s(kI,"slotIdOf");function mf(e){if(e===kn)return{kind:"responsible"};let n=pf(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(mf,"slotOfId");var fy="review",py="checkField",bI="reviewed",vI="reviewing",hf=["rejected","waitlisted"];function my(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(my,"isObject");var xz=new Set(["decision",fy]),xI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function hy(e){return Object.hasOwn(xI,e)?xI[e]:void 0}s(hy,"legacySemanticOfId");function Sz(e){return e===fy?bt.filter(n=>!hf.includes(n)):bt}s(Sz,"allowedSemanticsFor");var Az="other";function SI(e){return my(e)&&xz.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(SI,"outcomesOf");function AI(e){return(e?.nodes??[]).some(n=>SI(n).some(t=>my(t)&&!("semantic"in t)))}s(AI,"needsOutcomeSemantics");function EI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=SI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=Sz(u),h=!1,w=l.map(k=>{if(!my(k))return k;let y=String(k.id);if("semantic"in k)return Oi(k.semantic)||i.push({nodeId:c,outcomeId:y,value:String(k.semantic)}),k;let v=`${c}.${y}`,E=Object.hasOwn(n,v)?n[v]:void 0;if(E!==void 0)return p.includes(E)?(t.push({nodeId:c,outcomeId:y,semantic:E,source:"answer"}),h=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p,answer:E}),k);let A=hy(y),I=A??Az;return p.includes(I)?(t.push({nodeId:c,outcomeId:y,semantic:I,source:A===void 0?"formerDefault":"legacyTable"}),h=!0,{...k,semantic:I}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p}),k)});return h?{...d,outcomes:w}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(EI,"addOutcomeSemantics");var hr="bewerbungOffen";function wo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(wo,"isObject");var gy=["event","effect"];function TI(e){return wo(e)&&e.type==="eventTrigger"}s(TI,"isTrigger");function $I(e){let n=wo(e.inputs)?e.inputs:{};return"outcomes"in e||gy.some(t=>t in e||t in n)}s($I,"oldShape");function RI(e){return(e?.nodes??[]).some(n=>TI(n)&&$I(n))}s(RI,"needsEventTriggerStartMove");function Ez(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>wo(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===hr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(wo(e.next)?e.next:{});if(!(i.length===1&&i[0]===hr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=wo(e.inputs)?{...e.inputs}:{};for(let l of gy){let d=o[l];if(wo(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of gy)delete a[l],delete o[l];return wo(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(Ez,"moveNode");function II(e){let n=[],t=[],r=e.nodes.map(i=>{if(!TI(i)||!$I(i))return i;let o=Ez(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(II,"moveEventTriggerStart");function ml(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ml,"isObject");var OI={waitlistOrder:"arrival"};function PI(e){return!ml(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(ml(e.inputs)?e.inputs:{}))}s(PI,"lacksPolicy");function Tz(e){return(e?.nodes??[]).some(PI)}s(Tz,"needsWaitlistPolicyMove");function yy(e){return ml(e)&&Yt.includes(e.waitlistOrder)}s(yy,"isWaitlistPolicy");function $z(e){if(e===void 0)return{policy:OI,stated:!1};if(!ml(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Yt.includes(n)?"malformed":{policy:{waitlistOrder:n??OI.waitlistOrder},stated:n!==void 0}}s($z,"policyOfSelection");function _I(e,n,t={}){let r=[],i=[];if(!Tz(e))return{graph:e,moved:r,refused:i};let o=$z(n),a=e.nodes.map(l=>{if(!PI(l))return l;let d=l,c=String(d.id),u=ml(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,w;if(p!==void 0)h=p,w="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,w=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:w}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(_I,"moveWaitlistPolicyToInputs");function ko(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ko,"isObject");var Rz=[Gn,yo],Iz=["inputSchema","parties","schemaDigest","parts"];function NI(e){return ko(e)&&e.type==="governedDocument"&&("resolver"in e||ko(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(NI,"oldShape");function CI(e){return(e?.nodes??[]).some(NI)}s(CI,"needsGeneratorInputMove");function Oz(e){let n=ko(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!ko(i))return{unmoved:"resolverNotObject"};if(Gn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((ko(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>ko(d)&&Rz.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Gn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(Iz.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(t.generatorStamp=l),r=i.cockpitFields,delete t.resolver}if(ko(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(yo in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[yo]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}t.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};t.cockpitFields=r}return t.inputs=n,{node:t}}s(Oz,"moveNode");function DI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!NI(i))return i;let o=Oz(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(DI,"moveGeneratorPinsToInputs");var FI=/^\d{4}-\d{2}-\d{2}$/;function gr(e,n){return{de:e,en:n}}s(gr,"issue");function bo(e){if(typeof e!="object"||e===null)return gr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:gr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return gr(`unbekannte Art ${JSON.stringify(n.kind)}`,`unknown kind ${JSON.stringify(n.kind)}`);let{amount:t,activeFrom:r,activeTo:i}=n;return typeof t!="number"||!Number.isFinite(t)||t<=0?gr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((t*100).toFixed(6)))?typeof r!="string"||!FI.test(r)?gr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!FI.test(i)?gr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?gr("das Ende liegt vor dem Beginn","the end is before the start"):n.floorTotal!==void 0&&(typeof n.floorTotal!="number"||!Number.isSafeInteger(n.floorTotal)||n.floorTotal<0)?gr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):n.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(n.pricePeriod))?gr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?gr("unbekannte Angaben","unknown details"):null:gr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(bo,"reductionShapeIssue");function Pi(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||bo(n.reduction)===null&&n.reduction.kind==="amount")}s(Pi,"isPricedItemValue");var Ss=["freetext","recommendation","choice","pricedItem","record","reduction"],As=[...Ss,"appointment"];function MI(e){return typeof e=="string"&&As.includes(e)}s(MI,"isTaskResultKind");function _i(e){return typeof e=="string"&&Ss.includes(e)}s(_i,"isRecordedTaskResultKind");function Es(e){return _i(e.kind)}s(Es,"isRecordedTaskResult");var gf=["number","boolean","enum"];function wy(e){return typeof e=="string"&&gf.includes(e)}s(wy,"isRecordFieldType");var ky=["form","siblingRank"];var ri={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 qI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(qI,"isProseResult");function yf(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&wy(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):Pz(e)}s(yf,"draftResultStoreWrites");function Pz(e){let n=ri[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(Pz,"singleStoreWrite");var LI="team:";function Ts(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(LI)){let n=e.slice(LI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ts,"parseTaskResultChat");var Xe={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var _z=new Set(["if","else","in","true","false","null"]),Nz=new Set(["==","!=","<=",">=","&&","||"]);function Cz(e){return e>="0"&&e<="9"}s(Cz,"isDigit");function Dz(e){return/[a-zA-Z_$]/.test(e)}s(Dz,"isIdentStart");function Fz(e){return/[a-zA-Z0-9_.$]/.test(e)}s(Fz,"isIdentCont");function Lz(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
|
|
10966
10966
|
`||r==="\r"){t++;continue}if(r==="'"){let o=t+1,a="";for(;o<e.length&&e.charAt(o)!=="'";)e.charAt(o)==="\\"&&o+1<e.length?(a+=e.charAt(o+1),o+=2):(a+=e.charAt(o),o++);o>=e.length&&F(`Unterminated string at ${t}`),n.push({t:"str",v:a}),t=o+1;continue}if(Cz(r)){let o=t;for(;o<e.length&&/[0-9.]/.test(e.charAt(o));)o++;n.push({t:"num",v:Number(e.slice(t,o))}),t=o;continue}if(Dz(r)){let o=t;for(;o<e.length&&Fz(e.charAt(o));)o++;let a=e.slice(t,o);_z.has(a)?n.push({t:"kw",v:a}):n.push({t:"ident",v:a}),t=o;continue}let i=e.slice(t,t+2);if(Nz.has(i)){n.push({t:"op",v:i}),t+=2;continue}if("<>!".includes(r)){n.push({t:"op",v:r}),t++;continue}if("()[],".includes(r)){n.push({t:"punct",v:r}),t++;continue}F(`Unexpected char '${r}' at ${t}`)}return n}s(Lz,"tokenise");var KI=1e4,jI=128;function $s(e){e.depth++,e.depth>jI&&F(`Expression nesting too deep (> ${jI})`)}s($s,"enterDepth");function WI(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(WI,"peek");function zn(e){let n=e.tokens[e.pos];return n||F(`Unexpected end at ${e.pos}`),e.pos++,n}s(zn,"take");function Wn(e,n,t){let r=WI(e);return!(!r||r.t!==n||t!==void 0&&r.v!==t)}s(Wn,"match");function vo(e,n,t){return Wn(e,n,t)||F(`Expected ${n}${t?`:${t}`:""} at ${e.pos}`),zn(e)}s(vo,"expect");function oi(e){$s(e);try{return Wn(e,"kw","if")?Mz(e):qz(e)}finally{e.depth--}}s(oi,"parseExpr");function Mz(e){vo(e,"kw","if"),vo(e,"punct","(");let n=oi(e);vo(e,"punct",")");let t=oi(e);vo(e,"kw","else");let r=oi(e);return{kind:"if",cond:n,then:t,else:r}}s(Mz,"parseIf");function qz(e){let n=BI(e),t=0;try{for(;Wn(e,"op","||");){zn(e),$s(e),t++;let r=BI(e);n={kind:"binary",op:"||",left:n,right:r}}}finally{e.depth-=t}return n}s(qz,"parseLogicOr");function BI(e){let n=VI(e),t=0;try{for(;Wn(e,"op","&&");){zn(e),$s(e),t++;let r=VI(e);n={kind:"binary",op:"&&",left:n,right:r}}}finally{e.depth-=t}return n}s(BI,"parseLogicAnd");function VI(e){let n=UI(e),t=0;try{for(;Wn(e,"op","==")||Wn(e,"op","!=");){let r=zn(e).v;$s(e),t++;let i=UI(e);n={kind:"binary",op:r,left:n,right:i}}}finally{e.depth-=t}return n}s(VI,"parseEquality");function UI(e){let n=vy(e),t=0;try{for(;Wn(e,"op","<")||Wn(e,"op","<=")||Wn(e,"op",">")||Wn(e,"op",">=")||Wn(e,"kw","in");){let r=zn(e),i=r.t==="kw"?"in":r.v;$s(e),t++;let o=vy(e);n={kind:"binary",op:i,left:n,right:o}}}finally{e.depth-=t}return n}s(UI,"parseCompare");function vy(e){if(Wn(e,"op","!")){zn(e),$s(e);try{return{kind:"unary",op:"!",operand:vy(e)}}finally{e.depth--}}return Kz(e)}s(vy,"parseUnary");function Kz(e){let n=WI(e);if(n||F("Unexpected end"),n.t==="num")return zn(e),{kind:"num",value:n.v};if(n.t==="str")return zn(e),{kind:"str",value:n.v};if(n.t==="kw"&&n.v==="true")return zn(e),{kind:"bool",value:!0};if(n.t==="kw"&&n.v==="false")return zn(e),{kind:"bool",value:!1};if(n.t==="kw"&&n.v==="null")return zn(e),{kind:"null"};if(n.t==="punct"&&n.v==="("){zn(e);let t=oi(e);return vo(e,"punct",")"),t}if(n.t==="punct"&&n.v==="["){zn(e);let t=[];if(!Wn(e,"punct","]"))for(t.push(oi(e));Wn(e,"punct",",");)zn(e),t.push(oi(e));return vo(e,"punct","]"),{kind:"arr",items:t}}if(n.t==="ident"){let t=n.v;if(zn(e),Wn(e,"punct","(")){zn(e);let r=[];if(!Wn(e,"punct",")"))for(r.push(oi(e));Wn(e,"punct",",");)zn(e),r.push(oi(e));return vo(e,"punct",")"),{kind:"call",name:t,args:r}}return{kind:"ident",path:t}}F(`Unexpected token at ${e.pos}`)}s(Kz,"parsePrimary");function Pn(e){e.length>KI&&F(`Expression too long (${e.length} > ${KI})`);let n={tokens:Lz(e),pos:0,depth:0},t=oi(n);return n.pos<n.tokens.length&&F(`Unexpected trailing token at ${n.pos}`),t}s(Pn,"parseExpression");var jz=new Map([["today",()=>new Date().toISOString().slice(0,10)],["years_between",(e,n)=>{if(typeof e!="string"||typeof n!="string")return null;let t=new Date(e),r=new Date(n);if(isNaN(t.getTime())||isNaN(r.getTime()))return null;let i=r.getFullYear()-t.getFullYear(),o=r.getMonth()-t.getMonth();return(o<0||o===0&&r.getDate()<t.getDate())&&i--,i}],["length",e=>typeof e=="string"||Array.isArray(e)?e.length:0]]);function fn(e,n){switch(e.kind){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"null":return null;case"ident":{let t=Object.hasOwn(n.values,e.path)?n.values[e.path]:void 0;return t===void 0?null:t}case"arr":return e.items.map(t=>fn(t,n));case"unary":{let t=fn(e.operand,n);return!Ni(t)}case"call":{let t=n.functions!==void 0&&Object.hasOwn(n.functions,e.name)?n.functions[e.name]:jz.get(e.name);t||F(`Unknown function '${e.name}'`);let r=e.args.map(i=>fn(i,n));return t(...r)}case"binary":return Bz(e.op,e.left,e.right,n);case"if":return Ni(fn(e.cond,n))?fn(e.then,n):fn(e.else,n)}}s(fn,"evaluate");function Bz(e,n,t,r){if(e==="&&"){let a=fn(n,r);return Ni(a)?Ni(fn(t,r)):!1}if(e==="||"){let a=fn(n,r);return Ni(a)?!0:Ni(fn(t,r))}let i=fn(n,r),o=fn(t,r);switch(e){case"==":return by(i,o);case"!=":return!by(i,o);case"<":{let[a,l]=wf(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=wf(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=wf(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=wf(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>by(a,i)):!1}}s(Bz,"evalBinary");function wf(e,n){return[GI(e),GI(n)]}s(wf,"orderedOperands");function GI(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"){if(e.trim()==="")return null;let n=Number(e);return Number.isFinite(n)?n:null}return null}s(GI,"numericOperand");function by(e,n){return e===n?!0:e==null||n==null?!1:typeof e=="number"&&typeof n=="string"?e===Number(n):typeof e=="string"&&typeof n=="number"?Number(e)===n:!1}s(by,"looseEq");function Ni(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(Ni,"truthy");function Sn(e){let n=new Set;return ii(e,n),[...n]}s(Sn,"dependencies");function ii(e,n){switch(e.kind){case"ident":n.add(e.path);return;case"call":e.args.forEach(t=>ii(t,n));return;case"arr":e.items.forEach(t=>ii(t,n));return;case"unary":ii(e.operand,n);return;case"binary":ii(e.left,n),ii(e.right,n);return;case"if":ii(e.cond,n),ii(e.then,n),ii(e.else,n);return;default:return}}s(ii,"walk");var zI=new Map;function yr(e){let n=zI.get(e);return n||(n=Pn(e),zI.set(e,n)),n}s(yr,"parseCached");function Vz(e,n){return fn(yr(e),n)}s(Vz,"evalExpression");function HI(e,n){return Ni(Vz(e,n))}s(HI,"evalBoolean");function kf(e){let n=e.pricingRules;return n===void 0?[]:(Array.isArray(n)||F("graph.pricingRules must be an array \u2014 the graph validator refuses anything else"),n)}s(kf,"pricingRuleSets");function xy(e){return e.derive!==void 0}s(xy,"isDerivedKey");function Uz(e,n){let t=kf(e);return(n.rules??[]).map(r=>{let i=t.find(o=>o.key===r);return i===void 0&&F(`[process] derivation names the unknown rule set "${r}" \u2014 publish refuses that`),i})}s(Uz,"ruleSetsOfDerivation");function JI(e){return[...new Set(e.rows.flatMap(n=>Sn(yr(n.when))))]}s(JI,"ruleSetDependencies");function QI(e){let n=Xr(e);return n!==null&&se(n)===e?n:null}s(QI,"ruleIdentifierAddress");function Sy(e,n){let r=[...new Set(Uz(e,n).flatMap(JI))].map(o=>{let a=QI(o);return a===null&&F(`[address/bareIdentifier] rule identifier "${o}" is no address \u2014 publish refuses that`),{address:a,id:o,role:"rule"}}),i=n.reduction;return i===void 0?r:(we(i)||F(`[address/bareIdentifier] derive.reduction ${JSON.stringify(i)} is no address \u2014 publish refuses that`),[...r,{address:i,id:se(i),role:"reduction"}])}s(Sy,"derivationSources");function ZI(e,n){let t=kf(e);for(let r of n.rules??[]){let i=t.find(o=>o.key===r);if(i===void 0||i.rows.some(o=>hl(o.when)!==null)||JI(i).some(o=>QI(o)===null))return null}return n.reduction!==void 0&&!we(n.reduction)?null:Sy(e,n)}s(ZI,"draftDerivationSources");function hl(e){if(typeof e!="string"||e.trim().length===0)return"leere Bedingung";try{return yr(e),null}catch(n){return n instanceof Error?n.message:String(n)}}s(hl,"conditionIssue");function YI(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(YI,"rowTarget");function Ay(e){if(e.byStage===void 0){let n=YI(e);return n===null?[]:[{...n,stages:null}]}return e.item!==void 0||e.group!==void 0?[]:e.byStage.flatMap(n=>{let t=YI(n);return t===null?[]:[{...t,stages:n.stages}]})}s(Ay,"derivationTargets");function XI(e,n){n!==null&&(typeof n=="object"||typeof n=="function")&&Object.hasOwn(n,"exports")&&F(`[workflow/registry] node type "${e}": custom spec.exports is unsupported; use artifact-slot exports.`)}s(XI,"assertNoCustomNodeExports");var Ey=null;function eO(e){for(let[n,t]of Object.entries(e))XI(n,t);Ey=e}s(eO,"setSpecs");function nO(){return Ey||F("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),Ey}s(nO,"requireSpecs");function Je(e){let n=nO(),t=n[e.type];return t===void 0&&de("INVALID",{de:`[workflow/registry] Unbekannter Knotentyp "${String(e.type)}" (Knoten "${String(e.id)}"). Registrierte Typen: ${Object.keys(n).sort().join(", ")}.`,en:`[workflow/registry] Unknown node type "${String(e.type)}" (node "${String(e.id)}"). Registered types: ${Object.keys(n).sort().join(", ")}.`}),t}s(Je,"specFor");function tO(){return Object.keys(nO()).sort()}s(tO,"registeredNodeTypes");var rO=sf.filter(e=>ni[e].cohortBound!==!0);function Ty(e){return Ht(e)&&ni[e].cohortBound!==!0}s(Ty,"isEnvAddressLeaf");function $y(e){return go(e).type}s($y,"envType");function Ry(e){return go(e).label}s(Ry,"envLabel");function bf(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(bf,"addressBase");function kr(e){return e.scope==="node"&&e.key===it&&e.path===void 0}s(kr,"isInstanceAddress");function pn(e){return we(e)&&e.scope==="node"&&e.key===it&&e.path!==void 0}s(pn,"isFormFieldAddress");function iO(e){return pn(e)?{owner:e.owner,path:e.path}:null}s(iO,"formFieldOf");function Iy(e){return Sn(yr(e)).map(n=>{if(!n.startsWith("$"))return{identifier:n,address:null,reason:"bareIdentifier"};let t=Xr(n);return t===null?{identifier:n,address:null,reason:"shape"}:{identifier:n,address:t}})}s(Iy,"expressionAddresses");var it="admission",kl="document",Rs="contract",Is="contracts",oO="payment",Oy=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var ct={id:"identity",type:"identity",label:"display",sublabel:"display",library:"display",outcomes:"control",outputLabels:"display",inputs:"input",next:"control",tasks:"config",assign:"reference",actionTeams:"reference",optionalActions:"config",artifacts:"config",notifications:"config"},cce={join:{...ct},end:{...ct},eventTrigger:{...ct},form:{...ct,adoptForm:"address",formExports:"stamp"},roleAssign:{...ct},setFlag:{...ct},if:{...ct,condition:"address"},countersign:{...ct,contract:"address",titles:"display",signing:"config"},engagePush:{...ct,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...ct,commentRequired:"config",decisionAsTask:"config",reads:"address",formView:"config",requiresOneOf:"config"},review:{...ct,form:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...ct},completenessCheck:{...ct,requires:"address",deadline:"config"},collectPayment:{...ct},governedDocument:{...ct,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 wr(e){return Array.isArray(e)?e:[]}s(wr,"listOf");function qn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(qn,"record");function sO(e){switch(e.type){case"countersign":return["contract"];case"engagePush":return["form","contract","payment"];case"governedDocument":return e.production==="resolver"?["form"]:[];case"review":return["form"];default:return[]}}s(sO,"dataSourceFieldsOf");function aO(e){return e.type==="review"?[]:e.type==="engagePush"?["form"]:sO(e)}s(aO,"requiredDataSourceFields");var Gz={setFlag:{target:"setFlagTarget"}};function bl(e,n={}){let t=[],r=e,i=`nodes.${e.id}`,o=s((d,c,u,p={})=>{t.push({kind:d,at:c,nodeId:e.id,value:u,judgedTogether:null,...p})},"field"),a=new Map(n.slotTypes===!1?[]:(Je(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=Gz[e.type]??{};for(let[d,c]of Object.entries(qn(r.inputs)??{})){let u=qn(c);if(u?.kind!=="binding")continue;let p="address"in u?u.address:u.path,h=l[d];if(h!==void 0){o(h,`${i}.inputs.${d}`,p);continue}let w=a.get(d);o("binding",`${i}.inputs.${d}`,p,w!==void 0?{expectedType:w}:{})}for(let[d,c]of wr(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of wr(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 sO(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 wr(r.tasks).entries())t.push(...lO(e.id,c,d));for(let[d,c]of wr(r.optionalActions).entries()){let u=qn(c);u?.when!==void 0&&o("optionalActionWhen",zz(e.id,typeof u.key=="string"?u.key:String(d)),u.when)}return t}s(bl,"nodeAddressFields");function zz(e,n){return`nodes.${e}.optionalActions.${n}.when`}s(zz,"optionalActionWhenPath");function lO(e,n,t){let r=qn(n);if(r===null)return[];let i=[],o=typeof r.key=="string"?r.key:String(t),a=`nodes.${e}.tasks.${o}`,l=s((p,h,w,k={})=>{i.push({kind:p,at:h,nodeId:e,taskKey:o,value:w,judgedTogether:null,...k})},"field"),d=`${a}.evidence`;r.when!==void 0&&l("taskWhen",`${a}.when`,r.when,{expectedType:"boolean",judgedTogether:d});for(let[p,h]of wr(r.reads).entries())l("taskReads",`${a}.reads.${p}`,h,{judgedTogether:d});for(let[p,h]of wr(r.documents).entries()){let w=qn(h);w===null||w.kind==="artifact"||l("taskDocument",`${a}.documents.${p}`,"address"in w?w.address:w.key)}let c=qn(r.familyRequest);if(c!==null){for(let[p,h]of wr(c.fields).entries())l("familyRequestFields",`${a}.familyRequest.fields.${p}`,h,{judgedTogether:`${a}.familyRequest.fields`});c.from!==void 0&&l("familyRequestFrom",`${a}.familyRequest.from`,c.from)}let u=qn(r.result);if(u?.kind==="record")for(let[p,h]of wr(u.fields).entries()){let w=qn(qn(h)?.suggest);if(w?.kind!=="form")continue;let k=qn(h)?.type;l("suggest",`${a}.result.fields.${p}.suggest`,"address"in w?w.address:w.key,typeof k=="string"?{expectedType:k}:{})}return i}s(lO,"taskAddressFields");function vf(e){let n=[];for(let[t,r]of wr(e.processStore).entries()){let i=qn(qn(r)?.derive);if(i?.reduction!==void 0){let o=String(qn(r)?.key);n.push({kind:"reduction",at:`processStore.${t}.derive.reduction`,nodeId:null,priceKey:o,value:i.reduction,judgedTogether:null})}}for(let[t,r]of wr(e.pricingRules).entries())for(let[i,o]of wr(qn(r)?.rows).entries())n.push({kind:"pricingRule",at:`pricingRules.${t}.rows.${i}.when`,nodeId:null,value:qn(o)?.when,judgedTogether:null});return n}s(vf,"priceAddressFields");function Os(e){return Py(e)?(xf(e.value)??[]).flatMap(n=>n.address===null?[]:[n.address]):we(e.value)?[e.value]:[]}s(Os,"addressesInField");function Py(e){return e.kind==="pricingRule"||e.kind==="condition"||e.kind==="optionalActionWhen"}s(Py,"isExpressionField");function xf(e){return hl(e)===null?Iy(e):null}s(xf,"ruleConditionAddresses");function vt(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(vt,"adoptsForm");function dO(e){if(e.type!=="form"||vt({type:e.type,adoptForm:e.adoptForm}))return;let n=e.inputs?.smartForm;return n?.kind==="literal"&&typeof n.value=="string"&&n.value!==""?n.value:void 0}s(dO,"createdSmartFormSlug");function Wz(e,n){return e.type!=="governedDocument"||e.production!=="resolver"||n!==kl?n:e.generatorStamp?.parts!==void 0?Is:Rs}s(Wz,"addressKeyOfPort");function _y(e){let n=e.result;return n===void 0||!Es(n)?[]:yf(n).map(t=>t.key)}s(_y,"storeWritesOf");function yl(e,n){return(Array.isArray(e.processStore)?e.processStore:[]).find(t=>t.key===n)}s(yl,"declaredKey");function Lr(e,n){let t=[];if(!vt(n))for(let r of Je(n).outputs?.(n)??[])t.push({address:{scope:"node",owner:n.id,key:Wz(n,r.name)},type:r.type,...r.label!==void 0?{label:r.label}:{},nodeId:n.id,nodePort:r});for(let r of Array.isArray(n.tasks)?n.tasks:[])for(let i of _y(r)){let o=yl(e,i);t.push({address:{scope:"task",owner:r.key,key:i},type:o?.type??"unknown",...o!==void 0?{label:o.label}:{},nodeId:n.id})}return t}s(Lr,"producedAddresses");function cO(e,n,t){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===n&&_y(i).includes(t))return{nodeId:r.id,template:i};return null}s(cO,"taskWriter");function Mr(e,n,t){return cO(e,n,t)?.nodeId??null}s(Mr,"taskOwnerNode");function wl(e,n){let t=yl(e,n)?.derive;if(t===void 0)return null;let r=Array.isArray(e.pricingRules)?e.pricingRules:[],i=[];for(let a of t.rules??[]){let l=r.find(d=>d.key===a);if(l===void 0)return null;for(let d of l.rows){let c=xf(d.when);if(c===null)return null;for(let u of c)u.address!==null&&i.push(u.address)}}let o=t.reduction;return we(o)&&i.push(o),Hz(i)}s(wl,"derivedSources");function Hz(e){let n=new Set;return e.filter(t=>{let r=se(t);return n.has(r)?!1:(n.add(r),!0)})}s(Hz,"dedupe");function Yz(e){return bl(e,{slotTypes:!1}).flatMap(n=>Os(n).map(t=>({address:t,field:n})))}s(Yz,"writtenAddressesOf");function xo(e,n){let t=[],r=new Set,i=s((l,d,c,u)=>{let p=`${se(l)}|${d}|${c.at}|${u===void 0?"":se(u)}`;r.has(p)||(r.add(p),t.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 p=cO(e,l.owner,l.key);if(p===null)return;for(let h of lO(p.nodeId,p.template))if(!(h.kind!=="taskWhen"&&h.kind!=="taskReads"))for(let w of Os(h))i(w,"evidence",d,l)}if(l.scope==="derived")for(let p of wl(e,l.key)??[])i(p,"derivedSource",d,l),o(p,d,c)}},"carried");for(let{address:l,field:d}of Yz(n))i(l,"written",d),o(l,d);let a=new Set((Array.isArray(n.tasks)?n.tasks:[]).flatMap(l=>_y(l).map(d=>`${l.key}.${d}`)));for(let l of vf(e))if(!(l.kind!=="reduction"||!we(l.value)||l.value.scope!=="task")&&a.has(`${l.value.owner}.${l.value.key}`))for(let d of wl(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 t}s(xo,"addressReadsOf");function Ny(e,n){switch(n.scope){case"env":return Ht(n.key)?$y(n.key):vs(e,n.key)?.type;case"derived":case"task":{if(n.path!==void 0||n.scope==="task"&&Mr(e,n.owner,n.key)===null)return;let t=yl(e,n.key);return t===void 0||n.scope==="derived"!=(t.derive!==void 0)?void 0:t.type}case"node":{let t=e.nodes.find(i=>i.id===n.owner);if(t===void 0)return;let r=Lr(e,t).find(i=>i.address.scope==="node"&&i.address.key===n.key);return r===void 0?void 0:n.path===void 0?r.type:r.nodePort?.schema?.find(i=>i.key===n.path)?.type}}}s(Ny,"addressType");function gl(e,n){let t=qn(e)?.[n];return typeof t=="string"&&t.length>0?t:void 0}s(gl,"labelText");function Oe(e,n,t){let r=e.nodes.find(i=>i.id===n);return gl(r?.label,t)??n}s(Oe,"nodeDisplayName");function So(e,n,t){for(let r of e.nodes){let i=(Array.isArray(r.tasks)?r.tasks:[]).find(o=>o.key===n);if(i!==void 0)return gl(i.title,t)??n}return n}s(So,"taskDisplayName");function Ve(e,n,t){let r=[];switch(n.scope){case"env":r.push(Ht(n.key)?Ry(n.key)[t]:vs(e,n.key)?.label[t]??n.key);break;case"derived":r.push(gl(yl(e,n.key)?.label,t)??n.key);break;case"task":r.push(So(e,n.owner,t),gl(yl(e,n.key)?.label,t)??n.key);break;case"node":{r.push(Oe(e,n.owner,t));let i=e.nodes.find(a=>a.id===n.owner),o=i===void 0?void 0:Lr(e,i).find(a=>a.address.scope==="node"&&a.address.key===n.key);r.push(gl(o?.label,t)??n.key);break}}return n.scope!=="env"&&n.path!==void 0&&r.push(n.path),`${r.join(" \u203A ")} (${se(n)})`}s(Ve,"displayAddress");var vl=["beneficiary","signers"];function uO(e,n){return Array.isArray(e.artifacts)&&e.artifacts.some(t=>t?.key===n)}s(uO,"ownsSlot");function xl(e){let n=[];for(let[t,r]of Object.entries(qn(e.inputs)??{})){let i=qn(r);i?.kind==="binding"&&we(i.address)&&n.push({slot:t,address:i.address})}return n}s(xl,"bindingAddresses");function fO(e,n){return xl(e).find(t=>t.slot===n)?.address??null}s(fO,"bindingAddressAt");function pO(e,n){let t=s(i=>i.scope==="node"&&i.owner===n||i.scope==="task"&&Mr(e,i.owner,i.key)===n,"names");return[...e.nodes.filter(i=>i.id!==n).flatMap(i=>bl(i,{slotTypes:!1})),...vf(e)].flatMap(i=>Os(i).filter(t).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(pO,"addressesNaming");var _n={target:"target",flagKey:"flagKey",value:"value"};function Jz(e){return fO(e,_n.target)}s(Jz,"setFlagTarget");function mO(e){let n=Jz(e);return n!==null&&kr(n)?n.owner:null}s(mO,"setFlagTargetOwner");function Sf(e){let n=e.inputs?.[_n.flagKey];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(Sf,"setFlagKey");function hO(e){let n=e.inputs?.[_n.value];if(n===void 0||n.kind==="unset")return!0;if(n.kind==="literal"&&typeof n.value=="boolean")return n.value;F(`[setFlag/valueType] setFlag node "${String(e.id)}": \`${_n.value}\` is no yes/no literal \u2014 publish refuses that`)}s(hO,"setFlagValue");function gO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(gO,"isObject");var yO=["target","flagKey","value"];function wO(e){return gO(e)&&e.type==="setFlag"&&yO.some(n=>n in e)}s(wO,"oldShape");function kO(e){return(e?.nodes??[]).some(wO)}s(kO,"needsSetFlagInputMove");function Qz(e){let n=gO(e.inputs)?{...e.inputs}:{};if(yO.some(a=>a in e&&_n[a]in n))return{unmoved:"inputExists"};if("target"in e&&!we(e.target))return{unmoved:"targetNotAddress"};if("flagKey"in e&&typeof e.flagKey!="string")return{unmoved:"flagKeyNotString"};if("value"in e&&typeof e.value!="boolean")return{unmoved:"valueNotBoolean"};let{target:t,flagKey:r,value:i,...o}=e;return t!==void 0&&(n[_n.target]={kind:"binding",address:t}),typeof r=="string"&&r.length>0&&(n[_n.flagKey]={kind:"literal",value:r}),i!==void 0&&(n[_n.value]={kind:"literal",value:i}),{node:{...o,inputs:n}}}s(Qz,"moveNode");function bO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!wO(i))return i;let o=Qz(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(bO,"moveSetFlagConfigToInputs");function vO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(vO,"isObject");var Cy={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},Dy={review:["allowSkipInTest"]};function xO(e){return Cy[String(e)]??{}}s(xO,"movesOf");function SO(e){return Dy[String(e)]??[]}s(SO,"deadOf");function AO(e){return vO(e)&&[...Object.keys(xO(e.type)),...SO(e.type)].some(n=>n in e)}s(AO,"oldShape");function EO(e){return(e?.nodes??[]).some(AO)}s(EO,"needsScalarInputMove");function Zz(e,n){return n==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===n}s(Zz,"wellTyped");function Xz(e){let n=vO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(xO(e.type))){if(!(r in e))continue;let o=e[r];if(r in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!(i==="string"&&o==="")&&!Zz(o,i))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueWrongType"}};o!==""&&(n[r]={kind:"literal",value:o}),delete t[r]}for(let r of SO(e.type))delete t[r];return t.inputs=n,{node:t}}s(Xz,"moveNode");function TO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!AO(i))return i;let o=Xz(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(TO,"moveScalarConfigToInputs");var Ps={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 Af(e){return typeof e=="string"&&Object.hasOwn(Ps,e)}s(Af,"isResourceType");var Ece=Object.keys(Ps).filter(e=>Ps[e].existence.check==="generic");function $O(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.groupKey=="string"&&n.groupKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||bo(n.reduction)===null&&n.reduction.kind==="amount")&&Object.keys(n).every(t=>t==="groupKey"||t==="grantKeys"||t==="reduction")}s($O,"isPricedGroupValue");var Fy=["street","hausnr","plz","ort","land"];function RO(e){return Fy.includes(e)}s(RO,"isAddressPart");var eW=["municipality","municipalityKey","district","districtKey"],Ly=[...Fy,...eW],My={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(My);function Ci(e){return typeof e=="string"&&e in My}s(Ci,"isValueType");function xt(e){return e===void 0?void 0:My[e]}s(xt,"dataTypeOf");function Ef(e,n){let t=xt(e),r=xt(n);return t!==void 0&&t===r}s(Ef,"valueTypesCompatible");function Tf(e){return e===null?"null is not a text in both languages":Sl(e,{type:"localizedText"})}s(Tf,"completeLocalizedTextIssue");function Sl(e,n){if(Af(n.type)&&!Ci(n.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${n.type} key`;let t=xt(n.type),r=JSON.stringify(e),i=`slot type "${n.type}" takes a binding, not a literal`;if(t===void 0||t==="composite"||t==="file"||t==="edge")return i;if(e===null)return null;switch(t){case"text":return typeof e=="string"?null:`${r} is not a text (slot type "${n.type}")`;case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)?null:`${r} is not a date YYYY-MM-DD`;case"number":return typeof e=="number"&&Number.isFinite(e)?null:`${r} is not a number`;case"boolean":return typeof e=="boolean"?null:`${r} is not true/false`;case"option":{if(typeof e!="string")return`${r} is not an option value`;let o=(n.enumOptions??[]).map(a=>a.value);return o.length===0||o.includes(e)?null:`${r} is not one of the options ${o.join(", ")}`}case"pricedItem":{let o=e;return typeof o=="object"&&typeof o.itemKey=="string"&&o.itemKey.length>0&&Array.isArray(o.grantKeys)&&o.grantKeys.every(a=>typeof a=="string")?null:`${r} is not a priced item {"itemKey":\u2026,"grantKeys":[\u2026]}`}case"pricedGroup":return $O(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 fl(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=bo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(Sl,"literalTypeIssue");function IO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(IO,"isObject");var nW={collectPayment:{reason:"reason"}},tW={governedDocument:["mockAutoProduce"]},OO={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 qy(e){return nW[String(e)]??{}}s(qy,"movesOf");function PO(e){return tW[String(e)]??[]}s(PO,"deadOf");function _O(e){return IO(e)&&[...Object.keys(qy(e.type)),...PO(e.type)].some(n=>n in e)}s(_O,"oldShape");function NO(e){return(e?.nodes??[]).some(_O)}s(NO,"needsNodeConfigInputMove");function rW(e){return Tf(e)===null}s(rW,"isCompleteText");function iW(e){let n=IO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(qy(e.type)))if(r in e){if(i in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!rW(e[r]))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueNotLocalized"}};n[i]={kind:"literal",value:e[r]},delete t[r]}for(let r of PO(e.type))delete t[r];return Object.keys(qy(e.type)).some(r=>r in e)&&(t.inputs=n),{node:t}}s(iW,"moveNode");function CO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!_O(i))return i;let o=iW(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(CO,"moveNodeConfigToInputs");var Ky="collectPayment",Ns=["online","separate"];function $f(e){return Ns.includes(e)}s($f,"isCollectPaymentSettlement");var Cs="paid",jy="skipPayment",Di="article",Jt="settlement",Fi="reason",Qt="payee",By=["one_time"];function Rf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Rf,"isObject");function DO(e){if(!Rf(e)||e.type!==Ky)return!1;let n=Rf(e.inputs)?e.inputs:{},t=n[Jt];return!Rf(t)||t.kind!=="literal"||t.value!=="online"?!1:!(Qt in n)}s(DO,"isOnlinePaymentWithoutPayee");function FO(e){return(e?.nodes??[]).some(DO)}s(FO,"needsPayee");function LO(e,n={}){let t=[],r=[],i=e.nodes.map(o=>{if(!DO(o))return o;let a=String(o.id),l=Object.hasOwn(n,a)?n[a]:void 0;if(l===void 0||l==="")return r.push(a),o;t.push({nodeId:a,payee:l});let d=Rf(o.inputs)?o.inputs:{};return{...o,inputs:{...d,[Qt]:{kind:"literal",value:l}}}});return t.length===0?{graph:e,set:t,refused:r}:{graph:{...e,nodes:i},set:t,refused:r}}s(LO,"setPayeeOnOnlinePayments");function If(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(If,"isObject");function Vy(e){return If(e)&&If(e.assign)&&"userId"in e.assign}s(Vy,"namesUser");function Of(e){return(e?.nodes??[]).flatMap(n=>If(n)&&Array.isArray(n.tasks)?n.tasks.filter(Vy).map(t=>({nodeId:String(n.id),taskKey:String(t.key),hasTeam:typeof t.assign.group=="string"&&t.assign.group.length>0})):[])}s(Of,"taskUserAssignments");function MO(e){let n=Of(e);if(n.length===0)return{graph:e,dropped:n};let t=e.nodes.map(r=>{if(!If(r)||!Array.isArray(r.tasks)||!r.tasks.some(Vy))return r;let i=r.tasks.map(o=>{if(!Vy(o))return o;let{userId:a,...l}=o.assign,{assign:d,...c}=o;return Object.keys(l).length===0?c:{...c,assign:l}});return{...r,tasks:i}});return{graph:{...e,nodes:t},dropped:n}}s(MO,"dropTaskAssignUserIds");var Ds={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"actionTeams{}":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Knoten-Aktion ausf\xFChren darf",en:"team that may perform the node action"},consequence:{de:"au\xDFer der zust\xE4ndigen Person darf niemand die Aktion ausf\xFChren",en:"nobody but the responsible person may perform the action"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"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"}}},Uy=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function qO(e,n){if(typeof n!="string"||n.length===0)return null;if(e==="key")return n;let t=Ts(n);return t?.kind==="team"?t.groupKey:null}s(qO,"decodeKey");var KO={"assign{}":"assign","actionTeams{}":"actionTeams"},oW=s(e=>e in KO,"isMapLeaf");function sW(e){let n=/^(tasks|optionalActions)\[\](?:\.([a-zA-Z]+))?\.([a-zA-Z]+)$/.exec(e);return n===null&&F(`[resource] unreadable reference leaf "${e}"`),{list:n[1],field:n[2]??null,key:n[3]}}s(sW,"locate");function Pf(e){let n=[],t=e;for(let[r,i]of Object.entries(KO))for(let[o,a]of Object.entries(Uy(t[i])??{}))n.push({path:`${i}.${o}`,leaf:r,owner:o,key:qO("key",a),missing:typeof a!="string"||a.length===0});for(let r of Object.keys(Ds)){if(oW(r))continue;let i=Ds[r],{list:o,field:a,key:l}=sW(r);for(let d of Array.isArray(t[o])?t[o]:[]){let c=Uy(d);if(c===null||typeof c.key!="string")continue;let p=(a===null?c:Uy(c[a]))?.[l];if(p===void 0&&!i.required)continue;let h=typeof p!="string"||p.length===0;n.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:qO(i.codec,p),missing:h})}}return n}s(Pf,"nodeResourceReferences");var jO=s(e=>(e??[]).map(n=>`\u201E${n}\u201C`).join(", "),"list"),BO=s(e=>(e??[]).map(n=>`"${n}"`).join(", "),"listEn"),aW={"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 (${jO(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 (${BO(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 (${jO(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 (${BO(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 Fs(e,n,t){let{problem:r,remedy:i}=aW[e][t](n);return`[${e}] ${r} ${i}`}s(Fs,"addressMessage");function Zt(e){let n=[];for(let t of e){let r=t.next;if(r)for(let[i,o]of Object.entries(r))n.push({id:`${t.id}|${i}`,source:t.id,target:o.to,sourceBranchId:i})}return n}s(Zt,"derivedEdges");function Gy(e){let n=new Map;for(let t of Zt(e.nodes)){let r=n.get(t.source)??[];r.push(t.target),n.set(t.source,r)}return n}s(Gy,"successorsOf");function _f(e,n,t){if(n===t)return!0;let r=Gy(e),i=new Set([...r.values()].flat()),o=e.nodes.filter(l=>!i.has(l.id)&&l.id!==n).map(l=>l.id),a=new Set(o);for(;o.length>0;){let l=o.shift();if(l===t)return!1;for(let d of r.get(l)??[])d===n||a.has(d)||(a.add(d),o.push(d))}return!0}s(_f,"dominates");function VO(e,n,t){if(n===t)return!0;let r=Gy(e),i=[n],o=new Set(i);for(;i.length>0;){let a=i.shift();for(let l of r.get(a)??[]){if(l===t)return!0;o.has(l)||(o.add(l),i.push(l))}}return!1}s(VO,"reaches");function UO(e,n,t,r){let i=new Map(e.nodes.map(d=>[d.id,d])),o=Gy(e),a=[n],l=new Set(a);for(;a.length>0;){let d=a.shift();for(let c of o.get(d)??[]){if(l.has(c)||t.has(c))continue;l.add(c);let u=i.get(c);if(u!==void 0&&r(u))return c;a.push(c)}}return null}s(UO,"reachedAvoiding");function zy(e,n){let t=[],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(_f(e,a.id,n))for(let l of Lr(e,a))t.push(r(l));for(let a of rO)t.push({address:{scope:"env",key:a},type:$y(a),label:Ry(a),nodeId:null});for(let a of lf(e))t.push({address:{scope:"env",key:df(a.key)},type:a.type,label:a.label,nodeId:null});let i=new Set(t.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=wl(e,l.key);c===null||!c.every(u=>i.has(se(bf(u))))||(t.push({address:{scope:"derived",key:l.key},type:l.type,label:l.label,nodeId:null}),i.add(d),a=!0)}}return t}s(zy,"visibleAddressesAt");function si(e,n){let t=e?.readinessFormFieldsByFormNode?.get(n.owner);if(t!==void 0)return t.get(n.path)??null}s(si,"formFieldEntryOf");var GO={binding:{de:"Eingang",en:"Input"},condition:{de:"Bedingung",en:"Condition"},nodeReads:{de:"Gelesene Felder",en:"Fields read"},requires:{de:"Geforderte Felder",en:"Required fields"},adoptForm:{de:"\xDCbernommenes Formular",en:"Continued form"},setFlagTarget:{de:"Freizuschaltendes Formular",en:"Form to unlock"},form:{de:"Formular",en:"Form"},contract:{de:"Vertrag",en:"Contract"},payment:{de:"Zahlung",en:"Payment"},taskWhen:{de:"Bedingung",en:"Condition"},optionalActionWhen:{de:"Bedingung der optionalen Aktion",en:"Condition of the optional action"},taskReads:{de:"Gelesene Felder der Aufgabe",en:"Fields the task reads"},taskDocument:{de:"Dokumente",en:"Documents"},familyRequestFields:{de:"Nachforderbare Felder",en:"Requestable fields"},familyRequestFrom:{de:"Nachforderung aus",en:"Request from"},suggest:{de:"Vorschlag",en:"Suggestion"},reduction:{de:"Erm\xE4\xDFigung des Preises",en:"Reduction of the price"},pricingRule:{de:"Preisregel",en:"Pricing rule"}},lW=new Set(["nodeReads","requires","taskReads","taskDocument","familyRequestFields"]);function dW(e,n,t){let r=[];n.taskKey!==void 0&&r.push(`${t==="de"?"Aufgabe":"task"} \u201E${So(e,n.taskKey,t)}\u201C`);let i=n.kind==="binding"?` \u201E${n.at.split(".").pop()}\u201C`:"";return r.push(`${GO[n.kind][t]}${i}`),r.join(" \u203A ")}s(dW,"addressFieldWhere");function Al(e,n,t){let r=dW(e,n,t);return n.nodeId===null?r:`\u201E${Oe(e,n.nodeId,t)}\u201C \u203A ${r}`}s(Al,"whereOf");function zO(e,n,t){if(n.scope==="node")return Oe(e,n.owner,t);if(n.scope==="task")return So(e,n.owner,t)}s(zO,"producerName");function WO(e,n){let t=[],r=new Set,i=s((l,d,c)=>{let u={de:Fs(l,c("de"),"de"),en:Fs(l,c("en"),"en")},p=`${d}|${u.de}`;r.has(p)||(r.add(p),t.push({layer:"GRAPH",kind:"nodeRule",path:d,reason:u,severity:"error"}))},"report"),o=new Map(e.nodes.map(l=>[l.id,l])),a=[...e.nodes.flatMap(l=>bl(l)),...vf(e)];for(let l of a){let d=s(c=>Al(e,l,c),"where");for(let c of cW(e,l,i))fW(e,l,c,i)&&(mW(e,l,c,n,i),Oy.has(l.kind)&&!gW(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:Ve(e,c,u)})))}return yW(e,i),wW(e,a,i),xW(e,i),AW(e,i),t}s(WO,"checkAddresses");function cW(e,n,t){let r=s(i=>Al(e,n,i),"where");if(Py(n)){let i=xf(n.value)??[];for(let o of i)o.address===null&&t(o.reason==="bareIdentifier"?"address/bareIdentifier":"address/shape",n.at,a=>({where:r(a),address:o.identifier}));return Os(n)}return typeof n.value=="string"?(t("address/bareIdentifier",n.at,i=>({where:r(i),address:n.value})),[]):we(n.value)?[n.value]:(t("address/shape",n.at,i=>({where:r(i),address:JSON.stringify(n.value)??"undefined"})),[])}s(cW,"checkFieldShape");function HO(e,n,t,r){let i=zO(e,t,r);return{where:Al(e,n,r),address:Ve(e,t,r),...i!==void 0?{producer:i}:{}}}s(HO,"addressParams");function uW(e,n,t){return Ty(n)||t==="optionalActionWhen"&&(vs(e,n)!==void 0||Ht(n))?null:vs(e,n)!==void 0?t==="condition"||t==="binding"?null:"address/staffInputConditionOnly":Ht(n)?"address/envCohortBound":"address/unknownKey"}s(uW,"envAddressRefusal");function fW(e,n,t,r){let i=s(o=>HO(e,n,t,o),"params");switch(t.scope){case"env":{let o=uW(e,t.key,n.kind);return o===null?!0:(r(o,n.at,i),!1)}case"derived":return(e.processStore??[]).find(a=>a.key===t.key)?.derive!==void 0?!0:(r("address/unknownKey",n.at,i),!1);case"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===t.owner))?(e.processStore??[]).some(a=>a.key===t.key&&a.derive===void 0)?Mr(e,t.owner,t.key)===null?(r("address/ownerNotWriter",n.at,i),!1):!0:(r("address/unknownKey",n.at,i),!1):(r("address/unknownOwner",n.at,i),!1);case"node":{let o=e.nodes.find(a=>a.id===t.owner);return o===void 0?(r("address/unknownOwner",n.at,i),!1):Lr(e,o).some(a=>a.address.scope==="node"&&a.address.key===t.key)?!0:(r(Oy.has(n.kind)&&vt(o)?"address/notFormInstance":"address/unknownKey",n.at,i),!1)}}}s(fW,"resolves");function pW(e,n){return e===void 0||n===void 0||xt(n)===void 0?!0:xt(e)!==void 0&&Ef(e,n)}s(pW,"addressTypeFits");function mW(e,n,t,r,i){let o=s(l=>HO(e,n,t,l),"params");if(t.scope!=="env"&&t.path!==void 0&&!hW(e,n,t,r)){i("address/pathNotInTarget",n.at,o);return}if(n.expectedType===void 0)return;let a=Ny(e,t);pW(a,n.expectedType)||i("address/typeMismatch",n.at,l=>({...o(l),expected:n.expectedType,actual:a}))}s(mW,"checkPathAndType");function hW(e,n,t,r){if(t.scope!=="node")return!1;if(Ny(e,t)!==void 0)return!0;if(t.key!==it)return!1;if(!lW.has(n.kind))return e.nodes.find(o=>o.id===t.owner)?.formExports===void 0;let i=r?.readinessFormFieldsByFormNode?.get(t.owner);return i===void 0||i.has(t.path)}s(hW,"pathExists");function gW(e,n){if(!kr(n))return!1;let t=e.get(n.owner);return t!==void 0&&t.type==="form"&&!vt(t)}s(gW,"isCreatingFormInstance");function yW(e,n){for(let t of e.nodes){let r=new Set(bl(t).map(i=>i.kind));for(let i of aO(t))r.has(i)||n("address/missing",`nodes.${t.id}.${i}`,o=>({where:`\u201E${Oe(e,t.id,o)}\u201C \u203A ${GO[i][o]}`}))}}s(yW,"checkRequiredFields");function wW(e,n,t){let r=new Map;for(let i of n)if(i.judgedTogether!==null)for(let o of Os(i)){if(o.scope!=="node"||o.key!==it)continue;let a=r.get(i.judgedTogether)??[];a.push({field:i,owner:o.owner}),r.set(i.judgedTogether,a)}for(let[i,o]of r){let a=[...new Set(o.map(l=>l.owner))];a.length<2||t("address/mixedForms",i,l=>({where:Al(e,o[0].field,l),names:a.map(d=>Oe(e,d,l))}))}}s(wW,"checkMixedForms");function kW(e,n){return e.type==="engagePush"&&n.kind==="payment"}s(kW,"readSkipsAbsentProducer");function bW(e,n,t){return n!==t&&VO(e,n,t)}s(bW,"precedesOnSomePath");function vW(e,n,t,r){let i=bf(t.address);return r.has(se(i))||!SW(e,i)?!0:t.origin==="written"&&i.scope==="node"&&kW(n,t.field)&&bW(e,i.owner,n.id)}s(vW,"readPassesVisibility");function xW(e,n){for(let t of e.nodes){let r=xo(e,t);if(r.length===0)continue;let i=new Set(zy(e,t.id).map(o=>se(o.address)));for(let o of r){let a=bf(o.address);if(vW(e,t,o,i))continue;let l=a.scope==="task"?Mr(e,a.owner,a.key):a.scope==="node"?a.owner:null;n("address/notVisible",o.field.at,d=>({where:Al(e,o.field,d),address:Ve(e,o.address,d),producer:zO(e,a,d)??Ve(e,a,d),...l!==null?{producerNode:Oe(e,l,d)}:{},reader:Oe(e,t.id,d)}))}}}s(xW,"checkVisibility");function SW(e,n){if(n.scope==="env")return Ty(n.key);if(n.scope==="derived")return wl(e,n.key)!==null;let t=se(n);return e.nodes.some(r=>Lr(e,r).some(i=>se(i.address)===t))}s(SW,"producedSomewhere");function AW(e,n){let t=new Map;for(let r of e.nodes){let i=new Set(Lr(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"||!Fr.test(l)){n("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${Oe(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=t.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),t.set(l,d)}}for(let[r,i]of t)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)n("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${Oe(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${So(e,r,a)}\u201C`,names:i.map(l=>Oe(e,l.nodeId,a))}))}s(AW,"checkTaskKeys");function Nf(e,n){return e.label[n]??""}s(Nf,"wordingIn");function Li(e,n){let t=YO(e,n),r=Nf(e.qualifier,n);return t===""||r===""&&Nf(e.qualifier,"de")!==""?"":r===""?t:`${r} \xB7 ${t}`}s(Li,"fieldLabelIn");function YO(e,n){return Nf(e,n)}s(YO,"fieldOwnLabelIn");function Ls(e){return{key:e.key,kind:e.kind,type:e.kind==="entered"?e.type:null,repeated:e.kind==="entered"&&e.repeated,reviewRequired:e.kind==="entered"&&e.reviewRequired,name:{de:Li(e,"de"),en:Li(e,"en")}}}s(Ls,"catalogField");function Ms(e,n){switch(e){case"nodeReads":return n.repeated?"repeated":null;case"requires":return n.repeated?"repeated":n.kind==="computed"?"computed":n.name.en===""?"untranslated":null;case"taskDocument":return n.repeated?"repeated":n.kind==="entered"&&n.type==="docRef"?null:"notDocument";case"taskReads":case"familyRequestFields":return null}}s(Ms,"catalogFieldRefusal");function Cf(e,n){let t=e.buses.find(r=>r.key===n);return t||F(`[progress] layout '${e.id}' has no bus '${n}'`),t}s(Cf,"progressBus");function El(e,n){return e.states.some(t=>t.id===n)}s(El,"isBusState");function JO(e,n){let t=e.terminalSemantics?.[n];return t||F(`[progress] no terminal semantics for state '${n}' on bus '${e.key}'`),t}s(JO,"terminalSemantics");function Df(e,n){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,n)}s(Df,"hasTerminalSemantics");function EW(e,n){return(e.boards??[]).find(t=>t.audience===n||t.audience==="both")??null}s(EW,"boardForAudience");function QO(e){return EW(Cf(e,"process"),"internal")}s(QO,"internalProcessBoard");function qs(e,n,t){let r=null;for(let i of e.mappings)if(i.event===t)if("nodeId"in i.match){if(i.match.nodeId===n.id)return{bus:i.bus,state:i.state}}else i.match.nodeType===n.type&&(r=i);return r?{bus:r.bus,state:r.state}:null}s(qs,"resolveProgressEvent");var Ks={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},ai=Object.keys(Ks);function Ao(e){return Object.hasOwn(Ks,e)}s(Ao,"isEndNodeOutcome");var Wy={approved:{de:"Angenommen",en:"Admitted"},rejected:{de:"Abgelehnt",en:"Rejected"},withdrawn:{de:"Zur\xFCckgezogen",en:"Withdrawn"},expired:{de:"Abgelaufen",en:"Expired"}};var Mi=["commit","discard"],xue=m.union(...Mi.map(e=>m.literal(e)));function Ff(e){return typeof e=="string"&&Mi.includes(e)}s(Ff,"isApplicationDataDecision");function Kn(e){return Object.keys(e)}s(Kn,"progressEventsOf");var te=s((e,n)=>({de:e,en:n}),"lt"),nn=s((e,n,t,r,i=null,o=null)=>({chipLabel:e,tone:n,nextAction:i,affordance:o,title:t,body:r}),"ex"),ZO={key:"eingeschrieben",label:te("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},Lf={key:"abgesagt",label:te("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},XO={key:"abgelehnt",label:te("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var eP={enrolled:{label:te("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:ZO,external:nn(te("Eingeschrieben","Enrolled"),"green",te("Sie sind eingeschrieben!","You are enrolled!"),te("Ihre Anmeldung ist abgeschlossen und Ihr Platz ist gesichert. Wir freuen uns auf Sie.","Your enrolment is complete and your place is secured. We look forward to welcoming you."))},declined:{label:te("Abgesagt","Declined"),tone:"red",terminal:{lifecycleStatus:"completed",outcome:"rejected"},phase:Lf,external:nn(te("Abgesagt","Declined"),"red",te("Die Bewerbung wurde beendet","The application has ended"),te("Ihre Bewerbung wurde nicht fortgef\xFChrt.","Your application was not continued."))}},nP={role:"effect",effect:"pure",progressDefaults:eP,progressEvents:Kn(eP),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:ai.map(e=>({value:e,label:Wy[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=>[...TW(e),...$W(e),...RW(e)],"validate")},js=s((e,n,t,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${n}`,reason:{de:t,en:r},severity:"error"}),"nodeIssue");function Eo(e){let n=e.inputs?.applicationOutcome;return n?.kind==="literal"&&n.value!=null?String(n.value):null}s(Eo,"literalOutcome");function TW(e){if(e.type!=="end")return[];let n=e.inputs?.applicationOutcome;if(n===void 0||n.kind==="unset")return[];let t=Eo(e);return t===null?[js(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`)]:Ao(t)?[]:[js(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${t}' ist kein Ausgang eines Endknotens (${ai.join("|")}) \u2014 die Warteliste endet \xFCber das closed-Outcome ihres Wartelistenknotens`,`[end/applicationOutcome] ${e.label.en}: '${t}' is not an outcome of an end node (${ai.join("|")}) \u2014 the waitlist ends through the closed outcome of its waitlist node`)]}s(TW,"checkEndApplicationOutcome");function $W(e){if(e.type!=="end")return[];let n=e.inputs?.dataDecision;return!n||n.kind!=="literal"||n.value==null?[js(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)`)]:Ff(n.value)?[]:[js(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision '${String(n.value)}' ist ung\xFCltig (${Mi.join("|")})`,`[end/dataDecision] ${e.label.en}: dataDecision '${String(n.value)}' is invalid (${Mi.join("|")})`)]}s($W,"checkEndDataDecision");function RW(e){if(e.type!=="end")return[];let n=Eo(e);if(n===null||!Ao(n)||n==="approved")return[];let t=e.inputs?.dataDecision;if(t?.kind!=="literal"||t.value!=="commit")return[];let r=Wy[n];return[{...js(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(RW,"checkEndCommitWithoutApproval");function tP(e,n){if(!n?.layout||!n.wiring)return[];let t=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=Eo(r);if(i===null||!Ao(i))continue;let o=Ks[i],a=qs(n.wiring,r,o);if(a===null)continue;let l=n.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Df(l,a.state))continue;let d=JO(l,a.state).outcome;d!==i&&t.push(js(r,"applicationOutcome",`[end/outcomeMismatch] ${r.label.de}: das Ergebnis \u201E${i}" passt nicht zum Endzustand \u201E${a.state}" (Bus ${a.bus}), der \u201E${String(d)}" besiegelt \u2014 Ergebnis oder Verdrahtung angleichen.`,`[end/outcomeMismatch] ${r.label.en}: the outcome "${i}" does not match the final state "${a.state}" (bus ${a.bus}), which seals "${String(d)}" \u2014 align the outcome or the wiring.`))}return t}s(tP,"checkEndOutcomeMatchesTerminal");function Bs(e){let n=Je(e);return typeof n.inputs=="function"?n.inputs(e):[]}s(Bs,"inputSlots");function IW(e,n){return Bs(e).find(t=>t.id===n)}s(IW,"findInputSlot");function OW(e,n){let t=IW(e,n);if(!t)return{source:"missing",spec:{id:n,label:{de:n,en:n},type:"string"},unknownSlot:!0};let r=e.inputs?.[n]??{kind:"unset"};return r.kind==="binding"&&we(r.address)?{source:"binding",spec:t,address:r.address}:r.kind==="literal"?{source:"literal",spec:t,value:r.value}:r.kind==="cockpit"&&t.deferrable===!0?{source:"cockpit",spec:t}:t.defaultValue!==void 0?{source:"default",spec:t,value:t.defaultValue}:t.required?{source:"missing",spec:t}:{source:"optional",spec:t}}s(OW,"resolveInput");function rP(e){return Bs(e).filter(n=>OW(e,n.id).source==="missing")}s(rP,"missingRequiredInputs");var PW=["personRef","formRef","documentRef","docRef"];function _W(e){let n=Je(e);return typeof n.inputs!="function"?[]:n.inputs(e).map(t=>({id:t.id,type:t.type}))}s(_W,"listInputs");function iP(e){let n=[];for(let t of e.nodes)for(let r of _W(t))!PW.includes(r.type)||t.inputs?.[r.id]?.kind!=="literal"||n.push({layer:"GRAPH",kind:"modelError",path:`node.${t.id}.param.${r.id}`,reason:{de:`${t.label.de}: Literal f\xFCr referenztypisierten Slot "${r.id}" ist verboten \u2014 der Slot wird an eine Adresse gebunden`,en:`${t.label.en}: A literal for the reference-typed slot "${r.id}" is not allowed \u2014 the slot is bound to an address`},severity:"error"});return n}s(iP,"findParamValueRefSlotErrors");function oP(e){let n=[];for(let t of e.nodes){let r=Je(t);if(typeof r.inputs=="function")for(let i of r.inputs(t)){let o=t.inputs?.[i.id];if(o?.kind==="cockpit"&&i.deferrable!==!0){n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/notDeferrable] ${t.label.de}: Parameter \u201E${i.label.de}\u201C l\xE4sst sich nicht im Cockpit erg\xE4nzen \u2014 nur Parameter eines Generators oder einer Vorlage.`,en:`[inputs/notDeferrable] ${t.label.en}: Parameter "${i.label.en}" cannot be completed in the cockpit \u2014 only parameters of a generator or a template can.`},severity:"error"});continue}(i.inspector==="literal-only"&&o?.kind==="binding"||i.inspector==="binding-only"&&o?.kind==="literal")&&n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:i.inspector==="literal-only"?{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C ist ein fester Wert \u2014 eine Bindung an eine Adresse ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is a fixed value \u2014 it cannot be bound to an address.`}:{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C wird an eine Adresse gebunden \u2014 ein fester Wert ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is bound to an address \u2014 a fixed value is not possible here.`},severity:"error"})}}return n}s(oP,"findInspectorKindErrors");function sP(e){let n=[];for(let t of e.nodes)for(let r of rP(t))n.push({layer:"GRAPH",kind:"contractGap",path:`node.${t.id}.input.${r.id}`,reason:{de:`${t.label.de}: Pflicht-Slot "${r.label.de}" nicht gesetzt`,en:`${t.label.en}: Required slot "${r.label.en}" is not set`},severity:"error"});return n}s(sP,"findMissingRequiredInputs");function Mf(e){let n=e.processStore;return n===void 0?[]:(Array.isArray(n)||F("graph.processStore must be an array \u2014 the graph validator refuses anything else"),n)}s(Mf,"processStoreKeys");function lP(e){let n=[];for(let t of e.tasks??[]){let r=t.result;if(!(r===void 0||!Es(r)))for(let i of yf(r))n.push({key:i.key,nodeId:e.id,taskKey:t.key,template:t,result:r,valueType:i.valueType,...i.field!==void 0?{fieldKey:i.field.key}:{}})}return n}s(lP,"storeWritersOn");function dP(e){let n=new Map;for(let t of e.nodes)for(let r of lP(t)){let i=n.get(r.key)??[];i.push(r),n.set(r.key,i)}return n}s(dP,"processStoreWriters");function NW(e,n,t){for(let r of e.nodes){let i=lP(r).find(o=>o.taskKey===n&&o.key===t);if(i!==void 0)return i}return null}s(NW,"writerAt");function aP(e,n,t){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${t}: ${se(n)} is no task value`);let r=NW(e,n.owner,n.key);return r===null&&F(`[address/ownerNotWriter] ${t}: task "${n.owner}" writes no "${n.key}" \u2014 publish refuses that`),{key:n.key,nodeId:r.nodeId,taskKey:r.taskKey,...r.fieldKey!==void 0?{fieldKey:r.fieldKey}:{}}}s(aP,"sourceOfAddress");function Hy(e,n){(n.scope!=="task"&&n.scope!=="derived"||n.path!==void 0)&&F(`[process] ${se(n)} is no store address`);let t=Mf(e).find(o=>o.key===n.key);t===void 0&&F(`[address/unknownKey] ${se(n)}: "${n.key}" is not declared in processStore`);let r={key:t.key,type:t.type,label:t.label,audience:t.audience};if(n.scope==="task")return xy(t)&&F(`[address/unknownKey] ${se(n)}: "${n.key}" is a derived price \u2014 read it as $derived`),{...r,sources:[aP(e,n,se(n))]};xy(t)||F(`[address/unknownKey] ${se(n)}: "${n.key}" is a written value \u2014 read it as $task`);let i=Sy(e,t.derive).map(o=>aP(e,o.address,se(n)));return{...r,sources:i,derive:t.derive}}s(Hy,"processLeafOf");var Yy=new Set(["enum","pricedItem","number","boolean","reduction"]),Jy=new Set(["pricedItem","pricedGroup"]),Qy=new Set(["number","boolean","enum"]),Le={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 Me(e,n,t,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${n} ${t}`,en:`${n} ${r}`},severity:"error"}}s(Me,"err");function cP(e,n={}){let t=[],r=Mf(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)){t.push(Me(u,Le.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)&&t.push(Me(u,Le.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" ist doppelt deklariert.`,`Process key "${c.key}" is declared twice.`)),o.add(c.key),(c.derive!==void 0?!Jy.has(c.type):!Yy.has(c.type))&&t.push(c.derive!==void 0?Me(u,Le.derive,`Vorgangs-Schl\xFCssel "${c.key}" ist abgeleitet, hat aber den Typ "${c.type}" \u2014 abgeleitet wird nur ein Preis: ${[...Jy].join(", ")}.`,`Process key "${c.key}" is derived but has the type "${c.type}" \u2014 only a price can be derived: ${[...Jy].join(", ")}.`):Me(u,Le.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" hat den Typ "${c.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...Yy].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: ${[...Yy].join(", ")}${c.type==="pricedGroup"?" (a package is derived: derive)":""}.`)),(!c.label?.de?.trim()||!c.label?.en?.trim())&&t.push(Me(u,Le.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"&&t.push(Me(u,Le.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${c.key}": audience must be 'internal' or 'printable'.`))}let a=dP(e);for(let d of e.nodes)for(let c of d.tasks??[]){let u=c.result;u?.kind==="pricedItem"&&u.writes===void 0&&t.push(Me(`node.${d.id}.tasks.${c.key}.result.writes`,Le.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 p of c){let h=p.fieldKey===void 0?`node.${p.nodeId}.tasks.${p.taskKey}.result.writes`:`node.${p.nodeId}.tasks.${p.taskKey}.result.fields.${p.fieldKey}.writes`;if(u===void 0){t.push(Me(h,Le.unknownKey,`${p.fieldKey===void 0?"":`Feld "${p.fieldKey}" der `}Aufgabe "${p.taskKey}" schreibt "${d}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${p.fieldKey===void 0?"Task":`Field "${p.fieldKey}" of task`} "${p.taskKey}" writes "${d}", but the workflow declares no such process key (graph.processStore).`));continue}if(p.valueType!==u.type){let w=p.fieldKey===void 0?`Aufgabe "${p.taskKey}"`:`Feld "${p.fieldKey}" der Aufgabe "${p.taskKey}"`,k=p.fieldKey===void 0?`Task "${p.taskKey}"`:`Field "${p.fieldKey}" of task "${p.taskKey}"`;t.push(Me(h,Le.writerTypeMismatch,`${w} liefert ${p.valueType}, der Vorgangs-Schl\xFCssel "${d}" ist aber als ${u.type} deklariert.`,`${k} delivers ${p.valueType}, but the process key "${d}" is declared as ${u.type}.`))}}if(c.length>1){let p=c.map(h=>`${h.nodeId}/${h.taskKey}${h.fieldKey===void 0?"":`.${h.fieldKey}`}`).join(", ");t.push(Me(`processStore.${d}`,Le.secondWriter,`Vorgangs-Schl\xFCssel "${d}" wird ${c.length}-mal geschrieben (${p}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${d}" is written ${c.length} times (${p}) \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(", ");t.push(Me(`processStore.${d.key}`,Le.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)||t.push(Me(`processStore.${d.key}`,Le.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').`))}t.push(...CW(e,r,a,n));let l=new Map;for(let d of e.nodes){let c=Je(d),u=typeof c.inputs=="function"?c.inputs(d):[];for(let p of u){let h=d.inputs?.[p.id];if(h?.kind!=="binding")continue;let w=DW(e,h.address);if(w===null)continue;let k=`node.${d.id}.input.${p.id}`,y=se(h.address);for(let E of w.sources){let A=l.get(E.key)??new Set;A.add(d.id),l.set(E.key,A)}if(w.audience==="internal"&&t.push(Me(k,Le.internalInDocument,`${d.label.de}: "${p.id}" liest den internen Vorgangs-Schl\xFCssel "${w.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${d.label.en}: "${p.id}" reads the internal process key "${w.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`)),w.derive!==void 0)continue;let v=FW(a,w.sources[0].key,w.sources[0].taskKey);if(v.template.when!==void 0&&p.required===!0&&p.defaultValue===void 0&&t.push(Me(k,Le.absentWithoutDefault,`${d.label.de}: "${p.id}" ist Pflicht und an ${y} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${qf(v.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${d.label.en}: "${p.id}" is required and bound to ${y}, but the writing task only exists under a condition (when: ${qf(v.template.when)}) \u2014 without a default value the field would stay empty forever.`)),v.result.kind==="pricedItem"&&p.defaultValue!==void 0){let E=p.defaultValue;(!Pi(E)||E.itemKey!==v.result.item||E.grantKeys.length>0)&&t.push(Me(k,Le.defaultItemMismatch,`${d.label.de}: der Vorgabewert von "${p.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 "${p.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],p=u.template.blocks,h=p===void 0?void 0:p.node??u.nodeId,w=h!==void 0&&c.has(h)&&(()=>{let y=e.nodes.find(v=>v.id===h);return y!==void 0&&Je(y).processHoldTemplate?.(y)===p.templateKey})(),k=`node.${u.nodeId}.tasks.${u.taskKey}.blocks`;if(!w){let y=[...c][0],v=e.nodes.find(A=>A.id===y),E=Je(v).processHoldTemplate?.(v)??"?";t.push(Me(k,Le.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: { ${y===u.nodeId?"":`node: '${y}', `}templateKey: '${E}' }, 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: { ${y===u.nodeId?"":`node: '${y}', `}templateKey: '${E}' }, otherwise it works before the value exists.`));continue}for(let y of c)y===h||_f(e,h,y)||t.push(Me(k,Le.writerMustBlock,`"${y}" liest "${d}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${h}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${y}" reads "${d}" but does not lie behind the held-back node "${h}" \u2014 on a path past it, it would read the value before it is settled.`))}return t}s(cP,"processBindingIssues");function CW(e,n,t,r){let i=[],o=new Map(n.map(u=>[u.key,u])),a=kf(e),l=new Set;for(let[u,p]of a.entries()){let h=`pricingRules[${u}]`;if((typeof p.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(p.key)||l.has(p.key))&&i.push(Me(h,Le.ruleSet,`Regelgruppe ${JSON.stringify(p.key)} \u2014 ein eindeutiger Schl\xFCssel aus Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Rule group ${JSON.stringify(p.key)} \u2014 a unique key of letters, digits and _, starting with a lowercase letter.`)),l.add(p.key),(!p.label?.de?.trim()||!p.label?.en?.trim())&&i.push(Me(h,Le.ruleSet,`Regelgruppe "${p.key}" braucht ein Label in beiden Sprachen.`,`Rule group "${p.key}" needs a label in both languages.`)),!Array.isArray(p.rows)||p.rows.length===0){i.push(Me(h,Le.ruleSet,`Regelgruppe "${p.key}" hat keine Zeilen.`,`Rule group "${p.key}" has no rows.`));continue}for(let[w,k]of p.rows.entries()){let y=`${h}.rows[${w}]`;(!Array.isArray(k.grants)||k.grants.length===0||k.grants.some(E=>typeof E!="string"||E.length===0))&&i.push(Me(y,Le.ruleSet,`Regelgruppe "${p.key}", Zeile ${w+1}: nennt keine Rabattvorlage \u2014 eine Zeile ohne Rabatt ist die fehlende Zeile.`,`Rule group "${p.key}", row ${w+1}: names no discount template \u2014 a row without a discount is the missing row.`));let v=hl(k.when);if(v!==null){i.push(Me(y,Le.ruleCondition,`Regelgruppe "${p.key}", Zeile ${w+1}: Bedingung ${JSON.stringify(k.when)} \u2014 ${v}.`,`Rule group "${p.key}", row ${w+1}: condition ${JSON.stringify(k.when)} \u2014 ${v==="leere Bedingung"?"empty condition":v}.`));continue}for(let{identifier:E,address:A}of Iy(k.when)){if(A===null)continue;let I=LW(A,o,t);if(I==="ruleSource")i.push(Me(y,Le.ruleSource,`Regelgruppe "${p.key}", Zeile ${w+1}: liest ${E} \u2014 eine Bedingung liest nur Werte, die eine Aufgabe schreibt ($task.<aufgabe>.<schl\xFCssel>), vom Typ ${[...Qy].join(", ")}.`,`Rule group "${p.key}", row ${w+1}: reads ${E} \u2014 a condition only reads values that a task writes ($task.<task>.<key>), of type ${[...Qy].join(", ")}.`));else if(I==="ruleReadsAbsent"){let N=t.get(A.key).find(T=>T.taskKey===A.owner);i.push(Me(y,Le.ruleReadsAbsent,`Regelgruppe "${p.key}" liest ${E}, dessen Aufgabe entfallen kann (${N.template.when!==void 0?`when: ${qf(N.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 "${p.key}" reads ${E}, whose task can lapse (${N.template.when!==void 0?`when: ${qf(N.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 n){if(u.absentValue===void 0)continue;let p=`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(Me(p,Le.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 w=t.get(u.key)?.[0];w!==void 0&&!uP(w)&&i.push(Me(p,Le.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 n){let p=u.derive;if(p===void 0)continue;let h=`processStore.${u.key}.derive`,w=u.type==="pricedGroup"?"group":"item",k=[p.item,p.group,p.byStage].filter(T=>T!==void 0).length,y=Ay(p),v=p.byStage??[];(k!==1||y.length===0||y.length!==Math.max(v.length,1)||y.some(T=>T.kind!==w))&&i.push(Me(h,Le.derive,`"${u.key}" (${u.type}) leitet ${w==="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 ${w==="group"?"a package: exactly 'group' or 'byStage' with one 'group' each":"an article: exactly 'item' or 'byStage' with one 'item' each"}.`));let E=new Set;for(let[T,b]of v.entries()){if(!Array.isArray(b.stages)||b.stages.length===0){i.push(Me(`${h}.byStage[${T}]`,Le.derive,`"${u.key}": die Zeile ${T+1} nennt keine Stufe.`,`"${u.key}": row ${T+1} names no stage.`));continue}for(let R of b.stages)E.has(R)&&i.push(Me(`${h}.byStage[${T}]`,Le.derive,`"${u.key}": die Stufe "${R}" steht in mehr als einer Zeile \u2014 welcher Preis gilt, w\xE4re geraten.`,`"${u.key}": the stage "${R}" is in more than one row \u2014 which price applies would be a guess.`)),E.add(R)}let A=new Set;for(let T of p.rules??[]){let b=a.find(R=>R.key===T);if(b===void 0){i.push(Me(h,Le.derive,`"${u.key}" nennt die Regelgruppe "${T}", die der Workflow nicht deklariert (bekannt: ${a.map(R=>R.key).join(", ")||"keine"}).`,`"${u.key}" names the rule group "${T}", which the workflow does not declare (known: ${a.map(R=>R.key).join(", ")||"none"}).`));continue}for(let R of b.rows??[])for(let q of R.grants??[])A.add(q)}let I=p.reduction;we(I)&&(MW(I,o)||i.push(Me(h,Le.derive,`"${u.key}": Reduktion ${se(I)} ist kein von einer Aufgabe geschriebener Wert vom Typ reduction ($task.<aufgabe>.<schl\xFCssel>).`,`"${u.key}": reduction ${se(I)} is not a value of type reduction written by a task ($task.<task>.<key>).`)));for(let T of y)d.push({key:u.key,target:T,grants:A}),(T.kind==="item"?r.billingItemKeys?.has(T.key):r.groupArticleKeys?.has(T.key))===!1?i.push(Me(h,Le.derivePriceUnknown,`"${u.key}": ${T.kind==="item"?"der Artikel":"das Paket"} "${T.key}" ist nicht im Katalog des Mandanten.`,`"${u.key}": the ${T.kind==="item"?"article":"package"} "${T.key}" is not in the school's catalog.`)):r.offerProgram===null?i.push(Me(h,Le.derivePriceOfferWithoutProgram,`"${u.key}": das Angebot ist keinem Programm zugeordnet, also geh\xF6rt ${T.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 ${T.kind==="item"?"article":"package"} belongs to it; give the offer a program.`)):r.offerProgram!==void 0&&((T.kind==="item"?r.offerProgram.billingItemKeys:r.offerProgram.groupKeys).has(T.key)||i.push(Me(h,Le.derivePriceNotInProgram,`"${u.key}": ${T.kind==="item"?"der Artikel":"das Paket"} "${T.key}" ist dem Programm \u201E${r.offerProgram.nameDe}\u201C des Angebots nicht zugeordnet${T.kind==="group"?" oder wird nicht angeboten":""} (unter Finanzen \u2192 Artikel zuordnen).`,`"${u.key}": the ${T.kind==="item"?"article":"package"} "${T.key}" is not assigned to the offer's program "${r.offerProgram.nameDe}"${T.kind==="group"?" or is not offered":""} (under Finance \u2192 assign articles).`)));let N=r.offerProgram?.stageKeys;if(p.byStage!==void 0&&N!==void 0){let T=[...E].filter(R=>!N.all.has(R));T.length>0&&i.push(Me(h,Le.deriveStageUnknown,`"${u.key}": ${T.map(R=>`"${R}"`).join(", ")} ist keine Stufe des Programms \u201E${r.offerProgram.nameDe}\u201C (Stufen: ${[...N.all].join(", ")||"keine"}).`,`"${u.key}": ${T.map(R=>`"${R}"`).join(", ")} ${T.length===1?"is not a stage":"are not stages"} of the program "${r.offerProgram.nameDe}" (stages: ${[...N.all].join(", ")||"none"}).`));let b=[...N.active].filter(R=>!E.has(R));b.length>0&&i.push(Me(h,Le.deriveStageUncovered,`"${u.key}": f\xFCr ${b.map(R=>`"${R}"`).join(", ")} nennt byStage keinen ${w==="group"?"Paket":"Artikel"} \u2014 diese Stufe h\xE4tte keinen Preis.`,`"${u.key}": for ${b.map(R=>`"${R}"`).join(", ")} byStage names no ${w==="group"?"package":"article"} \u2014 that stage would have no price.`))}}for(let u of t.values())for(let p of u){if(p.result.kind!=="reduction"||p.result.prices===void 0||p.result.writes===void 0)continue;let h=`node.${p.nodeId}.tasks.${p.taskKey}.result.prices`,k=o.get(p.result.prices)?.derive?.reduction;we(k)&&k.scope==="task"&&k.owner===p.taskKey&&k.key===p.result.writes||i.push(Me(h,Le.reductionPrices,`Aufgabe "${p.taskKey}" senkt "${p.result.prices}" \u2014 das muss ein abgeleiteter Preis sein, dessen derive.reduction $task.${p.taskKey}.${p.result.writes} ist.`,`Task "${p.taskKey}" reduces "${p.result.prices}" \u2014 that must be a derived price whose derive.reduction is $task.${p.taskKey}.${p.result.writes}.`))}let c=r.grantTemplates;if(c!==void 0){let u=new Set(a.flatMap(p=>(p.rows??[]).flatMap(h=>h.grants??[])));for(let p of u){let h=c.get(p);if(h===void 0){i.push(Me("pricingRules",Le.ruleGrantUnknown,`Eine Regelgruppe vergibt "${p}", aber keine Rabattvorlage des Mandanten tr\xE4gt diesen Schl\xFCssel.`,`A rule group grants "${p}", but no discount template of the school has this key.`));continue}d.some(({target:k,grants:y})=>{if(!y.has(p))return!1;if(k.kind==="item")return h.itemKeys.includes(k.key);let v=r.groupArticleKeys?.get(k.key);return h.itemKeys.some(E=>v?.has(E))})||i.push(Me("pricingRules",Le.ruleGrantUnused,`Die Rabattvorlage "${p}" (gebunden an Artikel "${h.itemKeys.join(", ")}") wird vergeben, aber kein abgeleiteter Preis, der ihre Regelgruppe liest, enth\xE4lt ihr Ziel \u2014 sie wirkte nirgends.`,`The discount template "${p}" (bound to article "${h.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(CW,"derivedPriceIssues");function DW(e,n){if(!we(n)||n.scope!=="task"&&n.scope!=="derived"||n.path!==void 0)return null;let t=Mf(e).find(o=>o.key===n.key);if(t===void 0||n.scope==="derived"!=(t.derive!==void 0))return null;if(n.scope==="task")return Mr(e,n.owner,n.key)===null?null:Hy(e,n);let r=ZI(e,t.derive),i=s(o=>o.scope==="task"&&o.path===void 0&&Mr(e,o.owner,o.key)!==null,"resolvable");return r!==null&&r.every(o=>i(o.address))?Hy(e,n):null}s(DW,"draftLeafOf");function FW(e,n,t){let r=e.get(n)?.find(i=>i.taskKey===t);return r===void 0&&F(`[process] the leaf of "${n}" names task "${t}", which does not write it`),r}s(FW,"writerOf");function qf(e){return we(e)?se(e):JSON.stringify(e)}s(qf,"shown");function LW(e,n,t){let r=e.scope==="task"&&e.path===void 0?n.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||!Qy.has(r.type))return"ruleSource";let i=t.get(r.key)?.find(o=>o.taskKey===e.owner);return i!==void 0&&uP(i)&&r.absentValue===void 0?"ruleReadsAbsent":null}s(LW,"ruleSourceRefusal");function MW(e,n){let t=e.scope==="task"&&e.path===void 0?n.get(e.key):void 0;return t!==void 0&&t.type==="reduction"&&t.derive===void 0}s(MW,"isReductionValue");function uP(e){return e.template.when!==void 0||e.template.blocks?.node===void 0}s(uP,"writerMayBeNotOwed");function Zy(e){let n=Je(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:n.outcomes&&n.outcomes.length>0?[...n.outcomes]:null}s(Zy,"nodeOutcomes");var qW=["documentChangeRequested","documentReturned"];function fP(e){return qW.includes(e)}s(fP,"isNonAdvancingExternalEvent");var Vs=["offer","contract"];function Kf(e){return typeof e=="string"&&Vs.includes(e)}s(Kf,"isArtifactSlotType");var pP="open",Us="done";function Xy(e){let n={};for(let t of He)n[t]=e(t);return n}s(Xy,"localized");var mP=[{key:"tenantSlug",type:"string"}];var KW=/^(\d{4})-(\d{2})-(\d{2})$/;function jW(e){return e>=1900&&e<=2100}s(jW,"isSupportedYear");function BW(e,n,t){let r=new Date(Date.UTC(e,n-1,t));return r.getUTCFullYear()===e&&r.getUTCMonth()===n-1&&r.getUTCDate()===t}s(BW,"isRealDate");function ew(e){if(typeof e!="string")return null;let n=KW.exec(e);if(n===null)return null;let[,t,r,i]=n;return t===void 0||r===void 0||i===void 0||!jW(Number(t))||!BW(Number(t),Number(r),Number(i))?null:{year:t,month:r,day:i}}s(ew,"isoDateParts");var VW="Europe/Berlin";function gP(){return VW}s(gP,"tenantTimeZone");var hP=new Map;function UW(e){let n=hP.get(e);if(n)return n;let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{de("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return hP.set(e,t),t}s(UW,"formatterFor");function GW(e,n){let t=new Map(UW(e).formatToParts(new Date(n)).map(a=>[a.type,a.value])),r=s(a=>{let l=t.get(a);return l===void 0&&F(`Zeitzone "${e}" liefert kein Feld ${a}.`),Number(l)},"read"),i=r("hour")%24;return Date.UTC(r("year"),r("month")-1,r("day"),i,r("minute"),r("second"))-Math.floor(n/1e3)*1e3}s(GW,"zoneOffsetAt");function nw(e,n){let t=e+GW(n,e);return{wallClock:new Date(t).toISOString().slice(0,19),timeZone:n}}s(nw,"instantToLocalDateTime");var tw=3;function yP(e){return nw(e,gP()).wallClock.slice(0,10)}s(yP,"localIsoDate");var jf=["login","security","admission","tasks","deadlines","schoolMessages","staffTasks","staffAppointments","staffDeadlines","staffWaitlist","familyMessages","mentions"],wP=m.union(...jf.map(e=>m.literal(e)));var Dfe=m.union(m.literal("admission"),m.literal("tasks"),m.literal("staff"),m.literal("chat")),rw=["loginOnly","all"],Ffe=m.union(m.literal("loginOnly"),m.literal("all"));function kP(e){return typeof e=="string"&&rw.includes(e)}s(kP,"isMailLevel");var Tl="subject";function bP(e){return e.category==="login"}s(bP,"isSignInLetter");var mn={key:"schoolName",label:"Name der Schule"},vP={de:"Zu Ihren Bewerbungen",en:"View your applications"},Tn={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:vP},iw={key:Tn.key,label:Tn.label,link:!0,actionLabel:vP},xP={key:"authorName",label:"Name der schreibenden Person"},Gs={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},$l={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"}},WW={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"}},SP={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"}},Rl={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},AP={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},HW={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function qe(e){return{key:Tl,label:"Betreff",default:e}}s(qe,"subjectSlot");var qi=m.object({de:m.string(),en:m.string()}),Nn={tenantSlug:m.string(),applicationId:m.id("applications")},YW=m.object({tenantSlug:m.string()}),JW={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:YW,channels:["email"],portalVisible:!0,placeholders:[mn,Tn],slots:[qe({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:
|
|
10967
10967
|
|
|
10968
10968
|
{{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
|
|
@@ -11457,6 +11457,6 @@ ${t.length} unusable ${o}:
|
|
|
11457
11457
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11458
11458
|
`),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>
|
|
11459
11459
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11460
|
-
`);return t.length>0?1:0}},JE=class extends dr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=$.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function RB(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(RB,"requireOnOff");var IB=[NE,CE,DE,FE,LE,ME,qE,KE,jE,BE,ru,VE,UE,GE,zE,WE,HE,YE,JE];function OB(e){return e.de??e.en??Object.values(e)[0]??""}s(OB,"titleDe");function JZ(e){return{id:e._id,kind:e.kind,status:e.status,title:OB(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(JZ,"row");var QZ=["id","kind","status","title","assignee","group","outcome"],XE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=$.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(JZ),QZ),0}},eT=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=$.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:OB(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}},nT=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=$.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},tT=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=$.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},rT=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=$.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},PB=[XE,eT,nT,tT,rT];var iu=[...LR,...qC,...JC,...ZD,...QD,...AF,...PF,...OF,...TB,...IB,...EB,...uj,...yj,...SC,...bF,...mB,...DR,...cI,...lC,...CF,...NF,...LF,...MF,...wF,...iF,...PB,...sq,...Yq,...dj,...Jq,...Qj,...oB,...wj,...$j,...Oj,...Cj,...Fj,...lB,...wB,...XR];for(let e of iu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:i$(e.usage.category,n.join(" "))})}var _B="0.1.130";function NB(){return iu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=e$[lo(t)];return{path:t,effect:co(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(NB,"plexusCommandCatalog");import es from"node:path";function ZZ(e){let n=cn()?.workspaceRoot??process.cwd(),t=es.resolve(n,e),r=es.relative(n,t);if(es.isAbsolute(e)||r===".."||r.startsWith(`..${es.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(ZZ,"workspacePath");function XZ(e){let{absolute:n,relative:t}=ZZ(e.path??".");if(e.operation==="list"){if(!Se(n))return{files:[]};let r=[],i=s(o=>{for(let a of Or(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=es.join(o,a.name);if(a.isDirectory()?i(l):r.push(es.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return We(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Mn(es.dirname(n),{recursive:!0}),We(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return is(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(XZ,"plexusWorkspace");function CB(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=dl[t];if(!o||!Object.hasOwn(dl,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(Wg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Wg[i.path],skillHash:Zu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return XZ(i)},"executePlexusAgentTool")}s(CB,"createPlexusAgentToolExecutor");var _h=CB({inspectCommand:FB,executeCommand:LB});function Nh(){let e=new ls({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_B});e.register(za.HelpCommand),e.register(za.VersionCommand);for(let t of iu)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return t9(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(Nh,"createPlexusCli");function t9(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&Qa[t]===r&&ln(n,t,r),t in Qa&&co(t)==="confirm"&&!Za(e)&&n.write(`plexus-cli: \`${Qa[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11460
|
+
`);return t.length>0?1:0}},JE=class extends dr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=$.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function RB(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(RB,"requireOnOff");var IB=[NE,CE,DE,FE,LE,ME,qE,KE,jE,BE,ru,VE,UE,GE,zE,WE,HE,YE,JE];function OB(e){return e.de??e.en??Object.values(e)[0]??""}s(OB,"titleDe");function JZ(e){return{id:e._id,kind:e.kind,status:e.status,title:OB(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(JZ,"row");var QZ=["id","kind","status","title","assignee","group","outcome"],XE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=$.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(JZ),QZ),0}},eT=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=$.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:OB(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}},nT=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=$.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},tT=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=$.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},rT=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=$.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},PB=[XE,eT,nT,tT,rT];var iu=[...LR,...qC,...JC,...ZD,...QD,...AF,...PF,...OF,...TB,...IB,...EB,...uj,...yj,...SC,...bF,...mB,...DR,...cI,...lC,...CF,...NF,...LF,...MF,...wF,...iF,...PB,...sq,...Yq,...dj,...Jq,...Qj,...oB,...wj,...$j,...Oj,...Cj,...Fj,...lB,...wB,...XR];for(let e of iu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:i$(e.usage.category,n.join(" "))})}var _B="0.1.132";function NB(){return iu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=e$[lo(t)];return{path:t,effect:co(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(NB,"plexusCommandCatalog");import es from"node:path";function ZZ(e){let n=cn()?.workspaceRoot??process.cwd(),t=es.resolve(n,e),r=es.relative(n,t);if(es.isAbsolute(e)||r===".."||r.startsWith(`..${es.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(ZZ,"workspacePath");function XZ(e){let{absolute:n,relative:t}=ZZ(e.path??".");if(e.operation==="list"){if(!Se(n))return{files:[]};let r=[],i=s(o=>{for(let a of Or(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=es.join(o,a.name);if(a.isDirectory()?i(l):r.push(es.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return We(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Mn(es.dirname(n),{recursive:!0}),We(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return is(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(XZ,"plexusWorkspace");function CB(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=dl[t];if(!o||!Object.hasOwn(dl,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(Wg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Wg[i.path],skillHash:Zu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return XZ(i)},"executePlexusAgentTool")}s(CB,"createPlexusAgentToolExecutor");var _h=CB({inspectCommand:FB,executeCommand:LB});function Nh(){let e=new ls({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_B});e.register(za.HelpCommand),e.register(za.VersionCommand);for(let t of iu)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return t9(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(Nh,"createPlexusCli");function t9(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&Qa[t]===r&&ln(n,t,r),t in Qa&&co(t)==="confirm"&&!Za(e)&&n.write(`plexus-cli: \`${Qa[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11461
11461
|
`)}s(t9,"noteRetiredPath");function FB(e){let n=Nh().process(La(e),{executePlexusAgentTool:_h}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=NB().find(l=>l.path===t);if(!r){if(t===""||t==="--help"||t==="--version")return{path:t,writes:!1,host:"shared"};throw new Error(`plexus: command ${t} has no host classification.`)}let i=n,o=r.effect==="callKind"?rm(ha(ga),i.fn??"",i.kind):void 0,a=qu(t,{confirm:Za(n),callKind:o});return{...r,writes:a}}s(FB,"inspectPlexusCommand");async function LB(e,n){if(n)return sT(n,()=>LB(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let t="",r="",i=Nh();if(cn()){let l=FB(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(La(e.argv),{executePlexusAgentTool:_h,stdin:n9.from(e.stdin===void 0?[]:[e.stdin]),stdout:new DB({write(l,d,c){t+=String(l),c()}}),stderr:new DB({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(LB,"executePlexusCommand");uT({source:r9.join(import.meta.dirname,"skill")});Nh().runExit(La(process.argv.slice(2)),{executePlexusAgentTool:_h});
|
|
11462
11462
|
//# sourceMappingURL=cli.mjs.map
|