@smartkomm/plexus-cli 0.1.123 → 0.1.125
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
|
@@ -10521,15 +10521,13 @@ plexus-cli --env <env> --tenant <slug> tenant-users signature request <email>
|
|
|
10521
10521
|
|
|
10522
10522
|
Only the person can store, replace or remove their own signature.
|
|
10523
10523
|
|
|
10524
|
-
Only where the school
|
|
10525
|
-
default on): switched off, the request is refused (\`[signature/stampDisabled]\`),
|
|
10524
|
+
Only where the school has the **signature stamp** (\`tenant.signatureStamp\`): switched off, the request is refused (\`[signature/stampDisabled]\`),
|
|
10526
10525
|
\`tenant-users list\` / \`show\` drop the \`signature\` column, and a countersignature
|
|
10527
|
-
takes only the upload of the signed document.
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
config-as-code").
|
|
10526
|
+
takes only the upload of the signed document. A school cannot switch it: a
|
|
10527
|
+
platform admin does (\`_platform.config.manage\`), through the config field
|
|
10528
|
+
\`tenant.signatureStamp\` (\`config set \u2026 --target tenant --key <slug> --field
|
|
10529
|
+
signatureStamp --value false --confirm\`, see the README's \u201ETenant
|
|
10530
|
+
config-as-code"); Plattform \u2192 Mandanten shows the value.
|
|
10533
10531
|
|
|
10534
10532
|
Off keeps every stored signature image (nothing is deleted, none is used); on
|
|
10535
10533
|
again, it stamps as before. Decided per school: a person working for two
|
|
@@ -10852,7 +10850,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
|
|
|
10852
10850
|
## Related
|
|
10853
10851
|
- Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
|
|
10854
10852
|
\`plexus-cli platform imports cleanup-orphaned --help\`.
|
|
10855
|
-
`};var Yu="f6aafb013c32aeb0c313088112b391a760c5ee7b2af78ac486631f98247a3e52",qg=ER;var Kg=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=$.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Yu,tools:al}),0}},jg=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=$.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await Mg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},TR=[Kg,jg];var Bg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],sae=new Set(Bg.map(e=>e.key));function RR(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(RR,"resolveStartTarget");function FG(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(FG,"applicantText");function IR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:FG(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(IR,"applicationRows");var $R=Bg.map(e=>e.email);function OR(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(Dg(e,n)&&(r===void 0||!$R.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${$R.join(", ")} (--applicant) \u2014 never a real family's`)}s(OR,"assertStartApplicant");function PR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(PR,"processStoreJson");function LG(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.revisionNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(LG,"refText");function MG(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?LG(e.ref):JSON.stringify(e.value)}s(MG,"holds");function _R(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:MG(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(_R,"storeRows");function Hu(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(Hu,"parseKv");var NR="started",Ju="submitted",Qu="submitted",CR="load-scenario:";var DR="(Bewerbung)";function FR(e){return{nodeId:DR,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(FR,"sharedAsList");function LR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(LR,"disabledText");function MR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:LR(r)})))}s(MR,"actionRows");function qR(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: ${LR(a)}`);if(i!==DR)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(qR,"nodeOfferingAction");function KR(e,n,t){if(e.startsWith(CR)){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(KR,"runParams");async function qG(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(qG,"currentNodeIds");function KG(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(KG,"refusalText");async function Zu(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${KG(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,FR(r.actions)]}s(Zu,"actionsOf");async function jR(e,n,t){return t!==void 0?[t]:await qG(e,n)}s(jR,"nodesOf");var Ug=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=$.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await Zu(n,this.application,await jR(n,this.application,this.node));return this.print(t,MR,["node","action","label","disabled"]),0}},Vg=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=$.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=KR(this.action,this.autoSubmit,Hu(this.param??[]).values),t=await this.caller(),r=this.application,i=await jR(t,this.application,this.node),o=qR(await Zu(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}},BR=[Ug,Vg];var We=["de","en"];function hs(e,n){return We.every(t=>e[t]===n[t])}s(hs,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!We.includes(r))?"not-localized":We.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function $i(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s($i,"isLocalizedText");function ll(e,n){let t={};for(let r of We){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(ll,"composeTexts");var fr=/^[a-z][A-Za-z0-9]*$/;function Gg(e){return typeof e=="string"&&fr.test(e)}s(Gg,"isNodeId");function gs(e,n){Gg(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${fr.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(gs,"makeNodeId");var Ri="$env";function se(e){if(e.scope==="env")return`${Ri}.${e.key}`;let n=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(se,"formatAddress");var Cr=/^[a-z][a-zA-Z0-9_]*$/,jG=/^[A-Za-z_][A-Za-z0-9_]*$/;function po(e){return typeof e=="string"&&e.split(".").every(n=>jG.test(n))}s(po,"isPath");function Zr(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&&po(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Cr.test(i)?null:UR({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Cr.test(o)||(t==="node"?!fr.test(i):!Cr.test(i))?null:UR({scope:t,owner:i,key:o},a)}default:return null}}s(Zr,"tryParseAddress");function UR(e,n){if(n.length===0)return e;let t=n.join(".");return po(t)?{...e,path:t}:null}s(UR,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:n.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!po(n.path))return!1;switch(n.scope){case"env":return po(n.key);case"derived":return typeof n.key=="string"&&Cr.test(n.key);case"node":return typeof n.owner=="string"&&fr.test(n.owner)&&typeof n.key=="string"&&Cr.test(n.key);case"task":return typeof n.owner=="string"&&Cr.test(n.owner)&&typeof n.key=="string"&&Cr.test(n.key);default:return!1}}s(we,"isAddress");var Xr={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"}},ys=Object.keys(Xr);function ws(e){return Object.hasOwn(Xr,e)}s(ws,"isEnvKey");var BG=["self-service","staff"];function VR(e,n){return{kind:"fixed",values:e,labels:n}}s(VR,"fixedSet");var Xu={of:"applicant.language",withoutValue:"de"},ei={"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:Xu},"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:Xu},"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:Xu},"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:Xu},"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:VR(We,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:VR(BG,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},ef={types:Xr,fields:ei},nf=ys.flatMap(e=>Object.keys(Xr[e]).map(n=>`${e}.${n}`));function Wt(e){return Object.hasOwn(ei,e)}s(Wt,"isEnvLeaf");function tf(e){return`${Ri}.${e}`}s(tf,"envIdentifier");function mo(e){let n=ei[e],[t,r]=e.split("."),i=Xr[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(mo,"envLeaf");var GR="staffInput";var UG=["boolean"],dl=/^[a-z][A-Za-z0-9]*$/;function rf(e){return e.staffInputs??[]}s(rf,"staffInputsOf");function of(e){return`${GR}.${e}`}s(of,"staffInputLeaf");function zR(e){return`${Ri}.${of(e)}`}s(zR,"staffInputIdentifier");function VG(e){let n=`${GR}.`;return e.startsWith(n)?e.slice(n.length):null}s(VG,"staffInputKeyOfLeaf");function ks(e,n){let t=VG(n);return t===null?void 0:rf(e).find(r=>r.key===t)}s(ks,"declaredStaffInput");function WR(e){return[...rf(e).map(n=>({leaf:of(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...nf.map(n=>{let t=mo(n);return{leaf:n,type:t.type,label:t.label,valueSet:ei[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(WR,"envLeavesFor");function YR(e){return WR(e).filter(n=>!n.cohortBound)}s(YR,"conditionEnvLeaves");function HR(e){return QR(YR(e))}s(HR,"envConditionSchemaFor");function GG(e){return WR(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(GG,"offerConditionEnvLeaves");function JR(e){return QR(GG(e))}s(JR,"offerConditionSchemaFor");function QR(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(QR,"schemaOfLeaves");function ZR(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}"`};dl.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),UG.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(ZR,"staffInputIssues");var ny={required:!0,description:"Offer slug (its offerKey)"},zg=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=$.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",ny);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=IR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},Wg=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=$.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",ny);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}},Yg=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=$.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},Hg=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=$.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $derived\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(PR(t),()=>_R(t),["address","state","holds","producer","written"]),0}},Jg=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=$.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",ny);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();OR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=RR(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:eI(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 Zu(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}},Qg=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=$.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=zG(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 zG(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(zG,"parseDays");var Zg=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=$.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},Xg=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=$.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},ey=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=$.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=eI([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}},XR=[zg,Wg,Yg,Hg,Jg,Qg,Zg,Xg,ey];function eI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!dl.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(eI,"parseStaffInputs");var Un="contractGenerator",ho="documentTemplate";function cl(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(cl,"isGeneratorRef");function nI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(nI,"literalOf");function ni(e){let n=nI(e,Un);return cl(n)?n:null}s(ni,"generatorRefOfNode");function pr(e){let n=nI(e,ho);return typeof n=="string"&&n.length>0?n:null}s(pr,"documentTemplateKeyOfNode");function tI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(tI,"generatorRefLabel");var WG=["formExports","generatorStamp"];function rI(e,n,t){let r=e.inputs?.[Un];(r?.kind!=="literal"||!cl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Un} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Un]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts}}}s(rI,"applyGeneratorStamp");var YG=["reads"];function bs(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 WG)delete r[i];for(let i of YG)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(bs,"comparableWorkflowGraph");var ul={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 sf(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=ul[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(sf,"manifestIssues");function HG(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(HG,"validateProgressLayoutExternalCopy");function iI(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"]:HG(e)}s(iI,"progressLayoutIssues");var oI=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var JG=new Set(["sections","effects","outcomes","testScenarios","env"]),af={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 sI(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(JG.has(i))continue;let o=af[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(sI,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Ii(e){return typeof e=="string"&&bt.includes(e)}s(Ii,"isOutcomeSemantic");var Yt=["arrival","manual"],aI={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function QG(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(QG,"literal");function ty(e){let n=QG(e,"waitlistOrder");return Yt.includes(n)?{waitlistOrder:n}:null}s(ty,"waitlistPolicyOrNull");var wn="responsible",ry="team:";function lf(e){return`${ry}${e}`}s(lf,"teamSlot");function df(e){return e.startsWith(ry)?e.slice(ry.length):null}s(df,"teamKeyOfSlot");function lI(e){return e.kind==="responsible"?wn:lf(e.groupKey)}s(lI,"slotIdOf");function cf(e){if(e===wn)return{kind:"responsible"};let n=df(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(cf,"slotOfId");var iy="review",oy="checkField",dI="reviewed",cI="reviewing",uf=["rejected","waitlisted"];function sy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(sy,"isObject");var ZG=new Set(["decision",iy]),uI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function ay(e){return Object.hasOwn(uI,e)?uI[e]:void 0}s(ay,"legacySemanticOfId");function XG(e){return e===iy?bt.filter(n=>!uf.includes(n)):bt}s(XG,"allowedSemanticsFor");var ez="other";function fI(e){return sy(e)&&ZG.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(fI,"outcomesOf");function pI(e){return(e?.nodes??[]).some(n=>fI(n).some(t=>sy(t)&&!("semantic"in t)))}s(pI,"needsOutcomeSemantics");function mI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=fI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=XG(u),m=!1,y=l.map(k=>{if(!sy(k))return k;let g=String(k.id);if("semantic"in k)return Ii(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let v=`${c}.${g}`,E=Object.hasOwn(n,v)?n[v]:void 0;if(E!==void 0)return p.includes(E)?(t.push({nodeId:c,outcomeId:g,semantic:E,source:"answer"}),m=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:p,answer:E}),k);let A=ay(g),I=A??ez;return p.includes(I)?(t.push({nodeId:c,outcomeId:g,semantic:I,source:A===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:I}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:p}),k)});return m?{...d,outcomes:y}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(mI,"addOutcomeSemantics");var mr="bewerbungOffen";function go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(go,"isObject");var ly=["event","effect"];function hI(e){return go(e)&&e.type==="eventTrigger"}s(hI,"isTrigger");function gI(e){let n=go(e.inputs)?e.inputs:{};return"outcomes"in e||ly.some(t=>t in e||t in n)}s(gI,"oldShape");function yI(e){return(e?.nodes??[]).some(n=>hI(n)&&gI(n))}s(yI,"needsEventTriggerStartMove");function nz(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>go(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===mr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(go(e.next)?e.next:{});if(!(i.length===1&&i[0]===mr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=go(e.inputs)?{...e.inputs}:{};for(let l of ly){let d=o[l];if(go(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of ly)delete a[l],delete o[l];return go(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(nz,"moveNode");function wI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!hI(i)||!gI(i))return i;let o=nz(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(wI,"moveEventTriggerStart");function fl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(fl,"isObject");var kI={waitlistOrder:"arrival"};function bI(e){return!fl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(fl(e.inputs)?e.inputs:{}))}s(bI,"lacksPolicy");function tz(e){return(e?.nodes??[]).some(bI)}s(tz,"needsWaitlistPolicyMove");function dy(e){return fl(e)&&Yt.includes(e.waitlistOrder)}s(dy,"isWaitlistPolicy");function rz(e){if(e===void 0)return{policy:kI,stated:!1};if(!fl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Yt.includes(n)?"malformed":{policy:{waitlistOrder:n??kI.waitlistOrder},stated:n!==void 0}}s(rz,"policyOfSelection");function vI(e,n,t={}){let r=[],i=[];if(!tz(e))return{graph:e,moved:r,refused:i};let o=rz(n),a=e.nodes.map(l=>{if(!bI(l))return l;let d=l,c=String(d.id),u=fl(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,m,y;if(p!==void 0)m=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},r.push({nodeId:c,policy:m,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(vI,"moveWaitlistPolicyToInputs");function yo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(yo,"isObject");var iz=[Un,ho],oz=["inputSchema","parties","schemaDigest","parts"];function xI(e){return yo(e)&&e.type==="governedDocument"&&("resolver"in e||yo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(xI,"oldShape");function SI(e){return(e?.nodes??[]).some(xI)}s(SI,"needsGeneratorInputMove");function sz(e){let n=yo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!yo(i))return{unmoved:"resolverNotObject"};if(Un 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((yo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>yo(d)&&iz.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Un]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(oz.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(yo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ho in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[ho]={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(sz,"moveNode");function AI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!xI(i))return i;let o=sz(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(AI,"moveGeneratorPinsToInputs");var EI=/^\d{4}-\d{2}-\d{2}$/;function hr(e,n){return{de:e,en:n}}s(hr,"issue");function wo(e){if(typeof e!="object"||e===null)return hr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:hr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return hr(`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?hr("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"||!EI.test(r)?hr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!EI.test(i)?hr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?hr("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)?hr("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))?hr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?hr("unbekannte Angaben","unknown details"):null:hr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(wo,"reductionShapeIssue");function Oi(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||wo(n.reduction)===null&&n.reduction.kind==="amount")}s(Oi,"isPricedItemValue");var vs=["freetext","recommendation","choice","pricedItem","record","reduction"],xs=[...vs,"appointment"];function $I(e){return typeof e=="string"&&xs.includes(e)}s($I,"isTaskResultKind");function Pi(e){return typeof e=="string"&&vs.includes(e)}s(Pi,"isRecordedTaskResultKind");function Ss(e){return Pi(e.kind)}s(Ss,"isRecordedTaskResult");var ff=["number","boolean","enum"];function cy(e){return typeof e=="string"&&ff.includes(e)}s(cy,"isRecordFieldType");var uy=["form","siblingRank"];var ti={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 RI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(RI,"isProseResult");function pf(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&cy(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):az(e)}s(pf,"draftResultStoreWrites");function az(e){let n=ti[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(az,"singleStoreWrite");var TI="team:";function As(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(TI)){let n=e.slice(TI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(As,"parseTaskResultChat");var Ze={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var lz=new Set(["if","else","in","true","false","null"]),dz=new Set(["==","!=","<=",">=","&&","||"]);function cz(e){return e>="0"&&e<="9"}s(cz,"isDigit");function uz(e){return/[a-zA-Z_$]/.test(e)}s(uz,"isIdentStart");function fz(e){return/[a-zA-Z0-9_.$]/.test(e)}s(fz,"isIdentCont");function pz(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
|
|
10853
|
+
`};var Yu="66f15dc839ab3610472ff04616dacd3202d7314646fa5b1589d784873968c90e",qg=ER;var Kg=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=$.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Yu,tools:al}),0}},jg=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=$.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await Mg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},TR=[Kg,jg];var Bg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],sae=new Set(Bg.map(e=>e.key));function RR(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(RR,"resolveStartTarget");function FG(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(FG,"applicantText");function IR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:FG(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(IR,"applicationRows");var $R=Bg.map(e=>e.email);function OR(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(Dg(e,n)&&(r===void 0||!$R.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${$R.join(", ")} (--applicant) \u2014 never a real family's`)}s(OR,"assertStartApplicant");function PR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(PR,"processStoreJson");function LG(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.revisionNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(LG,"refText");function MG(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?LG(e.ref):JSON.stringify(e.value)}s(MG,"holds");function _R(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:MG(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(_R,"storeRows");function Hu(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(Hu,"parseKv");var NR="started",Ju="submitted",Qu="submitted",CR="load-scenario:";var DR="(Bewerbung)";function FR(e){return{nodeId:DR,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(FR,"sharedAsList");function LR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(LR,"disabledText");function MR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:LR(r)})))}s(MR,"actionRows");function qR(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: ${LR(a)}`);if(i!==DR)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(qR,"nodeOfferingAction");function KR(e,n,t){if(e.startsWith(CR)){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(KR,"runParams");async function qG(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(qG,"currentNodeIds");function KG(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(KG,"refusalText");async function Zu(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${KG(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,FR(r.actions)]}s(Zu,"actionsOf");async function jR(e,n,t){return t!==void 0?[t]:await qG(e,n)}s(jR,"nodesOf");var Ug=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=$.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await Zu(n,this.application,await jR(n,this.application,this.node));return this.print(t,MR,["node","action","label","disabled"]),0}},Vg=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=$.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=KR(this.action,this.autoSubmit,Hu(this.param??[]).values),t=await this.caller(),r=this.application,i=await jR(t,this.application,this.node),o=qR(await Zu(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}},BR=[Ug,Vg];var We=["de","en"];function hs(e,n){return We.every(t=>e[t]===n[t])}s(hs,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!We.includes(r))?"not-localized":We.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function $i(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s($i,"isLocalizedText");function ll(e,n){let t={};for(let r of We){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(ll,"composeTexts");var fr=/^[a-z][A-Za-z0-9]*$/;function Gg(e){return typeof e=="string"&&fr.test(e)}s(Gg,"isNodeId");function gs(e,n){Gg(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${fr.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(gs,"makeNodeId");var Ri="$env";function se(e){if(e.scope==="env")return`${Ri}.${e.key}`;let n=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(se,"formatAddress");var Cr=/^[a-z][a-zA-Z0-9_]*$/,jG=/^[A-Za-z_][A-Za-z0-9_]*$/;function po(e){return typeof e=="string"&&e.split(".").every(n=>jG.test(n))}s(po,"isPath");function Zr(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&&po(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Cr.test(i)?null:UR({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Cr.test(o)||(t==="node"?!fr.test(i):!Cr.test(i))?null:UR({scope:t,owner:i,key:o},a)}default:return null}}s(Zr,"tryParseAddress");function UR(e,n){if(n.length===0)return e;let t=n.join(".");return po(t)?{...e,path:t}:null}s(UR,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:n.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!po(n.path))return!1;switch(n.scope){case"env":return po(n.key);case"derived":return typeof n.key=="string"&&Cr.test(n.key);case"node":return typeof n.owner=="string"&&fr.test(n.owner)&&typeof n.key=="string"&&Cr.test(n.key);case"task":return typeof n.owner=="string"&&Cr.test(n.owner)&&typeof n.key=="string"&&Cr.test(n.key);default:return!1}}s(we,"isAddress");var Xr={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"}},ys=Object.keys(Xr);function ws(e){return Object.hasOwn(Xr,e)}s(ws,"isEnvKey");var BG=["self-service","staff"];function VR(e,n){return{kind:"fixed",values:e,labels:n}}s(VR,"fixedSet");var Xu={of:"applicant.language",withoutValue:"de"},ei={"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:Xu},"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:Xu},"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:Xu},"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:Xu},"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:VR(We,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:VR(BG,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},ef={types:Xr,fields:ei},nf=ys.flatMap(e=>Object.keys(Xr[e]).map(n=>`${e}.${n}`));function Wt(e){return Object.hasOwn(ei,e)}s(Wt,"isEnvLeaf");function tf(e){return`${Ri}.${e}`}s(tf,"envIdentifier");function mo(e){let n=ei[e],[t,r]=e.split("."),i=Xr[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(mo,"envLeaf");var GR="staffInput";var UG=["boolean"],dl=/^[a-z][A-Za-z0-9]*$/;function rf(e){return e.staffInputs??[]}s(rf,"staffInputsOf");function of(e){return`${GR}.${e}`}s(of,"staffInputLeaf");function zR(e){return`${Ri}.${of(e)}`}s(zR,"staffInputIdentifier");function VG(e){let n=`${GR}.`;return e.startsWith(n)?e.slice(n.length):null}s(VG,"staffInputKeyOfLeaf");function ks(e,n){let t=VG(n);return t===null?void 0:rf(e).find(r=>r.key===t)}s(ks,"declaredStaffInput");function WR(e){return[...rf(e).map(n=>({leaf:of(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...nf.map(n=>{let t=mo(n);return{leaf:n,type:t.type,label:t.label,valueSet:ei[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(WR,"envLeavesFor");function YR(e){return WR(e).filter(n=>!n.cohortBound)}s(YR,"conditionEnvLeaves");function HR(e){return QR(YR(e))}s(HR,"envConditionSchemaFor");function GG(e){return WR(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(GG,"offerConditionEnvLeaves");function JR(e){return QR(GG(e))}s(JR,"offerConditionSchemaFor");function QR(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(QR,"schemaOfLeaves");function ZR(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}"`};dl.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),UG.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(ZR,"staffInputIssues");var ny={required:!0,description:"Offer slug (its offerKey)"},zg=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=$.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",ny);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=IR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},Wg=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=$.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",ny);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}},Yg=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=$.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new Error(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},Hg=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=$.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $derived\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(PR(t),()=>_R(t),["address","state","holds","producer","written"]),0}},Jg=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=$.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",ny);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();OR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=RR(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:eI(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 Zu(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}},Qg=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=$.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new Error("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new Error("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new Error("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new Error("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new Error("applications discard-test: --dry-run and --confirm exclude each other");let n=zG(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 zG(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(zG,"parseDays");var Zg=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=$.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},Xg=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=$.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},ey=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=$.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=eI([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}},XR=[zg,Wg,Yg,Hg,Jg,Qg,Zg,Xg,ey];function eI(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!dl.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(eI,"parseStaffInputs");var Un="contractGenerator",ho="documentTemplate";function cl(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(cl,"isGeneratorRef");function nI(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(nI,"literalOf");function ni(e){let n=nI(e,Un);return cl(n)?n:null}s(ni,"generatorRefOfNode");function pr(e){let n=nI(e,ho);return typeof n=="string"&&n.length>0?n:null}s(pr,"documentTemplateKeyOfNode");function tI(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(tI,"generatorRefLabel");var WG=["formExports","generatorStamp"];function rI(e,n,t){let r=e.inputs?.[Un];(r?.kind!=="literal"||!cl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Un} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Un]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts}}}s(rI,"applyGeneratorStamp");var YG=["reads"];function bs(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 WG)delete r[i];for(let i of YG)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(bs,"comparableWorkflowGraph");var ul={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 sf(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=ul[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(sf,"manifestIssues");function HG(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(HG,"validateProgressLayoutExternalCopy");function iI(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"]:HG(e)}s(iI,"progressLayoutIssues");var oI=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var JG=new Set(["sections","effects","outcomes","testScenarios","env"]),af={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 sI(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(JG.has(i))continue;let o=af[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(sI,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Ii(e){return typeof e=="string"&&bt.includes(e)}s(Ii,"isOutcomeSemantic");var Yt=["arrival","manual"],aI={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function QG(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(QG,"literal");function ty(e){let n=QG(e,"waitlistOrder");return Yt.includes(n)?{waitlistOrder:n}:null}s(ty,"waitlistPolicyOrNull");var wn="responsible",ry="team:";function lf(e){return`${ry}${e}`}s(lf,"teamSlot");function df(e){return e.startsWith(ry)?e.slice(ry.length):null}s(df,"teamKeyOfSlot");function lI(e){return e.kind==="responsible"?wn:lf(e.groupKey)}s(lI,"slotIdOf");function cf(e){if(e===wn)return{kind:"responsible"};let n=df(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(cf,"slotOfId");var iy="review",oy="checkField",dI="reviewed",cI="reviewing",uf=["rejected","waitlisted"];function sy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(sy,"isObject");var ZG=new Set(["decision",iy]),uI={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function ay(e){return Object.hasOwn(uI,e)?uI[e]:void 0}s(ay,"legacySemanticOfId");function XG(e){return e===iy?bt.filter(n=>!uf.includes(n)):bt}s(XG,"allowedSemanticsFor");var ez="other";function fI(e){return sy(e)&&ZG.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(fI,"outcomesOf");function pI(e){return(e?.nodes??[]).some(n=>fI(n).some(t=>sy(t)&&!("semantic"in t)))}s(pI,"needsOutcomeSemantics");function mI(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=fI(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=XG(u),m=!1,y=l.map(k=>{if(!sy(k))return k;let g=String(k.id);if("semantic"in k)return Ii(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let v=`${c}.${g}`,E=Object.hasOwn(n,v)?n[v]:void 0;if(E!==void 0)return p.includes(E)?(t.push({nodeId:c,outcomeId:g,semantic:E,source:"answer"}),m=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:p,answer:E}),k);let A=ay(g),I=A??ez;return p.includes(I)?(t.push({nodeId:c,outcomeId:g,semantic:I,source:A===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:I}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:p}),k)});return m?{...d,outcomes:y}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(mI,"addOutcomeSemantics");var mr="bewerbungOffen";function go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(go,"isObject");var ly=["event","effect"];function hI(e){return go(e)&&e.type==="eventTrigger"}s(hI,"isTrigger");function gI(e){let n=go(e.inputs)?e.inputs:{};return"outcomes"in e||ly.some(t=>t in e||t in n)}s(gI,"oldShape");function yI(e){return(e?.nodes??[]).some(n=>hI(n)&&gI(n))}s(yI,"needsEventTriggerStartMove");function nz(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>go(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===mr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(go(e.next)?e.next:{});if(!(i.length===1&&i[0]===mr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=go(e.inputs)?{...e.inputs}:{};for(let l of ly){let d=o[l];if(go(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of ly)delete a[l],delete o[l];return go(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(nz,"moveNode");function wI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!hI(i)||!gI(i))return i;let o=nz(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(wI,"moveEventTriggerStart");function fl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(fl,"isObject");var kI={waitlistOrder:"arrival"};function bI(e){return!fl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(fl(e.inputs)?e.inputs:{}))}s(bI,"lacksPolicy");function tz(e){return(e?.nodes??[]).some(bI)}s(tz,"needsWaitlistPolicyMove");function dy(e){return fl(e)&&Yt.includes(e.waitlistOrder)}s(dy,"isWaitlistPolicy");function rz(e){if(e===void 0)return{policy:kI,stated:!1};if(!fl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Yt.includes(n)?"malformed":{policy:{waitlistOrder:n??kI.waitlistOrder},stated:n!==void 0}}s(rz,"policyOfSelection");function vI(e,n,t={}){let r=[],i=[];if(!tz(e))return{graph:e,moved:r,refused:i};let o=rz(n),a=e.nodes.map(l=>{if(!bI(l))return l;let d=l,c=String(d.id),u=fl(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,m,y;if(p!==void 0)m=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},r.push({nodeId:c,policy:m,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(vI,"moveWaitlistPolicyToInputs");function yo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(yo,"isObject");var iz=[Un,ho],oz=["inputSchema","parties","schemaDigest","parts"];function xI(e){return yo(e)&&e.type==="governedDocument"&&("resolver"in e||yo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(xI,"oldShape");function SI(e){return(e?.nodes??[]).some(xI)}s(SI,"needsGeneratorInputMove");function sz(e){let n=yo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!yo(i))return{unmoved:"resolverNotObject"};if(Un 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((yo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>yo(d)&&iz.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Un]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(oz.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(yo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ho in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[ho]={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(sz,"moveNode");function AI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!xI(i))return i;let o=sz(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(AI,"moveGeneratorPinsToInputs");var EI=/^\d{4}-\d{2}-\d{2}$/;function hr(e,n){return{de:e,en:n}}s(hr,"issue");function wo(e){if(typeof e!="object"||e===null)return hr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:hr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return hr(`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?hr("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"||!EI.test(r)?hr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!EI.test(i)?hr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?hr("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)?hr("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))?hr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?hr("unbekannte Angaben","unknown details"):null:hr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(wo,"reductionShapeIssue");function Oi(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||wo(n.reduction)===null&&n.reduction.kind==="amount")}s(Oi,"isPricedItemValue");var vs=["freetext","recommendation","choice","pricedItem","record","reduction"],xs=[...vs,"appointment"];function $I(e){return typeof e=="string"&&xs.includes(e)}s($I,"isTaskResultKind");function Pi(e){return typeof e=="string"&&vs.includes(e)}s(Pi,"isRecordedTaskResultKind");function Ss(e){return Pi(e.kind)}s(Ss,"isRecordedTaskResult");var ff=["number","boolean","enum"];function cy(e){return typeof e=="string"&&ff.includes(e)}s(cy,"isRecordFieldType");var uy=["form","siblingRank"];var ti={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 RI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(RI,"isProseResult");function pf(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&cy(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):az(e)}s(pf,"draftResultStoreWrites");function az(e){let n=ti[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(az,"singleStoreWrite");var TI="team:";function As(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(TI)){let n=e.slice(TI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(As,"parseTaskResultChat");var Ze={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var lz=new Set(["if","else","in","true","false","null"]),dz=new Set(["==","!=","<=",">=","&&","||"]);function cz(e){return e>="0"&&e<="9"}s(cz,"isDigit");function uz(e){return/[a-zA-Z_$]/.test(e)}s(uz,"isIdentStart");function fz(e){return/[a-zA-Z0-9_.$]/.test(e)}s(fz,"isIdentCont");function pz(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
|
|
10856
10854
|
`||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(uz(r)){let o=t;for(;o<e.length&&fz(e.charAt(o));)o++;let a=e.slice(t,o);lz.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(dz.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(pz,"tokenise");var II=1e4,OI=128;function Es(e){e.depth++,e.depth>OI&&F(`Expression nesting too deep (> ${OI})`)}s(Es,"enterDepth");function FI(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(FI,"peek");function Vn(e){let n=e.tokens[e.pos];return n||F(`Unexpected end at ${e.pos}`),e.pos++,n}s(Vn,"take");function Gn(e,n,t){let r=FI(e);return!(!r||r.t!==n||t!==void 0&&r.v!==t)}s(Gn,"match");function ko(e,n,t){return Gn(e,n,t)||F(`Expected ${n}${t?`:${t}`:""} at ${e.pos}`),Vn(e)}s(ko,"expect");function ii(e){Es(e);try{return Gn(e,"kw","if")?mz(e):hz(e)}finally{e.depth--}}s(ii,"parseExpr");function mz(e){ko(e,"kw","if"),ko(e,"punct","(");let n=ii(e);ko(e,"punct",")");let t=ii(e);ko(e,"kw","else");let r=ii(e);return{kind:"if",cond:n,then:t,else:r}}s(mz,"parseIf");function hz(e){let n=PI(e),t=0;try{for(;Gn(e,"op","||");){Vn(e),Es(e),t++;let r=PI(e);n={kind:"binary",op:"||",left:n,right:r}}}finally{e.depth-=t}return n}s(hz,"parseLogicOr");function PI(e){let n=_I(e),t=0;try{for(;Gn(e,"op","&&");){Vn(e),Es(e),t++;let r=_I(e);n={kind:"binary",op:"&&",left:n,right:r}}}finally{e.depth-=t}return n}s(PI,"parseLogicAnd");function _I(e){let n=NI(e),t=0;try{for(;Gn(e,"op","==")||Gn(e,"op","!=");){let r=Vn(e).v;Es(e),t++;let i=NI(e);n={kind:"binary",op:r,left:n,right:i}}}finally{e.depth-=t}return n}s(_I,"parseEquality");function NI(e){let n=py(e),t=0;try{for(;Gn(e,"op","<")||Gn(e,"op","<=")||Gn(e,"op",">")||Gn(e,"op",">=")||Gn(e,"kw","in");){let r=Vn(e),i=r.t==="kw"?"in":r.v;Es(e),t++;let o=py(e);n={kind:"binary",op:i,left:n,right:o}}}finally{e.depth-=t}return n}s(NI,"parseCompare");function py(e){if(Gn(e,"op","!")){Vn(e),Es(e);try{return{kind:"unary",op:"!",operand:py(e)}}finally{e.depth--}}return gz(e)}s(py,"parseUnary");function gz(e){let n=FI(e);if(n||F("Unexpected end"),n.t==="num")return Vn(e),{kind:"num",value:n.v};if(n.t==="str")return Vn(e),{kind:"str",value:n.v};if(n.t==="kw"&&n.v==="true")return Vn(e),{kind:"bool",value:!0};if(n.t==="kw"&&n.v==="false")return Vn(e),{kind:"bool",value:!1};if(n.t==="kw"&&n.v==="null")return Vn(e),{kind:"null"};if(n.t==="punct"&&n.v==="("){Vn(e);let t=ii(e);return ko(e,"punct",")"),t}if(n.t==="punct"&&n.v==="["){Vn(e);let t=[];if(!Gn(e,"punct","]"))for(t.push(ii(e));Gn(e,"punct",",");)Vn(e),t.push(ii(e));return ko(e,"punct","]"),{kind:"arr",items:t}}if(n.t==="ident"){let t=n.v;if(Vn(e),Gn(e,"punct","(")){Vn(e);let r=[];if(!Gn(e,"punct",")"))for(r.push(ii(e));Gn(e,"punct",",");)Vn(e),r.push(ii(e));return ko(e,"punct",")"),{kind:"call",name:t,args:r}}return{kind:"ident",path:t}}F(`Unexpected token at ${e.pos}`)}s(gz,"parsePrimary");function In(e){e.length>II&&F(`Expression too long (${e.length} > ${II})`);let n={tokens:pz(e),pos:0,depth:0},t=ii(n);return n.pos<n.tokens.length&&F(`Unexpected trailing token at ${n.pos}`),t}s(In,"parseExpression");var yz=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 cn(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=>cn(t,n));case"unary":{let t=cn(e.operand,n);return!_i(t)}case"call":{let t=n.functions!==void 0&&Object.hasOwn(n.functions,e.name)?n.functions[e.name]:yz.get(e.name);t||F(`Unknown function '${e.name}'`);let r=e.args.map(i=>cn(i,n));return t(...r)}case"binary":return wz(e.op,e.left,e.right,n);case"if":return _i(cn(e.cond,n))?cn(e.then,n):cn(e.else,n)}}s(cn,"evaluate");function wz(e,n,t,r){if(e==="&&"){let a=cn(n,r);return _i(a)?_i(cn(t,r)):!1}if(e==="||"){let a=cn(n,r);return _i(a)?!0:_i(cn(t,r))}let i=cn(n,r),o=cn(t,r);switch(e){case"==":return fy(i,o);case"!=":return!fy(i,o);case"<":{let[a,l]=mf(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=mf(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=mf(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=mf(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>fy(a,i)):!1}}s(wz,"evalBinary");function mf(e,n){return[CI(e),CI(n)]}s(mf,"orderedOperands");function CI(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(CI,"numericOperand");function fy(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(fy,"looseEq");function _i(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(_i,"truthy");function xn(e){let n=new Set;return ri(e,n),[...n]}s(xn,"dependencies");function ri(e,n){switch(e.kind){case"ident":n.add(e.path);return;case"call":e.args.forEach(t=>ri(t,n));return;case"arr":e.items.forEach(t=>ri(t,n));return;case"unary":ri(e.operand,n);return;case"binary":ri(e.left,n),ri(e.right,n);return;case"if":ri(e.cond,n),ri(e.then,n),ri(e.else,n);return;default:return}}s(ri,"walk");var DI=new Map;function gr(e){let n=DI.get(e);return n||(n=In(e),DI.set(e,n)),n}s(gr,"parseCached");function kz(e,n){return cn(gr(e),n)}s(kz,"evalExpression");function LI(e,n){return _i(kz(e,n))}s(LI,"evalBoolean");function hf(e){let n=e.pricingRules;return n===void 0?[]:(Array.isArray(n)||F("graph.pricingRules must be an array \u2014 the graph validator refuses anything else"),n)}s(hf,"pricingRuleSets");function my(e){return e.derive!==void 0}s(my,"isDerivedKey");function bz(e,n){let t=hf(e);return(n.rules??[]).map(r=>{let i=t.find(o=>o.key===r);return i===void 0&&F(`[process] derivation names the unknown rule set "${r}" \u2014 publish refuses that`),i})}s(bz,"ruleSetsOfDerivation");function qI(e){return[...new Set(e.rows.flatMap(n=>xn(gr(n.when))))]}s(qI,"ruleSetDependencies");function KI(e){let n=Zr(e);return n!==null&&se(n)===e?n:null}s(KI,"ruleIdentifierAddress");function hy(e,n){let r=[...new Set(bz(e,n).flatMap(qI))].map(o=>{let a=KI(o);return a===null&&F(`[address/bareIdentifier] rule identifier "${o}" is no address \u2014 publish refuses that`),{address:a,id:o,role:"rule"}}),i=n.reduction;return i===void 0?r:(we(i)||F(`[address/bareIdentifier] derive.reduction ${JSON.stringify(i)} is no address \u2014 publish refuses that`),[...r,{address:i,id:se(i),role:"reduction"}])}s(hy,"derivationSources");function jI(e,n){let t=hf(e);for(let r of n.rules??[]){let i=t.find(o=>o.key===r);if(i===void 0||i.rows.some(o=>pl(o.when)!==null)||qI(i).some(o=>KI(o)===null))return null}return n.reduction!==void 0&&!we(n.reduction)?null:hy(e,n)}s(jI,"draftDerivationSources");function pl(e){if(typeof e!="string"||e.trim().length===0)return"leere Bedingung";try{return gr(e),null}catch(n){return n instanceof Error?n.message:String(n)}}s(pl,"conditionIssue");function MI(e){return e.item!==void 0&&e.group===void 0?{kind:"item",key:e.item}:e.group!==void 0&&e.item===void 0?{kind:"group",key:e.group}:null}s(MI,"rowTarget");function gy(e){if(e.byStage===void 0){let n=MI(e);return n===null?[]:[{...n,stages:null}]}return e.item!==void 0||e.group!==void 0?[]:e.byStage.flatMap(n=>{let t=MI(n);return t===null?[]:[{...t,stages:n.stages}]})}s(gy,"derivationTargets");function BI(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(BI,"assertNoCustomNodeExports");var yy=null;function UI(e){for(let[n,t]of Object.entries(e))BI(n,t);yy=e}s(UI,"setSpecs");function VI(){return yy||F("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),yy}s(VI,"requireSpecs");function He(e){let n=VI(),t=n[e.type];return t===void 0&&le("INVALID",{de:`[workflow/registry] Unbekannter Knotentyp "${String(e.type)}" (Knoten "${String(e.id)}"). Registrierte Typen: ${Object.keys(n).sort().join(", ")}.`,en:`[workflow/registry] Unknown node type "${String(e.type)}" (node "${String(e.id)}"). Registered types: ${Object.keys(n).sort().join(", ")}.`}),t}s(He,"specFor");function GI(){return Object.keys(VI()).sort()}s(GI,"registeredNodeTypes");var zI=nf.filter(e=>ei[e].cohortBound!==!0);function wy(e){return Wt(e)&&ei[e].cohortBound!==!0}s(wy,"isEnvAddressLeaf");function ky(e){return mo(e).type}s(ky,"envType");function by(e){return mo(e).label}s(by,"envLabel");function gf(e){if(e.scope==="env"||e.path===void 0)return e;switch(e.scope){case"node":return{scope:"node",owner:e.owner,key:e.key};case"task":return{scope:"task",owner:e.owner,key:e.key};case"derived":return{scope:"derived",key:e.key}}}s(gf,"addressBase");function wr(e){return e.scope==="node"&&e.key===it&&e.path===void 0}s(wr,"isInstanceAddress");function un(e){return we(e)&&e.scope==="node"&&e.key===it&&e.path!==void 0}s(un,"isFormFieldAddress");function WI(e){return un(e)?{owner:e.owner,path:e.path}:null}s(WI,"formFieldOf");function vy(e){return xn(gr(e)).map(n=>{if(!n.startsWith("$"))return{identifier:n,address:null,reason:"bareIdentifier"};let t=Zr(n);return t===null?{identifier:n,address:null,reason:"shape"}:{identifier:n,address:t}})}s(vy,"expressionAddresses");var it="admission",yl="document",Ts="contract",$s="contracts",YI="payment",xy=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var ct={id:"identity",type:"identity",label:"display",sublabel:"display",library:"display",outcomes:"control",outputLabels:"display",inputs:"input",next:"control",tasks:"config",assign:"reference",actionTeams:"reference",optionalActions:"config",artifacts:"config",notifications:"config"},vde={join:{...ct},end:{...ct},eventTrigger:{...ct},form:{...ct,adoptForm:"address",formExports:"stamp"},roleAssign:{...ct},setFlag:{...ct},if:{...ct,condition:"address"},countersign:{...ct,contract:"address",titles:"display",signing:"config"},engagePush:{...ct,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...ct,commentRequired:"config",decisionAsTask:"config",reads:"address",requiresOneOf:"config"},review:{...ct,form:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...ct},completenessCheck:{...ct,requires:"address",deadline:"config"},collectPayment:{...ct},governedDocument:{...ct,production:"config",form:"address",generatorStamp:"stamp",templateStamp:"stamp",approval:"config",confirmBeforeIssue:"config",confirmContractTerms:"config",contractTermsQuestionText:"display",responseStrategy:"config",titles:"display",responseLabels:"display",reads:"address"}};function yr(e){return Array.isArray(e)?e:[]}s(yr,"listOf");function Ln(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(Ln,"record");function HI(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(HI,"dataSourceFieldsOf");function JI(e){return e.type==="review"?[]:e.type==="engagePush"?["form"]:HI(e)}s(JI,"requiredDataSourceFields");var vz={setFlag:{target:"setFlagTarget"}};function wl(e,n={}){let t=[],r=e,i=`nodes.${e.id}`,o=s((d,c,u,p={})=>{t.push({kind:d,at:c,nodeId:e.id,value:u,judgedTogether:null,...p})},"field"),a=new Map(n.slotTypes===!1?[]:(He(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=vz[e.type]??{};for(let[d,c]of Object.entries(Ln(r.inputs)??{})){let u=Ln(c);if(u?.kind!=="binding")continue;let p="address"in u?u.address:u.path,m=l[d];if(m!==void 0){o(m,`${i}.inputs.${d}`,p);continue}let y=a.get(d);o("binding",`${i}.inputs.${d}`,p,y!==void 0?{expectedType:y}:{})}for(let[d,c]of yr(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of yr(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 HI(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 yr(r.tasks).entries())t.push(...QI(e.id,c,d));for(let[d,c]of yr(r.optionalActions).entries()){let u=Ln(c);u?.when!==void 0&&o("optionalActionWhen",xz(e.id,typeof u.key=="string"?u.key:String(d)),u.when)}return t}s(wl,"nodeAddressFields");function xz(e,n){return`nodes.${e}.optionalActions.${n}.when`}s(xz,"optionalActionWhenPath");function QI(e,n,t){let r=Ln(n);if(r===null)return[];let i=[],o=typeof r.key=="string"?r.key:String(t),a=`nodes.${e}.tasks.${o}`,l=s((p,m,y,k={})=>{i.push({kind:p,at:m,nodeId:e,taskKey:o,value:y,judgedTogether:null,...k})},"field"),d=`${a}.evidence`;r.when!==void 0&&l("taskWhen",`${a}.when`,r.when,{expectedType:"boolean",judgedTogether:d});for(let[p,m]of yr(r.reads).entries())l("taskReads",`${a}.reads.${p}`,m,{judgedTogether:d});for(let[p,m]of yr(r.documents).entries()){let y=Ln(m);y===null||y.kind==="artifact"||l("taskDocument",`${a}.documents.${p}`,"address"in y?y.address:y.key)}let c=Ln(r.familyRequest);if(c!==null){for(let[p,m]of yr(c.fields).entries())l("familyRequestFields",`${a}.familyRequest.fields.${p}`,m,{judgedTogether:`${a}.familyRequest.fields`});c.from!==void 0&&l("familyRequestFrom",`${a}.familyRequest.from`,c.from)}let u=Ln(r.result);if(u?.kind==="record")for(let[p,m]of yr(u.fields).entries()){let y=Ln(Ln(m)?.suggest);if(y?.kind!=="form")continue;let k=Ln(m)?.type;l("suggest",`${a}.result.fields.${p}.suggest`,"address"in y?y.address:y.key,typeof k=="string"?{expectedType:k}:{})}return i}s(QI,"taskAddressFields");function yf(e){let n=[];for(let[t,r]of yr(e.processStore).entries()){let i=Ln(Ln(r)?.derive);if(i?.reduction!==void 0){let o=String(Ln(r)?.key);n.push({kind:"reduction",at:`processStore.${t}.derive.reduction`,nodeId:null,priceKey:o,value:i.reduction,judgedTogether:null})}}for(let[t,r]of yr(e.pricingRules).entries())for(let[i,o]of yr(Ln(r)?.rows).entries())n.push({kind:"pricingRule",at:`pricingRules.${t}.rows.${i}.when`,nodeId:null,value:Ln(o)?.when,judgedTogether:null});return n}s(yf,"priceAddressFields");function Rs(e){return Sy(e)?(wf(e.value)??[]).flatMap(n=>n.address===null?[]:[n.address]):we(e.value)?[e.value]:[]}s(Rs,"addressesInField");function Sy(e){return e.kind==="pricingRule"||e.kind==="condition"||e.kind==="optionalActionWhen"}s(Sy,"isExpressionField");function wf(e){return pl(e)===null?vy(e):null}s(wf,"ruleConditionAddresses");function vt(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(vt,"adoptsForm");function ZI(e){if(e.type!=="form"||vt({type:e.type,adoptForm:e.adoptForm}))return;let n=e.inputs?.smartForm;return n?.kind==="literal"&&typeof n.value=="string"&&n.value!==""?n.value:void 0}s(ZI,"createdSmartFormSlug");function Sz(e,n){return e.type!=="governedDocument"||e.production!=="resolver"||n!==yl?n:e.generatorStamp?.parts!==void 0?$s:Ts}s(Sz,"addressKeyOfPort");function Ay(e){let n=e.result;return n===void 0||!Ss(n)?[]:pf(n).map(t=>t.key)}s(Ay,"storeWritesOf");function hl(e,n){return(Array.isArray(e.processStore)?e.processStore:[]).find(t=>t.key===n)}s(hl,"declaredKey");function Dr(e,n){let t=[];if(!vt(n))for(let r of He(n).outputs?.(n)??[])t.push({address:{scope:"node",owner:n.id,key:Sz(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 Ay(r)){let o=hl(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(Dr,"producedAddresses");function XI(e,n,t){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===n&&Ay(i).includes(t))return{nodeId:r.id,template:i};return null}s(XI,"taskWriter");function Fr(e,n,t){return XI(e,n,t)?.nodeId??null}s(Fr,"taskOwnerNode");function gl(e,n){let t=hl(e,n)?.derive;if(t===void 0)return null;let r=Array.isArray(e.pricingRules)?e.pricingRules:[],i=[];for(let a of t.rules??[]){let l=r.find(d=>d.key===a);if(l===void 0)return null;for(let d of l.rows){let c=wf(d.when);if(c===null)return null;for(let u of c)u.address!==null&&i.push(u.address)}}let o=t.reduction;return we(o)&&i.push(o),Az(i)}s(gl,"derivedSources");function Az(e){let n=new Set;return e.filter(t=>{let r=se(t);return n.has(r)?!1:(n.add(r),!0)})}s(Az,"dedupe");function Ez(e){return wl(e,{slotTypes:!1}).flatMap(n=>Rs(n).map(t=>({address:t,field:n})))}s(Ez,"writtenAddressesOf");function bo(e,n){let t=[],r=new Set,i=s((l,d,c,u)=>{let p=`${se(l)}|${d}|${c.at}|${u===void 0?"":se(u)}`;r.has(p)||(r.add(p),t.push({address:l,origin:d,field:c,...u!==void 0?{via:u}:{}}))},"push"),o=s((l,d,c=new Set)=>{let u=se(l);if(!c.has(u)){if(c.add(u),l.scope==="task"){let p=XI(e,l.owner,l.key);if(p===null)return;for(let m of QI(p.nodeId,p.template))if(!(m.kind!=="taskWhen"&&m.kind!=="taskReads"))for(let y of Rs(m))i(y,"evidence",d,l)}if(l.scope==="derived")for(let p of gl(e,l.key)??[])i(p,"derivedSource",d,l),o(p,d,c)}},"carried");for(let{address:l,field:d}of Ez(n))i(l,"written",d),o(l,d);let a=new Set((Array.isArray(n.tasks)?n.tasks:[]).flatMap(l=>Ay(l).map(d=>`${l.key}.${d}`)));for(let l of yf(e))if(!(l.kind!=="reduction"||!we(l.value)||l.value.scope!=="task")&&a.has(`${l.value.owner}.${l.value.key}`))for(let d of gl(e,l.priceKey)??[])d.scope==="task"&&a.has(`${d.owner}.${d.key}`)||(i(d,"priceCheck",l,{scope:"derived",key:l.priceKey}),o(d,l));return t}s(bo,"addressReadsOf");function Ey(e,n){switch(n.scope){case"env":return Wt(n.key)?ky(n.key):ks(e,n.key)?.type;case"derived":case"task":{if(n.path!==void 0||n.scope==="task"&&Fr(e,n.owner,n.key)===null)return;let t=hl(e,n.key);return t===void 0||n.scope==="derived"!=(t.derive!==void 0)?void 0:t.type}case"node":{let t=e.nodes.find(i=>i.id===n.owner);if(t===void 0)return;let r=Dr(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(Ey,"addressType");function ml(e,n){let t=Ln(e)?.[n];return typeof t=="string"&&t.length>0?t:void 0}s(ml,"labelText");function Oe(e,n,t){let r=e.nodes.find(i=>i.id===n);return ml(r?.label,t)??n}s(Oe,"nodeDisplayName");function vo(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 ml(i.title,t)??n}return n}s(vo,"taskDisplayName");function Ue(e,n,t){let r=[];switch(n.scope){case"env":r.push(Wt(n.key)?by(n.key)[t]:ks(e,n.key)?.label[t]??n.key);break;case"derived":r.push(ml(hl(e,n.key)?.label,t)??n.key);break;case"task":r.push(vo(e,n.owner,t),ml(hl(e,n.key)?.label,t)??n.key);break;case"node":{r.push(Oe(e,n.owner,t));let i=e.nodes.find(a=>a.id===n.owner),o=i===void 0?void 0:Dr(e,i).find(a=>a.address.scope==="node"&&a.address.key===n.key);r.push(ml(o?.label,t)??n.key);break}}return n.scope!=="env"&&n.path!==void 0&&r.push(n.path),`${r.join(" \u203A ")} (${se(n)})`}s(Ue,"displayAddress");var kl=["beneficiary","signers"];function eO(e,n){return Array.isArray(e.artifacts)&&e.artifacts.some(t=>t?.key===n)}s(eO,"ownsSlot");function bl(e){let n=[];for(let[t,r]of Object.entries(Ln(e.inputs)??{})){let i=Ln(r);i?.kind==="binding"&&we(i.address)&&n.push({slot:t,address:i.address})}return n}s(bl,"bindingAddresses");function nO(e,n){return bl(e).find(t=>t.slot===n)?.address??null}s(nO,"bindingAddressAt");function tO(e,n){let t=s(i=>i.scope==="node"&&i.owner===n||i.scope==="task"&&Fr(e,i.owner,i.key)===n,"names");return[...e.nodes.filter(i=>i.id!==n).flatMap(i=>wl(i,{slotTypes:!1})),...yf(e)].flatMap(i=>Rs(i).filter(t).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(tO,"addressesNaming");var On={target:"target",flagKey:"flagKey",value:"value"};function Tz(e){return nO(e,On.target)}s(Tz,"setFlagTarget");function rO(e){let n=Tz(e);return n!==null&&wr(n)?n.owner:null}s(rO,"setFlagTargetOwner");function kf(e){let n=e.inputs?.[On.flagKey];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(kf,"setFlagKey");function iO(e){let n=e.inputs?.[On.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)}": \`${On.value}\` is no yes/no literal \u2014 publish refuses that`)}s(iO,"setFlagValue");function oO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(oO,"isObject");var sO=["target","flagKey","value"];function aO(e){return oO(e)&&e.type==="setFlag"&&sO.some(n=>n in e)}s(aO,"oldShape");function lO(e){return(e?.nodes??[]).some(aO)}s(lO,"needsSetFlagInputMove");function $z(e){let n=oO(e.inputs)?{...e.inputs}:{};if(sO.some(a=>a in e&&On[a]in n))return{unmoved:"inputExists"};if("target"in e&&!we(e.target))return{unmoved:"targetNotAddress"};if("flagKey"in e&&typeof e.flagKey!="string")return{unmoved:"flagKeyNotString"};if("value"in e&&typeof e.value!="boolean")return{unmoved:"valueNotBoolean"};let{target:t,flagKey:r,value:i,...o}=e;return t!==void 0&&(n[On.target]={kind:"binding",address:t}),typeof r=="string"&&r.length>0&&(n[On.flagKey]={kind:"literal",value:r}),i!==void 0&&(n[On.value]={kind:"literal",value:i}),{node:{...o,inputs:n}}}s($z,"moveNode");function dO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!aO(i))return i;let o=$z(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(dO,"moveSetFlagConfigToInputs");function cO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(cO,"isObject");var Ty={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},$y={review:["allowSkipInTest"]};function uO(e){return Ty[String(e)]??{}}s(uO,"movesOf");function fO(e){return $y[String(e)]??[]}s(fO,"deadOf");function pO(e){return cO(e)&&[...Object.keys(uO(e.type)),...fO(e.type)].some(n=>n in e)}s(pO,"oldShape");function mO(e){return(e?.nodes??[]).some(pO)}s(mO,"needsScalarInputMove");function Rz(e,n){return n==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===n}s(Rz,"wellTyped");function Iz(e){let n=cO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(uO(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==="")&&!Rz(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 fO(e.type))delete t[r];return t.inputs=n,{node:t}}s(Iz,"moveNode");function hO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!pO(i))return i;let o=Iz(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(hO,"moveScalarConfigToInputs");var Is={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 bf(e){return typeof e=="string"&&Object.hasOwn(Is,e)}s(bf,"isResourceType");var Fde=Object.keys(Is).filter(e=>Is[e].existence.check==="generic");function gO(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||wo(n.reduction)===null&&n.reduction.kind==="amount")&&Object.keys(n).every(t=>t==="groupKey"||t==="grantKeys"||t==="reduction")}s(gO,"isPricedGroupValue");var Ry=["street","hausnr","plz","ort","land"];function yO(e){return Ry.includes(e)}s(yO,"isAddressPart");var Oz=["municipality","municipalityKey","district","districtKey"],Iy=[...Ry,...Oz],Oy={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"},Os=Object.keys(Oy);function Ni(e){return typeof e=="string"&&e in Oy}s(Ni,"isValueType");function xt(e){return e===void 0?void 0:Oy[e]}s(xt,"dataTypeOf");function vf(e,n){let t=xt(e),r=xt(n);return t!==void 0&&t===r}s(vf,"valueTypesCompatible");function xf(e){return e===null?"null is not a text in both languages":vl(e,{type:"localizedText"})}s(xf,"completeLocalizedTextIssue");function vl(e,n){if(bf(n.type)&&!Ni(n.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${n.type} key`;let t=xt(n.type),r=JSON.stringify(e),i=`slot type "${n.type}" takes a binding, not a literal`;if(t===void 0||t==="composite"||t==="file"||t==="edge")return i;if(e===null)return null;switch(t){case"text":return typeof e=="string"?null:`${r} is not a text (slot type "${n.type}")`;case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)?null:`${r} is not a date YYYY-MM-DD`;case"number":return typeof e=="number"&&Number.isFinite(e)?null:`${r} is not a number`;case"boolean":return typeof e=="boolean"?null:`${r} is not true/false`;case"option":{if(typeof e!="string")return`${r} is not an option value`;let o=(n.enumOptions??[]).map(a=>a.value);return o.length===0||o.includes(e)?null:`${r} is not one of the options ${o.join(", ")}`}case"pricedItem":{let o=e;return typeof o=="object"&&typeof o.itemKey=="string"&&o.itemKey.length>0&&Array.isArray(o.grantKeys)&&o.grantKeys.every(a=>typeof a=="string")?null:`${r} is not a priced item {"itemKey":\u2026,"grantKeys":[\u2026]}`}case"pricedGroup":return gO(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 cl(e)?null:`${r} is not a contract generator {"kind":"generator"|"package","key":\u2026,"revision"?:n}`;case"documentTemplate":return typeof e=="string"&&e.length>0?null:`${r} is not a document template key`;case"roleKey":return typeof e=="string"&&e.length>0?null:`${r} is not a role key`;case"localizedText":{let o=e,a=s(l=>typeof l=="string"&&l.trim().length>0,"filled");return typeof o=="object"&&Object.keys(o).sort().join(",")==="de,en"&&a(o.de)&&a(o.en)?null:`${r} is not a text in both languages {"de":\u2026,"en":\u2026}`}case"reduction":{let o=wo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(vl,"literalTypeIssue");function wO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(wO,"isObject");var Pz={collectPayment:{reason:"reason"}},_z={governedDocument:["mockAutoProduce"]},kO={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 Py(e){return Pz[String(e)]??{}}s(Py,"movesOf");function bO(e){return _z[String(e)]??[]}s(bO,"deadOf");function vO(e){return wO(e)&&[...Object.keys(Py(e.type)),...bO(e.type)].some(n=>n in e)}s(vO,"oldShape");function xO(e){return(e?.nodes??[]).some(vO)}s(xO,"needsNodeConfigInputMove");function Nz(e){return xf(e)===null}s(Nz,"isCompleteText");function Cz(e){let n=wO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(Py(e.type)))if(r in e){if(i in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!Nz(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 bO(e.type))delete t[r];return Object.keys(Py(e.type)).some(r=>r in e)&&(t.inputs=n),{node:t}}s(Cz,"moveNode");function SO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!vO(i))return i;let o=Cz(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(SO,"moveNodeConfigToInputs");var _y="collectPayment",Ps=["online","separate"];function Sf(e){return Ps.includes(e)}s(Sf,"isCollectPaymentSettlement");var _s="paid",Ny="skipPayment",Ci="article",Ht="settlement",Di="reason",Jt="payee",Cy=["one_time"];function Af(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Af,"isObject");function AO(e){if(!Af(e)||e.type!==_y)return!1;let n=Af(e.inputs)?e.inputs:{},t=n[Ht];return!Af(t)||t.kind!=="literal"||t.value!=="online"?!1:!(Jt in n)}s(AO,"isOnlinePaymentWithoutPayee");function EO(e){return(e?.nodes??[]).some(AO)}s(EO,"needsPayee");function TO(e,n={}){let t=[],r=[],i=e.nodes.map(o=>{if(!AO(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=Af(o.inputs)?o.inputs:{};return{...o,inputs:{...d,[Jt]:{kind:"literal",value:l}}}});return t.length===0?{graph:e,set:t,refused:r}:{graph:{...e,nodes:i},set:t,refused:r}}s(TO,"setPayeeOnOnlinePayments");function Ef(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ef,"isObject");function Dy(e){return Ef(e)&&Ef(e.assign)&&"userId"in e.assign}s(Dy,"namesUser");function Tf(e){return(e?.nodes??[]).flatMap(n=>Ef(n)&&Array.isArray(n.tasks)?n.tasks.filter(Dy).map(t=>({nodeId:String(n.id),taskKey:String(t.key),hasTeam:typeof t.assign.group=="string"&&t.assign.group.length>0})):[])}s(Tf,"taskUserAssignments");function $O(e){let n=Tf(e);if(n.length===0)return{graph:e,dropped:n};let t=e.nodes.map(r=>{if(!Ef(r)||!Array.isArray(r.tasks)||!r.tasks.some(Dy))return r;let i=r.tasks.map(o=>{if(!Dy(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($O,"dropTaskAssignUserIds");var Ns={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"actionTeams{}":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Knoten-Aktion ausf\xFChren darf",en:"team that may perform the node action"},consequence:{de:"au\xDFer der zust\xE4ndigen Person darf niemand die Aktion ausf\xFChren",en:"nobody but the responsible person may perform the action"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"optionalActions[].trigger":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Aktion ausl\xF6sen darf",en:"team that may trigger the action"},consequence:{de:"niemand au\xDFer der Prozessverantwortung kann die Aktion ausl\xF6sen",en:"nobody but the process owner can trigger the action"}}},Fy=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function RO(e,n){if(typeof n!="string"||n.length===0)return null;if(e==="key")return n;let t=As(n);return t?.kind==="team"?t.groupKey:null}s(RO,"decodeKey");var IO={"assign{}":"assign","actionTeams{}":"actionTeams"},Dz=s(e=>e in IO,"isMapLeaf");function Fz(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(Fz,"locate");function $f(e){let n=[],t=e;for(let[r,i]of Object.entries(IO))for(let[o,a]of Object.entries(Fy(t[i])??{}))n.push({path:`${i}.${o}`,leaf:r,owner:o,key:RO("key",a),missing:typeof a!="string"||a.length===0});for(let r of Object.keys(Ns)){if(Dz(r))continue;let i=Ns[r],{list:o,field:a,key:l}=Fz(r);for(let d of Array.isArray(t[o])?t[o]:[]){let c=Fy(d);if(c===null||typeof c.key!="string")continue;let p=(a===null?c:Fy(c[a]))?.[l];if(p===void 0&&!i.required)continue;let m=typeof p!="string"||p.length===0;n.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:RO(i.codec,p),missing:m})}}return n}s($f,"nodeResourceReferences");var OO=s(e=>(e??[]).map(n=>`\u201E${n}\u201C`).join(", "),"list"),PO=s(e=>(e??[]).map(n=>`"${n}"`).join(", "),"listEn"),Lz={"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 (${OO(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 (${PO(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 (${OO(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 (${PO(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 Cs(e,n,t){let{problem:r,remedy:i}=Lz[e][t](n);return`[${e}] ${r} ${i}`}s(Cs,"addressMessage");function Qt(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(Qt,"derivedEdges");function Ly(e){let n=new Map;for(let t of Qt(e.nodes)){let r=n.get(t.source)??[];r.push(t.target),n.set(t.source,r)}return n}s(Ly,"successorsOf");function Rf(e,n,t){if(n===t)return!0;let r=Ly(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(Rf,"dominates");function _O(e,n,t){if(n===t)return!0;let r=Ly(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(_O,"reaches");function NO(e,n,t,r){let i=new Map(e.nodes.map(d=>[d.id,d])),o=Ly(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(NO,"reachedAvoiding");function My(e,n){let t=[],r=s(a=>({address:a.address,type:a.type,...a.label!==void 0?{label:a.label}:{},nodeId:a.nodeId}),"toVisible");for(let a of e.nodes)if(Rf(e,a.id,n))for(let l of Dr(e,a))t.push(r(l));for(let a of zI)t.push({address:{scope:"env",key:a},type:ky(a),label:by(a),nodeId:null});for(let a of rf(e))t.push({address:{scope:"env",key:of(a.key)},type:a.type,label:a.label,nodeId:null});let i=new Set(t.map(a=>se(a.address))),o=(Array.isArray(e.processStore)?e.processStore:[]).filter(a=>a.derive!==void 0);for(let a=!0;a;){a=!1;for(let l of o){let d=se({scope:"derived",key:l.key});if(i.has(d))continue;let c=gl(e,l.key);c===null||!c.every(u=>i.has(se(gf(u))))||(t.push({address:{scope:"derived",key:l.key},type:l.type,label:l.label,nodeId:null}),i.add(d),a=!0)}}return t}s(My,"visibleAddressesAt");function oi(e,n){let t=e?.readinessFormFieldsByFormNode?.get(n.owner);if(t!==void 0)return t.get(n.path)??null}s(oi,"formFieldEntryOf");var CO={binding:{de:"Eingang",en:"Input"},condition:{de:"Bedingung",en:"Condition"},nodeReads:{de:"Gelesene Felder",en:"Fields read"},requires:{de:"Geforderte Felder",en:"Required fields"},adoptForm:{de:"\xDCbernommenes Formular",en:"Continued form"},setFlagTarget:{de:"Freizuschaltendes Formular",en:"Form to unlock"},form:{de:"Formular",en:"Form"},contract:{de:"Vertrag",en:"Contract"},payment:{de:"Zahlung",en:"Payment"},taskWhen:{de:"Bedingung",en:"Condition"},optionalActionWhen:{de:"Bedingung der optionalen Aktion",en:"Condition of the optional action"},taskReads:{de:"Gelesene Felder der Aufgabe",en:"Fields the task reads"},taskDocument:{de:"Dokumente",en:"Documents"},familyRequestFields:{de:"Nachforderbare Felder",en:"Requestable fields"},familyRequestFrom:{de:"Nachforderung aus",en:"Request from"},suggest:{de:"Vorschlag",en:"Suggestion"},reduction:{de:"Erm\xE4\xDFigung des Preises",en:"Reduction of the price"},pricingRule:{de:"Preisregel",en:"Pricing rule"}},Mz=new Set(["nodeReads","requires","taskReads","taskDocument","familyRequestFields"]);function qz(e,n,t){let r=[];n.taskKey!==void 0&&r.push(`${t==="de"?"Aufgabe":"task"} \u201E${vo(e,n.taskKey,t)}\u201C`);let i=n.kind==="binding"?` \u201E${n.at.split(".").pop()}\u201C`:"";return r.push(`${CO[n.kind][t]}${i}`),r.join(" \u203A ")}s(qz,"addressFieldWhere");function xl(e,n,t){let r=qz(e,n,t);return n.nodeId===null?r:`\u201E${Oe(e,n.nodeId,t)}\u201C \u203A ${r}`}s(xl,"whereOf");function DO(e,n,t){if(n.scope==="node")return Oe(e,n.owner,t);if(n.scope==="task")return vo(e,n.owner,t)}s(DO,"producerName");function FO(e,n){let t=[],r=new Set,i=s((l,d,c)=>{let u={de:Cs(l,c("de"),"de"),en:Cs(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=>wl(l)),...yf(e)];for(let l of a){let d=s(c=>xl(e,l,c),"where");for(let c of Kz(e,l,i))Bz(e,l,c,i)&&(Vz(e,l,c,n,i),xy.has(l.kind)&&!zz(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:Ue(e,c,u)})))}return Wz(e,i),Yz(e,a,i),Zz(e,i),eW(e,i),t}s(FO,"checkAddresses");function Kz(e,n,t){let r=s(i=>xl(e,n,i),"where");if(Sy(n)){let i=wf(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 Rs(n)}return typeof n.value=="string"?(t("address/bareIdentifier",n.at,i=>({where:r(i),address:n.value})),[]):we(n.value)?[n.value]:(t("address/shape",n.at,i=>({where:r(i),address:JSON.stringify(n.value)??"undefined"})),[])}s(Kz,"checkFieldShape");function LO(e,n,t,r){let i=DO(e,t,r);return{where:xl(e,n,r),address:Ue(e,t,r),...i!==void 0?{producer:i}:{}}}s(LO,"addressParams");function jz(e,n,t){return wy(n)||t==="optionalActionWhen"&&(ks(e,n)!==void 0||Wt(n))?null:ks(e,n)!==void 0?t==="condition"||t==="binding"?null:"address/staffInputConditionOnly":Wt(n)?"address/envCohortBound":"address/unknownKey"}s(jz,"envAddressRefusal");function Bz(e,n,t,r){let i=s(o=>LO(e,n,t,o),"params");switch(t.scope){case"env":{let o=jz(e,t.key,n.kind);return o===null?!0:(r(o,n.at,i),!1)}case"derived":return(e.processStore??[]).find(a=>a.key===t.key)?.derive!==void 0?!0:(r("address/unknownKey",n.at,i),!1);case"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===t.owner))?(e.processStore??[]).some(a=>a.key===t.key&&a.derive===void 0)?Fr(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):Dr(e,o).some(a=>a.address.scope==="node"&&a.address.key===t.key)?!0:(r(xy.has(n.kind)&&vt(o)?"address/notFormInstance":"address/unknownKey",n.at,i),!1)}}}s(Bz,"resolves");function Uz(e,n){return e===void 0||n===void 0||xt(n)===void 0?!0:xt(e)!==void 0&&vf(e,n)}s(Uz,"addressTypeFits");function Vz(e,n,t,r,i){let o=s(l=>LO(e,n,t,l),"params");if(t.scope!=="env"&&t.path!==void 0&&!Gz(e,n,t,r)){i("address/pathNotInTarget",n.at,o);return}if(n.expectedType===void 0)return;let a=Ey(e,t);Uz(a,n.expectedType)||i("address/typeMismatch",n.at,l=>({...o(l),expected:n.expectedType,actual:a}))}s(Vz,"checkPathAndType");function Gz(e,n,t,r){if(t.scope!=="node")return!1;if(Ey(e,t)!==void 0)return!0;if(t.key!==it)return!1;if(!Mz.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(Gz,"pathExists");function zz(e,n){if(!wr(n))return!1;let t=e.get(n.owner);return t!==void 0&&t.type==="form"&&!vt(t)}s(zz,"isCreatingFormInstance");function Wz(e,n){for(let t of e.nodes){let r=new Set(wl(t).map(i=>i.kind));for(let i of JI(t))r.has(i)||n("address/missing",`nodes.${t.id}.${i}`,o=>({where:`\u201E${Oe(e,t.id,o)}\u201C \u203A ${CO[i][o]}`}))}}s(Wz,"checkRequiredFields");function Yz(e,n,t){let r=new Map;for(let i of n)if(i.judgedTogether!==null)for(let o of Rs(i)){if(o.scope!=="node"||o.key!==it)continue;let a=r.get(i.judgedTogether)??[];a.push({field:i,owner:o.owner}),r.set(i.judgedTogether,a)}for(let[i,o]of r){let a=[...new Set(o.map(l=>l.owner))];a.length<2||t("address/mixedForms",i,l=>({where:xl(e,o[0].field,l),names:a.map(d=>Oe(e,d,l))}))}}s(Yz,"checkMixedForms");function Hz(e,n){return e.type==="engagePush"&&n.kind==="payment"}s(Hz,"readSkipsAbsentProducer");function Jz(e,n,t){return n!==t&&_O(e,n,t)}s(Jz,"precedesOnSomePath");function Qz(e,n,t,r){let i=gf(t.address);return r.has(se(i))||!Xz(e,i)?!0:t.origin==="written"&&i.scope==="node"&&Hz(n,t.field)&&Jz(e,i.owner,n.id)}s(Qz,"readPassesVisibility");function Zz(e,n){for(let t of e.nodes){let r=bo(e,t);if(r.length===0)continue;let i=new Set(My(e,t.id).map(o=>se(o.address)));for(let o of r){let a=gf(o.address);if(Qz(e,t,o,i))continue;let l=a.scope==="task"?Fr(e,a.owner,a.key):a.scope==="node"?a.owner:null;n("address/notVisible",o.field.at,d=>({where:xl(e,o.field,d),address:Ue(e,o.address,d),producer:DO(e,a,d)??Ue(e,a,d),...l!==null?{producerNode:Oe(e,l,d)}:{},reader:Oe(e,t.id,d)}))}}}s(Zz,"checkVisibility");function Xz(e,n){if(n.scope==="env")return wy(n.key);if(n.scope==="derived")return gl(e,n.key)!==null;let t=se(n);return e.nodes.some(r=>Dr(e,r).some(i=>se(i.address)===t))}s(Xz,"producedSomewhere");function eW(e,n){let t=new Map;for(let r of e.nodes){let i=new Set(Dr(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"||!Cr.test(l)){n("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${Oe(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=t.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),t.set(l,d)}}for(let[r,i]of t)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)n("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${Oe(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${vo(e,r,a)}\u201C`,names:i.map(l=>Oe(e,l.nodeId,a))}))}s(eW,"checkTaskKeys");function If(e,n){return e.label[n]??""}s(If,"wordingIn");function Fi(e,n){let t=MO(e,n),r=If(e.qualifier,n);return t===""||r===""&&If(e.qualifier,"de")!==""?"":r===""?t:`${r} \xB7 ${t}`}s(Fi,"fieldLabelIn");function MO(e,n){return If(e,n)}s(MO,"fieldOwnLabelIn");function Ds(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:Fi(e,"de"),en:Fi(e,"en")}}}s(Ds,"catalogField");function Fs(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(Fs,"catalogFieldRefusal");function Of(e,n){let t=e.buses.find(r=>r.key===n);return t||F(`[progress] layout '${e.id}' has no bus '${n}'`),t}s(Of,"progressBus");function Sl(e,n){return e.states.some(t=>t.id===n)}s(Sl,"isBusState");function qO(e,n){let t=e.terminalSemantics?.[n];return t||F(`[progress] no terminal semantics for state '${n}' on bus '${e.key}'`),t}s(qO,"terminalSemantics");function Pf(e,n){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,n)}s(Pf,"hasTerminalSemantics");function nW(e,n){return(e.boards??[]).find(t=>t.audience===n||t.audience==="both")??null}s(nW,"boardForAudience");function KO(e){return nW(Of(e,"process"),"internal")}s(KO,"internalProcessBoard");function Ls(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(Ls,"resolveProgressEvent");var Ms={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},si=Object.keys(Ms);function xo(e){return Object.hasOwn(Ms,e)}s(xo,"isEndNodeOutcome");var qy={approved:{de:"Angenommen",en:"Admitted"},rejected:{de:"Abgelehnt",en:"Rejected"},withdrawn:{de:"Zur\xFCckgezogen",en:"Withdrawn"},expired:{de:"Abgelaufen",en:"Expired"}};var Li=["commit","discard"],Nce=w.union(...Li.map(e=>w.literal(e)));function _f(e){return typeof e=="string"&&Li.includes(e)}s(_f,"isApplicationDataDecision");function Mn(e){return Object.keys(e)}s(Mn,"progressEventsOf");var te=s((e,n)=>({de:e,en:n}),"lt"),en=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},Nf={key:"abgesagt",label:te("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},BO={key:"abgelehnt",label:te("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var UO={enrolled:{label:te("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:jO,external:en(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:Nf,external:en(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."))}},VO={role:"effect",effect:"pure",progressDefaults:UO,progressEvents:Mn(UO),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:si.map(e=>({value:e,label:qy[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),...rW(e),...iW(e)],"validate")},qs=s((e,n,t,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${n}`,reason:{de:t,en:r},severity:"error"}),"nodeIssue");function So(e){let n=e.inputs?.applicationOutcome;return n?.kind==="literal"&&n.value!=null?String(n.value):null}s(So,"literalOutcome");function tW(e){if(e.type!=="end")return[];let n=e.inputs?.applicationOutcome;if(n===void 0||n.kind==="unset")return[];let t=So(e);return t===null?[qs(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: das Ergebnis ist kein fester Wert \u2014 die Engine kann den Abschluss nicht ableiten`,`[end/applicationOutcome] ${e.label.en}: the application outcome is no fixed value \u2014 the engine cannot derive the terminal`)]:xo(t)?[]:[qs(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${t}' ist kein Ausgang eines Endknotens (${si.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 (${si.join("|")}) \u2014 the waitlist ends through the closed outcome of its waitlist node`)]}s(tW,"checkEndApplicationOutcome");function rW(e){if(e.type!=="end")return[];let n=e.inputs?.dataDecision;return!n||n.kind!=="literal"||n.value==null?[qs(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision fehlt \u2014 der Endknoten muss festlegen, ob die erfassten Daten \xFCbernommen (commit) oder verworfen (discard) werden`,`[end/dataDecision] ${e.label.en}: dataDecision is missing \u2014 the end node must decide whether the collected data is kept (commit) or discarded (discard)`)]:_f(n.value)?[]:[qs(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision '${String(n.value)}' ist ung\xFCltig (${Li.join("|")})`,`[end/dataDecision] ${e.label.en}: dataDecision '${String(n.value)}' is invalid (${Li.join("|")})`)]}s(rW,"checkEndDataDecision");function iW(e){if(e.type!=="end")return[];let n=So(e);if(n===null||!xo(n)||n==="approved")return[];let t=e.inputs?.dataDecision;if(t?.kind!=="literal"||t.value!=="commit")return[];let r=qy[n];return[{...qs(e,"dataDecision",`[end/commitWithoutApproval] ${e.label.de}: Ende ohne Zusage \xFCbernimmt die erfassten Daten (commit) \u2014 Personen und Beziehungen bleiben nach dem Ergebnis \u201E${r.de}" bestehen. Gewollt? Sonst discard.`,`[end/commitWithoutApproval] ${e.label.en}: end without admission keeps the captured data (commit) \u2014 persons and relationships remain after the outcome "${r.en}". Intended? Otherwise discard.`),severity:"warning"}]}s(iW,"checkEndCommitWithoutApproval");function GO(e,n){if(!n?.layout||!n.wiring)return[];let t=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=So(r);if(i===null||!xo(i))continue;let o=Ms[i],a=Ls(n.wiring,r,o);if(a===null)continue;let l=n.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Pf(l,a.state))continue;let d=qO(l,a.state).outcome;d!==i&&t.push(qs(r,"applicationOutcome",`[end/outcomeMismatch] ${r.label.de}: das Ergebnis \u201E${i}" passt nicht zum Endzustand \u201E${a.state}" (Bus ${a.bus}), der \u201E${String(d)}" besiegelt \u2014 Ergebnis oder Verdrahtung angleichen.`,`[end/outcomeMismatch] ${r.label.en}: the outcome "${i}" does not match the final state "${a.state}" (bus ${a.bus}), which seals "${String(d)}" \u2014 align the outcome or the wiring.`))}return t}s(GO,"checkEndOutcomeMatchesTerminal");function Ks(e){let n=He(e);return typeof n.inputs=="function"?n.inputs(e):[]}s(Ks,"inputSlots");function oW(e,n){return Ks(e).find(t=>t.id===n)}s(oW,"findInputSlot");function sW(e,n){let t=oW(e,n);if(!t)return{source:"missing",spec:{id:n,label:{de:n,en:n},type:"string"},unknownSlot:!0};let r=e.inputs?.[n]??{kind:"unset"};return r.kind==="binding"&&we(r.address)?{source:"binding",spec:t,address:r.address}:r.kind==="literal"?{source:"literal",spec:t,value:r.value}:r.kind==="cockpit"&&t.deferrable===!0?{source:"cockpit",spec:t}:t.defaultValue!==void 0?{source:"default",spec:t,value:t.defaultValue}:t.required?{source:"missing",spec:t}:{source:"optional",spec:t}}s(sW,"resolveInput");function zO(e){return Ks(e).filter(n=>sW(e,n.id).source==="missing")}s(zO,"missingRequiredInputs");var aW=["personRef","formRef","documentRef","docRef"];function lW(e){let n=He(e);return typeof n.inputs!="function"?[]:n.inputs(e).map(t=>({id:t.id,type:t.type}))}s(lW,"listInputs");function WO(e){let n=[];for(let t of e.nodes)for(let r of lW(t))!aW.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(WO,"findParamValueRefSlotErrors");function YO(e){let n=[];for(let t of e.nodes){let r=He(t);if(typeof r.inputs=="function")for(let i of r.inputs(t)){let o=t.inputs?.[i.id];if(o?.kind==="cockpit"&&i.deferrable!==!0){n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/notDeferrable] ${t.label.de}: Parameter \u201E${i.label.de}\u201C l\xE4sst sich nicht im Cockpit erg\xE4nzen \u2014 nur Parameter eines Generators oder einer Vorlage.`,en:`[inputs/notDeferrable] ${t.label.en}: Parameter "${i.label.en}" cannot be completed in the cockpit \u2014 only parameters of a generator or a template can.`},severity:"error"});continue}(i.inspector==="literal-only"&&o?.kind==="binding"||i.inspector==="binding-only"&&o?.kind==="literal")&&n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:i.inspector==="literal-only"?{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C ist ein fester Wert \u2014 eine Bindung an eine Adresse ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is a fixed value \u2014 it cannot be bound to an address.`}:{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C wird an eine Adresse gebunden \u2014 ein fester Wert ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is bound to an address \u2014 a fixed value is not possible here.`},severity:"error"})}}return n}s(YO,"findInspectorKindErrors");function HO(e){let n=[];for(let t of e.nodes)for(let r of zO(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(HO,"findMissingRequiredInputs");function Cf(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(Cf,"processStoreKeys");function QO(e){let n=[];for(let t of e.tasks??[]){let r=t.result;if(!(r===void 0||!Ss(r)))for(let i of pf(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(QO,"storeWritersOn");function ZO(e){let n=new Map;for(let t of e.nodes)for(let r of QO(t)){let i=n.get(r.key)??[];i.push(r),n.set(r.key,i)}return n}s(ZO,"processStoreWriters");function dW(e,n,t){for(let r of e.nodes){let i=QO(r).find(o=>o.taskKey===n&&o.key===t);if(i!==void 0)return i}return null}s(dW,"writerAt");function JO(e,n,t){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${t}: ${se(n)} is no task value`);let r=dW(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(JO,"sourceOfAddress");function Ky(e,n){(n.scope!=="task"&&n.scope!=="derived"||n.path!==void 0)&&F(`[process] ${se(n)} is no store address`);let t=Cf(e).find(o=>o.key===n.key);t===void 0&&F(`[address/unknownKey] ${se(n)}: "${n.key}" is not declared in processStore`);let r={key:t.key,type:t.type,label:t.label,audience:t.audience};if(n.scope==="task")return my(t)&&F(`[address/unknownKey] ${se(n)}: "${n.key}" is a derived price \u2014 read it as $derived`),{...r,sources:[JO(e,n,se(n))]};my(t)||F(`[address/unknownKey] ${se(n)}: "${n.key}" is a written value \u2014 read it as $task`);let i=hy(e,t.derive).map(o=>JO(e,o.address,se(n)));return{...r,sources:i,derive:t.derive}}s(Ky,"processLeafOf");var jy=new Set(["enum","pricedItem","number","boolean","reduction"]),By=new Set(["pricedItem","pricedGroup"]),Uy=new Set(["number","boolean","enum"]),Fe={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",ruleSet:"[process/ruleSet]",ruleCondition:"[process/ruleCondition]",ruleSource:"[process/ruleSource]",ruleReadsAbsent:"[process/ruleReadsAbsent]",absentValue:"[process/absentValue]",derive:"[process/derive]",derivedHasWriter:"[process/derivedHasWriter]",ruleGrantUnknown:"[process/ruleGrantUnknown]",ruleGrantUnused:"[process/ruleGrantUnused]",derivePriceUnknown:"[process/derivePriceUnknown]",derivePriceNotInProgram:"[process/derivePriceNotInProgram]",derivePriceOfferWithoutProgram:"[process/derivePriceOfferWithoutProgram]",deriveStageUnknown:"[process/deriveStageUnknown]",deriveStageUncovered:"[process/deriveStageUncovered]",reductionPrices:"[process/reductionPrices]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function Le(e,n,t,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${n} ${t}`,en:`${n} ${r}`},severity:"error"}}s(Le,"err");function XO(e,n={}){let t=[],r=Cf(e),i=new Map(r.map(d=>[d.key,d])),o=new Set;for(let[d,c]of r.entries()){let u=`processStore[${d}]`;if(typeof c.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(c.key)){t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(c.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(c.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}o.has(c.key)&&t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" ist doppelt deklariert.`,`Process key "${c.key}" is declared twice.`)),o.add(c.key),(c.derive!==void 0?!By.has(c.type):!jy.has(c.type))&&t.push(c.derive!==void 0?Le(u,Fe.derive,`Vorgangs-Schl\xFCssel "${c.key}" ist abgeleitet, hat aber den Typ "${c.type}" \u2014 abgeleitet wird nur ein Preis: ${[...By].join(", ")}.`,`Process key "${c.key}" is derived but has the type "${c.type}" \u2014 only a price can be derived: ${[...By].join(", ")}.`):Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" hat den Typ "${c.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...jy].join(", ")}${c.type==="pricedGroup"?" (ein Paket wird abgeleitet: derive)":""}.`,`Process key "${c.key}" has the type "${c.type}" \u2014 the process only stores results with a value: ${[...jy].join(", ")}${c.type==="pricedGroup"?" (a package is derived: derive)":""}.`)),(!c.label?.de?.trim()||!c.label?.en?.trim())&&t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" braucht ein Label in beiden Sprachen.`,`Process key "${c.key}" needs a label in both languages.`)),c.audience!=="internal"&&c.audience!=="printable"&&t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${c.key}": audience must be 'internal' or 'printable'.`))}let a=ZO(e);for(let d of e.nodes)for(let c of d.tasks??[]){let u=c.result;u?.kind==="pricedItem"&&u.writes===void 0&&t.push(Le(`node.${d.id}.tasks.${c.key}.result.writes`,Fe.pricedItemWritesNothing,`Aufgabe "${c.key}" (Knoten "${d.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${c.key}" (node "${d.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[d,c]of a){let u=i.get(d);for(let p of c){let m=p.fieldKey===void 0?`node.${p.nodeId}.tasks.${p.taskKey}.result.writes`:`node.${p.nodeId}.tasks.${p.taskKey}.result.fields.${p.fieldKey}.writes`;if(u===void 0){t.push(Le(m,Fe.unknownKey,`${p.fieldKey===void 0?"":`Feld "${p.fieldKey}" der `}Aufgabe "${p.taskKey}" schreibt "${d}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${p.fieldKey===void 0?"Task":`Field "${p.fieldKey}" of task`} "${p.taskKey}" writes "${d}", but the workflow declares no such process key (graph.processStore).`));continue}if(p.valueType!==u.type){let y=p.fieldKey===void 0?`Aufgabe "${p.taskKey}"`:`Feld "${p.fieldKey}" der Aufgabe "${p.taskKey}"`,k=p.fieldKey===void 0?`Task "${p.taskKey}"`:`Field "${p.fieldKey}" of task "${p.taskKey}"`;t.push(Le(m,Fe.writerTypeMismatch,`${y} liefert ${p.valueType}, der Vorgangs-Schl\xFCssel "${d}" ist aber als ${u.type} deklariert.`,`${k} delivers ${p.valueType}, but the process key "${d}" is declared as ${u.type}.`))}}if(c.length>1){let p=c.map(m=>`${m.nodeId}/${m.taskKey}${m.fieldKey===void 0?"":`.${m.fieldKey}`}`).join(", ");t.push(Le(`processStore.${d}`,Fe.secondWriter,`Vorgangs-Schl\xFCssel "${d}" wird ${c.length}-mal geschrieben (${p}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${d}" is written ${c.length} times (${p}) \u2014 exactly one writer per key.`))}}for(let d of r){if(d.derive!==void 0){if(a.has(d.key)){let c=a.get(d.key).map(u=>`${u.nodeId}/${u.taskKey}`).join(", ");t.push(Le(`processStore.${d.key}`,Fe.derivedHasWriter,`Vorgangs-Schl\xFCssel "${d.key}" wird abgeleitet (derive) \u2014 keine Aufgabe darf ihn schreiben (${c}).`,`Process key "${d.key}" is derived (derive) \u2014 no task may write it (${c}).`))}continue}a.has(d.key)||t.push(Le(`processStore.${d.key}`,Fe.noWriter,`Vorgangs-Schl\xFCssel "${d.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${d.key}" is declared, but no task writes it ('result.writes').`))}t.push(...cW(e,r,a,n));let l=new Map;for(let d of e.nodes){let c=He(d),u=typeof c.inputs=="function"?c.inputs(d):[];for(let p of u){let m=d.inputs?.[p.id];if(m?.kind!=="binding")continue;let y=uW(e,m.address);if(y===null)continue;let k=`node.${d.id}.input.${p.id}`,g=se(m.address);for(let E of y.sources){let A=l.get(E.key)??new Set;A.add(d.id),l.set(E.key,A)}if(y.audience==="internal"&&t.push(Le(k,Fe.internalInDocument,`${d.label.de}: "${p.id}" liest den internen Vorgangs-Schl\xFCssel "${y.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${d.label.en}: "${p.id}" reads the internal process key "${y.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`)),y.derive!==void 0)continue;let v=fW(a,y.sources[0].key,y.sources[0].taskKey);if(v.template.when!==void 0&&p.required===!0&&p.defaultValue===void 0&&t.push(Le(k,Fe.absentWithoutDefault,`${d.label.de}: "${p.id}" ist Pflicht und an ${g} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${Df(v.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${d.label.en}: "${p.id}" is required and bound to ${g}, but the writing task only exists under a condition (when: ${Df(v.template.when)}) \u2014 without a default value the field would stay empty forever.`)),v.result.kind==="pricedItem"&&p.defaultValue!==void 0){let E=p.defaultValue;(!Oi(E)||E.itemKey!==v.result.item||E.grantKeys.length>0)&&t.push(Le(k,Fe.defaultItemMismatch,`${d.label.de}: der Vorgabewert von "${p.id}" muss der Artikel der schreibenden Aufgabe ohne Erm\xE4\xDFigung sein ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 sonst rechnete die Familie ohne Antrag einen anderen Artikel als mit.`,`${d.label.en}: the default value of "${p.id}" must be the article of the writing task without a reduction ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 otherwise the family would be charged a different article without an application than with one.`))}}}for(let[d,c]of l){let u=a.get(d)[0],p=u.template.blocks,m=p===void 0?void 0:p.node??u.nodeId,y=m!==void 0&&c.has(m)&&(()=>{let g=e.nodes.find(v=>v.id===m);return g!==void 0&&He(g).processHoldTemplate?.(g)===p.templateKey})(),k=`node.${u.nodeId}.tasks.${u.taskKey}.blocks`;if(!y){let g=[...c][0],v=e.nodes.find(A=>A.id===g),E=He(v).processHoldTemplate?.(v)??"?";t.push(Le(k,Fe.writerMustBlock,`Die Aufgabe "${u.taskKey}" schreibt "${d}", h\xE4lt aber keinen der lesenden Knoten (${[...c].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${g===u.nodeId?"":`node: '${g}', `}templateKey: '${E}' }, sonst arbeitet er, bevor der Wert existiert.`,`The task "${u.taskKey}" writes "${d}" but holds back none of the reading nodes (${[...c].join(", ")}) \u2014 it must block the first one, e.g. blocks: { ${g===u.nodeId?"":`node: '${g}', `}templateKey: '${E}' }, otherwise it works before the value exists.`));continue}for(let g of c)g===m||Rf(e,m,g)||t.push(Le(k,Fe.writerMustBlock,`"${g}" liest "${d}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${m}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${g}" reads "${d}" but does not lie behind the held-back node "${m}" \u2014 on a path past it, it would read the value before it is settled.`))}return t}s(XO,"processBindingIssues");function cW(e,n,t,r){let i=[],o=new Map(n.map(u=>[u.key,u])),a=hf(e),l=new Set;for(let[u,p]of a.entries()){let m=`pricingRules[${u}]`;if((typeof p.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(p.key)||l.has(p.key))&&i.push(Le(m,Fe.ruleSet,`Regelgruppe ${JSON.stringify(p.key)} \u2014 ein eindeutiger Schl\xFCssel aus Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Rule group ${JSON.stringify(p.key)} \u2014 a unique key of letters, digits and _, starting with a lowercase letter.`)),l.add(p.key),(!p.label?.de?.trim()||!p.label?.en?.trim())&&i.push(Le(m,Fe.ruleSet,`Regelgruppe "${p.key}" braucht ein Label in beiden Sprachen.`,`Rule group "${p.key}" needs a label in both languages.`)),!Array.isArray(p.rows)||p.rows.length===0){i.push(Le(m,Fe.ruleSet,`Regelgruppe "${p.key}" hat keine Zeilen.`,`Rule group "${p.key}" has no rows.`));continue}for(let[y,k]of p.rows.entries()){let g=`${m}.rows[${y}]`;(!Array.isArray(k.grants)||k.grants.length===0||k.grants.some(E=>typeof E!="string"||E.length===0))&&i.push(Le(g,Fe.ruleSet,`Regelgruppe "${p.key}", Zeile ${y+1}: nennt keine Rabattvorlage \u2014 eine Zeile ohne Rabatt ist die fehlende Zeile.`,`Rule group "${p.key}", row ${y+1}: names no discount template \u2014 a row without a discount is the missing row.`));let v=pl(k.when);if(v!==null){i.push(Le(g,Fe.ruleCondition,`Regelgruppe "${p.key}", Zeile ${y+1}: Bedingung ${JSON.stringify(k.when)} \u2014 ${v}.`,`Rule group "${p.key}", row ${y+1}: condition ${JSON.stringify(k.when)} \u2014 ${v==="leere Bedingung"?"empty condition":v}.`));continue}for(let{identifier:E,address:A}of vy(k.when)){if(A===null)continue;let I=pW(A,o,t);if(I==="ruleSource")i.push(Le(g,Fe.ruleSource,`Regelgruppe "${p.key}", Zeile ${y+1}: liest ${E} \u2014 eine Bedingung liest nur Werte, die eine Aufgabe schreibt ($task.<aufgabe>.<schl\xFCssel>), vom Typ ${[...Uy].join(", ")}.`,`Rule group "${p.key}", row ${y+1}: reads ${E} \u2014 a condition only reads values that a task writes ($task.<task>.<key>), of type ${[...Uy].join(", ")}.`));else if(I==="ruleReadsAbsent"){let N=t.get(A.key).find(T=>T.taskKey===A.owner);i.push(Le(g,Fe.ruleReadsAbsent,`Regelgruppe "${p.key}" liest ${E}, dessen Aufgabe entfallen kann (${N.template.when!==void 0?`when: ${Df(N.template.when)}`:"sie endet mit ihrem Knoten"}) \u2014 der Schl\xFCssel muss sagen, wof\xFCr er ohne Aufgabe steht ('absentValue'), sonst entschiede die Regel still \xFCber einen fehlenden Wert.`,`Rule group "${p.key}" reads ${E}, whose task can lapse (${N.template.when!==void 0?`when: ${Df(N.template.when)}`:"it ends with its node"}) \u2014 the key must say what it stands for without a task ('absentValue'), otherwise the rule would silently decide on a missing value.`))}}}}for(let u of n){if(u.absentValue===void 0)continue;let p=`processStore.${u.key}.absentValue`;if(!(u.type==="number"&&typeof u.absentValue=="number"||u.type==="boolean"&&typeof u.absentValue=="boolean"||u.type==="enum"&&typeof u.absentValue=="string"&&u.absentValue.length>0)){i.push(Le(p,Fe.absentValue,`Vorgangs-Schl\xFCssel "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} passt nicht zum Typ.`,`Process key "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} does not fit the type.`));continue}let y=t.get(u.key)?.[0];y!==void 0&&!eP(y)&&i.push(Le(p,Fe.absentValue,`Vorgangs-Schl\xFCssel "${u.key}": seine Aufgabe ist immer geschuldet und \xFCberlebt ihren Knoten \u2014 ein absentValue w\xFCrde nie gelesen.`,`Process key "${u.key}": its task is always owed and outlives its node \u2014 an absentValue would never be read.`))}let d=[];for(let u of n){let p=u.derive;if(p===void 0)continue;let m=`processStore.${u.key}.derive`,y=u.type==="pricedGroup"?"group":"item",k=[p.item,p.group,p.byStage].filter(T=>T!==void 0).length,g=gy(p),v=p.byStage??[];(k!==1||g.length===0||g.length!==Math.max(v.length,1)||g.some(T=>T.kind!==y))&&i.push(Le(m,Fe.derive,`"${u.key}" (${u.type}) leitet ${y==="group"?"ein Paket ab: genau 'group' oder 'byStage' mit je einem 'group'":"einen Artikel ab: genau 'item' oder 'byStage' mit je einem 'item'"}.`,`"${u.key}" (${u.type}) derives ${y==="group"?"a package: exactly 'group' or 'byStage' with one 'group' each":"an article: exactly 'item' or 'byStage' with one 'item' each"}.`));let E=new Set;for(let[T,b]of v.entries()){if(!Array.isArray(b.stages)||b.stages.length===0){i.push(Le(`${m}.byStage[${T}]`,Fe.derive,`"${u.key}": die Zeile ${T+1} nennt keine Stufe.`,`"${u.key}": row ${T+1} names no stage.`));continue}for(let R of b.stages)E.has(R)&&i.push(Le(`${m}.byStage[${T}]`,Fe.derive,`"${u.key}": die Stufe "${R}" steht in mehr als einer Zeile \u2014 welcher Preis gilt, w\xE4re geraten.`,`"${u.key}": the stage "${R}" is in more than one row \u2014 which price applies would be a guess.`)),E.add(R)}let A=new Set;for(let T of p.rules??[]){let b=a.find(R=>R.key===T);if(b===void 0){i.push(Le(m,Fe.derive,`"${u.key}" nennt die Regelgruppe "${T}", die der Workflow nicht deklariert (bekannt: ${a.map(R=>R.key).join(", ")||"keine"}).`,`"${u.key}" names the rule group "${T}", which the workflow does not declare (known: ${a.map(R=>R.key).join(", ")||"none"}).`));continue}for(let R of b.rows??[])for(let q of R.grants??[])A.add(q)}let I=p.reduction;we(I)&&(mW(I,o)||i.push(Le(m,Fe.derive,`"${u.key}": Reduktion ${se(I)} ist kein von einer Aufgabe geschriebener Wert vom Typ reduction ($task.<aufgabe>.<schl\xFCssel>).`,`"${u.key}": reduction ${se(I)} is not a value of type reduction written by a task ($task.<task>.<key>).`)));for(let T of g)d.push({key:u.key,target:T,grants:A}),(T.kind==="item"?r.billingItemKeys?.has(T.key):r.groupArticleKeys?.has(T.key))===!1?i.push(Le(m,Fe.derivePriceUnknown,`"${u.key}": ${T.kind==="item"?"der Artikel":"das Paket"} "${T.key}" ist nicht im Katalog des Mandanten.`,`"${u.key}": the ${T.kind==="item"?"article":"package"} "${T.key}" is not in the school's catalog.`)):r.offerProgram===null?i.push(Le(m,Fe.derivePriceOfferWithoutProgram,`"${u.key}": das Angebot ist keinem Programm zugeordnet, also geh\xF6rt ${T.kind==="item"?"kein Artikel":"kein Paket"} zu ihm; dem Angebot ein Programm geben.`,`"${u.key}": the offer is not assigned to a program, so no ${T.kind==="item"?"article":"package"} belongs to it; give the offer a program.`)):r.offerProgram!==void 0&&((T.kind==="item"?r.offerProgram.billingItemKeys:r.offerProgram.groupKeys).has(T.key)||i.push(Le(m,Fe.derivePriceNotInProgram,`"${u.key}": ${T.kind==="item"?"der Artikel":"das Paket"} "${T.key}" ist dem Programm \u201E${r.offerProgram.nameDe}\u201C des Angebots nicht zugeordnet${T.kind==="group"?" oder wird nicht angeboten":""} (unter Finanzen \u2192 Artikel zuordnen).`,`"${u.key}": the ${T.kind==="item"?"article":"package"} "${T.key}" is not assigned to the offer's program "${r.offerProgram.nameDe}"${T.kind==="group"?" or is not offered":""} (under Finance \u2192 assign articles).`)));let N=r.offerProgram?.stageKeys;if(p.byStage!==void 0&&N!==void 0){let T=[...E].filter(R=>!N.all.has(R));T.length>0&&i.push(Le(m,Fe.deriveStageUnknown,`"${u.key}": ${T.map(R=>`"${R}"`).join(", ")} ist keine Stufe des Programms \u201E${r.offerProgram.nameDe}\u201C (Stufen: ${[...N.all].join(", ")||"keine"}).`,`"${u.key}": ${T.map(R=>`"${R}"`).join(", ")} ${T.length===1?"is not a stage":"are not stages"} of the program "${r.offerProgram.nameDe}" (stages: ${[...N.all].join(", ")||"none"}).`));let b=[...N.active].filter(R=>!E.has(R));b.length>0&&i.push(Le(m,Fe.deriveStageUncovered,`"${u.key}": f\xFCr ${b.map(R=>`"${R}"`).join(", ")} nennt byStage keinen ${y==="group"?"Paket":"Artikel"} \u2014 diese Stufe h\xE4tte keinen Preis.`,`"${u.key}": for ${b.map(R=>`"${R}"`).join(", ")} byStage names no ${y==="group"?"package":"article"} \u2014 that stage would have no price.`))}}for(let u of t.values())for(let p of u){if(p.result.kind!=="reduction"||p.result.prices===void 0||p.result.writes===void 0)continue;let m=`node.${p.nodeId}.tasks.${p.taskKey}.result.prices`,k=o.get(p.result.prices)?.derive?.reduction;we(k)&&k.scope==="task"&&k.owner===p.taskKey&&k.key===p.result.writes||i.push(Le(m,Fe.reductionPrices,`Aufgabe "${p.taskKey}" senkt "${p.result.prices}" \u2014 das muss ein abgeleiteter Preis sein, dessen derive.reduction $task.${p.taskKey}.${p.result.writes} ist.`,`Task "${p.taskKey}" reduces "${p.result.prices}" \u2014 that must be a derived price whose derive.reduction is $task.${p.taskKey}.${p.result.writes}.`))}let c=r.grantTemplates;if(c!==void 0){let u=new Set(a.flatMap(p=>(p.rows??[]).flatMap(m=>m.grants??[])));for(let p of u){let m=c.get(p);if(m===void 0){i.push(Le("pricingRules",Fe.ruleGrantUnknown,`Eine Regelgruppe vergibt "${p}", aber keine Rabattvorlage des Mandanten tr\xE4gt diesen Schl\xFCssel.`,`A rule group grants "${p}", but no discount template of the school has this key.`));continue}d.some(({target:k,grants:g})=>{if(!g.has(p))return!1;if(k.kind==="item")return m.itemKeys.includes(k.key);let v=r.groupArticleKeys?.get(k.key);return m.itemKeys.some(E=>v?.has(E))})||i.push(Le("pricingRules",Fe.ruleGrantUnused,`Die Rabattvorlage "${p}" (gebunden an Artikel "${m.itemKeys.join(", ")}") wird vergeben, aber kein abgeleiteter Preis, der ihre Regelgruppe liest, enth\xE4lt ihr Ziel \u2014 sie wirkte nirgends.`,`The discount template "${p}" (bound to article "${m.itemKeys.join(", ")}") is granted, but no derived price reading its rule group contains its target \u2014 it would have no effect anywhere.`))}}return i}s(cW,"derivedPriceIssues");function uW(e,n){if(!we(n)||n.scope!=="task"&&n.scope!=="derived"||n.path!==void 0)return null;let t=Cf(e).find(o=>o.key===n.key);if(t===void 0||n.scope==="derived"!=(t.derive!==void 0))return null;if(n.scope==="task")return Fr(e,n.owner,n.key)===null?null:Ky(e,n);let r=jI(e,t.derive),i=s(o=>o.scope==="task"&&o.path===void 0&&Fr(e,o.owner,o.key)!==null,"resolvable");return r!==null&&r.every(o=>i(o.address))?Ky(e,n):null}s(uW,"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 Df(e){return we(e)?se(e):JSON.stringify(e)}s(Df,"shown");function pW(e,n,t){let r=e.scope==="task"&&e.path===void 0?n.get(e.key):void 0;if(e.scope==="task"&&e.path===void 0&&r===void 0)return null;if(e.scope!=="task"||r===void 0||r.derive!==void 0||!Uy.has(r.type))return"ruleSource";let i=t.get(r.key)?.find(o=>o.taskKey===e.owner);return i!==void 0&&eP(i)&&r.absentValue===void 0?"ruleReadsAbsent":null}s(pW,"ruleSourceRefusal");function mW(e,n){let t=e.scope==="task"&&e.path===void 0?n.get(e.key):void 0;return t!==void 0&&t.type==="reduction"&&t.derive===void 0}s(mW,"isReductionValue");function eP(e){return e.template.when!==void 0||e.template.blocks?.node===void 0}s(eP,"writerMayBeNotOwed");function Vy(e){let n=He(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:n.outcomes&&n.outcomes.length>0?[...n.outcomes]:null}s(Vy,"nodeOutcomes");var hW=["documentChangeRequested","documentReturned"];function nP(e){return hW.includes(e)}s(nP,"isNonAdvancingExternalEvent");var js=["offer","contract"];function Ff(e){return typeof e=="string"&&js.includes(e)}s(Ff,"isArtifactSlotType");var tP="open",Bs="done";function Gy(e){let n={};for(let t of We)n[t]=e(t);return n}s(Gy,"localized");var rP=[{key:"tenantSlug",type:"string"}];var gW=/^(\d{4})-(\d{2})-(\d{2})$/;function yW(e){return e>=1900&&e<=2100}s(yW,"isSupportedYear");function wW(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(wW,"isRealDate");function zy(e){if(typeof e!="string")return null;let n=gW.exec(e);if(n===null)return null;let[,t,r,i]=n;return t===void 0||r===void 0||i===void 0||!yW(Number(t))||!wW(Number(t),Number(r),Number(i))?null:{year:t,month:r,day:i}}s(zy,"isoDateParts");var kW="Europe/Berlin";function oP(){return kW}s(oP,"tenantTimeZone");var iP=new Map;function bW(e){let n=iP.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{le("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return iP.set(e,t),t}s(bW,"formatterFor");function vW(e,n){let t=new Map(bW(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(vW,"zoneOffsetAt");function Wy(e,n){let t=e+vW(n,e);return{wallClock:new Date(t).toISOString().slice(0,19),timeZone:n}}s(Wy,"instantToLocalDateTime");var Yy=3;function sP(e){return Wy(e,oP()).wallClock.slice(0,10)}s(sP,"localIsoDate");var Lf=["login","security","admission","tasks","deadlines","schoolMessages","staffTasks","staffAppointments","staffDeadlines","staffWaitlist","familyMessages","mentions"],aP=w.union(...Lf.map(e=>w.literal(e)));var zue=w.union(w.literal("admission"),w.literal("tasks"),w.literal("staff"),w.literal("chat")),Hy=["loginOnly","all"],Wue=w.union(w.literal("loginOnly"),w.literal("all"));function lP(e){return typeof e=="string"&&Hy.includes(e)}s(lP,"isMailLevel");var Al="subject";function dP(e){return e.category==="login"}s(dP,"isSignInLetter");var fn={key:"schoolName",label:"Name der Schule"},cP={de:"Zu Ihren Bewerbungen",en:"View your applications"},An={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:cP},Jy={key:An.key,label:An.label,link:!0,actionLabel:cP},uP={key:"authorName",label:"Name der schreibenden Person"},Us={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},El={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"}},SW={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"}},fP={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"}},Tl={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},pP={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},AW={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function Me(e){return{key:Al,label:"Betreff",default:e}}s(Me,"subjectSlot");var Mi=w.object({de:w.string(),en:w.string()}),Pn={tenantSlug:w.string(),applicationId:w.id("applications")},EW=w.object({tenantSlug:w.string()}),TW={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:EW,channels:["email"],portalVisible:!0,placeholders:[fn,An],slots:[Me({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:
|
|
10857
10855
|
|
|
10858
10856
|
{{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
|
|
@@ -11347,6 +11345,6 @@ ${t.length} unusable ${o}:
|
|
|
11347
11345
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11348
11346
|
`),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>
|
|
11349
11347
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11350
|
-
`);return t.length>0?1:0}},qE=class extends lr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=$.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function iB(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(iB,"requireOnOff");var oB=[xE,SE,AE,EE,TE,$E,RE,IE,OE,PE,Xc,_E,NE,CE,DE,FE,LE,ME,qE];function sB(e){return e.de??e.en??Object.values(e)[0]??""}s(sB,"titleDe");function aZ(e){return{id:e._id,kind:e.kind,status:e.status,title:sB(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(aZ,"row");var lZ=["id","kind","status","title","assignee","group","outcome"],BE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=$.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(aZ),lZ),0}},UE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=$.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:sB(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}},VE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=$.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},GE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=$.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},zE=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=$.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},aB=[BE,UE,VE,GE,zE];var eu=[...TR,...AC,...DC,...LD,...FD,...dF,...gF,...hF,...tB,...oB,...nB,...jK,...WK,...lC,...oF,...Vj,...AR,...XR,...WN,...kF,...wF,...xF,...SF,...rF,...UD,...aB,...KM,...Eq,...qK,...Tq,...$j,...Dj,...YK,...rj,...sj,...cj,...fj,...Mj,...Yj,...BR];for(let e of eu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:WT(e.usage.category,n.join(" "))})}var lB="0.1.123";function dB(){return eu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=UT[so(t)];return{path:t,effect:ao(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(dB,"plexusCommandCatalog");import Zo from"node:path";function dZ(e){let n=ln()?.workspaceRoot??process.cwd(),t=Zo.resolve(n,e),r=Zo.relative(n,t);if(Zo.isAbsolute(e)||r===".."||r.startsWith(`..${Zo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(dZ,"workspacePath");function cZ(e){let{absolute:n,relative:t}=dZ(e.path??".");if(e.operation==="list"){if(!Se(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=Zo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Zo.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return ze(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Fn(Zo.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return ts(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(cZ,"plexusWorkspace");function cB(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=al[t];if(!o||!Object.hasOwn(al,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(qg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:qg[i.path],skillHash:Yu}}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 cZ(i)},"executePlexusAgentTool")}s(cB,"createPlexusAgentToolExecutor");var Ah=cB({inspectCommand:fB,executeCommand:pB});function Eh(){let e=new ss({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:lB});e.register(Va.HelpCommand),e.register(Va.VersionCommand);for(let t of eu)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 pZ(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(Eh,"createPlexusCli");function pZ(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&Ha[t]===r&&an(n,t,r),t in Ha&&ao(t)==="confirm"&&!Ja(e)&&n.write(`plexus-cli: \`${Ha[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11348
|
+
`);return t.length>0?1:0}},qE=class extends lr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=$.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function iB(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(iB,"requireOnOff");var oB=[xE,SE,AE,EE,TE,$E,RE,IE,OE,PE,Xc,_E,NE,CE,DE,FE,LE,ME,qE];function sB(e){return e.de??e.en??Object.values(e)[0]??""}s(sB,"titleDe");function aZ(e){return{id:e._id,kind:e.kind,status:e.status,title:sB(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(aZ,"row");var lZ=["id","kind","status","title","assignee","group","outcome"],BE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=$.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(aZ),lZ),0}},UE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=$.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:sB(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}},VE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=$.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},GE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=$.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},zE=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=$.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},aB=[BE,UE,VE,GE,zE];var eu=[...TR,...AC,...DC,...LD,...FD,...dF,...gF,...hF,...tB,...oB,...nB,...jK,...WK,...lC,...oF,...Vj,...AR,...XR,...WN,...kF,...wF,...xF,...SF,...rF,...UD,...aB,...KM,...Eq,...qK,...Tq,...$j,...Dj,...YK,...rj,...sj,...cj,...fj,...Mj,...Yj,...BR];for(let e of eu){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:WT(e.usage.category,n.join(" "))})}var lB="0.1.125";function dB(){return eu.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=UT[so(t)];return{path:t,effect:ao(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(dB,"plexusCommandCatalog");import Zo from"node:path";function dZ(e){let n=ln()?.workspaceRoot??process.cwd(),t=Zo.resolve(n,e),r=Zo.relative(n,t);if(Zo.isAbsolute(e)||r===".."||r.startsWith(`..${Zo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(dZ,"workspacePath");function cZ(e){let{absolute:n,relative:t}=dZ(e.path??".");if(e.operation==="list"){if(!Se(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=Zo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Zo.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return ze(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Fn(Zo.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return ts(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(cZ,"plexusWorkspace");function cB(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=al[t];if(!o||!Object.hasOwn(al,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(qg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:qg[i.path],skillHash:Yu}}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 cZ(i)},"executePlexusAgentTool")}s(cB,"createPlexusAgentToolExecutor");var Ah=cB({inspectCommand:fB,executeCommand:pB});function Eh(){let e=new ss({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:lB});e.register(Va.HelpCommand),e.register(Va.VersionCommand);for(let t of eu)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 pZ(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(Eh,"createPlexusCli");function pZ(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&Ha[t]===r&&an(n,t,r),t in Ha&&ao(t)==="confirm"&&!Ja(e)&&n.write(`plexus-cli: \`${Ha[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11351
11349
|
`)}s(pZ,"noteRetiredPath");function fB(e){let n=Eh().process(Da(e),{executePlexusAgentTool:Ah}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=dB().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"?Zp(ma(ha),i.fn??"",i.kind):void 0,a=Du(t,{confirm:Ja(n),callKind:o});return{...r,writes:a}}s(fB,"inspectPlexusCommand");async function pB(e,n){if(n)return HE(n,()=>pB(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=Eh();if(ln()){let l=fB(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(Da(e.argv),{executePlexusAgentTool:Ah,stdin:fZ.from(e.stdin===void 0?[]:[e.stdin]),stdout:new uB({write(l,d,c){t+=String(l),c()}}),stderr:new uB({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(pB,"executePlexusCommand");eT({source:mZ.join(import.meta.dirname,"skill")});Eh().runExit(Da(process.argv.slice(2)),{executePlexusAgentTool:Ah});
|
|
11352
11350
|
//# sourceMappingURL=cli.mjs.map
|