@smartkomm/plexus-cli 0.1.161 → 0.1.162
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
|
@@ -6092,7 +6092,7 @@ plexus-cli --env prod demo link delete --allow-prod <code> --confirm # deletes,
|
|
|
6092
6092
|
|
|
6093
6093
|
## Related
|
|
6094
6094
|
- \`plexus-cli demo link stats --json\` for further processing (e.g. \`jq\`).
|
|
6095
|
-
`,"references/notifications/debug-mail-delivery.md":'# Debug a mail delivery\n\n**When:** "no mail arrived", a red `deadLastHour` badge in the platform\nconsole, or a `backend:convex` GlitchTip issue tagged `area=notifications`.\n\n## 1. Is the sweeper alive, and is anything dead?\n\n```bash\nplexus-cli --env staging platform notifications sweeper-status\nplexus-cli --env staging platform notifications list --status dead\n```\n\n`ranAt` older than a few minutes \u21D2 the cron is not firing (deploy broke?).\n`deadLastHour > 0` \u21D2 go to step 3 with an id from the list.\n\n## 2. Find the delivery for a person\n\n```bash\nplexus-cli --env staging platform notifications list --to parent@example.org --since 2d\nplexus-cli --env staging platform notifications list --template account.loginLink --since 24h\n```\n\nFor a sign-in problem start with `platform users login-trail` instead \u2014 see\n[Trace why someone could not sign in](./trace-a-login.md).\n\nStatuses: `queued` (waiting / backoff), `sending` (in flight), `sent` (relay\naccepted \u2014 NOT "in the inbox"), `skipped` (a successful non-send: recipient\ngone, precondition no longer true, reserved TLD \u2014 in `live` every RFC 2606\naddress, in `redirect` only `.invalid`), `dead` (gave up).\n\n## 3. Read the evidence\n\n```bash\nplexus-cli --env staging platform notifications show <deliveryId>\n```\n\n| `errorCode` | Means | Do |\n| --- | --- | --- |\n| `delivery_mode_invalid` / `config_missing` | deployment env is incomplete | needs a platform operator: complete the deployment\'s mail settings, then `retry` |\n| `smtp_auth` | relay rejected the credentials | needs a platform operator: rotate the relay password in the deployment\'s settings, then `retry` |\n| `smtp_policy` | relay rejected OUR sender at `MAIL FROM` | `MAIL_FROM_ADDRESS` not allowed for this account \u2014 ask the mail admin |\n| `smtp_content` with 4xx at `DATA` | milter (DKIM) hiccup \u2014 retried automatically | if it stays: the relay\'s DKIM key/permissions \u2014 ask the mail admin |\n| `smtp_recipient_rejected` | 5xx at `RCPT TO` | the address does not exist \u2014 nothing to retry |\n| `recipient_revoked` / `recipient_changed` / `recipient_deleted` | identity changed after enqueue | expected; re-raise the event if still wanted |\n| `never_claimed` | the dispatch action fails BEFORE it can claim | bundle/import problem \u2014 needs a platform operator (deployment logs of the action), fix, `retry` |\n| `unknown_outcome` | action died after SMTP began | the recipient MAY have received it; decide, then `retry` |\n\n`lastSmtpCommand` / `lastSmtpResponseCode` / `lastSmtpResponse` carry the raw\nrelay line. `possibleDuplicate: true` means attempt N may already have landed.\n\n## 4. Prove the configuration end to end\n\n```bash\nplexus-cli --env staging platform notifications self-test --to <your-address>\n```\n\nVerifies the connection + credentials, sends one mail, returns the SMTP\ntranscript. On staging the mail is redirected like every other; on prod it\nreally goes to `--to`.\n\n## 5. Retry\n\n```bash\nplexus-cli --env staging platform notifications retry <deliveryId>\n```\n\nOnly `dead` rows. It is a fresh attempt through the normal claim path \u2014 the\nretry budget is widened by exactly one.\n\n## Gotchas\n\n- `sent` = accepted by the relay. The last hop (relay \u2192 GMX) is invisible; on\n staging the platform operator reads the catch-all mailbox.\n- A `451` is not always transient: the relay says `451 4.7.1` for a\n sender-policy violation and for a broken DKIM key. Look at the COMMAND.\n- Locally nothing is ever sent (`dry`): the mail is in the Dev Rail \u2192\n `notifications:listDevPreviews`.\n',"references/notifications/mail-level.md":'# Choose which mail a school sends (mail level)\n\n> **Version check first.** A deployment on a release older than the mail level\n> ignores `--field mailLevel` WITHOUT an error and keeps reading the retired\n> `tenant.enabledMailCategories` (`[]` = sign-in only, every category = all).\n> If `config export` shows no `mailLevel`, stop and ask the platform operator.\n> The same skew means a tenant scaffolded with a newer CLI against an older\n> deployment starts at sign-in mail only.\n\n**When to use:** a school wants only the sign-in links for FAMILIES for now\n(\u201EAnmeldelinks ja, alles andere nein"), or is ready for every mail.\n\n**The level is family mail only.**\nLetters to the school\'s own staff (`audience: "internal"`: new tasks, passed\ndeadlines, family messages, mentions) go out at BOTH levels; each staff member\ndecides them in \u201EEinstellungen" (personal categories, runbook \u201EWhich mail a\nstaff member wants"). Do not use the level to quiet staff mail.\n\n**Current stance:** every tenant \u2014 prod, staging and the `test` demo tenant \u2014\nruns `loginOnly` until the platform operator decides otherwise. Switching a real\nschool to `all` is that decision, not a routine step. Only a local full seed\nputs the `test` demo tenant at `all`, so locally every admission, family-task and\nschool-chat letter is rendered (a local deployment sends no mail); the template\nstaging and prod apply stays `loginOnly`. On a local deployment that was not\nseeded that way, set it to `all` yourself (`--env local`). Staff letters render\nat both levels.\n\n## What it is\n\n- A school has ONE setting, its **mail level** (`tenant.mailLevel`, required in\n every tenant config):\n - `loginOnly` \u2014 \u201EAn Familien nur Anmeldelinks": to families, sign-in links,\n the access a school hands out, address confirmations (\u201EBewerbung\n begonnen/geparkt" included), security notices about one\'s own account\n (e.g. a changed login address) and the family\'s deadline letters (the\n reminder before a task\'s due day and the letter after it passed).\n - `all` \u2014 \u201EAlle E-Mails": to families additionally admission, family task\n reminders and the school\'s chat messages.\n- Every letter still declares a **category** in code (`login`, `security`,\n `admission`, `tasks`, `deadlines`, `schoolMessages`; for staff the personal `
|
|
6095
|
+
`,"references/notifications/debug-mail-delivery.md":'# Debug a mail delivery\n\n**When:** "no mail arrived", a red `deadLastHour` badge in the platform\nconsole, or a `backend:convex` GlitchTip issue tagged `area=notifications`.\n\n## 1. Is the sweeper alive, and is anything dead?\n\n```bash\nplexus-cli --env staging platform notifications sweeper-status\nplexus-cli --env staging platform notifications list --status dead\n```\n\n`ranAt` older than a few minutes \u21D2 the cron is not firing (deploy broke?).\n`deadLastHour > 0` \u21D2 go to step 3 with an id from the list.\n\n## 2. Find the delivery for a person\n\n```bash\nplexus-cli --env staging platform notifications list --to parent@example.org --since 2d\nplexus-cli --env staging platform notifications list --template account.loginLink --since 24h\n```\n\nFor a sign-in problem start with `platform users login-trail` instead \u2014 see\n[Trace why someone could not sign in](./trace-a-login.md).\n\nStatuses: `queued` (waiting / backoff), `sending` (in flight), `sent` (relay\naccepted \u2014 NOT "in the inbox"), `skipped` (a successful non-send: recipient\ngone, precondition no longer true, reserved TLD \u2014 in `live` every RFC 2606\naddress, in `redirect` only `.invalid`), `dead` (gave up).\n\n## 3. Read the evidence\n\n```bash\nplexus-cli --env staging platform notifications show <deliveryId>\n```\n\n| `errorCode` | Means | Do |\n| --- | --- | --- |\n| `delivery_mode_invalid` / `config_missing` | deployment env is incomplete | needs a platform operator: complete the deployment\'s mail settings, then `retry` |\n| `smtp_auth` | relay rejected the credentials | needs a platform operator: rotate the relay password in the deployment\'s settings, then `retry` |\n| `smtp_policy` | relay rejected OUR sender at `MAIL FROM` | `MAIL_FROM_ADDRESS` not allowed for this account \u2014 ask the mail admin |\n| `smtp_content` with 4xx at `DATA` | milter (DKIM) hiccup \u2014 retried automatically | if it stays: the relay\'s DKIM key/permissions \u2014 ask the mail admin |\n| `smtp_recipient_rejected` | 5xx at `RCPT TO` | the address does not exist \u2014 nothing to retry |\n| `recipient_revoked` / `recipient_changed` / `recipient_deleted` | identity changed after enqueue | expected; re-raise the event if still wanted |\n| `never_claimed` | the dispatch action fails BEFORE it can claim | bundle/import problem \u2014 needs a platform operator (deployment logs of the action), fix, `retry` |\n| `unknown_outcome` | action died after SMTP began | the recipient MAY have received it; decide, then `retry` |\n\n`lastSmtpCommand` / `lastSmtpResponseCode` / `lastSmtpResponse` carry the raw\nrelay line. `possibleDuplicate: true` means attempt N may already have landed.\n\n## 4. Prove the configuration end to end\n\n```bash\nplexus-cli --env staging platform notifications self-test --to <your-address>\n```\n\nVerifies the connection + credentials, sends one mail, returns the SMTP\ntranscript. On staging the mail is redirected like every other; on prod it\nreally goes to `--to`.\n\n## 5. Retry\n\n```bash\nplexus-cli --env staging platform notifications retry <deliveryId>\n```\n\nOnly `dead` rows. It is a fresh attempt through the normal claim path \u2014 the\nretry budget is widened by exactly one.\n\n## Gotchas\n\n- `sent` = accepted by the relay. The last hop (relay \u2192 GMX) is invisible; on\n staging the platform operator reads the catch-all mailbox.\n- A `451` is not always transient: the relay says `451 4.7.1` for a\n sender-policy violation and for a broken DKIM key. Look at the COMMAND.\n- Locally nothing is ever sent (`dry`): the mail is in the Dev Rail \u2192\n `notifications:listDevPreviews`.\n',"references/notifications/mail-level.md":'# Choose which mail a school sends (mail level)\n\n> **Version check first.** A deployment on a release older than the mail level\n> ignores `--field mailLevel` WITHOUT an error and keeps reading the retired\n> `tenant.enabledMailCategories` (`[]` = sign-in only, every category = all).\n> If `config export` shows no `mailLevel`, stop and ask the platform operator.\n> The same skew means a tenant scaffolded with a newer CLI against an older\n> deployment starts at sign-in mail only.\n\n**When to use:** a school wants only the sign-in links for FAMILIES for now\n(\u201EAnmeldelinks ja, alles andere nein"), or is ready for every mail.\n\n**The level is family mail only.**\nLetters to the school\'s own staff (`audience: "internal"`: new tasks, passed\ndeadlines, family messages, mentions) go out at BOTH levels; each staff member\ndecides them in \u201EEinstellungen" (personal categories, runbook \u201EWhich mail a\nstaff member wants"). Do not use the level to quiet staff mail.\n\n**Current stance:** every tenant \u2014 prod, staging and the `test` demo tenant \u2014\nruns `loginOnly` until the platform operator decides otherwise. Switching a real\nschool to `all` is that decision, not a routine step. Only a local full seed\nputs the `test` demo tenant at `all`, so locally every admission, family-task and\nschool-chat letter is rendered (a local deployment sends no mail); the template\nstaging and prod apply stays `loginOnly`. On a local deployment that was not\nseeded that way, set it to `all` yourself (`--env local`). Staff letters render\nat both levels.\n\n## What it is\n\n- A school has ONE setting, its **mail level** (`tenant.mailLevel`, required in\n every tenant config):\n - `loginOnly` \u2014 \u201EAn Familien nur Anmeldelinks": to families, sign-in links,\n the access a school hands out, address confirmations (\u201EBewerbung\n begonnen/geparkt" included), security notices about one\'s own account\n (e.g. a changed login address) and the family\'s deadline letters (the\n reminder before a task\'s due day and the letter after it passed).\n - `all` \u2014 \u201EAlle E-Mails": to families additionally admission, family task\n reminders and the school\'s chat messages.\n- Every letter still declares a **category** in code (`login`, `security`,\n `admission`, `tasks`, `deadlines`, `schoolMessages`; for staff the personal `staffAssigned`, `staffTeamQueue`, `staffFeedback`,\n `staffAppointments`, `staffDeadlines`, `staffWaitlist`, `staffUnassigned`, `familyMessages`,\n `mentions`). It names\n the letter in a skipped delivery\'s reason; a school cannot switch single\n categories.\n- The `notifications` module must be enabled for `all`; with the module off only\n sign-in and security mail go out whatever the level says.\n- Refused by `config set` / `config apply`: a missing or unknown level\n (`[notification/mailLevel]`), `all` without the `notifications` module\n (`[notification/levelWithoutModule]`), and the retired spellings\n `tenant.enabledMailCategories` (`[notification/mailCategoriesRetired]`)\n and `tenant.mailEnabled` (`[notification/mailEnabledRetired]`) \u2014 a scratch\n export from before the mail level must be rewritten, not applied.\n- `MAIL_DELIVERY_MODE` of the deployment stays the outer boundary. Never change\n it for this.\n\n## Set it (dry run first)\n\n```bash\n# sign-in mail only\nplexus-cli --env staging config set --tenant <slug> --target tenant \\\n --key <slug> --field mailLevel --value loginOnly\nplexus-cli --env staging config set --tenant <slug> --target tenant \\\n --key <slug> --field mailLevel --value loginOnly --confirm\n\n# everything (what the introduction of the level wrote for every school that sent mail)\nplexus-cli --env staging config set --tenant <slug> --target tenant \\\n --key <slug> --field mailLevel --value all --confirm\n```\n\nThrough a scratch export instead: `config export` \u2192 set\n`"tenant": { \u2026, "mailLevel": "loginOnly" }` \u2192 `config apply --from snapshot:\u2026`.\n\n## Verify\n\n- `plexus-cli --env <env> config export --tenant <slug>` shows `mailLevel`\n (always emitted; an existing snapshot file is replaced only with `--force`).\n- Platform rail \u2192 **Mandanten** (needs `_platform.config.read`): the column\n \u201EE-Mails" says \u201ENur Anmeldelinks" (amber) or \u201EAlle E-Mails" \u2014 as the send\n path answers it, so module off reads \u201ENur Anmeldelinks" too.\n- Dashboard of the school: banner \u201EHinweis zur Konfiguration" on top of the\n page, gap `mailDisabled` (\u201EDiese Schule versendet nur Anmeldelinks \u2026") \u2014\n unless the school hides that notice: `config set --tenant <slug> --target tenant\n --key <slug> --field hideMailLevelNotice --value true --confirm` (mail-module setting, shown under\n \u201Enotifications" in Platform \u2192 Mandanten; the test tenant does). Only this\n notice goes; a configuration error always shows.\n- A suppressed letter is a row: `plexus-cli --env <env> notifications \u2026` lists it\n `skipped`, `tenant_delivery_disabled`, last error\n `the school\'s mail level does not send "<category>" mail`.\n\n## Gotchas\n\n- A skipped delivery is never re-sent when the level goes back to `all` \u2014 the\n setting decides at enqueue AND at send time, not retroactively.\n- `applicant.accessSent` (\u201EZugang versenden \u2192 Per Mail senden") is `login`: it\n goes out at `loginOnly`.\n',"references/notifications/reword-a-letter.md":`# Reword a letter for one school
|
|
6096
6096
|
|
|
6097
6097
|
**When to use:** a school wants one of the mails Plexus sends in its name to say
|
|
6098
6098
|
something else \u2014 a different opening paragraph, its own sign-off \u2014 and you want
|
|
@@ -10960,8 +10960,8 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
|
|
|
10960
10960
|
## Related
|
|
10961
10961
|
- Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
|
|
10962
10962
|
\`plexus-cli platform imports cleanup-orphaned --help\`.
|
|
10963
|
-
`};var ef="ecadf362903fb0ab816098827c95d93cfa7d2e2a2bb32f9a6f0961baa91be08b",Yg=DR;var Hg=class extends ve{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:ef,tools:hl}),0}},Jg=class extends ve{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await Wg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},FR=[Hg,Jg];var Qg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],dle=new Set(Qg.map(e=>e.key));function MR(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(MR,"resolveStartTarget");function oz(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(oz,"applicantText");function qR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:oz(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(qR,"applicationRows");var LR=Qg.map(e=>e.email);function KR(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(Ug(e,n)&&(r===void 0||!LR.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${LR.join(", ")} (--applicant) \u2014 never a real family's`)}s(KR,"assertStartApplicant");function jR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(jR,"processStoreJson");function sz(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(sz,"refText");function az(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?sz(e.ref):JSON.stringify(e.value)}s(az,"holds");function VR(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:az(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(VR,"storeRows");function nf(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(nf,"parseKv");var BR="started",tf="submitted",rf="submitted",UR="load-scenario:";var GR="(Bewerbung)";function zR(e){return{nodeId:GR,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(zR,"sharedAsList");function WR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(WR,"disabledText");function YR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:WR(r)})))}s(YR,"actionRows");function HR(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: ${WR(a)}`);if(i!==GR)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(HR,"nodeOfferingAction");function JR(e,n,t){if(e.startsWith(UR)){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(JR,"runParams");async function lz(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(lz,"currentNodeIds");function dz(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(dz,"refusalText");async function of(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${dz(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,zR(r.actions)]}s(of,"actionsOf");async function QR(e,n,t){return t!==void 0?[t]:await lz(e,n)}s(QR,"nodesOf");var Zg=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await of(n,this.application,await QR(n,this.application,this.node));return this.print(t,YR,["node","action","label","disabled"]),0}},Xg=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=JR(this.action,this.autoSubmit,nf(this.param??[]).values),t=await this.caller(),r=this.application,i=await QR(t,this.application,this.node),o=HR(await of(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}},ZR=[Zg,Xg];var ze=["de","en"];function Ss(e,n){return ze.every(t=>e[t]===n[t])}s(Ss,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function $i(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s($i,"isLocalizedText");function gl(e,n){let t={};for(let r of ze){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(gl,"composeTexts");var mr=/^[a-z][A-Za-z0-9]*$/;function ey(e){return typeof e=="string"&&mr.test(e)}s(ey,"isNodeId");function As(e,n){ey(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${mr.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(As,"makeNodeId");var Ii="$env";function pe(e){if(e.scope==="env")return`${Ii}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(pe,"formatAddress");var Ri=/^[a-z][a-zA-Z0-9_]*$/,cz=/^[A-Za-z_][A-Za-z0-9_]*$/;function ho(e){return typeof e=="string"&&e.split(".").every(n=>cz.test(n))}s(ho,"isPath");function go(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"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Ri.test(o)||(t==="node"?!mr.test(i):!Ri.test(i))?null:uz({scope:t,owner:i,key:o},a)}default:return null}}s(go,"tryParseAddress");function uz(e,n){if(n.length===0)return e;let t=n.join(".");return ho(t)?{...e,path:t}:null}s(uz,"withPath");function xe(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!ho(n.path))return!1;switch(n.scope){case"env":return ho(n.key);case"node":return typeof n.owner=="string"&&mr.test(n.owner)&&typeof n.key=="string"&&Ri.test(n.key);case"task":return typeof n.owner=="string"&&Ri.test(n.owner)&&typeof n.key=="string"&&Ri.test(n.key);default:return!1}}s(xe,"isAddress");var Yr={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"}},Es=Object.keys(Yr);function Ts(e){return Object.hasOwn(Yr,e)}s(Ts,"isEnvKey");var fz=["self-service","staff"];function XR(e,n){return{kind:"fixed",values:e,labels:n}}s(XR,"fixedSet");var sf={of:"applicant.language",withoutValue:"de"},Hr={"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:sf},"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:sf},"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:sf},"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:sf},"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:XR(ze,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:XR(fz,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},af={types:Yr,fields:Hr},lf=Es.flatMap(e=>Object.keys(Yr[e]).map(n=>`${e}.${n}`));function Ht(e){return Object.hasOwn(Hr,e)}s(Ht,"isEnvLeaf");function df(e){return`${Ii}.${e}`}s(df,"envIdentifier");function yo(e){let n=Hr[e],[t,r]=e.split("."),i=Yr[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(yo,"envLeaf");var eI="staffInput";var pz=["boolean"],yl=/^[a-z][A-Za-z0-9]*$/;function cf(e){return e.staffInputs??[]}s(cf,"staffInputsOf");function uf(e){return`${eI}.${e}`}s(uf,"staffInputLeaf");function nI(e){return`${Ii}.${uf(e)}`}s(nI,"staffInputIdentifier");function mz(e){let n=`${eI}.`;return e.startsWith(n)?e.slice(n.length):null}s(mz,"staffInputKeyOfLeaf");function $s(e,n){let t=mz(n);return t===null?void 0:cf(e).find(r=>r.key===t)}s($s,"declaredStaffInput");function tI(e){return[...cf(e).map(n=>({leaf:uf(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...lf.map(n=>{let t=yo(n);return{leaf:n,type:t.type,label:t.label,valueSet:Hr[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(tI,"envLeavesFor");function rI(e){return tI(e).filter(n=>!n.cohortBound)}s(rI,"conditionEnvLeaves");function iI(e){return sI(rI(e))}s(iI,"envConditionSchemaFor");function hz(e){return tI(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(hz,"offerConditionEnvLeaves");function oI(e){return sI(hz(e))}s(oI,"offerConditionSchemaFor");function sI(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(sI,"schemaOfLeaves");function aI(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}"`};yl.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=Rn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(aI,"staffInputIssues");var cy={required:!0,description:"Offer slug (its offerKey)"},ny=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",cy);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=qR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},ty=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",cy);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}},ry=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},iy=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(jR(t),()=>VR(t),["address","state","holds","producer","written"]),0}},oy=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",cy);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();KR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=MR(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:dI(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 of(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},sy=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=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 ay=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=T.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},ly=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},dy=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=dI([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}},lI=[ny,ty,ry,iy,oy,sy,ay,ly,dy];function dI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!yl.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(dI,"parseStaffInputs");var Vn="contractGenerator",wo="documentTemplate";function wl(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(wl,"isGeneratorRef");function cI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(cI,"literalOf");function Jr(e){let n=cI(e,Vn);return wl(n)?n:null}s(Jr,"generatorRefOfNode");function hr(e){let n=cI(e,wo);return typeof n=="string"&&n.length>0?n:null}s(hr,"documentTemplateKeyOfNode");function uI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(uI,"generatorRefLabel");var yz=["formExports","generatorStamp"];function fI(e,n,t){let r=e.inputs?.[Vn];(r?.kind!=="literal"||!wl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Vn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Vn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts},...n.coverLetter===void 0?{}:{coverLetter:n.coverLetter}}}s(fI,"applyGeneratorStamp");var wz=["reads"];function Rs(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(Rs,"comparableWorkflowGraph");var kl={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 ff(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=kl[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(ff,"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 pI(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(pI,"progressLayoutIssues");var mI=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var bz=new Set(["sections","effects","outcomes","testScenarios","env","views"]),pf={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 hI(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=pf[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(hI,"smartFormDefinitionShapeIssues");var kt=["granted","rejected","waitlisted","other"];function Oi(e){return typeof e=="string"&&kt.includes(e)}s(Oi,"isOutcomeSemantic");var Jt=["arrival","manual"],gI={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 uy(e){let n=vz(e,"waitlistOrder");return Jt.includes(n)?{waitlistOrder:n}:null}s(uy,"waitlistPolicyOrNull");var gn="responsible",fy="team:";function mf(e){return`${fy}${e}`}s(mf,"teamSlot");function hf(e){return e.startsWith(fy)?e.slice(fy.length):null}s(hf,"teamKeyOfSlot");function yI(e){return e.kind==="responsible"?gn:mf(e.groupKey)}s(yI,"slotIdOf");function gf(e){if(e===gn)return{kind:"responsible"};let n=hf(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(gf,"slotOfId");var py="review",my="checkField",wI="reviewed",kI="reviewing",yf=["rejected","waitlisted"];function hy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(hy,"isObject");var xz=new Set(["decision",py]),bI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function gy(e){return Object.hasOwn(bI,e)?bI[e]:void 0}s(gy,"legacySemanticOfId");function Sz(e){return e===py?kt.filter(n=>!yf.includes(n)):kt}s(Sz,"allowedSemanticsFor");var Az="other";function vI(e){return hy(e)&&xz.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(vI,"outcomesOf");function xI(e){return(e?.nodes??[]).some(n=>vI(n).some(t=>hy(t)&&!("semantic"in t)))}s(xI,"needsOutcomeSemantics");function SI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=vI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=Sz(u),h=!1,k=l.map(b=>{if(!hy(b))return b;let y=String(b.id);if("semantic"in b)return Oi(b.semantic)||i.push({nodeId:c,outcomeId:y,value:String(b.semantic)}),b;let v=`${c}.${y}`,A=Object.hasOwn(n,v)?n[v]:void 0;if(A!==void 0)return p.includes(A)?(t.push({nodeId:c,outcomeId:y,semantic:A,source:"answer"}),h=!0,{...b,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p,answer:A}),b);let E=gy(y),R=E??Az;return p.includes(R)?(t.push({nodeId:c,outcomeId:y,semantic:R,source:E===void 0?"formerDefault":"legacyTable"}),h=!0,{...b,semantic:R}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p}),b)});return h?{...d,outcomes:k}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(SI,"addOutcomeSemantics");var gr="bewerbungOffen";function ko(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ko,"isObject");var yy=["event","effect"];function AI(e){return ko(e)&&e.type==="eventTrigger"}s(AI,"isTrigger");function EI(e){let n=ko(e.inputs)?e.inputs:{};return"outcomes"in e||yy.some(t=>t in e||t in n)}s(EI,"oldShape");function TI(e){return(e?.nodes??[]).some(n=>AI(n)&&EI(n))}s(TI,"needsEventTriggerStartMove");function Ez(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>ko(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===gr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(ko(e.next)?e.next:{});if(!(i.length===1&&i[0]===gr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=ko(e.inputs)?{...e.inputs}:{};for(let l of yy){let d=o[l];if(ko(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of yy)delete a[l],delete o[l];return ko(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(Ez,"moveNode");function $I(e){let n=[],t=[],r=e.nodes.map(i=>{if(!AI(i)||!EI(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($I,"moveEventTriggerStart");function bl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(bl,"isObject");var RI={waitlistOrder:"arrival"};function II(e){return!bl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(bl(e.inputs)?e.inputs:{}))}s(II,"lacksPolicy");function Tz(e){return(e?.nodes??[]).some(II)}s(Tz,"needsWaitlistPolicyMove");function wy(e){return bl(e)&&Jt.includes(e.waitlistOrder)}s(wy,"isWaitlistPolicy");function $z(e){if(e===void 0)return{policy:RI,stated:!1};if(!bl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Jt.includes(n)?"malformed":{policy:{waitlistOrder:n??RI.waitlistOrder},stated:n!==void 0}}s($z,"policyOfSelection");function OI(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(!II(l))return l;let d=l,c=String(d.id),u=bl(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,k;if(p!==void 0)h=p,k="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,k=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:k}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(OI,"moveWaitlistPolicyToInputs");function bo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(bo,"isObject");var Rz=[Vn,wo],Iz=["inputSchema","parties","schemaDigest","parts"];function _I(e){return bo(e)&&e.type==="governedDocument"&&("resolver"in e||bo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(_I,"oldShape");function PI(e){return(e?.nodes??[]).some(_I)}s(PI,"needsGeneratorInputMove");function Oz(e){let n=bo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!bo(i))return{unmoved:"resolverNotObject"};if(Vn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((bo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>bo(d)&&Rz.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Vn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(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(bo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(wo in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[wo]={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 NI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!_I(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(NI,"moveGeneratorPinsToInputs");var CI=/^\d{4}-\d{2}-\d{2}$/;function yr(e,n){return{de:e,en:n}}s(yr,"issue");function vo(e){if(typeof e!="object"||e===null)return yr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:yr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return yr(`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?yr("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"||!CI.test(r)?yr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!CI.test(i)?yr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?yr("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)?yr("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))?yr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?yr("unbekannte Angaben","unknown details"):null:yr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(vo,"reductionShapeIssue");function _i(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||vo(n.reduction)===null&&n.reduction.kind==="amount")}s(_i,"isPricedItemValue");var Is=["freetext","recommendation","choice","pricedItem","record","reduction"],Os=[...Is,"appointment"];function FI(e){return typeof e=="string"&&Os.includes(e)}s(FI,"isTaskResultKind");function Pi(e){return typeof e=="string"&&Is.includes(e)}s(Pi,"isRecordedTaskResultKind");function _s(e){return Pi(e.kind)}s(_s,"isRecordedTaskResult");var wf=["number","boolean","enum"];function ky(e){return typeof e=="string"&&wf.includes(e)}s(ky,"isRecordFieldType");var by=["form","siblingRank"];var Qr={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 LI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(LI,"isProseResult");function kf(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&ky(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):_z(e)}s(kf,"draftResultStoreWrites");function _z(e){let n=Qr[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(_z,"singleStoreWrite");var DI="team:";function Ps(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(DI)){let n=e.slice(DI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ps,"parseTaskResultChat");var nn={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]"};var Pz=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===`
|
|
10964
|
-
`||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);Pz.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 MI=1e4,qI=128;function Ns(e){e.depth++,e.depth>qI&&F(`Expression nesting too deep (> ${qI})`)}s(Ns,"enterDepth");function GI(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(GI,"peek");function Bn(e){let n=e.tokens[e.pos];return n||F(`Unexpected end at ${e.pos}`),e.pos++,n}s(Bn,"take");function Un(e,n,t){let r=GI(e);return!(!r||r.t!==n||t!==void 0&&r.v!==t)}s(Un,"match");function xo(e,n,t){return Un(e,n,t)||F(`Expected ${n}${t?`:${t}`:""} at ${e.pos}`),Bn(e)}s(xo,"expect");function Xr(e){Ns(e);try{return Un(e,"kw","if")?Mz(e):qz(e)}finally{e.depth--}}s(Xr,"parseExpr");function Mz(e){xo(e,"kw","if"),xo(e,"punct","(");let n=Xr(e);xo(e,"punct",")");let t=Xr(e);xo(e,"kw","else");let r=Xr(e);return{kind:"if",cond:n,then:t,else:r}}s(Mz,"parseIf");function qz(e){let n=KI(e),t=0;try{for(;Un(e,"op","||");){Bn(e),Ns(e),t++;let r=KI(e);n={kind:"binary",op:"||",left:n,right:r}}}finally{e.depth-=t}return n}s(qz,"parseLogicOr");function KI(e){let n=jI(e),t=0;try{for(;Un(e,"op","&&");){Bn(e),Ns(e),t++;let r=jI(e);n={kind:"binary",op:"&&",left:n,right:r}}}finally{e.depth-=t}return n}s(KI,"parseLogicAnd");function jI(e){let n=VI(e),t=0;try{for(;Un(e,"op","==")||Un(e,"op","!=");){let r=Bn(e).v;Ns(e),t++;let i=VI(e);n={kind:"binary",op:r,left:n,right:i}}}finally{e.depth-=t}return n}s(jI,"parseEquality");function VI(e){let n=xy(e),t=0;try{for(;Un(e,"op","<")||Un(e,"op","<=")||Un(e,"op",">")||Un(e,"op",">=")||Un(e,"kw","in");){let r=Bn(e),i=r.t==="kw"?"in":r.v;Ns(e),t++;let o=xy(e);n={kind:"binary",op:i,left:n,right:o}}}finally{e.depth-=t}return n}s(VI,"parseCompare");function xy(e){if(Un(e,"op","!")){Bn(e),Ns(e);try{return{kind:"unary",op:"!",operand:xy(e)}}finally{e.depth--}}return Kz(e)}s(xy,"parseUnary");function Kz(e){let n=GI(e);if(n||F("Unexpected end"),n.t==="num")return Bn(e),{kind:"num",value:n.v};if(n.t==="str")return Bn(e),{kind:"str",value:n.v};if(n.t==="kw"&&n.v==="true")return Bn(e),{kind:"bool",value:!0};if(n.t==="kw"&&n.v==="false")return Bn(e),{kind:"bool",value:!1};if(n.t==="kw"&&n.v==="null")return Bn(e),{kind:"null"};if(n.t==="punct"&&n.v==="("){Bn(e);let t=Xr(e);return xo(e,"punct",")"),t}if(n.t==="punct"&&n.v==="["){Bn(e);let t=[];if(!Un(e,"punct","]"))for(t.push(Xr(e));Un(e,"punct",",");)Bn(e),t.push(Xr(e));return xo(e,"punct","]"),{kind:"arr",items:t}}if(n.t==="ident"){let t=n.v;if(Bn(e),Un(e,"punct","(")){Bn(e);let r=[];if(!Un(e,"punct",")"))for(r.push(Xr(e));Un(e,"punct",",");)Bn(e),r.push(Xr(e));return xo(e,"punct",")"),{kind:"call",name:t,args:r}}return{kind:"ident",path:t}}F(`Unexpected token at ${e.pos}`)}s(Kz,"parsePrimary");function In(e){e.length>MI&&F(`Expression too long (${e.length} > ${MI})`);let n={tokens:Lz(e),pos:0,depth:0},t=Xr(n);return n.pos<n.tokens.length&&F(`Unexpected trailing token at ${n.pos}`),t}s(In,"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 yn(e,n){switch(e.kind){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"null":return null;case"ident":{let t=Object.hasOwn(n.values,e.path)?n.values[e.path]:void 0;return t===void 0?null:t}case"arr":return e.items.map(t=>yn(t,n));case"unary":{let t=yn(e.operand,n);return!So(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=>yn(i,n));return t(...r)}case"binary":return Vz(e.op,e.left,e.right,n);case"if":return So(yn(e.cond,n))?yn(e.then,n):yn(e.else,n)}}s(yn,"evaluate");function Vz(e,n,t,r){if(e==="&&"){let a=yn(n,r);return So(a)?So(yn(t,r)):!1}if(e==="||"){let a=yn(n,r);return So(a)?!0:So(yn(t,r))}let i=yn(n,r),o=yn(t,r);switch(e){case"==":return vy(i,o);case"!=":return!vy(i,o);case"<":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>vy(a,i)):!1}}s(Vz,"evalBinary");function bf(e,n){return[BI(e),BI(n)]}s(bf,"orderedOperands");function BI(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(BI,"numericOperand");function vy(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(vy,"looseEq");function So(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(So,"truthy");function On(e){let n=new Set;return Zr(e,n),[...n]}s(On,"dependencies");function Zr(e,n){switch(e.kind){case"ident":n.add(e.path);return;case"call":e.args.forEach(t=>Zr(t,n));return;case"arr":e.items.forEach(t=>Zr(t,n));return;case"unary":Zr(e.operand,n);return;case"binary":Zr(e.left,n),Zr(e.right,n);return;case"if":Zr(e.cond,n),Zr(e.then,n),Zr(e.else,n);return;default:return}}s(Zr,"walk");var UI=new Map;function ei(e){let n=UI.get(e);return n||(n=In(e),UI.set(e,n)),n}s(ei,"parseCached");function Bz(e,n){return yn(ei(e),n)}s(Bz,"evalExpression");function zI(e,n){return So(Bz(e,n))}s(zI,"evalBoolean");function WI(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(WI,"assertNoCustomNodeExports");var Sy=null;function YI(e){for(let[n,t]of Object.entries(e))WI(n,t);Sy=e}s(YI,"setSpecs");function HI(){return Sy||F("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),Sy}s(HI,"requireSpecs");function Ye(e){let n=HI(),t=n[e.type];return t===void 0&&ae("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(Ye,"specFor");function JI(){return Object.keys(HI()).sort()}s(JI,"registeredNodeTypes");var QI=lf.filter(e=>Hr[e].cohortBound!==!0);function Ay(e){return Ht(e)&&Hr[e].cohortBound!==!0}s(Ay,"isEnvAddressLeaf");function Ey(e){return yo(e).type}s(Ey,"envType");function Ty(e){return yo(e).label}s(Ty,"envLabel");function $y(e){if(e.scope==="env"||e.path===void 0)return e;switch(e.scope){case"node":return{scope:"node",owner:e.owner,key:e.key};case"task":return{scope:"task",owner:e.owner,key:e.key}}}s($y,"addressBase");function wr(e){return e.scope==="node"&&e.key===nt&&e.path===void 0}s(wr,"isInstanceAddress");function un(e){return xe(e)&&e.scope==="node"&&e.key===nt&&e.path!==void 0}s(un,"isFormFieldAddress");function ZI(e){return un(e)?{owner:e.owner,path:e.path}:null}s(ZI,"formFieldOf");function Uz(e){return On(ei(e)).map(n=>{if(!n.startsWith("$"))return{identifier:n,address:null,reason:"bareIdentifier"};let t=go(n);return t===null?{identifier:n,address:null,reason:"shape"}:{identifier:n,address:t}})}s(Uz,"expressionAddresses");var nt="admission",vl="document",Cs="contract",Ds="contracts",XI="payment",Ry=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var lt={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"},wce={join:{...lt},end:{...lt},eventTrigger:{...lt},form:{...lt,adoptForm:"address",formExports:"stamp"},roleAssign:{...lt},setFlag:{...lt},if:{...lt,condition:"address"},countersign:{...lt,contract:"address",titles:"display",signing:"config"},engagePush:{...lt,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...lt,commentRequired:"config",decisionAsTask:"config",reads:"address",formView:"config",requiresOneOf:"config"},review:{...lt,form:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...lt},completenessCheck:{...lt,requires:"address",deadline:"config"},collectPayment:{...lt},governedDocument:{...lt,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 Ni(e){return Array.isArray(e)?e:[]}s(Ni,"listOf");function Nt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(Nt,"record");function eO(e){switch(e.type){case"countersign":return["contract"];case"engagePush":return["form","contract","payment"];case"governedDocument":return e.production==="resolver"?["form"]:[];case"review":return["form"];default:return[]}}s(eO,"dataSourceFieldsOf");function nO(e){return e.type==="review"?[]:e.type==="engagePush"?["form"]:eO(e)}s(nO,"requiredDataSourceFields");var Gz={setFlag:{target:"setFlagTarget"}};function xl(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?[]:(Ye(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=Gz[e.type]??{};for(let[d,c]of Object.entries(Nt(r.inputs)??{})){let u=Nt(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 k=a.get(d);o("binding",`${i}.inputs.${d}`,p,k!==void 0?{expectedType:k}:{})}for(let[d,c]of Ni(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of Ni(r.requires).entries())o("requires",`${i}.requires.${d}`,c,{judgedTogether:`${i}.requires`});e.type==="form"&&r.adoptForm!==void 0&&o("adoptForm",`${i}.adoptForm`,r.adoptForm);for(let d of eO(e))r[d]!==void 0&&o(d,`${i}.${d}`,r[d]);e.type==="if"&&r.condition!==void 0&&o("condition",`${i}.condition`,r.condition);for(let[d,c]of Ni(r.tasks).entries())t.push(...tO(e.id,c,d));for(let[d,c]of Ni(r.optionalActions).entries()){let u=Nt(c);u?.when!==void 0&&o("optionalActionWhen",zz(e.id,typeof u.key=="string"?u.key:String(d)),u.when)}return t}s(xl,"nodeAddressFields");function zz(e,n){return`nodes.${e}.optionalActions.${n}.when`}s(zz,"optionalActionWhenPath");function tO(e,n,t){let r=Nt(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,k,b={})=>{i.push({kind:p,at:h,nodeId:e,taskKey:o,value:k,judgedTogether:null,...b})},"field"),d=`${a}.evidence`;r.when!==void 0&&l("taskWhen",`${a}.when`,r.when,{expectedType:"boolean",judgedTogether:d});for(let[p,h]of Ni(r.reads).entries())l("taskReads",`${a}.reads.${p}`,h,{judgedTogether:d});for(let[p,h]of Ni(r.documents).entries()){let k=Nt(h);k===null||k.kind==="artifact"||l("taskDocument",`${a}.documents.${p}`,"address"in k?k.address:k.key)}let c=Nt(r.familyRequest);if(c!==null){for(let[p,h]of Ni(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=Nt(r.result);if(u?.kind==="record")for(let[p,h]of Ni(u.fields).entries()){let k=Nt(Nt(h)?.suggest);if(k?.kind!=="form")continue;let b=Nt(h)?.type;l("suggest",`${a}.result.fields.${p}.suggest`,"address"in k?k.address:k.key,typeof b=="string"?{expectedType:b}:{})}return i}s(tO,"taskAddressFields");function Fs(e){return Iy(e)?(Oy(e.value)??[]).flatMap(n=>n.address===null?[]:[n.address]):xe(e.value)?[e.value]:[]}s(Fs,"addressesInField");function Iy(e){return e.kind==="condition"||e.kind==="optionalActionWhen"}s(Iy,"isExpressionField");function Oy(e){if(typeof e!="string"||e.trim().length===0)return null;try{ei(e)}catch{return null}return Uz(e)}s(Oy,"conditionAddresses");function bt(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(bt,"adoptsForm");function rO(e){if(e.type!=="form"||bt({type:e.type,adoptForm:e.adoptForm}))return;let n=e.inputs?.smartForm;return n?.kind==="literal"&&typeof n.value=="string"&&n.value!==""?n.value:void 0}s(rO,"createdSmartFormSlug");function Wz(e,n){return e.type!=="governedDocument"||e.production!=="resolver"||n!==vl?n:e.generatorStamp?.parts!==void 0?Ds:Cs}s(Wz,"addressKeyOfPort");function iO(e){let n=e.result;return n===void 0||!_s(n)?[]:kf(n).map(t=>t.key)}s(iO,"storeWritesOf");function _y(e,n){return(Array.isArray(e.processStore)?e.processStore:[]).find(t=>t.key===n)}s(_y,"declaredKey");function Cr(e,n){let t=[];if(!bt(n))for(let r of Ye(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 iO(r)){let o=_y(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(Cr,"producedAddresses");function oO(e,n,t){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===n&&iO(i).includes(t))return{nodeId:r.id,template:i};return null}s(oO,"taskWriter");function ni(e,n,t){return oO(e,n,t)?.nodeId??null}s(ni,"taskOwnerNode");function Yz(e){return xl(e,{slotTypes:!1}).flatMap(n=>Fs(n).map(t=>({address:t,field:n})))}s(Yz,"writtenAddressesOf");function Ao(e,n){let t=[],r=new Set,i=s((a,l,d,c)=>{let u=`${pe(a)}|${l}|${d.at}|${c===void 0?"":pe(c)}`;r.has(u)||(r.add(u),t.push({address:a,origin:l,field:d,...c!==void 0?{via:c}:{}}))},"push"),o=s((a,l)=>{if(a.scope!=="task")return;let d=oO(e,a.owner,a.key);if(d!==null){for(let c of tO(d.nodeId,d.template))if(!(c.kind!=="taskWhen"&&c.kind!=="taskReads"))for(let u of Fs(c))i(u,"evidence",l,a)}},"carried");for(let{address:a,field:l}of Yz(n))i(a,"written",l),o(a,l);return t}s(Ao,"addressReadsOf");function Py(e,n){switch(n.scope){case"env":return Ht(n.key)?Ey(n.key):$s(e,n.key)?.type;case"task":return n.path!==void 0||ni(e,n.owner,n.key)===null?void 0:_y(e,n.key)?.type;case"node":{let t=e.nodes.find(i=>i.id===n.owner);if(t===void 0)return;let r=Cr(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(Py,"addressType");function vf(e,n){let t=Nt(e)?.[n];return typeof t=="string"&&t.length>0?t:void 0}s(vf,"labelText");function _e(e,n,t){let r=e.nodes.find(i=>i.id===n);return vf(r?.label,t)??n}s(_e,"nodeDisplayName");function Eo(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 vf(i.title,t)??n}return n}s(Eo,"taskDisplayName");function je(e,n,t){let r=[];switch(n.scope){case"env":r.push(Ht(n.key)?Ty(n.key)[t]:$s(e,n.key)?.label[t]??n.key);break;case"task":r.push(Eo(e,n.owner,t),vf(_y(e,n.key)?.label,t)??n.key);break;case"node":{r.push(_e(e,n.owner,t));let i=e.nodes.find(a=>a.id===n.owner),o=i===void 0?void 0:Cr(e,i).find(a=>a.address.scope==="node"&&a.address.key===n.key);r.push(vf(o?.label,t)??n.key);break}}return n.scope!=="env"&&n.path!==void 0&&r.push(n.path),`${r.join(" \u203A ")} (${pe(n)})`}s(je,"displayAddress");var Sl=["beneficiary","signers"];function sO(e,n){return Array.isArray(e.artifacts)&&e.artifacts.some(t=>t?.key===n)}s(sO,"ownsSlot");function Al(e){let n=[];for(let[t,r]of Object.entries(Nt(e.inputs)??{})){let i=Nt(r);i?.kind==="binding"&&xe(i.address)&&n.push({slot:t,address:i.address})}return n}s(Al,"bindingAddresses");function aO(e,n){return Al(e).find(t=>t.slot===n)?.address??null}s(aO,"bindingAddressAt");function lO(e,n){let t=s(i=>i.scope==="node"&&i.owner===n||i.scope==="task"&&ni(e,i.owner,i.key)===n,"names");return e.nodes.filter(i=>i.id!==n).flatMap(i=>xl(i,{slotTypes:!1})).flatMap(i=>Fs(i).filter(t).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(lO,"addressesNaming");var _n={target:"target",flagKey:"flagKey",value:"value"};function Hz(e){return aO(e,_n.target)}s(Hz,"setFlagTarget");function dO(e){let n=Hz(e);return n!==null&&wr(n)?n.owner:null}s(dO,"setFlagTargetOwner");function xf(e){let n=e.inputs?.[_n.flagKey];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(xf,"setFlagKey");function cO(e){let n=e.inputs?.[_n.value];if(n===void 0||n.kind==="unset")return!0;if(n.kind==="literal"&&typeof n.value=="boolean")return n.value;F(`[setFlag/valueType] setFlag node "${String(e.id)}": \`${_n.value}\` is no yes/no literal \u2014 publish refuses that`)}s(cO,"setFlagValue");function uO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(uO,"isObject");var fO=["target","flagKey","value"];function pO(e){return uO(e)&&e.type==="setFlag"&&fO.some(n=>n in e)}s(pO,"oldShape");function mO(e){return(e?.nodes??[]).some(pO)}s(mO,"needsSetFlagInputMove");function Jz(e){let n=uO(e.inputs)?{...e.inputs}:{};if(fO.some(a=>a in e&&_n[a]in n))return{unmoved:"inputExists"};if("target"in e&&!xe(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(Jz,"moveNode");function hO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!pO(i))return i;let o=Jz(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(hO,"moveSetFlagConfigToInputs");function gO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(gO,"isObject");var Ny={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},Cy={review:["allowSkipInTest"]};function yO(e){return Ny[String(e)]??{}}s(yO,"movesOf");function wO(e){return Cy[String(e)]??[]}s(wO,"deadOf");function kO(e){return gO(e)&&[...Object.keys(yO(e.type)),...wO(e.type)].some(n=>n in e)}s(kO,"oldShape");function bO(e){return(e?.nodes??[]).some(kO)}s(bO,"needsScalarInputMove");function Qz(e,n){return n==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===n}s(Qz,"wellTyped");function Zz(e){let n=gO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(yO(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==="")&&!Qz(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 wO(e.type))delete t[r];return t.inputs=n,{node:t}}s(Zz,"moveNode");function vO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!kO(i))return i;let o=Zz(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(vO,"moveScalarConfigToInputs");var Ls={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 Sf(e){return typeof e=="string"&&Object.hasOwn(Ls,e)}s(Sf,"isResourceType");var Nce=Object.keys(Ls).filter(e=>Ls[e].existence.check==="generic");function xO(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||vo(n.reduction)===null&&n.reduction.kind==="amount")&&Object.keys(n).every(t=>t==="groupKey"||t==="grantKeys"||t==="reduction")}s(xO,"isPricedGroupValue");var Dy=["street","hausnr","plz","ort","land"];function SO(e){return Dy.includes(e)}s(SO,"isAddressPart");var Xz=["municipality","municipalityKey","district","districtKey"],Fy=[...Dy,...Xz],Ly={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"},Ms=Object.keys(Ly);function Ci(e){return typeof e=="string"&&e in Ly}s(Ci,"isValueType");function vt(e){return e===void 0?void 0:Ly[e]}s(vt,"dataTypeOf");function Af(e,n){let t=vt(e),r=vt(n);return t!==void 0&&t===r}s(Af,"valueTypesCompatible");function Ef(e){return e===null?"null is not a text in both languages":El(e,{type:"localizedText"})}s(Ef,"completeLocalizedTextIssue");function El(e,n){if(Sf(n.type)&&!Ci(n.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${n.type} key`;let t=vt(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 xO(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 wl(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=vo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(El,"literalTypeIssue");function AO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(AO,"isObject");var eW={collectPayment:{reason:"reason"}},nW={governedDocument:["mockAutoProduce"]},EO={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 My(e){return eW[String(e)]??{}}s(My,"movesOf");function TO(e){return nW[String(e)]??[]}s(TO,"deadOf");function $O(e){return AO(e)&&[...Object.keys(My(e.type)),...TO(e.type)].some(n=>n in e)}s($O,"oldShape");function RO(e){return(e?.nodes??[]).some($O)}s(RO,"needsNodeConfigInputMove");function tW(e){return Ef(e)===null}s(tW,"isCompleteText");function rW(e){let n=AO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(My(e.type)))if(r in e){if(i in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!tW(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 TO(e.type))delete t[r];return Object.keys(My(e.type)).some(r=>r in e)&&(t.inputs=n),{node:t}}s(rW,"moveNode");function IO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!$O(i))return i;let o=rW(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(IO,"moveNodeConfigToInputs");var Tl="collectPayment",qs=["online","manual"];function Tf(e){return qs.includes(e)}s(Tf,"isCollectPaymentMode");var To="paid",qy="skipPayment",Ky="confirmPayment",Di="article",tt="mode",Fi="reason",Qt="payee",jy=["one_time"];function $f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s($f,"isObject");function OO(e){if(!$f(e)||e.type!==Tl)return!1;let n=$f(e.inputs)?e.inputs:{},t=n[tt];return!$f(t)||t.kind!=="literal"||t.value!=="online"?!1:!(Qt in n)}s(OO,"isOnlinePaymentWithoutPayee");function _O(e){return(e?.nodes??[]).some(OO)}s(_O,"needsPayee");function PO(e,n={}){let t=[],r=[],i=e.nodes.map(o=>{if(!OO(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=$f(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(PO,"setPayeeOnOnlinePayments");var NO="settlement",iW={online:"online",separate:"manual"};function Vy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Vy,"isObject");function CO(e){return Vy(e)&&e.type===Tl&&Vy(e.inputs)&&NO in e.inputs}s(CO,"carriesSettlement");function DO(e){return(e?.nodes??[]).some(CO)}s(DO,"needsPaymentModeRename");function FO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!CO(i))return i;let o=String(i.id),{[NO]:a,...l}=i.inputs;if(tt in l)return t.push({nodeId:o,reason:"bothCells"}),i;let d=Vy(a)&&a.kind==="literal"&&typeof a.value=="string"?iW[a.value]:void 0;return d===void 0?(t.push({nodeId:o,reason:"unknownValue"}),i):(n.push(o),{...i,inputs:{...l,[tt]:{...a,value:d}}})});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(FO,"renameSettlementToMode");function Rf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Rf,"isObject");function By(e){return Rf(e)&&Rf(e.assign)&&"userId"in e.assign}s(By,"namesUser");function If(e){return(e?.nodes??[]).flatMap(n=>Rf(n)&&Array.isArray(n.tasks)?n.tasks.filter(By).map(t=>({nodeId:String(n.id),taskKey:String(t.key),hasTeam:typeof t.assign.group=="string"&&t.assign.group.length>0})):[])}s(If,"taskUserAssignments");function LO(e){let n=If(e);if(n.length===0)return{graph:e,dropped:n};let t=e.nodes.map(r=>{if(!Rf(r)||!Array.isArray(r.tasks)||!r.tasks.some(By))return r;let i=r.tasks.map(o=>{if(!By(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(LO,"dropTaskAssignUserIds");var Ks={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"actionTeams{}":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Knoten-Aktion ausf\xFChren darf",en:"team that may perform the node action"},consequence:{de:"au\xDFer der zust\xE4ndigen Person darf niemand die Aktion ausf\xFChren",en:"nobody but the responsible person may perform the action"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"tasks[].result.primaryHostTeams":{kind:"team",codec:"key",involves:!1,required:!1,list:!0,what:{de:"Team oben in der Gastgeber-Auswahl",en:"team listed first in the host picker"},consequence:{de:"die Gastgeber-Auswahl kann das Team nicht oben zeigen",en:"the host picker cannot list the team first"}},"optionalActions[].trigger":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Aktion ausl\xF6sen darf",en:"team that may trigger the action"},consequence:{de:"niemand au\xDFer der Prozessverantwortung kann die Aktion ausl\xF6sen",en:"nobody but the process owner can trigger the action"}}},Uy=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function Gy(e,n){if(typeof n!="string"||n.length===0)return null;if(e==="key")return n;let t=Ps(n);return t?.kind==="team"?t.groupKey:null}s(Gy,"decodeKey");var MO={"assign{}":"assign","actionTeams{}":"actionTeams"},oW=s(e=>e in MO,"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 Of(e){let n=[],t=e;for(let[r,i]of Object.entries(MO))for(let[o,a]of Object.entries(Uy(t[i])??{}))n.push({path:`${i}.${o}`,leaf:r,owner:o,key:Gy("key",a),missing:typeof a!="string"||a.length===0});for(let r of Object.keys(Ks)){if(oW(r))continue;let i=Ks[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=`${o}.${c.key}${a===null?"":`.${a}`}.${l}`;if(i.list===!0){if(!Array.isArray(p)){n.push({path:h,leaf:r,owner:c.key,key:null,missing:!0});continue}let b=c.key;p.forEach((y,v)=>{n.push({path:`${h}.${v}`,leaf:r,owner:b,index:v,key:Gy(i.codec,y),missing:typeof y!="string"||y.length===0})});continue}let k=typeof p!="string"||p.length===0;n.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:Gy(i.codec,p),missing:k})}}return n}s(Of,"nodeResourceReferences");var qO=s(e=>(e??[]).map(n=>`\u201E${n}\u201C`).join(", "),"list"),KO=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 (${qO(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 (${KO(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 (${qO(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 (${KO(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 js(e,n,t){let{problem:r,remedy:i}=aW[e][t](n);return`[${e}] ${r} ${i}`}s(js,"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 zy(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(zy,"successorsOf");function _f(e,n,t){if(n===t)return!0;let r=zy(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 jO(e,n,t){if(n===t)return!0;let r=zy(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(jO,"reaches");function VO(e,n,t,r){let i=new Map(e.nodes.map(d=>[d.id,d])),o=zy(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(VO,"reachedAvoiding");function Wy(e,n){let t=[],r=s(i=>({address:i.address,type:i.type,...i.label!==void 0?{label:i.label}:{},nodeId:i.nodeId}),"toVisible");for(let i of e.nodes)if(_f(e,i.id,n))for(let o of Cr(e,i))t.push(r(o));for(let i of QI)t.push({address:{scope:"env",key:i},type:Ey(i),label:Ty(i),nodeId:null});for(let i of cf(e))t.push({address:{scope:"env",key:uf(i.key)},type:i.type,label:i.label,nodeId:null});return t}s(Wy,"visibleAddressesAt");function ti(e,n){let t=e?.readinessFormFieldsByFormNode?.get(n.owner);if(t!==void 0)return t.get(n.path)??null}s(ti,"formFieldEntryOf");var BO={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"}},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${Eo(e,n.taskKey,t)}\u201C`);let i=n.kind==="binding"?` \u201E${n.at.split(".").pop()}\u201C`:"";return r.push(`${BO[n.kind][t]}${i}`),r.join(" \u203A ")}s(dW,"addressFieldWhere");function $l(e,n,t){let r=dW(e,n,t);return`\u201E${_e(e,n.nodeId,t)}\u201C \u203A ${r}`}s($l,"whereOf");function UO(e,n,t){if(n.scope==="node")return _e(e,n.owner,t);if(n.scope==="task")return Eo(e,n.owner,t)}s(UO,"producerName");function GO(e,n){let t=[],r=new Set,i=s((l,d,c)=>{let u={de:js(l,c("de"),"de"),en:js(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=>xl(l))];for(let l of a){let d=s(c=>$l(e,l,c),"where");for(let c of cW(e,l,i))fW(e,l,c,i)&&(mW(e,l,c,n,i),Ry.has(l.kind)&&!gW(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:je(e,c,u)})))}return yW(e,i),wW(e,a,i),xW(e,i),AW(e,i),t}s(GO,"checkAddresses");function cW(e,n,t){let r=s(i=>$l(e,n,i),"where");if(Iy(n)){let i=Oy(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 Fs(n)}return typeof n.value=="string"?(t("address/bareIdentifier",n.at,i=>({where:r(i),address:n.value})),[]):xe(n.value)?[n.value]:(t("address/shape",n.at,i=>({where:r(i),address:JSON.stringify(n.value)??"undefined"})),[])}s(cW,"checkFieldShape");function zO(e,n,t,r){let i=UO(e,t,r);return{where:$l(e,n,r),address:je(e,t,r),...i!==void 0?{producer:i}:{}}}s(zO,"addressParams");function uW(e,n,t){return Ay(n)||t==="optionalActionWhen"&&($s(e,n)!==void 0||Ht(n))?null:$s(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=>zO(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"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===t.owner))?(e.processStore??[]).some(a=>a.key===t.key)?ni(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):Cr(e,o).some(a=>a.address.scope==="node"&&a.address.key===t.key)?!0:(r(Ry.has(n.kind)&&bt(o)?"address/notFormInstance":"address/unknownKey",n.at,i),!1)}}}s(fW,"resolves");function pW(e,n){return e===void 0||n===void 0||vt(n)===void 0?!0:vt(e)!==void 0&&Af(e,n)}s(pW,"addressTypeFits");function mW(e,n,t,r,i){let o=s(l=>zO(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=Py(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(Py(e,t)!==void 0)return!0;if(t.key!==nt)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(!wr(n))return!1;let t=e.get(n.owner);return t!==void 0&&t.type==="form"&&!bt(t)}s(gW,"isCreatingFormInstance");function yW(e,n){for(let t of e.nodes){let r=new Set(xl(t).map(i=>i.kind));for(let i of nO(t))r.has(i)||n("address/missing",`nodes.${t.id}.${i}`,o=>({where:`\u201E${_e(e,t.id,o)}\u201C \u203A ${BO[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 Fs(i)){if(o.scope!=="node"||o.key!==nt)continue;let a=r.get(i.judgedTogether)??[];a.push({field:i,owner:o.owner}),r.set(i.judgedTogether,a)}for(let[i,o]of r){let a=[...new Set(o.map(l=>l.owner))];a.length<2||t("address/mixedForms",i,l=>({where:$l(e,o[0].field,l),names:a.map(d=>_e(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&&jO(e,n,t)}s(bW,"precedesOnSomePath");function vW(e,n,t,r){let i=$y(t.address);return r.has(pe(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=Ao(e,t);if(r.length===0)continue;let i=new Set(Wy(e,t.id).map(o=>pe(o.address)));for(let o of r){let a=$y(o.address);if(vW(e,t,o,i))continue;let l=a.scope==="task"?ni(e,a.owner,a.key):a.scope==="node"?a.owner:null;n("address/notVisible",o.field.at,d=>({where:$l(e,o.field,d),address:je(e,o.address,d),producer:UO(e,a,d)??je(e,a,d),...l!==null?{producerNode:_e(e,l,d)}:{},reader:_e(e,t.id,d)}))}}}s(xW,"checkVisibility");function SW(e,n){if(n.scope==="env")return Ay(n.key);let t=pe(n);return e.nodes.some(r=>Cr(e,r).some(i=>pe(i.address)===t))}s(SW,"producedSomewhere");function AW(e,n){let t=new Map;for(let r of e.nodes){let i=new Set(Cr(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"||!Ri.test(l)){n("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${_e(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=t.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),t.set(l,d)}}for(let[r,i]of t)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)n("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${_e(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${Eo(e,r,a)}\u201C`,names:i.map(l=>_e(e,l.nodeId,a))}))}s(AW,"checkTaskKeys");function Pf(e,n){return e.label[n]??""}s(Pf,"wordingIn");function Li(e,n){let t=WO(e,n),r=Pf(e.qualifier,n);return t===""||r===""&&Pf(e.qualifier,"de")!==""?"":r===""?t:`${r} \xB7 ${t}`}s(Li,"fieldLabelIn");function WO(e,n){return Pf(e,n)}s(WO,"fieldOwnLabelIn");function Vs(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(Vs,"catalogField");function Bs(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(Bs,"catalogFieldRefusal");function Nf(e,n){let t=e.buses.find(r=>r.key===n);return t||F(`[progress] layout '${e.id}' has no bus '${n}'`),t}s(Nf,"progressBus");function Rl(e,n){return e.states.some(t=>t.id===n)}s(Rl,"isBusState");function YO(e,n){let t=e.terminalSemantics?.[n];return t||F(`[progress] no terminal semantics for state '${n}' on bus '${e.key}'`),t}s(YO,"terminalSemantics");function Cf(e,n){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,n)}s(Cf,"hasTerminalSemantics");function EW(e,n){return(e.boards??[]).find(t=>t.audience===n||t.audience==="both")??null}s(EW,"boardForAudience");function HO(e){return EW(Nf(e,"process"),"internal")}s(HO,"internalProcessBoard");function Us(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(Us,"resolveProgressEvent");var Gs={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},ri=Object.keys(Gs);function $o(e){return Object.hasOwn(Gs,e)}s($o,"isEndNodeOutcome");var Yy={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"],Nue=m.union(...Mi.map(e=>m.literal(e)));function Df(e){return typeof e=="string"&&Mi.includes(e)}s(Df,"isApplicationDataDecision");function Ln(e){return Object.keys(e)}s(Ln,"progressEventsOf");var te=s((e,n)=>({de:e,en:n}),"lt"),Ze=s((e,n,t,r,i=null,o=null)=>({chipLabel:e,tone:n,nextAction:i,affordance:o,title:t,body:r}),"ex"),JO={key:"eingeschrieben",label:te("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},Ff={key:"abgesagt",label:te("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},QO={key:"abgelehnt",label:te("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var ZO={enrolled:{label:te("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:JO,external:Ze(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:Ff,external:Ze(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."))}},XO={role:"effect",effect:"pure",progressDefaults:ZO,progressEvents:Ln(ZO),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:ri.map(e=>({value:e,label:Yy[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")},zs=s((e,n,t,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${n}`,reason:{de:t,en:r},severity:"error"}),"nodeIssue");function Ro(e){let n=e.inputs?.applicationOutcome;return n?.kind==="literal"&&n.value!=null?String(n.value):null}s(Ro,"literalOutcome");function TW(e){if(e.type!=="end")return[];let n=e.inputs?.applicationOutcome;if(n===void 0||n.kind==="unset")return[];let t=Ro(e);return t===null?[zs(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`)]:$o(t)?[]:[zs(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${t}' ist kein Ausgang eines Endknotens (${ri.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 (${ri.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?[zs(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)`)]:Df(n.value)?[]:[zs(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=Ro(e);if(n===null||!$o(n)||n==="approved")return[];let t=e.inputs?.dataDecision;if(t?.kind!=="literal"||t.value!=="commit")return[];let r=Yy[n];return[{...zs(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 e_(e,n){if(!n?.layout||!n.wiring)return[];let t=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=Ro(r);if(i===null||!$o(i))continue;let o=Gs[i],a=Us(n.wiring,r,o);if(a===null)continue;let l=n.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Cf(l,a.state))continue;let d=YO(l,a.state).outcome;d!==i&&t.push(zs(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(e_,"checkEndOutcomeMatchesTerminal");function Ws(e){let n=Ye(e);return typeof n.inputs=="function"?n.inputs(e):[]}s(Ws,"inputSlots");function IW(e,n){return Ws(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"&&xe(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 n_(e){return Ws(e).filter(n=>OW(e,n.id).source==="missing")}s(n_,"missingRequiredInputs");var _W=["personRef","formRef","documentRef","docRef"];function PW(e){let n=Ye(e);return typeof n.inputs!="function"?[]:n.inputs(e).map(t=>({id:t.id,type:t.type}))}s(PW,"listInputs");function t_(e){let n=[];for(let t of e.nodes)for(let r of PW(t))!_W.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(t_,"findParamValueRefSlotErrors");function r_(e){let n=[];for(let t of e.nodes){let r=Ye(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(r_,"findInspectorKindErrors");function i_(e){let n=[];for(let t of e.nodes)for(let r of n_(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(i_,"findMissingRequiredInputs");function Lf(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(Lf,"processStoreKeys");function o_(e){let n=[];for(let t of e.tasks??[]){let r=t.result;if(!(r===void 0||!_s(r)))for(let i of kf(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(o_,"storeWritersOn");function s_(e){let n=new Map;for(let t of e.nodes)for(let r of o_(t)){let i=n.get(r.key)??[];i.push(r),n.set(r.key,i)}return n}s(s_,"processStoreWriters");function NW(e,n,t){for(let r of e.nodes){let i=o_(r).find(o=>o.taskKey===n&&o.key===t);if(i!==void 0)return i}return null}s(NW,"writerAt");function CW(e,n,t){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${t}: ${pe(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(CW,"sourceOfAddress");function a_(e,n){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${pe(n)} is no store address`);let t=Lf(e).find(r=>r.key===n.key);return t===void 0&&F(`[address/unknownKey] ${pe(n)}: "${n.key}" is not declared in processStore`),{key:t.key,type:t.type,label:t.label,audience:t.audience,source:CW(e,n,pe(n))}}s(a_,"processLeafOf");var Hy=new Set(["enum","pricedItem","number","boolean","reduction"]),dt={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function ct(e,n,t,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${n} ${t}`,en:`${n} ${r}`},severity:"error"}}s(ct,"err");function d_(e){let n=[],t=Lf(e),r=new Map(t.map(l=>[l.key,l])),i=new Set;for(let[l,d]of t.entries()){let c=`processStore[${l}]`;if(typeof d.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(d.key)){n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(d.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(d.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}i.has(d.key)&&n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" ist doppelt deklariert.`,`Process key "${d.key}" is declared twice.`)),i.add(d.key),Hy.has(d.type)||n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" hat den Typ "${d.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...Hy].join(", ")}.`,`Process key "${d.key}" has the type "${d.type}" \u2014 the process only stores results with a value: ${[...Hy].join(", ")}.`)),(!d.label?.de?.trim()||!d.label?.en?.trim())&&n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" braucht ein Label in beiden Sprachen.`,`Process key "${d.key}" needs a label in both languages.`)),d.audience!=="internal"&&d.audience!=="printable"&&n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${d.key}": audience must be 'internal' or 'printable'.`))}let o=s_(e);for(let l of e.nodes)for(let d of l.tasks??[]){let c=d.result;c?.kind==="pricedItem"&&c.writes===void 0&&n.push(ct(`node.${l.id}.tasks.${d.key}.result.writes`,dt.pricedItemWritesNothing,`Aufgabe "${d.key}" (Knoten "${l.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${d.key}" (node "${l.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[l,d]of o){let c=r.get(l);for(let u of d){let p=u.fieldKey===void 0?`node.${u.nodeId}.tasks.${u.taskKey}.result.writes`:`node.${u.nodeId}.tasks.${u.taskKey}.result.fields.${u.fieldKey}.writes`;if(c===void 0){n.push(ct(p,dt.unknownKey,`${u.fieldKey===void 0?"":`Feld "${u.fieldKey}" der `}Aufgabe "${u.taskKey}" schreibt "${l}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${u.fieldKey===void 0?"Task":`Field "${u.fieldKey}" of task`} "${u.taskKey}" writes "${l}", but the workflow declares no such process key (graph.processStore).`));continue}if(u.valueType!==c.type){let h=u.fieldKey===void 0?`Aufgabe "${u.taskKey}"`:`Feld "${u.fieldKey}" der Aufgabe "${u.taskKey}"`,k=u.fieldKey===void 0?`Task "${u.taskKey}"`:`Field "${u.fieldKey}" of task "${u.taskKey}"`;n.push(ct(p,dt.writerTypeMismatch,`${h} liefert ${u.valueType}, der Vorgangs-Schl\xFCssel "${l}" ist aber als ${c.type} deklariert.`,`${k} delivers ${u.valueType}, but the process key "${l}" is declared as ${c.type}.`))}}if(d.length>1){let u=d.map(p=>`${p.nodeId}/${p.taskKey}${p.fieldKey===void 0?"":`.${p.fieldKey}`}`).join(", ");n.push(ct(`processStore.${l}`,dt.secondWriter,`Vorgangs-Schl\xFCssel "${l}" wird ${d.length}-mal geschrieben (${u}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${l}" is written ${d.length} times (${u}) \u2014 exactly one writer per key.`))}}for(let l of t)o.has(l.key)||n.push(ct(`processStore.${l.key}`,dt.noWriter,`Vorgangs-Schl\xFCssel "${l.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${l.key}" is declared, but no task writes it ('result.writes').`));let a=new Map;for(let l of e.nodes){let d=Ye(l),c=typeof d.inputs=="function"?d.inputs(l):[];for(let u of c){let p=l.inputs?.[u.id];if(p?.kind!=="binding")continue;let h=DW(e,p.address);if(h===null)continue;let k=`node.${l.id}.input.${u.id}`,b=pe(p.address),y=a.get(h.source.key)??new Set;y.add(l.id),a.set(h.source.key,y),h.audience==="internal"&&n.push(ct(k,dt.internalInDocument,`${l.label.de}: "${u.id}" liest den internen Vorgangs-Schl\xFCssel "${h.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${l.label.en}: "${u.id}" reads the internal process key "${h.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`));let v=FW(o,h.source.key,h.source.taskKey);if(v.template.when!==void 0&&u.required===!0&&u.defaultValue===void 0&&n.push(ct(k,dt.absentWithoutDefault,`${l.label.de}: "${u.id}" ist Pflicht und an ${b} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${l_(v.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${l.label.en}: "${u.id}" is required and bound to ${b}, but the writing task only exists under a condition (when: ${l_(v.template.when)}) \u2014 without a default value the field would stay empty forever.`)),v.result.kind==="pricedItem"&&u.defaultValue!==void 0){let A=u.defaultValue;(!_i(A)||A.itemKey!==v.result.item||A.grantKeys.length>0)&&n.push(ct(k,dt.defaultItemMismatch,`${l.label.de}: der Vorgabewert von "${u.id}" muss der Artikel der schreibenden Aufgabe ohne Erm\xE4\xDFigung sein ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 sonst rechnete die Familie ohne Antrag einen anderen Artikel als mit.`,`${l.label.en}: the default value of "${u.id}" must be the article of the writing task without a reduction ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 otherwise the family would be charged a different article without an application than with one.`))}}}for(let[l,d]of a){let c=o.get(l)[0],u=c.template.blocks,p=u===void 0?void 0:u.node??c.nodeId,h=p!==void 0&&(()=>{let b=e.nodes.find(y=>y.id===p);return b!==void 0&&Ye(b).processHoldTemplate?.(b)===u.templateKey})(),k=`node.${c.nodeId}.tasks.${c.taskKey}.blocks`;if(!h){let b=[...d][0],y=e.nodes.find(A=>A.id===b),v=Ye(y).processHoldTemplate?.(y)??"?";n.push(ct(k,dt.writerMustBlock,`Die Aufgabe "${c.taskKey}" schreibt "${l}", h\xE4lt aber keinen der lesenden Knoten (${[...d].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${b===c.nodeId?"":`node: '${b}', `}templateKey: '${v}' }, sonst arbeitet er, bevor der Wert existiert.`,`The task "${c.taskKey}" writes "${l}" but holds back none of the reading nodes (${[...d].join(", ")}) \u2014 it must block the first one, e.g. blocks: { ${b===c.nodeId?"":`node: '${b}', `}templateKey: '${v}' }, otherwise it works before the value exists.`));continue}for(let b of d)b===p||_f(e,p,b)||n.push(ct(k,dt.writerMustBlock,`"${b}" liest "${l}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${p}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${b}" reads "${l}" but does not lie behind the held-back node "${p}" \u2014 on a path past it, it would read the value before it is settled.`))}return n}s(d_,"processBindingIssues");function DW(e,n){return!xe(n)||n.scope!=="task"||n.path!==void 0||!Lf(e).some(t=>t.key===n.key)||ni(e,n.owner,n.key)===null?null:a_(e,n)}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 l_(e){return xe(e)?pe(e):JSON.stringify(e)}s(l_,"shown");function Jy(e){let n=Ye(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:n.outcomes&&n.outcomes.length>0?[...n.outcomes]:null}s(Jy,"nodeOutcomes");var LW=["documentChangeRequested","documentReturned","coverLetterConfirmed","coverLetterRevisionRequested"];function c_(e){return LW.includes(e)}s(c_,"isNonAdvancingExternalEvent");var Ys=["offer","contract"];function Mf(e){return typeof e=="string"&&Ys.includes(e)}s(Mf,"isArtifactSlotType");var u_="open",Hs="done";function Qy(e){let n={};for(let t of ze)n[t]=e(t);return n}s(Qy,"localized");var f_=[{key:"tenantSlug",type:"string"}];var MW=/^(\d{4})-(\d{2})-(\d{2})$/;function qW(e){return e>=1900&&e<=2100}s(qW,"isSupportedYear");function KW(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(KW,"isRealDate");function Zy(e){if(typeof e!="string")return null;let n=MW.exec(e);if(n===null)return null;let[,t,r,i]=n;return t===void 0||r===void 0||i===void 0||!qW(Number(t))||!KW(Number(t),Number(r),Number(i))?null:{year:t,month:r,day:i}}s(Zy,"isoDateParts");var jW="Europe/Berlin";function m_(){return jW}s(m_,"tenantTimeZone");var p_=new Map;function VW(e){let n=p_.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{ae("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return p_.set(e,t),t}s(VW,"formatterFor");function BW(e,n){let t=new Map(VW(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(BW,"zoneOffsetAt");function Xy(e,n){let t=e+BW(n,e);return{wallClock:new Date(t).toISOString().slice(0,19),timeZone:n}}s(Xy,"instantToLocalDateTime");var ew=3;function h_(e){return Xy(e,m_()).wallClock.slice(0,10)}s(h_,"localIsoDate");var qf=["login","security","admission","tasks","deadlines","schoolMessages","staffTasks","staffFeedback","staffAppointments","staffDeadlines","staffWaitlist","staffUnassigned","familyMessages","mentions"],g_=m.union(...qf.map(e=>m.literal(e)));var Ufe=m.union(m.literal("admission"),m.literal("tasks"),m.literal("staff"),m.literal("chat")),nw=["loginOnly","all"],Gfe=m.union(m.literal("loginOnly"),m.literal("all"));function y_(e){return typeof e=="string"&&nw.includes(e)}s(y_,"isMailLevel");var Il="subject";function w_(e){return e.category==="login"}s(w_,"isSignInLetter");var dn={key:"schoolName",label:"Name der Schule"},b_={de:"Zu Ihren Bewerbungen",en:"View your applications"},vn={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:b_},tw={key:vn.key,label:vn.label,link:!0,actionLabel:b_},v_={key:"authorName",label:"Name der schreibenden Person"},Io={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},Ol={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"}},GW={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"}},x_={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"}},_l={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},S_={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},zW={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function Re(e){return{key:Il,label:"Betreff",default:e}}s(Re,"subjectSlot");var qi=m.object({de:m.string(),en:m.string()}),Sn={tenantSlug:m.string(),applicationId:m.id("applications")},WW=m.object({tenantSlug:m.string()}),YW={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:WW,channels:["email"],portalVisible:!0,placeholders:[dn,vn],slots:[Re({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:
|
|
10963
|
+
`};var ef="9b387e0e8a599a7441990af45c4f4cd0941dde0c699c7c597641e646c377500f",Yg=DR;var Hg=class extends ve{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:ef,tools:hl}),0}},Jg=class extends ve{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await Wg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},FR=[Hg,Jg];var Qg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],dle=new Set(Qg.map(e=>e.key));function MR(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(MR,"resolveStartTarget");function oz(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(oz,"applicantText");function qR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:oz(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(qR,"applicationRows");var LR=Qg.map(e=>e.email);function KR(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(Ug(e,n)&&(r===void 0||!LR.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${LR.join(", ")} (--applicant) \u2014 never a real family's`)}s(KR,"assertStartApplicant");function jR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(jR,"processStoreJson");function sz(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(sz,"refText");function az(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?sz(e.ref):JSON.stringify(e.value)}s(az,"holds");function VR(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:az(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(VR,"storeRows");function nf(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(nf,"parseKv");var BR="started",tf="submitted",rf="submitted",UR="load-scenario:";var GR="(Bewerbung)";function zR(e){return{nodeId:GR,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(zR,"sharedAsList");function WR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(WR,"disabledText");function YR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:WR(r)})))}s(YR,"actionRows");function HR(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: ${WR(a)}`);if(i!==GR)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(HR,"nodeOfferingAction");function JR(e,n,t){if(e.startsWith(UR)){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(JR,"runParams");async function lz(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(lz,"currentNodeIds");function dz(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(dz,"refusalText");async function of(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${dz(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,zR(r.actions)]}s(of,"actionsOf");async function QR(e,n,t){return t!==void 0?[t]:await lz(e,n)}s(QR,"nodesOf");var Zg=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await of(n,this.application,await QR(n,this.application,this.node));return this.print(t,YR,["node","action","label","disabled"]),0}},Xg=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=JR(this.action,this.autoSubmit,nf(this.param??[]).values),t=await this.caller(),r=this.application,i=await QR(t,this.application,this.node),o=HR(await of(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}},ZR=[Zg,Xg];var ze=["de","en"];function Ss(e,n){return ze.every(t=>e[t]===n[t])}s(Ss,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function $i(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s($i,"isLocalizedText");function gl(e,n){let t={};for(let r of ze){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(gl,"composeTexts");var mr=/^[a-z][A-Za-z0-9]*$/;function ey(e){return typeof e=="string"&&mr.test(e)}s(ey,"isNodeId");function As(e,n){ey(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${mr.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(As,"makeNodeId");var Ii="$env";function pe(e){if(e.scope==="env")return`${Ii}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(pe,"formatAddress");var Ri=/^[a-z][a-zA-Z0-9_]*$/,cz=/^[A-Za-z_][A-Za-z0-9_]*$/;function ho(e){return typeof e=="string"&&e.split(".").every(n=>cz.test(n))}s(ho,"isPath");function go(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"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Ri.test(o)||(t==="node"?!mr.test(i):!Ri.test(i))?null:uz({scope:t,owner:i,key:o},a)}default:return null}}s(go,"tryParseAddress");function uz(e,n){if(n.length===0)return e;let t=n.join(".");return ho(t)?{...e,path:t}:null}s(uz,"withPath");function xe(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!ho(n.path))return!1;switch(n.scope){case"env":return ho(n.key);case"node":return typeof n.owner=="string"&&mr.test(n.owner)&&typeof n.key=="string"&&Ri.test(n.key);case"task":return typeof n.owner=="string"&&Ri.test(n.owner)&&typeof n.key=="string"&&Ri.test(n.key);default:return!1}}s(xe,"isAddress");var Yr={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"}},Es=Object.keys(Yr);function Ts(e){return Object.hasOwn(Yr,e)}s(Ts,"isEnvKey");var fz=["self-service","staff"];function XR(e,n){return{kind:"fixed",values:e,labels:n}}s(XR,"fixedSet");var sf={of:"applicant.language",withoutValue:"de"},Hr={"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:sf},"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:sf},"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:sf},"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:sf},"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:XR(ze,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:XR(fz,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},af={types:Yr,fields:Hr},lf=Es.flatMap(e=>Object.keys(Yr[e]).map(n=>`${e}.${n}`));function Ht(e){return Object.hasOwn(Hr,e)}s(Ht,"isEnvLeaf");function df(e){return`${Ii}.${e}`}s(df,"envIdentifier");function yo(e){let n=Hr[e],[t,r]=e.split("."),i=Yr[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(yo,"envLeaf");var eI="staffInput";var pz=["boolean"],yl=/^[a-z][A-Za-z0-9]*$/;function cf(e){return e.staffInputs??[]}s(cf,"staffInputsOf");function uf(e){return`${eI}.${e}`}s(uf,"staffInputLeaf");function nI(e){return`${Ii}.${uf(e)}`}s(nI,"staffInputIdentifier");function mz(e){let n=`${eI}.`;return e.startsWith(n)?e.slice(n.length):null}s(mz,"staffInputKeyOfLeaf");function $s(e,n){let t=mz(n);return t===null?void 0:cf(e).find(r=>r.key===t)}s($s,"declaredStaffInput");function tI(e){return[...cf(e).map(n=>({leaf:uf(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...lf.map(n=>{let t=yo(n);return{leaf:n,type:t.type,label:t.label,valueSet:Hr[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(tI,"envLeavesFor");function rI(e){return tI(e).filter(n=>!n.cohortBound)}s(rI,"conditionEnvLeaves");function iI(e){return sI(rI(e))}s(iI,"envConditionSchemaFor");function hz(e){return tI(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(hz,"offerConditionEnvLeaves");function oI(e){return sI(hz(e))}s(oI,"offerConditionSchemaFor");function sI(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(sI,"schemaOfLeaves");function aI(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}"`};yl.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=Rn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(aI,"staffInputIssues");var cy={required:!0,description:"Offer slug (its offerKey)"},ny=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",cy);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=qR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},ty=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",cy);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}},ry=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},iy=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(jR(t),()=>VR(t),["address","state","holds","producer","written"]),0}},oy=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",cy);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();KR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=MR(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:dI(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 of(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},sy=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=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 ay=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=T.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},ly=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},dy=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=dI([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}},lI=[ny,ty,ry,iy,oy,sy,ay,ly,dy];function dI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!yl.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(dI,"parseStaffInputs");var Vn="contractGenerator",wo="documentTemplate";function wl(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(wl,"isGeneratorRef");function cI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(cI,"literalOf");function Jr(e){let n=cI(e,Vn);return wl(n)?n:null}s(Jr,"generatorRefOfNode");function hr(e){let n=cI(e,wo);return typeof n=="string"&&n.length>0?n:null}s(hr,"documentTemplateKeyOfNode");function uI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(uI,"generatorRefLabel");var yz=["formExports","generatorStamp"];function fI(e,n,t){let r=e.inputs?.[Vn];(r?.kind!=="literal"||!wl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Vn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Vn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts},...n.coverLetter===void 0?{}:{coverLetter:n.coverLetter}}}s(fI,"applyGeneratorStamp");var wz=["reads"];function Rs(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(Rs,"comparableWorkflowGraph");var kl={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 ff(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=kl[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(ff,"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 pI(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(pI,"progressLayoutIssues");var mI=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var bz=new Set(["sections","effects","outcomes","testScenarios","env","views"]),pf={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 hI(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=pf[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(hI,"smartFormDefinitionShapeIssues");var kt=["granted","rejected","waitlisted","other"];function Oi(e){return typeof e=="string"&&kt.includes(e)}s(Oi,"isOutcomeSemantic");var Jt=["arrival","manual"],gI={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 uy(e){let n=vz(e,"waitlistOrder");return Jt.includes(n)?{waitlistOrder:n}:null}s(uy,"waitlistPolicyOrNull");var gn="responsible",fy="team:";function mf(e){return`${fy}${e}`}s(mf,"teamSlot");function hf(e){return e.startsWith(fy)?e.slice(fy.length):null}s(hf,"teamKeyOfSlot");function yI(e){return e.kind==="responsible"?gn:mf(e.groupKey)}s(yI,"slotIdOf");function gf(e){if(e===gn)return{kind:"responsible"};let n=hf(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(gf,"slotOfId");var py="review",my="checkField",wI="reviewed",kI="reviewing",yf=["rejected","waitlisted"];function hy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(hy,"isObject");var xz=new Set(["decision",py]),bI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function gy(e){return Object.hasOwn(bI,e)?bI[e]:void 0}s(gy,"legacySemanticOfId");function Sz(e){return e===py?kt.filter(n=>!yf.includes(n)):kt}s(Sz,"allowedSemanticsFor");var Az="other";function vI(e){return hy(e)&&xz.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(vI,"outcomesOf");function xI(e){return(e?.nodes??[]).some(n=>vI(n).some(t=>hy(t)&&!("semantic"in t)))}s(xI,"needsOutcomeSemantics");function SI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=vI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=Sz(u),h=!1,k=l.map(b=>{if(!hy(b))return b;let y=String(b.id);if("semantic"in b)return Oi(b.semantic)||i.push({nodeId:c,outcomeId:y,value:String(b.semantic)}),b;let v=`${c}.${y}`,A=Object.hasOwn(n,v)?n[v]:void 0;if(A!==void 0)return p.includes(A)?(t.push({nodeId:c,outcomeId:y,semantic:A,source:"answer"}),h=!0,{...b,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p,answer:A}),b);let E=gy(y),R=E??Az;return p.includes(R)?(t.push({nodeId:c,outcomeId:y,semantic:R,source:E===void 0?"formerDefault":"legacyTable"}),h=!0,{...b,semantic:R}):(r.push({nodeId:c,nodeType:u,outcomeId:y,allowed:p}),b)});return h?{...d,outcomes:k}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(SI,"addOutcomeSemantics");var gr="bewerbungOffen";function ko(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ko,"isObject");var yy=["event","effect"];function AI(e){return ko(e)&&e.type==="eventTrigger"}s(AI,"isTrigger");function EI(e){let n=ko(e.inputs)?e.inputs:{};return"outcomes"in e||yy.some(t=>t in e||t in n)}s(EI,"oldShape");function TI(e){return(e?.nodes??[]).some(n=>AI(n)&&EI(n))}s(TI,"needsEventTriggerStartMove");function Ez(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>ko(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===gr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(ko(e.next)?e.next:{});if(!(i.length===1&&i[0]===gr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=ko(e.inputs)?{...e.inputs}:{};for(let l of yy){let d=o[l];if(ko(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of yy)delete a[l],delete o[l];return ko(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(Ez,"moveNode");function $I(e){let n=[],t=[],r=e.nodes.map(i=>{if(!AI(i)||!EI(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($I,"moveEventTriggerStart");function bl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(bl,"isObject");var RI={waitlistOrder:"arrival"};function II(e){return!bl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(bl(e.inputs)?e.inputs:{}))}s(II,"lacksPolicy");function Tz(e){return(e?.nodes??[]).some(II)}s(Tz,"needsWaitlistPolicyMove");function wy(e){return bl(e)&&Jt.includes(e.waitlistOrder)}s(wy,"isWaitlistPolicy");function $z(e){if(e===void 0)return{policy:RI,stated:!1};if(!bl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Jt.includes(n)?"malformed":{policy:{waitlistOrder:n??RI.waitlistOrder},stated:n!==void 0}}s($z,"policyOfSelection");function OI(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(!II(l))return l;let d=l,c=String(d.id),u=bl(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,k;if(p!==void 0)h=p,k="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,k=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:k}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(OI,"moveWaitlistPolicyToInputs");function bo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(bo,"isObject");var Rz=[Vn,wo],Iz=["inputSchema","parties","schemaDigest","parts"];function _I(e){return bo(e)&&e.type==="governedDocument"&&("resolver"in e||bo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(_I,"oldShape");function PI(e){return(e?.nodes??[]).some(_I)}s(PI,"needsGeneratorInputMove");function Oz(e){let n=bo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!bo(i))return{unmoved:"resolverNotObject"};if(Vn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((bo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>bo(d)&&Rz.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Vn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(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(bo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(wo in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[wo]={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 NI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!_I(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(NI,"moveGeneratorPinsToInputs");var CI=/^\d{4}-\d{2}-\d{2}$/;function yr(e,n){return{de:e,en:n}}s(yr,"issue");function vo(e){if(typeof e!="object"||e===null)return yr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:yr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return yr(`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?yr("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"||!CI.test(r)?yr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!CI.test(i)?yr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?yr("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)?yr("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))?yr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?yr("unbekannte Angaben","unknown details"):null:yr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(vo,"reductionShapeIssue");function _i(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||vo(n.reduction)===null&&n.reduction.kind==="amount")}s(_i,"isPricedItemValue");var Is=["freetext","recommendation","choice","pricedItem","record","reduction"],Os=[...Is,"appointment"];function FI(e){return typeof e=="string"&&Os.includes(e)}s(FI,"isTaskResultKind");function Pi(e){return typeof e=="string"&&Is.includes(e)}s(Pi,"isRecordedTaskResultKind");function _s(e){return Pi(e.kind)}s(_s,"isRecordedTaskResult");var wf=["number","boolean","enum"];function ky(e){return typeof e=="string"&&wf.includes(e)}s(ky,"isRecordFieldType");var by=["form","siblingRank"];var Qr={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 LI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(LI,"isProseResult");function kf(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&ky(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):_z(e)}s(kf,"draftResultStoreWrites");function _z(e){let n=Qr[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(_z,"singleStoreWrite");var DI="team:";function Ps(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(DI)){let n=e.slice(DI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ps,"parseTaskResultChat");var nn={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]"};var Pz=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===`
|
|
10964
|
+
`||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);Pz.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 MI=1e4,qI=128;function Ns(e){e.depth++,e.depth>qI&&F(`Expression nesting too deep (> ${qI})`)}s(Ns,"enterDepth");function GI(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(GI,"peek");function Bn(e){let n=e.tokens[e.pos];return n||F(`Unexpected end at ${e.pos}`),e.pos++,n}s(Bn,"take");function Un(e,n,t){let r=GI(e);return!(!r||r.t!==n||t!==void 0&&r.v!==t)}s(Un,"match");function xo(e,n,t){return Un(e,n,t)||F(`Expected ${n}${t?`:${t}`:""} at ${e.pos}`),Bn(e)}s(xo,"expect");function Xr(e){Ns(e);try{return Un(e,"kw","if")?Mz(e):qz(e)}finally{e.depth--}}s(Xr,"parseExpr");function Mz(e){xo(e,"kw","if"),xo(e,"punct","(");let n=Xr(e);xo(e,"punct",")");let t=Xr(e);xo(e,"kw","else");let r=Xr(e);return{kind:"if",cond:n,then:t,else:r}}s(Mz,"parseIf");function qz(e){let n=KI(e),t=0;try{for(;Un(e,"op","||");){Bn(e),Ns(e),t++;let r=KI(e);n={kind:"binary",op:"||",left:n,right:r}}}finally{e.depth-=t}return n}s(qz,"parseLogicOr");function KI(e){let n=jI(e),t=0;try{for(;Un(e,"op","&&");){Bn(e),Ns(e),t++;let r=jI(e);n={kind:"binary",op:"&&",left:n,right:r}}}finally{e.depth-=t}return n}s(KI,"parseLogicAnd");function jI(e){let n=VI(e),t=0;try{for(;Un(e,"op","==")||Un(e,"op","!=");){let r=Bn(e).v;Ns(e),t++;let i=VI(e);n={kind:"binary",op:r,left:n,right:i}}}finally{e.depth-=t}return n}s(jI,"parseEquality");function VI(e){let n=xy(e),t=0;try{for(;Un(e,"op","<")||Un(e,"op","<=")||Un(e,"op",">")||Un(e,"op",">=")||Un(e,"kw","in");){let r=Bn(e),i=r.t==="kw"?"in":r.v;Ns(e),t++;let o=xy(e);n={kind:"binary",op:i,left:n,right:o}}}finally{e.depth-=t}return n}s(VI,"parseCompare");function xy(e){if(Un(e,"op","!")){Bn(e),Ns(e);try{return{kind:"unary",op:"!",operand:xy(e)}}finally{e.depth--}}return Kz(e)}s(xy,"parseUnary");function Kz(e){let n=GI(e);if(n||F("Unexpected end"),n.t==="num")return Bn(e),{kind:"num",value:n.v};if(n.t==="str")return Bn(e),{kind:"str",value:n.v};if(n.t==="kw"&&n.v==="true")return Bn(e),{kind:"bool",value:!0};if(n.t==="kw"&&n.v==="false")return Bn(e),{kind:"bool",value:!1};if(n.t==="kw"&&n.v==="null")return Bn(e),{kind:"null"};if(n.t==="punct"&&n.v==="("){Bn(e);let t=Xr(e);return xo(e,"punct",")"),t}if(n.t==="punct"&&n.v==="["){Bn(e);let t=[];if(!Un(e,"punct","]"))for(t.push(Xr(e));Un(e,"punct",",");)Bn(e),t.push(Xr(e));return xo(e,"punct","]"),{kind:"arr",items:t}}if(n.t==="ident"){let t=n.v;if(Bn(e),Un(e,"punct","(")){Bn(e);let r=[];if(!Un(e,"punct",")"))for(r.push(Xr(e));Un(e,"punct",",");)Bn(e),r.push(Xr(e));return xo(e,"punct",")"),{kind:"call",name:t,args:r}}return{kind:"ident",path:t}}F(`Unexpected token at ${e.pos}`)}s(Kz,"parsePrimary");function In(e){e.length>MI&&F(`Expression too long (${e.length} > ${MI})`);let n={tokens:Lz(e),pos:0,depth:0},t=Xr(n);return n.pos<n.tokens.length&&F(`Unexpected trailing token at ${n.pos}`),t}s(In,"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 yn(e,n){switch(e.kind){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"null":return null;case"ident":{let t=Object.hasOwn(n.values,e.path)?n.values[e.path]:void 0;return t===void 0?null:t}case"arr":return e.items.map(t=>yn(t,n));case"unary":{let t=yn(e.operand,n);return!So(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=>yn(i,n));return t(...r)}case"binary":return Vz(e.op,e.left,e.right,n);case"if":return So(yn(e.cond,n))?yn(e.then,n):yn(e.else,n)}}s(yn,"evaluate");function Vz(e,n,t,r){if(e==="&&"){let a=yn(n,r);return So(a)?So(yn(t,r)):!1}if(e==="||"){let a=yn(n,r);return So(a)?!0:So(yn(t,r))}let i=yn(n,r),o=yn(t,r);switch(e){case"==":return vy(i,o);case"!=":return!vy(i,o);case"<":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=bf(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>vy(a,i)):!1}}s(Vz,"evalBinary");function bf(e,n){return[BI(e),BI(n)]}s(bf,"orderedOperands");function BI(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(BI,"numericOperand");function vy(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(vy,"looseEq");function So(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(So,"truthy");function On(e){let n=new Set;return Zr(e,n),[...n]}s(On,"dependencies");function Zr(e,n){switch(e.kind){case"ident":n.add(e.path);return;case"call":e.args.forEach(t=>Zr(t,n));return;case"arr":e.items.forEach(t=>Zr(t,n));return;case"unary":Zr(e.operand,n);return;case"binary":Zr(e.left,n),Zr(e.right,n);return;case"if":Zr(e.cond,n),Zr(e.then,n),Zr(e.else,n);return;default:return}}s(Zr,"walk");var UI=new Map;function ei(e){let n=UI.get(e);return n||(n=In(e),UI.set(e,n)),n}s(ei,"parseCached");function Bz(e,n){return yn(ei(e),n)}s(Bz,"evalExpression");function zI(e,n){return So(Bz(e,n))}s(zI,"evalBoolean");function WI(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(WI,"assertNoCustomNodeExports");var Sy=null;function YI(e){for(let[n,t]of Object.entries(e))WI(n,t);Sy=e}s(YI,"setSpecs");function HI(){return Sy||F("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),Sy}s(HI,"requireSpecs");function Ye(e){let n=HI(),t=n[e.type];return t===void 0&&ae("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(Ye,"specFor");function JI(){return Object.keys(HI()).sort()}s(JI,"registeredNodeTypes");var QI=lf.filter(e=>Hr[e].cohortBound!==!0);function Ay(e){return Ht(e)&&Hr[e].cohortBound!==!0}s(Ay,"isEnvAddressLeaf");function Ey(e){return yo(e).type}s(Ey,"envType");function Ty(e){return yo(e).label}s(Ty,"envLabel");function $y(e){if(e.scope==="env"||e.path===void 0)return e;switch(e.scope){case"node":return{scope:"node",owner:e.owner,key:e.key};case"task":return{scope:"task",owner:e.owner,key:e.key}}}s($y,"addressBase");function wr(e){return e.scope==="node"&&e.key===nt&&e.path===void 0}s(wr,"isInstanceAddress");function un(e){return xe(e)&&e.scope==="node"&&e.key===nt&&e.path!==void 0}s(un,"isFormFieldAddress");function ZI(e){return un(e)?{owner:e.owner,path:e.path}:null}s(ZI,"formFieldOf");function Uz(e){return On(ei(e)).map(n=>{if(!n.startsWith("$"))return{identifier:n,address:null,reason:"bareIdentifier"};let t=go(n);return t===null?{identifier:n,address:null,reason:"shape"}:{identifier:n,address:t}})}s(Uz,"expressionAddresses");var nt="admission",vl="document",Cs="contract",Ds="contracts",XI="payment",Ry=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var lt={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"},wce={join:{...lt},end:{...lt},eventTrigger:{...lt},form:{...lt,adoptForm:"address",formExports:"stamp"},roleAssign:{...lt},setFlag:{...lt},if:{...lt,condition:"address"},countersign:{...lt,contract:"address",titles:"display",signing:"config"},engagePush:{...lt,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...lt,commentRequired:"config",decisionAsTask:"config",reads:"address",formView:"config",requiresOneOf:"config"},review:{...lt,form:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...lt},completenessCheck:{...lt,requires:"address",deadline:"config"},collectPayment:{...lt},governedDocument:{...lt,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 Ni(e){return Array.isArray(e)?e:[]}s(Ni,"listOf");function Nt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(Nt,"record");function eO(e){switch(e.type){case"countersign":return["contract"];case"engagePush":return["form","contract","payment"];case"governedDocument":return e.production==="resolver"?["form"]:[];case"review":return["form"];default:return[]}}s(eO,"dataSourceFieldsOf");function nO(e){return e.type==="review"?[]:e.type==="engagePush"?["form"]:eO(e)}s(nO,"requiredDataSourceFields");var Gz={setFlag:{target:"setFlagTarget"}};function xl(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?[]:(Ye(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=Gz[e.type]??{};for(let[d,c]of Object.entries(Nt(r.inputs)??{})){let u=Nt(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 k=a.get(d);o("binding",`${i}.inputs.${d}`,p,k!==void 0?{expectedType:k}:{})}for(let[d,c]of Ni(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of Ni(r.requires).entries())o("requires",`${i}.requires.${d}`,c,{judgedTogether:`${i}.requires`});e.type==="form"&&r.adoptForm!==void 0&&o("adoptForm",`${i}.adoptForm`,r.adoptForm);for(let d of eO(e))r[d]!==void 0&&o(d,`${i}.${d}`,r[d]);e.type==="if"&&r.condition!==void 0&&o("condition",`${i}.condition`,r.condition);for(let[d,c]of Ni(r.tasks).entries())t.push(...tO(e.id,c,d));for(let[d,c]of Ni(r.optionalActions).entries()){let u=Nt(c);u?.when!==void 0&&o("optionalActionWhen",zz(e.id,typeof u.key=="string"?u.key:String(d)),u.when)}return t}s(xl,"nodeAddressFields");function zz(e,n){return`nodes.${e}.optionalActions.${n}.when`}s(zz,"optionalActionWhenPath");function tO(e,n,t){let r=Nt(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,k,b={})=>{i.push({kind:p,at:h,nodeId:e,taskKey:o,value:k,judgedTogether:null,...b})},"field"),d=`${a}.evidence`;r.when!==void 0&&l("taskWhen",`${a}.when`,r.when,{expectedType:"boolean",judgedTogether:d});for(let[p,h]of Ni(r.reads).entries())l("taskReads",`${a}.reads.${p}`,h,{judgedTogether:d});for(let[p,h]of Ni(r.documents).entries()){let k=Nt(h);k===null||k.kind==="artifact"||l("taskDocument",`${a}.documents.${p}`,"address"in k?k.address:k.key)}let c=Nt(r.familyRequest);if(c!==null){for(let[p,h]of Ni(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=Nt(r.result);if(u?.kind==="record")for(let[p,h]of Ni(u.fields).entries()){let k=Nt(Nt(h)?.suggest);if(k?.kind!=="form")continue;let b=Nt(h)?.type;l("suggest",`${a}.result.fields.${p}.suggest`,"address"in k?k.address:k.key,typeof b=="string"?{expectedType:b}:{})}return i}s(tO,"taskAddressFields");function Fs(e){return Iy(e)?(Oy(e.value)??[]).flatMap(n=>n.address===null?[]:[n.address]):xe(e.value)?[e.value]:[]}s(Fs,"addressesInField");function Iy(e){return e.kind==="condition"||e.kind==="optionalActionWhen"}s(Iy,"isExpressionField");function Oy(e){if(typeof e!="string"||e.trim().length===0)return null;try{ei(e)}catch{return null}return Uz(e)}s(Oy,"conditionAddresses");function bt(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(bt,"adoptsForm");function rO(e){if(e.type!=="form"||bt({type:e.type,adoptForm:e.adoptForm}))return;let n=e.inputs?.smartForm;return n?.kind==="literal"&&typeof n.value=="string"&&n.value!==""?n.value:void 0}s(rO,"createdSmartFormSlug");function Wz(e,n){return e.type!=="governedDocument"||e.production!=="resolver"||n!==vl?n:e.generatorStamp?.parts!==void 0?Ds:Cs}s(Wz,"addressKeyOfPort");function iO(e){let n=e.result;return n===void 0||!_s(n)?[]:kf(n).map(t=>t.key)}s(iO,"storeWritesOf");function _y(e,n){return(Array.isArray(e.processStore)?e.processStore:[]).find(t=>t.key===n)}s(_y,"declaredKey");function Cr(e,n){let t=[];if(!bt(n))for(let r of Ye(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 iO(r)){let o=_y(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(Cr,"producedAddresses");function oO(e,n,t){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===n&&iO(i).includes(t))return{nodeId:r.id,template:i};return null}s(oO,"taskWriter");function ni(e,n,t){return oO(e,n,t)?.nodeId??null}s(ni,"taskOwnerNode");function Yz(e){return xl(e,{slotTypes:!1}).flatMap(n=>Fs(n).map(t=>({address:t,field:n})))}s(Yz,"writtenAddressesOf");function Ao(e,n){let t=[],r=new Set,i=s((a,l,d,c)=>{let u=`${pe(a)}|${l}|${d.at}|${c===void 0?"":pe(c)}`;r.has(u)||(r.add(u),t.push({address:a,origin:l,field:d,...c!==void 0?{via:c}:{}}))},"push"),o=s((a,l)=>{if(a.scope!=="task")return;let d=oO(e,a.owner,a.key);if(d!==null){for(let c of tO(d.nodeId,d.template))if(!(c.kind!=="taskWhen"&&c.kind!=="taskReads"))for(let u of Fs(c))i(u,"evidence",l,a)}},"carried");for(let{address:a,field:l}of Yz(n))i(a,"written",l),o(a,l);return t}s(Ao,"addressReadsOf");function Py(e,n){switch(n.scope){case"env":return Ht(n.key)?Ey(n.key):$s(e,n.key)?.type;case"task":return n.path!==void 0||ni(e,n.owner,n.key)===null?void 0:_y(e,n.key)?.type;case"node":{let t=e.nodes.find(i=>i.id===n.owner);if(t===void 0)return;let r=Cr(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(Py,"addressType");function vf(e,n){let t=Nt(e)?.[n];return typeof t=="string"&&t.length>0?t:void 0}s(vf,"labelText");function _e(e,n,t){let r=e.nodes.find(i=>i.id===n);return vf(r?.label,t)??n}s(_e,"nodeDisplayName");function Eo(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 vf(i.title,t)??n}return n}s(Eo,"taskDisplayName");function je(e,n,t){let r=[];switch(n.scope){case"env":r.push(Ht(n.key)?Ty(n.key)[t]:$s(e,n.key)?.label[t]??n.key);break;case"task":r.push(Eo(e,n.owner,t),vf(_y(e,n.key)?.label,t)??n.key);break;case"node":{r.push(_e(e,n.owner,t));let i=e.nodes.find(a=>a.id===n.owner),o=i===void 0?void 0:Cr(e,i).find(a=>a.address.scope==="node"&&a.address.key===n.key);r.push(vf(o?.label,t)??n.key);break}}return n.scope!=="env"&&n.path!==void 0&&r.push(n.path),`${r.join(" \u203A ")} (${pe(n)})`}s(je,"displayAddress");var Sl=["beneficiary","signers"];function sO(e,n){return Array.isArray(e.artifacts)&&e.artifacts.some(t=>t?.key===n)}s(sO,"ownsSlot");function Al(e){let n=[];for(let[t,r]of Object.entries(Nt(e.inputs)??{})){let i=Nt(r);i?.kind==="binding"&&xe(i.address)&&n.push({slot:t,address:i.address})}return n}s(Al,"bindingAddresses");function aO(e,n){return Al(e).find(t=>t.slot===n)?.address??null}s(aO,"bindingAddressAt");function lO(e,n){let t=s(i=>i.scope==="node"&&i.owner===n||i.scope==="task"&&ni(e,i.owner,i.key)===n,"names");return e.nodes.filter(i=>i.id!==n).flatMap(i=>xl(i,{slotTypes:!1})).flatMap(i=>Fs(i).filter(t).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(lO,"addressesNaming");var _n={target:"target",flagKey:"flagKey",value:"value"};function Hz(e){return aO(e,_n.target)}s(Hz,"setFlagTarget");function dO(e){let n=Hz(e);return n!==null&&wr(n)?n.owner:null}s(dO,"setFlagTargetOwner");function xf(e){let n=e.inputs?.[_n.flagKey];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(xf,"setFlagKey");function cO(e){let n=e.inputs?.[_n.value];if(n===void 0||n.kind==="unset")return!0;if(n.kind==="literal"&&typeof n.value=="boolean")return n.value;F(`[setFlag/valueType] setFlag node "${String(e.id)}": \`${_n.value}\` is no yes/no literal \u2014 publish refuses that`)}s(cO,"setFlagValue");function uO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(uO,"isObject");var fO=["target","flagKey","value"];function pO(e){return uO(e)&&e.type==="setFlag"&&fO.some(n=>n in e)}s(pO,"oldShape");function mO(e){return(e?.nodes??[]).some(pO)}s(mO,"needsSetFlagInputMove");function Jz(e){let n=uO(e.inputs)?{...e.inputs}:{};if(fO.some(a=>a in e&&_n[a]in n))return{unmoved:"inputExists"};if("target"in e&&!xe(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(Jz,"moveNode");function hO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!pO(i))return i;let o=Jz(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(hO,"moveSetFlagConfigToInputs");function gO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(gO,"isObject");var Ny={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},Cy={review:["allowSkipInTest"]};function yO(e){return Ny[String(e)]??{}}s(yO,"movesOf");function wO(e){return Cy[String(e)]??[]}s(wO,"deadOf");function kO(e){return gO(e)&&[...Object.keys(yO(e.type)),...wO(e.type)].some(n=>n in e)}s(kO,"oldShape");function bO(e){return(e?.nodes??[]).some(kO)}s(bO,"needsScalarInputMove");function Qz(e,n){return n==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===n}s(Qz,"wellTyped");function Zz(e){let n=gO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(yO(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==="")&&!Qz(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 wO(e.type))delete t[r];return t.inputs=n,{node:t}}s(Zz,"moveNode");function vO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!kO(i))return i;let o=Zz(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(vO,"moveScalarConfigToInputs");var Ls={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 Sf(e){return typeof e=="string"&&Object.hasOwn(Ls,e)}s(Sf,"isResourceType");var Nce=Object.keys(Ls).filter(e=>Ls[e].existence.check==="generic");function xO(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||vo(n.reduction)===null&&n.reduction.kind==="amount")&&Object.keys(n).every(t=>t==="groupKey"||t==="grantKeys"||t==="reduction")}s(xO,"isPricedGroupValue");var Dy=["street","hausnr","plz","ort","land"];function SO(e){return Dy.includes(e)}s(SO,"isAddressPart");var Xz=["municipality","municipalityKey","district","districtKey"],Fy=[...Dy,...Xz],Ly={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"},Ms=Object.keys(Ly);function Ci(e){return typeof e=="string"&&e in Ly}s(Ci,"isValueType");function vt(e){return e===void 0?void 0:Ly[e]}s(vt,"dataTypeOf");function Af(e,n){let t=vt(e),r=vt(n);return t!==void 0&&t===r}s(Af,"valueTypesCompatible");function Ef(e){return e===null?"null is not a text in both languages":El(e,{type:"localizedText"})}s(Ef,"completeLocalizedTextIssue");function El(e,n){if(Sf(n.type)&&!Ci(n.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${n.type} key`;let t=vt(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 xO(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 wl(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=vo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(El,"literalTypeIssue");function AO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(AO,"isObject");var eW={collectPayment:{reason:"reason"}},nW={governedDocument:["mockAutoProduce"]},EO={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 My(e){return eW[String(e)]??{}}s(My,"movesOf");function TO(e){return nW[String(e)]??[]}s(TO,"deadOf");function $O(e){return AO(e)&&[...Object.keys(My(e.type)),...TO(e.type)].some(n=>n in e)}s($O,"oldShape");function RO(e){return(e?.nodes??[]).some($O)}s(RO,"needsNodeConfigInputMove");function tW(e){return Ef(e)===null}s(tW,"isCompleteText");function rW(e){let n=AO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(My(e.type)))if(r in e){if(i in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!tW(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 TO(e.type))delete t[r];return Object.keys(My(e.type)).some(r=>r in e)&&(t.inputs=n),{node:t}}s(rW,"moveNode");function IO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!$O(i))return i;let o=rW(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(IO,"moveNodeConfigToInputs");var Tl="collectPayment",qs=["online","manual"];function Tf(e){return qs.includes(e)}s(Tf,"isCollectPaymentMode");var To="paid",qy="skipPayment",Ky="confirmPayment",Di="article",tt="mode",Fi="reason",Qt="payee",jy=["one_time"];function $f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s($f,"isObject");function OO(e){if(!$f(e)||e.type!==Tl)return!1;let n=$f(e.inputs)?e.inputs:{},t=n[tt];return!$f(t)||t.kind!=="literal"||t.value!=="online"?!1:!(Qt in n)}s(OO,"isOnlinePaymentWithoutPayee");function _O(e){return(e?.nodes??[]).some(OO)}s(_O,"needsPayee");function PO(e,n={}){let t=[],r=[],i=e.nodes.map(o=>{if(!OO(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=$f(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(PO,"setPayeeOnOnlinePayments");var NO="settlement",iW={online:"online",separate:"manual"};function Vy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Vy,"isObject");function CO(e){return Vy(e)&&e.type===Tl&&Vy(e.inputs)&&NO in e.inputs}s(CO,"carriesSettlement");function DO(e){return(e?.nodes??[]).some(CO)}s(DO,"needsPaymentModeRename");function FO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!CO(i))return i;let o=String(i.id),{[NO]:a,...l}=i.inputs;if(tt in l)return t.push({nodeId:o,reason:"bothCells"}),i;let d=Vy(a)&&a.kind==="literal"&&typeof a.value=="string"?iW[a.value]:void 0;return d===void 0?(t.push({nodeId:o,reason:"unknownValue"}),i):(n.push(o),{...i,inputs:{...l,[tt]:{...a,value:d}}})});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(FO,"renameSettlementToMode");function Rf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Rf,"isObject");function By(e){return Rf(e)&&Rf(e.assign)&&"userId"in e.assign}s(By,"namesUser");function If(e){return(e?.nodes??[]).flatMap(n=>Rf(n)&&Array.isArray(n.tasks)?n.tasks.filter(By).map(t=>({nodeId:String(n.id),taskKey:String(t.key),hasTeam:typeof t.assign.group=="string"&&t.assign.group.length>0})):[])}s(If,"taskUserAssignments");function LO(e){let n=If(e);if(n.length===0)return{graph:e,dropped:n};let t=e.nodes.map(r=>{if(!Rf(r)||!Array.isArray(r.tasks)||!r.tasks.some(By))return r;let i=r.tasks.map(o=>{if(!By(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(LO,"dropTaskAssignUserIds");var Ks={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"actionTeams{}":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Knoten-Aktion ausf\xFChren darf",en:"team that may perform the node action"},consequence:{de:"au\xDFer der zust\xE4ndigen Person darf niemand die Aktion ausf\xFChren",en:"nobody but the responsible person may perform the action"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"tasks[].result.primaryHostTeams":{kind:"team",codec:"key",involves:!1,required:!1,list:!0,what:{de:"Team oben in der Gastgeber-Auswahl",en:"team listed first in the host picker"},consequence:{de:"die Gastgeber-Auswahl kann das Team nicht oben zeigen",en:"the host picker cannot list the team first"}},"optionalActions[].trigger":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Aktion ausl\xF6sen darf",en:"team that may trigger the action"},consequence:{de:"niemand au\xDFer der Prozessverantwortung kann die Aktion ausl\xF6sen",en:"nobody but the process owner can trigger the action"}}},Uy=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function Gy(e,n){if(typeof n!="string"||n.length===0)return null;if(e==="key")return n;let t=Ps(n);return t?.kind==="team"?t.groupKey:null}s(Gy,"decodeKey");var MO={"assign{}":"assign","actionTeams{}":"actionTeams"},oW=s(e=>e in MO,"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 Of(e){let n=[],t=e;for(let[r,i]of Object.entries(MO))for(let[o,a]of Object.entries(Uy(t[i])??{}))n.push({path:`${i}.${o}`,leaf:r,owner:o,key:Gy("key",a),missing:typeof a!="string"||a.length===0});for(let r of Object.keys(Ks)){if(oW(r))continue;let i=Ks[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=`${o}.${c.key}${a===null?"":`.${a}`}.${l}`;if(i.list===!0){if(!Array.isArray(p)){n.push({path:h,leaf:r,owner:c.key,key:null,missing:!0});continue}let b=c.key;p.forEach((y,v)=>{n.push({path:`${h}.${v}`,leaf:r,owner:b,index:v,key:Gy(i.codec,y),missing:typeof y!="string"||y.length===0})});continue}let k=typeof p!="string"||p.length===0;n.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:Gy(i.codec,p),missing:k})}}return n}s(Of,"nodeResourceReferences");var qO=s(e=>(e??[]).map(n=>`\u201E${n}\u201C`).join(", "),"list"),KO=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 (${qO(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 (${KO(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 (${qO(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 (${KO(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 js(e,n,t){let{problem:r,remedy:i}=aW[e][t](n);return`[${e}] ${r} ${i}`}s(js,"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 zy(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(zy,"successorsOf");function _f(e,n,t){if(n===t)return!0;let r=zy(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 jO(e,n,t){if(n===t)return!0;let r=zy(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(jO,"reaches");function VO(e,n,t,r){let i=new Map(e.nodes.map(d=>[d.id,d])),o=zy(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(VO,"reachedAvoiding");function Wy(e,n){let t=[],r=s(i=>({address:i.address,type:i.type,...i.label!==void 0?{label:i.label}:{},nodeId:i.nodeId}),"toVisible");for(let i of e.nodes)if(_f(e,i.id,n))for(let o of Cr(e,i))t.push(r(o));for(let i of QI)t.push({address:{scope:"env",key:i},type:Ey(i),label:Ty(i),nodeId:null});for(let i of cf(e))t.push({address:{scope:"env",key:uf(i.key)},type:i.type,label:i.label,nodeId:null});return t}s(Wy,"visibleAddressesAt");function ti(e,n){let t=e?.readinessFormFieldsByFormNode?.get(n.owner);if(t!==void 0)return t.get(n.path)??null}s(ti,"formFieldEntryOf");var BO={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"}},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${Eo(e,n.taskKey,t)}\u201C`);let i=n.kind==="binding"?` \u201E${n.at.split(".").pop()}\u201C`:"";return r.push(`${BO[n.kind][t]}${i}`),r.join(" \u203A ")}s(dW,"addressFieldWhere");function $l(e,n,t){let r=dW(e,n,t);return`\u201E${_e(e,n.nodeId,t)}\u201C \u203A ${r}`}s($l,"whereOf");function UO(e,n,t){if(n.scope==="node")return _e(e,n.owner,t);if(n.scope==="task")return Eo(e,n.owner,t)}s(UO,"producerName");function GO(e,n){let t=[],r=new Set,i=s((l,d,c)=>{let u={de:js(l,c("de"),"de"),en:js(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=>xl(l))];for(let l of a){let d=s(c=>$l(e,l,c),"where");for(let c of cW(e,l,i))fW(e,l,c,i)&&(mW(e,l,c,n,i),Ry.has(l.kind)&&!gW(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:je(e,c,u)})))}return yW(e,i),wW(e,a,i),xW(e,i),AW(e,i),t}s(GO,"checkAddresses");function cW(e,n,t){let r=s(i=>$l(e,n,i),"where");if(Iy(n)){let i=Oy(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 Fs(n)}return typeof n.value=="string"?(t("address/bareIdentifier",n.at,i=>({where:r(i),address:n.value})),[]):xe(n.value)?[n.value]:(t("address/shape",n.at,i=>({where:r(i),address:JSON.stringify(n.value)??"undefined"})),[])}s(cW,"checkFieldShape");function zO(e,n,t,r){let i=UO(e,t,r);return{where:$l(e,n,r),address:je(e,t,r),...i!==void 0?{producer:i}:{}}}s(zO,"addressParams");function uW(e,n,t){return Ay(n)||t==="optionalActionWhen"&&($s(e,n)!==void 0||Ht(n))?null:$s(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=>zO(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"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===t.owner))?(e.processStore??[]).some(a=>a.key===t.key)?ni(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):Cr(e,o).some(a=>a.address.scope==="node"&&a.address.key===t.key)?!0:(r(Ry.has(n.kind)&&bt(o)?"address/notFormInstance":"address/unknownKey",n.at,i),!1)}}}s(fW,"resolves");function pW(e,n){return e===void 0||n===void 0||vt(n)===void 0?!0:vt(e)!==void 0&&Af(e,n)}s(pW,"addressTypeFits");function mW(e,n,t,r,i){let o=s(l=>zO(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=Py(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(Py(e,t)!==void 0)return!0;if(t.key!==nt)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(!wr(n))return!1;let t=e.get(n.owner);return t!==void 0&&t.type==="form"&&!bt(t)}s(gW,"isCreatingFormInstance");function yW(e,n){for(let t of e.nodes){let r=new Set(xl(t).map(i=>i.kind));for(let i of nO(t))r.has(i)||n("address/missing",`nodes.${t.id}.${i}`,o=>({where:`\u201E${_e(e,t.id,o)}\u201C \u203A ${BO[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 Fs(i)){if(o.scope!=="node"||o.key!==nt)continue;let a=r.get(i.judgedTogether)??[];a.push({field:i,owner:o.owner}),r.set(i.judgedTogether,a)}for(let[i,o]of r){let a=[...new Set(o.map(l=>l.owner))];a.length<2||t("address/mixedForms",i,l=>({where:$l(e,o[0].field,l),names:a.map(d=>_e(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&&jO(e,n,t)}s(bW,"precedesOnSomePath");function vW(e,n,t,r){let i=$y(t.address);return r.has(pe(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=Ao(e,t);if(r.length===0)continue;let i=new Set(Wy(e,t.id).map(o=>pe(o.address)));for(let o of r){let a=$y(o.address);if(vW(e,t,o,i))continue;let l=a.scope==="task"?ni(e,a.owner,a.key):a.scope==="node"?a.owner:null;n("address/notVisible",o.field.at,d=>({where:$l(e,o.field,d),address:je(e,o.address,d),producer:UO(e,a,d)??je(e,a,d),...l!==null?{producerNode:_e(e,l,d)}:{},reader:_e(e,t.id,d)}))}}}s(xW,"checkVisibility");function SW(e,n){if(n.scope==="env")return Ay(n.key);let t=pe(n);return e.nodes.some(r=>Cr(e,r).some(i=>pe(i.address)===t))}s(SW,"producedSomewhere");function AW(e,n){let t=new Map;for(let r of e.nodes){let i=new Set(Cr(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"||!Ri.test(l)){n("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${_e(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=t.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),t.set(l,d)}}for(let[r,i]of t)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)n("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${_e(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${Eo(e,r,a)}\u201C`,names:i.map(l=>_e(e,l.nodeId,a))}))}s(AW,"checkTaskKeys");function Pf(e,n){return e.label[n]??""}s(Pf,"wordingIn");function Li(e,n){let t=WO(e,n),r=Pf(e.qualifier,n);return t===""||r===""&&Pf(e.qualifier,"de")!==""?"":r===""?t:`${r} \xB7 ${t}`}s(Li,"fieldLabelIn");function WO(e,n){return Pf(e,n)}s(WO,"fieldOwnLabelIn");function Vs(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(Vs,"catalogField");function Bs(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(Bs,"catalogFieldRefusal");function Nf(e,n){let t=e.buses.find(r=>r.key===n);return t||F(`[progress] layout '${e.id}' has no bus '${n}'`),t}s(Nf,"progressBus");function Rl(e,n){return e.states.some(t=>t.id===n)}s(Rl,"isBusState");function YO(e,n){let t=e.terminalSemantics?.[n];return t||F(`[progress] no terminal semantics for state '${n}' on bus '${e.key}'`),t}s(YO,"terminalSemantics");function Cf(e,n){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,n)}s(Cf,"hasTerminalSemantics");function EW(e,n){return(e.boards??[]).find(t=>t.audience===n||t.audience==="both")??null}s(EW,"boardForAudience");function HO(e){return EW(Nf(e,"process"),"internal")}s(HO,"internalProcessBoard");function Us(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(Us,"resolveProgressEvent");var Gs={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},ri=Object.keys(Gs);function $o(e){return Object.hasOwn(Gs,e)}s($o,"isEndNodeOutcome");var Yy={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"],Nue=m.union(...Mi.map(e=>m.literal(e)));function Df(e){return typeof e=="string"&&Mi.includes(e)}s(Df,"isApplicationDataDecision");function Ln(e){return Object.keys(e)}s(Ln,"progressEventsOf");var te=s((e,n)=>({de:e,en:n}),"lt"),Ze=s((e,n,t,r,i=null,o=null)=>({chipLabel:e,tone:n,nextAction:i,affordance:o,title:t,body:r}),"ex"),JO={key:"eingeschrieben",label:te("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},Ff={key:"abgesagt",label:te("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},QO={key:"abgelehnt",label:te("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var ZO={enrolled:{label:te("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:JO,external:Ze(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:Ff,external:Ze(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."))}},XO={role:"effect",effect:"pure",progressDefaults:ZO,progressEvents:Ln(ZO),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:ri.map(e=>({value:e,label:Yy[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")},zs=s((e,n,t,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${n}`,reason:{de:t,en:r},severity:"error"}),"nodeIssue");function Ro(e){let n=e.inputs?.applicationOutcome;return n?.kind==="literal"&&n.value!=null?String(n.value):null}s(Ro,"literalOutcome");function TW(e){if(e.type!=="end")return[];let n=e.inputs?.applicationOutcome;if(n===void 0||n.kind==="unset")return[];let t=Ro(e);return t===null?[zs(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`)]:$o(t)?[]:[zs(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${t}' ist kein Ausgang eines Endknotens (${ri.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 (${ri.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?[zs(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)`)]:Df(n.value)?[]:[zs(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=Ro(e);if(n===null||!$o(n)||n==="approved")return[];let t=e.inputs?.dataDecision;if(t?.kind!=="literal"||t.value!=="commit")return[];let r=Yy[n];return[{...zs(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 e_(e,n){if(!n?.layout||!n.wiring)return[];let t=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=Ro(r);if(i===null||!$o(i))continue;let o=Gs[i],a=Us(n.wiring,r,o);if(a===null)continue;let l=n.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Cf(l,a.state))continue;let d=YO(l,a.state).outcome;d!==i&&t.push(zs(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(e_,"checkEndOutcomeMatchesTerminal");function Ws(e){let n=Ye(e);return typeof n.inputs=="function"?n.inputs(e):[]}s(Ws,"inputSlots");function IW(e,n){return Ws(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"&&xe(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 n_(e){return Ws(e).filter(n=>OW(e,n.id).source==="missing")}s(n_,"missingRequiredInputs");var _W=["personRef","formRef","documentRef","docRef"];function PW(e){let n=Ye(e);return typeof n.inputs!="function"?[]:n.inputs(e).map(t=>({id:t.id,type:t.type}))}s(PW,"listInputs");function t_(e){let n=[];for(let t of e.nodes)for(let r of PW(t))!_W.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(t_,"findParamValueRefSlotErrors");function r_(e){let n=[];for(let t of e.nodes){let r=Ye(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(r_,"findInspectorKindErrors");function i_(e){let n=[];for(let t of e.nodes)for(let r of n_(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(i_,"findMissingRequiredInputs");function Lf(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(Lf,"processStoreKeys");function o_(e){let n=[];for(let t of e.tasks??[]){let r=t.result;if(!(r===void 0||!_s(r)))for(let i of kf(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(o_,"storeWritersOn");function s_(e){let n=new Map;for(let t of e.nodes)for(let r of o_(t)){let i=n.get(r.key)??[];i.push(r),n.set(r.key,i)}return n}s(s_,"processStoreWriters");function NW(e,n,t){for(let r of e.nodes){let i=o_(r).find(o=>o.taskKey===n&&o.key===t);if(i!==void 0)return i}return null}s(NW,"writerAt");function CW(e,n,t){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${t}: ${pe(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(CW,"sourceOfAddress");function a_(e,n){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${pe(n)} is no store address`);let t=Lf(e).find(r=>r.key===n.key);return t===void 0&&F(`[address/unknownKey] ${pe(n)}: "${n.key}" is not declared in processStore`),{key:t.key,type:t.type,label:t.label,audience:t.audience,source:CW(e,n,pe(n))}}s(a_,"processLeafOf");var Hy=new Set(["enum","pricedItem","number","boolean","reduction"]),dt={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function ct(e,n,t,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${n} ${t}`,en:`${n} ${r}`},severity:"error"}}s(ct,"err");function d_(e){let n=[],t=Lf(e),r=new Map(t.map(l=>[l.key,l])),i=new Set;for(let[l,d]of t.entries()){let c=`processStore[${l}]`;if(typeof d.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(d.key)){n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(d.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(d.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}i.has(d.key)&&n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" ist doppelt deklariert.`,`Process key "${d.key}" is declared twice.`)),i.add(d.key),Hy.has(d.type)||n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" hat den Typ "${d.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...Hy].join(", ")}.`,`Process key "${d.key}" has the type "${d.type}" \u2014 the process only stores results with a value: ${[...Hy].join(", ")}.`)),(!d.label?.de?.trim()||!d.label?.en?.trim())&&n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" braucht ein Label in beiden Sprachen.`,`Process key "${d.key}" needs a label in both languages.`)),d.audience!=="internal"&&d.audience!=="printable"&&n.push(ct(c,dt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${d.key}": audience must be 'internal' or 'printable'.`))}let o=s_(e);for(let l of e.nodes)for(let d of l.tasks??[]){let c=d.result;c?.kind==="pricedItem"&&c.writes===void 0&&n.push(ct(`node.${l.id}.tasks.${d.key}.result.writes`,dt.pricedItemWritesNothing,`Aufgabe "${d.key}" (Knoten "${l.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${d.key}" (node "${l.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[l,d]of o){let c=r.get(l);for(let u of d){let p=u.fieldKey===void 0?`node.${u.nodeId}.tasks.${u.taskKey}.result.writes`:`node.${u.nodeId}.tasks.${u.taskKey}.result.fields.${u.fieldKey}.writes`;if(c===void 0){n.push(ct(p,dt.unknownKey,`${u.fieldKey===void 0?"":`Feld "${u.fieldKey}" der `}Aufgabe "${u.taskKey}" schreibt "${l}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${u.fieldKey===void 0?"Task":`Field "${u.fieldKey}" of task`} "${u.taskKey}" writes "${l}", but the workflow declares no such process key (graph.processStore).`));continue}if(u.valueType!==c.type){let h=u.fieldKey===void 0?`Aufgabe "${u.taskKey}"`:`Feld "${u.fieldKey}" der Aufgabe "${u.taskKey}"`,k=u.fieldKey===void 0?`Task "${u.taskKey}"`:`Field "${u.fieldKey}" of task "${u.taskKey}"`;n.push(ct(p,dt.writerTypeMismatch,`${h} liefert ${u.valueType}, der Vorgangs-Schl\xFCssel "${l}" ist aber als ${c.type} deklariert.`,`${k} delivers ${u.valueType}, but the process key "${l}" is declared as ${c.type}.`))}}if(d.length>1){let u=d.map(p=>`${p.nodeId}/${p.taskKey}${p.fieldKey===void 0?"":`.${p.fieldKey}`}`).join(", ");n.push(ct(`processStore.${l}`,dt.secondWriter,`Vorgangs-Schl\xFCssel "${l}" wird ${d.length}-mal geschrieben (${u}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${l}" is written ${d.length} times (${u}) \u2014 exactly one writer per key.`))}}for(let l of t)o.has(l.key)||n.push(ct(`processStore.${l.key}`,dt.noWriter,`Vorgangs-Schl\xFCssel "${l.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${l.key}" is declared, but no task writes it ('result.writes').`));let a=new Map;for(let l of e.nodes){let d=Ye(l),c=typeof d.inputs=="function"?d.inputs(l):[];for(let u of c){let p=l.inputs?.[u.id];if(p?.kind!=="binding")continue;let h=DW(e,p.address);if(h===null)continue;let k=`node.${l.id}.input.${u.id}`,b=pe(p.address),y=a.get(h.source.key)??new Set;y.add(l.id),a.set(h.source.key,y),h.audience==="internal"&&n.push(ct(k,dt.internalInDocument,`${l.label.de}: "${u.id}" liest den internen Vorgangs-Schl\xFCssel "${h.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${l.label.en}: "${u.id}" reads the internal process key "${h.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`));let v=FW(o,h.source.key,h.source.taskKey);if(v.template.when!==void 0&&u.required===!0&&u.defaultValue===void 0&&n.push(ct(k,dt.absentWithoutDefault,`${l.label.de}: "${u.id}" ist Pflicht und an ${b} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${l_(v.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${l.label.en}: "${u.id}" is required and bound to ${b}, but the writing task only exists under a condition (when: ${l_(v.template.when)}) \u2014 without a default value the field would stay empty forever.`)),v.result.kind==="pricedItem"&&u.defaultValue!==void 0){let A=u.defaultValue;(!_i(A)||A.itemKey!==v.result.item||A.grantKeys.length>0)&&n.push(ct(k,dt.defaultItemMismatch,`${l.label.de}: der Vorgabewert von "${u.id}" muss der Artikel der schreibenden Aufgabe ohne Erm\xE4\xDFigung sein ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 sonst rechnete die Familie ohne Antrag einen anderen Artikel als mit.`,`${l.label.en}: the default value of "${u.id}" must be the article of the writing task without a reduction ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 otherwise the family would be charged a different article without an application than with one.`))}}}for(let[l,d]of a){let c=o.get(l)[0],u=c.template.blocks,p=u===void 0?void 0:u.node??c.nodeId,h=p!==void 0&&(()=>{let b=e.nodes.find(y=>y.id===p);return b!==void 0&&Ye(b).processHoldTemplate?.(b)===u.templateKey})(),k=`node.${c.nodeId}.tasks.${c.taskKey}.blocks`;if(!h){let b=[...d][0],y=e.nodes.find(A=>A.id===b),v=Ye(y).processHoldTemplate?.(y)??"?";n.push(ct(k,dt.writerMustBlock,`Die Aufgabe "${c.taskKey}" schreibt "${l}", h\xE4lt aber keinen der lesenden Knoten (${[...d].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${b===c.nodeId?"":`node: '${b}', `}templateKey: '${v}' }, sonst arbeitet er, bevor der Wert existiert.`,`The task "${c.taskKey}" writes "${l}" but holds back none of the reading nodes (${[...d].join(", ")}) \u2014 it must block the first one, e.g. blocks: { ${b===c.nodeId?"":`node: '${b}', `}templateKey: '${v}' }, otherwise it works before the value exists.`));continue}for(let b of d)b===p||_f(e,p,b)||n.push(ct(k,dt.writerMustBlock,`"${b}" liest "${l}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${p}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${b}" reads "${l}" but does not lie behind the held-back node "${p}" \u2014 on a path past it, it would read the value before it is settled.`))}return n}s(d_,"processBindingIssues");function DW(e,n){return!xe(n)||n.scope!=="task"||n.path!==void 0||!Lf(e).some(t=>t.key===n.key)||ni(e,n.owner,n.key)===null?null:a_(e,n)}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 l_(e){return xe(e)?pe(e):JSON.stringify(e)}s(l_,"shown");function Jy(e){let n=Ye(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:n.outcomes&&n.outcomes.length>0?[...n.outcomes]:null}s(Jy,"nodeOutcomes");var LW=["documentChangeRequested","documentReturned","coverLetterConfirmed","coverLetterRevisionRequested"];function c_(e){return LW.includes(e)}s(c_,"isNonAdvancingExternalEvent");var Ys=["offer","contract"];function Mf(e){return typeof e=="string"&&Ys.includes(e)}s(Mf,"isArtifactSlotType");var u_="open",Hs="done";function Qy(e){let n={};for(let t of ze)n[t]=e(t);return n}s(Qy,"localized");var f_=[{key:"tenantSlug",type:"string"}];var MW=/^(\d{4})-(\d{2})-(\d{2})$/;function qW(e){return e>=1900&&e<=2100}s(qW,"isSupportedYear");function KW(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(KW,"isRealDate");function Zy(e){if(typeof e!="string")return null;let n=MW.exec(e);if(n===null)return null;let[,t,r,i]=n;return t===void 0||r===void 0||i===void 0||!qW(Number(t))||!KW(Number(t),Number(r),Number(i))?null:{year:t,month:r,day:i}}s(Zy,"isoDateParts");var jW="Europe/Berlin";function m_(){return jW}s(m_,"tenantTimeZone");var p_=new Map;function VW(e){let n=p_.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{ae("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return p_.set(e,t),t}s(VW,"formatterFor");function BW(e,n){let t=new Map(VW(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(BW,"zoneOffsetAt");function Xy(e,n){let t=e+BW(n,e);return{wallClock:new Date(t).toISOString().slice(0,19),timeZone:n}}s(Xy,"instantToLocalDateTime");var ew=3;function h_(e){return Xy(e,m_()).wallClock.slice(0,10)}s(h_,"localIsoDate");var qf=["login","security","admission","tasks","deadlines","schoolMessages","staffAssigned","staffTeamQueue","staffFeedback","staffAppointments","staffDeadlines","staffWaitlist","staffUnassigned","familyMessages","mentions"],g_=m.union(...qf.map(e=>m.literal(e)));var Ufe=m.union(m.literal("admission"),m.literal("tasks"),m.literal("staff"),m.literal("chat")),nw=["loginOnly","all"],Gfe=m.union(m.literal("loginOnly"),m.literal("all"));function y_(e){return typeof e=="string"&&nw.includes(e)}s(y_,"isMailLevel");var Il="subject";function w_(e){return e.category==="login"}s(w_,"isSignInLetter");var dn={key:"schoolName",label:"Name der Schule"},b_={de:"Zu Ihren Bewerbungen",en:"View your applications"},vn={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:b_},tw={key:vn.key,label:vn.label,link:!0,actionLabel:b_},v_={key:"authorName",label:"Name der schreibenden Person"},Io={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},Ol={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"}},GW={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"}},x_={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"}},_l={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},S_={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},zW={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function Re(e){return{key:Il,label:"Betreff",default:e}}s(Re,"subjectSlot");var qi=m.object({de:m.string(),en:m.string()}),Sn={tenantSlug:m.string(),applicationId:m.id("applications")},WW=m.object({tenantSlug:m.string()}),YW={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:WW,channels:["email"],portalVisible:!0,placeholders:[dn,vn],slots:[Re({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:
|
|
10965
10965
|
|
|
10966
10966
|
{{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
|
|
10967
10967
|
|
|
@@ -11033,15 +11033,15 @@ You can check the current status at any time here:
|
|
|
11033
11033
|
|
|
11034
11034
|
{{applicationLink}}`,en:`Please assign the task to a person in the application:
|
|
11035
11035
|
|
|
11036
|
-
{{applicationLink}}`}}]},A_=m.object({tenantSlug:m.string(),recipientUserId:m.id("users"),workItemId:m.id("work_items"),taskTitle:m.string()});var rw={key:"taskLink",label:"Link zur Aufgabe",required:!0,link:!0,actionLabel:{de:"Aufgabe \xF6ffnen",en:"Open task"}},jf={...Js,subjectSafe:!0},g1={id:"staff.taskAssigned",category:"
|
|
11036
|
+
{{applicationLink}}`}}]},A_=m.object({tenantSlug:m.string(),recipientUserId:m.id("users"),workItemId:m.id("work_items"),taskTitle:m.string()});var rw={key:"taskLink",label:"Link zur Aufgabe",required:!0,link:!0,actionLabel:{de:"Aufgabe \xF6ffnen",en:"Open task"}},jf={...Js,subjectSafe:!0},g1={id:"staff.taskAssigned",category:"staffAssigned",label:"Aufgabe zugewiesen",occasion:{de:"Sobald einer Person eine Aufgabe zugewiesen wird (nicht bei Selbstzuweisung)",en:"When a task is assigned to a person (not when they take it themselves)"},audience:"internal",frame:"notice",timeline:"hidden",paramsValidator:A_,channels:["email"],portalVisible:!1,placeholders:[jf,rw],slots:[Re({de:"Neue Aufgabe: {{taskTitle}}",en:"New task: {{taskTitle}}"}),{key:"intro",label:"Einleitung",multiline:!0,default:{de:"Ihnen wurde diese Aufgabe zugewiesen:",en:"This task has been assigned to you:"}},{key:"outro",label:"Abschluss",multiline:!0,default:{de:`Direkt zur Aufgabe:
|
|
11037
11037
|
|
|
11038
11038
|
{{taskLink}}`,en:`Go straight to the task:
|
|
11039
11039
|
|
|
11040
|
-
{{taskLink}}`}}]},y1=m.object({tenantSlug:m.string(),recipientUserId:m.id("users"),workItemId:m.id("work_items"),teamId:m.id("permission_groups"),taskTitle:m.string(),teamLabel:m.string()}),w1={key:"teamLabel",label:"Team",subjectSafe:!0},k1={id:"staff.teamTaskQueued",category:"
|
|
11040
|
+
{{taskLink}}`}}]},y1=m.object({tenantSlug:m.string(),recipientUserId:m.id("users"),workItemId:m.id("work_items"),teamId:m.id("permission_groups"),taskTitle:m.string(),teamLabel:m.string()}),w1={key:"teamLabel",label:"Team",subjectSafe:!0},k1={id:"staff.teamTaskQueued",category:"staffTeamQueue",label:"Aufgabe f\xFCr ein Team",occasion:{de:"Sobald eine Aufgabe ohne Bearbeiter in der Queue eines Teams landet \u2014 an jedes Mitglied",en:"When a task lands in a team's queue with nobody holding it \u2014 to every member"},audience:"internal",deputyCopy:!1,frame:"notice",timeline:"hidden",paramsValidator:y1,channels:["email"],portalVisible:!1,placeholders:[jf,w1,rw],slots:[Re({de:"Neue Aufgabe f\xFCr {{teamLabel}}: {{taskTitle}}",en:"New task for {{teamLabel}}: {{taskTitle}}"}),{key:"intro",label:"Einleitung",multiline:!0,default:{de:"Diese Aufgabe liegt jetzt in der Queue Ihres Teams {{teamLabel}}:",en:"This task is now in the queue of your team {{teamLabel}}:"}},{key:"outro",label:"Abschluss",multiline:!0,default:{de:`Direkt zur Aufgabe:
|
|
11041
11041
|
|
|
11042
11042
|
{{taskLink}}`,en:`Go straight to the task:
|
|
11043
11043
|
|
|
11044
|
-
{{taskLink}}`}}]},b1=m.object({tenantSlug:m.string(),recipientUserId:m.id("users"),workItemId:m.id("work_items"),taskTitle:m.string()}),v1={id:"staff.paymentReported",category:"
|
|
11044
|
+
{{taskLink}}`}}]},b1=m.object({tenantSlug:m.string(),recipientUserId:m.id("users"),workItemId:m.id("work_items"),taskTitle:m.string()}),v1={id:"staff.paymentReported",category:"staffTeamQueue",label:"\xDCberweisung gemeldet",occasion:{de:"Wenn eine Familie meldet, dass sie die Geb\xFChr \xFCberwiesen hat \u2014 an das Team, das den Zahlungseingang best\xE4tigt",en:"When a family reports that it has transferred the fee \u2014 to the team that confirms the payment"},audience:"internal",deputyCopy:!1,frame:"notice",timeline:"hidden",paramsValidator:b1,channels:["email"],portalVisible:!1,placeholders:[jf,rw],slots:[Re({de:"\xDCberweisung gemeldet: {{taskTitle}}",en:"Transfer reported: {{taskTitle}}"}),{key:"intro",label:"Einleitung",multiline:!0,default:{de:"Die Familie meldet, dass sie die Geb\xFChr \xFCberwiesen hat. Bitte pr\xFCfen Sie den Zahlungseingang und best\xE4tigen Sie ihn in dieser Aufgabe:",en:"The family reports that it has transferred the fee. Please check that the payment has arrived and confirm it in this task:"}},{key:"outro",label:"Abschluss",multiline:!0,default:{de:`Direkt zur Aufgabe:
|
|
11045
11045
|
|
|
11046
11046
|
{{taskLink}}`,en:`Go straight to the task:
|
|
11047
11047
|
|
|
@@ -11049,7 +11049,7 @@ You can check the current status at any time here:
|
|
|
11049
11049
|
|
|
11050
11050
|
Der Link gilt 30 Tage und antwortet in Ihrem Namen. Bitte leiten Sie diese E-Mail nicht weiter.`,en:`{{feedbackLink}}
|
|
11051
11051
|
|
|
11052
|
-
The link is valid for 30 days and answers in your name. Please do not forward this email.`}}]},E1=m.object({tenantSlug:m.string(),contractId:m.id("contracts")}),T1={key:"contractLink",label:"Link zum Vertrag",required:!0,link:!0,actionLabel:{de:"Vertrag \xF6ffnen",en:"Open contract"}},$1={id:"staff.coverLetterAnswered",category:"
|
|
11052
|
+
The link is valid for 30 days and answers in your name. Please do not forward this email.`}}]},E1=m.object({tenantSlug:m.string(),contractId:m.id("contracts")}),T1={key:"contractLink",label:"Link zum Vertrag",required:!0,link:!0,actionLabel:{de:"Vertrag \xF6ffnen",en:"Open contract"}},$1={id:"staff.coverLetterAnswered",category:"staffAssigned",label:"Antwort auf ein Schreiben",occasion:{de:"Wenn eine Familie ein Schreiben zu einem einzelnen Vertrag beantwortet \u2014 an die Person, die gefragt hat",en:"When a family answers a letter on a contract without an application \u2014 to the person who asked"},audience:"internal",frame:"notice",timeline:"hidden",paramsValidator:E1,channels:["email"],portalVisible:!1,placeholders:[T1],slots:[Re({de:"Antwort auf Ihr Schreiben zu einem Vertrag",en:"An answer to your letter on a contract"}),{key:"intro",label:"Einleitung",multiline:!0,default:{de:`Die Familie hat das Schreiben zu einem Vertrag beantwortet. Der n\xE4chste Schritt liegt bei Ihnen.
|
|
11053
11053
|
|
|
11054
11054
|
{{contractLink}}`,en:`The family has answered the letter on a contract. The next step is yours.
|
|
11055
11055
|
|
|
@@ -11475,6 +11475,6 @@ ${t.length} unusable ${o}:
|
|
|
11475
11475
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11476
11476
|
`),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>
|
|
11477
11477
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11478
|
-
`);return t.length>0?1:0}},HE=class extends cr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function $V(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s($V,"requireOnOff");var RV=[PE,NE,CE,DE,FE,LE,ME,qE,KE,jE,ou,VE,BE,UE,GE,zE,WE,YE,HE];function IV(e){return e.de??e.en??Object.values(e)[0]??""}s(IV,"titleDe");function c9(e){return{id:e._id,kind:e.kind,status:e.status,title:IV(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(c9,"row");var u9=["id","kind","status","title","assignee","group","outcome"],ZE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(c9),u9),0}},XE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:IV(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}},eT=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},nT=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},tT=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},OV=[ZE,XE,eT,nT,tT];var su=[...FR,...LC,...YC,...JD,...HD,...xF,...IF,...RF,...EV,...RV,...AV,...cj,...gj,...vC,...wF,...pV,...CR,...lI,...sC,...PF,..._F,...DF,...FF,...gF,...tF,...OV,...iq,...Wq,...lj,...Yq,...Jj,...iV,...yj,...Tj,...Ij,...Nj,...Dj,...aV,...yV,...ZR];for(let e of su){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:r$(e.usage.category,n.join(" "))})}var _V="0.1.161";function PV(){return su.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=XT[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(PV,"plexusCommandCatalog");import ss from"node:path";function f9(e){let n=ln()?.workspaceRoot??process.cwd(),t=ss.resolve(n,e),r=ss.relative(n,t);if(ss.isAbsolute(e)||r===".."||r.startsWith(`..${ss.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(f9,"workspacePath");function p9(e){let{absolute:n,relative:t}=f9(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Rr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=ss.join(o,a.name);if(a.isDirectory()?i(l):r.push(ss.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 Ge(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Fn(ss.dirname(n),{recursive:!0}),Ge(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return cs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(p9,"plexusWorkspace");function NV(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=hl[t];if(!o||!Object.hasOwn(hl,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(Yg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Yg[i.path],skillHash:ef}}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 p9(i)},"executePlexusAgentTool")}s(NV,"createPlexusAgentToolExecutor");var Nh=NV({inspectCommand:DV,executeCommand:FV});function Ch(){let e=new ms({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_V});e.register(Za.HelpCommand),e.register(Za.VersionCommand);for(let t of su)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 g9(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(Ch,"createPlexusCli");function g9(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&rl[t]===r&&sn(n,t,r),t in rl&&co(t)==="confirm"&&!il(e)&&n.write(`plexus-cli: \`${rl[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11478
|
+
`);return t.length>0?1:0}},HE=class extends cr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function $V(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s($V,"requireOnOff");var RV=[PE,NE,CE,DE,FE,LE,ME,qE,KE,jE,ou,VE,BE,UE,GE,zE,WE,YE,HE];function IV(e){return e.de??e.en??Object.values(e)[0]??""}s(IV,"titleDe");function c9(e){return{id:e._id,kind:e.kind,status:e.status,title:IV(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(c9,"row");var u9=["id","kind","status","title","assignee","group","outcome"],ZE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(c9),u9),0}},XE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:IV(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}},eT=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},nT=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},tT=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},OV=[ZE,XE,eT,nT,tT];var su=[...FR,...LC,...YC,...JD,...HD,...xF,...IF,...RF,...EV,...RV,...AV,...cj,...gj,...vC,...wF,...pV,...CR,...lI,...sC,...PF,..._F,...DF,...FF,...gF,...tF,...OV,...iq,...Wq,...lj,...Yq,...Jj,...iV,...yj,...Tj,...Ij,...Nj,...Dj,...aV,...yV,...ZR];for(let e of su){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:r$(e.usage.category,n.join(" "))})}var _V="0.1.162";function PV(){return su.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=XT[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(PV,"plexusCommandCatalog");import ss from"node:path";function f9(e){let n=ln()?.workspaceRoot??process.cwd(),t=ss.resolve(n,e),r=ss.relative(n,t);if(ss.isAbsolute(e)||r===".."||r.startsWith(`..${ss.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(f9,"workspacePath");function p9(e){let{absolute:n,relative:t}=f9(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Rr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=ss.join(o,a.name);if(a.isDirectory()?i(l):r.push(ss.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 Ge(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Fn(ss.dirname(n),{recursive:!0}),Ge(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return cs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(p9,"plexusWorkspace");function NV(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=hl[t];if(!o||!Object.hasOwn(hl,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(Yg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Yg[i.path],skillHash:ef}}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 p9(i)},"executePlexusAgentTool")}s(NV,"createPlexusAgentToolExecutor");var Nh=NV({inspectCommand:DV,executeCommand:FV});function Ch(){let e=new ms({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_V});e.register(Za.HelpCommand),e.register(Za.VersionCommand);for(let t of su)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 g9(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(Ch,"createPlexusCli");function g9(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&rl[t]===r&&sn(n,t,r),t in rl&&co(t)==="confirm"&&!il(e)&&n.write(`plexus-cli: \`${rl[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11479
11479
|
`)}s(g9,"noteRetiredPath");function DV(e){let n=Ch().process(Ba(e),{executePlexusAgentTool:Nh}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=PV().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"?im(xa(Sa),i.fn??"",i.kind):void 0,a=ju(t,{confirm:il(n),callKind:o});return{...r,writes:a}}s(DV,"inspectPlexusCommand");async function FV(e,n){if(n)return oT(n,()=>FV(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=Ch();if(ln()){let l=DV(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(Ba(e.argv),{executePlexusAgentTool:Nh,stdin:h9.from(e.stdin===void 0?[]:[e.stdin]),stdout:new CV({write(l,d,c){t+=String(l),c()}}),stderr:new CV({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(FV,"executePlexusCommand");cT({source:y9.join(import.meta.dirname,"skill")});Ch().runExit(Ba(process.argv.slice(2)),{executePlexusAgentTool:Nh});
|
|
11480
11480
|
//# sourceMappingURL=cli.mjs.map
|