@smartkomm/plexus-cli 0.1.34 → 0.1.35

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
@@ -79,7 +79,7 @@ ${t.map(n=>`
79
79
  `),a}format(t){var n;return((n=t??this.enableColors)!==null&&n!==void 0?n:e.defaultContext.colorDepth>1)?fE:pE}getUsageByRegistration(t,n){let r=this.registrations.get(t);if(typeof r>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(r.index,n)}getUsageByIndex(t,n){return this.builder.getBuilderByIndex(t).usage(n)}};Jo.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:sE()};function hE(e){return e()}s(hE,"noopCaptureActivator");var Aa={};BA(Aa,{DefinitionsCommand:()=>ba,HelpCommand:()=>va,TokensCommand:()=>xa,VersionCommand:()=>Sa});var ba=class extends T{static{s(this,"DefinitionsCommand")}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)}
80
80
  `)}};ba.paths=[["--clipanion=definitions"]];var va=class extends T{static{s(this,"HelpCommand")}async execute(){this.context.stdout.write(this.cli.usage())}};va.paths=[["-h"],["--help"]];function Qc(e={}){return on({definition(t,n){var r;t.addProxy({name:(r=e.name)!==null&&r!==void 0?r:n,required:e.required})},transformer(t,n,r){return r.positionals.map(({value:i})=>i)}})}s(Qc,"Proxy");var xa=class extends T{static{s(this,"TokensCommand")}constructor(){super(...arguments),this.args=Qc()}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.process(this.args).tokens,null,2)}
81
81
  `)}};xa.paths=[["--clipanion=tokens"]];var Sa=class extends T{static{s(this,"VersionCommand")}async execute(){var t;this.context.stdout.write(`${(t=this.cli.binaryVersion)!==null&&t!==void 0?t:"<unknown>"}
82
- `)}};Sa.paths=[["-v"],["--version"]];var p={};BA(p,{Array:()=>gE,Boolean:()=>yE,Counter:()=>wE,Proxy:()=>Qc,Rest:()=>kE,String:()=>bE,applyValidator:()=>Hi,cleanValidationError:()=>Vc,formatError:()=>ya,isOptionSymbol:()=>ga,makeCommandOption:()=>on,rerouteArguments:()=>vr});function gE(e,t,n){let[r,i]=vr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return on({definition(d){d.addOption({names:a,arity:o,hidden:i?.hidden,description:i?.description,required:i.required})},transformer(d,c,u){let f,m=typeof r<"u"?[...r]:void 0;for(let{name:y,value:k}of u.options)l.has(y)&&(f=y,m=m??[],m.push(k));return typeof m<"u"?Hi(f??c,m,i.validator):m}})}s(gE,"Array");function yE(e,t,n){let[r,i]=vr(t,n??{}),o=e.split(","),a=new Set(o);return on({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:f,value:m}of c.options)a.has(f)&&(u=m);return u}})}s(yE,"Boolean");function wE(e,t,n){let[r,i]=vr(t,n??{}),o=e.split(","),a=new Set(o);return on({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:f,value:m}of c.options)a.has(f)&&(u??(u=0),m?u+=1:u=0);return u}})}s(wE,"Counter");function kE(e={}){return on({definition(t,n){var r;t.addRest({name:(r=e.name)!==null&&r!==void 0?r:n,required:e.required})},transformer(t,n,r){let i=s(a=>{let l=r.positionals[a];return l.extra===In||l.extra===!1&&a<t.arity.leading.length},"isRestPositional"),o=0;for(;o<r.positionals.length&&i(o);)o+=1;return r.positionals.splice(0,o).map(({value:a})=>a)}})}s(kE,"Rest");function Dj(e,t,n){let[r,i]=vr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return on({definition(d){d.addOption({names:a,arity:i.tolerateBoolean?0:o,hidden:i.hidden,description:i.description,required:i.required})},transformer(d,c,u,f){let m,y=r;typeof i.env<"u"&&f.env[i.env]&&(m=i.env,y=f.env[i.env]);for(let{name:k,value:g}of u.options)l.has(k)&&(m=k,y=g);return typeof y=="string"?Hi(m??c,y,i.validator):y}})}s(Dj,"StringOption");function Fj(e={}){let{required:t=!0}=e;return on({definition(n,r){var i;n.addPositional({name:(i=e.name)!==null&&i!==void 0?i:r,required:e.required})},transformer(n,r,i){var o;for(let a=0;a<i.positionals.length;++a){if(i.positionals[a].extra===In||t&&i.positionals[a].extra===!0||!t&&i.positionals[a].extra===!1)continue;let[l]=i.positionals.splice(a,1);return Hi((o=e.name)!==null&&o!==void 0?o:r,l.value,e.validator)}}})}s(Fj,"StringPositional");function bE(e,...t){return typeof e=="string"?Dj(e,...t):Fj(e)}s(bE,"String");import{Readable as g3,Writable as dK}from"node:stream";var Sr=[],Un=[],Lj=Uint8Array,fh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Yi=0,vE=fh.length;Yi<vE;++Yi)Sr[Yi]=fh[Yi],Un[fh.charCodeAt(Yi)]=Yi;var Yi,vE;Un[45]=62;Un[95]=63;function Mj(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}s(Mj,"getLens");function qj(e,t,n){return(t+n)*3/4-n}s(qj,"_byteLength");function Qo(e){var t,n=Mj(e),r=n[0],i=n[1],o=new Lj(qj(e,r,i)),a=0,l=i>0?r-4:r,d;for(d=0;d<l;d+=4)t=Un[e.charCodeAt(d)]<<18|Un[e.charCodeAt(d+1)]<<12|Un[e.charCodeAt(d+2)]<<6|Un[e.charCodeAt(d+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=Un[e.charCodeAt(d)]<<2|Un[e.charCodeAt(d+1)]>>4,o[a++]=t&255),i===1&&(t=Un[e.charCodeAt(d)]<<10|Un[e.charCodeAt(d+1)]<<4|Un[e.charCodeAt(d+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}s(Qo,"toByteArray");function Kj(e){return Sr[e>>18&63]+Sr[e>>12&63]+Sr[e>>6&63]+Sr[e&63]}s(Kj,"tripletToBase64");function jj(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(Kj(r));return i.join("")}s(jj,"encodeChunk");function Zo(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(jj(e,a,a+o>l?l:a+o));return r===1?(t=e[n-1],i.push(Sr[t>>2]+Sr[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(Sr[t>>10]+Sr[t>>4&63]+Sr[t<<2&63]+"=")),i.join("")}s(Zo,"fromByteArray");function Vn(e){if(e===void 0)return{};if(!Xc(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}s(Vn,"parseArgs");function Zc(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}s(Zc,"validateDeploymentUrl");function Xc(e){let t=typeof e=="object",n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&r}s(Xc,"isSimpleObject");var AE=!0,Xo=BigInt("-9223372036854775808"),tu=BigInt("9223372036854775807"),gh=BigInt("0"),Bj=BigInt("8"),Uj=BigInt("256"),mh="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",Qi=class{static{s(this,"CommitTsPlaceholder")}[Symbol.toPrimitive](t){if(t==="string")return this.toString();throw new Error(mh)}valueOf(){throw new Error(mh)}toJSON(){throw new Error(mh)}toString(){return"[unresolved commit timestamp]"}},EE=new Qi;function TE(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}s(TE,"isSpecial");function Vj(e){e<gh&&(e-=Xo+Xo);let t=e.toString(16);t.length%2===1&&(t="0"+t);let n=new Uint8Array(new ArrayBuffer(8)),r=0;for(let i of t.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),e>>=Bj;return Zo(n)}s(Vj,"slowBigIntToBase64");function Gj(e){let t=Qo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=gh,r=gh;for(let i of t)n+=BigInt(i)*Uj**r,r++;return n>tu&&(n+=Xo+Xo),n}s(Gj,"slowBase64ToBigInt");function zj(e){if(e<Xo||tu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Zo(new Uint8Array(t))}s(zj,"modernBigIntToBase64");function Wj(e){let t=Qo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}s(Wj,"modernBase64ToBigInt");var Hj=DataView.prototype.setBigInt64?zj:Vj,Yj=DataView.prototype.getBigInt64?Wj:Gj,xE=1024;function yh(e){if(e.length>xE)throw new Error(`Field name ${e} exceeds maximum field name length ${xE}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}s(yh,"validateObjectField");function Ct(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>Ct(r));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let r=t[0][0];if(r==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Qo(e.$bytes).buffer}if(r==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return Yj(e.$integer)}if(r==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);let i=Qo(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);let a=new DataView(i.buffer).getFloat64(0,AE);if(!TE(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(r==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return EE}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}let n={};for(let[r,i]of Object.entries(e))yh(r),n[r]=Ct(i);return n}s(Ct,"jsonToConvex");var SE=16384;function Ji(e){let t=JSON.stringify(e,(n,r)=>r===void 0?"undefined":typeof r=="function"?"[Function]":typeof r=="symbol"?String(r):typeof r=="bigint"?`${r.toString()}n`:r);if(t.length>SE){let n="[...truncated]",r=SE-n.length,i=t.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),t.substring(0,r)+n}return t}s(Ji,"stringifyValueForError");function eu(e,t,n,r){if(e===void 0){let a=n&&` (present at path ${n} in original object ${Ji(t)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<Xo||tu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:Hj(e)}}if(typeof e=="number")if(TE(e)){let a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,e,AE),{$float:Zo(new Uint8Array(a))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Zo(new Uint8Array(e))};if(e instanceof Qi)return{$commitTs:null};if(Array.isArray(e))return e.map((a,l)=>eu(a,t,n+`[${l}]`,!1));if(e instanceof Set)throw new Error(hh(n,"Set",[...e],t));if(e instanceof Map)throw new Error(hh(n,"Map",[...e],t));if(!Xc(e)){let a=e?.constructor?.name,l=a?`${a} `:"";throw new Error(hh(n,l,e,t))}let i={},o=Object.entries(e);o.sort(([a,l],[d,c])=>a===d?0:a<d?-1:1);for(let[a,l]of o)l!==void 0?(yh(a),i[a]=eu(l,t,n+`.${a}`,!1)):r&&(yh(a),i[a]=Jj(l,t,n+`.${a}`));return i}s(eu,"convexToJsonInternal");function hh(e,t,n,r){return e?`${t}${Ji(n)} is not a supported Convex type (present at path ${e} in original object ${Ji(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Ji(n)} is not a supported Convex type.`}s(hh,"errorMessageForUnsupportedType");function Jj(e,t,n){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Ji(e)} but original value is undefined`);return eu(e,t,n,!1)}s(Jj,"convexOrUndefinedToJsonInternal");function Qt(e){return eu(e,e,"",!1)}s(Qt,"convexToJson");var Qj=Object.defineProperty,Zj=s((e,t,n)=>t in e?Qj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),nt=s((e,t,n)=>Zj(e,typeof t!="symbol"?t+"":t,n),"__publicField"),Xj="https://docs.convex.dev/error#undefined-validator";function Ea(e,t){let n=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${Xj} for details.`)}s(Ea,"throwUndefinedValidatorError");var Zt=class{static{s(this,"BaseValidator")}constructor({isOptional:t}){nt(this,"type"),nt(this,"fieldPaths"),nt(this,"isOptional"),nt(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}},nu=class e extends Zt{static{s(this,"VId")}constructor({isOptional:t,tableName:n}){if(super({isOptional:t}),nt(this,"tableName"),nt(this,"kind","id"),typeof n!="string")throw new Error("v.id(tableName) requires a string");this.tableName=n}get json(){return{type:"id",tableName:this.tableName}}optional(){return new e({isOptional:"optional",tableName:this.tableName})}asOptional(){return this.optional()}},Ta=class e extends Zt{static{s(this,"VFloat64")}constructor(){super(...arguments),nt(this,"kind","float64")}get json(){return{type:"number"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},$a=class e extends Zt{static{s(this,"VInt64")}constructor(){super(...arguments),nt(this,"kind","int64")}get json(){return{type:"bigint"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},ru=class e extends Zt{static{s(this,"VCommitTs")}constructor(){super(...arguments),nt(this,"kind","commitTs")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},iu=class e extends Zt{static{s(this,"VBoolean")}constructor(){super(...arguments),nt(this,"kind","boolean")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},ou=class e extends Zt{static{s(this,"VBytes")}constructor(){super(...arguments),nt(this,"kind","bytes")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},su=class e extends Zt{static{s(this,"VString")}constructor(){super(...arguments),nt(this,"kind","string")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},au=class e extends Zt{static{s(this,"VNull")}constructor(){super(...arguments),nt(this,"kind","null")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},lu=class e extends Zt{static{s(this,"VAny")}constructor(){super(...arguments),nt(this,"kind","any")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},du=class e extends Zt{static{s(this,"VObject")}constructor({isOptional:t,fields:n}){super({isOptional:t}),nt(this,"fields"),nt(this,"kind","object"),globalThis.Object.entries(n).forEach(([r,i])=>{if(i===void 0&&Ea("v.object()",r),!i.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=n}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,n])=>[t,{fieldType:n.json,optional:n.isOptional==="optional"}]))}}optional(){return new e({isOptional:"optional",fields:this.fields})}asOptional(){return this.optional()}omit(...t){let n={...this.fields};for(let r of t)delete n[r];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let r of t)n[r]=this.fields[r];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[n,r]of globalThis.Object.entries(this.fields))t[n]=r.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},cu=class e extends Zt{static{s(this,"VLiteral")}constructor({isOptional:t,value:n}){if(super({isOptional:t}),nt(this,"value"),nt(this,"kind","literal"),typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"&&typeof n!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=n}get json(){return{type:this.kind,value:Qt(this.value)}}optional(){return new e({isOptional:"optional",value:this.value})}asOptional(){return this.optional()}},uu=class e extends Zt{static{s(this,"VArray")}constructor({isOptional:t,element:n}){super({isOptional:t}),nt(this,"element"),nt(this,"kind","array"),n===void 0&&Ea("v.array()"),this.element=n}get json(){return{type:this.kind,value:this.element.json}}optional(){return new e({isOptional:"optional",element:this.element})}asOptional(){return this.optional()}},fu=class e extends Zt{static{s(this,"VRecord")}constructor({isOptional:t,key:n,value:r}){if(super({isOptional:t}),nt(this,"key"),nt(this,"value"),nt(this,"kind","record"),n===void 0&&Ea("v.record()","key"),r===void 0&&Ea("v.record()","value"),n.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(r.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!n.isConvexValidator||!r.isConvexValidator)throw new Error("Key and value of v.record() must be validators");this.key=n,this.value=r}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}optional(){return new e({isOptional:"optional",key:this.key,value:this.value})}asOptional(){return this.optional()}},pu=class e extends Zt{static{s(this,"VUnion")}constructor({isOptional:t,members:n}){super({isOptional:t}),nt(this,"members"),nt(this,"kind","union"),n.forEach((r,i)=>{if(r===void 0&&Ea("v.union()",`member at index ${i}`),!r.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=n}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}optional(){return new e({isOptional:"optional",members:this.members})}asOptional(){return this.optional()}};function mu(e){return e?.isConvexValidator===!0}s(mu,"isValidator");var w={id:s(e=>new nu({isOptional:"required",tableName:e}),"id"),null:s(()=>new au({isOptional:"required"}),"null"),number:s(()=>new Ta({isOptional:"required"}),"number"),float64:s(()=>new Ta({isOptional:"required"}),"float64"),bigint:s(()=>new $a({isOptional:"required"}),"bigint"),int64:s(()=>new $a({isOptional:"required"}),"int64"),commitTs:s(()=>new ru({isOptional:"required"}),"commitTs"),boolean:s(()=>new iu({isOptional:"required"}),"boolean"),string:s(()=>new su({isOptional:"required"}),"string"),bytes:s(()=>new ou({isOptional:"required"}),"bytes"),literal:s(e=>new cu({isOptional:"required",value:e}),"literal"),array:s(e=>new uu({isOptional:"required",element:e}),"array"),object:s(e=>new du({isOptional:"required",fields:e}),"object"),record:s((e,t)=>new fu({isOptional:"required",key:e,value:t}),"record"),union:s((...e)=>new pu({isOptional:"required",members:e}),"union"),any:s(()=>new lu({isOptional:"required"}),"any"),optional:s(e=>e.asOptional(),"optional"),nullable:s(e=>w.union(e,w.null()),"nullable")};var eB=Object.defineProperty,tB=s((e,t,n)=>t in e?eB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),wh=s((e,t,n)=>tB(e,typeof t!="symbol"?t+"":t,n),"__publicField"),$E,RE,nB=Symbol.for("ConvexError"),gn=class extends(RE=Error,$E=nB,RE){static{s(this,"ConvexError")}constructor(t){super(typeof t=="string"?t:Ji(t)),wh(this,"name","ConvexError"),wh(this,"data"),wh(this,$E,!0),this.data=t}};var IE=s(()=>Array.from({length:4},()=>0),"arr"),I8=IE(),O8=IE();var sn="1.47.0";var Zi=Symbol.for("functionName");var kh=Symbol.for("toReferencePath");function iB(e){return e[kh]??null}s(iB,"extractReferencePath");function oB(e){return e.startsWith("function://")}s(oB,"isFunctionHandle");function Br(e){let t;if(typeof e=="string")oB(e)?t={functionHandle:e}:t={name:e};else if(e[Zi])t={name:e[Zi]};else{let n=iB(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}s(Br,"getFunctionAddress");var mX=w.object({numItems:w.number(),cursor:w.union(w.string(),w.null()),endCursor:w.optional(w.union(w.string(),w.null())),id:w.optional(w.number()),maximumRowsRead:w.optional(w.number()),maximumBytesRead:w.optional(w.number())});function ir(e){let t=Br(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;let n=e[Zi];if(!n)throw new Error(`${e} is not a functionReference`);return n}s(ir,"getFunctionName");function Ra(e){return{[Zi]:e}}s(Ra,"makeFunctionReference");function PE(e=[]){let t={get(n,r){if(typeof r=="string"){let i=[...e,r];return PE(i)}else if(r===Zi){if(e.length<2){let a=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}let i=e.slice(0,-1).join("/"),o=e[e.length-1];return o==="default"?i:i+":"+o}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}s(PE,"createApi");var hu=PE();function _E(e,t){let n={get(r,i){if(typeof i=="string"){let o=[...t,i];return _E(e,o)}else if(i===kh){if(t.length<1){let o=[e,...t].join(".");throw new Error(`API path is expected to be of the form \`${e}.childComponent.functionName\`. Found: \`${o}\``)}return"_reference/childComponent/"+t.join("/")}else return}};return new Proxy({},n)}s(_E,"createChildComponents");var vh=s(()=>_E("components",[]),"componentsGeneric");var lB=Symbol("var.requestId"),dB=Symbol("var.ip"),cB=Symbol("var.userAgent"),uB=Symbol("var.now"),fB=Symbol("var.convexActor"),pB={[lB]:"requestId",[dB]:"ip",[cB]:"userAgent",[uB]:"now",[fB]:"convexActor"};var mB=Object.defineProperty,hB=s((e,t,n)=>t in e?mB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),or=s((e,t,n)=>hB(e,typeof t!="symbol"?t+"":t,n),"__publicField"),gu=class{static{s(this,"TableDefinition")}constructor(t){or(this,"indexes"),or(this,"stagedDbIndexes"),or(this,"searchIndexes"),or(this,"stagedSearchIndexes"),or(this,"vectorIndexes"),or(this,"stagedVectorIndexes"),or(this,"validator"),or(this,"stagedValidator"),this.indexes=[],this.stagedDbIndexes=[],this.searchIndexes=[],this.stagedSearchIndexes=[],this.vectorIndexes=[],this.stagedVectorIndexes=[],this.validator=t}" indexes"(){return this.indexes}index(t,n){return Array.isArray(n)?this.indexes.push({indexDescriptor:t,fields:n}):n.staged?this.stagedDbIndexes.push({indexDescriptor:t,fields:n.fields}):this.indexes.push({indexDescriptor:t,fields:n.fields}),this}searchIndex(t,n){return n.staged?this.stagedSearchIndexes.push({indexDescriptor:t,searchField:n.searchField,filterFields:n.filterFields||[]}):this.searchIndexes.push({indexDescriptor:t,searchField:n.searchField,filterFields:n.filterFields||[]}),this}vectorIndex(t,n){return n.staged?this.stagedVectorIndexes.push({indexDescriptor:t,vectorField:n.vectorField,dimensions:n.dimensions,filterFields:n.filterFields||[]}):this.vectorIndexes.push({indexDescriptor:t,vectorField:n.vectorField,dimensions:n.dimensions,filterFields:n.filterFields||[]}),this}staged(t){if(this.stagedValidator!==void 0)throw new Error("Table cannot have more than one staged validator.");if(mu(t))this.stagedValidator=t;else{if(this.validator.kind!=="object"&&this.validator.kind!=="any")throw new Error("Specifying top-level field changes is only supported for simple table definitions. For a table defined with a union or record validator, you must stage a fully defined object or union validator.");let n=this.validator.kind==="object"?this.validator.fields:{},r=Object.fromEntries(Object.entries({...n,...t}).filter(i=>i[1]!==void 0));this.stagedValidator=w.object(r)}return this.self()}self(){return this}export(){let t=this.validator.json;if(typeof t!="object")throw new Error("Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)");let n;if(this.stagedValidator!==void 0&&(n=this.stagedValidator.json,typeof n!="object"))throw new Error("Invalid staged validator: please make sure that the parameter of `.staged()` is valid (see https://docs.convex.dev/database/schemas)");return{indexes:this.indexes,stagedDbIndexes:this.stagedDbIndexes,searchIndexes:this.searchIndexes,stagedSearchIndexes:this.stagedSearchIndexes,vectorIndexes:this.vectorIndexes,stagedVectorIndexes:this.stagedVectorIndexes,documentType:t,stagedDocumentType:n}}};function Ur(e){return mu(e)?new gu(e):new gu(w.object(e))}s(Ur,"defineTable");function CE(e,t){switch(t.kind){case"object":return t.extend({_id:w.id(e),_creationTime:w.number()});case"union":return w.union(...t.members.map(n=>CE(e,n)));case"any":return t;default:throw new Error(`Invalid validator for table "${e}": a table's documents must be objects, or a union of objects (see https://docs.convex.dev/database/schemas)`)}}s(CE,"addSystemFields");function DE(e,t){return CE(e,t.validator)}s(DE,"docValidator");function NE(e,t){let n=e.tables[t];if(n===void 0)throw new Error(`Table "${t}" is not in this schema. Tables in this schema: ${Object.keys(e.tables).join(", ")}`);return n}s(NE,"tableInSchema");var xh=class{static{s(this,"SchemaDefinition")}constructor(t,n){or(this,"tables"),or(this,"strictTableNameTypes"),or(this,"schemaValidation"),this.tables=t,this.schemaValidation=n?.schemaValidation===void 0?!0:n.schemaValidation}doc(t){return DE(t,NE(this,t))}id(t){return NE(this,t),w.id(t)}export(){return JSON.stringify({tables:Object.entries(this.tables).map(([t,n])=>{let{indexes:r,stagedDbIndexes:i,searchIndexes:o,stagedSearchIndexes:a,vectorIndexes:l,stagedVectorIndexes:d,documentType:c,stagedDocumentType:u}=n.export();return{tableName:t,indexes:r,stagedDbIndexes:i,searchIndexes:o,stagedSearchIndexes:a,vectorIndexes:l,stagedVectorIndexes:d,documentType:c,stagedDocumentType:u}}),schemaValidation:this.schemaValidation})}};function FE(e,t){return new xh(e,t)}s(FE,"defineSchema");var JX=FE({_scheduled_functions:Ur({name:w.string(),args:w.array(w.any()),scheduledTime:w.float64(),completedTime:w.optional(w.float64()),state:w.union(w.object({kind:w.literal("pending")}),w.object({kind:w.literal("inProgress")}),w.object({kind:w.literal("success")}),w.object({kind:w.literal("failed"),error:w.string()}),w.object({kind:w.literal("canceled")}))}),_storage:Ur({sha256:w.string(),size:w.float64(),contentType:w.optional(w.string())})});var Ie=class extends Error{static{s(this,"GuardRefusal")}constructor(t,n){super(t,n),this.name="GuardRefusal",this.stack=`${this.name}: ${t}`}};function LE(e){return e instanceof Ie||(typeof e=="object"&&e!==null?e.clipanion:void 0)?.type==="usage"?2:1}s(LE,"exitCodeFor");var gB={"applications discard-test":"write","applications staff-input set":"write","applications start-test":"write","audit access":"write","branding clear-font":"write","branding clear-logo":"write","branding set-font":"write","branding set-logo":"write","branding set-theme":"write","setup export":"write","setup apply":"write","catalog apply":"write","contract grant add":"write","contract grant add-aggregate":"write","contract grant end":"write","contract grant replace":"write","demo link create":"write","feedback assign":"write","feedback create":"write","feedback link":"write","feedback reassign":"write","feedback reply":"write","feedback set-deadline":"write","feedback set-status":"write","feedback sync":"write","feedback tag":"write","feedback tags create":"write","feedback tags set":"write","feedback to-issue":"write","feedback unlink":"write","feedback untag":"write","files put":"write","notifications chrome set":"write","notifications letters reset":"write","notifications letters set":"write","platform notifications retry":"write","platform notifications self-test":"write","offer apply":"write","offer archive":"write","offer capacity set":"write","offer create":"write","offer level add":"write","offer level move":"write","offer level archive":"write","offer level restore":"write","offer level set":"write","offer restore":"write","offer run add":"write","offer run archive":"write","offer run restore":"write","offer run set":"write","offer set":"write","offer unit create":"write","offer unit ensure-pedagogy":"write","org legal-entity create":"write","org legal-entity set":"write","org unit create":"write","org unit set":"write","generator archive":"write","generator scope":"write","platform generator input-key apply":"write","platform generator input-key create":"write","platform generator input-key deprecate":"write","generator package apply":"write","generator package archive":"write","generator package clone":"write","generator package create":"write","generator package seal":"write","generator clone":"write","generator create":"write","generator seal":"write","generator save":"write","generator setup apply":"write","generator source save":"write","generator scenarios approve":"write","platform signing connection activate":"write","platform signing connection reseal":"write","platform signing connection set":"write","signing connection test":"write","signing reconcile":"write","signing resend":"write","signing start":"write","stripe allow":"write","stripe refresh":"write","test-actions run":"write","tokens create":"write","tenant-users notifications set":"write","tenant-users groups add":"write","tenant-users reactivate":"write","tenant-users send-login-link":"write","tenant-users send-password-reset":"write","tenant-users signature request":"write","platform users create":"write","platform users grant":"write","platform users provision":"write","platform users relink-auth":"write","platform users set-password":"write","platform users set-platform-admin":"write","platform users set-platform-permission":"write","work-items assign":"write","work-items complete":"write","work-items create":"write","platform workers reap":"write","config apply":"confirm","config prune-offers":"confirm","config set":"confirm","config wipe":"confirm","demo link delete":"confirm","demo link revoke":"confirm","feedback tags delete":"confirm","files delete":"confirm","generator delete-draft":"confirm","generator package delete-draft":"confirm","imports trigger":"confirm","platform imports trigger-all":"confirm","jobs cancel":"confirm","offer delete":"confirm","org legal-entity delete":"confirm","org unit delete":"confirm","platform imports cleanup-orphaned":"confirm","org delete-subtree":"confirm","platform persons purge":"confirm","retention apply":"confirm","retention parties apply":"confirm","platform signing connection delete":"confirm","signing void":"confirm","tokens revoke":"confirm","tenant-users archive":"confirm","tenant-users deactivate":"confirm","tenant-users invite":"confirm","tenant-users set-key":"confirm","tenant-users groups revoke":"confirm","platform users archive":"confirm","platform users grant-all":"confirm","users groups delete":"confirm","platform users revoke":"confirm","platform users set-email":"confirm",call:"callKind","accounts email-changes":"read","admission runs list":"read","applications counts":"read","applications list":"read","applications show":"read","applications staff-input list":"read","applications store":"read","branding show":"read","catalog export":"read","catalog plan":"read","config export":"read","setup plan":"read","setup list":"read","setup diff":"read","config targets":"read","demo link list":"read","demo link stats":"read","demo videos":"read","feedback admins":"read","feedback comments":"read","feedback links":"read","feedback list":"read","feedback screenshot":"read","feedback tags list":"read","files list":"read","imports status":"read","jobs list":"read","jobs logs":"read","jobs show":"read","leads list":"read","notifications chrome show":"read","notifications letters list":"read","notifications letters show":"read","platform notifications list":"read","platform notifications show":"read","platform notifications sweeper-status":"read","offer diff":"read","offer export":"read","offer list":"read","offer plan":"read","offer show":"read","offer status":"read","offer versions":"read","offer workflow restamp-pins":"read","org tree":"read","platform users list":"read","platform workers list":"read","persons list":"read","platform generator input-key list":"read","platform generator input-key plan":"read","generator list":"read","generator package list":"read","generator package plan":"read","generator package show":"read","generator package test":"read","generator setup plan":"read","generator show":"read","generator source export":"read","generator scenarios test":"read","retention plan":"read","retention parties plan":"read","signing connection show":"read","platform signing status":"read","signing list":"read","signing show":"read","stripe status":"read",tenants:"read","test-actions list":"read","tokens list":"read","tenant-users groups list":"read","tenant-users units list":"read","tenant-users history":"read","tenant-users list":"read","tenant-users notifications list":"read","tenant-users show":"read","platform users doctor":"read","users groups":"read","platform users login-trail":"read","platform users show":"read",whoami:"read","work-items list":"read","work-items show":"read","platform workers logs":"read","platform workers reaper-status":"read","agent tools":"read","assignment simulate":"read","config show":"read",describe:"read",functions:"read","offer form list":"read","offer form show":"read","offer validate":"read","offer workflow channels list":"read","offer workflow node list":"read","offer workflow node reads":"read","offer workflow show":"read","offer workflow staff-input list":"read","agent invoke":"local-write","config init":"local-write","config legal-entity add":"local-write","config unit add":"local-write","offer form add":"local-write","offer form delete":"local-write","offer form computed delete":"local-write","offer form computed add":"local-write","offer form computed set":"local-write","offer form effect add":"local-write","offer form effect delete":"local-write","offer form effect set":"local-write","offer form env set":"local-write","offer form field add":"local-write","offer form field attach":"local-write","offer form field delete":"local-write","offer form field detach":"local-write","offer form field export":"local-write","offer form field move":"local-write","offer form field set":"local-write","offer form outcome add":"local-write","offer form outcome delete":"local-write","offer form outcome set":"local-write","offer form repeated add":"local-write","offer form repeated delete":"local-write","offer form repeated set":"local-write","offer form scenario add":"local-write","offer form scenario delete":"local-write","offer form scenario set":"local-write","offer form section add":"local-write","offer form section delete":"local-write","offer form section move":"local-write","offer form section set":"local-write","offer form set":"local-write","offer init":"local-write","offer manifest set":"local-write","offer upgrade":"local-write","offer workflow channels add":"local-write","offer workflow channels delete":"local-write","offer workflow node add":"local-write","offer workflow node add-reads":"local-write","offer workflow node add-requires":"local-write","offer workflow node clear-notification":"local-write","offer workflow node delete":"local-write","offer workflow node optional-action delete":"local-write","offer workflow node optional-action set":"local-write","offer workflow node remove-reads":"local-write","offer workflow node remove-requires":"local-write","offer workflow node set":"local-write","offer workflow node set-cockpit-fields":"local-write","offer workflow node set-engage":"local-write","offer workflow node set-generator":"local-write","offer workflow node set-input":"local-write","offer workflow node set-notification":"local-write","offer workflow node set-reads":"local-write","offer workflow node set-requires":"local-write","offer workflow node task add":"local-write","offer workflow node task delete":"local-write","offer workflow node task set":"local-write","offer workflow restamp-exports":"local-write","offer workflow staff-input delete":"local-write","offer workflow staff-input set":"local-write",seed:"write"},Ia={"generator input-key apply":"platform generator input-key apply","generator input-key create":"platform generator input-key create","generator input-key deprecate":"platform generator input-key deprecate","generator input-key list":"platform generator input-key list","generator input-key plan":"platform generator input-key plan","imports cleanup-orphaned":"platform imports cleanup-orphaned","imports trigger-all":"platform imports trigger-all","notifications list":"platform notifications list","notifications retry":"platform notifications retry","notifications self-test":"platform notifications self-test","notifications show":"platform notifications show","notifications sweeper-status":"platform notifications sweeper-status","persons purge":"platform persons purge","platform users":"platform users list","platform workers":"platform workers list","signing connection activate":"platform signing connection activate","signing connection delete":"platform signing connection delete","signing connection reseal":"platform signing connection reseal","signing connection set":"platform signing connection set","signing status":"platform signing status","users archive":"platform users archive","users create":"platform users create","users doctor":"platform users doctor","users grant":"platform users grant","users grant-all":"platform users grant-all","users list":"platform users list","users login-trail":"platform users login-trail","users provision":"platform users provision","users relink-auth":"platform users relink-auth","users revoke":"platform users revoke","users set-email":"platform users set-email","users set-password":"platform users set-password","users set-platform-admin":"platform users set-platform-admin","users set-platform-permission":"platform users set-platform-permission","users show":"platform users show","workers logs":"platform workers logs","workers reap":"platform workers reap","workers reaper-status":"platform workers reaper-status","admission laeufe":"admission runs list","feedback deadline":"feedback set-deadline","feedback tags recolor":"feedback tags set","feedback tags rename":"feedback tags set","feedback tags visibility":"feedback tags set","files remove":"files delete","files rm":"files delete","interessenten list":"leads list","offer form computed rm":"offer form computed delete","offer form effect rm":"offer form effect delete","offer form field rm":"offer form field delete","offer form outcome rm":"offer form outcome delete","offer form repeated rm":"offer form repeated delete","offer form rm":"offer form delete","offer form scenario rm":"offer form scenario delete","offer form section rm":"offer form section delete","offer hard-delete":"offer delete","offer level remove":"offer level archive","offer level rename":"offer level set","offer unit delete":"org unit delete","offer workflow channels remove":"offer workflow channels delete","offer workflow channels rm":"offer workflow channels delete","offer workflow node optional-action remove":"offer workflow node optional-action delete","offer workflow node optional-action rm":"offer workflow node optional-action delete","offer workflow node rm":"offer workflow node delete","offer workflow node task remove":"offer workflow node task delete","offer workflow node task rm":"offer workflow node task delete","offer workflow staff-input remove":"offer workflow staff-input delete","offer workflow staff-input rm":"offer workflow staff-input delete","org legal-entity update":"org legal-entity set","org unit update":"org unit set","platform tenants":"tenants","signing connection remove":"platform signing connection delete","stammdaten persons":"persons list","stammdaten persons purge":"platform persons purge",units:"org tree","users add":"platform users grant","users deactivate":"platform users archive","users delete":"platform users archive","users provision-platform-admin":"platform users provision","users provision-platform-user":"platform users provision","users remove":"platform users revoke","users set-group":"tenant-users groups add","users unset-group":"tenant-users groups revoke"};function Xi(e){return Ia[e]??e}s(Xi,"canonicalVerb");var Sh={retiredYes:"--yes",retiredExecute:"--execute"};function Oa(e){let t=e;return t.confirm===!0||Object.keys(Sh).some(n=>t[n]===!0)}s(Oa,"confirmGiven");var ME={seed:"Requires the local RDU stack and deployment admin access.","feedback to-issue":"Requires the operator's locally authenticated GitHub CLI.","feedback sync":"Requires the operator's locally authenticated GitHub CLI.","imports trigger":"Reads import-provider credentials from the local environment.","agent invoke":"Tool transport entrypoint; nested transports are not executable commands."};function eo(e){let t=gB[Xi(e)];if(t===void 0)throw new Ie(`plexus: "${e}" is not classified in plexus/writeVerbs.ts \u2014 add it as read|write|confirm|callKind|local-write.`);return t}s(eo,"commandEffect");function wu(e,t){switch(eo(e)){case"read":case"local-write":return!1;case"write":return!0;case"confirm":return t.confirm===!0;case"callKind":if(t.callKind===void 0)throw new Ie(`plexus: "${e}" resolved no call kind before connecting.`);return t.callKind!=="query"}}s(wu,"runWrites");var yu=s(()=>!0,"always"),qE={"config targets":[{fn:"config/api:targets",why:"lists the config targets through an action",when:yu}],"setup plan":[{fn:"setupExport:platformPlanPart",why:"previews the restore server-side (every part as a dry run)",when:yu},{fn:"setupExport:platformPlanPlatformPart",why:"previews the platform restore server-side (a dry run)",when:yu}]},KE={"config apply":[{fn:"config/api:apply",why:"previews the apply server-side",when:s(e=>e.confirm===!1,"when")},{fn:"config/api:applyPlatform",why:"previews the platform apply",when:s(e=>e.confirm===!1,"when")}],"config set":[{fn:"config/api:setField",why:"previews the change",when:s(e=>e.confirm===!1,"when")}],"config wipe":[{fn:"config/api:wipePreview",why:"counts what a wipe would remove",when:yu}],"config prune-offers":[{fn:"config/api:pruneOffers",why:"lists what would be pruned",when:s(e=>e.commit===!1,"when")}],"platform imports cleanup-orphaned":[{fn:"imports:failOrphanedRuns",why:"lists the orphaned runs",when:s(e=>e.confirm===!1,"when")}],"platform persons purge":[{fn:"parties:purgeDeletedParty",why:"plans the purge",when:s(e=>e.dryRun===!0,"when")}],"platform users set-email":[{fn:"platformAdmin:setUserEmail",why:"plans the change",when:s(e=>e.dryRun===!0,"when")}]};function jE(e,t,n=[]){let r=s(i=>(o,a)=>{let l=ir(o),d=n.find(c=>c.fn===l);if(d===void 0||!d.when(a??{}))throw new Ie(`plexus: "${t}" does not write in this run (plexus/writeVerbs.ts) but called the ${i} ${l}`+(d===void 0?"":" without its dry-run argument")+" \u2014 refused before sending. Classify the command as a write, or declare the call in ACTION_READS / DRY_RUN_CALLS.");return e[i](o,a)},"gate");return new Proxy(e,{get(i,o,a){return o==="mutation"?r("mutation"):o==="action"?r("action"):Reflect.get(i,o,a)}})}s(jE,"guardedCaller");var yB={"audit access":"platform","branding clear-font":"platform","branding clear-logo":"platform","branding set-font":"platform","branding set-logo":"platform","branding set-theme":"platform","branding show":"platform","demo link create":"platform","demo link delete":"platform","demo link list":"platform","demo link revoke":"platform","demo link stats":"platform","demo videos":"platform","feedback admins":"platform","feedback assign":"platform","feedback comments":"platform","feedback create":"platform","feedback link":"platform","feedback links":"platform","feedback list":"platform","feedback reassign":"platform","feedback reply":"platform","feedback screenshot":"platform","feedback set-deadline":"platform","feedback set-status":"platform","feedback sync":"platform","feedback tag":"platform","feedback tags create":"platform","feedback tags delete":"platform","feedback tags list":"platform","feedback tags set":"platform","feedback to-issue":"platform","feedback unlink":"platform","feedback untag":"platform","files delete":"platform","files put":"platform","jobs cancel":"platform","jobs list":"platform","jobs logs":"platform","jobs show":"platform","platform generator input-key apply":"platform","platform generator input-key create":"platform","platform generator input-key deprecate":"platform","platform generator input-key list":"platform","platform generator input-key plan":"platform","platform imports cleanup-orphaned":"platform","platform imports trigger-all":"platform","platform notifications list":"platform","platform notifications retry":"platform","platform notifications self-test":"platform","platform notifications show":"platform","platform notifications sweeper-status":"platform","platform persons purge":"platform","platform signing connection activate":"platform","platform signing connection delete":"platform","platform signing connection reseal":"platform","platform signing connection set":"platform","platform signing status":"platform","platform users archive":"platform","platform users create":"platform","platform users doctor":"platform","platform users grant":"platform","platform users grant-all":"platform","platform users list":"platform","platform users login-trail":"platform","platform users provision":"platform","platform users relink-auth":"platform","platform users revoke":"platform","platform users set-email":"platform","platform users set-password":"platform","platform users set-platform-admin":"platform","platform users set-platform-permission":"platform","platform users show":"platform","platform workers list":"platform","platform workers logs":"platform","platform workers reap":"platform","platform workers reaper-status":"platform","retention apply":"platform","retention parties apply":"platform","retention parties plan":"platform","retention plan":"platform","setup apply":"platform","setup diff":"platform","setup export":"platform","setup list":"platform","setup plan":"platform","accounts email-changes":"tenant","admission runs list":"tenant","applications counts":"tenant","applications discard-test":"tenant","applications list":"tenant","applications show":"tenant","applications staff-input list":"tenant","applications staff-input set":"tenant","applications start-test":"tenant","applications store":"tenant","catalog apply":"tenant","catalog export":"tenant","catalog plan":"tenant","config apply":"tenant","config export":"tenant","config prune-offers":"tenant","config set":"tenant","config targets":"tenant","config wipe":"tenant","contract grant add":"tenant","contract grant add-aggregate":"tenant","contract grant end":"tenant","contract grant replace":"tenant","files list":"tenant","generator archive":"tenant","generator clone":"tenant","generator create":"tenant","generator delete-draft":"tenant","generator list":"tenant","generator package apply":"tenant","generator package archive":"tenant","generator package clone":"tenant","generator package create":"tenant","generator package delete-draft":"tenant","generator package list":"tenant","generator package plan":"tenant","generator package seal":"tenant","generator package show":"tenant","generator package test":"tenant","generator save":"tenant","generator scenarios approve":"tenant","generator scenarios test":"tenant","generator scope":"tenant","generator seal":"tenant","generator setup apply":"tenant","generator setup plan":"tenant","generator show":"tenant","generator source export":"tenant","generator source save":"tenant","imports status":"tenant","imports trigger":"tenant","leads list":"tenant","notifications chrome set":"tenant","notifications chrome show":"tenant","notifications letters list":"tenant","notifications letters reset":"tenant","notifications letters set":"tenant","notifications letters show":"tenant","offer apply":"tenant","offer archive":"tenant","offer capacity set":"tenant","offer create":"tenant","offer delete":"tenant","offer diff":"tenant","offer export":"tenant","offer level add":"tenant","offer level archive":"tenant","offer level move":"tenant","offer level restore":"tenant","offer level set":"tenant","offer list":"tenant","offer plan":"tenant","offer restore":"tenant","offer run add":"tenant","offer run archive":"tenant","offer run restore":"tenant","offer run set":"tenant","offer set":"tenant","offer show":"tenant","offer status":"tenant","offer unit create":"tenant","offer unit ensure-pedagogy":"tenant","offer versions":"tenant","offer workflow restamp-pins":"tenant","org delete-subtree":"tenant","org legal-entity create":"tenant","org legal-entity delete":"tenant","org legal-entity set":"tenant","org tree":"tenant","org unit create":"tenant","org unit delete":"tenant","org unit set":"tenant","persons list":"tenant","signing connection show":"tenant","signing connection test":"tenant","signing list":"tenant","signing reconcile":"tenant","signing resend":"tenant","signing show":"tenant","signing start":"tenant","signing void":"tenant","stripe allow":"tenant","stripe refresh":"tenant","stripe status":"tenant","tenant-users archive":"tenant","tenant-users deactivate":"tenant","tenant-users groups add":"tenant","tenant-users groups list":"tenant","tenant-users groups revoke":"tenant","tenant-users history":"tenant","tenant-users invite":"tenant","tenant-users list":"tenant","tenant-users notifications list":"tenant","tenant-users notifications set":"tenant","tenant-users reactivate":"tenant","tenant-users send-login-link":"tenant","tenant-users send-password-reset":"tenant","tenant-users set-key":"tenant","tenant-users show":"tenant","tenant-users signature request":"tenant","tenant-users units list":"tenant","test-actions list":"tenant","test-actions run":"tenant","users groups":"tenant","users groups delete":"tenant","work-items assign":"tenant","work-items complete":"tenant","work-items create":"tenant","work-items list":"tenant","work-items show":"tenant",call:"self",tenants:"self","tokens create":"self","tokens list":"self","tokens revoke":"self",whoami:"self","agent invoke":"offline","agent tools":"offline","assignment simulate":"offline","config init":"offline","config legal-entity add":"offline","config show":"offline","config unit add":"offline",describe:"offline",functions:"offline","offer form add":"offline","offer form computed add":"offline","offer form computed delete":"offline","offer form computed set":"offline","offer form delete":"offline","offer form effect add":"offline","offer form effect delete":"offline","offer form effect set":"offline","offer form env set":"offline","offer form field add":"offline","offer form field attach":"offline","offer form field delete":"offline","offer form field detach":"offline","offer form field export":"offline","offer form field move":"offline","offer form field set":"offline","offer form list":"offline","offer form outcome add":"offline","offer form outcome delete":"offline","offer form outcome set":"offline","offer form repeated add":"offline","offer form repeated delete":"offline","offer form repeated set":"offline","offer form scenario add":"offline","offer form scenario delete":"offline","offer form scenario set":"offline","offer form section add":"offline","offer form section delete":"offline","offer form section move":"offline","offer form section set":"offline","offer form set":"offline","offer form show":"offline","offer init":"offline","offer manifest set":"offline","offer upgrade":"offline","offer validate":"offline","offer workflow channels add":"offline","offer workflow channels delete":"offline","offer workflow channels list":"offline","offer workflow node add":"offline","offer workflow node add-reads":"offline","offer workflow node add-requires":"offline","offer workflow node clear-notification":"offline","offer workflow node delete":"offline","offer workflow node list":"offline","offer workflow node optional-action delete":"offline","offer workflow node optional-action set":"offline","offer workflow node reads":"offline","offer workflow node remove-reads":"offline","offer workflow node remove-requires":"offline","offer workflow node set":"offline","offer workflow node set-cockpit-fields":"offline","offer workflow node set-engage":"offline","offer workflow node set-generator":"offline","offer workflow node set-input":"offline","offer workflow node set-notification":"offline","offer workflow node set-reads":"offline","offer workflow node set-requires":"offline","offer workflow node task add":"offline","offer workflow node task delete":"offline","offer workflow node task set":"offline","offer workflow restamp-exports":"offline","offer workflow show":"offline","offer workflow staff-input delete":"offline","offer workflow staff-input list":"offline","offer workflow staff-input set":"offline",seed:"offline"};function wB(e){let t=yB[Xi(e)];if(t===void 0)throw new Error(`plexus: "${e}" has no scope in plexus/commandScope.ts \u2014 add platform|tenant|self|offline.`);return t}s(wB,"commandScope");var kB={platform:"platform operator",tenant:"school token",self:"own account",offline:"offline"};function BE(e,t){return`${e??"Other"} (${kB[wB(t)]})`}s(BE,"scopedCategory");var Pa=class extends gn{static{s(this,"RefusalError")}constructor(t,n){super({code:t,message:{de:n.de,en:n.en}}),this.message=n.de}};function ce(e,t){throw new Pa(e,t)}s(ce,"refuse");function N(e,t){throw new Error(e,t)}s(N,"bug");function bB(e){return typeof e=="object"&&e!==null&&Symbol.for("ConvexError")in e}s(bB,"isConvexError");var vB=s(e=>{console.warn(`[refusal/legacyStringMessage] a refusal arrived with a bare string message (${e.code??"no code"}): ${e.de}`)},"legacyReporter"),UE=new Set;function xB(e,t){if(e===void 0)return{de:"",en:""};if(typeof e=="string"){let n=t??e;return UE.has(n)||(UE.add(n),vB({code:t,de:e})),{de:e,en:""}}if(e!==null&&typeof e=="object"){let{de:n,en:r}=e;if(typeof n=="string"&&typeof r=="string")return{de:n,en:r}}N(`refusalOf: a ConvexError's message is neither { de, en } nor a string: ${JSON.stringify(e)}`)}s(xB,"refusalTextOf");function fi(e){if(!bB(e))return null;let t=e.data;if(typeof t=="string")return{code:null,message:{de:t,en:t}};if(t&&typeof t=="object"){let{code:n,message:r}=t,i=typeof n=="string"?n:null;return{code:i,message:xB(r,i)}}return null}s(fi,"refusalOf");function SB(e){let t=fi(e);if(t!==null&&(t.message.de!==""||t.message.en!==""))return{kind:"refusal",code:t.code,message:t.message};let n=e instanceof Error?e.message:String(e),r=/\[Request ID:\s*([0-9a-f]+)\]/i.exec(n)?.[1],i=n.replace(/\[CONVEX[^\]]*\]/g,"").replace(/\[Request ID:[^\]]*\]/gi,"").replace(/\bServer Error\b/gi,"").replace(/\bCalled by client\b/g,"").trim();return r!==void 0&&i===""?{kind:"redacted",requestId:r}:{kind:"technical",text:n}}s(SB,"classifyServerFailure");function AB(e){return{de:`Serverfehler (Request-ID ${e}) \u2014 Details in GlitchTip.`,en:`Server error (request ID ${e}) \u2014 details in GlitchTip.`}}s(AB,"serverFailureText");function Ah(e){let t=SB(e);return t.kind==="refusal"?t.message.de!==""?t.message.de:t.message.en:t.kind==="redacted"?AB(t.requestId).de:t.text}s(Ah,"operatorFailureLine");function GE(e,t,n,r,i){if(n||!r){e.write(`${JSON.stringify(t,null,2)}
82
+ `)}};Sa.paths=[["-v"],["--version"]];var p={};BA(p,{Array:()=>gE,Boolean:()=>yE,Counter:()=>wE,Proxy:()=>Qc,Rest:()=>kE,String:()=>bE,applyValidator:()=>Hi,cleanValidationError:()=>Vc,formatError:()=>ya,isOptionSymbol:()=>ga,makeCommandOption:()=>on,rerouteArguments:()=>vr});function gE(e,t,n){let[r,i]=vr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return on({definition(d){d.addOption({names:a,arity:o,hidden:i?.hidden,description:i?.description,required:i.required})},transformer(d,c,u){let f,m=typeof r<"u"?[...r]:void 0;for(let{name:y,value:k}of u.options)l.has(y)&&(f=y,m=m??[],m.push(k));return typeof m<"u"?Hi(f??c,m,i.validator):m}})}s(gE,"Array");function yE(e,t,n){let[r,i]=vr(t,n??{}),o=e.split(","),a=new Set(o);return on({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:f,value:m}of c.options)a.has(f)&&(u=m);return u}})}s(yE,"Boolean");function wE(e,t,n){let[r,i]=vr(t,n??{}),o=e.split(","),a=new Set(o);return on({definition(l){l.addOption({names:o,allowBinding:!1,arity:0,hidden:i.hidden,description:i.description,required:i.required})},transformer(l,d,c){let u=r;for(let{name:f,value:m}of c.options)a.has(f)&&(u??(u=0),m?u+=1:u=0);return u}})}s(wE,"Counter");function kE(e={}){return on({definition(t,n){var r;t.addRest({name:(r=e.name)!==null&&r!==void 0?r:n,required:e.required})},transformer(t,n,r){let i=s(a=>{let l=r.positionals[a];return l.extra===In||l.extra===!1&&a<t.arity.leading.length},"isRestPositional"),o=0;for(;o<r.positionals.length&&i(o);)o+=1;return r.positionals.splice(0,o).map(({value:a})=>a)}})}s(kE,"Rest");function Dj(e,t,n){let[r,i]=vr(t,n??{}),{arity:o=1}=i,a=e.split(","),l=new Set(a);return on({definition(d){d.addOption({names:a,arity:i.tolerateBoolean?0:o,hidden:i.hidden,description:i.description,required:i.required})},transformer(d,c,u,f){let m,y=r;typeof i.env<"u"&&f.env[i.env]&&(m=i.env,y=f.env[i.env]);for(let{name:k,value:g}of u.options)l.has(k)&&(m=k,y=g);return typeof y=="string"?Hi(m??c,y,i.validator):y}})}s(Dj,"StringOption");function Fj(e={}){let{required:t=!0}=e;return on({definition(n,r){var i;n.addPositional({name:(i=e.name)!==null&&i!==void 0?i:r,required:e.required})},transformer(n,r,i){var o;for(let a=0;a<i.positionals.length;++a){if(i.positionals[a].extra===In||t&&i.positionals[a].extra===!0||!t&&i.positionals[a].extra===!1)continue;let[l]=i.positionals.splice(a,1);return Hi((o=e.name)!==null&&o!==void 0?o:r,l.value,e.validator)}}})}s(Fj,"StringPositional");function bE(e,...t){return typeof e=="string"?Dj(e,...t):Fj(e)}s(bE,"String");import{Readable as g3,Writable as dK}from"node:stream";var Sr=[],Un=[],Lj=Uint8Array,fh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Yi=0,vE=fh.length;Yi<vE;++Yi)Sr[Yi]=fh[Yi],Un[fh.charCodeAt(Yi)]=Yi;var Yi,vE;Un[45]=62;Un[95]=63;function Mj(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}s(Mj,"getLens");function qj(e,t,n){return(t+n)*3/4-n}s(qj,"_byteLength");function Qo(e){var t,n=Mj(e),r=n[0],i=n[1],o=new Lj(qj(e,r,i)),a=0,l=i>0?r-4:r,d;for(d=0;d<l;d+=4)t=Un[e.charCodeAt(d)]<<18|Un[e.charCodeAt(d+1)]<<12|Un[e.charCodeAt(d+2)]<<6|Un[e.charCodeAt(d+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=Un[e.charCodeAt(d)]<<2|Un[e.charCodeAt(d+1)]>>4,o[a++]=t&255),i===1&&(t=Un[e.charCodeAt(d)]<<10|Un[e.charCodeAt(d+1)]<<4|Un[e.charCodeAt(d+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}s(Qo,"toByteArray");function Kj(e){return Sr[e>>18&63]+Sr[e>>12&63]+Sr[e>>6&63]+Sr[e&63]}s(Kj,"tripletToBase64");function jj(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(Kj(r));return i.join("")}s(jj,"encodeChunk");function Zo(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(jj(e,a,a+o>l?l:a+o));return r===1?(t=e[n-1],i.push(Sr[t>>2]+Sr[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(Sr[t>>10]+Sr[t>>4&63]+Sr[t<<2&63]+"=")),i.join("")}s(Zo,"fromByteArray");function Vn(e){if(e===void 0)return{};if(!Xc(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}s(Vn,"parseArgs");function Zc(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}s(Zc,"validateDeploymentUrl");function Xc(e){let t=typeof e=="object",n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&r}s(Xc,"isSimpleObject");var AE=!0,Xo=BigInt("-9223372036854775808"),tu=BigInt("9223372036854775807"),gh=BigInt("0"),Bj=BigInt("8"),Uj=BigInt("256"),mh="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",Qi=class{static{s(this,"CommitTsPlaceholder")}[Symbol.toPrimitive](t){if(t==="string")return this.toString();throw new Error(mh)}valueOf(){throw new Error(mh)}toJSON(){throw new Error(mh)}toString(){return"[unresolved commit timestamp]"}},EE=new Qi;function TE(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}s(TE,"isSpecial");function Vj(e){e<gh&&(e-=Xo+Xo);let t=e.toString(16);t.length%2===1&&(t="0"+t);let n=new Uint8Array(new ArrayBuffer(8)),r=0;for(let i of t.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),e>>=Bj;return Zo(n)}s(Vj,"slowBigIntToBase64");function Gj(e){let t=Qo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=gh,r=gh;for(let i of t)n+=BigInt(i)*Uj**r,r++;return n>tu&&(n+=Xo+Xo),n}s(Gj,"slowBase64ToBigInt");function zj(e){if(e<Xo||tu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Zo(new Uint8Array(t))}s(zj,"modernBigIntToBase64");function Wj(e){let t=Qo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}s(Wj,"modernBase64ToBigInt");var Hj=DataView.prototype.setBigInt64?zj:Vj,Yj=DataView.prototype.getBigInt64?Wj:Gj,xE=1024;function yh(e){if(e.length>xE)throw new Error(`Field name ${e} exceeds maximum field name length ${xE}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}s(yh,"validateObjectField");function Ct(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>Ct(r));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let r=t[0][0];if(r==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Qo(e.$bytes).buffer}if(r==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return Yj(e.$integer)}if(r==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);let i=Qo(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);let a=new DataView(i.buffer).getFloat64(0,AE);if(!TE(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(r==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return EE}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}let n={};for(let[r,i]of Object.entries(e))yh(r),n[r]=Ct(i);return n}s(Ct,"jsonToConvex");var SE=16384;function Ji(e){let t=JSON.stringify(e,(n,r)=>r===void 0?"undefined":typeof r=="function"?"[Function]":typeof r=="symbol"?String(r):typeof r=="bigint"?`${r.toString()}n`:r);if(t.length>SE){let n="[...truncated]",r=SE-n.length,i=t.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),t.substring(0,r)+n}return t}s(Ji,"stringifyValueForError");function eu(e,t,n,r){if(e===void 0){let a=n&&` (present at path ${n} in original object ${Ji(t)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<Xo||tu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:Hj(e)}}if(typeof e=="number")if(TE(e)){let a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,e,AE),{$float:Zo(new Uint8Array(a))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Zo(new Uint8Array(e))};if(e instanceof Qi)return{$commitTs:null};if(Array.isArray(e))return e.map((a,l)=>eu(a,t,n+`[${l}]`,!1));if(e instanceof Set)throw new Error(hh(n,"Set",[...e],t));if(e instanceof Map)throw new Error(hh(n,"Map",[...e],t));if(!Xc(e)){let a=e?.constructor?.name,l=a?`${a} `:"";throw new Error(hh(n,l,e,t))}let i={},o=Object.entries(e);o.sort(([a,l],[d,c])=>a===d?0:a<d?-1:1);for(let[a,l]of o)l!==void 0?(yh(a),i[a]=eu(l,t,n+`.${a}`,!1)):r&&(yh(a),i[a]=Jj(l,t,n+`.${a}`));return i}s(eu,"convexToJsonInternal");function hh(e,t,n,r){return e?`${t}${Ji(n)} is not a supported Convex type (present at path ${e} in original object ${Ji(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Ji(n)} is not a supported Convex type.`}s(hh,"errorMessageForUnsupportedType");function Jj(e,t,n){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Ji(e)} but original value is undefined`);return eu(e,t,n,!1)}s(Jj,"convexOrUndefinedToJsonInternal");function Qt(e){return eu(e,e,"",!1)}s(Qt,"convexToJson");var Qj=Object.defineProperty,Zj=s((e,t,n)=>t in e?Qj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),nt=s((e,t,n)=>Zj(e,typeof t!="symbol"?t+"":t,n),"__publicField"),Xj="https://docs.convex.dev/error#undefined-validator";function Ea(e,t){let n=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${Xj} for details.`)}s(Ea,"throwUndefinedValidatorError");var Zt=class{static{s(this,"BaseValidator")}constructor({isOptional:t}){nt(this,"type"),nt(this,"fieldPaths"),nt(this,"isOptional"),nt(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}},nu=class e extends Zt{static{s(this,"VId")}constructor({isOptional:t,tableName:n}){if(super({isOptional:t}),nt(this,"tableName"),nt(this,"kind","id"),typeof n!="string")throw new Error("v.id(tableName) requires a string");this.tableName=n}get json(){return{type:"id",tableName:this.tableName}}optional(){return new e({isOptional:"optional",tableName:this.tableName})}asOptional(){return this.optional()}},Ta=class e extends Zt{static{s(this,"VFloat64")}constructor(){super(...arguments),nt(this,"kind","float64")}get json(){return{type:"number"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},$a=class e extends Zt{static{s(this,"VInt64")}constructor(){super(...arguments),nt(this,"kind","int64")}get json(){return{type:"bigint"}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},ru=class e extends Zt{static{s(this,"VCommitTs")}constructor(){super(...arguments),nt(this,"kind","commitTs")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},iu=class e extends Zt{static{s(this,"VBoolean")}constructor(){super(...arguments),nt(this,"kind","boolean")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},ou=class e extends Zt{static{s(this,"VBytes")}constructor(){super(...arguments),nt(this,"kind","bytes")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},su=class e extends Zt{static{s(this,"VString")}constructor(){super(...arguments),nt(this,"kind","string")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},au=class e extends Zt{static{s(this,"VNull")}constructor(){super(...arguments),nt(this,"kind","null")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},lu=class e extends Zt{static{s(this,"VAny")}constructor(){super(...arguments),nt(this,"kind","any")}get json(){return{type:this.kind}}optional(){return new e({isOptional:"optional"})}asOptional(){return this.optional()}},du=class e extends Zt{static{s(this,"VObject")}constructor({isOptional:t,fields:n}){super({isOptional:t}),nt(this,"fields"),nt(this,"kind","object"),globalThis.Object.entries(n).forEach(([r,i])=>{if(i===void 0&&Ea("v.object()",r),!i.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=n}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,n])=>[t,{fieldType:n.json,optional:n.isOptional==="optional"}]))}}optional(){return new e({isOptional:"optional",fields:this.fields})}asOptional(){return this.optional()}omit(...t){let n={...this.fields};for(let r of t)delete n[r];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let r of t)n[r]=this.fields[r];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[n,r]of globalThis.Object.entries(this.fields))t[n]=r.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},cu=class e extends Zt{static{s(this,"VLiteral")}constructor({isOptional:t,value:n}){if(super({isOptional:t}),nt(this,"value"),nt(this,"kind","literal"),typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"&&typeof n!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=n}get json(){return{type:this.kind,value:Qt(this.value)}}optional(){return new e({isOptional:"optional",value:this.value})}asOptional(){return this.optional()}},uu=class e extends Zt{static{s(this,"VArray")}constructor({isOptional:t,element:n}){super({isOptional:t}),nt(this,"element"),nt(this,"kind","array"),n===void 0&&Ea("v.array()"),this.element=n}get json(){return{type:this.kind,value:this.element.json}}optional(){return new e({isOptional:"optional",element:this.element})}asOptional(){return this.optional()}},fu=class e extends Zt{static{s(this,"VRecord")}constructor({isOptional:t,key:n,value:r}){if(super({isOptional:t}),nt(this,"key"),nt(this,"value"),nt(this,"kind","record"),n===void 0&&Ea("v.record()","key"),r===void 0&&Ea("v.record()","value"),n.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(r.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!n.isConvexValidator||!r.isConvexValidator)throw new Error("Key and value of v.record() must be validators");this.key=n,this.value=r}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}optional(){return new e({isOptional:"optional",key:this.key,value:this.value})}asOptional(){return this.optional()}},pu=class e extends Zt{static{s(this,"VUnion")}constructor({isOptional:t,members:n}){super({isOptional:t}),nt(this,"members"),nt(this,"kind","union"),n.forEach((r,i)=>{if(r===void 0&&Ea("v.union()",`member at index ${i}`),!r.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=n}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}optional(){return new e({isOptional:"optional",members:this.members})}asOptional(){return this.optional()}};function mu(e){return e?.isConvexValidator===!0}s(mu,"isValidator");var w={id:s(e=>new nu({isOptional:"required",tableName:e}),"id"),null:s(()=>new au({isOptional:"required"}),"null"),number:s(()=>new Ta({isOptional:"required"}),"number"),float64:s(()=>new Ta({isOptional:"required"}),"float64"),bigint:s(()=>new $a({isOptional:"required"}),"bigint"),int64:s(()=>new $a({isOptional:"required"}),"int64"),commitTs:s(()=>new ru({isOptional:"required"}),"commitTs"),boolean:s(()=>new iu({isOptional:"required"}),"boolean"),string:s(()=>new su({isOptional:"required"}),"string"),bytes:s(()=>new ou({isOptional:"required"}),"bytes"),literal:s(e=>new cu({isOptional:"required",value:e}),"literal"),array:s(e=>new uu({isOptional:"required",element:e}),"array"),object:s(e=>new du({isOptional:"required",fields:e}),"object"),record:s((e,t)=>new fu({isOptional:"required",key:e,value:t}),"record"),union:s((...e)=>new pu({isOptional:"required",members:e}),"union"),any:s(()=>new lu({isOptional:"required"}),"any"),optional:s(e=>e.asOptional(),"optional"),nullable:s(e=>w.union(e,w.null()),"nullable")};var eB=Object.defineProperty,tB=s((e,t,n)=>t in e?eB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),wh=s((e,t,n)=>tB(e,typeof t!="symbol"?t+"":t,n),"__publicField"),$E,RE,nB=Symbol.for("ConvexError"),gn=class extends(RE=Error,$E=nB,RE){static{s(this,"ConvexError")}constructor(t){super(typeof t=="string"?t:Ji(t)),wh(this,"name","ConvexError"),wh(this,"data"),wh(this,$E,!0),this.data=t}};var IE=s(()=>Array.from({length:4},()=>0),"arr"),I8=IE(),O8=IE();var sn="1.47.0";var Zi=Symbol.for("functionName");var kh=Symbol.for("toReferencePath");function iB(e){return e[kh]??null}s(iB,"extractReferencePath");function oB(e){return e.startsWith("function://")}s(oB,"isFunctionHandle");function Br(e){let t;if(typeof e=="string")oB(e)?t={functionHandle:e}:t={name:e};else if(e[Zi])t={name:e[Zi]};else{let n=iB(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}s(Br,"getFunctionAddress");var mX=w.object({numItems:w.number(),cursor:w.union(w.string(),w.null()),endCursor:w.optional(w.union(w.string(),w.null())),id:w.optional(w.number()),maximumRowsRead:w.optional(w.number()),maximumBytesRead:w.optional(w.number())});function ir(e){let t=Br(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;let n=e[Zi];if(!n)throw new Error(`${e} is not a functionReference`);return n}s(ir,"getFunctionName");function Ra(e){return{[Zi]:e}}s(Ra,"makeFunctionReference");function PE(e=[]){let t={get(n,r){if(typeof r=="string"){let i=[...e,r];return PE(i)}else if(r===Zi){if(e.length<2){let a=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}let i=e.slice(0,-1).join("/"),o=e[e.length-1];return o==="default"?i:i+":"+o}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}s(PE,"createApi");var hu=PE();function _E(e,t){let n={get(r,i){if(typeof i=="string"){let o=[...t,i];return _E(e,o)}else if(i===kh){if(t.length<1){let o=[e,...t].join(".");throw new Error(`API path is expected to be of the form \`${e}.childComponent.functionName\`. Found: \`${o}\``)}return"_reference/childComponent/"+t.join("/")}else return}};return new Proxy({},n)}s(_E,"createChildComponents");var vh=s(()=>_E("components",[]),"componentsGeneric");var lB=Symbol("var.requestId"),dB=Symbol("var.ip"),cB=Symbol("var.userAgent"),uB=Symbol("var.now"),fB=Symbol("var.convexActor"),pB={[lB]:"requestId",[dB]:"ip",[cB]:"userAgent",[uB]:"now",[fB]:"convexActor"};var mB=Object.defineProperty,hB=s((e,t,n)=>t in e?mB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),or=s((e,t,n)=>hB(e,typeof t!="symbol"?t+"":t,n),"__publicField"),gu=class{static{s(this,"TableDefinition")}constructor(t){or(this,"indexes"),or(this,"stagedDbIndexes"),or(this,"searchIndexes"),or(this,"stagedSearchIndexes"),or(this,"vectorIndexes"),or(this,"stagedVectorIndexes"),or(this,"validator"),or(this,"stagedValidator"),this.indexes=[],this.stagedDbIndexes=[],this.searchIndexes=[],this.stagedSearchIndexes=[],this.vectorIndexes=[],this.stagedVectorIndexes=[],this.validator=t}" indexes"(){return this.indexes}index(t,n){return Array.isArray(n)?this.indexes.push({indexDescriptor:t,fields:n}):n.staged?this.stagedDbIndexes.push({indexDescriptor:t,fields:n.fields}):this.indexes.push({indexDescriptor:t,fields:n.fields}),this}searchIndex(t,n){return n.staged?this.stagedSearchIndexes.push({indexDescriptor:t,searchField:n.searchField,filterFields:n.filterFields||[]}):this.searchIndexes.push({indexDescriptor:t,searchField:n.searchField,filterFields:n.filterFields||[]}),this}vectorIndex(t,n){return n.staged?this.stagedVectorIndexes.push({indexDescriptor:t,vectorField:n.vectorField,dimensions:n.dimensions,filterFields:n.filterFields||[]}):this.vectorIndexes.push({indexDescriptor:t,vectorField:n.vectorField,dimensions:n.dimensions,filterFields:n.filterFields||[]}),this}staged(t){if(this.stagedValidator!==void 0)throw new Error("Table cannot have more than one staged validator.");if(mu(t))this.stagedValidator=t;else{if(this.validator.kind!=="object"&&this.validator.kind!=="any")throw new Error("Specifying top-level field changes is only supported for simple table definitions. For a table defined with a union or record validator, you must stage a fully defined object or union validator.");let n=this.validator.kind==="object"?this.validator.fields:{},r=Object.fromEntries(Object.entries({...n,...t}).filter(i=>i[1]!==void 0));this.stagedValidator=w.object(r)}return this.self()}self(){return this}export(){let t=this.validator.json;if(typeof t!="object")throw new Error("Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)");let n;if(this.stagedValidator!==void 0&&(n=this.stagedValidator.json,typeof n!="object"))throw new Error("Invalid staged validator: please make sure that the parameter of `.staged()` is valid (see https://docs.convex.dev/database/schemas)");return{indexes:this.indexes,stagedDbIndexes:this.stagedDbIndexes,searchIndexes:this.searchIndexes,stagedSearchIndexes:this.stagedSearchIndexes,vectorIndexes:this.vectorIndexes,stagedVectorIndexes:this.stagedVectorIndexes,documentType:t,stagedDocumentType:n}}};function Ur(e){return mu(e)?new gu(e):new gu(w.object(e))}s(Ur,"defineTable");function CE(e,t){switch(t.kind){case"object":return t.extend({_id:w.id(e),_creationTime:w.number()});case"union":return w.union(...t.members.map(n=>CE(e,n)));case"any":return t;default:throw new Error(`Invalid validator for table "${e}": a table's documents must be objects, or a union of objects (see https://docs.convex.dev/database/schemas)`)}}s(CE,"addSystemFields");function DE(e,t){return CE(e,t.validator)}s(DE,"docValidator");function NE(e,t){let n=e.tables[t];if(n===void 0)throw new Error(`Table "${t}" is not in this schema. Tables in this schema: ${Object.keys(e.tables).join(", ")}`);return n}s(NE,"tableInSchema");var xh=class{static{s(this,"SchemaDefinition")}constructor(t,n){or(this,"tables"),or(this,"strictTableNameTypes"),or(this,"schemaValidation"),this.tables=t,this.schemaValidation=n?.schemaValidation===void 0?!0:n.schemaValidation}doc(t){return DE(t,NE(this,t))}id(t){return NE(this,t),w.id(t)}export(){return JSON.stringify({tables:Object.entries(this.tables).map(([t,n])=>{let{indexes:r,stagedDbIndexes:i,searchIndexes:o,stagedSearchIndexes:a,vectorIndexes:l,stagedVectorIndexes:d,documentType:c,stagedDocumentType:u}=n.export();return{tableName:t,indexes:r,stagedDbIndexes:i,searchIndexes:o,stagedSearchIndexes:a,vectorIndexes:l,stagedVectorIndexes:d,documentType:c,stagedDocumentType:u}}),schemaValidation:this.schemaValidation})}};function FE(e,t){return new xh(e,t)}s(FE,"defineSchema");var JX=FE({_scheduled_functions:Ur({name:w.string(),args:w.array(w.any()),scheduledTime:w.float64(),completedTime:w.optional(w.float64()),state:w.union(w.object({kind:w.literal("pending")}),w.object({kind:w.literal("inProgress")}),w.object({kind:w.literal("success")}),w.object({kind:w.literal("failed"),error:w.string()}),w.object({kind:w.literal("canceled")}))}),_storage:Ur({sha256:w.string(),size:w.float64(),contentType:w.optional(w.string())})});var Ie=class extends Error{static{s(this,"GuardRefusal")}constructor(t,n){super(t,n),this.name="GuardRefusal",this.stack=`${this.name}: ${t}`}};function LE(e){return e instanceof Ie||(typeof e=="object"&&e!==null?e.clipanion:void 0)?.type==="usage"?2:1}s(LE,"exitCodeFor");var gB={"applications discard-test":"write","applications staff-input set":"write","applications start-test":"write","audit access":"write","branding clear-font":"write","branding clear-logo":"write","branding set-font":"write","branding set-logo":"write","branding set-theme":"write","setup export":"write","setup apply":"write","catalog apply":"write","contract grant add":"write","contract grant add-aggregate":"write","contract grant end":"write","contract grant replace":"write","demo link create":"write","feedback assign":"write","feedback create":"write","feedback link":"write","feedback reassign":"write","feedback reply":"write","feedback set-deadline":"write","feedback set-status":"write","feedback sync":"write","feedback tag":"write","feedback tags create":"write","feedback tags set":"write","feedback to-issue":"write","feedback unlink":"write","feedback untag":"write","files put":"write","notifications chrome set":"write","notifications letters reset":"write","notifications letters set":"write","platform notifications retry":"write","platform notifications self-test":"write","offer apply":"write","offer archive":"write","offer capacity set":"write","offer create":"write","offer level add":"write","offer level move":"write","offer level archive":"write","offer level restore":"write","offer level set":"write","offer restore":"write","offer run add":"write","offer run archive":"write","offer run restore":"write","offer run set":"write","offer set":"write","offer unit create":"write","offer unit ensure-pedagogy":"write","org legal-entity create":"write","org legal-entity set":"write","org unit create":"write","org unit set":"write","generator archive":"write","generator scope":"write","platform generator input-key apply":"write","platform generator input-key create":"write","platform generator input-key deprecate":"write","generator package apply":"write","generator package archive":"write","generator package clone":"write","generator package create":"write","generator package seal":"write","generator clone":"write","generator create":"write","generator seal":"write","generator save":"write","generator setup apply":"write","generator source save":"write","generator scenarios approve":"write","platform signing connection activate":"write","platform signing connection reseal":"write","platform signing connection set":"write","signing connection test":"write","signing reconcile":"write","signing resend":"write","signing start":"write","stripe allow":"write","stripe refresh":"write","test-actions run":"write","tokens create":"write","tenant-users notifications set":"write","tenant-users groups add":"write","tenant-users reactivate":"write","tenant-users send-login-link":"write","tenant-users send-password-reset":"write","tenant-users signature request":"write","platform users create":"write","platform users grant":"write","platform users provision":"write","platform users relink-auth":"write","platform users set-password":"write","platform users set-platform-admin":"write","platform users set-platform-permission":"write","work-items assign":"write","work-items complete":"write","work-items create":"write","platform workers reap":"write","config apply":"confirm","config prune-offers":"confirm","config set":"confirm","config wipe":"confirm","demo link delete":"confirm","demo link revoke":"confirm","feedback tags delete":"confirm","files delete":"confirm","generator delete-draft":"confirm","generator package delete-draft":"confirm","imports trigger":"confirm","platform imports trigger-all":"confirm","jobs cancel":"confirm","offer delete":"confirm","org legal-entity delete":"confirm","org unit delete":"confirm","platform imports cleanup-orphaned":"confirm","org delete-subtree":"confirm","platform persons purge":"confirm","retention apply":"confirm","retention parties apply":"confirm","platform signing connection delete":"confirm","signing void":"confirm","tokens revoke":"confirm","tenant-users archive":"confirm","tenant-users deactivate":"confirm","tenant-users invite":"confirm","tenant-users set-key":"confirm","tenant-users groups revoke":"confirm","platform users archive":"confirm","platform users grant-all":"confirm","users groups delete":"confirm","platform users revoke":"confirm","platform users set-email":"confirm",call:"callKind","accounts email-changes":"read","admission runs list":"read","applications counts":"read","applications list":"read","applications show":"read","applications staff-input list":"read","applications store":"read","branding show":"read","catalog export":"read","catalog plan":"read","config export":"read","setup plan":"read","setup list":"read","setup diff":"read","config targets":"read","demo link list":"read","demo link stats":"read","demo videos":"read","feedback admins":"read","feedback comments":"read","feedback links":"read","feedback list":"read","feedback screenshot":"read","feedback tags list":"read","files list":"read","imports status":"read","jobs list":"read","jobs logs":"read","jobs show":"read","leads list":"read","notifications chrome show":"read","notifications letters list":"read","notifications letters show":"read","platform notifications list":"read","platform notifications show":"read","platform notifications sweeper-status":"read","offer diff":"read","offer export":"read","offer list":"read","offer plan":"read","offer show":"read","offer status":"read","offer versions":"read","offer workflow restamp-pins":"read","org tree":"read","platform users list":"read","platform workers list":"read","persons list":"read","platform generator input-key list":"read","platform generator input-key plan":"read","generator list":"read","generator package list":"read","generator package plan":"read","generator package show":"read","generator package test":"read","generator setup plan":"read","generator show":"read","generator source export":"read","generator scenarios test":"read","retention plan":"read","retention parties plan":"read","signing connection show":"read","platform signing status":"read","signing list":"read","signing show":"read","stripe status":"read",tenants:"read","test-actions list":"read","tokens list":"read","tenant-users groups list":"read","tenant-users units list":"read","tenant-users history":"read","tenant-users list":"read","tenant-users notifications list":"read","tenant-users show":"read","platform users doctor":"read","users groups":"read","platform users login-trail":"read","platform users show":"read",whoami:"read","work-items list":"read","work-items show":"read","platform workers logs":"read","platform workers reaper-status":"read","agent tools":"read","assignment simulate":"read","config show":"read",describe:"read",functions:"read","offer form list":"read","offer form show":"read","offer validate":"read","offer workflow channels list":"read","offer workflow node list":"read","offer workflow node reads":"read","offer workflow show":"read","offer workflow staff-input list":"read","agent invoke":"local-write","config init":"local-write","config legal-entity add":"local-write","config unit add":"local-write","offer form add":"local-write","offer form delete":"local-write","offer form computed delete":"local-write","offer form computed add":"local-write","offer form computed set":"local-write","offer form effect add":"local-write","offer form effect delete":"local-write","offer form effect set":"local-write","offer form env set":"local-write","offer form field add":"local-write","offer form field attach":"local-write","offer form field delete":"local-write","offer form field detach":"local-write","offer form field export":"local-write","offer form field move":"local-write","offer form field set":"local-write","offer form outcome add":"local-write","offer form outcome delete":"local-write","offer form outcome set":"local-write","offer form repeated add":"local-write","offer form repeated delete":"local-write","offer form repeated set":"local-write","offer form scenario add":"local-write","offer form scenario delete":"local-write","offer form scenario set":"local-write","offer form section add":"local-write","offer form section delete":"local-write","offer form section move":"local-write","offer form section set":"local-write","offer form set":"local-write","offer init":"local-write","offer manifest set":"local-write","offer upgrade":"local-write","offer workflow channels add":"local-write","offer workflow channels delete":"local-write","offer workflow node add":"local-write","offer workflow node add-reads":"local-write","offer workflow node add-requires":"local-write","offer workflow node clear-notification":"local-write","offer workflow node delete":"local-write","offer workflow node optional-action delete":"local-write","offer workflow node optional-action set":"local-write","offer workflow node remove-reads":"local-write","offer workflow node remove-requires":"local-write","offer workflow node set":"local-write","offer workflow node set-cockpit-fields":"local-write","offer workflow node set-engage":"local-write","offer workflow node set-generator":"local-write","offer workflow node set-input":"local-write","offer workflow node set-notification":"local-write","offer workflow node set-reads":"local-write","offer workflow node set-requires":"local-write","offer workflow node task add":"local-write","offer workflow node task delete":"local-write","offer workflow node task set":"local-write","offer workflow restamp-exports":"local-write","offer workflow staff-input delete":"local-write","offer workflow staff-input set":"local-write",seed:"write"},Ia={"generator input-key apply":"platform generator input-key apply","generator input-key create":"platform generator input-key create","generator input-key deprecate":"platform generator input-key deprecate","generator input-key list":"platform generator input-key list","generator input-key plan":"platform generator input-key plan","imports cleanup-orphaned":"platform imports cleanup-orphaned","imports trigger-all":"platform imports trigger-all","notifications list":"platform notifications list","notifications retry":"platform notifications retry","notifications self-test":"platform notifications self-test","notifications show":"platform notifications show","notifications sweeper-status":"platform notifications sweeper-status","persons purge":"platform persons purge","platform users":"platform users list","platform workers":"platform workers list","signing connection activate":"platform signing connection activate","signing connection delete":"platform signing connection delete","signing connection reseal":"platform signing connection reseal","signing connection set":"platform signing connection set","signing status":"platform signing status","users archive":"platform users archive","users create":"platform users create","users doctor":"platform users doctor","users grant":"platform users grant","users grant-all":"platform users grant-all","users list":"platform users list","users login-trail":"platform users login-trail","users provision":"platform users provision","users relink-auth":"platform users relink-auth","users revoke":"platform users revoke","users set-email":"platform users set-email","users set-password":"platform users set-password","users set-platform-admin":"platform users set-platform-admin","users set-platform-permission":"platform users set-platform-permission","users show":"platform users show","workers logs":"platform workers logs","workers reap":"platform workers reap","workers reaper-status":"platform workers reaper-status","admission laeufe":"admission runs list","feedback deadline":"feedback set-deadline","feedback tags recolor":"feedback tags set","feedback tags rename":"feedback tags set","feedback tags visibility":"feedback tags set","files remove":"files delete","files rm":"files delete","interessenten list":"leads list","offer form computed rm":"offer form computed delete","offer form effect rm":"offer form effect delete","offer form field rm":"offer form field delete","offer form outcome rm":"offer form outcome delete","offer form repeated rm":"offer form repeated delete","offer form rm":"offer form delete","offer form scenario rm":"offer form scenario delete","offer form section rm":"offer form section delete","offer hard-delete":"offer delete","offer level remove":"offer level archive","offer level rename":"offer level set","offer unit delete":"org unit delete","offer workflow channels remove":"offer workflow channels delete","offer workflow channels rm":"offer workflow channels delete","offer workflow node optional-action remove":"offer workflow node optional-action delete","offer workflow node optional-action rm":"offer workflow node optional-action delete","offer workflow node rm":"offer workflow node delete","offer workflow node task remove":"offer workflow node task delete","offer workflow node task rm":"offer workflow node task delete","offer workflow staff-input remove":"offer workflow staff-input delete","offer workflow staff-input rm":"offer workflow staff-input delete","org legal-entity update":"org legal-entity set","org unit update":"org unit set","platform tenants":"tenants","signing connection remove":"platform signing connection delete","stammdaten persons":"persons list","stammdaten persons purge":"platform persons purge",units:"org tree","users add":"platform users grant","users deactivate":"platform users archive","users delete":"platform users archive","users provision-platform-admin":"platform users provision","users provision-platform-user":"platform users provision","users remove":"platform users revoke","users set-group":"tenant-users groups add","users unset-group":"tenant-users groups revoke"};function Xi(e){return Ia[e]??e}s(Xi,"canonicalVerb");var Sh={retiredYes:"--yes",retiredExecute:"--execute"};function Oa(e){let t=e;return t.confirm===!0||Object.keys(Sh).some(n=>t[n]===!0)}s(Oa,"confirmGiven");var ME={seed:"Requires the local RDU stack and deployment admin access.","feedback to-issue":"Requires the operator's locally authenticated GitHub CLI.","feedback sync":"Requires the operator's locally authenticated GitHub CLI.","imports trigger":"Reads import-provider credentials from the local environment.","agent invoke":"Tool transport entrypoint; nested transports are not executable commands."};function eo(e){let t=gB[Xi(e)];if(t===void 0)throw new Ie(`plexus: "${e}" is not classified in plexus/writeVerbs.ts \u2014 add it as read|write|confirm|callKind|local-write.`);return t}s(eo,"commandEffect");function wu(e,t){switch(eo(e)){case"read":case"local-write":return!1;case"write":return!0;case"confirm":return t.confirm===!0;case"callKind":if(t.callKind===void 0)throw new Ie(`plexus: "${e}" resolved no call kind before connecting.`);return t.callKind!=="query"}}s(wu,"runWrites");var yu=s(()=>!0,"always"),qE={"config targets":[{fn:"config/api:targets",why:"lists the config targets through an action",when:yu}],"setup plan":[{fn:"setupExport:platformPlanPart",why:"previews the restore server-side (every part as a dry run)",when:yu},{fn:"setupExport:platformPlanPlatformPart",why:"previews the platform restore server-side (a dry run)",when:yu}]},KE={"config apply":[{fn:"config/api:apply",why:"previews the apply server-side",when:s(e=>e.confirm===!1,"when")},{fn:"config/api:applyPlatform",why:"previews the platform apply",when:s(e=>e.confirm===!1,"when")}],"config set":[{fn:"config/api:setField",why:"previews the change",when:s(e=>e.confirm===!1,"when")}],"config wipe":[{fn:"config/api:wipePreview",why:"counts what a wipe would remove",when:yu}],"config prune-offers":[{fn:"config/api:pruneOffers",why:"lists what would be pruned",when:s(e=>e.commit===!1,"when")}],"platform imports cleanup-orphaned":[{fn:"imports:failOrphanedRuns",why:"lists the orphaned runs",when:s(e=>e.confirm===!1,"when")}],"platform persons purge":[{fn:"parties:purgeDeletedParty",why:"plans the purge",when:s(e=>e.dryRun===!0,"when")}],"platform users set-email":[{fn:"platformAdmin:setUserEmail",why:"plans the change",when:s(e=>e.dryRun===!0,"when")}]};function jE(e,t,n=[]){let r=s(i=>(o,a)=>{let l=ir(o),d=n.find(c=>c.fn===l);if(d===void 0||!d.when(a??{}))throw new Ie(`plexus: "${t}" does not write in this run (plexus/writeVerbs.ts) but called the ${i} ${l}`+(d===void 0?"":" without its dry-run argument")+" \u2014 refused before sending. Classify the command as a write, or declare the call in ACTION_READS / DRY_RUN_CALLS.");return e[i](o,a)},"gate");return new Proxy(e,{get(i,o,a){return o==="mutation"?r("mutation"):o==="action"?r("action"):Reflect.get(i,o,a)}})}s(jE,"guardedCaller");var yB={"audit access":"platform","demo link create":"platform","demo link delete":"platform","demo link list":"platform","demo link revoke":"platform","demo link stats":"platform","demo videos":"platform","feedback admins":"platform","feedback assign":"platform","feedback comments":"platform","feedback create":"platform","feedback link":"platform","feedback links":"platform","feedback list":"platform","feedback reassign":"platform","feedback reply":"platform","feedback screenshot":"platform","feedback set-deadline":"platform","feedback set-status":"platform","feedback sync":"platform","feedback tag":"platform","feedback tags create":"platform","feedback tags delete":"platform","feedback tags list":"platform","feedback tags set":"platform","feedback to-issue":"platform","feedback unlink":"platform","feedback untag":"platform","jobs cancel":"platform","jobs list":"platform","jobs logs":"platform","jobs show":"platform","platform generator input-key apply":"platform","platform generator input-key create":"platform","platform generator input-key deprecate":"platform","platform generator input-key list":"platform","platform generator input-key plan":"platform","platform imports cleanup-orphaned":"platform","platform imports trigger-all":"platform","platform notifications list":"platform","platform notifications retry":"platform","platform notifications self-test":"platform","platform notifications show":"platform","platform notifications sweeper-status":"platform","platform persons purge":"platform","platform signing connection activate":"platform","platform signing connection delete":"platform","platform signing connection reseal":"platform","platform signing connection set":"platform","platform signing status":"platform","platform users archive":"platform","platform users create":"platform","platform users doctor":"platform","platform users grant":"platform","platform users grant-all":"platform","platform users list":"platform","platform users login-trail":"platform","platform users provision":"platform","platform users relink-auth":"platform","platform users revoke":"platform","platform users set-email":"platform","platform users set-password":"platform","platform users set-platform-admin":"platform","platform users set-platform-permission":"platform","platform users show":"platform","platform workers list":"platform","platform workers logs":"platform","platform workers reap":"platform","platform workers reaper-status":"platform","retention apply":"platform","retention parties apply":"platform","retention parties plan":"platform","retention plan":"platform","setup apply":"platform","setup diff":"platform","setup export":"platform","setup list":"platform","setup plan":"platform","accounts email-changes":"tenant","admission runs list":"tenant","applications counts":"tenant","applications discard-test":"tenant","applications list":"tenant","applications show":"tenant","applications staff-input list":"tenant","applications staff-input set":"tenant","applications start-test":"tenant","applications store":"tenant","branding clear-font":"tenant","branding clear-logo":"tenant","branding set-font":"tenant","branding set-logo":"tenant","branding set-theme":"tenant","branding show":"tenant","catalog apply":"tenant","catalog export":"tenant","catalog plan":"tenant","config apply":"tenant","config export":"tenant","config prune-offers":"tenant","config set":"tenant","config targets":"tenant","config wipe":"tenant","contract grant add":"tenant","contract grant add-aggregate":"tenant","contract grant end":"tenant","contract grant replace":"tenant","files delete":"tenant","files list":"tenant","files put":"tenant","generator archive":"tenant","generator clone":"tenant","generator create":"tenant","generator delete-draft":"tenant","generator list":"tenant","generator package apply":"tenant","generator package archive":"tenant","generator package clone":"tenant","generator package create":"tenant","generator package delete-draft":"tenant","generator package list":"tenant","generator package plan":"tenant","generator package seal":"tenant","generator package show":"tenant","generator package test":"tenant","generator save":"tenant","generator scenarios approve":"tenant","generator scenarios test":"tenant","generator scope":"tenant","generator seal":"tenant","generator setup apply":"tenant","generator setup plan":"tenant","generator show":"tenant","generator source export":"tenant","generator source save":"tenant","imports status":"tenant","imports trigger":"tenant","leads list":"tenant","notifications chrome set":"tenant","notifications chrome show":"tenant","notifications letters list":"tenant","notifications letters reset":"tenant","notifications letters set":"tenant","notifications letters show":"tenant","offer apply":"tenant","offer archive":"tenant","offer capacity set":"tenant","offer create":"tenant","offer delete":"tenant","offer diff":"tenant","offer export":"tenant","offer level add":"tenant","offer level archive":"tenant","offer level move":"tenant","offer level restore":"tenant","offer level set":"tenant","offer list":"tenant","offer plan":"tenant","offer restore":"tenant","offer run add":"tenant","offer run archive":"tenant","offer run restore":"tenant","offer run set":"tenant","offer set":"tenant","offer show":"tenant","offer status":"tenant","offer unit create":"tenant","offer unit ensure-pedagogy":"tenant","offer versions":"tenant","offer workflow restamp-pins":"tenant","org delete-subtree":"tenant","org legal-entity create":"tenant","org legal-entity delete":"tenant","org legal-entity set":"tenant","org tree":"tenant","org unit create":"tenant","org unit delete":"tenant","org unit set":"tenant","persons list":"tenant","signing connection show":"tenant","signing connection test":"tenant","signing list":"tenant","signing reconcile":"tenant","signing resend":"tenant","signing show":"tenant","signing start":"tenant","signing void":"tenant","stripe allow":"tenant","stripe refresh":"tenant","stripe status":"tenant","tenant-users archive":"tenant","tenant-users deactivate":"tenant","tenant-users groups add":"tenant","tenant-users groups list":"tenant","tenant-users groups revoke":"tenant","tenant-users history":"tenant","tenant-users invite":"tenant","tenant-users list":"tenant","tenant-users notifications list":"tenant","tenant-users notifications set":"tenant","tenant-users reactivate":"tenant","tenant-users send-login-link":"tenant","tenant-users send-password-reset":"tenant","tenant-users set-key":"tenant","tenant-users show":"tenant","tenant-users signature request":"tenant","tenant-users units list":"tenant","test-actions list":"tenant","test-actions run":"tenant","users groups":"tenant","users groups delete":"tenant","work-items assign":"tenant","work-items complete":"tenant","work-items create":"tenant","work-items list":"tenant","work-items show":"tenant",call:"self",tenants:"self","tokens create":"self","tokens list":"self","tokens revoke":"self",whoami:"self","agent invoke":"offline","agent tools":"offline","assignment simulate":"offline","config init":"offline","config legal-entity add":"offline","config show":"offline","config unit add":"offline",describe:"offline",functions:"offline","offer form add":"offline","offer form computed add":"offline","offer form computed delete":"offline","offer form computed set":"offline","offer form delete":"offline","offer form effect add":"offline","offer form effect delete":"offline","offer form effect set":"offline","offer form env set":"offline","offer form field add":"offline","offer form field attach":"offline","offer form field delete":"offline","offer form field detach":"offline","offer form field export":"offline","offer form field move":"offline","offer form field set":"offline","offer form list":"offline","offer form outcome add":"offline","offer form outcome delete":"offline","offer form outcome set":"offline","offer form repeated add":"offline","offer form repeated delete":"offline","offer form repeated set":"offline","offer form scenario add":"offline","offer form scenario delete":"offline","offer form scenario set":"offline","offer form section add":"offline","offer form section delete":"offline","offer form section move":"offline","offer form section set":"offline","offer form set":"offline","offer form show":"offline","offer init":"offline","offer manifest set":"offline","offer upgrade":"offline","offer validate":"offline","offer workflow channels add":"offline","offer workflow channels delete":"offline","offer workflow channels list":"offline","offer workflow node add":"offline","offer workflow node add-reads":"offline","offer workflow node add-requires":"offline","offer workflow node clear-notification":"offline","offer workflow node delete":"offline","offer workflow node list":"offline","offer workflow node optional-action delete":"offline","offer workflow node optional-action set":"offline","offer workflow node reads":"offline","offer workflow node remove-reads":"offline","offer workflow node remove-requires":"offline","offer workflow node set":"offline","offer workflow node set-cockpit-fields":"offline","offer workflow node set-engage":"offline","offer workflow node set-generator":"offline","offer workflow node set-input":"offline","offer workflow node set-notification":"offline","offer workflow node set-reads":"offline","offer workflow node set-requires":"offline","offer workflow node task add":"offline","offer workflow node task delete":"offline","offer workflow node task set":"offline","offer workflow restamp-exports":"offline","offer workflow show":"offline","offer workflow staff-input delete":"offline","offer workflow staff-input list":"offline","offer workflow staff-input set":"offline",seed:"offline"};function wB(e){let t=yB[Xi(e)];if(t===void 0)throw new Error(`plexus: "${e}" has no scope in plexus/commandScope.ts \u2014 add platform|tenant|self|offline.`);return t}s(wB,"commandScope");var kB={platform:"platform operator",tenant:"school token",self:"own account",offline:"offline"};function BE(e,t){return`${e??"Other"} (${kB[wB(t)]})`}s(BE,"scopedCategory");var Pa=class extends gn{static{s(this,"RefusalError")}constructor(t,n){super({code:t,message:{de:n.de,en:n.en}}),this.message=n.de}};function ce(e,t){throw new Pa(e,t)}s(ce,"refuse");function N(e,t){throw new Error(e,t)}s(N,"bug");function bB(e){return typeof e=="object"&&e!==null&&Symbol.for("ConvexError")in e}s(bB,"isConvexError");var vB=s(e=>{console.warn(`[refusal/legacyStringMessage] a refusal arrived with a bare string message (${e.code??"no code"}): ${e.de}`)},"legacyReporter"),UE=new Set;function xB(e,t){if(e===void 0)return{de:"",en:""};if(typeof e=="string"){let n=t??e;return UE.has(n)||(UE.add(n),vB({code:t,de:e})),{de:e,en:""}}if(e!==null&&typeof e=="object"){let{de:n,en:r}=e;if(typeof n=="string"&&typeof r=="string")return{de:n,en:r}}N(`refusalOf: a ConvexError's message is neither { de, en } nor a string: ${JSON.stringify(e)}`)}s(xB,"refusalTextOf");function fi(e){if(!bB(e))return null;let t=e.data;if(typeof t=="string")return{code:null,message:{de:t,en:t}};if(t&&typeof t=="object"){let{code:n,message:r}=t,i=typeof n=="string"?n:null;return{code:i,message:xB(r,i)}}return null}s(fi,"refusalOf");function SB(e){let t=fi(e);if(t!==null&&(t.message.de!==""||t.message.en!==""))return{kind:"refusal",code:t.code,message:t.message};let n=e instanceof Error?e.message:String(e),r=/\[Request ID:\s*([0-9a-f]+)\]/i.exec(n)?.[1],i=n.replace(/\[CONVEX[^\]]*\]/g,"").replace(/\[Request ID:[^\]]*\]/gi,"").replace(/\bServer Error\b/gi,"").replace(/\bCalled by client\b/g,"").trim();return r!==void 0&&i===""?{kind:"redacted",requestId:r}:{kind:"technical",text:n}}s(SB,"classifyServerFailure");function AB(e){return{de:`Serverfehler (Request-ID ${e}) \u2014 Details in GlitchTip.`,en:`Server error (request ID ${e}) \u2014 details in GlitchTip.`}}s(AB,"serverFailureText");function Ah(e){let t=SB(e);return t.kind==="refusal"?t.message.de!==""?t.message.de:t.message.en:t.kind==="redacted"?AB(t.requestId).de:t.text}s(Ah,"operatorFailureLine");function GE(e,t,n,r,i){if(n||!r){e.write(`${JSON.stringify(t,null,2)}
83
83
  `);return}e.write(`${EB(r(t),i)}
84
84
  `)}s(GE,"emit");function yn(e){return Ah(e)}s(yn,"errorMessage");function EB(e,t){if(e.length===0)return"(none)";let n=t??Object.keys(e[0]),r=n.map(a=>Math.max(a.length,...e.map(l=>(l[a]??"").length))),i=s(a=>a.map((l,d)=>l.padEnd(r[d])).join(" ").trimEnd(),"line"),o=[i(n),i(n.map((a,l)=>"\u2500".repeat(r[l])))];for(let a of e)o.push(i(n.map(l=>a[l]??"")));return o.join(`
85
85
  `)}s(EB,"renderTable");function zE(e){if(!(e instanceof Error))return e;let t=fi(e),n=t?.message.de??"";if(t!==null&&n!==""){let o=new Error(t.code===null?n:`[${t.code}] ${n}`);return o.name="Refused",VE(o)}let r=Ah(e);if(r===e.message)return e;let i=new Error(r);return i.name="ServerFailure",VE(i)}s(zE,"operatorError");function VE(e){return e.stack="",e}s(VE,"withoutStack");var Se=class extends T{static{s(this,"BaseCommand")}json=p.Boolean("--json",!1,{description:"Print raw JSON instead of a table"});async validateAndExecute(){try{return await super.validateAndExecute()}catch(t){let n=zE(t);return this.context.stderr.write(this.cli.error(n instanceof Error?n:new Error(String(n)))),LE(n)}}print(t,n,r){GE(this.context.stdout,t,this.json,n,r)}};var TB=Object.defineProperty,$B=s((e,t,n)=>t in e?TB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),WE=s((e,t,n)=>$B(e,typeof t!="symbol"?t+"":t,n),"__publicField"),RB="color:rgb(0, 145, 255)";function IB(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}s(IB,"prefix_for_source");var ku=class{static{s(this,"DefaultLogger")}constructor(t){WE(this,"_onLogLineFuncs"),WE(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let n=Math.random().toString(36).substring(2,15);for(let r=0;r<10&&this._onLogLineFuncs[n]!==void 0;r++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=t,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...t){if(this._verbose)for(let n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...t)}log(...t){for(let n of Object.values(this._onLogLineFuncs))n("info",...t)}warn(...t){for(let n of Object.values(this._onLogLineFuncs))n("warn",...t)}error(...t){for(let n of Object.values(this._onLogLineFuncs))n("error",...t)}};function Eh(e){let t=new ku(e);return t.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),t}s(Eh,"instantiateDefaultLogger");function Th(e){return new ku(e)}s(Th,"instantiateNoopLogger");function to(e,t,n,r,i){let o=IB(n);if(typeof i=="object"&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),t==="info"){let a=i.match(/^\[.*?\] /);if(a===null){e.error(`[CONVEX ${o}(${r})] Could not parse console.log`);return}let l=i.slice(1,a[0].length-2),d=i.slice(a[0].length);e.log(`%c[CONVEX ${o}(${r})] [${l}]`,RB,d)}else e.error(`[CONVEX ${o}(${r})] ${i}`)}s(to,"logForFunction");var _B=Object.defineProperty,NB=s((e,t,n)=>t in e?_B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"__defNormalProp"),$h=s((e,t,n)=>NB(e,typeof t!="symbol"?t+"":t,n),"__publicField"),no=class e{static{s(this,"Long")}constructor(t,n){$h(this,"low"),$h(this,"high"),$h(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){let t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?JE:t>=CB?DB:new e(t%_a|0,t/_a|0)}toString(){return(BigInt(this.high)*BigInt(_a)+BigInt(this.low)).toString()}equals(t){return e.isLong(t)||(t=e.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return e.isLong(t)||(t=e.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?e.fromNumber(t):new e(t.low,t.high)}},JE=new no(0,0),QE=65536,_a=QE*QE,CB=_a*_a,DB=new no(-1,-1);var Rh=class extends Error{static{s(this,"InvalidTokenError")}};Rh.prototype.name="InvalidTokenError";var Kee=480*60*60*1e3;import{createRequire as KB}from"module";import{resolve as jB}from"path";var MB;function ZE(e){MB=e}s(ZE,"setDefaultWebSocketConstructor");var ts=KB(jB(".")),BB=Object.create,XE=Object.defineProperty,UB=Object.getOwnPropertyDescriptor,eT=Object.getOwnPropertyNames,VB=Object.getPrototypeOf,GB=Object.prototype.hasOwnProperty,rt=(e=>typeof ts<"u"?ts:typeof Proxy<"u"?new Proxy(e,{get:s((t,n)=>(typeof ts<"u"?ts:t)[n],"get")}):e)(function(e){if(typeof ts<"u")return ts.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Dt=s((e,t)=>s(function(){return t||(0,e[eT(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),zB=s((e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eT(t))!GB.call(e,i)&&i!==n&&XE(e,i,{get:s(()=>t[i],"get"),enumerable:!(r=UB(t,i))||r.enumerable});return e},"__copyProps"),pi=s((e,t,n)=>(n=e!=null?BB(VB(e)):{},zB(t||!e||!e.__esModule?XE(n,"default",{value:e,enumerable:!0}):n,e)),"__toESM"),mi=Dt({"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/constants.js"(e,t){"use strict";var n=["nodebuffer","arraybuffer","fragments"],r=typeof Blob<"u";r&&n.push("blob"),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:r,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:s(()=>{},"NOOP")}}}),WB=Dt({"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(e,t){var n=rt("fs"),r=rt("path"),i=rt("os"),o=typeof __webpack_require__=="function"?__non_webpack_require__:rt,a=process.config&&process.config.variables||{},l=!!process.env.PREBUILDS_ONLY,d=process.versions.modules,c=H()?"electron":Y()?"node-webkit":"node",u=process.env.npm_config_arch||i.arch(),f=process.env.npm_config_platform||i.platform(),m=process.env.LIBC||(pe(f)?"musl":"glibc"),y=process.env.ARM_VERSION||(u==="arm64"?"8":a.arm_version)||"",k=(process.versions.uv||"").split(".")[0];t.exports=g;function g(te){return o(g.resolve(te))}s(g,"load"),g.resolve=g.path=function(te){te=r.resolve(te||".");try{var oe=o(r.join(te,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[oe+"_PREBUILD"]&&(te=process.env[oe+"_PREBUILD"])}catch{}if(!l){var O=$(r.join(te,"build/Release"),R);if(O)return O;var I=$(r.join(te,"build/Debug"),R);if(I)return I}var B=le(te);if(B)return B;var D=le(r.dirname(process.execPath));if(D)return D;var Z=["platform="+f,"arch="+u,"runtime="+c,"abi="+d,"uv="+k,y?"armv="+y:"","libc="+m,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"",typeof __webpack_require__=="function"?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+Z+`
@@ -244,9 +244,7 @@ These need the **platform operator** (a \`_platform.*\` right). Ask them; do not
244
244
  try: everything under \`platform \u2026\` (accounts across tenants, workers, the mail
245
245
  delivery monitor, cross-tenant imports, the hard delete of a person, signing
246
246
  connection set-up and key slots, the contract input-key registry), the
247
- \`feedback\`, \`demo\`, \`setup\`, \`retention\`, \`jobs\`, \`audit\` and \`branding \u2026\`
248
- commands, \`files put|delete\` (a school sets its branding and library files
249
- through \`config apply\` or in the app), creating, onboarding or wiping a tenant
247
+ \`feedback\`, \`demo\`, \`setup\`, \`retention\`, \`jobs\` and \`audit\` commands, creating, onboarding or wiping a tenant
250
248
  (\`config wipe\`, \`config prune-offers\`, \`config apply --scope platform\`),
251
249
  \`offer delete\` (the hard delete), the settings listed above and issuing a token
252
250
  for someone else (\`tokens create --for\`). Every command's right is in
@@ -296,7 +294,7 @@ whole is the operator's (ask them; do not try).
296
294
  | [applications/correct-staff-input.md](references/applications/correct-staff-input.md) | Mandant | Correct an internal input staff set at the start, while no step has read it. |
297
295
  | [audit/answer-access-request.md](references/audit/answer-access-request.md) | Plattform | Answer an Art. 15 request: who looked at this application? |
298
296
  | [config/add-legal-entity.md](references/config/add-legal-entity.md) | Mandant | Add a Tr\xE4ger with its address or a unit to an exported config offline, then apply it. |
299
- | [config/attach-a-template.md](references/config/attach-a-template.md) | Mandant + Plattform | Put a template into the file library and attach it to a form field (\`files put\` and \`files delete\` need the operator; a school adds the file through \`config apply\` or the app). |
297
+ | [config/attach-a-template.md](references/config/attach-a-template.md) | Mandant | Put a template into the file library and attach it to a form field (\`files put\` / \`files delete\` need \`administration.config.manage\`). |
300
298
  | [config/export-tenant-setup.md](references/config/export-tenant-setup.md) | Plattform | Take a portable copy of a tenant's setup (config plus referenced files) into a new directory outside any repository. |
301
299
  | [config/init-tenant.md](references/config/init-tenant.md) | Plattform | Generate and apply a minimal valid tenant config without an existing source. |
302
300
  | [config/onboard-tenant.md](references/config/onboard-tenant.md) | Plattform | Set up or refresh a real tenant's config from a snapshot or another environment. |
@@ -304,7 +302,7 @@ whole is the operator's (ask them; do not try).
304
302
  | [config/platform-setup-export.md](references/config/platform-setup-export.md) | Plattform | Export the platform's own setup (the contract input registry) and restore it before a tenant whose setup names its keys. |
305
303
  | [config/restore-tenant-setup.md](references/config/restore-tenant-setup.md) | Plattform | Preview and apply a setup export directory onto its tenant, part by part. |
306
304
  | [config/list-setup-exports.md](references/config/list-setup-exports.md) | Plattform | List a tenant's nightly and manual setup exports and show what changed between two of them. |
307
- | [config/set-tenant-branding.md](references/config/set-tenant-branding.md) | Mandant + Plattform | Give the application portal colours, radius and fonts; upload logo and WOFF2 fonts (the \`branding \u2026\` commands need the operator; a school uses \`config apply\`). |
305
+ | [config/set-tenant-branding.md](references/config/set-tenant-branding.md) | Mandant | Give the application portal colours, radius and fonts; upload logo and WOFF2 fonts (\`branding \u2026\` needs \`administration.config.manage\`). |
308
306
  | [config/set-tenant-terms.md](references/config/set-tenant-terms.md) | Plattform | Switch a school from \u201EBewerbung" to \u201EAnmeldung" throughout with one setting. |
309
307
  | [config/set-external-sign-in.md](references/config/set-external-sign-in.md) | Plattform | Choose how long the sign-in link in a school's letters works \u2014 once, N days, or without end. |
310
308
  | [config/set-up-billing-catalog.md](references/config/set-up-billing-catalog.md) | Mandant + Plattform | Load articles, packages, reduction tiers and Word templates by stable keys (catalog plan/apply). |
@@ -390,14 +388,13 @@ Generated from the commands the CLI registers \u2014 do not edit; \`plexus-cli <
390
388
  - [Admission (platform operator)](#admission-platform-operator) (2)
391
389
  - [Admission (school token)](#admission-school-token) (12)
392
390
  - [Agents (offline)](#agents-offline) (2)
393
- - [Branding (platform operator)](#branding-platform-operator) (6)
391
+ - [Branding (school token)](#branding-school-token) (6)
394
392
  - [Config (offline)](#config-offline) (4)
395
393
  - [Config (school token)](#config-school-token) (6)
396
394
  - [Contracts (platform operator)](#contracts-platform-operator) (5)
397
395
  - [Contracts (school token)](#contracts-school-token) (19)
398
396
  - [Feedback (platform operator)](#feedback-platform-operator) (21)
399
- - [Files (platform operator)](#files-platform-operator) (2)
400
- - [Files (school token)](#files-school-token) (1)
397
+ - [Files (school token)](#files-school-token) (3)
401
398
  - [Identity (own account)](#identity-own-account) (5)
402
399
  - [Imports (platform operator)](#imports-platform-operator) (2)
403
400
  - [Imports (school token)](#imports-school-token) (2)
@@ -609,13 +606,13 @@ Show the shared platform/CLI agent tool schemas and skill revision.
609
606
  - **Right:** offline \u2014 no deployment
610
607
  - **Effect:** read \u2014 changes nothing on the deployment
611
608
 
612
- ## Branding (platform operator)
609
+ ## Branding (school token)
613
610
 
614
611
  ### \`branding clear-font\`
615
612
 
616
- Remove a tenant's portal font file for a slot (platform-admin; the family stays)
613
+ Remove a tenant's portal font file for a slot (the family stays)
617
614
 
618
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
615
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
619
616
  - **Effect:** write \u2014 needs \`--env\`; on production also \`--allow-prod\`
620
617
 
621
618
  | Option | Description |
@@ -624,16 +621,16 @@ Remove a tenant's portal font file for a slot (platform-admin; the family stays)
624
621
 
625
622
  ### \`branding clear-logo\`
626
623
 
627
- Remove a tenant's portal logo (platform-admin)
624
+ Remove a tenant's portal logo
628
625
 
629
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
626
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
630
627
  - **Effect:** write \u2014 needs \`--env\`; on production also \`--allow-prod\`
631
628
 
632
629
  ### \`branding set-font\`
633
630
 
634
- Upload a tenant's portal font file (WOFF2) for a slot (platform-admin)
631
+ Upload a tenant's portal font file (WOFF2) for a slot
635
632
 
636
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
633
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
637
634
  - **Effect:** write \u2014 needs \`--env\`; on production also \`--allow-prod\`
638
635
 
639
636
  | Option | Description |
@@ -643,9 +640,9 @@ Upload a tenant's portal font file (WOFF2) for a slot (platform-admin)
643
640
 
644
641
  ### \`branding set-logo\`
645
642
 
646
- Upload a tenant's portal logo (platform-admin)
643
+ Upload a tenant's portal logo
647
644
 
648
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
645
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
649
646
  - **Effect:** write \u2014 needs \`--env\`; on production also \`--allow-prod\`
650
647
 
651
648
  | Option | Description |
@@ -655,9 +652,9 @@ Upload a tenant's portal logo (platform-admin)
655
652
 
656
653
  ### \`branding set-theme\`
657
654
 
658
- Set a tenant's portal theme tokens from a JSON file (platform-admin)
655
+ Set a tenant's portal theme tokens from a JSON file
659
656
 
660
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
657
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
661
658
  - **Effect:** write \u2014 needs \`--env\`; on production also \`--allow-prod\`
662
659
 
663
660
  | Option | Description |
@@ -666,9 +663,9 @@ Set a tenant's portal theme tokens from a JSON file (platform-admin)
666
663
 
667
664
  ### \`branding show\`
668
665
 
669
- Show a tenant's current branding + resolved logo and font-file URLs (platform-admin)
666
+ Show a tenant's current branding + resolved logo and font-file URLs
670
667
 
671
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
668
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
672
669
  - **Effect:** read \u2014 changes nothing on the deployment
673
670
 
674
671
  ## Config (offline)
@@ -1309,24 +1306,31 @@ Detach a tag from a feedback item (uses the active --tenant).
1309
1306
  - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
1310
1307
  - **Effect:** write \u2014 needs \`--env\`; on production also \`--allow-prod\`
1311
1308
 
1312
- ## Files (platform operator)
1309
+ ## Files (school token)
1313
1310
 
1314
1311
  ### \`files delete <key>\`
1315
1312
 
1316
1313
  Delete a library file \u2014 plan unless --confirm; refused while a form uses it / Datei l\xF6schen
1317
1314
 
1318
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
1315
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
1319
1316
  - **Effect:** plan by default \u2014 writes only with \`--confirm\` (and \`--env\`; on production also \`--allow-prod\`)
1320
1317
 
1321
1318
  | Option | Description |
1322
1319
  |---|---|
1323
1320
  | \`--confirm\` | Delete (without it, only the plan is printed). |
1324
1321
 
1322
+ ### \`files list\`
1323
+
1324
+ List a tenant's file library (Vorlagen) / Dateien auflisten
1325
+
1326
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
1327
+ - **Effect:** read \u2014 changes nothing on the deployment
1328
+
1325
1329
  ### \`files put <key> <path>\`
1326
1330
 
1327
1331
  Create or replace a library file by key / Datei anlegen oder ersetzen
1328
1332
 
1329
- - **Right:** platform operator \u2014 needs a \`_platform.*\` right; a school's token is refused
1333
+ - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
1330
1334
  - **Effect:** write \u2014 needs \`--env\`; on production also \`--allow-prod\`
1331
1335
 
1332
1336
  | Option | Description |
@@ -1335,15 +1339,6 @@ Create or replace a library file by key / Datei anlegen oder ersetzen
1335
1339
  | \`--label-en <value>\` | English label (required for a new key) |
1336
1340
  | \`--file-name <value>\` | Download name (default: the local file name) |
1337
1341
 
1338
- ## Files (school token)
1339
-
1340
- ### \`files list\`
1341
-
1342
- List a tenant's file library (Vorlagen) / Dateien auflisten
1343
-
1344
- - **Right:** school token \u2014 a module permission inside one school (the school's own administrator runs it)
1345
- - **Effect:** read \u2014 changes nothing on the deployment
1346
-
1347
1342
  ## Identity (own account)
1348
1343
 
1349
1344
  ### \`tenants\`
@@ -4483,8 +4478,13 @@ every form at once \u2014 no republish.
4483
4478
 
4484
4479
  ## Prerequisites
4485
4480
 
4486
- - \`plexus-cli\` installed; a platform-admin token with \`_platform.config.manage\`
4487
- for the target env (listing needs \`_platform.config.read\`).
4481
+ - \`plexus-cli\` installed; for the target env either the school's own token
4482
+ holding \`administration.config.manage\` tenant-wide (listing needs
4483
+ \`administration.config.read\`; see
4484
+ [CLI access for a tenant admin](../users/cli-access-for-tenant-admin.md)), or a
4485
+ platform-admin token with \`_platform.config.manage\` (listing:
4486
+ \`_platform.config.read\`). The in-app right \`stammdaten._self.configure\` alone
4487
+ is refused by the CLI.
4488
4488
  - The \`files\` commands and the \`fileKey\` attachment shape must be **live** on
4489
4489
  the target env before an offer that uses them is published (a platform
4490
4490
  operator rolls a release out to staging, then prod). An offer published before
@@ -5140,7 +5140,7 @@ own administrator cannot change it.
5140
5140
  \u201EZugangslinks sperren" ends every access link of that family at the school.
5141
5141
  - Access links also end when the account gains reach (another school, staff
5142
5142
  rights) or its login address is changed by someone else.
5143
- `,"references/config/set-tenant-branding.md":'# Set a tenant\'s external-portal branding\n\n**When to use:** give a tenant\'s public `/e/**` Bewerbungsportal its own white-label\nlook \u2014 brand colors, corner radius, logo size, header style, and font families, plus an\nuploaded logo and uploaded font files \u2014 on staging and/or prod, without a reseed.\n\n## Prerequisites\n\n- `plexus-cli` installed and current (`plexus-cli --help`).\n- A token configured for each target env (`plexus-cli --env <env> config show` prints\n the resolved connection): a platform-admin token holding `_platform.config.manage` (the\n same right that gates `config apply`), or \u2014 for your OWN tenant only \u2014 a tenant\n admin\'s token holding `administration.config.manage` (see\n [CLI access for a tenant admin](../users/cli-access-for-tenant-admin.md)). Such a\n token changes branding **only through `config apply`** (branding is one of the few\n `tenant.*` settings it may change); every `plexus-cli branding \u2026` command needs the\n platform right and refuses it. A local admin key without a user identity does **not**\n satisfy this gate.\n- The `plexus-cli branding \u2026` commands must be **live on the target env** first (they\n call backend functions of the same release). A platform operator rolls a release out\n to staging, then prod; only then run the CLI.\n- The tenant **slug** (e.g. `test`). Always **stage on staging first**, verify in the\n browser, then promote to prod.\n\n## The two halves of branding\n\n| Part | Where it lives | How to set it |\n| --- | --- | --- |\n| **Theme tokens** \u2014 colors, radius, logoSize, bannerDensity, filledHeader, websiteUrl, font **families** | `tenant_branding` row columns; config-portable (exported in `tenant.branding`) | `plexus-cli branding set-theme` (surgical) **or** `config apply` (whole-config) |\n| **Logo** | `_storage` id column (a single `primary` slot); carried by config **by hash** (`tenant.brandingAssets.logo`) | `plexus-cli branding set-logo` (one-off upload) **or** `config apply` (bytes from the snapshot / source env) |\n| **Font files** (WOFF2, one per slot `heading` / `body`) | `_storage` id columns; carried by config **by hash** (`tenant.brandingAssets.fontHeading` / `fontBody`) | `plexus-cli branding set-font --slot heading\\|body --file <woff2>` **or** `config apply` |\n\nA `storageId` is deployment-local, so config never carries it. It carries each uploaded\nfile like a library file: `{ sha256, sizeBytes, mimeType }` under `tenant.brandingAssets`, and\n`config export` downloads the bytes beside `config.json` as `branding/<slot>.<ext>`\n(`path` in the entry). `config apply --from snapshot:\u2026` or `--from env:<src>` uploads\nonly the files whose hash the target does not hold; the dry run prints\n`~ brand branding/logo content differs \u2014 would upload`. A missing slot \u2014 or a snapshot\nwithout the block \u2014 leaves the target\'s file untouched. A replaced **logo** file is never\ndeleted (sent mail links it); a replaced **font** file is.\nFonts are served from the app\'s own Convex origin \u2014 **never** point a browser at an\nexternal font host (a private-network host is blocked by the browser; the Google-Fonts\nCDN is a GDPR problem).\n\n## The theme shape\n\nEvery field is optional \u2014 omit a key to fall back to the platform default:\n\n```jsonc\n{\n "colors": {\n "primary": "#1E4BCD", // brand primary \u2192 --color-primary (buttons, rings, filled header)\n "accent": "#0AAA5F", // secondary accent \u2192 --color-accent (links, hovers, dots)\n "background": "#FFFFFF", // portal page bg \u2192 --color-bg\n "foreground": "#111111" // body text \u2192 --color-fg\n },\n "radius": "sharp", // "sharp" | "rounded" | "soft"\n "logoSize": "max", // banner logo height: "sm" | "md" | "lg" | "max" (default lg)\n "bannerDensity": "normal", // "compact" | "normal" | "spacious" (default normal)\n "filledHeader": false, // true \u2192 top nav bar filled with the PRIMARY colour (on-primary text)\n "websiteUrl": "https://www.example-schule.de",\n "fonts": {\n "heading": { "family": "Space Grotesk" }, // family only \u2014 the file is uploaded (set-font)\n "body": { "family": "Lora" }\n }\n}\n```\n\n- `colors.*` are `#RRGGBB` hex strings; `radius`/`logoSize`/`bannerDensity` are the enums above.\n- A font entry is `{ family }`. With an uploaded file for that slot the portal loads it as\n `@font-face` under that family; without one the family must already be available\n (system/bundled). A font `url` is **refused** (`fonts.<slot>.url is no longer\n supported`) \u2014 upload the file instead.\n- Bad values (malformed hex, bad enum, a font `url`) fail loud server-side \u2014 the write\n aborts, no partial state.\n\n## Steps \u2014 the surgical CLI path (recommended)\n\n```bash\n# 1. Inspect current branding (branding + resolved logo URL).\nplexus-cli --env staging --tenant <slug> branding show\n\n# 2. Set the theme tokens from a JSON file (replaces the theme wholesale; leaves the logo).\nplexus-cli --env staging --tenant <slug> branding set-theme --file theme.json\n\n# 3. Upload the logo \u2014 from a local file \u2026\nplexus-cli --env staging --tenant <slug> branding set-logo --file logo.png\n# \u2026 or straight from a URL (fetched + uploaded by the CLI):\nplexus-cli --env staging --tenant <slug> branding set-logo \\\n --url https://cdn.example.com/logo-black.png\n\n# 4. Upload the font files \u2014 the slot\'s family must be set first (step 2), the file is\n# applied under it. WOFF2 only (signature-checked), \u2264 2 MB; a replaced file is deleted.\nplexus-cli --env staging --tenant <slug> branding set-font --slot heading --file heading.woff2\nplexus-cli --env staging --tenant <slug> branding set-font --slot body --file body.woff2\n# (`branding clear-font --slot <slot>` removes a file; the family stays.)\n\n# 5. Verify, then promote to prod (re-run 1\u20134 with --env prod \u2014 never assume prod == staging).\nplexus-cli --env prod --tenant <slug> branding show\n```\n\n- `set-theme` replaces the whole theme (a submitted-absent field clears the stored one),\n mirroring the admin form \u2014 so the file must carry the **complete**\n theme you want.\n- The logo cap: images only, \u2264 3 MB. Pick the variant that reads on the header \u2014 a **dark\n logo** for the default light bar, a **white/inverse logo** when `filledHeader: true`\n (the bar is the dark primary colour). `branding clear-logo` removes it.\n\n## Alternatives\n\n- **Whole-config rollout (`config apply`).** The theme round-trips through the config\n snapshot\'s `tenant.branding` block and the files through `tenant.brandingAssets`, so\n `config export \u2192 edit \u2192 apply` (or `apply --from env:staging` onto prod) carries the\n complete brand, bytes included \u2014 but it re-plans the *entire* tenant config, so prefer\n it when branding rides along with other config changes or moves between environments.\n To swap a file in a snapshot, replace `branding/<slot>.<ext>` and keep its `path`: the\n CLI re-hashes the file on disk. For a one-off change, `set-theme` / `set-logo` /\n `set-font` are surgical.\n- **Admin UI.** A tenant admin (holding `administration.branding.manage`) edits the same\n row live under **Administration \u2192 Branding**. Use it for quick per-tenant tweaks; use the CLI\n for reproducible, cross-env rollout by a platform admin.\n\n## Gotchas\n\n- **Release gate:** a brand-new `plexus-cli branding` verb (or a new theme field) must be\n live on the env before the CLI call resolves \u2014 otherwise the call fails with an unknown\n function. Ask the platform operator whether the release is out.\n- `config export` names the logo and the font files by hash and writes their bytes to\n `branding/`; `branding show` resolves their URLs (`logoUploads`, `fontUploads`). A\n committing apply refuses a changed hash it has no bytes for\n (`[branding/contentMissing]`), a font file that is not WOFF2 (`[branding/fontRefused]`)\n and a font slot without an own family (`[branding/fontFamilyMissing]`).\n- `set-font` refuses (`INVALID`, German message) a slot without a saved\n family, a family named like the back office\'s own fonts (`Inter Variable`, `Azeret Mono\n Variable` \u2014 an `@font-face` is document-wide), anything over 2 MB and anything that is\n not WOFF2 \u2014 convert TTF/OTF/WOFF first (e.g. `woff2_compress`).\n- Removing a family (config / `set-theme`) leaves its file attached but unused; the admin\n page flags it. Clear the file with `branding clear-font` when you drop the family.\n- A deployment that once held external font URLs dropped them on upgrade (the platform\n operator has the list of dropped URLs); re-upload those files with `set-font`.\n- Verify in the browser: DevTools \u2192 Network \u2192 the `.woff2` request from the Convex origin\n answers 200 with `Access-Control-Allow-Origin: <the portal origin>` (fonts load\n cross-origin; Convex storage reflects the requesting origin).\n- This is a live-DB operation; nothing else records it. A `config export` snapshot is\n your only copy \u2014 keep it out of any shared or public place.\n\n## Related\n\n- [Update a tenant\'s config](./update-tenant-config.md) \xB7 [Onboard / establish a tenant](./onboard-tenant.md)\n- Command semantics: `plexus-cli branding <verb> --help`, `plexus-cli config apply --help`.\n',"references/config/set-tenant-terms.md":`# Set a school's terms (\u201EAnmeldung" statt \u201EBewerbung")
5143
+ `,"references/config/set-tenant-branding.md":'# Set a tenant\'s external-portal branding\n\n**When to use:** give a tenant\'s public `/e/**` Bewerbungsportal its own white-label\nlook \u2014 brand colors, corner radius, logo size, header style, and font families, plus an\nuploaded logo and uploaded font files \u2014 on staging and/or prod, without a reseed.\n\n## Prerequisites\n\n- `plexus-cli` installed and current (`plexus-cli --help`).\n- A token configured for each target env (`plexus-cli --env <env> config show` prints\n the resolved connection): a platform-admin token holding `_platform.config.manage` (the\n same right that gates `config apply`), or \u2014 for your OWN tenant only \u2014 a tenant\n admin\'s token holding `administration.config.manage` (see\n [CLI access for a tenant admin](../users/cli-access-for-tenant-admin.md)). Such a\n token runs every `plexus-cli branding \u2026` command and `config apply` for its own\n tenant (branding is one of the `tenant.*` settings a school may change); `branding\n show` needs `administration.config.read` at least. The in-app right\n `administration.branding.manage` alone is refused by the CLI. A local admin key\n without a user identity does **not** satisfy this gate.\n- The `plexus-cli branding \u2026` commands must be **live on the target env** first (they\n call backend functions of the same release). A platform operator rolls a release out\n to staging, then prod; only then run the CLI.\n- The tenant **slug** (e.g. `test`). Always **stage on staging first**, verify in the\n browser, then promote to prod.\n\n## The two halves of branding\n\n| Part | Where it lives | How to set it |\n| --- | --- | --- |\n| **Theme tokens** \u2014 colors, radius, logoSize, bannerDensity, filledHeader, websiteUrl, font **families** | `tenant_branding` row columns; config-portable (exported in `tenant.branding`) | `plexus-cli branding set-theme` (surgical) **or** `config apply` (whole-config) |\n| **Logo** | `_storage` id column (a single `primary` slot); carried by config **by hash** (`tenant.brandingAssets.logo`) | `plexus-cli branding set-logo` (one-off upload) **or** `config apply` (bytes from the snapshot / source env) |\n| **Font files** (WOFF2, one per slot `heading` / `body`) | `_storage` id columns; carried by config **by hash** (`tenant.brandingAssets.fontHeading` / `fontBody`) | `plexus-cli branding set-font --slot heading\\|body --file <woff2>` **or** `config apply` |\n\nA `storageId` is deployment-local, so config never carries it. It carries each uploaded\nfile like a library file: `{ sha256, sizeBytes, mimeType }` under `tenant.brandingAssets`, and\n`config export` downloads the bytes beside `config.json` as `branding/<slot>.<ext>`\n(`path` in the entry). `config apply --from snapshot:\u2026` or `--from env:<src>` uploads\nonly the files whose hash the target does not hold; the dry run prints\n`~ brand branding/logo content differs \u2014 would upload`. A missing slot \u2014 or a snapshot\nwithout the block \u2014 leaves the target\'s file untouched. A replaced **logo** file is never\ndeleted (sent mail links it); a replaced **font** file is.\nFonts are served from the app\'s own Convex origin \u2014 **never** point a browser at an\nexternal font host (a private-network host is blocked by the browser; the Google-Fonts\nCDN is a GDPR problem).\n\n## The theme shape\n\nEvery field is optional \u2014 omit a key to fall back to the platform default:\n\n```jsonc\n{\n "colors": {\n "primary": "#1E4BCD", // brand primary \u2192 --color-primary (buttons, rings, filled header)\n "accent": "#0AAA5F", // secondary accent \u2192 --color-accent (links, hovers, dots)\n "background": "#FFFFFF", // portal page bg \u2192 --color-bg\n "foreground": "#111111" // body text \u2192 --color-fg\n },\n "radius": "sharp", // "sharp" | "rounded" | "soft"\n "logoSize": "max", // banner logo height: "sm" | "md" | "lg" | "max" (default lg)\n "bannerDensity": "normal", // "compact" | "normal" | "spacious" (default normal)\n "filledHeader": false, // true \u2192 top nav bar filled with the PRIMARY colour (on-primary text)\n "websiteUrl": "https://www.example-schule.de",\n "fonts": {\n "heading": { "family": "Space Grotesk" }, // family only \u2014 the file is uploaded (set-font)\n "body": { "family": "Lora" }\n }\n}\n```\n\n- `colors.*` are `#RRGGBB` hex strings; `radius`/`logoSize`/`bannerDensity` are the enums above.\n- A font entry is `{ family }`. With an uploaded file for that slot the portal loads it as\n `@font-face` under that family; without one the family must already be available\n (system/bundled). A font `url` is **refused** (`fonts.<slot>.url is no longer\n supported`) \u2014 upload the file instead.\n- Bad values (malformed hex, bad enum, a font `url`) fail loud server-side \u2014 the write\n aborts, no partial state.\n\n## Steps \u2014 the surgical CLI path (recommended)\n\n```bash\n# 1. Inspect current branding (branding + resolved logo URL).\nplexus-cli --env staging --tenant <slug> branding show\n\n# 2. Set the theme tokens from a JSON file (replaces the theme wholesale; leaves the logo).\nplexus-cli --env staging --tenant <slug> branding set-theme --file theme.json\n\n# 3. Upload the logo \u2014 from a local file \u2026\nplexus-cli --env staging --tenant <slug> branding set-logo --file logo.png\n# \u2026 or straight from a URL (fetched + uploaded by the CLI):\nplexus-cli --env staging --tenant <slug> branding set-logo \\\n --url https://cdn.example.com/logo-black.png\n\n# 4. Upload the font files \u2014 the slot\'s family must be set first (step 2), the file is\n# applied under it. WOFF2 only (signature-checked), \u2264 2 MB; a replaced file is deleted.\nplexus-cli --env staging --tenant <slug> branding set-font --slot heading --file heading.woff2\nplexus-cli --env staging --tenant <slug> branding set-font --slot body --file body.woff2\n# (`branding clear-font --slot <slot>` removes a file; the family stays.)\n\n# 5. Verify, then promote to prod (re-run 1\u20134 with --env prod \u2014 never assume prod == staging).\nplexus-cli --env prod --tenant <slug> branding show\n```\n\n- `set-theme` replaces the whole theme (a submitted-absent field clears the stored one),\n mirroring the admin form \u2014 so the file must carry the **complete**\n theme you want.\n- The logo cap: images only, \u2264 3 MB. Pick the variant that reads on the header \u2014 a **dark\n logo** for the default light bar, a **white/inverse logo** when `filledHeader: true`\n (the bar is the dark primary colour). `branding clear-logo` removes it.\n\n## Alternatives\n\n- **Whole-config rollout (`config apply`).** The theme round-trips through the config\n snapshot\'s `tenant.branding` block and the files through `tenant.brandingAssets`, so\n `config export \u2192 edit \u2192 apply` (or `apply --from env:staging` onto prod) carries the\n complete brand, bytes included \u2014 but it re-plans the *entire* tenant config, so prefer\n it when branding rides along with other config changes or moves between environments.\n To swap a file in a snapshot, replace `branding/<slot>.<ext>` and keep its `path`: the\n CLI re-hashes the file on disk. For a one-off change, `set-theme` / `set-logo` /\n `set-font` are surgical.\n- **Admin UI.** A tenant admin (holding `administration.branding.manage`) edits the same\n row live under **Administration \u2192 Branding**. Use it for quick per-tenant tweaks; use the CLI\n for reproducible, cross-env rollout.\n\n## Gotchas\n\n- **Release gate:** a brand-new `plexus-cli branding` verb (or a new theme field) must be\n live on the env before the CLI call resolves \u2014 otherwise the call fails with an unknown\n function. Ask the platform operator whether the release is out.\n- `config export` names the logo and the font files by hash and writes their bytes to\n `branding/`; `branding show` resolves their URLs (`logoUploads`, `fontUploads`). A\n committing apply refuses a changed hash it has no bytes for\n (`[branding/contentMissing]`), a font file that is not WOFF2 (`[branding/fontRefused]`)\n and a font slot without an own family (`[branding/fontFamilyMissing]`).\n- `set-font` refuses (`INVALID`, German message) a slot without a saved\n family, a family named like the back office\'s own fonts (`Inter Variable`, `Azeret Mono\n Variable` \u2014 an `@font-face` is document-wide), anything over 2 MB and anything that is\n not WOFF2 \u2014 convert TTF/OTF/WOFF first (e.g. `woff2_compress`).\n- Removing a family (config / `set-theme`) leaves its file attached but unused; the admin\n page flags it. Clear the file with `branding clear-font` when you drop the family.\n- A deployment that once held external font URLs dropped them on upgrade (the platform\n operator has the list of dropped URLs); re-upload those files with `set-font`.\n- Verify in the browser: DevTools \u2192 Network \u2192 the `.woff2` request from the Convex origin\n answers 200 with `Access-Control-Allow-Origin: <the portal origin>` (fonts load\n cross-origin; Convex storage reflects the requesting origin).\n- This is a live-DB operation; nothing else records it. A `config export` snapshot is\n your only copy \u2014 keep it out of any shared or public place.\n\n## Related\n\n- [Update a tenant\'s config](./update-tenant-config.md) \xB7 [Onboard / establish a tenant](./onboard-tenant.md)\n- Command semantics: `plexus-cli branding <verb> --help`, `plexus-cli config apply --help`.\n',"references/config/set-tenant-terms.md":`# Set a school's terms (\u201EAnmeldung" statt \u201EBewerbung")
5144
5144
 
5145
5145
  **When to use:** a school calls the process by another name \u2014 it runs an
5146
5146
  \u201EAnmeldeverfahren", not a \u201EBewerbungsverfahren". One setting switches the whole product for that school: the UI,
@@ -9813,7 +9813,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
9813
9813
  ## Related
9814
9814
  - Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
9815
9815
  \`plexus-cli platform imports cleanup-orphaned --help\`.
9816
- `};var Pu="61c290e371b0fa98a247559cf6e15b83e499adde8bbebfbc277078b3a60c8f14",ug=b$;var fg=class extends Se{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Pu,tools:ja}),0}},pg=class extends Se{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=p.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let t=JSON.parse(await cg(this.context.stdin)),n=await this.context.executePlexusAgentTool(this.tool,t);return this.print(n),0}},v$=[fg,pg];var mg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],cie=new Set(mg.map(e=>e.key));function S$(e,t,n,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===t);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${t}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${t} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===n||l.runId===n);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${n}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(S$,"resolveStartTarget");function CU(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(CU,"applicantText");function A$(e){return e.map(t=>({id:t.application._id,status:t.deletedAt?`${t.application.status} (gel\xF6scht)`:t.application.status,state:t.currentProcessStateId??"",applicant:CU(t.applicantName),test:t.application.testMode===!0?"test":""}))}s(A$,"applicationRows");var x$=mg.map(e=>e.email);function E$(e,t,n,r){if(n===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(n!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(ag(e,t)&&(r===void 0||!x$.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${x$.join(", ")} (--applicant) \u2014 never a real family's`)}s(E$,"assertStartApplicant");function T$(e){let t={};for(let{address:n,...r}of e.entries)t[n]=r;return{applicationId:e.applicationId,store:t}}s(T$,"processStoreJson");function DU(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(t=>`${t.partKey}: contract ${t.contractId} \xB7 ${t.revision===null?"keine Fassung":`Fassung ${t.revision.revisionNumber}`} \xB7 ${t.contractStatus}`).join("; ")}}s(DU,"refText");function FU(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?DU(e.ref):JSON.stringify(e.value)}s(FU,"holds");function $$(e){return e.entries.map(t=>({address:t.address,state:t.state,holds:FU(t),producer:t.producer?.label??"",written:t.writtenAt===void 0?"":new Date(t.writtenAt).toISOString()}))}s($$,"storeRows");function _u(e){let t={},n={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(n,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);n[o]=a;try{t[o]=JSON.parse(a)}catch{t[o]=a}}return{values:t,raw:n}}s(_u,"parseKv");var R$="started",Nu="submitted",Cu="submitted",I$="load-scenario:";var O$="(Bewerbung)";function P$(e){return{nodeId:O$,actions:e.map(t=>({id:t.id,label:{de:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`,en:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`},...t.disabledReason===void 0?{}:{disabledReason:t.disabledReason}}))}}s(P$,"sharedAsList");function _$(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(_$,"disabledText");function N$(e){return e.flatMap(({nodeId:t,actions:n})=>n.map(r=>({node:t,action:r.id,label:r.label.de,disabled:_$(r)})))}s(N$,"actionRows");function C$(e,t,n=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===t));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${t}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${t}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===t);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${t}" on ${i} is disabled: ${_$(a)}`);if(i!==O$)return i;let l=n[0];if(l===void 0)throw new Error(`test-actions run: "${t}" needs a current node \u2014 the application has none`);return l}s(C$,"nodeOfferingAction");function D$(e,t,n){if(e.startsWith(I$)){if(Object.hasOwn(n,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:t,...n}}return Object.keys(n).length===0?void 0:{...n}}s(D$,"runParams");async function LU(e,t){let n=await e.query(S.workflow.getInstance,{applicationId:t});if(n===null)throw new Error(`test-actions: application ${t} has no workflow instance`);return n.instance.currentNodeIds}s(LU,"currentNodeIds");function MU(e,t){switch(t){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${t} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(MU,"refusalText");async function Du(e,t,n){let r=await e.query(S.workflow.listSharedTestActions,{applicationId:t});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${MU(t,r.reason)}`);let i=[];for(let o of n){let a=await e.query(S.workflow.listTestActions,{applicationId:t,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,P$(r.actions)]}s(Du,"actionsOf");async function F$(e,t,n){return n!==void 0?[n]:await LU(e,t)}s(F$,"nodesOf");var hg=class extends C{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let t=await this.caller(),n=await Du(t,this.application,await F$(t,this.application,this.node));return this.print(n,N$,["node","action","label","disabled"]),0}},gg=class extends C{static{s(this,"TestActionsRunCommand")}application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=p.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=p.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=p.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (upload-signed-document)"});async execute(){let t=D$(this.action,this.autoSubmit,_u(this.param??[]).values),n=await this.caller(),r=this.application,i=await F$(n,this.application,this.node),o=C$(await Du(n,r,i),this.action,i);return await n.mutation(S.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...t===void 0?{}:{params:t}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},L$=[hg,gg];var ze=["de","en"];function os(e,t){return ze.every(n=>e[n]===t[n])}s(os,"sameText");function Et(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let t=e;return Object.keys(t).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=t[r];return typeof i!="string"||i.trim()===""})}s(Et,"missingLocales");function wi(e){let t=Et(e);return t!=="not-localized"&&t.length===0}s(wi,"isLocalizedText");function Ba(e,t){let n={};for(let r of ze){let i=e.map(o=>o[r]);n[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?t(i,r):""}return n}s(Ba,"composeTexts");var sr=/^[a-z][A-Za-z0-9]*$/;function yg(e){return typeof e=="string"&&sr.test(e)}s(yg,"isNodeId");function ss(e,t){yg(e)||N(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${sr.source}.`);let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}s(ss,"makeNodeId");var ki="$env";function se(e){if(e.scope==="env")return`${ki}.${e.key}`;let t=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?t:`${t}.${e.path}`}s(se,"formatAddress");var Tr=/^[a-z][a-zA-Z0-9_]*$/,qU=/^[A-Za-z_][A-Za-z0-9_]*$/;function oo(e){return typeof e=="string"&&e.split(".").every(t=>qU.test(t))}s(oo,"isPath");function Vr(e){if(!e.startsWith("$"))return null;let t=e.slice(1).split("."),[n,...r]=t;switch(n){case"env":{let i=r.join(".");return r.length>0&&oo(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Tr.test(i)?null:M$({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Tr.test(o)||(n==="node"?!sr.test(i):!Tr.test(i))?null:M$({scope:n,owner:i,key:o},a)}default:return null}}s(Vr,"tryParseAddress");function M$(e,t){if(t.length===0)return e;let n=t.join(".");return oo(n)?{...e,path:n}:null}s(M$,"withPath");function be(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=t.scope==="env"?["scope","key"]:t.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(t).some(r=>!n.includes(r))||t.path!==void 0&&!oo(t.path))return!1;switch(t.scope){case"env":return oo(t.key);case"derived":return typeof t.key=="string"&&Tr.test(t.key);case"node":return typeof t.owner=="string"&&sr.test(t.owner)&&typeof t.key=="string"&&Tr.test(t.key);case"task":return typeof t.owner=="string"&&Tr.test(t.owner)&&typeof t.key=="string"&&Tr.test(t.key);default:return!1}}s(be,"isAddress");var Gr={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"}},as=Object.keys(Gr);function ls(e){return Object.hasOwn(Gr,e)}s(ls,"isEnvKey");var KU=["self-service","staff"];function q$(e,t){return{kind:"fixed",values:e,labels:t}}s(q$,"fixedSet");var Fu={of:"applicant.language",withoutValue:"de"},zr={"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:Fu},"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:Fu},"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:Fu},"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:Fu},"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:q$(ze,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:q$(KU,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Lu={types:Gr,fields:zr},Mu=as.flatMap(e=>Object.keys(Gr[e]).map(t=>`${e}.${t}`));function ar(e){return Object.hasOwn(zr,e)}s(ar,"isEnvLeaf");function qu(e){return`${ki}.${e}`}s(qu,"envIdentifier");function so(e){let t=zr[e],[n,r]=e.split("."),i=Gr[n][r];i===void 0&&N(`[env] leaf "${e}" has no type`);let o=t.valueSet;return{leaf:e,type:i,label:t.label,nullable:t.nullable,...t.absent===void 0?{}:{absent:t.absent},...t.nameLanguage===void 0?{}:{nameLanguage:t.nameLanguage},...t.cohortBound===void 0?{}:{cohortBound:t.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&N(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(so,"envLeaf");var K$="staffInput";var jU=["boolean"],Ua=/^[a-z][A-Za-z0-9]*$/;function Ku(e){return e.staffInputs??[]}s(Ku,"staffInputsOf");function ju(e){return`${K$}.${e}`}s(ju,"staffInputLeaf");function j$(e){return`${ki}.${ju(e)}`}s(j$,"staffInputIdentifier");function BU(e){let t=`${K$}.`;return e.startsWith(t)?e.slice(t.length):null}s(BU,"staffInputKeyOfLeaf");function Va(e,t){let n=BU(t);return n===null?void 0:Ku(e).find(r=>r.key===n)}s(Va,"declaredStaffInput");function UU(e){return[...Ku(e).map(t=>({leaf:ju(t.key),type:t.type,label:t.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Mu.map(t=>{let n=so(t);return{leaf:t,type:n.type,label:n.label,valueSet:zr[t].valueSet,nullable:n.nullable,cohortBound:n.cohortBound===!0}})]}s(UU,"envLeavesFor");function B$(e){return UU(e).filter(t=>!t.cohortBound)}s(B$,"conditionEnvLeaves");function U$(e){let t={},n={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of B$(e)){let[l="",d=""]=r.split(".");t[l]={...t[l]??{},[d]:i},n[r]={valueSet:o,nullable:a}}return{types:t,fields:n}}s(U$,"envConditionSchemaFor");function V$(e){let t=e.staffInputs;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let n=[],r=new Set;return t.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){n.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Ua.test(l.key)||n.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&n.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),jU.includes(l.type)||n.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Et(l.label);c==="not-localized"?n.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&n.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),n}s(V$,"staffInputIssues");var Tg={required:!0,description:"Offer slug (its offerKey)"},wg=class extends C{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=p.String("--offer",Tg);testOnly=p.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let t=await this.caller(),n=await t.query(S.admission.listForAngebot,{client:this.requireTenant(t),offerKey:this.offer}),r=A$(n).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},kg=class extends C{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=p.String("--offer",Tg);async execute(){let t=await this.caller(),n=await t.query(S.admission.getCountsByListForAngebot,{client:this.requireTenant(t),offerKey:this.offer});return this.print(n,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},bg=class extends C{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=p.String({required:!0});async execute(){let t=await this.caller(),n=this.application,r=await t.query(S.admission.get,{applicationId:n});if(r===null)throw new Error(`applications show: no application ${n} (or not visible to you)`);let i=await t.query(S.workflow.getInstance,{applicationId:n});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:n},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},vg=class extends C{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $derived\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=p.String({required:!0});async execute(){let n=await(await this.caller()).query(S.processStoreView.get,{applicationId:this.application});return this.print(T$(n),()=>$$(n),["address","state","holds","producer","written"]),0}},xg=class extends C{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=p.String("--offer",Tg);run=p.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=p.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=p.String("--party",{description:"Applicant party id"});applicant=p.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=p.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=p.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=p.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let t=await this.caller();E$(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let n=this.requireTenant(t),r=S$(await t.query(S.admission.listAdmissionTree,{client:n}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await t.query(S.applicants.partyByEmail,{client:n,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await t.mutation(S.admission.staffStartApplicationForParty,{client:n,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:z$(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await t.query(S.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await Du(t,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},Sg=class extends C{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one)"});application=p.String({required:!0});async execute(){return await(await this.caller()).mutation(S.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},n=>[{key:"discarded",value:n.discarded}]),0}},Ag=class extends C{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=p.String({required:!0});async execute(){let n=await(await this.caller()).query(S.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(n,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},Eg=class extends C{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=p.String({required:!0});input=p.String("--input",{required:!0,description:"key=true|false"});reason=p.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let t=await this.caller(),[{key:n,value:r}]=z$([this.input]);return await t.mutation(S.admission.correctStaffInput,{applicationId:this.application,key:n,value:r,reason:this.reason}),this.print({application:this.application,key:n,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},G$=[wg,kg,bg,vg,xg,Sg,Ag,Eg];function z$(e){return e.map(t=>{let[n="",r,...i]=t.split("=");if(!Ua.test(n)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${t}": expected key=true or key=false`);return{key:n,value:r==="true"}})}s(z$,"parseStaffInputs");var Ft="contractGenerator",ao="documentTemplate";function Ga(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return(t.kind==="generator"||t.kind==="package")&&typeof t.key=="string"&&t.key.length>0&&(t.revision===void 0||typeof t.revision=="number"&&Number.isInteger(t.revision)&&t.revision>0)&&n.every(r=>r==="kind"||r==="key"||r==="revision")}s(Ga,"isGeneratorRef");function W$(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(W$,"literalOf");function Wr(e){let t=W$(e,Ft);return Ga(t)?t:null}s(Wr,"generatorRefOfNode");function lr(e){let t=W$(e,ao);return typeof t=="string"&&t.length>0?t:null}s(lr,"documentTemplateKeyOfNode");function H$(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(H$,"generatorRefLabel");var VU=["formExports","generatorStamp"];function Y$(e,t,n){let r=e.inputs?.[Ft];(r?.kind!=="literal"||!Ga(r.value))&&N(`applyGeneratorStamp: the node names no generator in inputs.${Ft} \u2014 a stamp derives from it`),n.freezeRevision&&t.revision!==void 0&&(e.inputs[Ft]={kind:"literal",value:{...r.value,revision:t.revision}}),e.generatorStamp={inputSchema:t.inputSchema,parties:t.parties,schemaDigest:t.schemaDigest,...t.parts===void 0?{}:{parts:t.parts}}}s(Y$,"applyGeneratorStamp");var GU=["reads"];function ds(e){if(e===null||typeof e!="object")return e;let t={...e};return Array.isArray(t.nodes)&&(t.nodes=t.nodes.map(n=>{if(n===null||typeof n!="object")return n;let r={...n};for(let i of VU)delete r[i];for(let i of GU)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),t}s(ds,"comparableWorkflowGraph");var za={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:"Reihenfolge und automatisches Nachr\xFCcken sind die Eing\xE4nge `waitlistOrder` / `autoPromoteOnVacancy` des Wartelistenknotens (Freigabe-Strategie und Stichtag las nichts)",en:"order and automatic promotion are the waitlist node's inputs `waitlistOrder` / `autoPromoteOnVacancy` (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 Bu(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(t=>{let n=za[t];return n!==void 0?`manifest: \`${t}\` is no longer part of manifest.json (${n.en}). Delete the line.`:`manifest: unknown key \`${t}\` \u2014 manifest.json carries no key.`})}s(Bu,"manifestIssues");function zU(e){let t=[],n=e.buses;if(!Array.isArray(n))return t;let r=n.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return t;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";t.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return t}s(zU,"validateProgressLayoutExternalCopy");function J$(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let t=e.buses;return!Array.isArray(t)||!t.some(n=>!!n&&typeof n=="object"&&n.key==="process")?["progressLayout: the layout must declare the `process` bus"]:zU(e)}s(J$,"progressLayoutIssues");var Q$=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var WU=new Set(["sections","effects","outcomes","testScenarios","env"]),Uu={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 Z$(e,t){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${t}: die Formulardefinition muss ein Objekt sein.`,en:`${t}: the form definition must be an object.`}];let n=[];for(let i of Object.keys(e)){if(WU.has(i))continue;let o=Uu[i];n.push(o!==void 0?{de:`${t}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${t}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${t}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${t}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||n.push({de:`${t}: \`${i}\` muss eine Liste sein.`,en:`${t}: \`${i}\` must be a list.`});return n}s(Z$,"smartFormDefinitionShapeIssues");var wn=["granted","rejected","waitlisted","other"];function bi(e){return typeof e=="string"&&wn.includes(e)}s(bi,"isOutcomeSemantic");var Gn=["arrival","manual"],eR={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function X$(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(X$,"literal");function $g(e){let t=X$(e,"waitlistOrder"),n=X$(e,"autoPromoteOnVacancy");return!Gn.includes(t)||typeof n!="boolean"?null:{waitlistOrder:t,autoPromoteOnVacancy:n}}s($g,"waitlistPolicyOrNull");var ht="responsible",Rg="team:";function Vu(e){return`${Rg}${e}`}s(Vu,"teamSlot");function Gu(e){return e.startsWith(Rg)?e.slice(Rg.length):null}s(Gu,"teamKeyOfSlot");function tR(e){return e.kind==="responsible"?ht:Vu(e.groupKey)}s(tR,"slotIdOf");function zu(e){if(e===ht)return{kind:"responsible"};let t=Gu(e);return t===null||t.length===0?null:{kind:"team",groupKey:t}}s(zu,"slotOfId");var Ig="review",Og="checkField",nR="reviewed",rR="reviewing",Wu=["rejected","waitlisted"];function Pg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Pg,"isObject");var HU=new Set(["decision",Ig]),iR={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function _g(e){return Object.hasOwn(iR,e)?iR[e]:void 0}s(_g,"legacySemanticOfId");function YU(e){return e===Ig?wn.filter(t=>!Wu.includes(t)):wn}s(YU,"allowedSemanticsFor");var JU="other";function oR(e){return Pg(e)&&HU.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(oR,"outcomesOf");function sR(e){return(e?.nodes??[]).some(t=>oR(t).some(n=>Pg(n)&&!("semantic"in n)))}s(sR,"needsOutcomeSemantics");function aR(e,t={}){let n=[],r=[],i=[],o=e.nodes.map(a=>{let l=oR(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),f=YU(u),m=!1,y=l.map(k=>{if(!Pg(k))return k;let g=String(k.id);if("semantic"in k)return bi(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let v=`${c}.${g}`,$=Object.hasOwn(t,v)?t[v]:void 0;if($!==void 0)return f.includes($)?(n.push({nodeId:c,outcomeId:g,semantic:$,source:"answer"}),m=!0,{...k,semantic:$}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f,answer:$}),k);let R=_g(g),A=R??JU;return f.includes(A)?(n.push({nodeId:c,outcomeId:g,semantic:A,source:R===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f}),k)});return m?{...d,outcomes:y}:a});return n.length===0?{graph:e,written:n,refused:r,invalid:i}:{graph:{...e,nodes:o},written:n,refused:r,invalid:i}}s(aR,"addOutcomeSemantics");var dr="bewerbungOffen";function lo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(lo,"isObject");var Ng=["event","effect"];function lR(e){return lo(e)&&e.type==="eventTrigger"}s(lR,"isTrigger");function dR(e){let t=lo(e.inputs)?e.inputs:{};return"outcomes"in e||Ng.some(n=>n in e||n in t)}s(dR,"oldShape");function cR(e){return(e?.nodes??[]).some(t=>lR(t)&&dR(t))}s(cR,"needsEventTriggerStartMove");function QU(e){let t=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>lo(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===dr))return{unmoved:{nodeId:t,reason:"outcomesNotStart"}};let i=Object.keys(lo(e.next)?e.next:{});if(!(i.length===1&&i[0]===dr))return{unmoved:{nodeId:t,reason:"nextNotStart"}};let o=lo(e.inputs)?{...e.inputs}:{};for(let l of Ng){let d=o[l];if(lo(d)&&d.kind==="binding")return{unmoved:{nodeId:t,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Ng)delete a[l],delete o[l];return lo(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(QU,"moveNode");function uR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!lR(i)||!dR(i))return i;let o=QU(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(uR,"moveEventTriggerStart");function Wa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Wa,"isObject");var Cg={waitlistOrder:"arrival",autoPromoteOnVacancy:!1};function fR(e){if(!Wa(e)||e.type!=="waitlist")return!1;let t=Wa(e.inputs)?e.inputs:{};return!("waitlistOrder"in t)||!("autoPromoteOnVacancy"in t)}s(fR,"lacksPolicy");function ZU(e){return(e?.nodes??[]).some(fR)}s(ZU,"needsWaitlistPolicyMove");function Dg(e){return Wa(e)&&Gn.includes(e.waitlistOrder)&&typeof e.autoPromoteOnVacancy=="boolean"}s(Dg,"isWaitlistPolicy");function XU(e){if(e===void 0)return{policy:Cg,stated:!1};if(!Wa(e))return"malformed";let t=e.waitlistOrder,n=e.autoPromoteOnVacancy;return t!==void 0&&!Gn.includes(t)||n!==void 0&&typeof n!="boolean"?"malformed":{policy:{waitlistOrder:t??Cg.waitlistOrder,autoPromoteOnVacancy:n??Cg.autoPromoteOnVacancy},stated:t!==void 0&&n!==void 0}}s(XU,"policyOfSelection");function pR(e,t,n={}){let r=[],i=[];if(!ZU(e))return{graph:e,moved:r,refused:i};let o=XU(t),a=e.nodes.map(l=>{if(!fR(l))return l;let d=l,c=String(d.id),u=Wa(d.inputs)?{...d.inputs}:{};if("waitlistOrder"in u||"autoPromoteOnVacancy"in u)return i.push({nodeId:c,reason:"inputExists"}),l;let f=Object.hasOwn(n,c)?n[c]:void 0,m,y;if(f!==void 0)m=f,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},u.autoPromoteOnVacancy={kind:"literal",value:m.autoPromoteOnVacancy},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(pR,"moveWaitlistPolicyToInputs");function co(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(co,"isObject");var eV=[Ft,ao],tV=["inputSchema","parties","schemaDigest","parts"];function mR(e){return co(e)&&e.type==="governedDocument"&&("resolver"in e||co(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(mR,"oldShape");function hR(e){return(e?.nodes??[]).some(mR)}s(hR,"needsGeneratorInputMove");function nV(e){let t=co(e.inputs)?{...e.inputs}:{},n={...e},r;if("resolver"in e){let i=e.resolver;if(!co(i))return{unmoved:"resolverNotObject"};if(Ft in t)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((co(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>co(d)&&eV.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};t[Ft]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(tV.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(n.generatorStamp=l),r=i.cockpitFields,delete n.resolver}if(co(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ao in t)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};t[ao]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}n.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};n.cockpitFields=r}return n.inputs=t,{node:n}}s(nV,"moveNode");function gR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!mR(i))return i;let o=nV(i);return"unmoved"in o?(n.push({nodeId:String(i.id),reason:o.unmoved}),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(gR,"moveGeneratorPinsToInputs");var yR=/^\d{4}-\d{2}-\d{2}$/;function cr(e,t){return{de:e,en:t}}s(cr,"issue");function uo(e){if(typeof e!="object"||e===null)return cr("keine Reduktion","not a reduction");let t=e;if(t.kind==="none")return Object.keys(t).length===1?null:cr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(t.kind!=="amount")return cr(`unbekannte Art ${JSON.stringify(t.kind)}`,`unknown kind ${JSON.stringify(t.kind)}`);let{amount:n,activeFrom:r,activeTo:i}=t;return typeof n!="number"||!Number.isFinite(n)||n<=0?cr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((n*100).toFixed(6)))?typeof r!="string"||!yR.test(r)?cr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!yR.test(i)?cr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?cr("das Ende liegt vor dem Beginn","the end is before the start"):t.floorTotal!==void 0&&(typeof t.floorTotal!="number"||!Number.isSafeInteger(t.floorTotal)||t.floorTotal<0)?cr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):t.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(t.pricePeriod))?cr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(t).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?cr("unbekannte Angaben","unknown details"):null:cr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(uo,"reductionShapeIssue");function vi(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.itemKey=="string"&&t.itemKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||uo(t.reduction)===null&&t.reduction.kind==="amount")}s(vi,"isPricedItemValue");var cs=["freetext","recommendation","choice","pricedItem","record","reduction"],us=[...cs,"appointment"];function kR(e){return typeof e=="string"&&us.includes(e)}s(kR,"isTaskResultKind");function xi(e){return typeof e=="string"&&cs.includes(e)}s(xi,"isRecordedTaskResultKind");function fs(e){return xi(e.kind)}s(fs,"isRecordedTaskResult");var Hu=["number","boolean","enum"];function Fg(e){return typeof e=="string"&&Hu.includes(e)}s(Fg,"isRecordFieldType");var Lg=["form","siblingRank"];var Hr={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 fo(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(fo,"isProseResult");function Yu(e){return e.kind==="record"?(e.fields??[]).filter(t=>typeof t.writes=="string"&&t.writes.length>0&&Fg(t.type)).map(t=>({key:t.writes,valueType:t.type,field:t})):rV(e)}s(Yu,"draftResultStoreWrites");function rV(e){let t=Hr[e.kind].valueType;return e.writes===void 0||t===null?[]:[{key:e.writes,valueType:t}]}s(rV,"singleStoreWrite");var wR="team:";function ps(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(wR)){let t=e.slice(wR.length);return t.length===0?null:{kind:"team",groupKey:t}}return{kind:"channel",channelKey:e}}s(ps,"parseTaskResultChat");var He={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",filesOnKind:"[taskResult/filesOnKind]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var iV=new Set(["if","else","in","true","false","null"]),oV=new Set(["==","!=","<=",">=","&&","||"]);function sV(e){return e>="0"&&e<="9"}s(sV,"isDigit");function aV(e){return/[a-zA-Z_$]/.test(e)}s(aV,"isIdentStart");function lV(e){return/[a-zA-Z0-9_.$]/.test(e)}s(lV,"isIdentCont");function dV(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(r===" "||r===" "||r===`
9816
+ `};var Pu="aafde774e99c32c2e37100c99081e6ec2eeccbacf544b5f9c13ad882e960b799",ug=b$;var fg=class extends Se{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Pu,tools:ja}),0}},pg=class extends Se{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=p.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let t=JSON.parse(await cg(this.context.stdin)),n=await this.context.executePlexusAgentTool(this.tool,t);return this.print(n),0}},v$=[fg,pg];var mg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],cie=new Set(mg.map(e=>e.key));function S$(e,t,n,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===t);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${t}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${t} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===n||l.runId===n);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${n}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(S$,"resolveStartTarget");function CU(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(CU,"applicantText");function A$(e){return e.map(t=>({id:t.application._id,status:t.deletedAt?`${t.application.status} (gel\xF6scht)`:t.application.status,state:t.currentProcessStateId??"",applicant:CU(t.applicantName),test:t.application.testMode===!0?"test":""}))}s(A$,"applicationRows");var x$=mg.map(e=>e.email);function E$(e,t,n,r){if(n===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(n!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(ag(e,t)&&(r===void 0||!x$.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${x$.join(", ")} (--applicant) \u2014 never a real family's`)}s(E$,"assertStartApplicant");function T$(e){let t={};for(let{address:n,...r}of e.entries)t[n]=r;return{applicationId:e.applicationId,store:t}}s(T$,"processStoreJson");function DU(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(t=>`${t.partKey}: contract ${t.contractId} \xB7 ${t.revision===null?"keine Fassung":`Fassung ${t.revision.revisionNumber}`} \xB7 ${t.contractStatus}`).join("; ")}}s(DU,"refText");function FU(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?DU(e.ref):JSON.stringify(e.value)}s(FU,"holds");function $$(e){return e.entries.map(t=>({address:t.address,state:t.state,holds:FU(t),producer:t.producer?.label??"",written:t.writtenAt===void 0?"":new Date(t.writtenAt).toISOString()}))}s($$,"storeRows");function _u(e){let t={},n={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(n,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);n[o]=a;try{t[o]=JSON.parse(a)}catch{t[o]=a}}return{values:t,raw:n}}s(_u,"parseKv");var R$="started",Nu="submitted",Cu="submitted",I$="load-scenario:";var O$="(Bewerbung)";function P$(e){return{nodeId:O$,actions:e.map(t=>({id:t.id,label:{de:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`,en:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`},...t.disabledReason===void 0?{}:{disabledReason:t.disabledReason}}))}}s(P$,"sharedAsList");function _$(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(_$,"disabledText");function N$(e){return e.flatMap(({nodeId:t,actions:n})=>n.map(r=>({node:t,action:r.id,label:r.label.de,disabled:_$(r)})))}s(N$,"actionRows");function C$(e,t,n=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===t));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${t}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${t}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===t);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${t}" on ${i} is disabled: ${_$(a)}`);if(i!==O$)return i;let l=n[0];if(l===void 0)throw new Error(`test-actions run: "${t}" needs a current node \u2014 the application has none`);return l}s(C$,"nodeOfferingAction");function D$(e,t,n){if(e.startsWith(I$)){if(Object.hasOwn(n,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:t,...n}}return Object.keys(n).length===0?void 0:{...n}}s(D$,"runParams");async function LU(e,t){let n=await e.query(S.workflow.getInstance,{applicationId:t});if(n===null)throw new Error(`test-actions: application ${t} has no workflow instance`);return n.instance.currentNodeIds}s(LU,"currentNodeIds");function MU(e,t){switch(t){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${t} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(MU,"refusalText");async function Du(e,t,n){let r=await e.query(S.workflow.listSharedTestActions,{applicationId:t});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${MU(t,r.reason)}`);let i=[];for(let o of n){let a=await e.query(S.workflow.listTestActions,{applicationId:t,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,P$(r.actions)]}s(Du,"actionsOf");async function F$(e,t,n){return n!==void 0?[n]:await LU(e,t)}s(F$,"nodesOf");var hg=class extends C{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let t=await this.caller(),n=await Du(t,this.application,await F$(t,this.application,this.node));return this.print(n,N$,["node","action","label","disabled"]),0}},gg=class extends C{static{s(this,"TestActionsRunCommand")}application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=p.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=p.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=p.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (upload-signed-document)"});async execute(){let t=D$(this.action,this.autoSubmit,_u(this.param??[]).values),n=await this.caller(),r=this.application,i=await F$(n,this.application,this.node),o=C$(await Du(n,r,i),this.action,i);return await n.mutation(S.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...t===void 0?{}:{params:t}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},L$=[hg,gg];var ze=["de","en"];function os(e,t){return ze.every(n=>e[n]===t[n])}s(os,"sameText");function Et(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let t=e;return Object.keys(t).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=t[r];return typeof i!="string"||i.trim()===""})}s(Et,"missingLocales");function wi(e){let t=Et(e);return t!=="not-localized"&&t.length===0}s(wi,"isLocalizedText");function Ba(e,t){let n={};for(let r of ze){let i=e.map(o=>o[r]);n[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?t(i,r):""}return n}s(Ba,"composeTexts");var sr=/^[a-z][A-Za-z0-9]*$/;function yg(e){return typeof e=="string"&&sr.test(e)}s(yg,"isNodeId");function ss(e,t){yg(e)||N(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${sr.source}.`);let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}s(ss,"makeNodeId");var ki="$env";function se(e){if(e.scope==="env")return`${ki}.${e.key}`;let t=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?t:`${t}.${e.path}`}s(se,"formatAddress");var Tr=/^[a-z][a-zA-Z0-9_]*$/,qU=/^[A-Za-z_][A-Za-z0-9_]*$/;function oo(e){return typeof e=="string"&&e.split(".").every(t=>qU.test(t))}s(oo,"isPath");function Vr(e){if(!e.startsWith("$"))return null;let t=e.slice(1).split("."),[n,...r]=t;switch(n){case"env":{let i=r.join(".");return r.length>0&&oo(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Tr.test(i)?null:M$({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Tr.test(o)||(n==="node"?!sr.test(i):!Tr.test(i))?null:M$({scope:n,owner:i,key:o},a)}default:return null}}s(Vr,"tryParseAddress");function M$(e,t){if(t.length===0)return e;let n=t.join(".");return oo(n)?{...e,path:n}:null}s(M$,"withPath");function be(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=t.scope==="env"?["scope","key"]:t.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(t).some(r=>!n.includes(r))||t.path!==void 0&&!oo(t.path))return!1;switch(t.scope){case"env":return oo(t.key);case"derived":return typeof t.key=="string"&&Tr.test(t.key);case"node":return typeof t.owner=="string"&&sr.test(t.owner)&&typeof t.key=="string"&&Tr.test(t.key);case"task":return typeof t.owner=="string"&&Tr.test(t.owner)&&typeof t.key=="string"&&Tr.test(t.key);default:return!1}}s(be,"isAddress");var Gr={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"}},as=Object.keys(Gr);function ls(e){return Object.hasOwn(Gr,e)}s(ls,"isEnvKey");var KU=["self-service","staff"];function q$(e,t){return{kind:"fixed",values:e,labels:t}}s(q$,"fixedSet");var Fu={of:"applicant.language",withoutValue:"de"},zr={"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:Fu},"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:Fu},"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:Fu},"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:Fu},"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:q$(ze,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:q$(KU,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Lu={types:Gr,fields:zr},Mu=as.flatMap(e=>Object.keys(Gr[e]).map(t=>`${e}.${t}`));function ar(e){return Object.hasOwn(zr,e)}s(ar,"isEnvLeaf");function qu(e){return`${ki}.${e}`}s(qu,"envIdentifier");function so(e){let t=zr[e],[n,r]=e.split("."),i=Gr[n][r];i===void 0&&N(`[env] leaf "${e}" has no type`);let o=t.valueSet;return{leaf:e,type:i,label:t.label,nullable:t.nullable,...t.absent===void 0?{}:{absent:t.absent},...t.nameLanguage===void 0?{}:{nameLanguage:t.nameLanguage},...t.cohortBound===void 0?{}:{cohortBound:t.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&N(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(so,"envLeaf");var K$="staffInput";var jU=["boolean"],Ua=/^[a-z][A-Za-z0-9]*$/;function Ku(e){return e.staffInputs??[]}s(Ku,"staffInputsOf");function ju(e){return`${K$}.${e}`}s(ju,"staffInputLeaf");function j$(e){return`${ki}.${ju(e)}`}s(j$,"staffInputIdentifier");function BU(e){let t=`${K$}.`;return e.startsWith(t)?e.slice(t.length):null}s(BU,"staffInputKeyOfLeaf");function Va(e,t){let n=BU(t);return n===null?void 0:Ku(e).find(r=>r.key===n)}s(Va,"declaredStaffInput");function UU(e){return[...Ku(e).map(t=>({leaf:ju(t.key),type:t.type,label:t.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...Mu.map(t=>{let n=so(t);return{leaf:t,type:n.type,label:n.label,valueSet:zr[t].valueSet,nullable:n.nullable,cohortBound:n.cohortBound===!0}})]}s(UU,"envLeavesFor");function B$(e){return UU(e).filter(t=>!t.cohortBound)}s(B$,"conditionEnvLeaves");function U$(e){let t={},n={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of B$(e)){let[l="",d=""]=r.split(".");t[l]={...t[l]??{},[d]:i},n[r]={valueSet:o,nullable:a}}return{types:t,fields:n}}s(U$,"envConditionSchemaFor");function V$(e){let t=e.staffInputs;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let n=[],r=new Set;return t.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){n.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Ua.test(l.key)||n.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&n.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),jU.includes(l.type)||n.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Et(l.label);c==="not-localized"?n.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&n.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),n}s(V$,"staffInputIssues");var Tg={required:!0,description:"Offer slug (its offerKey)"},wg=class extends C{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=p.String("--offer",Tg);testOnly=p.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let t=await this.caller(),n=await t.query(S.admission.listForAngebot,{client:this.requireTenant(t),offerKey:this.offer}),r=A$(n).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},kg=class extends C{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=p.String("--offer",Tg);async execute(){let t=await this.caller(),n=await t.query(S.admission.getCountsByListForAngebot,{client:this.requireTenant(t),offerKey:this.offer});return this.print(n,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},bg=class extends C{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=p.String({required:!0});async execute(){let t=await this.caller(),n=this.application,r=await t.query(S.admission.get,{applicationId:n});if(r===null)throw new Error(`applications show: no application ${n} (or not visible to you)`);let i=await t.query(S.workflow.getInstance,{applicationId:n});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:n},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},vg=class extends C{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $derived\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=p.String({required:!0});async execute(){let n=await(await this.caller()).query(S.processStoreView.get,{applicationId:this.application});return this.print(T$(n),()=>$$(n),["address","state","holds","producer","written"]),0}},xg=class extends C{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=p.String("--offer",Tg);run=p.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=p.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=p.String("--party",{description:"Applicant party id"});applicant=p.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=p.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=p.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=p.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let t=await this.caller();E$(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let n=this.requireTenant(t),r=S$(await t.query(S.admission.listAdmissionTree,{client:n}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await t.query(S.applicants.partyByEmail,{client:n,email:this.applicant});if(d===null)throw new Error(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await t.mutation(S.admission.staffStartApplicationForParty,{client:n,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:z$(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await t.query(S.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await Du(t,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},Sg=class extends C{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one)"});application=p.String({required:!0});async execute(){return await(await this.caller()).mutation(S.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},n=>[{key:"discarded",value:n.discarded}]),0}},Ag=class extends C{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=p.String({required:!0});async execute(){let n=await(await this.caller()).query(S.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(n,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},Eg=class extends C{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=p.String({required:!0});input=p.String("--input",{required:!0,description:"key=true|false"});reason=p.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let t=await this.caller(),[{key:n,value:r}]=z$([this.input]);return await t.mutation(S.admission.correctStaffInput,{applicationId:this.application,key:n,value:r,reason:this.reason}),this.print({application:this.application,key:n,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},G$=[wg,kg,bg,vg,xg,Sg,Ag,Eg];function z$(e){return e.map(t=>{let[n="",r,...i]=t.split("=");if(!Ua.test(n)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${t}": expected key=true or key=false`);return{key:n,value:r==="true"}})}s(z$,"parseStaffInputs");var Ft="contractGenerator",ao="documentTemplate";function Ga(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return(t.kind==="generator"||t.kind==="package")&&typeof t.key=="string"&&t.key.length>0&&(t.revision===void 0||typeof t.revision=="number"&&Number.isInteger(t.revision)&&t.revision>0)&&n.every(r=>r==="kind"||r==="key"||r==="revision")}s(Ga,"isGeneratorRef");function W$(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(W$,"literalOf");function Wr(e){let t=W$(e,Ft);return Ga(t)?t:null}s(Wr,"generatorRefOfNode");function lr(e){let t=W$(e,ao);return typeof t=="string"&&t.length>0?t:null}s(lr,"documentTemplateKeyOfNode");function H$(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(H$,"generatorRefLabel");var VU=["formExports","generatorStamp"];function Y$(e,t,n){let r=e.inputs?.[Ft];(r?.kind!=="literal"||!Ga(r.value))&&N(`applyGeneratorStamp: the node names no generator in inputs.${Ft} \u2014 a stamp derives from it`),n.freezeRevision&&t.revision!==void 0&&(e.inputs[Ft]={kind:"literal",value:{...r.value,revision:t.revision}}),e.generatorStamp={inputSchema:t.inputSchema,parties:t.parties,schemaDigest:t.schemaDigest,...t.parts===void 0?{}:{parts:t.parts}}}s(Y$,"applyGeneratorStamp");var GU=["reads"];function ds(e){if(e===null||typeof e!="object")return e;let t={...e};return Array.isArray(t.nodes)&&(t.nodes=t.nodes.map(n=>{if(n===null||typeof n!="object")return n;let r={...n};for(let i of VU)delete r[i];for(let i of GU)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),t}s(ds,"comparableWorkflowGraph");var za={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:"Reihenfolge und automatisches Nachr\xFCcken sind die Eing\xE4nge `waitlistOrder` / `autoPromoteOnVacancy` des Wartelistenknotens (Freigabe-Strategie und Stichtag las nichts)",en:"order and automatic promotion are the waitlist node's inputs `waitlistOrder` / `autoPromoteOnVacancy` (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 Bu(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(t=>{let n=za[t];return n!==void 0?`manifest: \`${t}\` is no longer part of manifest.json (${n.en}). Delete the line.`:`manifest: unknown key \`${t}\` \u2014 manifest.json carries no key.`})}s(Bu,"manifestIssues");function zU(e){let t=[],n=e.buses;if(!Array.isArray(n))return t;let r=n.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return t;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";t.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return t}s(zU,"validateProgressLayoutExternalCopy");function J$(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let t=e.buses;return!Array.isArray(t)||!t.some(n=>!!n&&typeof n=="object"&&n.key==="process")?["progressLayout: the layout must declare the `process` bus"]:zU(e)}s(J$,"progressLayoutIssues");var Q$=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var WU=new Set(["sections","effects","outcomes","testScenarios","env"]),Uu={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 Z$(e,t){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${t}: die Formulardefinition muss ein Objekt sein.`,en:`${t}: the form definition must be an object.`}];let n=[];for(let i of Object.keys(e)){if(WU.has(i))continue;let o=Uu[i];n.push(o!==void 0?{de:`${t}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${t}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${t}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${t}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||n.push({de:`${t}: \`${i}\` muss eine Liste sein.`,en:`${t}: \`${i}\` must be a list.`});return n}s(Z$,"smartFormDefinitionShapeIssues");var wn=["granted","rejected","waitlisted","other"];function bi(e){return typeof e=="string"&&wn.includes(e)}s(bi,"isOutcomeSemantic");var Gn=["arrival","manual"],eR={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function X$(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(X$,"literal");function $g(e){let t=X$(e,"waitlistOrder"),n=X$(e,"autoPromoteOnVacancy");return!Gn.includes(t)||typeof n!="boolean"?null:{waitlistOrder:t,autoPromoteOnVacancy:n}}s($g,"waitlistPolicyOrNull");var ht="responsible",Rg="team:";function Vu(e){return`${Rg}${e}`}s(Vu,"teamSlot");function Gu(e){return e.startsWith(Rg)?e.slice(Rg.length):null}s(Gu,"teamKeyOfSlot");function tR(e){return e.kind==="responsible"?ht:Vu(e.groupKey)}s(tR,"slotIdOf");function zu(e){if(e===ht)return{kind:"responsible"};let t=Gu(e);return t===null||t.length===0?null:{kind:"team",groupKey:t}}s(zu,"slotOfId");var Ig="review",Og="checkField",nR="reviewed",rR="reviewing",Wu=["rejected","waitlisted"];function Pg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Pg,"isObject");var HU=new Set(["decision",Ig]),iR={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function _g(e){return Object.hasOwn(iR,e)?iR[e]:void 0}s(_g,"legacySemanticOfId");function YU(e){return e===Ig?wn.filter(t=>!Wu.includes(t)):wn}s(YU,"allowedSemanticsFor");var JU="other";function oR(e){return Pg(e)&&HU.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(oR,"outcomesOf");function sR(e){return(e?.nodes??[]).some(t=>oR(t).some(n=>Pg(n)&&!("semantic"in n)))}s(sR,"needsOutcomeSemantics");function aR(e,t={}){let n=[],r=[],i=[],o=e.nodes.map(a=>{let l=oR(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),f=YU(u),m=!1,y=l.map(k=>{if(!Pg(k))return k;let g=String(k.id);if("semantic"in k)return bi(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let v=`${c}.${g}`,$=Object.hasOwn(t,v)?t[v]:void 0;if($!==void 0)return f.includes($)?(n.push({nodeId:c,outcomeId:g,semantic:$,source:"answer"}),m=!0,{...k,semantic:$}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f,answer:$}),k);let R=_g(g),A=R??JU;return f.includes(A)?(n.push({nodeId:c,outcomeId:g,semantic:A,source:R===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f}),k)});return m?{...d,outcomes:y}:a});return n.length===0?{graph:e,written:n,refused:r,invalid:i}:{graph:{...e,nodes:o},written:n,refused:r,invalid:i}}s(aR,"addOutcomeSemantics");var dr="bewerbungOffen";function lo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(lo,"isObject");var Ng=["event","effect"];function lR(e){return lo(e)&&e.type==="eventTrigger"}s(lR,"isTrigger");function dR(e){let t=lo(e.inputs)?e.inputs:{};return"outcomes"in e||Ng.some(n=>n in e||n in t)}s(dR,"oldShape");function cR(e){return(e?.nodes??[]).some(t=>lR(t)&&dR(t))}s(cR,"needsEventTriggerStartMove");function QU(e){let t=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>lo(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===dr))return{unmoved:{nodeId:t,reason:"outcomesNotStart"}};let i=Object.keys(lo(e.next)?e.next:{});if(!(i.length===1&&i[0]===dr))return{unmoved:{nodeId:t,reason:"nextNotStart"}};let o=lo(e.inputs)?{...e.inputs}:{};for(let l of Ng){let d=o[l];if(lo(d)&&d.kind==="binding")return{unmoved:{nodeId:t,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Ng)delete a[l],delete o[l];return lo(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(QU,"moveNode");function uR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!lR(i)||!dR(i))return i;let o=QU(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(uR,"moveEventTriggerStart");function Wa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Wa,"isObject");var Cg={waitlistOrder:"arrival",autoPromoteOnVacancy:!1};function fR(e){if(!Wa(e)||e.type!=="waitlist")return!1;let t=Wa(e.inputs)?e.inputs:{};return!("waitlistOrder"in t)||!("autoPromoteOnVacancy"in t)}s(fR,"lacksPolicy");function ZU(e){return(e?.nodes??[]).some(fR)}s(ZU,"needsWaitlistPolicyMove");function Dg(e){return Wa(e)&&Gn.includes(e.waitlistOrder)&&typeof e.autoPromoteOnVacancy=="boolean"}s(Dg,"isWaitlistPolicy");function XU(e){if(e===void 0)return{policy:Cg,stated:!1};if(!Wa(e))return"malformed";let t=e.waitlistOrder,n=e.autoPromoteOnVacancy;return t!==void 0&&!Gn.includes(t)||n!==void 0&&typeof n!="boolean"?"malformed":{policy:{waitlistOrder:t??Cg.waitlistOrder,autoPromoteOnVacancy:n??Cg.autoPromoteOnVacancy},stated:t!==void 0&&n!==void 0}}s(XU,"policyOfSelection");function pR(e,t,n={}){let r=[],i=[];if(!ZU(e))return{graph:e,moved:r,refused:i};let o=XU(t),a=e.nodes.map(l=>{if(!fR(l))return l;let d=l,c=String(d.id),u=Wa(d.inputs)?{...d.inputs}:{};if("waitlistOrder"in u||"autoPromoteOnVacancy"in u)return i.push({nodeId:c,reason:"inputExists"}),l;let f=Object.hasOwn(n,c)?n[c]:void 0,m,y;if(f!==void 0)m=f,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},u.autoPromoteOnVacancy={kind:"literal",value:m.autoPromoteOnVacancy},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(pR,"moveWaitlistPolicyToInputs");function co(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(co,"isObject");var eV=[Ft,ao],tV=["inputSchema","parties","schemaDigest","parts"];function mR(e){return co(e)&&e.type==="governedDocument"&&("resolver"in e||co(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(mR,"oldShape");function hR(e){return(e?.nodes??[]).some(mR)}s(hR,"needsGeneratorInputMove");function nV(e){let t=co(e.inputs)?{...e.inputs}:{},n={...e},r;if("resolver"in e){let i=e.resolver;if(!co(i))return{unmoved:"resolverNotObject"};if(Ft in t)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((co(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>co(d)&&eV.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};t[Ft]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(tV.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(n.generatorStamp=l),r=i.cockpitFields,delete n.resolver}if(co(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ao in t)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};t[ao]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}n.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};n.cockpitFields=r}return n.inputs=t,{node:n}}s(nV,"moveNode");function gR(e){let t=[],n=[],r=e.nodes.map(i=>{if(!mR(i))return i;let o=nV(i);return"unmoved"in o?(n.push({nodeId:String(i.id),reason:o.unmoved}),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(gR,"moveGeneratorPinsToInputs");var yR=/^\d{4}-\d{2}-\d{2}$/;function cr(e,t){return{de:e,en:t}}s(cr,"issue");function uo(e){if(typeof e!="object"||e===null)return cr("keine Reduktion","not a reduction");let t=e;if(t.kind==="none")return Object.keys(t).length===1?null:cr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(t.kind!=="amount")return cr(`unbekannte Art ${JSON.stringify(t.kind)}`,`unknown kind ${JSON.stringify(t.kind)}`);let{amount:n,activeFrom:r,activeTo:i}=t;return typeof n!="number"||!Number.isFinite(n)||n<=0?cr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((n*100).toFixed(6)))?typeof r!="string"||!yR.test(r)?cr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!yR.test(i)?cr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?cr("das Ende liegt vor dem Beginn","the end is before the start"):t.floorTotal!==void 0&&(typeof t.floorTotal!="number"||!Number.isSafeInteger(t.floorTotal)||t.floorTotal<0)?cr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):t.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(t.pricePeriod))?cr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(t).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?cr("unbekannte Angaben","unknown details"):null:cr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(uo,"reductionShapeIssue");function vi(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.itemKey=="string"&&t.itemKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||uo(t.reduction)===null&&t.reduction.kind==="amount")}s(vi,"isPricedItemValue");var cs=["freetext","recommendation","choice","pricedItem","record","reduction"],us=[...cs,"appointment"];function kR(e){return typeof e=="string"&&us.includes(e)}s(kR,"isTaskResultKind");function xi(e){return typeof e=="string"&&cs.includes(e)}s(xi,"isRecordedTaskResultKind");function fs(e){return xi(e.kind)}s(fs,"isRecordedTaskResult");var Hu=["number","boolean","enum"];function Fg(e){return typeof e=="string"&&Hu.includes(e)}s(Fg,"isRecordFieldType");var Lg=["form","siblingRank"];var Hr={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 fo(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(fo,"isProseResult");function Yu(e){return e.kind==="record"?(e.fields??[]).filter(t=>typeof t.writes=="string"&&t.writes.length>0&&Fg(t.type)).map(t=>({key:t.writes,valueType:t.type,field:t})):rV(e)}s(Yu,"draftResultStoreWrites");function rV(e){let t=Hr[e.kind].valueType;return e.writes===void 0||t===null?[]:[{key:e.writes,valueType:t}]}s(rV,"singleStoreWrite");var wR="team:";function ps(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(wR)){let t=e.slice(wR.length);return t.length===0?null:{kind:"team",groupKey:t}}return{kind:"channel",channelKey:e}}s(ps,"parseTaskResultChat");var He={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",filesOnKind:"[taskResult/filesOnKind]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var iV=new Set(["if","else","in","true","false","null"]),oV=new Set(["==","!=","<=",">=","&&","||"]);function sV(e){return e>="0"&&e<="9"}s(sV,"isDigit");function aV(e){return/[a-zA-Z_$]/.test(e)}s(aV,"isIdentStart");function lV(e){return/[a-zA-Z0-9_.$]/.test(e)}s(lV,"isIdentCont");function dV(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(r===" "||r===" "||r===`
9817
9817
  `||r==="\r"){n++;continue}if(r==="'"){let o=n+1,a="";for(;o<e.length&&e.charAt(o)!=="'";)e.charAt(o)==="\\"&&o+1<e.length?(a+=e.charAt(o+1),o+=2):(a+=e.charAt(o),o++);o>=e.length&&N(`Unterminated string at ${n}`),t.push({t:"str",v:a}),n=o+1;continue}if(sV(r)){let o=n;for(;o<e.length&&/[0-9.]/.test(e.charAt(o));)o++;t.push({t:"num",v:Number(e.slice(n,o))}),n=o;continue}if(aV(r)){let o=n;for(;o<e.length&&lV(e.charAt(o));)o++;let a=e.slice(n,o);iV.has(a)?t.push({t:"kw",v:a}):t.push({t:"ident",v:a}),n=o;continue}let i=e.slice(n,n+2);if(oV.has(i)){t.push({t:"op",v:i}),n+=2;continue}if("<>!".includes(r)){t.push({t:"op",v:r}),n++;continue}if("()[],".includes(r)){t.push({t:"punct",v:r}),n++;continue}N(`Unexpected char '${r}' at ${n}`)}return t}s(dV,"tokenise");var bR=1e4,vR=128;function ms(e){e.depth++,e.depth>vR&&N(`Expression nesting too deep (> ${vR})`)}s(ms,"enterDepth");function $R(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s($R,"peek");function Lt(e){let t=e.tokens[e.pos];return t||N(`Unexpected end at ${e.pos}`),e.pos++,t}s(Lt,"take");function Mt(e,t,n){let r=$R(e);return!(!r||r.t!==t||n!==void 0&&r.v!==n)}s(Mt,"match");function po(e,t,n){return Mt(e,t,n)||N(`Expected ${t}${n?`:${n}`:""} at ${e.pos}`),Lt(e)}s(po,"expect");function Jr(e){ms(e);try{return Mt(e,"kw","if")?cV(e):uV(e)}finally{e.depth--}}s(Jr,"parseExpr");function cV(e){po(e,"kw","if"),po(e,"punct","(");let t=Jr(e);po(e,"punct",")");let n=Jr(e);po(e,"kw","else");let r=Jr(e);return{kind:"if",cond:t,then:n,else:r}}s(cV,"parseIf");function uV(e){let t=xR(e),n=0;try{for(;Mt(e,"op","||");){Lt(e),ms(e),n++;let r=xR(e);t={kind:"binary",op:"||",left:t,right:r}}}finally{e.depth-=n}return t}s(uV,"parseLogicOr");function xR(e){let t=SR(e),n=0;try{for(;Mt(e,"op","&&");){Lt(e),ms(e),n++;let r=SR(e);t={kind:"binary",op:"&&",left:t,right:r}}}finally{e.depth-=n}return t}s(xR,"parseLogicAnd");function SR(e){let t=AR(e),n=0;try{for(;Mt(e,"op","==")||Mt(e,"op","!=");){let r=Lt(e).v;ms(e),n++;let i=AR(e);t={kind:"binary",op:r,left:t,right:i}}}finally{e.depth-=n}return t}s(SR,"parseEquality");function AR(e){let t=qg(e),n=0;try{for(;Mt(e,"op","<")||Mt(e,"op","<=")||Mt(e,"op",">")||Mt(e,"op",">=")||Mt(e,"kw","in");){let r=Lt(e),i=r.t==="kw"?"in":r.v;ms(e),n++;let o=qg(e);t={kind:"binary",op:i,left:t,right:o}}}finally{e.depth-=n}return t}s(AR,"parseCompare");function qg(e){if(Mt(e,"op","!")){Lt(e),ms(e);try{return{kind:"unary",op:"!",operand:qg(e)}}finally{e.depth--}}return fV(e)}s(qg,"parseUnary");function fV(e){let t=$R(e);if(t||N("Unexpected end"),t.t==="num")return Lt(e),{kind:"num",value:t.v};if(t.t==="str")return Lt(e),{kind:"str",value:t.v};if(t.t==="kw"&&t.v==="true")return Lt(e),{kind:"bool",value:!0};if(t.t==="kw"&&t.v==="false")return Lt(e),{kind:"bool",value:!1};if(t.t==="kw"&&t.v==="null")return Lt(e),{kind:"null"};if(t.t==="punct"&&t.v==="("){Lt(e);let n=Jr(e);return po(e,"punct",")"),n}if(t.t==="punct"&&t.v==="["){Lt(e);let n=[];if(!Mt(e,"punct","]"))for(n.push(Jr(e));Mt(e,"punct",",");)Lt(e),n.push(Jr(e));return po(e,"punct","]"),{kind:"arr",items:n}}if(t.t==="ident"){let n=t.v;if(Lt(e),Mt(e,"punct","(")){Lt(e);let r=[];if(!Mt(e,"punct",")"))for(r.push(Jr(e));Mt(e,"punct",",");)Lt(e),r.push(Jr(e));return po(e,"punct",")"),{kind:"call",name:n,args:r}}return{kind:"ident",path:n}}N(`Unexpected token at ${e.pos}`)}s(fV,"parsePrimary");function qt(e){e.length>bR&&N(`Expression too long (${e.length} > ${bR})`);let t={tokens:dV(e),pos:0,depth:0},n=Jr(t);return t.pos<t.tokens.length&&N(`Unexpected trailing token at ${t.pos}`),n}s(qt,"parseExpression");var pV=new Map([["today",()=>new Date().toISOString().slice(0,10)],["years_between",(e,t)=>{if(typeof e!="string"||typeof t!="string")return null;let n=new Date(e),r=new Date(t);if(isNaN(n.getTime())||isNaN(r.getTime()))return null;let i=r.getFullYear()-n.getFullYear(),o=r.getMonth()-n.getMonth();return(o<0||o===0&&r.getDate()<n.getDate())&&i--,i}],["length",e=>typeof e=="string"||Array.isArray(e)?e.length:0]]);function gt(e,t){switch(e.kind){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"null":return null;case"ident":{let n=Object.hasOwn(t.values,e.path)?t.values[e.path]:void 0;return n===void 0?null:n}case"arr":return e.items.map(n=>gt(n,t));case"unary":{let n=gt(e.operand,t);return!Si(n)}case"call":{let n=t.functions!==void 0&&Object.hasOwn(t.functions,e.name)?t.functions[e.name]:pV.get(e.name);n||N(`Unknown function '${e.name}'`);let r=e.args.map(i=>gt(i,t));return n(...r)}case"binary":return mV(e.op,e.left,e.right,t);case"if":return Si(gt(e.cond,t))?gt(e.then,t):gt(e.else,t)}}s(gt,"evaluate");function mV(e,t,n,r){if(e==="&&"){let a=gt(t,r);return Si(a)?Si(gt(n,r)):!1}if(e==="||"){let a=gt(t,r);return Si(a)?!0:Si(gt(n,r))}let i=gt(t,r),o=gt(n,r);switch(e){case"==":return Mg(i,o);case"!=":return!Mg(i,o);case"<":{let[a,l]=Ju(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=Ju(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=Ju(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=Ju(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>Mg(a,i)):!1}}s(mV,"evalBinary");function Ju(e,t){return[ER(e),ER(t)]}s(Ju,"orderedOperands");function ER(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"){if(e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}return null}s(ER,"numericOperand");function Mg(e,t){return e===t?!0:e==null||t==null?!1:typeof e=="number"&&typeof t=="string"?e===Number(t):typeof e=="string"&&typeof t=="number"?Number(e)===t:!1}s(Mg,"looseEq");function Si(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(Si,"truthy");function kt(e){let t=new Set;return Yr(e,t),[...t]}s(kt,"dependencies");function Yr(e,t){switch(e.kind){case"ident":t.add(e.path);return;case"call":e.args.forEach(n=>Yr(n,t));return;case"arr":e.items.forEach(n=>Yr(n,t));return;case"unary":Yr(e.operand,t);return;case"binary":Yr(e.left,t),Yr(e.right,t);return;case"if":Yr(e.cond,t),Yr(e.then,t),Yr(e.else,t);return;default:return}}s(Yr,"walk");var TR=new Map;function ur(e){let t=TR.get(e);return t||(t=qt(e),TR.set(e,t)),t}s(ur,"parseCached");function hV(e,t){return gt(ur(e),t)}s(hV,"evalExpression");function RR(e,t){return Si(hV(e,t))}s(RR,"evalBoolean");function Qu(e){let t=e.pricingRules;return t===void 0?[]:(Array.isArray(t)||N("graph.pricingRules must be an array \u2014 the graph validator refuses anything else"),t)}s(Qu,"pricingRuleSets");function Kg(e){return e.derive!==void 0}s(Kg,"isDerivedKey");function gV(e,t){let n=Qu(e);return(t.rules??[]).map(r=>{let i=n.find(o=>o.key===r);return i===void 0&&N(`[process] derivation names the unknown rule set "${r}" \u2014 publish refuses that`),i})}s(gV,"ruleSetsOfDerivation");function OR(e){return[...new Set(e.rows.flatMap(t=>kt(ur(t.when))))]}s(OR,"ruleSetDependencies");function PR(e){let t=Vr(e);return t!==null&&se(t)===e?t:null}s(PR,"ruleIdentifierAddress");function jg(e,t){let r=[...new Set(gV(e,t).flatMap(OR))].map(o=>{let a=PR(o);return a===null&&N(`[address/bareIdentifier] rule identifier "${o}" is no address \u2014 publish refuses that`),{address:a,id:o,role:"rule"}}),i=t.reduction;return i===void 0?r:(be(i)||N(`[address/bareIdentifier] derive.reduction ${JSON.stringify(i)} is no address \u2014 publish refuses that`),[...r,{address:i,id:se(i),role:"reduction"}])}s(jg,"derivationSources");function _R(e,t){let n=Qu(e);for(let r of t.rules??[]){let i=n.find(o=>o.key===r);if(i===void 0||i.rows.some(o=>Ha(o.when)!==null)||OR(i).some(o=>PR(o)===null))return null}return t.reduction!==void 0&&!be(t.reduction)?null:jg(e,t)}s(_R,"draftDerivationSources");function Ha(e){if(typeof e!="string"||e.trim().length===0)return"leere Bedingung";try{return ur(e),null}catch(t){return t instanceof Error?t.message:String(t)}}s(Ha,"conditionIssue");function IR(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(IR,"rowTarget");function Bg(e){if(e.byStage===void 0){let t=IR(e);return t===null?[]:[{...t,stages:null}]}return e.item!==void 0||e.group!==void 0?[]:e.byStage.flatMap(t=>{let n=IR(t);return n===null?[]:[{...n,stages:t.stages}]})}s(Bg,"derivationTargets");function NR(e,t){t!==null&&(typeof t=="object"||typeof t=="function")&&Object.hasOwn(t,"exports")&&N(`[workflow/registry] node type "${e}": custom spec.exports is unsupported; use artifact-slot exports.`)}s(NR,"assertNoCustomNodeExports");var Ug=null;function CR(e){for(let[t,n]of Object.entries(e))NR(t,n);Ug=e}s(CR,"setSpecs");function DR(){return Ug||N("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),Ug}s(DR,"requireSpecs");function Ye(e){let t=DR(),n=t[e.type];return n===void 0&&ce("INVALID",{de:`[workflow/registry] Unbekannter Knotentyp "${String(e.type)}" (Knoten "${String(e.id)}"). Registrierte Typen: ${Object.keys(t).sort().join(", ")}.`,en:`[workflow/registry] Unknown node type "${String(e.type)}" (node "${String(e.id)}"). Registered types: ${Object.keys(t).sort().join(", ")}.`}),n}s(Ye,"specFor");function FR(){return Object.keys(DR()).sort()}s(FR,"registeredNodeTypes");var LR=Mu.filter(e=>zr[e].cohortBound!==!0);function Vg(e){return ar(e)&&zr[e].cohortBound!==!0}s(Vg,"isEnvAddressLeaf");function Gg(e){return so(e).type}s(Gg,"envType");function zg(e){return so(e).label}s(zg,"envLabel");function Zu(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(Zu,"addressBase");function hs(e){return e.scope==="node"&&e.key===tn&&e.path===void 0}s(hs,"isInstanceAddress");function at(e){return be(e)&&e.scope==="node"&&e.key===tn&&e.path!==void 0}s(at,"isFormFieldAddress");function MR(e){return at(e)?{owner:e.owner,path:e.path}:null}s(MR,"formFieldOf");function Wg(e){return kt(ur(e)).map(t=>{if(!t.startsWith("$"))return{identifier:t,address:null,reason:"bareIdentifier"};let n=Vr(t);return n===null?{identifier:t,address:null,reason:"shape"}:{identifier:t,address:n}})}s(Wg,"expressionAddresses");var tn="admission",Za="document",gs="contract",ys="contracts",qR="payment",Hg=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var ln={id:"identity",type:"identity",label:"display",sublabel:"display",library:"display",outcomes:"control",outputLabels:"display",inputs:"input",next:"control",tasks:"config",assign:"reference",optionalActions:"config",artifacts:"config",notifications:"config"},Ese={join:{...ln},end:{...ln},eventTrigger:{...ln},form:{...ln,adoptForm:"address",formExports:"stamp"},roleAssign:{...ln},setFlag:{...ln},if:{...ln,condition:"address"},countersign:{...ln,contract:"address",titles:"display",signing:"config"},engagePush:{...ln,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...ln,commentRequired:"config",decisionAsTask:"config",reads:"address",requiresOneOf:"config"},review:{...ln,reads:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...ln},completenessCheck:{...ln,requires:"address",deadline:"config"},collectPayment:{...ln},governedDocument:{...ln,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 $r(e){return Array.isArray(e)?e:[]}s($r,"listOf");function Kt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(Kt,"record");function KR(e){switch(e.type){case"countersign":return["contract"];case"engagePush":return["form","contract","payment"];case"governedDocument":return e.production==="resolver"?["form"]:[];default:return[]}}s(KR,"dataSourceFieldsOf");function jR(e){return e.type==="engagePush"?["form"]:KR(e)}s(jR,"requiredDataSourceFields");var yV={setFlag:{target:"setFlagTarget"}};function Xa(e,t={}){let n=[],r=e,i=`nodes.${e.id}`,o=s((d,c,u,f={})=>{n.push({kind:d,at:c,nodeId:e.id,value:u,judgedTogether:null,...f})},"field"),a=new Map(t.slotTypes===!1?[]:(Ye(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=yV[e.type]??{};for(let[d,c]of Object.entries(Kt(r.inputs)??{})){let u=Kt(c);if(u?.kind!=="binding")continue;let f="address"in u?u.address:u.path,m=l[d];if(m!==void 0){o(m,`${i}.inputs.${d}`,f);continue}let y=a.get(d);o("binding",`${i}.inputs.${d}`,f,y!==void 0?{expectedType:y}:{})}for(let[d,c]of $r(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of $r(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 KR(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 $r(r.tasks).entries())n.push(...BR(e.id,c,d));return n}s(Xa,"nodeAddressFields");function BR(e,t,n){let r=Kt(t);if(r===null)return[];let i=[],o=typeof r.key=="string"?r.key:String(n),a=`nodes.${e}.tasks.${o}`,l=s((f,m,y,k={})=>{i.push({kind:f,at:m,nodeId:e,taskKey:o,value:y,judgedTogether:null,...k})},"field"),d=`${a}.evidence`;r.when!==void 0&&l("taskWhen",`${a}.when`,r.when,{expectedType:"boolean",judgedTogether:d});for(let[f,m]of $r(r.reads).entries())l("taskReads",`${a}.reads.${f}`,m,{judgedTogether:d});for(let[f,m]of $r(r.documents).entries()){let y=Kt(m);y===null||y.kind==="artifact"||l("taskDocument",`${a}.documents.${f}`,"address"in y?y.address:y.key)}let c=Kt(r.familyRequest);if(c!==null){for(let[f,m]of $r(c.fields).entries())l("familyRequestFields",`${a}.familyRequest.fields.${f}`,m,{judgedTogether:`${a}.familyRequest.fields`});c.from!==void 0&&l("familyRequestFrom",`${a}.familyRequest.from`,c.from)}let u=Kt(r.result);if(u?.kind==="record")for(let[f,m]of $r(u.fields).entries()){let y=Kt(Kt(m)?.suggest);if(y?.kind!=="form")continue;let k=Kt(m)?.type;l("suggest",`${a}.result.fields.${f}.suggest`,"address"in y?y.address:y.key,typeof k=="string"?{expectedType:k}:{})}return i}s(BR,"taskAddressFields");function Xu(e){let t=[];for(let[n,r]of $r(e.processStore).entries()){let i=Kt(Kt(r)?.derive);if(i?.reduction!==void 0){let o=String(Kt(r)?.key);t.push({kind:"reduction",at:`processStore.${n}.derive.reduction`,nodeId:null,priceKey:o,value:i.reduction,judgedTogether:null})}}for(let[n,r]of $r(e.pricingRules).entries())for(let[i,o]of $r(Kt(r)?.rows).entries())t.push({kind:"pricingRule",at:`pricingRules.${n}.rows.${i}.when`,nodeId:null,value:Kt(o)?.when,judgedTogether:null});return t}s(Xu,"priceAddressFields");function ws(e){return Yg(e)?(ef(e.value)??[]).flatMap(t=>t.address===null?[]:[t.address]):be(e.value)?[e.value]:[]}s(ws,"addressesInField");function Yg(e){return e.kind==="pricingRule"||e.kind==="condition"}s(Yg,"isExpressionField");function ef(e){return Ha(e)===null?Wg(e):null}s(ef,"ruleConditionAddresses");function kn(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(kn,"adoptsForm");function UR(e){if(e.type!=="form"||kn({type:e.type,adoptForm:e.adoptForm}))return;let t=e.inputs?.smartForm;return t?.kind==="literal"&&typeof t.value=="string"&&t.value!==""?t.value:void 0}s(UR,"createdSmartFormSlug");function wV(e,t){return e.type!=="governedDocument"||e.production!=="resolver"||t!==Za?t:e.generatorStamp?.parts!==void 0?ys:gs}s(wV,"addressKeyOfPort");function Jg(e){let t=e.result;return t===void 0||!fs(t)?[]:Yu(t).map(n=>n.key)}s(Jg,"storeWritesOf");function Ja(e,t){return(Array.isArray(e.processStore)?e.processStore:[]).find(n=>n.key===t)}s(Ja,"declaredKey");function Rr(e,t){let n=[];if(!kn(t))for(let r of Ye(t).outputs?.(t)??[])n.push({address:{scope:"node",owner:t.id,key:wV(t,r.name)},type:r.type,...r.label!==void 0?{label:r.label}:{},nodeId:t.id,nodePort:r});for(let r of Array.isArray(t.tasks)?t.tasks:[])for(let i of Jg(r)){let o=Ja(e,i);n.push({address:{scope:"task",owner:r.key,key:i},type:o?.type??"unknown",...o!==void 0?{label:o.label}:{},nodeId:t.id})}return n}s(Rr,"producedAddresses");function VR(e,t,n){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===t&&Jg(i).includes(n))return{nodeId:r.id,template:i};return null}s(VR,"taskWriter");function Ir(e,t,n){return VR(e,t,n)?.nodeId??null}s(Ir,"taskOwnerNode");function Qa(e,t){let n=Ja(e,t)?.derive;if(n===void 0)return null;let r=Array.isArray(e.pricingRules)?e.pricingRules:[],i=[];for(let a of n.rules??[]){let l=r.find(d=>d.key===a);if(l===void 0)return null;for(let d of l.rows){let c=ef(d.when);if(c===null)return null;for(let u of c)u.address!==null&&i.push(u.address)}}let o=n.reduction;return be(o)&&i.push(o),kV(i)}s(Qa,"derivedSources");function kV(e){let t=new Set;return e.filter(n=>{let r=se(n);return t.has(r)?!1:(t.add(r),!0)})}s(kV,"dedupe");function bV(e){return Xa(e,{slotTypes:!1}).flatMap(t=>ws(t).map(n=>({address:n,field:t})))}s(bV,"writtenAddressesOf");function mo(e,t){let n=[],r=new Set,i=s((l,d,c,u)=>{let f=`${se(l)}|${d}|${c.at}|${u===void 0?"":se(u)}`;r.has(f)||(r.add(f),n.push({address:l,origin:d,field:c,...u!==void 0?{via:u}:{}}))},"push"),o=s((l,d,c=new Set)=>{let u=se(l);if(!c.has(u)){if(c.add(u),l.scope==="task"){let f=VR(e,l.owner,l.key);if(f===null)return;for(let m of BR(f.nodeId,f.template))if(!(m.kind!=="taskWhen"&&m.kind!=="taskReads"))for(let y of ws(m))i(y,"evidence",d,l)}if(l.scope==="derived")for(let f of Qa(e,l.key)??[])i(f,"derivedSource",d,l),o(f,d,c)}},"carried");for(let{address:l,field:d}of bV(t))i(l,"written",d),o(l,d);let a=new Set((Array.isArray(t.tasks)?t.tasks:[]).flatMap(l=>Jg(l).map(d=>`${l.key}.${d}`)));for(let l of Xu(e))if(!(l.kind!=="reduction"||!be(l.value)||l.value.scope!=="task")&&a.has(`${l.value.owner}.${l.value.key}`))for(let d of Qa(e,l.priceKey)??[])d.scope==="task"&&a.has(`${d.owner}.${d.key}`)||(i(d,"priceCheck",l,{scope:"derived",key:l.priceKey}),o(d,l));return n}s(mo,"addressReadsOf");function Qg(e,t){switch(t.scope){case"env":return ar(t.key)?Gg(t.key):Va(e,t.key)?.type;case"derived":case"task":{if(t.path!==void 0||t.scope==="task"&&Ir(e,t.owner,t.key)===null)return;let n=Ja(e,t.key);return n===void 0||t.scope==="derived"!=(n.derive!==void 0)?void 0:n.type}case"node":{let n=e.nodes.find(i=>i.id===t.owner);if(n===void 0)return;let r=Rr(e,n).find(i=>i.address.scope==="node"&&i.address.key===t.key);return r===void 0?void 0:t.path===void 0?r.type:r.nodePort?.schema?.find(i=>i.key===t.path)?.type}}}s(Qg,"addressType");function Ya(e,t){let n=Kt(e)?.[t];return typeof n=="string"&&n.length>0?n:void 0}s(Ya,"labelText");function Oe(e,t,n){let r=e.nodes.find(i=>i.id===t);return Ya(r?.label,n)??t}s(Oe,"nodeDisplayName");function ho(e,t,n){for(let r of e.nodes){let i=(Array.isArray(r.tasks)?r.tasks:[]).find(o=>o.key===t);if(i!==void 0)return Ya(i.title,n)??t}return t}s(ho,"taskDisplayName");function Be(e,t,n){let r=[];switch(t.scope){case"env":r.push(ar(t.key)?zg(t.key)[n]:Va(e,t.key)?.label[n]??t.key);break;case"derived":r.push(Ya(Ja(e,t.key)?.label,n)??t.key);break;case"task":r.push(ho(e,t.owner,n),Ya(Ja(e,t.key)?.label,n)??t.key);break;case"node":{r.push(Oe(e,t.owner,n));let i=e.nodes.find(a=>a.id===t.owner),o=i===void 0?void 0:Rr(e,i).find(a=>a.address.scope==="node"&&a.address.key===t.key);r.push(Ya(o?.label,n)??t.key);break}}return t.scope!=="env"&&t.path!==void 0&&r.push(t.path),`${r.join(" \u203A ")} (${se(t)})`}s(Be,"displayAddress");var el=["beneficiary","signers"];function GR(e,t){return Array.isArray(e.artifacts)&&e.artifacts.some(n=>n?.key===t)}s(GR,"ownsSlot");function tl(e){let t=[];for(let[n,r]of Object.entries(Kt(e.inputs)??{})){let i=Kt(r);i?.kind==="binding"&&be(i.address)&&t.push({slot:n,address:i.address})}return t}s(tl,"bindingAddresses");function zR(e,t){return tl(e).find(n=>n.slot===t)?.address??null}s(zR,"bindingAddressAt");function WR(e,t){let n=s(i=>i.scope==="node"&&i.owner===t||i.scope==="task"&&Ir(e,i.owner,i.key)===t,"names");return[...e.nodes.filter(i=>i.id!==t).flatMap(i=>Xa(i,{slotTypes:!1})),...Xu(e)].flatMap(i=>ws(i).filter(n).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(WR,"addressesNaming");var Tt={target:"target",flagKey:"flagKey",value:"value"};function vV(e){return zR(e,Tt.target)}s(vV,"setFlagTarget");function HR(e){let t=vV(e);return t!==null&&hs(t)?t.owner:null}s(HR,"setFlagTargetOwner");function tf(e){let t=e.inputs?.[Tt.flagKey];return t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0?t.value:null}s(tf,"setFlagKey");function YR(e){let t=e.inputs?.[Tt.value];if(t===void 0||t.kind==="unset")return!0;if(t.kind==="literal"&&typeof t.value=="boolean")return t.value;N(`[setFlag/valueType] setFlag node "${String(e.id)}": \`${Tt.value}\` is no yes/no literal \u2014 publish refuses that`)}s(YR,"setFlagValue");function JR(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(JR,"isObject");var QR=["target","flagKey","value"];function ZR(e){return JR(e)&&e.type==="setFlag"&&QR.some(t=>t in e)}s(ZR,"oldShape");function XR(e){return(e?.nodes??[]).some(ZR)}s(XR,"needsSetFlagInputMove");function xV(e){let t=JR(e.inputs)?{...e.inputs}:{};if(QR.some(a=>a in e&&Tt[a]in t))return{unmoved:"inputExists"};if("target"in e&&!be(e.target))return{unmoved:"targetNotAddress"};if("flagKey"in e&&typeof e.flagKey!="string")return{unmoved:"flagKeyNotString"};if("value"in e&&typeof e.value!="boolean")return{unmoved:"valueNotBoolean"};let{target:n,flagKey:r,value:i,...o}=e;return n!==void 0&&(t[Tt.target]={kind:"binding",address:n}),typeof r=="string"&&r.length>0&&(t[Tt.flagKey]={kind:"literal",value:r}),i!==void 0&&(t[Tt.value]={kind:"literal",value:i}),{node:{...o,inputs:t}}}s(xV,"moveNode");function eI(e){let t=[],n=[],r=e.nodes.map(i=>{if(!ZR(i))return i;let o=xV(i);return"unmoved"in o?(n.push({nodeId:String(i.id),reason:o.unmoved}),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(eI,"moveSetFlagConfigToInputs");function tI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(tI,"isObject");var Zg={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},Xg={review:["allowSkipInTest"]};function nI(e){return Zg[String(e)]??{}}s(nI,"movesOf");function rI(e){return Xg[String(e)]??[]}s(rI,"deadOf");function iI(e){return tI(e)&&[...Object.keys(nI(e.type)),...rI(e.type)].some(t=>t in e)}s(iI,"oldShape");function oI(e){return(e?.nodes??[]).some(iI)}s(oI,"needsScalarInputMove");function SV(e,t){return t==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===t}s(SV,"wellTyped");function AV(e){let t=tI(e.inputs)?{...e.inputs}:{},n={...e};for(let[r,i]of Object.entries(nI(e.type))){if(!(r in e))continue;let o=e[r];if(r in t)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!(i==="string"&&o==="")&&!SV(o,i))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueWrongType"}};o!==""&&(t[r]={kind:"literal",value:o}),delete n[r]}for(let r of rI(e.type))delete n[r];return n.inputs=t,{node:n}}s(AV,"moveNode");function sI(e){let t=[],n=[],r=e.nodes.map(i=>{if(!iI(i))return i;let o=AV(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(sI,"moveScalarConfigToInputs");var ks={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 nf(e){return typeof e=="string"&&Object.hasOwn(ks,e)}s(nf,"isResourceType");var Kse=Object.keys(ks).filter(e=>ks[e].existence.check==="generic");function aI(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.groupKey=="string"&&t.groupKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||uo(t.reduction)===null&&t.reduction.kind==="amount")&&Object.keys(t).every(n=>n==="groupKey"||n==="grantKeys"||n==="reduction")}s(aI,"isPricedGroupValue");var ey=["street","hausnr","plz","ort","land"];function lI(e){return ey.includes(e)}s(lI,"isAddressPart");var EV=["municipality","municipalityKey","district","districtKey"],ty=[...ey,...EV],ny={string:"text",email:"text",tel:"text",number:"number",date:"date",boolean:"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"},bs=Object.keys(ny);function Ai(e){return typeof e=="string"&&e in ny}s(Ai,"isValueType");function bn(e){return e===void 0?void 0:ny[e]}s(bn,"dataTypeOf");function rf(e,t){let n=bn(e),r=bn(t);return n!==void 0&&n===r}s(rf,"valueTypesCompatible");function of(e){return e===null?"null is not a text in both languages":nl(e,{type:"localizedText"})}s(of,"completeLocalizedTextIssue");function nl(e,t){if(nf(t.type)&&!Ai(t.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${t.type} key`;let n=bn(t.type),r=JSON.stringify(e),i=`slot type "${t.type}" takes a binding, not a literal`;if(n===void 0||n==="composite"||n==="file"||n==="edge")return i;if(e===null)return null;switch(n){case"text":return typeof e=="string"?null:`${r} is not a text (slot type "${t.type}")`;case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)?null:`${r} is not a date YYYY-MM-DD`;case"number":return typeof e=="number"&&Number.isFinite(e)?null:`${r} is not a number`;case"boolean":return typeof e=="boolean"?null:`${r} is not true/false`;case"option":{if(typeof e!="string")return`${r} is not an option value`;let o=(t.enumOptions??[]).map(a=>a.value);return o.length===0||o.includes(e)?null:`${r} is not one of the options ${o.join(", ")}`}case"pricedItem":{let o=e;return typeof o=="object"&&typeof o.itemKey=="string"&&o.itemKey.length>0&&Array.isArray(o.grantKeys)&&o.grantKeys.every(a=>typeof a=="string")?null:`${r} is not a priced item {"itemKey":\u2026,"grantKeys":[\u2026]}`}case"pricedGroup":return aI(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 Ga(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=uo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(nl,"literalTypeIssue");function dI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(dI,"isObject");var TV={collectPayment:{reason:"reason"}},$V={governedDocument:["mockAutoProduce"]},cI={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 ry(e){return TV[String(e)]??{}}s(ry,"movesOf");function uI(e){return $V[String(e)]??[]}s(uI,"deadOf");function fI(e){return dI(e)&&[...Object.keys(ry(e.type)),...uI(e.type)].some(t=>t in e)}s(fI,"oldShape");function pI(e){return(e?.nodes??[]).some(fI)}s(pI,"needsNodeConfigInputMove");function RV(e){return of(e)===null}s(RV,"isCompleteText");function IV(e){let t=dI(e.inputs)?{...e.inputs}:{},n={...e};for(let[r,i]of Object.entries(ry(e.type)))if(r in e){if(i in t)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!RV(e[r]))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueNotLocalized"}};t[i]={kind:"literal",value:e[r]},delete n[r]}for(let r of uI(e.type))delete n[r];return Object.keys(ry(e.type)).some(r=>r in e)&&(n.inputs=t),{node:n}}s(IV,"moveNode");function mI(e){let t=[],n=[],r=e.nodes.map(i=>{if(!fI(i))return i;let o=IV(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(mI,"moveNodeConfigToInputs");var iy="collectPayment",vs=["online","separate"];function sf(e){return vs.includes(e)}s(sf,"isCollectPaymentSettlement");var xs="paid",oy="skipPayment",Ei="article",zn="settlement",Ti="reason",Wn="payee",sy=["one_time"];function af(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(af,"isObject");function hI(e){if(!af(e)||e.type!==iy)return!1;let t=af(e.inputs)?e.inputs:{},n=t[zn];return!af(n)||n.kind!=="literal"||n.value!=="online"?!1:!(Wn in t)}s(hI,"isOnlinePaymentWithoutPayee");function gI(e){return(e?.nodes??[]).some(hI)}s(gI,"needsPayee");function yI(e,t={}){let n=[],r=[],i=e.nodes.map(o=>{if(!hI(o))return o;let a=String(o.id),l=Object.hasOwn(t,a)?t[a]:void 0;if(l===void 0||l==="")return r.push(a),o;n.push({nodeId:a,payee:l});let d=af(o.inputs)?o.inputs:{};return{...o,inputs:{...d,[Wn]:{kind:"literal",value:l}}}});return n.length===0?{graph:e,set:n,refused:r}:{graph:{...e,nodes:i},set:n,refused:r}}s(yI,"setPayeeOnOnlinePayments");function lf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(lf,"isObject");function ay(e){return lf(e)&&lf(e.assign)&&"userId"in e.assign}s(ay,"namesUser");function df(e){return(e?.nodes??[]).flatMap(t=>lf(t)&&Array.isArray(t.tasks)?t.tasks.filter(ay).map(n=>({nodeId:String(t.id),taskKey:String(n.key),hasTeam:typeof n.assign.group=="string"&&n.assign.group.length>0})):[])}s(df,"taskUserAssignments");function wI(e){let t=df(e);if(t.length===0)return{graph:e,dropped:t};let n=e.nodes.map(r=>{if(!lf(r)||!Array.isArray(r.tasks)||!r.tasks.some(ay))return r;let i=r.tasks.map(o=>{if(!ay(o))return o;let{userId:a,...l}=o.assign,{assign:d,...c}=o;return Object.keys(l).length===0?c:{...c,assign:l}});return{...r,tasks:i}});return{graph:{...e,nodes:n},dropped:t}}s(wI,"dropTaskAssignUserIds");var Ss={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"optionalActions[].trigger":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Aktion ausl\xF6sen darf",en:"team that may trigger the action"},consequence:{de:"niemand au\xDFer der Prozessverantwortung kann die Aktion ausl\xF6sen",en:"nobody but the process owner can trigger the action"}}},ly=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function kI(e,t){if(typeof t!="string"||t.length===0)return null;if(e==="key")return t;let n=ps(t);return n?.kind==="team"?n.groupKey:null}s(kI,"decodeKey");function OV(e){let t=/^(tasks|optionalActions)\[\](?:\.([a-zA-Z]+))?\.([a-zA-Z]+)$/.exec(e);return t===null&&N(`[resource] unreadable reference leaf "${e}"`),{list:t[1],field:t[2]??null,key:t[3]}}s(OV,"locate");function cf(e){let t=[],n=e;for(let[r,i]of Object.entries(ly(n.assign)??{})){let o=kI("key",i);t.push({path:`assign.${r}`,leaf:"assign{}",owner:r,key:o,missing:typeof i!="string"||i.length===0})}for(let r of Object.keys(Ss)){if(r==="assign{}")continue;let i=Ss[r],{list:o,field:a,key:l}=OV(r);for(let d of Array.isArray(n[o])?n[o]:[]){let c=ly(d);if(c===null||typeof c.key!="string")continue;let f=(a===null?c:ly(c[a]))?.[l];if(f===void 0&&!i.required)continue;let m=typeof f!="string"||f.length===0;t.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:kI(i.codec,f),missing:m})}}return t}s(cf,"nodeResourceReferences");var bI=s(e=>(e??[]).map(t=>`\u201E${t}\u201C`).join(", "),"list"),vI=s(e=>(e??[]).map(t=>`"${t}"`).join(", "),"listEn"),PV={"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 (${bI(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 (${vI(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 (${bI(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 (${vI(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 As(e,t,n){let{problem:r,remedy:i}=PV[e][n](t);return`[${e}] ${r} ${i}`}s(As,"addressMessage");function On(e){let t=[];for(let n of e){let r=n.next;if(r)for(let[i,o]of Object.entries(r))t.push({id:`${n.id}|${i}`,source:n.id,target:o.to,sourceBranchId:i})}return t}s(On,"derivedEdges");function uf(e,t,n){if(t===n)return!0;let r=new Map,i=new Set;for(let l of On(e.nodes)){let d=r.get(l.source)??[];d.push(l.target),r.set(l.source,d),i.add(l.target)}let o=e.nodes.filter(l=>!i.has(l.id)&&l.id!==t).map(l=>l.id),a=new Set(o);for(;o.length>0;){let l=o.shift();if(l===n)return!1;for(let d of r.get(l)??[])d===t||a.has(d)||(a.add(d),o.push(d))}return!0}s(uf,"dominates");function xI(e,t,n){if(t===n)return!0;let r=new Map;for(let a of On(e.nodes)){let l=r.get(a.source)??[];l.push(a.target),r.set(a.source,l)}let i=[t],o=new Set(i);for(;i.length>0;){let a=i.shift();for(let l of r.get(a)??[]){if(l===n)return!0;o.has(l)||(o.add(l),i.push(l))}}return!1}s(xI,"reaches");function dy(e,t){let n=[],r=s(a=>({address:a.address,type:a.type,...a.label!==void 0?{label:a.label}:{},nodeId:a.nodeId}),"toVisible");for(let a of e.nodes)if(uf(e,a.id,t))for(let l of Rr(e,a))n.push(r(l));for(let a of LR)n.push({address:{scope:"env",key:a},type:Gg(a),label:zg(a),nodeId:null});for(let a of Ku(e))n.push({address:{scope:"env",key:ju(a.key)},type:a.type,label:a.label,nodeId:null});let i=new Set(n.map(a=>se(a.address))),o=(Array.isArray(e.processStore)?e.processStore:[]).filter(a=>a.derive!==void 0);for(let a=!0;a;){a=!1;for(let l of o){let d=se({scope:"derived",key:l.key});if(i.has(d))continue;let c=Qa(e,l.key);c===null||!c.every(u=>i.has(se(Zu(u))))||(n.push({address:{scope:"derived",key:l.key},type:l.type,label:l.label,nodeId:null}),i.add(d),a=!0)}}return n}s(dy,"visibleAddressesAt");function Or(e,t){let n=e?.readinessFormFieldsByFormNode?.get(t.owner);if(n!==void 0)return n.get(t.path)??null}s(Or,"formFieldEntryOf");var SI={binding:{de:"Eingang",en:"Input"},condition:{de:"Bedingung",en:"Condition"},nodeReads:{de:"Gelesene Felder",en:"Fields read"},requires:{de:"Geforderte Felder",en:"Required fields"},adoptForm:{de:"\xDCbernommenes Formular",en:"Continued form"},setFlagTarget:{de:"Freizuschaltendes Formular",en:"Form to unlock"},form:{de:"Formular",en:"Form"},contract:{de:"Vertrag",en:"Contract"},payment:{de:"Zahlung",en:"Payment"},taskWhen:{de:"Bedingung",en:"Condition"},taskReads:{de:"Gelesene Felder der Aufgabe",en:"Fields the task reads"},taskDocument:{de:"Dokumente",en:"Documents"},familyRequestFields:{de:"Nachforderbare Felder",en:"Requestable fields"},familyRequestFrom:{de:"Nachforderung aus",en:"Request from"},suggest:{de:"Vorschlag",en:"Suggestion"},reduction:{de:"Erm\xE4\xDFigung des Preises",en:"Reduction of the price"},pricingRule:{de:"Preisregel",en:"Pricing rule"}},_V=new Set(["nodeReads","requires","taskReads","taskDocument","familyRequestFields"]);function NV(e,t,n){let r=[];t.taskKey!==void 0&&r.push(`${n==="de"?"Aufgabe":"task"} \u201E${ho(e,t.taskKey,n)}\u201C`);let i=t.kind==="binding"?` \u201E${t.at.split(".").pop()}\u201C`:"";return r.push(`${SI[t.kind][n]}${i}`),r.join(" \u203A ")}s(NV,"addressFieldWhere");function rl(e,t,n){let r=NV(e,t,n);return t.nodeId===null?r:`\u201E${Oe(e,t.nodeId,n)}\u201C \u203A ${r}`}s(rl,"whereOf");function AI(e,t,n){if(t.scope==="node")return Oe(e,t.owner,n);if(t.scope==="task")return ho(e,t.owner,n)}s(AI,"producerName");function EI(e,t){let n=[],r=new Set,i=s((l,d,c)=>{let u={de:As(l,c("de"),"de"),en:As(l,c("en"),"en")},f=`${d}|${u.de}`;r.has(f)||(r.add(f),n.push({layer:"GRAPH",kind:"nodeRule",path:d,reason:u,severity:"error"}))},"report"),o=new Map(e.nodes.map(l=>[l.id,l])),a=[...e.nodes.flatMap(l=>Xa(l)),...Xu(e)];for(let l of a){let d=s(c=>rl(e,l,c),"where");for(let c of CV(e,l,i))FV(e,l,c,i)&&(MV(e,l,c,t,i),Hg.has(l.kind)&&!KV(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:Be(e,c,u)})))}return jV(e,i),BV(e,a,i),zV(e,i),HV(e,i),n}s(EI,"checkAddresses");function CV(e,t,n){let r=s(i=>rl(e,t,i),"where");if(Yg(t)){let i=ef(t.value)??[];for(let o of i)o.address===null&&n(o.reason==="bareIdentifier"?"address/bareIdentifier":"address/shape",t.at,a=>({where:r(a),address:o.identifier}));return ws(t)}return typeof t.value=="string"?(n("address/bareIdentifier",t.at,i=>({where:r(i),address:t.value})),[]):be(t.value)?[t.value]:(n("address/shape",t.at,i=>({where:r(i),address:JSON.stringify(t.value)??"undefined"})),[])}s(CV,"checkFieldShape");function TI(e,t,n,r){let i=AI(e,n,r);return{where:rl(e,t,r),address:Be(e,n,r),...i!==void 0?{producer:i}:{}}}s(TI,"addressParams");function DV(e,t,n){return Vg(t)?null:Va(e,t)!==void 0?n==="condition"||n==="binding"?null:"address/staffInputConditionOnly":ar(t)?"address/envCohortBound":"address/unknownKey"}s(DV,"envAddressRefusal");function FV(e,t,n,r){let i=s(o=>TI(e,t,n,o),"params");switch(n.scope){case"env":{let o=DV(e,n.key,t.kind);return o===null?!0:(r(o,t.at,i),!1)}case"derived":return(e.processStore??[]).find(a=>a.key===n.key)?.derive!==void 0?!0:(r("address/unknownKey",t.at,i),!1);case"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===n.owner))?(e.processStore??[]).some(a=>a.key===n.key&&a.derive===void 0)?Ir(e,n.owner,n.key)===null?(r("address/ownerNotWriter",t.at,i),!1):!0:(r("address/unknownKey",t.at,i),!1):(r("address/unknownOwner",t.at,i),!1);case"node":{let o=e.nodes.find(a=>a.id===n.owner);return o===void 0?(r("address/unknownOwner",t.at,i),!1):Rr(e,o).some(a=>a.address.scope==="node"&&a.address.key===n.key)?!0:(r(Hg.has(t.kind)&&kn(o)?"address/notFormInstance":"address/unknownKey",t.at,i),!1)}}}s(FV,"resolves");function LV(e,t){return e===void 0||t===void 0||bn(t)===void 0?!0:bn(e)!==void 0&&rf(e,t)}s(LV,"addressTypeFits");function MV(e,t,n,r,i){let o=s(l=>TI(e,t,n,l),"params");if(n.scope!=="env"&&n.path!==void 0&&!qV(e,t,n,r)){i("address/pathNotInTarget",t.at,o);return}if(t.expectedType===void 0)return;let a=Qg(e,n);LV(a,t.expectedType)||i("address/typeMismatch",t.at,l=>({...o(l),expected:t.expectedType,actual:a}))}s(MV,"checkPathAndType");function qV(e,t,n,r){if(n.scope!=="node")return!1;if(Qg(e,n)!==void 0)return!0;if(n.key!==tn)return!1;if(!_V.has(t.kind))return e.nodes.find(o=>o.id===n.owner)?.formExports===void 0;let i=r?.readinessFormFieldsByFormNode?.get(n.owner);return i===void 0||i.has(n.path)}s(qV,"pathExists");function KV(e,t){if(!hs(t))return!1;let n=e.get(t.owner);return n!==void 0&&n.type==="form"&&!kn(n)}s(KV,"isCreatingFormInstance");function jV(e,t){for(let n of e.nodes){let r=new Set(Xa(n).map(i=>i.kind));for(let i of jR(n))r.has(i)||t("address/missing",`nodes.${n.id}.${i}`,o=>({where:`\u201E${Oe(e,n.id,o)}\u201C \u203A ${SI[i][o]}`}))}}s(jV,"checkRequiredFields");function BV(e,t,n){let r=new Map;for(let i of t)if(i.judgedTogether!==null)for(let o of ws(i)){if(o.scope!=="node"||o.key!==tn)continue;let a=r.get(i.judgedTogether)??[];a.push({field:i,owner:o.owner}),r.set(i.judgedTogether,a)}for(let[i,o]of r){let a=[...new Set(o.map(l=>l.owner))];a.length<2||n("address/mixedForms",i,l=>({where:rl(e,o[0].field,l),names:a.map(d=>Oe(e,d,l))}))}}s(BV,"checkMixedForms");function UV(e,t){return e.type==="engagePush"&&t.kind==="payment"}s(UV,"readSkipsAbsentProducer");function VV(e,t,n){return t!==n&&xI(e,t,n)}s(VV,"precedesOnSomePath");function GV(e,t,n,r){let i=Zu(n.address);return r.has(se(i))||!WV(e,i)?!0:n.origin==="written"&&i.scope==="node"&&UV(t,n.field)&&VV(e,i.owner,t.id)}s(GV,"readPassesVisibility");function zV(e,t){for(let n of e.nodes){let r=mo(e,n);if(r.length===0)continue;let i=new Set(dy(e,n.id).map(o=>se(o.address)));for(let o of r){let a=Zu(o.address);if(GV(e,n,o,i))continue;let l=a.scope==="task"?Ir(e,a.owner,a.key):a.scope==="node"?a.owner:null;t("address/notVisible",o.field.at,d=>({where:rl(e,o.field,d),address:Be(e,o.address,d),producer:AI(e,a,d)??Be(e,a,d),...l!==null?{producerNode:Oe(e,l,d)}:{},reader:Oe(e,n.id,d)}))}}}s(zV,"checkVisibility");function WV(e,t){if(t.scope==="env")return Vg(t.key);if(t.scope==="derived")return Qa(e,t.key)!==null;let n=se(t);return e.nodes.some(r=>Rr(e,r).some(i=>se(i.address)===n))}s(WV,"producedSomewhere");function HV(e,t){let n=new Map;for(let r of e.nodes){let i=new Set(Rr(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"||!Tr.test(l)){t("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${Oe(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=n.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),n.set(l,d)}}for(let[r,i]of n)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)t("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${Oe(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${ho(e,r,a)}\u201C`,names:i.map(l=>Oe(e,l.nodeId,a))}))}s(HV,"checkTaskKeys");function ff(e,t){return e.label[t]??""}s(ff,"wordingIn");function $i(e,t){let n=$I(e,t),r=ff(e.qualifier,t);return n===""||r===""&&ff(e.qualifier,"de")!==""?"":r===""?n:`${r} \xB7 ${n}`}s($i,"fieldLabelIn");function $I(e,t){return ff(e,t)}s($I,"fieldOwnLabelIn");function Ri(e){return{key:e.key,kind:e.kind,type:e.kind==="entered"?e.type:null,repeated:e.kind==="entered"&&e.repeated,name:{de:$i(e,"de"),en:$i(e,"en")}}}s(Ri,"catalogField");function Ii(e,t,n){switch(e){case"nodeReads":return t.repeated?"repeated":n==="review"&&t.kind==="computed"?"computed":null;case"requires":return t.repeated?"repeated":t.kind==="computed"?"computed":t.name.en===""?"untranslated":null;case"taskDocument":return t.repeated?"repeated":t.kind==="entered"&&t.type==="docRef"?null:"notDocument";case"taskReads":case"familyRequestFields":return null}}s(Ii,"catalogFieldRefusal");function pf(e,t){let n=e.buses.find(r=>r.key===t);return n||N(`[progress] layout '${e.id}' has no bus '${t}'`),n}s(pf,"progressBus");function il(e,t){return e.states.some(n=>n.id===t)}s(il,"isBusState");function RI(e,t){let n=e.terminalSemantics?.[t];return n||N(`[progress] no terminal semantics for state '${t}' on bus '${e.key}'`),n}s(RI,"terminalSemantics");function mf(e,t){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,t)}s(mf,"hasTerminalSemantics");function YV(e,t){return(e.boards??[]).find(n=>n.audience===t||n.audience==="both")??null}s(YV,"boardForAudience");function II(e){return YV(pf(e,"process"),"internal")}s(II,"internalProcessBoard");function Es(e,t,n){let r=null;for(let i of e.mappings)if(i.event===n)if("nodeId"in i.match){if(i.match.nodeId===t.id)return{bus:i.bus,state:i.state}}else i.match.nodeType===t.type&&(r=i);return r?{bus:r.bus,state:r.state}:null}s(Es,"resolveProgressEvent");var Ts={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},Qr=Object.keys(Ts);function $s(e){return Object.hasOwn(Ts,e)}s($s,"isEndNodeOutcome");var OI={approved:{de:"Angenommen",en:"Admitted"},rejected:{de:"Abgelehnt",en:"Rejected"},withdrawn:{de:"Zur\xFCckgezogen",en:"Withdrawn"},expired:{de:"Abgelaufen",en:"Expired"}};var Oi=["commit","discard"],Lae=w.union(...Oi.map(e=>w.literal(e)));function hf(e){return typeof e=="string"&&Oi.includes(e)}s(hf,"isApplicationDataDecision");function Pt(e){return Object.keys(e)}s(Pt,"progressEventsOf");var ne=s((e,t)=>({de:e,en:t}),"lt"),Ze=s((e,t,n,r,i=null,o=null)=>({chipLabel:e,tone:t,nextAction:i,affordance:o,title:n,body:r}),"ex"),PI={key:"eingeschrieben",label:ne("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},gf={key:"abgesagt",label:ne("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},_I={key:"abgelehnt",label:ne("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var NI={enrolled:{label:ne("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:PI,external:Ze(ne("Eingeschrieben","Enrolled"),"green",ne("Sie sind eingeschrieben!","You are enrolled!"),ne("Ihre Anmeldung ist abgeschlossen und Ihr Platz ist gesichert. Wir freuen uns auf Sie.","Your enrolment is complete and your place is secured. We look forward to welcoming you."))},declined:{label:ne("Abgesagt","Declined"),tone:"red",terminal:{lifecycleStatus:"completed",outcome:"rejected"},phase:gf,external:Ze(ne("Abgesagt","Declined"),"red",ne("Die Bewerbung wurde beendet","The application has ended"),ne("Ihre Bewerbung wurde nicht fortgef\xFChrt.","Your application was not continued."))}},CI={role:"effect",effect:"pure",progressDefaults:NI,progressEvents:Pt(NI),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:Qr.map(e=>({value:e,label:OI[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=>[...JV(e),...QV(e)],"validate")},ol=s((e,t,n,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${t}`,reason:{de:n,en:r},severity:"error"}),"nodeIssue");function DI(e){let t=e.inputs?.applicationOutcome;return t?.kind==="literal"&&t.value!=null?String(t.value):null}s(DI,"literalOutcome");function JV(e){if(e.type!=="end")return[];let t=e.inputs?.applicationOutcome;if(t===void 0||t.kind==="unset")return[];let n=DI(e);return n===null?[ol(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`)]:$s(n)?[]:[ol(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${n}' ist kein Ausgang eines Endknotens (${Qr.join("|")}) \u2014 die Warteliste endet \xFCber das closed-Outcome ihres Wartelistenknotens`,`[end/applicationOutcome] ${e.label.en}: '${n}' is not an outcome of an end node (${Qr.join("|")}) \u2014 the waitlist ends through the closed outcome of its waitlist node`)]}s(JV,"checkEndApplicationOutcome");function QV(e){if(e.type!=="end")return[];let t=e.inputs?.dataDecision;return!t||t.kind!=="literal"||t.value==null?[ol(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)`)]:hf(t.value)?[]:[ol(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision '${String(t.value)}' ist ung\xFCltig (${Oi.join("|")})`,`[end/dataDecision] ${e.label.en}: dataDecision '${String(t.value)}' is invalid (${Oi.join("|")})`)]}s(QV,"checkEndDataDecision");function FI(e,t){if(!t?.layout||!t.wiring)return[];let n=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=DI(r);if(i===null||!$s(i))continue;let o=Ts[i],a=Es(t.wiring,r,o);if(a===null)continue;let l=t.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!mf(l,a.state))continue;let d=RI(l,a.state).outcome;d!==i&&n.push(ol(r,"applicationOutcome",`[end/outcomeMismatch] ${r.label.de}: das Ergebnis \u201E${i}" passt nicht zum Endzustand \u201E${a.state}" (Bus ${a.bus}), der \u201E${String(d)}" besiegelt \u2014 Ergebnis oder Verdrahtung angleichen.`,`[end/outcomeMismatch] ${r.label.en}: the outcome "${i}" does not match the final state "${a.state}" (bus ${a.bus}), which seals "${String(d)}" \u2014 align the outcome or the wiring.`))}return n}s(FI,"checkEndOutcomeMatchesTerminal");function Rs(e){let t=Ye(e);return typeof t.inputs=="function"?t.inputs(e):[]}s(Rs,"inputSlots");function ZV(e,t){return Rs(e).find(n=>n.id===t)}s(ZV,"findInputSlot");function XV(e,t){let n=ZV(e,t);if(!n)return{source:"missing",spec:{id:t,label:{de:t,en:t},type:"string"},unknownSlot:!0};let r=e.inputs?.[t]??{kind:"unset"};return r.kind==="binding"&&be(r.address)?{source:"binding",spec:n,address:r.address}:r.kind==="literal"?{source:"literal",spec:n,value:r.value}:r.kind==="cockpit"&&n.deferrable===!0?{source:"cockpit",spec:n}:n.defaultValue!==void 0?{source:"default",spec:n,value:n.defaultValue}:n.required?{source:"missing",spec:n}:{source:"optional",spec:n}}s(XV,"resolveInput");function LI(e){return Rs(e).filter(t=>XV(e,t.id).source==="missing")}s(LI,"missingRequiredInputs");var eG=["personRef","formRef","documentRef","docRef"];function tG(e){let t=Ye(e);return typeof t.inputs!="function"?[]:t.inputs(e).map(n=>({id:n.id,type:n.type}))}s(tG,"listInputs");function MI(e){let t=[];for(let n of e.nodes)for(let r of tG(n))!eG.includes(r.type)||n.inputs?.[r.id]?.kind!=="literal"||t.push({layer:"GRAPH",kind:"modelError",path:`node.${n.id}.param.${r.id}`,reason:{de:`${n.label.de}: Literal f\xFCr referenztypisierten Slot "${r.id}" ist verboten \u2014 der Slot wird an eine Adresse gebunden`,en:`${n.label.en}: A literal for the reference-typed slot "${r.id}" is not allowed \u2014 the slot is bound to an address`},severity:"error"});return t}s(MI,"findParamValueRefSlotErrors");function qI(e){let t=[];for(let n of e.nodes){let r=Ye(n);if(typeof r.inputs=="function")for(let i of r.inputs(n)){let o=n.inputs?.[i.id];if(o?.kind==="cockpit"&&i.deferrable!==!0){t.push({layer:"GRAPH",kind:"modelError",path:`nodes.${n.id}.inputs.${i.id}`,reason:{de:`[inputs/notDeferrable] ${n.label.de}: Parameter \u201E${i.label.de}\u201C l\xE4sst sich nicht im Cockpit erg\xE4nzen \u2014 nur Parameter eines Generators oder einer Vorlage.`,en:`[inputs/notDeferrable] ${n.label.en}: Parameter "${i.label.en}" cannot be completed in the cockpit \u2014 only parameters of a generator or a template can.`},severity:"error"});continue}(i.inspector==="literal-only"&&o?.kind==="binding"||i.inspector==="binding-only"&&o?.kind==="literal")&&t.push({layer:"GRAPH",kind:"modelError",path:`nodes.${n.id}.inputs.${i.id}`,reason:i.inspector==="literal-only"?{de:`[inputs/inspectorKind] ${n.label.de}: Parameter \u201E${i.label.de}\u201C ist ein fester Wert \u2014 eine Bindung an eine Adresse ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${n.label.en}: Parameter "${i.label.en}" is a fixed value \u2014 it cannot be bound to an address.`}:{de:`[inputs/inspectorKind] ${n.label.de}: Parameter \u201E${i.label.de}\u201C wird an eine Adresse gebunden \u2014 ein fester Wert ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${n.label.en}: Parameter "${i.label.en}" is bound to an address \u2014 a fixed value is not possible here.`},severity:"error"})}}return t}s(qI,"findInspectorKindErrors");function KI(e){let t=[];for(let n of e.nodes)for(let r of LI(n))t.push({layer:"GRAPH",kind:"contractGap",path:`node.${n.id}.input.${r.id}`,reason:{de:`${n.label.de}: Pflicht-Slot "${r.label.de}" nicht gesetzt`,en:`${n.label.en}: Required slot "${r.label.en}" is not set`},severity:"error"});return t}s(KI,"findMissingRequiredInputs");function yf(e){let t=e.processStore;return t===void 0?[]:(Array.isArray(t)||N("graph.processStore must be an array \u2014 the graph validator refuses anything else"),t)}s(yf,"processStoreKeys");function BI(e){let t=[];for(let n of e.tasks??[]){let r=n.result;if(!(r===void 0||!fs(r)))for(let i of Yu(r))t.push({key:i.key,nodeId:e.id,taskKey:n.key,template:n,result:r,valueType:i.valueType,...i.field!==void 0?{fieldKey:i.field.key}:{}})}return t}s(BI,"storeWritersOn");function UI(e){let t=new Map;for(let n of e.nodes)for(let r of BI(n)){let i=t.get(r.key)??[];i.push(r),t.set(r.key,i)}return t}s(UI,"processStoreWriters");function nG(e,t,n){for(let r of e.nodes){let i=BI(r).find(o=>o.taskKey===t&&o.key===n);if(i!==void 0)return i}return null}s(nG,"writerAt");function jI(e,t,n){(t.scope!=="task"||t.path!==void 0)&&N(`[process] ${n}: ${se(t)} is no task value`);let r=nG(e,t.owner,t.key);return r===null&&N(`[address/ownerNotWriter] ${n}: task "${t.owner}" writes no "${t.key}" \u2014 publish refuses that`),{key:t.key,nodeId:r.nodeId,taskKey:r.taskKey,...r.fieldKey!==void 0?{fieldKey:r.fieldKey}:{}}}s(jI,"sourceOfAddress");function cy(e,t){(t.scope!=="task"&&t.scope!=="derived"||t.path!==void 0)&&N(`[process] ${se(t)} is no store address`);let n=yf(e).find(o=>o.key===t.key);n===void 0&&N(`[address/unknownKey] ${se(t)}: "${t.key}" is not declared in processStore`);let r={key:n.key,type:n.type,label:n.label,audience:n.audience};if(t.scope==="task")return Kg(n)&&N(`[address/unknownKey] ${se(t)}: "${t.key}" is a derived price \u2014 read it as $derived`),{...r,sources:[jI(e,t,se(t))]};Kg(n)||N(`[address/unknownKey] ${se(t)}: "${t.key}" is a written value \u2014 read it as $task`);let i=jg(e,n.derive).map(o=>jI(e,o.address,se(t)));return{...r,sources:i,derive:n.derive}}s(cy,"processLeafOf");var uy=new Set(["enum","pricedItem","number","boolean","reduction"]),fy=new Set(["pricedItem","pricedGroup"]),py=new Set(["number","boolean","enum"]),De={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",ruleSet:"[process/ruleSet]",ruleCondition:"[process/ruleCondition]",ruleSource:"[process/ruleSource]",ruleReadsAbsent:"[process/ruleReadsAbsent]",absentValue:"[process/absentValue]",derive:"[process/derive]",derivedHasWriter:"[process/derivedHasWriter]",ruleGrantUnknown:"[process/ruleGrantUnknown]",ruleGrantUnused:"[process/ruleGrantUnused]",derivePriceUnknown:"[process/derivePriceUnknown]",derivePriceNotInProgram:"[process/derivePriceNotInProgram]",derivePriceOfferWithoutProgram:"[process/derivePriceOfferWithoutProgram]",deriveStageUnknown:"[process/deriveStageUnknown]",deriveStageUncovered:"[process/deriveStageUncovered]",reductionPrices:"[process/reductionPrices]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function Fe(e,t,n,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${t} ${n}`,en:`${t} ${r}`},severity:"error"}}s(Fe,"err");function VI(e,t={}){let n=[],r=yf(e),i=new Map(r.map(d=>[d.key,d])),o=new Set;for(let[d,c]of r.entries()){let u=`processStore[${d}]`;if(typeof c.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(c.key)){n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(c.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(c.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}o.has(c.key)&&n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" ist doppelt deklariert.`,`Process key "${c.key}" is declared twice.`)),o.add(c.key),(c.derive!==void 0?!fy.has(c.type):!uy.has(c.type))&&n.push(c.derive!==void 0?Fe(u,De.derive,`Vorgangs-Schl\xFCssel "${c.key}" ist abgeleitet, hat aber den Typ "${c.type}" \u2014 abgeleitet wird nur ein Preis: ${[...fy].join(", ")}.`,`Process key "${c.key}" is derived but has the type "${c.type}" \u2014 only a price can be derived: ${[...fy].join(", ")}.`):Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" hat den Typ "${c.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...uy].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: ${[...uy].join(", ")}${c.type==="pricedGroup"?" (a package is derived: derive)":""}.`)),(!c.label?.de?.trim()||!c.label?.en?.trim())&&n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" braucht ein Label in beiden Sprachen.`,`Process key "${c.key}" needs a label in both languages.`)),c.audience!=="internal"&&c.audience!=="printable"&&n.push(Fe(u,De.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${c.key}": audience must be 'internal' or 'printable'.`))}let a=UI(e);for(let d of e.nodes)for(let c of d.tasks??[]){let u=c.result;u?.kind==="pricedItem"&&u.writes===void 0&&n.push(Fe(`node.${d.id}.tasks.${c.key}.result.writes`,De.pricedItemWritesNothing,`Aufgabe "${c.key}" (Knoten "${d.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${c.key}" (node "${d.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[d,c]of a){let u=i.get(d);for(let f of c){let m=f.fieldKey===void 0?`node.${f.nodeId}.tasks.${f.taskKey}.result.writes`:`node.${f.nodeId}.tasks.${f.taskKey}.result.fields.${f.fieldKey}.writes`;if(u===void 0){n.push(Fe(m,De.unknownKey,`${f.fieldKey===void 0?"":`Feld "${f.fieldKey}" der `}Aufgabe "${f.taskKey}" schreibt "${d}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${f.fieldKey===void 0?"Task":`Field "${f.fieldKey}" of task`} "${f.taskKey}" writes "${d}", but the workflow declares no such process key (graph.processStore).`));continue}if(f.valueType!==u.type){let y=f.fieldKey===void 0?`Aufgabe "${f.taskKey}"`:`Feld "${f.fieldKey}" der Aufgabe "${f.taskKey}"`,k=f.fieldKey===void 0?`Task "${f.taskKey}"`:`Field "${f.fieldKey}" of task "${f.taskKey}"`;n.push(Fe(m,De.writerTypeMismatch,`${y} liefert ${f.valueType}, der Vorgangs-Schl\xFCssel "${d}" ist aber als ${u.type} deklariert.`,`${k} delivers ${f.valueType}, but the process key "${d}" is declared as ${u.type}.`))}}if(c.length>1){let f=c.map(m=>`${m.nodeId}/${m.taskKey}${m.fieldKey===void 0?"":`.${m.fieldKey}`}`).join(", ");n.push(Fe(`processStore.${d}`,De.secondWriter,`Vorgangs-Schl\xFCssel "${d}" wird ${c.length}-mal geschrieben (${f}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${d}" is written ${c.length} times (${f}) \u2014 exactly one writer per key.`))}}for(let d of r){if(d.derive!==void 0){if(a.has(d.key)){let c=a.get(d.key).map(u=>`${u.nodeId}/${u.taskKey}`).join(", ");n.push(Fe(`processStore.${d.key}`,De.derivedHasWriter,`Vorgangs-Schl\xFCssel "${d.key}" wird abgeleitet (derive) \u2014 keine Aufgabe darf ihn schreiben (${c}).`,`Process key "${d.key}" is derived (derive) \u2014 no task may write it (${c}).`))}continue}a.has(d.key)||n.push(Fe(`processStore.${d.key}`,De.noWriter,`Vorgangs-Schl\xFCssel "${d.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${d.key}" is declared, but no task writes it ('result.writes').`))}n.push(...rG(e,r,a,t));let l=new Map;for(let d of e.nodes){let c=Ye(d),u=typeof c.inputs=="function"?c.inputs(d):[];for(let f of u){let m=d.inputs?.[f.id];if(m?.kind!=="binding")continue;let y=iG(e,m.address);if(y===null)continue;let k=`node.${d.id}.input.${f.id}`,g=se(m.address);for(let $ of y.sources){let R=l.get($.key)??new Set;R.add(d.id),l.set($.key,R)}if(y.audience==="internal"&&n.push(Fe(k,De.internalInDocument,`${d.label.de}: "${f.id}" liest den internen Vorgangs-Schl\xFCssel "${y.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${d.label.en}: "${f.id}" reads the internal process key "${y.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`)),y.derive!==void 0)continue;let v=oG(a,y.sources[0].key,y.sources[0].taskKey);if(v.template.when!==void 0&&f.required===!0&&f.defaultValue===void 0&&n.push(Fe(k,De.absentWithoutDefault,`${d.label.de}: "${f.id}" ist Pflicht und an ${g} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${wf(v.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${d.label.en}: "${f.id}" is required and bound to ${g}, but the writing task only exists under a condition (when: ${wf(v.template.when)}) \u2014 without a default value the field would stay empty forever.`)),v.result.kind==="pricedItem"&&f.defaultValue!==void 0){let $=f.defaultValue;(!vi($)||$.itemKey!==v.result.item||$.grantKeys.length>0)&&n.push(Fe(k,De.defaultItemMismatch,`${d.label.de}: der Vorgabewert von "${f.id}" muss der Artikel der schreibenden Aufgabe ohne Erm\xE4\xDFigung sein ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 sonst rechnete die Familie ohne Antrag einen anderen Artikel als mit.`,`${d.label.en}: the default value of "${f.id}" must be the article of the writing task without a reduction ({ itemKey: '${v.result.item??"?"}', grantKeys: [] }) \u2014 otherwise the family would be charged a different article without an application than with one.`))}}}for(let[d,c]of l){let u=a.get(d)[0],f=u.template.blocks,m=f===void 0?void 0:f.node??u.nodeId,y=m!==void 0&&c.has(m)&&(()=>{let g=e.nodes.find(v=>v.id===m);return g!==void 0&&Ye(g).processHoldTemplate?.(g)===f.templateKey})(),k=`node.${u.nodeId}.tasks.${u.taskKey}.blocks`;if(!y){let g=[...c][0],v=e.nodes.find(R=>R.id===g),$=Ye(v).processHoldTemplate?.(v)??"?";n.push(Fe(k,De.writerMustBlock,`Die Aufgabe "${u.taskKey}" schreibt "${d}", h\xE4lt aber keinen der lesenden Knoten (${[...c].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${g===u.nodeId?"":`node: '${g}', `}templateKey: '${$}' }, 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: '${$}' }, otherwise it works before the value exists.`));continue}for(let g of c)g===m||uf(e,m,g)||n.push(Fe(k,De.writerMustBlock,`"${g}" liest "${d}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${m}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${g}" reads "${d}" but does not lie behind the held-back node "${m}" \u2014 on a path past it, it would read the value before it is settled.`))}return n}s(VI,"processBindingIssues");function rG(e,t,n,r){let i=[],o=new Map(t.map(u=>[u.key,u])),a=Qu(e),l=new Set;for(let[u,f]of a.entries()){let m=`pricingRules[${u}]`;if((typeof f.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(f.key)||l.has(f.key))&&i.push(Fe(m,De.ruleSet,`Regelgruppe ${JSON.stringify(f.key)} \u2014 ein eindeutiger Schl\xFCssel aus Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Rule group ${JSON.stringify(f.key)} \u2014 a unique key of letters, digits and _, starting with a lowercase letter.`)),l.add(f.key),(!f.label?.de?.trim()||!f.label?.en?.trim())&&i.push(Fe(m,De.ruleSet,`Regelgruppe "${f.key}" braucht ein Label in beiden Sprachen.`,`Rule group "${f.key}" needs a label in both languages.`)),!Array.isArray(f.rows)||f.rows.length===0){i.push(Fe(m,De.ruleSet,`Regelgruppe "${f.key}" hat keine Zeilen.`,`Rule group "${f.key}" has no rows.`));continue}for(let[y,k]of f.rows.entries()){let g=`${m}.rows[${y}]`;(!Array.isArray(k.grants)||k.grants.length===0||k.grants.some($=>typeof $!="string"||$.length===0))&&i.push(Fe(g,De.ruleSet,`Regelgruppe "${f.key}", Zeile ${y+1}: nennt keine Rabattvorlage \u2014 eine Zeile ohne Rabatt ist die fehlende Zeile.`,`Rule group "${f.key}", row ${y+1}: names no discount template \u2014 a row without a discount is the missing row.`));let v=Ha(k.when);if(v!==null){i.push(Fe(g,De.ruleCondition,`Regelgruppe "${f.key}", Zeile ${y+1}: Bedingung ${JSON.stringify(k.when)} \u2014 ${v}.`,`Rule group "${f.key}", row ${y+1}: condition ${JSON.stringify(k.when)} \u2014 ${v==="leere Bedingung"?"empty condition":v}.`));continue}for(let{identifier:$,address:R}of Wg(k.when)){if(R===null)continue;let A=sG(R,o,n);if(A==="ruleSource")i.push(Fe(g,De.ruleSource,`Regelgruppe "${f.key}", Zeile ${y+1}: liest ${$} \u2014 eine Bedingung liest nur Werte, die eine Aufgabe schreibt ($task.<aufgabe>.<schl\xFCssel>), vom Typ ${[...py].join(", ")}.`,`Rule group "${f.key}", row ${y+1}: reads ${$} \u2014 a condition only reads values that a task writes ($task.<task>.<key>), of type ${[...py].join(", ")}.`));else if(A==="ruleReadsAbsent"){let P=n.get(R.key).find(L=>L.taskKey===R.owner);i.push(Fe(g,De.ruleReadsAbsent,`Regelgruppe "${f.key}" liest ${$}, dessen Aufgabe entfallen kann (${P.template.when!==void 0?`when: ${wf(P.template.when)}`:"sie endet mit ihrem Knoten"}) \u2014 der Schl\xFCssel muss sagen, wof\xFCr er ohne Aufgabe steht ('absentValue'), sonst entschiede die Regel still \xFCber einen fehlenden Wert.`,`Rule group "${f.key}" reads ${$}, whose task can lapse (${P.template.when!==void 0?`when: ${wf(P.template.when)}`:"it ends with its node"}) \u2014 the key must say what it stands for without a task ('absentValue'), otherwise the rule would silently decide on a missing value.`))}}}}for(let u of t){if(u.absentValue===void 0)continue;let f=`processStore.${u.key}.absentValue`;if(!(u.type==="number"&&typeof u.absentValue=="number"||u.type==="boolean"&&typeof u.absentValue=="boolean"||u.type==="enum"&&typeof u.absentValue=="string"&&u.absentValue.length>0)){i.push(Fe(f,De.absentValue,`Vorgangs-Schl\xFCssel "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} passt nicht zum Typ.`,`Process key "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} does not fit the type.`));continue}let y=n.get(u.key)?.[0];y!==void 0&&!GI(y)&&i.push(Fe(f,De.absentValue,`Vorgangs-Schl\xFCssel "${u.key}": seine Aufgabe ist immer geschuldet und \xFCberlebt ihren Knoten \u2014 ein absentValue w\xFCrde nie gelesen.`,`Process key "${u.key}": its task is always owed and outlives its node \u2014 an absentValue would never be read.`))}let d=[];for(let u of t){let f=u.derive;if(f===void 0)continue;let m=`processStore.${u.key}.derive`,y=u.type==="pricedGroup"?"group":"item",k=[f.item,f.group,f.byStage].filter(L=>L!==void 0).length,g=Bg(f),v=f.byStage??[];(k!==1||g.length===0||g.length!==Math.max(v.length,1)||g.some(L=>L.kind!==y))&&i.push(Fe(m,De.derive,`"${u.key}" (${u.type}) leitet ${y==="group"?"ein Paket ab: genau 'group' oder 'byStage' mit je einem 'group'":"einen Artikel ab: genau 'item' oder 'byStage' mit je einem 'item'"}.`,`"${u.key}" (${u.type}) derives ${y==="group"?"a package: exactly 'group' or 'byStage' with one 'group' each":"an article: exactly 'item' or 'byStage' with one 'item' each"}.`));let $=new Set;for(let[L,b]of v.entries()){if(!Array.isArray(b.stages)||b.stages.length===0){i.push(Fe(`${m}.byStage[${L}]`,De.derive,`"${u.key}": die Zeile ${L+1} nennt keine Stufe.`,`"${u.key}": row ${L+1} names no stage.`));continue}for(let E of b.stages)$.has(E)&&i.push(Fe(`${m}.byStage[${L}]`,De.derive,`"${u.key}": die Stufe "${E}" steht in mehr als einer Zeile \u2014 welcher Preis gilt, w\xE4re geraten.`,`"${u.key}": the stage "${E}" is in more than one row \u2014 which price applies would be a guess.`)),$.add(E)}let R=new Set;for(let L of f.rules??[]){let b=a.find(E=>E.key===L);if(b===void 0){i.push(Fe(m,De.derive,`"${u.key}" nennt die Regelgruppe "${L}", die der Workflow nicht deklariert (bekannt: ${a.map(E=>E.key).join(", ")||"keine"}).`,`"${u.key}" names the rule group "${L}", which the workflow does not declare (known: ${a.map(E=>E.key).join(", ")||"none"}).`));continue}for(let E of b.rows??[])for(let q of E.grants??[])R.add(q)}let A=f.reduction;be(A)&&(aG(A,o)||i.push(Fe(m,De.derive,`"${u.key}": Reduktion ${se(A)} ist kein von einer Aufgabe geschriebener Wert vom Typ reduction ($task.<aufgabe>.<schl\xFCssel>).`,`"${u.key}": reduction ${se(A)} is not a value of type reduction written by a task ($task.<task>.<key>).`)));for(let L of g)d.push({key:u.key,target:L,grants:R}),(L.kind==="item"?r.billingItemKeys?.has(L.key):r.groupArticleKeys?.has(L.key))===!1?i.push(Fe(m,De.derivePriceUnknown,`"${u.key}": ${L.kind==="item"?"der Artikel":"das Paket"} "${L.key}" ist nicht im Katalog des Mandanten.`,`"${u.key}": the ${L.kind==="item"?"article":"package"} "${L.key}" is not in the school's catalog.`)):r.offerProgram===null?i.push(Fe(m,De.derivePriceOfferWithoutProgram,`"${u.key}": das Angebot ist keinem Programm zugeordnet, also geh\xF6rt ${L.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 ${L.kind==="item"?"article":"package"} belongs to it; give the offer a program.`)):r.offerProgram!==void 0&&((L.kind==="item"?r.offerProgram.billingItemKeys:r.offerProgram.groupKeys).has(L.key)||i.push(Fe(m,De.derivePriceNotInProgram,`"${u.key}": ${L.kind==="item"?"der Artikel":"das Paket"} "${L.key}" ist dem Programm \u201E${r.offerProgram.nameDe}\u201C des Angebots nicht zugeordnet${L.kind==="group"?" oder wird nicht angeboten":""} (unter Finanzen \u2192 Artikel zuordnen).`,`"${u.key}": the ${L.kind==="item"?"article":"package"} "${L.key}" is not assigned to the offer's program "${r.offerProgram.nameDe}"${L.kind==="group"?" or is not offered":""} (under Finance \u2192 assign articles).`)));let P=r.offerProgram?.stageKeys;if(f.byStage!==void 0&&P!==void 0){let L=[...$].filter(E=>!P.all.has(E));L.length>0&&i.push(Fe(m,De.deriveStageUnknown,`"${u.key}": ${L.map(E=>`"${E}"`).join(", ")} ist keine Stufe des Programms \u201E${r.offerProgram.nameDe}\u201C (Stufen: ${[...P.all].join(", ")||"keine"}).`,`"${u.key}": ${L.map(E=>`"${E}"`).join(", ")} ${L.length===1?"is not a stage":"are not stages"} of the program "${r.offerProgram.nameDe}" (stages: ${[...P.all].join(", ")||"none"}).`));let b=[...P.active].filter(E=>!$.has(E));b.length>0&&i.push(Fe(m,De.deriveStageUncovered,`"${u.key}": f\xFCr ${b.map(E=>`"${E}"`).join(", ")} nennt byStage keinen ${y==="group"?"Paket":"Artikel"} \u2014 diese Stufe h\xE4tte keinen Preis.`,`"${u.key}": for ${b.map(E=>`"${E}"`).join(", ")} byStage names no ${y==="group"?"package":"article"} \u2014 that stage would have no price.`))}}for(let u of n.values())for(let f of u){if(f.result.kind!=="reduction"||f.result.prices===void 0||f.result.writes===void 0)continue;let m=`node.${f.nodeId}.tasks.${f.taskKey}.result.prices`,k=o.get(f.result.prices)?.derive?.reduction;be(k)&&k.scope==="task"&&k.owner===f.taskKey&&k.key===f.result.writes||i.push(Fe(m,De.reductionPrices,`Aufgabe "${f.taskKey}" senkt "${f.result.prices}" \u2014 das muss ein abgeleiteter Preis sein, dessen derive.reduction $task.${f.taskKey}.${f.result.writes} ist.`,`Task "${f.taskKey}" reduces "${f.result.prices}" \u2014 that must be a derived price whose derive.reduction is $task.${f.taskKey}.${f.result.writes}.`))}let c=r.grantTemplates;if(c!==void 0){let u=new Set(a.flatMap(f=>(f.rows??[]).flatMap(m=>m.grants??[])));for(let f of u){let m=c.get(f);if(m===void 0){i.push(Fe("pricingRules",De.ruleGrantUnknown,`Eine Regelgruppe vergibt "${f}", aber keine Rabattvorlage des Mandanten tr\xE4gt diesen Schl\xFCssel.`,`A rule group grants "${f}", but no discount template of the school has this key.`));continue}d.some(({target:k,grants:g})=>{if(!g.has(f))return!1;if(k.kind==="item")return m.itemKeys.includes(k.key);let v=r.groupArticleKeys?.get(k.key);return m.itemKeys.some($=>v?.has($))})||i.push(Fe("pricingRules",De.ruleGrantUnused,`Die Rabattvorlage "${f}" (gebunden an Artikel "${m.itemKeys.join(", ")}") wird vergeben, aber kein abgeleiteter Preis, der ihre Regelgruppe liest, enth\xE4lt ihr Ziel \u2014 sie wirkte nirgends.`,`The discount template "${f}" (bound to article "${m.itemKeys.join(", ")}") is granted, but no derived price reading its rule group contains its target \u2014 it would have no effect anywhere.`))}}return i}s(rG,"derivedPriceIssues");function iG(e,t){if(!be(t)||t.scope!=="task"&&t.scope!=="derived"||t.path!==void 0)return null;let n=yf(e).find(o=>o.key===t.key);if(n===void 0||t.scope==="derived"!=(n.derive!==void 0))return null;if(t.scope==="task")return Ir(e,t.owner,t.key)===null?null:cy(e,t);let r=_R(e,n.derive),i=s(o=>o.scope==="task"&&o.path===void 0&&Ir(e,o.owner,o.key)!==null,"resolvable");return r!==null&&r.every(o=>i(o.address))?cy(e,t):null}s(iG,"draftLeafOf");function oG(e,t,n){let r=e.get(t)?.find(i=>i.taskKey===n);return r===void 0&&N(`[process] the leaf of "${t}" names task "${n}", which does not write it`),r}s(oG,"writerOf");function wf(e){return be(e)?se(e):JSON.stringify(e)}s(wf,"shown");function sG(e,t,n){let r=e.scope==="task"&&e.path===void 0?t.get(e.key):void 0;if(e.scope==="task"&&e.path===void 0&&r===void 0)return null;if(e.scope!=="task"||r===void 0||r.derive!==void 0||!py.has(r.type))return"ruleSource";let i=n.get(r.key)?.find(o=>o.taskKey===e.owner);return i!==void 0&&GI(i)&&r.absentValue===void 0?"ruleReadsAbsent":null}s(sG,"ruleSourceRefusal");function aG(e,t){let n=e.scope==="task"&&e.path===void 0?t.get(e.key):void 0;return n!==void 0&&n.type==="reduction"&&n.derive===void 0}s(aG,"isReductionValue");function GI(e){return e.template.when!==void 0||e.template.blocks?.node===void 0}s(GI,"writerMayBeNotOwed");function my(e){let t=Ye(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:t.outcomes&&t.outcomes.length>0?[...t.outcomes]:null}s(my,"nodeOutcomes");var lG=["documentChangeRequested","documentReturned"];function zI(e){return lG.includes(e)}s(zI,"isNonAdvancingExternalEvent");var Is=["offer","contract"];function kf(e){return typeof e=="string"&&Is.includes(e)}s(kf,"isArtifactSlotType");var WI="open",Os="done";function hy(e){let t={};for(let n of ze)t[n]=e(n);return t}s(hy,"localized");var HI=[{key:"tenantSlug",type:"string"}];var dG=/^(\d{4})-(\d{2})-(\d{2})$/;function cG(e){return e>=1900&&e<=2100}s(cG,"isSupportedYear");function uG(e,t,n){let r=new Date(Date.UTC(e,t-1,n));return r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n}s(uG,"isRealDate");function gy(e){if(typeof e!="string")return null;let t=dG.exec(e);if(t===null)return null;let[,n,r,i]=t;return n===void 0||r===void 0||i===void 0||!cG(Number(n))||!uG(Number(n),Number(r),Number(i))?null:{year:n,month:r,day:i}}s(gy,"isoDateParts");var fG="Europe/Berlin";function JI(){return fG}s(JI,"tenantTimeZone");var YI=new Map;function pG(e){let t=YI.get(e);if(t)return t;let n;try{n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{ce("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return YI.set(e,n),n}s(pG,"formatterFor");function mG(e,t){let n=new Map(pG(e).formatToParts(new Date(t)).map(a=>[a.type,a.value])),r=s(a=>{let l=n.get(a);return l===void 0&&N(`Zeitzone "${e}" liefert kein Feld ${a}.`),Number(l)},"read"),i=r("hour")%24;return Date.UTC(r("year"),r("month")-1,r("day"),i,r("minute"),r("second"))-Math.floor(t/1e3)*1e3}s(mG,"zoneOffsetAt");function yy(e,t){let n=e+mG(t,e);return{wallClock:new Date(n).toISOString().slice(0,19),timeZone:t}}s(yy,"instantToLocalDateTime");var wy=3;function QI(e){return yy(e,JI()).wallClock.slice(0,10)}s(QI,"localIsoDate");var bf=["login","security","admission","tasks","schoolMessages","staffTasks","staffAppointments","staffDeadlines","familyMessages","mentions"],ZI=w.union(...bf.map(e=>w.literal(e)));var Jle=w.union(w.literal("admission"),w.literal("tasks"),w.literal("staff"),w.literal("chat")),ky=["loginOnly","all"],Qle=w.union(w.literal("loginOnly"),w.literal("all"));function XI(e){return typeof e=="string"&&ky.includes(e)}s(XI,"isMailLevel");var sl="subject";function eO(e){return e.category==="login"}s(eO,"isSignInLetter");var dt={key:"schoolName",label:"Name der Schule"},tO={de:"Zu Ihren Bewerbungen",en:"View your applications"},vt={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:tO},by={key:vt.key,label:vt.label,link:!0,actionLabel:tO},nO={key:"authorName",label:"Name der schreibenden Person"},al={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},ll={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"}},gG={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"}},rO={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"}},dl={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},iO={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},yG={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function Me(e){return{key:sl,label:"Betreff",default:e}}s(Me,"subjectSlot");var cl=w.object({de:w.string(),en:w.string()}),_t={tenantSlug:w.string(),applicationId:w.id("applications")},wG=w.object({tenantSlug:w.string()}),kG={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:wG,channels:["email"],portalVisible:!0,placeholders:[dt,vt],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:
9818
9818
 
9819
9819
  {{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
@@ -10049,7 +10049,7 @@ The link is valid for {{gueltigkeit}} and works once. Afterwards you are signed
10049
10049
  {key,name,gradeLevel|null}, run {key,name,startDate|null}, applicant
10050
10050
  {language: 'de'|'en'|null (null = no applicant account), channel:
10051
10051
  'self-service'|'staff'}. A missing key fails loud, exactly like a start.
10052
- `,examples:[["Portal application to an offer",`$0 assignment simulate --dir ~/scratch/kindergarten-r17 --env-json '{"applicant":{"language":"de","channel":"self-service"}}'`],["The next pick of a \u201EReihum\u201C row whose last start took 'finanzen'","$0 assignment simulate --dir <bundle> --env-file env.json --rotation-previous team:finanzen=finanzen"],["A leastLoaded rotation with open-task counts","$0 assignment simulate --dir <bundle> --env-file env.json --open finanzen=3 --open finanzen_2=1"]]});dir=p.String("--dir",{required:!0,description:"Offer bundle directory (its workflow.json carries the rule)"});envJson=p.String("--env-json",{description:"The application's environment ($env) as JSON"});envFile=p.String("--env-file",{description:"\u2026or a file holding it"});creator=p.String("--creator",{description:"Label for the staff creator (only a staff start has one)"});rotationPrevious=p.Array("--rotation-previous",{description:"<slot>=<personKey>: the last pick of that slot's \u201EReihum\u201C row (repeatable; none = its first start)"});left=p.Array("--left",{description:"<personKey>: someone who has left \u2014 every rotation skips them (repeatable)"});open=p.Array("--open",{description:"<personKey>=<n>: open tasks, for a leastLoaded rotation (repeatable; absent = 0)"});async execute(){let t=Ke(this.dir),n=DO(t.workflow?.graph,`bundle ${this.dir}`),r=U1(this.envJson,this.envFile),i=HP(n,r,{...this.creator!==void 0?{creator:this.creator}:{},rotationPrevious:YP("--rotation-previous",this.rotationPrevious),openCounts:B1(this.open),left:this.left??[]});return this.print(i,o=>o.slots.map(a=>({slot:a.slot,row:`#${a.row}`,value:a.value,rotation:a.rotation===void 0?"":`${a.rotation.mode} [${a.rotation.pool.join(", ")}] after ${a.rotation.previous??"\u2014"} \u2192 ${a.rotation.picked}`}))),0}},JP=[Qy];var V1={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif",".svg":"image/svg+xml",".avif":"image/avif"};function QP(e){return V1[G.extname(e).toLowerCase()]}s(QP,"guessImageContentType");async function G1(e,t){if(e===void 0==(t===void 0))throw new Error("Pass exactly one of --file <path> or --url <url>.");if(t!==void 0&&st())throw new Error("Hosted agents cannot fetch arbitrary logo URLs. Upload the image to the chat and use --file <path>.");if(e!==void 0){let a=G.resolve(e),l;try{l=ye(a)}catch{throw new Error(`File not found: ${e}`)}let d=QP(a);if(d===void 0)throw new Error(`Cannot infer an image content-type from "${G.basename(a)}" \u2014 use a .png/.jpg/.webp/.gif file.`);return{bytes:new Uint8Array(l),contentType:d}}let n=await fetch(t);if(!n.ok)throw new Error(`Fetch failed for ${t} (${n.status} ${n.statusText}).`);let r=new Uint8Array(await n.arrayBuffer()),i=n.headers.get("content-type")?.split(";")[0]?.trim(),o=i&&i.startsWith("image/")?i:QP(new URL(t).pathname);if(o===void 0)throw new Error(`Response for ${t} is not an image (content-type "${i??"unknown"}").`);return{bytes:r,contentType:o}}s(G1,"loadLogoBytes");async function z1(e,t,n,r){let i=await e.mutation(S.branding.platformGenerateBrandingLogoUploadUrl,{client:t});return e.upload(i,n,r)}s(z1,"uploadLogo");var Zy=class extends C{static{s(this,"BrandingSetLogoCommand")}static paths=[["branding","set-logo"]];static usage=T.Usage({category:"Branding",description:"Upload a tenant's portal logo (platform-admin)",details:"Sets the external-portal logo for --tenant from a local --file or a remote --url. A one-off upload without the tenant's Branding admin UI. To move the logo with the rest of the config (export \u2192 apply, env \u2192 env), use `config apply` \u2014 it carries the file by hash (`tenant.brandingAssets.logo`).",examples:[["Upload the test tenant's logo to staging from a file","$0 --env staging --tenant test branding set-logo --file logo.png"],["Upload from an S3 URL","$0 --env staging --tenant test branding set-logo --url https://s3.example/logo.png"]]});file=p.String("--file",{description:"Local image file to upload"});url=p.String("--url",{description:"Fetch the logo image from this URL"});async execute(){let t=await this.caller(),n=this.requireTenant(t),{bytes:r,contentType:i}=await G1(this.file,this.url),o=await z1(t,n,r,i);return await t.mutation(S.branding.platformSetBrandingLogo,{client:n,slot:"primary",storageId:o}),this.print({tenant:n,slot:"primary",contentType:i,bytes:r.length,storageId:o},a=>[{field:"tenant",value:a.tenant},{field:"slot",value:a.slot},{field:"contentType",value:a.contentType},{field:"bytes",value:String(a.bytes)},{field:"storageId",value:a.storageId}]),0}},Xy=class extends C{static{s(this,"BrandingClearLogoCommand")}static paths=[["branding","clear-logo"]];static usage=T.Usage({category:"Branding",description:"Remove a tenant's portal logo (platform-admin)"});async execute(){let t=await this.caller(),n=this.requireTenant(t);return await t.mutation(S.branding.platformClearBrandingLogo,{client:n,slot:"primary"}),this.print({tenant:n,slot:"primary",cleared:!0},r=>[{field:"tenant",value:r.tenant},{field:"slot",value:r.slot},{field:"cleared",value:String(r.cleared)}]),0}};function ZP(e){if(e!=="heading"&&e!=="body")throw new Error(`branding: --slot must be heading or body (got "${e}")`);return e}s(ZP,"parseFontSlot");var ew=class extends C{static{s(this,"BrandingSetFontCommand")}static paths=[["branding","set-font"]];static usage=T.Usage({category:"Branding",description:"Upload a tenant's portal font file (WOFF2) for a slot (platform-admin)",details:"Uploads --file as the font of --slot (heading|body). The backend checks the WOFF2 signature and the 2 MB cap and applies the file under the slot's configured family (`fonts.<slot>.family` \u2014 set it first with `branding set-theme` or `config apply`). A replaced file is deleted. `config apply` carries font files by hash too (`tenant.brandingAssets.fontHeading|fontBody`).",examples:[["Upload the test tenant's heading font to staging","$0 --env staging --tenant test branding set-font --slot heading --file heading.woff2"]]});slot=p.String("--slot",{required:!0,description:"heading | body"});file=p.String("--file",{required:!0,description:"Local .woff2 file"});async execute(){let t=ZP(this.slot),n=G.resolve(this.file),r;try{r=ye(n)}catch{throw new Error(`File not found: ${this.file}`)}let i=await this.caller(),o=this.requireTenant(i),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),{storageId:l}=await i.action(S.brandingFonts.platformSetBrandingFont,{client:o,slot:t,bytes:a});return this.print({tenant:o,slot:t,bytes:r.length,storageId:l},d=>[{field:"tenant",value:d.tenant},{field:"slot",value:d.slot},{field:"bytes",value:String(d.bytes)},{field:"storageId",value:d.storageId}]),0}},tw=class extends C{static{s(this,"BrandingClearFontCommand")}static paths=[["branding","clear-font"]];static usage=T.Usage({category:"Branding",description:"Remove a tenant's portal font file for a slot (platform-admin; the family stays)"});slot=p.String("--slot",{required:!0,description:"heading | body"});async execute(){let t=ZP(this.slot),n=await this.caller(),r=this.requireTenant(n);return await n.mutation(S.branding.platformClearBrandingFont,{client:r,slot:t}),this.print({tenant:r,slot:t,cleared:!0},i=>[{field:"tenant",value:i.tenant},{field:"slot",value:i.slot},{field:"cleared",value:String(i.cleared)}]),0}},nw=class extends C{static{s(this,"BrandingSetThemeCommand")}static paths=[["branding","set-theme"]];static usage=T.Usage({category:"Branding",description:"Set a tenant's portal theme tokens from a JSON file (platform-admin)",details:"Replaces the branding THEME (colors/radius/logoSize/bannerDensity/filledHeader/websiteUrl/font families) wholesale from --file. Does NOT touch the uploaded logo or font files (see `branding set-logo` / `branding set-font`). The same brand tokens `config apply` writes, but surgical \u2014 it touches only branding, not the rest of the tenant config.",examples:[["Apply the test tenant's theme to staging","$0 --env staging --tenant test branding set-theme --file theme.json"]]});file=p.String("--file",{required:!0,description:"Branding theme JSON"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=G.resolve(this.file),i;try{i=JSON.parse(ye(r,"utf8"))}catch(o){throw new Error(`Cannot read branding JSON ${this.file}: ${yn(o)}`,{cause:o})}return await t.mutation(S.branding.platformUpdateBranding,{client:n,branding:i}),this.print({tenant:n,applied:!0},o=>[{field:"tenant",value:o.tenant},{field:"applied",value:String(o.applied)}]),0}},rw=class extends C{static{s(this,"BrandingShowCommand")}static paths=[["branding","show"]];static usage=T.Usage({category:"Branding",description:"Show a tenant's current branding + resolved logo and font-file URLs (platform-admin)"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.branding.platformGetBranding,{client:n});return this.print(r),0}},XP=[rw,nw,Zy,Xy,ew,tw];var js=s(()=>p.String("--output",{hidden:!0}),"retiredOutputOption"),En=s(()=>p.Boolean("--force",!1,{description:"Overwrite an existing --out file."}),"forceOption");function Bs(e){if(e.retiredOutput===void 0)return e.out;if(e.out!==void 0&&e.out!==e.retiredOutput)throw new Ie(`--out "${e.out}" and --output "${e.retiredOutput}" disagree \u2014 pass only --out.`);return it(e.context.stderr,"--output","--out"),e.retiredOutput}s(Bs,"resolveOut");function fr(e,t){let n=G.resolve(e);if(Ae(n)&&!t)throw new Ie(`${n} exists \u2014 pick another --out or pass --force.`);return n}s(fr,"assertOutFree");function W1(e){try{return br(e)}catch{throw new Ie(`${e} is not a directory \u2014 --out names a directory here.`)}}s(W1,"entriesOf");function iw(e,t){let n=G.resolve(e);if(Ae(n)&&W1(n).length>0&&!t)throw new Ie(`${n} is not empty \u2014 pick another --out or pass --force.`);return n}s(iw,"assertOutDirFree");function e_(e,t,n){let r=fr(e,n),i=t.map(o=>G.join(G.dirname(r),o)).filter(o=>Ae(o));if(i.length>0&&!n)throw new Ie(`${i.join(", ")} exist(s) beside --out \u2014 pick another directory or pass --force.`);return r}s(e_,"assertSnapshotOutFree");function jf(e){(!Number.isSafeInteger(e)||e<0)&&ce("INVALID",{de:"Betr\xE4ge m\xFCssen nichtnegative ganze Centbetr\xE4ge sein.",en:"Amounts must be non-negative whole amounts in cents."})}s(jf,"assertMoney");var ow=["month","year","once","unit"];function wo(e,t){return ce("CONFLICT",{de:e,en:t})}s(wo,"missing");function t_(e,t,n){return{label:t,kind:"chosen",valueType:"choice",choices:n,resolve(r){let i=r.selections?.[e];return(!i||!n.includes(i))&&wo(`Die Auswahl f\xFCr \u201E${t.de}\u201C fehlt oder ist ung\xFCltig.`,`The selection for \u201C${t.en}\u201D is missing or invalid.`),{value:i,explanation:{de:`${t.de}: ${i} (Vertragsauswahl)`,en:`${t.en}: ${i} (contract selection)`}}}}}s(t_,"chosen");function sw(e,t){let n=e.enrollment,r=n?.contextDate??t;return(!n||!n.startDate||n.startDate>r||n.endDate&&n.endDate<r)&&wo("F\xFCr dieses Datum fehlt eine eindeutige Einschreibung.","An unambiguous enrollment is missing for this date."),n}s(sw,"enrollment");var H1={paymentFrequency:t_("paymentFrequency",{de:"Zahlungsweise",en:"Payment frequency"},["monthly","yearly"]),gradeLevel:{label:{de:"Klassenstufe",en:"Grade level"},kind:"derived",valueType:"integer",resolve(e,t){let n=sw(e,t).gradeLevel;return(!Number.isSafeInteger(n)||n<1)&&wo("Die Klassenstufe fehlt.","The grade level is missing."),{value:n,explanation:{de:`Klassenstufe ${n} am ${t}`,en:`Grade ${n} on ${t}`}}}},schoolYear:{label:{de:"Schuljahr",en:"School year"},kind:"derived",valueType:"integer",resolve(e,t){let n=sw(e,t).schoolYear;return(!Number.isSafeInteger(n)||n<1)&&wo("F\xFCr dieses Datum fehlt ein j\xE4hrlicher Schuljahreslauf.","An annual school-year run is missing for this date."),{value:n,explanation:{de:`Schuljahr ${n}/${n+1}`,en:`School year ${n}/${n+1}`}}}},siblingRank:{label:{de:"Geschwisterrang",en:"Sibling rank"},kind:"derived",valueType:"integer",resolve(e,t){e.unavailable?.siblingRank&&ce("CONFLICT",e.unavailable.siblingRank);let n=e.siblings?.filter(o=>o.eligible);(!e.partyId||!n?.some(o=>o.partyId===e.partyId))&&wo("F\xFCr dieses Datum fehlt die Sch\xFClerrolle des Kindes.","The child\u2019s Student role is missing for this date."),n.some(o=>!o.birthDate||!/^\d{4}-\d{2}-\d{2}$/.test(o.birthDate)||!Number.isFinite(new Date(`${o.birthDate}T00:00:00Z`).valueOf())||new Date(`${o.birthDate}T00:00:00Z`).toISOString().slice(0,10)!==o.birthDate||o.birthDate>t)&&wo("F\xFCr den Geschwisterrang fehlt ein g\xFCltiges Geburtsdatum.","A valid birth date is missing for sibling ranking.");let r=[...new Map(n.map(o=>[o.partyId,o])).values()].sort((o,a)=>o.birthDate<a.birthDate?-1:o.birthDate>a.birthDate?1:o.partyId<a.partyId?-1:o.partyId>a.partyId?1:0),i=r.findIndex(o=>o.partyId===e.partyId)+1;return{value:i,explanation:{de:`${i}. Kind von ${r.length} berechtigten Kindern am ${t}; \xE4lteste zuerst, bei gleichem Geburtsdatum nach Personen-ID.`,en:`Child ${i} of ${r.length} eligible children on ${t}; oldest first, then party ID for equal birth dates.`}}}},program:{label:{de:"Programm",en:"Program"},kind:"derived",valueType:"program",resolve(e,t){let n=sw(e,t).programId;return n||wo("Das Programm fehlt.","The program is missing."),{value:n,explanation:{de:`Programm der Einschreibung am ${t}`,en:`Enrollment program on ${t}`}}}},admissionFeeTier:t_("admissionFeeTier",{de:"Anmeldegeb\xFChrensatz",en:"Admission fee tier"},["100","75","50"])},Y1=Object.fromEntries(Object.entries(H1).map(([e,t])=>[e,{...t,matchSchema:{parse(n){return Q1(t,n),n}},matches:J1}])),Ope=Object.keys(Y1);function J1(e,t){return"else"in t?!0:"eq"in t?e===t.eq:"in"in t?t.in.includes(e):typeof e=="number"&&(t.gte===void 0||e>=t.gte)&&(t.lte===void 0||e<=t.lte)}s(J1,"matchesPrice");function Q1(e,t){let n=s(()=>ce("INVALID",{de:"Der Match passt nicht zum Preiskriterium.",en:"The match does not fit the price criterion."}),"fail");if(!t||typeof t!="object"||Array.isArray(t))return n();let r=t,i=Object.keys(r).sort().join();if(i==="else"&&r.else===!0)return;let o=s(a=>e.valueType==="integer"?Number.isSafeInteger(a)&&Number(a)>=1:typeof a=="string"&&a.length>0&&(e.valueType!=="choice"||e.choices.includes(a)),"validValue");if(!(i==="eq"&&o(r.eq))&&!(i==="in"&&Array.isArray(r.in)&&r.in.length>0&&new Set(r.in).size===r.in.length&&r.in.every(o))&&!(e.valueType==="integer"&&["gte","lte","gte,lte"].includes(i)&&Object.values(r).every(a=>Number.isSafeInteger(a)&&Number(a)>=1)&&(r.gte===void 0||r.lte===void 0||Number(r.gte)<=Number(r.lte))))return n()}s(Q1,"validateMatch");function n_(e,t){if(Object.keys(t).some(n=>!["percent","amountMinor"].includes(n))&&ce("INVALID",{de:"Die Erm\xE4\xDFigung braucht genau eine Prozentregel oder einen Centbetrag.",en:"The reduction needs exactly one percentage rule or one amount in cents."}),e==="percent"&&"percent"in t&&!("amountMinor"in t)){(!Number.isFinite(t.percent)||t.percent<0||t.percent>100)&&ce("INVALID",{de:"Prozentwerte m\xFCssen zwischen 0 und 100 liegen.",en:"Percentages must be between 0 and 100."});return}if(e==="absolute"&&"amountMinor"in t&&!("percent"in t))return jf(t.amountMinor);ce("INVALID",{de:"Die Erm\xE4\xDFigung braucht genau eine Prozentregel oder einen Centbetrag.",en:"The reduction needs exactly one percentage rule or one amount in cents."})}s(n_,"validateRule");var Z1=/^[a-z][a-z0-9_-]{0,63}$/;function r_(e){return Z1.test(e)}s(r_,"isTemplateConfigKey");import{createHash as i2}from"node:crypto";import{inflateRawSync as o2}from"node:zlib";var i_=/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/,X1=/{{\s*([^{}]+?)\s*}}|<<\s*([^<>]+?)\s*>>/g,e2=/^[#/]\s*/;function t2(e){let t=e.trim(),n=t.match(/^{{\s*([^{}]+?)\s*}}$/);if(n)return n[1]?.trim()??t;let r=t.match(/^<<\s*([^<>]+?)\s*>>$/);return r?r[1]?.trim()??t:t}s(t2,"innerTemplatePlaceholder");function Bf(e){return t2(e).replace(e2,"")}s(Bf,"normalizeTemplatePlaceholderKey");function Uf(e){return Bf(e).toLowerCase()}s(Uf,"canonicalTemplatePlaceholderKey");function o_(e){let t=new Map;for(let n of n2(e))t.has(n.key)||t.set(n.key,n.placeholder);return Array.from(t.entries()).sort(([n],[r])=>n.localeCompare(r,"de")).map(([,n])=>n)}s(o_,"extractTemplatePlaceholders");function n2(e){let t=[];for(let n of e.matchAll(X1)){let r=Bf(n[1]??n[2]??"");r&&t.push({key:Uf(r),placeholder:n[0].trim()})}return t}s(n2,"extractTemplatePlaceholderOccurrences");var s_=/^word\/(document|header\d+|footer\d+|footnotes|endnotes)\.xml$/;function r2(e){return e.replace(/<[^>]+>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&#(\d+);/g,(t,n)=>String.fromCodePoint(Number(n))).replace(/&#x([0-9a-f]+);/gi,(t,n)=>String.fromCodePoint(parseInt(n,16))).replace(/&amp;/g,"&")}s(r2,"templateXmlText");function a_(e){return e.map(r2).join(`
10052
+ `,examples:[["Portal application to an offer",`$0 assignment simulate --dir ~/scratch/kindergarten-r17 --env-json '{"applicant":{"language":"de","channel":"self-service"}}'`],["The next pick of a \u201EReihum\u201C row whose last start took 'finanzen'","$0 assignment simulate --dir <bundle> --env-file env.json --rotation-previous team:finanzen=finanzen"],["A leastLoaded rotation with open-task counts","$0 assignment simulate --dir <bundle> --env-file env.json --open finanzen=3 --open finanzen_2=1"]]});dir=p.String("--dir",{required:!0,description:"Offer bundle directory (its workflow.json carries the rule)"});envJson=p.String("--env-json",{description:"The application's environment ($env) as JSON"});envFile=p.String("--env-file",{description:"\u2026or a file holding it"});creator=p.String("--creator",{description:"Label for the staff creator (only a staff start has one)"});rotationPrevious=p.Array("--rotation-previous",{description:"<slot>=<personKey>: the last pick of that slot's \u201EReihum\u201C row (repeatable; none = its first start)"});left=p.Array("--left",{description:"<personKey>: someone who has left \u2014 every rotation skips them (repeatable)"});open=p.Array("--open",{description:"<personKey>=<n>: open tasks, for a leastLoaded rotation (repeatable; absent = 0)"});async execute(){let t=Ke(this.dir),n=DO(t.workflow?.graph,`bundle ${this.dir}`),r=U1(this.envJson,this.envFile),i=HP(n,r,{...this.creator!==void 0?{creator:this.creator}:{},rotationPrevious:YP("--rotation-previous",this.rotationPrevious),openCounts:B1(this.open),left:this.left??[]});return this.print(i,o=>o.slots.map(a=>({slot:a.slot,row:`#${a.row}`,value:a.value,rotation:a.rotation===void 0?"":`${a.rotation.mode} [${a.rotation.pool.join(", ")}] after ${a.rotation.previous??"\u2014"} \u2192 ${a.rotation.picked}`}))),0}},JP=[Qy];var V1={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif",".svg":"image/svg+xml",".avif":"image/avif"};function QP(e){return V1[G.extname(e).toLowerCase()]}s(QP,"guessImageContentType");async function G1(e,t){if(e===void 0==(t===void 0))throw new Error("Pass exactly one of --file <path> or --url <url>.");if(t!==void 0&&st())throw new Error("Hosted agents cannot fetch arbitrary logo URLs. Upload the image to the chat and use --file <path>.");if(e!==void 0){let a=G.resolve(e),l;try{l=ye(a)}catch{throw new Error(`File not found: ${e}`)}let d=QP(a);if(d===void 0)throw new Error(`Cannot infer an image content-type from "${G.basename(a)}" \u2014 use a .png/.jpg/.webp/.gif file.`);return{bytes:new Uint8Array(l),contentType:d}}let n=await fetch(t);if(!n.ok)throw new Error(`Fetch failed for ${t} (${n.status} ${n.statusText}).`);let r=new Uint8Array(await n.arrayBuffer()),i=n.headers.get("content-type")?.split(";")[0]?.trim(),o=i&&i.startsWith("image/")?i:QP(new URL(t).pathname);if(o===void 0)throw new Error(`Response for ${t} is not an image (content-type "${i??"unknown"}").`);return{bytes:r,contentType:o}}s(G1,"loadLogoBytes");async function z1(e,t,n,r){let i=await e.mutation(S.branding.platformGenerateBrandingLogoUploadUrl,{client:t});return e.upload(i,n,r)}s(z1,"uploadLogo");var Zy=class extends C{static{s(this,"BrandingSetLogoCommand")}static paths=[["branding","set-logo"]];static usage=T.Usage({category:"Branding",description:"Upload a tenant's portal logo",details:"Sets the external-portal logo for --tenant from a local --file or a remote --url. A one-off upload without the tenant's Branding admin UI. To move the logo with the rest of the config (export \u2192 apply, env \u2192 env), use `config apply` \u2014 it carries the file by hash (`tenant.brandingAssets.logo`).",examples:[["Upload the test tenant's logo to staging from a file","$0 --env staging --tenant test branding set-logo --file logo.png"],["Upload from an S3 URL","$0 --env staging --tenant test branding set-logo --url https://s3.example/logo.png"]]});file=p.String("--file",{description:"Local image file to upload"});url=p.String("--url",{description:"Fetch the logo image from this URL"});async execute(){let t=await this.caller(),n=this.requireTenant(t),{bytes:r,contentType:i}=await G1(this.file,this.url),o=await z1(t,n,r,i);return await t.mutation(S.branding.platformSetBrandingLogo,{client:n,slot:"primary",storageId:o}),this.print({tenant:n,slot:"primary",contentType:i,bytes:r.length,storageId:o},a=>[{field:"tenant",value:a.tenant},{field:"slot",value:a.slot},{field:"contentType",value:a.contentType},{field:"bytes",value:String(a.bytes)},{field:"storageId",value:a.storageId}]),0}},Xy=class extends C{static{s(this,"BrandingClearLogoCommand")}static paths=[["branding","clear-logo"]];static usage=T.Usage({category:"Branding",description:"Remove a tenant's portal logo"});async execute(){let t=await this.caller(),n=this.requireTenant(t);return await t.mutation(S.branding.platformClearBrandingLogo,{client:n,slot:"primary"}),this.print({tenant:n,slot:"primary",cleared:!0},r=>[{field:"tenant",value:r.tenant},{field:"slot",value:r.slot},{field:"cleared",value:String(r.cleared)}]),0}};function ZP(e){if(e!=="heading"&&e!=="body")throw new Error(`branding: --slot must be heading or body (got "${e}")`);return e}s(ZP,"parseFontSlot");var ew=class extends C{static{s(this,"BrandingSetFontCommand")}static paths=[["branding","set-font"]];static usage=T.Usage({category:"Branding",description:"Upload a tenant's portal font file (WOFF2) for a slot",details:"Uploads --file as the font of --slot (heading|body). The backend checks the WOFF2 signature and the 2 MB cap and applies the file under the slot's configured family (`fonts.<slot>.family` \u2014 set it first with `branding set-theme` or `config apply`). A replaced file is deleted. `config apply` carries font files by hash too (`tenant.brandingAssets.fontHeading|fontBody`).",examples:[["Upload the test tenant's heading font to staging","$0 --env staging --tenant test branding set-font --slot heading --file heading.woff2"]]});slot=p.String("--slot",{required:!0,description:"heading | body"});file=p.String("--file",{required:!0,description:"Local .woff2 file"});async execute(){let t=ZP(this.slot),n=G.resolve(this.file),r;try{r=ye(n)}catch{throw new Error(`File not found: ${this.file}`)}let i=await this.caller(),o=this.requireTenant(i),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),{storageId:l}=await i.action(S.brandingFonts.platformSetBrandingFont,{client:o,slot:t,bytes:a});return this.print({tenant:o,slot:t,bytes:r.length,storageId:l},d=>[{field:"tenant",value:d.tenant},{field:"slot",value:d.slot},{field:"bytes",value:String(d.bytes)},{field:"storageId",value:d.storageId}]),0}},tw=class extends C{static{s(this,"BrandingClearFontCommand")}static paths=[["branding","clear-font"]];static usage=T.Usage({category:"Branding",description:"Remove a tenant's portal font file for a slot (the family stays)"});slot=p.String("--slot",{required:!0,description:"heading | body"});async execute(){let t=ZP(this.slot),n=await this.caller(),r=this.requireTenant(n);return await n.mutation(S.branding.platformClearBrandingFont,{client:r,slot:t}),this.print({tenant:r,slot:t,cleared:!0},i=>[{field:"tenant",value:i.tenant},{field:"slot",value:i.slot},{field:"cleared",value:String(i.cleared)}]),0}},nw=class extends C{static{s(this,"BrandingSetThemeCommand")}static paths=[["branding","set-theme"]];static usage=T.Usage({category:"Branding",description:"Set a tenant's portal theme tokens from a JSON file",details:"Replaces the branding THEME (colors/radius/logoSize/bannerDensity/filledHeader/websiteUrl/font families) wholesale from --file. Does NOT touch the uploaded logo or font files (see `branding set-logo` / `branding set-font`). The same brand tokens `config apply` writes, but surgical \u2014 it touches only branding, not the rest of the tenant config.",examples:[["Apply the test tenant's theme to staging","$0 --env staging --tenant test branding set-theme --file theme.json"]]});file=p.String("--file",{required:!0,description:"Branding theme JSON"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=G.resolve(this.file),i;try{i=JSON.parse(ye(r,"utf8"))}catch(o){throw new Error(`Cannot read branding JSON ${this.file}: ${yn(o)}`,{cause:o})}return await t.mutation(S.branding.platformUpdateBranding,{client:n,branding:i}),this.print({tenant:n,applied:!0},o=>[{field:"tenant",value:o.tenant},{field:"applied",value:String(o.applied)}]),0}},rw=class extends C{static{s(this,"BrandingShowCommand")}static paths=[["branding","show"]];static usage=T.Usage({category:"Branding",description:"Show a tenant's current branding + resolved logo and font-file URLs"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.branding.platformGetBranding,{client:n});return this.print(r),0}},XP=[rw,nw,Zy,Xy,ew,tw];var js=s(()=>p.String("--output",{hidden:!0}),"retiredOutputOption"),En=s(()=>p.Boolean("--force",!1,{description:"Overwrite an existing --out file."}),"forceOption");function Bs(e){if(e.retiredOutput===void 0)return e.out;if(e.out!==void 0&&e.out!==e.retiredOutput)throw new Ie(`--out "${e.out}" and --output "${e.retiredOutput}" disagree \u2014 pass only --out.`);return it(e.context.stderr,"--output","--out"),e.retiredOutput}s(Bs,"resolveOut");function fr(e,t){let n=G.resolve(e);if(Ae(n)&&!t)throw new Ie(`${n} exists \u2014 pick another --out or pass --force.`);return n}s(fr,"assertOutFree");function W1(e){try{return br(e)}catch{throw new Ie(`${e} is not a directory \u2014 --out names a directory here.`)}}s(W1,"entriesOf");function iw(e,t){let n=G.resolve(e);if(Ae(n)&&W1(n).length>0&&!t)throw new Ie(`${n} is not empty \u2014 pick another --out or pass --force.`);return n}s(iw,"assertOutDirFree");function e_(e,t,n){let r=fr(e,n),i=t.map(o=>G.join(G.dirname(r),o)).filter(o=>Ae(o));if(i.length>0&&!n)throw new Ie(`${i.join(", ")} exist(s) beside --out \u2014 pick another directory or pass --force.`);return r}s(e_,"assertSnapshotOutFree");function jf(e){(!Number.isSafeInteger(e)||e<0)&&ce("INVALID",{de:"Betr\xE4ge m\xFCssen nichtnegative ganze Centbetr\xE4ge sein.",en:"Amounts must be non-negative whole amounts in cents."})}s(jf,"assertMoney");var ow=["month","year","once","unit"];function wo(e,t){return ce("CONFLICT",{de:e,en:t})}s(wo,"missing");function t_(e,t,n){return{label:t,kind:"chosen",valueType:"choice",choices:n,resolve(r){let i=r.selections?.[e];return(!i||!n.includes(i))&&wo(`Die Auswahl f\xFCr \u201E${t.de}\u201C fehlt oder ist ung\xFCltig.`,`The selection for \u201C${t.en}\u201D is missing or invalid.`),{value:i,explanation:{de:`${t.de}: ${i} (Vertragsauswahl)`,en:`${t.en}: ${i} (contract selection)`}}}}}s(t_,"chosen");function sw(e,t){let n=e.enrollment,r=n?.contextDate??t;return(!n||!n.startDate||n.startDate>r||n.endDate&&n.endDate<r)&&wo("F\xFCr dieses Datum fehlt eine eindeutige Einschreibung.","An unambiguous enrollment is missing for this date."),n}s(sw,"enrollment");var H1={paymentFrequency:t_("paymentFrequency",{de:"Zahlungsweise",en:"Payment frequency"},["monthly","yearly"]),gradeLevel:{label:{de:"Klassenstufe",en:"Grade level"},kind:"derived",valueType:"integer",resolve(e,t){let n=sw(e,t).gradeLevel;return(!Number.isSafeInteger(n)||n<1)&&wo("Die Klassenstufe fehlt.","The grade level is missing."),{value:n,explanation:{de:`Klassenstufe ${n} am ${t}`,en:`Grade ${n} on ${t}`}}}},schoolYear:{label:{de:"Schuljahr",en:"School year"},kind:"derived",valueType:"integer",resolve(e,t){let n=sw(e,t).schoolYear;return(!Number.isSafeInteger(n)||n<1)&&wo("F\xFCr dieses Datum fehlt ein j\xE4hrlicher Schuljahreslauf.","An annual school-year run is missing for this date."),{value:n,explanation:{de:`Schuljahr ${n}/${n+1}`,en:`School year ${n}/${n+1}`}}}},siblingRank:{label:{de:"Geschwisterrang",en:"Sibling rank"},kind:"derived",valueType:"integer",resolve(e,t){e.unavailable?.siblingRank&&ce("CONFLICT",e.unavailable.siblingRank);let n=e.siblings?.filter(o=>o.eligible);(!e.partyId||!n?.some(o=>o.partyId===e.partyId))&&wo("F\xFCr dieses Datum fehlt die Sch\xFClerrolle des Kindes.","The child\u2019s Student role is missing for this date."),n.some(o=>!o.birthDate||!/^\d{4}-\d{2}-\d{2}$/.test(o.birthDate)||!Number.isFinite(new Date(`${o.birthDate}T00:00:00Z`).valueOf())||new Date(`${o.birthDate}T00:00:00Z`).toISOString().slice(0,10)!==o.birthDate||o.birthDate>t)&&wo("F\xFCr den Geschwisterrang fehlt ein g\xFCltiges Geburtsdatum.","A valid birth date is missing for sibling ranking.");let r=[...new Map(n.map(o=>[o.partyId,o])).values()].sort((o,a)=>o.birthDate<a.birthDate?-1:o.birthDate>a.birthDate?1:o.partyId<a.partyId?-1:o.partyId>a.partyId?1:0),i=r.findIndex(o=>o.partyId===e.partyId)+1;return{value:i,explanation:{de:`${i}. Kind von ${r.length} berechtigten Kindern am ${t}; \xE4lteste zuerst, bei gleichem Geburtsdatum nach Personen-ID.`,en:`Child ${i} of ${r.length} eligible children on ${t}; oldest first, then party ID for equal birth dates.`}}}},program:{label:{de:"Programm",en:"Program"},kind:"derived",valueType:"program",resolve(e,t){let n=sw(e,t).programId;return n||wo("Das Programm fehlt.","The program is missing."),{value:n,explanation:{de:`Programm der Einschreibung am ${t}`,en:`Enrollment program on ${t}`}}}},admissionFeeTier:t_("admissionFeeTier",{de:"Anmeldegeb\xFChrensatz",en:"Admission fee tier"},["100","75","50"])},Y1=Object.fromEntries(Object.entries(H1).map(([e,t])=>[e,{...t,matchSchema:{parse(n){return Q1(t,n),n}},matches:J1}])),Ope=Object.keys(Y1);function J1(e,t){return"else"in t?!0:"eq"in t?e===t.eq:"in"in t?t.in.includes(e):typeof e=="number"&&(t.gte===void 0||e>=t.gte)&&(t.lte===void 0||e<=t.lte)}s(J1,"matchesPrice");function Q1(e,t){let n=s(()=>ce("INVALID",{de:"Der Match passt nicht zum Preiskriterium.",en:"The match does not fit the price criterion."}),"fail");if(!t||typeof t!="object"||Array.isArray(t))return n();let r=t,i=Object.keys(r).sort().join();if(i==="else"&&r.else===!0)return;let o=s(a=>e.valueType==="integer"?Number.isSafeInteger(a)&&Number(a)>=1:typeof a=="string"&&a.length>0&&(e.valueType!=="choice"||e.choices.includes(a)),"validValue");if(!(i==="eq"&&o(r.eq))&&!(i==="in"&&Array.isArray(r.in)&&r.in.length>0&&new Set(r.in).size===r.in.length&&r.in.every(o))&&!(e.valueType==="integer"&&["gte","lte","gte,lte"].includes(i)&&Object.values(r).every(a=>Number.isSafeInteger(a)&&Number(a)>=1)&&(r.gte===void 0||r.lte===void 0||Number(r.gte)<=Number(r.lte))))return n()}s(Q1,"validateMatch");function n_(e,t){if(Object.keys(t).some(n=>!["percent","amountMinor"].includes(n))&&ce("INVALID",{de:"Die Erm\xE4\xDFigung braucht genau eine Prozentregel oder einen Centbetrag.",en:"The reduction needs exactly one percentage rule or one amount in cents."}),e==="percent"&&"percent"in t&&!("amountMinor"in t)){(!Number.isFinite(t.percent)||t.percent<0||t.percent>100)&&ce("INVALID",{de:"Prozentwerte m\xFCssen zwischen 0 und 100 liegen.",en:"Percentages must be between 0 and 100."});return}if(e==="absolute"&&"amountMinor"in t&&!("percent"in t))return jf(t.amountMinor);ce("INVALID",{de:"Die Erm\xE4\xDFigung braucht genau eine Prozentregel oder einen Centbetrag.",en:"The reduction needs exactly one percentage rule or one amount in cents."})}s(n_,"validateRule");var Z1=/^[a-z][a-z0-9_-]{0,63}$/;function r_(e){return Z1.test(e)}s(r_,"isTemplateConfigKey");import{createHash as i2}from"node:crypto";import{inflateRawSync as o2}from"node:zlib";var i_=/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/,X1=/{{\s*([^{}]+?)\s*}}|<<\s*([^<>]+?)\s*>>/g,e2=/^[#/]\s*/;function t2(e){let t=e.trim(),n=t.match(/^{{\s*([^{}]+?)\s*}}$/);if(n)return n[1]?.trim()??t;let r=t.match(/^<<\s*([^<>]+?)\s*>>$/);return r?r[1]?.trim()??t:t}s(t2,"innerTemplatePlaceholder");function Bf(e){return t2(e).replace(e2,"")}s(Bf,"normalizeTemplatePlaceholderKey");function Uf(e){return Bf(e).toLowerCase()}s(Uf,"canonicalTemplatePlaceholderKey");function o_(e){let t=new Map;for(let n of n2(e))t.has(n.key)||t.set(n.key,n.placeholder);return Array.from(t.entries()).sort(([n],[r])=>n.localeCompare(r,"de")).map(([,n])=>n)}s(o_,"extractTemplatePlaceholders");function n2(e){let t=[];for(let n of e.matchAll(X1)){let r=Bf(n[1]??n[2]??"");r&&t.push({key:Uf(r),placeholder:n[0].trim()})}return t}s(n2,"extractTemplatePlaceholderOccurrences");var s_=/^word\/(document|header\d+|footer\d+|footnotes|endnotes)\.xml$/;function r2(e){return e.replace(/<[^>]+>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&#(\d+);/g,(t,n)=>String.fromCodePoint(Number(n))).replace(/&#x([0-9a-f]+);/gi,(t,n)=>String.fromCodePoint(parseInt(n,16))).replace(/&amp;/g,"&")}s(r2,"templateXmlText");function a_(e){return e.map(r2).join(`
10053
10053
  `)}s(a_,"templateTextFromParts");var s2="application/vnd.openxmlformats-officedocument.wordprocessingml.document";async function Al(e){let t=G.resolve(e);if(!t.toLowerCase().endsWith(".docx"))throw new Error("Word templates must be a .docx file.");let n=new Uint8Array(await Kn(t));return{file:t,bytes:n,sha256:i2("sha256").update(n).digest("base64"),placeholders:o_(a2(n)).map(Bf)}}s(Al,"readLocalDocx");async function Vf(e,t,n,r){let i=await e.query(S.templates.roleOptions,{client:t}),o=i.find(d=>d.key===r.role);if(o===void 0)throw new Error(`Unknown leaf role "${r.role}". Available: ${i.map(d=>d.key).join(", ")}`);let a=await d_(e,t,n),{templateId:l}=await e.action(S.templateFileActions.create,{client:t,name:r.name,roleId:o.id,storageId:a,filename:G.basename(n.file),...r.configKey===void 0?{}:{configKey:r.configKey},...r.icon===void 0?{}:{icon:r.icon},...r.fileNamePattern===void 0?{}:{fileNamePattern:r.fileNamePattern}});return l}s(Vf,"uploadDocumentTemplate");async function l_(e,t,n,r){let i=await d_(e,t,r);await e.action(S.templateFileActions.replaceFile,{client:t,templateId:n,storageId:i,filename:G.basename(r.file)})}s(l_,"replaceDocumentTemplateFile");async function d_(e,t,n){let{uploadUrl:r,uploadTicket:i}=await e.mutation(S.templates.generateUploadUrl,{client:t}),o=await e.upload(r,n.bytes,s2);return await e.mutation(S.uploads.registerUpload,{uploadTicket:i,storageId:o}),o}s(d_,"stageDocx");function a2(e){let t=l2(e,n=>s_.test(n));if(!t.has("word/document.xml"))throw new Error("word/document.xml not found \u2014 the file is not a readable .docx.");return a_([...t.values()])}s(a2,"docxPlaceholderText");function l2(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=new Error("No ZIP central directory \u2014 the file is not a readable .docx."),i=-1;for(let d=e.length-22;d>=Math.max(0,e.length-22-65535);d--)if(n.getUint32(d,!0)===101010256){i=d;break}if(i<0)throw r;let o=n.getUint16(i+10,!0),a=n.getUint32(i+16,!0),l=new Map;for(let d=0;d<o;d++){if(a+46>e.length||n.getUint32(a,!0)!==33639248)throw r;let c=n.getUint16(a+10,!0),u=n.getUint32(a+20,!0),f=n.getUint16(a+28,!0),m=n.getUint16(a+30,!0),y=n.getUint16(a+32,!0),k=n.getUint32(a+42,!0),g=new TextDecoder().decode(e.subarray(a+46,a+46+f));if(a+=46+f+m+y,!t(g))continue;if(n.getUint32(k,!0)!==67324752)throw r;let v=k+30+n.getUint16(k+26,!0)+n.getUint16(k+28,!0),$=Buffer.from(e.subarray(v,v+u));l.set(g,(c===0?$:o2($)).toString("utf8"))}return l}s(l2,"readZipEntries");function Rt(e,t,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`${n}: ${t} muss ein Objekt sein.`);return e}s(Rt,"record");function Ve(e,t,n){if(typeof e!="string"||e.trim().length===0)throw new Error(`${n}: ${t} fehlt.`);return e.trim()}s(Ve,"text");function dn(e,t,n,r){let i=Et(e);if(i==="not-localized"){let a=typeof e=="string"&&e.trim()!==""?e.trim():"\u2026";throw new Error(`${n}: ${t}: erwartet { "de": "\u2026", "en": "\u2026" } (${r} sind zweisprachig) \u2014 z. B. "name": ${JSON.stringify({de:a,en:"\u2026"})}`)}if(i.length>0)throw new Error(`${n}: ${t}.${i.join(` und ${t}.`)} ${i.length>1?"fehlen":"fehlt"} (${r} sind zweisprachig; kein R\xFCckfall auf Deutsch).`);let o=e;return{de:o.de.trim(),en:o.en.trim()}}s(dn,"localizedName");function _n(e,t,n){if(!Array.isArray(e))throw new Error(`${n}: ${t} muss eine Liste sein.`);return e}s(_n,"list");function Gf(e,t){return _n(e,"revenueAccounts",t).map((n,r)=>{let i=Rt(n,`revenueAccounts[${r}]`,t);return{code:Ve(i.code,`revenueAccounts[${r}].code`,t),name:Ve(i.name,`revenueAccounts[${r}].name`,t)}})}s(Gf,"parseRevenueAccounts");function zf(e,t){return _n(e,"billingItems",t).map((n,r)=>{let i=`billingItems[${r}]`,o=Rt(n,i,t),a=Ve(o.itemType,`${i}.itemType`,t),l=Ve(o.taxTreatment,`${i}.taxTreatment`,t);if(l!=="exempt_ustg_4_nr_21"&&l!=="vat_19"&&l!=="vat_7")throw new Error(`${t}: ${i}.taxTreatment ist unbekannt.`);if(a!=="recurring"&&a!=="one_time"&&a!=="usage")throw new Error(`${t}: ${i}.itemType "${a}" ist unbekannt.`);if(o.minAmount!==void 0)throw new Error(`${t}: ${i}.minAmount wird nicht mehr unterst\xFCtzt; eine Vertragserm\xE4\xDFigung mit Untergrenze verwenden.`);let d=Rt(o.price,`${i}.price`,t),c=d.effectiveFrom===void 0?{}:{effectiveFrom:Ve(d.effectiveFrom,`${i}.price.effectiveFrom`,t)},u=Ve(d.currency,`${i}.price.currency`,t),f=d.tree===void 0?(()=>{let m=Ve(d.period,`${i}.price.period`,t);if(!["month","year","once","unit"].includes(m))throw new Error(`${t}: ${i}.price.period ist unbekannt.`);return{currency:u,amount:d.amount,period:m,...c}})():(()=>{if(d.amount!==void 0||d.period!==void 0)throw new Error(`${t}: ${i}.price: tree wird nicht mit amount oder period kombiniert.`);return{currency:u,tree:Rt(d.tree,`${i}.price.tree`,t),...c}})();return{key:Ve(o.key,`${i}.key`,t),name:dn(o.name,`${i}.name`,t,"Artikelnamen"),itemType:a,revenueAccount:Ve(o.revenueAccount,`${i}.revenueAccount`,t),taxTreatment:l,config:Rt(o.config??{},`${i}.config`,t),...o.programs===void 0?{}:{programs:_n(o.programs,`${i}.programs`,t).map((m,y)=>Ve(m,`${i}.programs[${y}]`,t))},price:f}})}s(zf,"parseBillingItems");var $e="catalog",d2=["sibling","stipend","promo","needsBased","singleParent"],c2=["percent","absolute"];function aw(e,t){let n=new Set;for(let r of e){if(n.has(r))throw new Error(`${$e}: ${t}: Schl\xFCssel "${r}" steht zweimal in der Datei.`);n.add(r)}}s(aw,"uniqueKeys");function Wf(e,t,n){if(!t.includes(e))throw new Error(`${$e}: ${n} "${e}" ist unbekannt (${t.join(", ")}).`);return e}s(Wf,"oneOf");function u2(e,t){let n=Rt(e,"Datei",$e);if(n.plans!==void 0)throw new Error("catalog: plans wurden entfernt. Geb\xFChrengruppen geh\xF6ren in die Generatorrevision; Programmzuordnungen unter billingItems[].programs angeben.");let r=["revenueAccounts","billingItems","grantTemplates","documentTemplates"],i=Object.keys(n).filter(c=>!r.includes(c));if(i.length>0)throw new Error(`${$e}: unbekannte Abschnitte ${i.join(", ")} (erlaubt: ${r.join(", ")}).`);let o=zf(n.billingItems??[],$e).map((c,u)=>{let f=`billingItems[${u}].price`;if(!("tree"in c.price)&&(typeof c.price.amount!="number"||!Number.isFinite(c.price.amount)))throw new Error(`${$e}: ${f}.amount muss eine Zahl sein (${JSON.stringify("amount"in c.price?c.price.amount:null)}).`);if(c.price.effectiveFrom===void 0)throw new Error(`${$e}: ${f}.effectiveFrom fehlt \u2014 der erste Tag, ab dem der Preis gilt (YYYY-MM-DD).`);return{...c,price:"tree"in c.price?{currency:c.price.currency,tree:c.price.tree,effectiveFrom:c.price.effectiveFrom}:{currency:c.price.currency,amount:c.price.amount,effectiveFrom:c.price.effectiveFrom,period:c.price.period}}}),a=_n(n.grantTemplates??[],"grantTemplates",$e).map((c,u)=>{let f=`grantTemplates[${u}]`,m=Rt(c,f,$e);if(m.item!==void 0||m.plan!==void 0||m.value!==void 0)throw new Error(`${$e}: ${f}: eligibleItems, scope und rule statt item/plan/value verwenden.`);if(typeof m.retroactiveRevocation!="boolean")throw new Error(`${$e}: ${f}.retroactiveRevocation muss true oder false sein.`);let y=Wf(Ve(m.scope,`${f}.scope`,$e),["line","aggregate"],`${f}.scope`),k=Wf(Ve(m.kind,`${f}.kind`,$e),c2,`${f}.kind`),g=Rt(m.rule,`${f}.rule`,$e);n_(k,g);let v=Wf(Ve(m.pricePeriod,`${f}.pricePeriod`,$e),["month","year","once","unit"],`${f}.pricePeriod`);if(m.floorTotal!==void 0){if(typeof m.floorTotal!="number"||y!=="aggregate")throw new Error(`${$e}: ${f}.floorTotal geh\xF6rt zu einer Aggregaterm\xE4\xDFigung.`);jf(m.floorTotal)}let $=_n(m.eligibleItems,`${f}.eligibleItems`,$e).map((R,A)=>Ve(R,`${f}.eligibleItems[${A}]`,$e));if($.length===0||new Set($).size!==$.length)throw new Error(`${$e}: ${f}.eligibleItems braucht eindeutige Artikel.`);return{key:Ve(m.key,`${f}.key`,$e),name:dn(m.name,`${f}.name`,$e,"Erm\xE4\xDFigungsnamen"),eligibleItems:$,scope:y,rule:g,pricePeriod:v,...m.floorTotal===void 0?{}:{floorTotal:m.floorTotal},...m.offeredFrom===void 0?{}:{offeredFrom:Ve(m.offeredFrom,`${f}.offeredFrom`,$e)},...m.offeredUntil===void 0?{}:{offeredUntil:Ve(m.offeredUntil,`${f}.offeredUntil`,$e)},reason:Wf(Ve(m.reason,`${f}.reason`,$e),d2,`${f}.reason`),kind:k,eligibility:Rt(m.eligibility,`${f}.eligibility`,$e),retroactiveRevocation:m.retroactiveRevocation}}),l=_n(n.documentTemplates??[],"documentTemplates",$e).map((c,u)=>{let f=`documentTemplates[${u}]`,m=Rt(c,f,$e),y=Ve(m.key,`${f}.key`,$e);if(!r_(y))throw new Error(`${$e}: ${f}.key "${y}" ist kein g\xFCltiger Vorlagen-Schl\xFCssel (Kleinbuchstaben, Ziffern, - und _, beginnend mit einem Buchstaben).`);let k=G.resolve(t,Ve(m.file,`${f}.file`,$e));if(!k.toLowerCase().endsWith(".docx"))throw new Error(`${$e}: ${f}.file muss eine .docx sein.`);return{key:y,name:dn(m.name,`${f}.name`,$e,"Vorlagennamen"),file:k,role:Ve(m.role,`${f}.role`,$e),...m.icon===void 0?{}:{icon:Ve(m.icon,`${f}.icon`,$e)},...m.fileNamePattern===void 0?{}:{fileNamePattern:Ve(m.fileNamePattern,`${f}.fileNamePattern`,$e)},...m.parameters===void 0?{}:{parameters:m.parameters===null?null:f2(m.parameters,`${f}.parameters`)}}});aw(o.map(c=>c.key),"billingItems"),aw(a.map(c=>c.key),"grantTemplates");for(let[c,u]of o.entries()){if(u.programs===void 0)throw new Error(`${$e}: billingItems[${c}] (${u.key}) geh\xF6rt keinem Programm \u2014 "programs" nennen (die Programm-Schl\xFCssel, die den Artikel einzeln verkaufen; [] f\xFCr einen stillgelegten Artikel) oder den Artikel in ein Paket aufnehmen.`);if(u.programs!==void 0&&new Set(u.programs).size!==u.programs.length)throw new Error(`${$e}: billingItems[${c}].programs: ein Programm steht zweimal.`)}aw(l.map(c=>c.key),"documentTemplates");let d=Gf(n.revenueAccounts??[],$e);if(d.length+o.length+a.length+l.length===0)throw new Error(`${$e}: die Datei deklariert nichts (${r.join(", ")}).`);return{revenueAccounts:d,billingItems:o,grantTemplates:a,documentTemplates:l}}s(u2,"parseCatalog");function lw(e){let t=G.resolve(e);if(!Ae(t))throw new Error(`${$e}: ${t} gibt es nicht.`);return u2(JSON.parse(ye(t,"utf8")),G.dirname(t))}s(lw,"readCatalog");function f2(e,t){let n=Rt(e,t,$e);return _n(n.fields,`${t}.fields`,$e),n}s(f2,"declaredParameters");function p2(e){return{revenueAccounts:e.revenueAccounts,billingItems:e.billingItems.map(t=>({key:t.key,name:t.name,itemType:t.itemType,revenueAccountCode:t.revenueAccount,taxTreatment:t.taxTreatment,config:t.config,price:t.price,programs:t.programs}))}}s(p2,"billingArgs");function m2(e){return{articlePrograms:e.billingItems.map(t=>({item:t.key,programs:t.programs??[]}))}}s(m2,"planArgs");async function dw(e,t,n,r=Al){let i=[],o=[],a=null;if(n.billingItems.length>0||n.revenueAccounts.length>0){a=p2(n);let u=await e.query(S.contractSetup.planBillingSetup,{client:t,...a});for(let f of u.rows)i.push({step:f.kind,target:f.key,action:f.action,detail:f.detail}),f.kind==="billingItem"&&f.action==="create"&&o.push(f.key)}let l=null;if(n.billingItems.length>0){l=m2(n);let u=await e.query(S.catalogPrograms.planProgramSetup,{client:t,...l,pendingItems:o});for(let f of u.rows)i.push({step:f.kind,target:f.key,action:f.action,detail:f.detail?.de??""});for(let f of n.billingItems)f.programs?.length===0&&i.push({step:"billingItemProgram",target:f.key,action:"none",detail:"kein Programm verkauft den Artikel (stillgelegt?) \u2014 Finanzen zeigt \u201EKein Programm\u201C"})}let d=null;if(n.grantTemplates.length>0){d={grantTemplates:n.grantTemplates};let u=await e.query(S.contractSetup.planGrantSetup,{client:t,grantTemplates:n.grantTemplates,pendingItems:o});for(let f of u.rows)i.push({step:"grantTemplate",target:f.key,action:f.action,detail:f.detail})}let c=[];if(n.documentTemplates.length>0){let u=await e.query(S.templates.roleOptions,{client:t});for(let f of n.documentTemplates){let m=u.find(A=>A.key===f.role);if(m===void 0)throw new Error(`${$e}: Vorlage ${f.key}: Rolle "${f.role}" ist keine Blatt-Rolle dieses Mandanten (${u.map(A=>A.key).join(", ")}).`);let y=await r(f.file),k=await e.query(S.templates.stateByConfigKey,{client:t,configKey:f.key});if(k!==null&&k.roleKey!==f.role)throw new Error(`${$e}: Vorlage ${f.key} geh\xF6rt zur Rolle "${k.roleKey}", die Datei nennt "${f.role}" \u2014 die Rolle einer bestehenden Vorlage \xE4ndert catalog nicht (Vorlagenverwaltung).`);let g=k===null||k.sha256!==y.sha256,v=f.parameters!==void 0&&Pe(f.parameters)!==Pe(k?.parameters??null),$=[];k!==null&&(os(k.name,f.name)||$.push(`Name ${k.name.de} / ${k.name.en||"\u2014"} \u2192 ${f.name.de} / ${f.name.en}`),f.icon!==void 0&&k.icon!==f.icon&&$.push(`Icon \u2192 ${f.icon}`),f.fileNamePattern!==void 0&&k.fileNamePattern!==f.fileNamePattern&&$.push("Dateinamensmuster")),c.push({declared:f,docx:y,roleId:m.id,state:k,upload:g,metadata:$,parametersChange:v});let R=v?[f.parameters===null?"Parameter entfernen":`Parameter (${f.parameters.fields.length} Felder)`]:[];i.push({step:"documentTemplate",target:f.key,action:k===null?"create":g||$.length>0||v?"update":"same",detail:k===null?[`${f.name.de} \xB7 ${G.basename(f.file)}`,...R].join(", "):[...g?[`Datei ersetzen (${G.basename(f.file)})`]:[],...$,...R].join(", ")})}}return{rows:i,billing:a,programs:l,grants:d,templates:c}}s(dw,"planCatalog");async function c_(e,t,n,r=Al){let i=await dw(e,t,n,r),o=[];if(i.billing!==null){let a=await e.mutation(S.contractSetup.applyBillingSetup,{client:t,...i.billing});for(let l of a.rows)o.push({step:l.kind,target:l.key,action:l.action,detail:l.detail})}if(i.programs!==null){let a=await e.mutation(S.catalogPrograms.applyProgramSetup,{client:t,...i.programs});for(let l of a.rows)o.push({step:l.kind,target:l.key,action:l.action,detail:l.detail?.de??""})}if(i.grants!==null){let a=await e.mutation(S.contractSetup.applyGrantSetup,{client:t,grantTemplates:i.grants.grantTemplates});for(let l of a.rows)o.push({step:"grantTemplate",target:l.key,action:l.action,detail:l.detail})}for(let a of i.templates){let{declared:l,state:d}=a;if(d===null)await Vf(e,t,a.docx,{name:l.name,role:l.role,configKey:l.key,...l.icon===void 0?{}:{icon:l.icon},...l.fileNamePattern===void 0?{}:{fileNamePattern:l.fileNamePattern}});else if(a.upload&&await l_(e,t,d.templateId,a.docx),a.metadata.length>0){let c=l.icon??d.icon,u=l.fileNamePattern??d.fileNamePattern;await e.mutation(S.templates.updateMetadata,{client:t,templateId:d.templateId,name:l.name,roleId:a.roleId,configKey:l.key,...c===null?{}:{icon:c},...u===null?{}:{fileNamePattern:u}})}a.parametersChange&&await e.mutation(S.templates.setParameters,{client:t,configKey:l.key,parameters:l.parameters??null}),o.push(i.rows.find(c=>c.step==="documentTemplate"&&c.target===l.key))}return o}s(c_,"applyCatalog");async function u_(e,t){let{unkeyed:n,...r}=await e.query(S.catalogExport.exportCatalog,{client:t});return{file:{revenueAccounts:r.revenueAccounts,billingItems:r.billingItems,grantTemplates:r.grantTemplates},unkeyed:n}}s(u_,"exportCatalog");var f_={required:!0,description:"catalog.json (revenueAccounts, billingItems with their programs, grantTemplates, documentTemplates)"},p_=["step","target","action","detail"],cw=class extends C{static{s(this,"CatalogPlanCommand")}file=p.String("--file",f_);static paths=[["catalog","plan"]];static usage=T.Usage({category:"Contracts",description:"Read-only: what `catalog apply` would write (revenue accounts, articles, price versions, program assignments, packages, tiers, Word templates)."});async execute(){let t=await this.caller(),n=await dw(t,this.requireTenant(t),lw(this.file));return this.print(n.rows,r=>r,p_),0}},uw=class extends C{static{s(this,"CatalogApplyCommand")}file=p.String("--file",f_);static paths=[["catalog","apply"]];static usage=T.Usage({category:"Contracts",description:"Bring a catalog file onto the environment by stable key; a Word file is uploaded only when its SHA-256 differs. Idempotent."});async execute(){let t=await this.caller();return this.print(await c_(t,this.requireTenant(t),lw(this.file)),n=>n,p_),0}},fw=class extends C{static{s(this,"CatalogExportCommand")}out=p.String("--out",{required:!0,description:"catalog.json to write (refused when it exists, unless --force)"});force=En();static paths=[["catalog","export"]];static usage=T.Usage({category:"Contracts",description:"Read-only: write the tenant's catalog (revenue accounts, articles with price, floor and programs, packages, grant templates) as catalog.json \u2014 `catalog plan` on it reports `same` everywhere. Word templates are not exported."});async execute(){let t=fr(this.out,this.force),n=await this.caller(),{file:r,unkeyed:i}=await u_(n,this.requireTenant(n));lt(t,`${JSON.stringify(r,null,2)}
10054
10054
  `);let o=Object.entries(i).filter(([,a])=>a>0).map(([a,l])=>`${l} ${a}`);return this.context.stdout.write(`${this.out}: ${r.billingItems.length} Artikel, ${r.grantTemplates.length} Rabattvorlagen`+(o.length===0?`
10055
10055
  `:` \u2014 ohne Schl\xFCssel nicht exportiert: ${o.join(", ")}
@@ -10245,6 +10245,6 @@ ${n.length} unusable ${o}:
10245
10245
  `),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
10246
10246
  `),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>
10247
10247
  `)}else this.context.stdout.write(`No unusable identities.
10248
- `);return n.length>0?1:0}},CA=class extends nr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.String({required:!0});async execute(){let n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function nK(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(nK,"requireOnOff");var rK=[yA,wA,kA,bA,vA,xA,SA,AA,EA,TA,Dc,$A,RA,IA,OA,PA,_A,NA,CA];function iK(e){return e.de??e.en??Object.values(e)[0]??""}s(iK,"titleDe");function u3(e){return{id:e._id,kind:e.kind,status:e.status,title:iK(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(u3,"row");var f3=["id","kind","status","title","assignee","group","outcome"],LA=class extends C{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(u3),f3),0}},MA=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:iK(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}},qA=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},KA=class extends C{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},jA=class extends C{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},oK=[LA,MA,qA,KA,jA];var Fc=[...v$,...m_,...AN,...SN,...JN,...rC,...nC,...eK,...rK,...Xq,...rq,...XP,...zN,...Uq,...k$,...G$,...JP,...sC,...oC,...dC,...cC,...VN,...ON,...oK,...r0,...B0,...tq,...U0,...Pq,...qq,...iq,...pq,...gq,...Bq,...Wq,...L$];for(let e of Fc){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:BE(e.usage.category,t.join(" "))})}var sK="0.1.34";function aK(){return Fc.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=ME[Xi(n)];return{path:n,effect:eo(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(aK,"plexusCommandCatalog");import Bo from"node:path";function p3(e){let t=st()?.workspaceRoot??process.cwd(),n=Bo.resolve(t,e),r=Bo.relative(t,n);if(Bo.isAbsolute(e)||r===".."||r.startsWith(`..${Bo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(p3,"workspacePath");function m3(e){let{absolute:t,relative:n}=p3(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of br(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Bo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Bo.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return lt(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Ot(Bo.dirname(t),{recursive:!0}),lt(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return zo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(m3,"plexusWorkspace");function lK(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=ja[n];if(!o||!Object.hasOwn(ja,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(ug,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:ug[i.path],skillHash:Pu}}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 m3(i)},"executePlexusAgentTool")}s(lK,"createPlexusAgentToolExecutor");var Jm=lK({inspectCommand:cK,executeCommand:uK});function Qm(){let e=new Jo({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:sK});e.register(Aa.HelpCommand),e.register(Aa.VersionCommand);for(let n of Fc)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return y3(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(Qm,"createPlexusCli");function y3(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Ia[n]===r&&it(t,n,r),n in Ia&&eo(n)==="confirm"&&!Oa(e)&&t.write(`plexus-cli: \`${Ia[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
10248
+ `);return n.length>0?1:0}},CA=class extends nr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.String({required:!0});async execute(){let n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function nK(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(nK,"requireOnOff");var rK=[yA,wA,kA,bA,vA,xA,SA,AA,EA,TA,Dc,$A,RA,IA,OA,PA,_A,NA,CA];function iK(e){return e.de??e.en??Object.values(e)[0]??""}s(iK,"titleDe");function u3(e){return{id:e._id,kind:e.kind,status:e.status,title:iK(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(u3,"row");var f3=["id","kind","status","title","assignee","group","outcome"],LA=class extends C{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(u3),f3),0}},MA=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:iK(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}},qA=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},KA=class extends C{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},jA=class extends C{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},oK=[LA,MA,qA,KA,jA];var Fc=[...v$,...m_,...AN,...SN,...JN,...rC,...nC,...eK,...rK,...Xq,...rq,...XP,...zN,...Uq,...k$,...G$,...JP,...sC,...oC,...dC,...cC,...VN,...ON,...oK,...r0,...B0,...tq,...U0,...Pq,...qq,...iq,...pq,...gq,...Bq,...Wq,...L$];for(let e of Fc){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:BE(e.usage.category,t.join(" "))})}var sK="0.1.35";function aK(){return Fc.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=ME[Xi(n)];return{path:n,effect:eo(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(aK,"plexusCommandCatalog");import Bo from"node:path";function p3(e){let t=st()?.workspaceRoot??process.cwd(),n=Bo.resolve(t,e),r=Bo.relative(t,n);if(Bo.isAbsolute(e)||r===".."||r.startsWith(`..${Bo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(p3,"workspacePath");function m3(e){let{absolute:t,relative:n}=p3(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of br(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Bo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Bo.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return lt(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Ot(Bo.dirname(t),{recursive:!0}),lt(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return zo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(m3,"plexusWorkspace");function lK(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=ja[n];if(!o||!Object.hasOwn(ja,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(ug,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:ug[i.path],skillHash:Pu}}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 m3(i)},"executePlexusAgentTool")}s(lK,"createPlexusAgentToolExecutor");var Jm=lK({inspectCommand:cK,executeCommand:uK});function Qm(){let e=new Jo({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:sK});e.register(Aa.HelpCommand),e.register(Aa.VersionCommand);for(let n of Fc)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return y3(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(Qm,"createPlexusCli");function y3(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Ia[n]===r&&it(t,n,r),n in Ia&&eo(n)==="confirm"&&!Oa(e)&&t.write(`plexus-cli: \`${Ia[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
10249
10249
  `)}s(y3,"noteRetiredPath");function cK(e){let t=Qm().process(ha(e),{executePlexusAgentTool:Jm}),n=t.path.join(" ");if(n.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=aK().find(l=>l.path===n);if(!r){if(n===""||n==="--help"||n==="--version")return{path:n,writes:!1,host:"shared"};throw new Error(`plexus: command ${n} has no host classification.`)}let i=t,o=r.effect==="callKind"?mp(Hs(Ys),i.fn??"",i.kind):void 0,a=wu(n,{confirm:Oa(t),callKind:o});return{...r,writes:a}}s(cK,"inspectPlexusCommand");async function uK(e,t){if(t)return VA(t,()=>uK(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let n="",r="",i=Qm();if(st()){let l=cK(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(ha(e.argv),{executePlexusAgentTool:Jm,stdin:g3.from(e.stdin===void 0?[]:[e.stdin]),stdout:new dK({write(l,d,c){n+=String(l),c()}}),stderr:new dK({write(l,d,c){r+=String(l),c()}})}),stdout:n,stderr:r}}s(uK,"executePlexusCommand");YA({source:w3.join(import.meta.dirname,"skill")});Qm().runExit(ha(process.argv.slice(2)),{executePlexusAgentTool:Jm});
10250
10250
  //# sourceMappingURL=cli.mjs.map