chapterhouse 0.3.11 → 0.3.12
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/api/server.js
CHANGED
|
@@ -469,7 +469,7 @@ app.post("/api/message", (req, res) => {
|
|
|
469
469
|
event.route = {
|
|
470
470
|
model: routeResult.model,
|
|
471
471
|
routerMode: routeResult.routerMode,
|
|
472
|
-
tier: routeResult.tier,
|
|
472
|
+
...(routeResult.tier !== null ? { tier: routeResult.tier } : {}),
|
|
473
473
|
...(routeResult.overrideName ? { overrideName: routeResult.overrideName } : {}),
|
|
474
474
|
};
|
|
475
475
|
}
|
|
@@ -547,7 +547,7 @@ app.post("/api/sessions/:sessionKey/interrupt", (req, res) => {
|
|
|
547
547
|
event.route = {
|
|
548
548
|
model: routeResult.model,
|
|
549
549
|
routerMode: routeResult.routerMode,
|
|
550
|
-
tier: routeResult.tier,
|
|
550
|
+
...(routeResult.tier !== null ? { tier: routeResult.tier } : {}),
|
|
551
551
|
...(routeResult.overrideName ? { overrideName: routeResult.overrideName } : {}),
|
|
552
552
|
};
|
|
553
553
|
}
|
package/package.json
CHANGED
|
@@ -127,7 +127,7 @@ Error generating stack: `+s.message+`
|
|
|
127
127
|
|
|
128
128
|
`)}f.write("payload.value = newResult;"),f.write("return payload;");const O=f.compile();return(x,S)=>O(d,x,S)};let s;const o=ju,a=!sv.jitless,c=a&&qW.value,u=e.catchall;let h;t._zod.parse=(d,f)=>{h??(h=r.value);const p=d.value;return o(p)?a&&c&&(f==null?void 0:f.async)===!1&&f.jitless!==!0?(s||(s=i(e.shape)),d=s(d,f),u?l$([],p,d,f,h,t):d):n(d,f):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),d)}});function pC(t,e,n,r){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const i=t.filter(s=>!Ma(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(o=>Ki(o,r,Gi())))}),e)}const c$=X("$ZodUnion",(t,e)=>{pt.init(t,e),Ue(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Ue(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Ue(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Ue(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>av(i.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const a of e.options){const l=a._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)o.push(l),s=!0;else{if(l.issues.length===0)return l;o.push(l)}}return s?Promise.all(o).then(a=>pC(a,r,t,i)):pC(o,r,t,i)}}),DH=X("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,c$.init(t,e);const n=t._zod.parse;Ue(t._zod,"propValues",()=>{const i={};for(const s of e.options){const o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[a,l]of Object.entries(o)){i[a]||(i[a]=new Set);for(const c of l)i[a].add(c)}}return i});const r=Wg(()=>{var o;const i=e.options,s=new Map;for(const a of i){const l=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});t._zod.parse=(i,s)=>{const o=i.value;if(!ju(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;const a=r.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(i,s):e.unionFallback||s.direction==="backward"?n(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:o,path:[e.discriminator],inst:t}),i)}}),zH=X("$ZodIntersection",(t,e)=>{pt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([l,c])=>gC(n,l,c)):gC(n,s,o)}});function Lb(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(wl(t)&&wl(e)){const n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),i={...t,...e};for(const s of r){const o=Lb(t[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],s=e[r],o=Lb(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gC(t,e,n){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&t.issues.push({...i,keys:s}),Ma(t))return t;const o=Lb(e.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const jH=X("$ZodRecord",(t,e)=>{pt.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!wl(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const s=[],o=e.keyType._zod.values;if(o){n.value={};const a=new Set;for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(f=>Ki(f,r,Gi())),input:c,path:[c],inst:t});continue}const h=u.value,d=e.valueType._zod.run({value:i[c],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Qa(c,f.issues)),n.value[h]=f.value})):(d.issues.length&&n.issues.push(...Qa(c,d.issues)),n.value[h]=d.value)}let l;for(const c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&t$.test(a)&&l.issues.length){const h=e.keyType._zod.run({value:Number(a),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){e.mode==="loose"?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Ki(h,r,Gi())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:i[a],issues:[]},r);u instanceof Promise?s.push(u.then(h=>{h.issues.length&&n.issues.push(...Qa(a,h.issues)),n.value[l.value]=h.value})):(u.issues.length&&n.issues.push(...Qa(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),BH=X("$ZodEnum",(t,e)=>{pt.init(t,e);const n=WN(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>GW.has(typeof i)).map(i=>typeof i=="string"?Sl(i):i.toString()).join("|")})$`),t._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:t}),i}}),UH=X("$ZodLiteral",(t,e)=>{if(pt.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Sl(r):r?Sl(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),ZH=X("$ZodTransform",(t,e)=>{pt.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new XN(t.constructor.name);const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n.fallback=!0,n));if(i instanceof Promise)throw new el;return n.value=i,n.fallback=!0,n}});function mC(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const u$=X("$ZodOptional",(t,e)=>{pt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Ue(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Ue(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${av(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const i=n.value,s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>mC(o,i)):mC(s,i)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),FH=X("$ZodExactOptional",(t,e)=>{u$.init(t,e),Ue(t._zod,"values",()=>e.innerType._zod.values),Ue(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),XH=X("$ZodNullable",(t,e)=>{pt.init(t,e),Ue(t._zod,"optin",()=>e.innerType._zod.optin),Ue(t._zod,"optout",()=>e.innerType._zod.optout),Ue(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${av(n.source)}|null)$`):void 0}),Ue(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),WH=X("$ZodDefault",(t,e)=>{pt.init(t,e),t._zod.optin="optional",Ue(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>OC(s,e)):OC(i,e)}});function OC(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const VH=X("$ZodPrefault",(t,e)=>{pt.init(t,e),t._zod.optin="optional",Ue(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),HH=X("$ZodNonOptional",(t,e)=>{pt.init(t,e),Ue(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>yC(s,t)):yC(i,t)}});function yC(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const YH=X("$ZodCatch",(t,e)=>{pt.init(t,e),t._zod.optin="optional",Ue(t._zod,"optout",()=>e.innerType._zod.optout),Ue(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(o=>Ki(o,r,Gi()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(s=>Ki(s,r,Gi()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),qH=X("$ZodPipe",(t,e)=>{pt.init(t,e),Ue(t._zod,"values",()=>e.in._zod.values),Ue(t._zod,"optin",()=>e.in._zod.optin),Ue(t._zod,"optout",()=>e.out._zod.optout),Ue(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(n,r);return s instanceof Promise?s.then(o=>dd(o,e.in,r)):dd(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>dd(s,e.out,r)):dd(i,e.out,r)}});function dd(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}const GH=X("$ZodReadonly",(t,e)=>{pt.init(t,e),Ue(t._zod,"propValues",()=>e.innerType._zod.propValues),Ue(t._zod,"values",()=>e.innerType._zod.values),Ue(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Ue(t._zod,"optout",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(bC):bC(i)}});function bC(t){return t.value=Object.freeze(t.value),t}const KH=X("$ZodCustom",(t,e)=>{Un.init(t,e),pt.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>wC(s,n,r,t));wC(i,n,r,t)}});function wC(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(Bu(i))}}var SC;class JH{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function e9(){return new JH}(SC=globalThis).__zod_globalRegistry??(SC.__zod_globalRegistry=e9());const Lc=globalThis.__zod_globalRegistry;function t9(t,e){return new t({type:"string",...fe(e)})}function n9(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...fe(e)})}function kC(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...fe(e)})}function r9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...fe(e)})}function i9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...fe(e)})}function s9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...fe(e)})}function o9(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...fe(e)})}function a9(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...fe(e)})}function l9(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...fe(e)})}function c9(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...fe(e)})}function u9(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...fe(e)})}function h9(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...fe(e)})}function d9(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...fe(e)})}function f9(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...fe(e)})}function p9(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...fe(e)})}function g9(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...fe(e)})}function m9(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...fe(e)})}function O9(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...fe(e)})}function y9(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...fe(e)})}function b9(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...fe(e)})}function w9(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...fe(e)})}function S9(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...fe(e)})}function k9(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...fe(e)})}function v9(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...fe(e)})}function x9(t,e){return new t({type:"string",format:"date",check:"string_format",...fe(e)})}function C9(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...fe(e)})}function E9(t,e){return new t({type:"string",format:"duration",check:"string_format",...fe(e)})}function _9(t,e){return new t({type:"number",checks:[],...fe(e)})}function T9(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...fe(e)})}function A9(t,e){return new t({type:"boolean",...fe(e)})}function P9(t){return new t({type:"unknown"})}function I9(t,e){return new t({type:"never",...fe(e)})}function vC(t,e){return new r$({check:"less_than",...fe(e),value:t,inclusive:!1})}function aO(t,e){return new r$({check:"less_than",...fe(e),value:t,inclusive:!0})}function xC(t,e){return new i$({check:"greater_than",...fe(e),value:t,inclusive:!1})}function lO(t,e){return new i$({check:"greater_than",...fe(e),value:t,inclusive:!0})}function CC(t,e){return new WV({check:"multiple_of",...fe(e),value:t})}function h$(t,e){return new HV({check:"max_length",...fe(e),maximum:t})}function kp(t,e){return new YV({check:"min_length",...fe(e),minimum:t})}function d$(t,e){return new qV({check:"length_equals",...fe(e),length:t})}function R9(t,e){return new GV({check:"string_format",format:"regex",...fe(e),pattern:t})}function N9(t){return new KV({check:"string_format",format:"lowercase",...fe(t)})}function $9(t){return new JV({check:"string_format",format:"uppercase",...fe(t)})}function M9(t,e){return new eH({check:"string_format",format:"includes",...fe(e),includes:t})}function Q9(t,e){return new tH({check:"string_format",format:"starts_with",...fe(e),prefix:t})}function L9(t,e){return new nH({check:"string_format",format:"ends_with",...fe(e),suffix:t})}function Hl(t){return new rH({check:"overwrite",tx:t})}function D9(t){return Hl(e=>e.normalize(t))}function z9(){return Hl(t=>t.trim())}function j9(){return Hl(t=>t.toLowerCase())}function B9(){return Hl(t=>t.toUpperCase())}function U9(){return Hl(t=>YW(t))}function Z9(t,e,n){return new t({type:"array",element:e,...fe(n)})}function F9(t,e,n){return new t({type:"custom",check:"custom",fn:e,...fe(n)})}function X9(t,e){const n=W9(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(Bu(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Bu(s))}},t(r.value,r)),e);return n}function W9(t,e){const n=new Un({check:"custom",...fe(e)});return n._zod.check=t,n}function f$(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??Lc,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function It(t,e,n={path:[],schemaPath:[]}){var u,h;var r;const i=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o);const a=(h=(u=t._zod).toJSONSchema)==null?void 0:h.call(u);if(a)o.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,d);else{const p=o.schema,g=e.processors[i.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);g(t,e,p,d)}const f=t._zod.parent;f&&(o.ref||(o.ref=f),It(f,e,d),e.seen.get(f).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),e.io==="input"&&hn(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function p$(t,e){var o,a,l,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of t.seen.entries()){const h=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(h){const d=r.get(h);if(d&&d!==u[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(h,u[0])}}const i=u=>{var g;const h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const b=(g=t.external.registry.get(u[0]))==null?void 0:g.id,m=t.external.uri??(w=>w);if(b)return{ref:m(b)};const O=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=O,{defId:O,ref:`${m("__shared")}#/${h}/${O}`}}if(u[1]===n)return{ref:"#"};const f=`#/${h}/`,p=u[1].schema.id??`__schema${t.counter++}`;return{defId:p,ref:f+p}},s=u=>{if(u[1].schema.$ref)return;const h=u[1],{ref:d,defId:f}=i(u);h.def={...h.schema},f&&(h.defId=f);const p=h.schema;for(const g in p)delete p[g];p.$ref=d};if(t.cycles==="throw")for(const u of t.seen.entries()){const h=u[1];if(h.cycle)throw new Error(`Cycle detected: #/${(a=h.cycle)==null?void 0:a.join("/")}/<root>
|
|
129
129
|
|
|
130
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const h=u[1];if(e===u[0]){s(u);continue}if(t.external){const f=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&f){s(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){s(u);continue}if(h.cycle){s(u);continue}if(h.count>1&&t.reused==="ref"){s(u);continue}}}function g$(t,e){var a,l,c,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const d=t.seen.get(h);if(d.ref===null)return;const f=d.def??d.schema,p={...f},g=d.ref;if(d.ref=null,g){r(g);const m=t.seen.get(g),O=m.schema;if(O.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(O)):Object.assign(f,O),Object.assign(f,p),h._zod.parent===g)for(const k in f)k==="$ref"||k==="allOf"||k in p||delete f[k];if(O.$ref&&m.def)for(const k in f)k==="$ref"||k==="allOf"||k in m.def&&JSON.stringify(f[k])===JSON.stringify(m.def[k])&&delete f[k]}const b=h._zod.parent;if(b&&b!==g){r(b);const m=t.seen.get(b);if(m!=null&&m.schema.$ref&&(f.$ref=m.schema.$ref,m.def))for(const O in f)O==="$ref"||O==="allOf"||O in m.def&&JSON.stringify(f[O])===JSON.stringify(m.def[O])&&delete f[O]}t.override({zodSchema:h,jsonSchema:f,path:d.path??[]})};for(const h of[...t.seen.entries()].reverse())r(h[0]);const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const h=(l=t.external.registry.get(e))==null?void 0:l.id;if(!h)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(h)}Object.assign(i,n.def??n.schema);const s=(c=t.metadataRegistry.get(e))==null?void 0:c.id;s!==void 0&&i.id===s&&delete i.id;const o=((u=t.external)==null?void 0:u.defs)??{};for(const h of t.seen.entries()){const d=h[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,o[d.defId]=d.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const h=JSON.parse(JSON.stringify(i));return Object.defineProperty(h,"~standard",{value:{...e["~standard"],jsonSchema:{input:vp(e,"input",t.processors),output:vp(e,"output",t.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function hn(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return hn(r.element,n);if(r.type==="set")return hn(r.valueType,n);if(r.type==="lazy")return hn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return hn(r.innerType,n);if(r.type==="intersection")return hn(r.left,n)||hn(r.right,n);if(r.type==="record"||r.type==="map")return hn(r.keyType,n)||hn(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:hn(r.in,n)||hn(r.out,n);if(r.type==="object"){for(const i in r.shape)if(hn(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(hn(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(hn(i,n))return!0;return!!(r.rest&&hn(r.rest,n))}return!1}const V9=(t,e={})=>n=>{const r=f$({...n,processors:e});return It(t,r),p$(r,t),g$(r,t)},vp=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=f$({...i??{},target:s,io:e,processors:n});return It(t,o),p$(o,t),g$(o,t)},H9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Y9=(t,e,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=H9[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),c&&(i.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},q9=(t,e,n,r)=>{const i=n,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";h?f?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),d?f?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o=="number"&&(i.maximum=o),typeof l=="number"&&(i.multipleOf=l)},G9=(t,e,n,r)=>{n.type="boolean"},K9=(t,e,n,r)=>{n.not={}},J9=(t,e,n,r)=>{},e6=(t,e,n,r)=>{const i=t._zod.def,s=WN(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},t6=(t,e,n,r)=>{const i=t._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),s.every(o=>typeof o=="boolean")&&(n.type="boolean"),s.every(o=>o===null)&&(n.type="null"),n.enum=s},n6=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},r6=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},i6=(t,e,n,r)=>{const i=n,s=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=It(s.element,e,{...r,path:[...r.path,"items"]})},s6=(t,e,n,r)=>{var c;const i=n,s=t._zod.def;i.type="object",i.properties={};const o=s.shape;for(const u in o)i.properties[u]=It(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const h=s.shape[u]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(i.required=Array.from(l)),((c=s.catchall)==null?void 0:c._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=It(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},o6=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>It(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},a6=(t,e,n,r)=>{const i=t._zod.def,s=It(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=It(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=l},l6=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=It(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const h of l)i.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=It(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=It(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(i.required=u)}},c6=(t,e,n,r)=>{const i=t._zod.def,s=It(i.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},u6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},h6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},d6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},f6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},p6=(t,e,n,r)=>{const i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?i.out:i.in:i.out;It(o,e,r);const a=e.seen.get(t);a.ref=o},g6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},m$=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},m6=X("ZodISODateTime",(t,e)=>{OH.init(t,e),mt.init(t,e)});function O6(t){return v9(m6,t)}const y6=X("ZodISODate",(t,e)=>{yH.init(t,e),mt.init(t,e)});function b6(t){return x9(y6,t)}const w6=X("ZodISOTime",(t,e)=>{bH.init(t,e),mt.init(t,e)});function S6(t){return C9(w6,t)}const k6=X("ZodISODuration",(t,e)=>{wH.init(t,e),mt.init(t,e)});function v6(t){return E9(k6,t)}const x6=(t,e)=>{qN.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>cV(t,n)},flatten:{value:n=>lV(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Qb,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Qb,2)}},isEmpty:{get(){return t.issues.length===0}}})},Er=X("ZodError",x6,{Parent:Error}),C6=cv(Er),E6=uv(Er),_6=Vg(Er),T6=Hg(Er),A6=dV(Er),P6=fV(Er),I6=pV(Er),R6=gV(Er),N6=mV(Er),$6=OV(Er),M6=yV(Er),Q6=bV(Er),EC=new WeakMap;function Eh(t,e,n){const r=Object.getPrototypeOf(t);let i=EC.get(r);if(i||(i=new Set,EC.set(r,i)),!i.has(e)){i.add(e);for(const s in n){const o=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const gt=X("ZodType",(t,e)=>(pt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:vp(t,"input"),output:vp(t,"output")}}),t.toJSONSchema=V9(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>C6(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>_6(t,n,r),t.parseAsync=async(n,r)=>E6(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>T6(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>A6(t,n,r),t.decode=(n,r)=>P6(t,n,r),t.encodeAsync=async(n,r)=>I6(t,n,r),t.decodeAsync=async(n,r)=>R6(t,n,r),t.safeEncode=(n,r)=>N6(t,n,r),t.safeDecode=(n,r)=>$6(t,n,r),t.safeEncodeAsync=async(n,r)=>M6(t,n,r),t.safeDecodeAsync=async(n,r)=>Q6(t,n,r),Eh(t,"ZodType",{check(...n){const r=this.def;return this.clone(ro(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return io(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(TY(n,r))},superRefine(n,r){return this.check(AY(n,r))},overwrite(n){return this.check(Hl(n))},optional(){return PC(this)},exactOptional(){return gY(this)},nullable(){return IC(this)},nullish(){return PC(IC(this))},nonoptional(n){return SY(this,n)},array(){return cr(this)},or(n){return qg([this,n])},and(n){return uY(this,n)},transform(n){return RC(this,fY(n))},default(n){return yY(this,n)},prefault(n){return wY(this,n)},catch(n){return vY(this,n)},pipe(n){return RC(this,n)},readonly(){return EY(this)},describe(n){const r=this.clone();return Lc.add(r,{description:n}),r},meta(...n){if(n.length===0)return Lc.get(this);const r=this.clone();return Lc.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){var n;return(n=Lc.get(t))==null?void 0:n.description},configurable:!0}),t)),O$=X("_ZodString",(t,e)=>{hv.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>Y9(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,Eh(t,"_ZodString",{regex(...r){return this.check(R9(...r))},includes(...r){return this.check(M9(...r))},startsWith(...r){return this.check(Q9(...r))},endsWith(...r){return this.check(L9(...r))},min(...r){return this.check(kp(...r))},max(...r){return this.check(h$(...r))},length(...r){return this.check(d$(...r))},nonempty(...r){return this.check(kp(1,...r))},lowercase(r){return this.check(N9(r))},uppercase(r){return this.check($9(r))},trim(){return this.check(z9())},normalize(...r){return this.check(D9(...r))},toLowerCase(){return this.check(j9())},toUpperCase(){return this.check(B9())},slugify(){return this.check(U9())}})}),L6=X("ZodString",(t,e)=>{hv.init(t,e),O$.init(t,e),t.email=n=>t.check(n9(D6,n)),t.url=n=>t.check(a9(z6,n)),t.jwt=n=>t.check(k9(eY,n)),t.emoji=n=>t.check(l9(j6,n)),t.guid=n=>t.check(kC(_C,n)),t.uuid=n=>t.check(r9(fd,n)),t.uuidv4=n=>t.check(i9(fd,n)),t.uuidv6=n=>t.check(s9(fd,n)),t.uuidv7=n=>t.check(o9(fd,n)),t.nanoid=n=>t.check(c9(B6,n)),t.guid=n=>t.check(kC(_C,n)),t.cuid=n=>t.check(u9(U6,n)),t.cuid2=n=>t.check(h9(Z6,n)),t.ulid=n=>t.check(d9(F6,n)),t.base64=n=>t.check(b9(G6,n)),t.base64url=n=>t.check(w9(K6,n)),t.xid=n=>t.check(f9(X6,n)),t.ksuid=n=>t.check(p9(W6,n)),t.ipv4=n=>t.check(g9(V6,n)),t.ipv6=n=>t.check(m9(H6,n)),t.cidrv4=n=>t.check(O9(Y6,n)),t.cidrv6=n=>t.check(y9(q6,n)),t.e164=n=>t.check(S9(J6,n)),t.datetime=n=>t.check(O6(n)),t.date=n=>t.check(b6(n)),t.time=n=>t.check(S6(n)),t.duration=n=>t.check(v6(n))});function N(t){return t9(L6,t)}const mt=X("ZodStringFormat",(t,e)=>{ct.init(t,e),O$.init(t,e)}),D6=X("ZodEmail",(t,e)=>{lH.init(t,e),mt.init(t,e)}),_C=X("ZodGUID",(t,e)=>{oH.init(t,e),mt.init(t,e)}),fd=X("ZodUUID",(t,e)=>{aH.init(t,e),mt.init(t,e)}),z6=X("ZodURL",(t,e)=>{cH.init(t,e),mt.init(t,e)}),j6=X("ZodEmoji",(t,e)=>{uH.init(t,e),mt.init(t,e)}),B6=X("ZodNanoID",(t,e)=>{hH.init(t,e),mt.init(t,e)}),U6=X("ZodCUID",(t,e)=>{dH.init(t,e),mt.init(t,e)}),Z6=X("ZodCUID2",(t,e)=>{fH.init(t,e),mt.init(t,e)}),F6=X("ZodULID",(t,e)=>{pH.init(t,e),mt.init(t,e)}),X6=X("ZodXID",(t,e)=>{gH.init(t,e),mt.init(t,e)}),W6=X("ZodKSUID",(t,e)=>{mH.init(t,e),mt.init(t,e)}),V6=X("ZodIPv4",(t,e)=>{SH.init(t,e),mt.init(t,e)}),H6=X("ZodIPv6",(t,e)=>{kH.init(t,e),mt.init(t,e)}),Y6=X("ZodCIDRv4",(t,e)=>{vH.init(t,e),mt.init(t,e)}),q6=X("ZodCIDRv6",(t,e)=>{xH.init(t,e),mt.init(t,e)}),G6=X("ZodBase64",(t,e)=>{CH.init(t,e),mt.init(t,e)}),K6=X("ZodBase64URL",(t,e)=>{_H.init(t,e),mt.init(t,e)}),J6=X("ZodE164",(t,e)=>{TH.init(t,e),mt.init(t,e)}),eY=X("ZodJWT",(t,e)=>{PH.init(t,e),mt.init(t,e)}),y$=X("ZodNumber",(t,e)=>{o$.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>q9(t,r,i),Eh(t,"ZodNumber",{gt(r,i){return this.check(xC(r,i))},gte(r,i){return this.check(lO(r,i))},min(r,i){return this.check(lO(r,i))},lt(r,i){return this.check(vC(r,i))},lte(r,i){return this.check(aO(r,i))},max(r,i){return this.check(aO(r,i))},int(r){return this.check(TC(r))},safe(r){return this.check(TC(r))},positive(r){return this.check(xC(0,r))},nonnegative(r){return this.check(lO(0,r))},negative(r){return this.check(vC(0,r))},nonpositive(r){return this.check(aO(0,r))},multipleOf(r,i){return this.check(CC(r,i))},step(r,i){return this.check(CC(r,i))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Mt(t){return _9(y$,t)}const tY=X("ZodNumberFormat",(t,e)=>{IH.init(t,e),y$.init(t,e)});function TC(t){return T9(tY,t)}const nY=X("ZodBoolean",(t,e)=>{RH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>G9(t,n,r)});function or(t){return A9(nY,t)}const rY=X("ZodUnknown",(t,e)=>{NH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>J9()});function kl(){return P9(rY)}const iY=X("ZodNever",(t,e)=>{$H.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>K9(t,n,r)});function sY(t){return I9(iY,t)}const oY=X("ZodArray",(t,e)=>{MH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>i6(t,n,r,i),t.element=e.element,Eh(t,"ZodArray",{min(n,r){return this.check(kp(n,r))},nonempty(n){return this.check(kp(1,n))},max(n,r){return this.check(h$(n,r))},length(n,r){return this.check(d$(n,r))},unwrap(){return this.element}})});function cr(t,e){return Z9(oY,t,e)}const aY=X("ZodObject",(t,e)=>{LH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>s6(t,n,r,i),Ue(t,"shape",()=>e.shape),Eh(t,"ZodObject",{keyof(){return so(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:kl()})},loose(){return this.clone({...this._zod.def,catchall:kl()})},strict(){return this.clone({...this._zod.def,catchall:sY()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return nV(this,n)},safeExtend(n){return rV(this,n)},merge(n){return iV(this,n)},pick(n){return eV(this,n)},omit(n){return tV(this,n)},partial(...n){return sV(w$,this,n[0])},required(...n){return oV(S$,this,n[0])}})});function ce(t,e){const n={type:"object",shape:t??{},...fe(e)};return new aY(n)}const b$=X("ZodUnion",(t,e)=>{c$.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>o6(t,n,r,i),t.options=e.options});function qg(t,e){return new b$({type:"union",options:t,...fe(e)})}const lY=X("ZodDiscriminatedUnion",(t,e)=>{b$.init(t,e),DH.init(t,e)});function dv(t,e,n){return new lY({type:"union",options:e,discriminator:t,...fe(n)})}const cY=X("ZodIntersection",(t,e)=>{zH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>a6(t,n,r,i)});function uY(t,e){return new cY({type:"intersection",left:t,right:e})}const AC=X("ZodRecord",(t,e)=>{jH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>l6(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function Gg(t,e,n){return!e||!e._zod?new AC({type:"record",keyType:N(),valueType:t,...fe(e)}):new AC({type:"record",keyType:t,valueType:e,...fe(n)})}const Db=X("ZodEnum",(t,e)=>{BH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>e6(t,r,i),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Db({...e,checks:[],...fe(i),entries:s})},t.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Db({...e,checks:[],...fe(i),entries:s})}});function so(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Db({type:"enum",entries:n,...fe(e)})}const hY=X("ZodLiteral",(t,e)=>{UH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>t6(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ye(t,e){return new hY({type:"literal",values:Array.isArray(t)?t:[t],...fe(e)})}const dY=X("ZodTransform",(t,e)=>{ZH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>r6(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new XN(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Bu(s,n.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(Bu(o))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function fY(t){return new dY({type:"transform",transform:t})}const w$=X("ZodOptional",(t,e)=>{u$.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>m$(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function PC(t){return new w$({type:"optional",innerType:t})}const pY=X("ZodExactOptional",(t,e)=>{FH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>m$(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function gY(t){return new pY({type:"optional",innerType:t})}const mY=X("ZodNullable",(t,e)=>{XH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>c6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function IC(t){return new mY({type:"nullable",innerType:t})}const OY=X("ZodDefault",(t,e)=>{WH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>h6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yY(t,e){return new OY({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():HN(e)}})}const bY=X("ZodPrefault",(t,e)=>{VH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>d6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function wY(t,e){return new bY({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():HN(e)}})}const S$=X("ZodNonOptional",(t,e)=>{HH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>u6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function SY(t,e){return new S$({type:"nonoptional",innerType:t,...fe(e)})}const kY=X("ZodCatch",(t,e)=>{YH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>f6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function vY(t,e){return new kY({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const xY=X("ZodPipe",(t,e)=>{qH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>p6(t,n,r,i),t.in=e.in,t.out=e.out});function RC(t,e){return new xY({type:"pipe",in:t,out:e})}const CY=X("ZodReadonly",(t,e)=>{GH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>g6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function EY(t){return new CY({type:"readonly",innerType:t})}const _Y=X("ZodCustom",(t,e)=>{KH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>n6(t,n)});function TY(t,e={}){return F9(_Y,t,e)}function AY(t,e){return X9(t,e)}const PY=ce({appName:ye("Chapterhouse"),entraAuthEnabled:ye(!1),standalone:ye(!0),chatSseEnabled:or().optional()}),IY=ce({appName:ye("Chapterhouse"),entraAuthEnabled:ye(!1),standalone:ye(!1),chatSseEnabled:or().optional()}),RY=ce({appName:ye("Chapterhouse"),entraAuthEnabled:ye(!0),entraClientId:N(),entraTenantId:N(),chatSseEnabled:or().optional()}),NY=qg([PY,IY,RY]),$Y=qg([ce({authMode:ye("legacy"),token:N().nullable()}),ce({authMode:ye("entra")}),ce({authMode:ye("standalone")})]),cO=ce({status:N()}),MY=ce({status:N(),cancelled:or()}),QY=ce({slug:N(),name:N(),model:N(),taskId:N(),description:N(),status:N(),startedAt:N(),completedAt:N().nullable()}),LY=cr(QY),DY=ce({taskId:N(),agentSlug:N(),name:N(),description:N(),status:N(),result:N().nullable(),startedAt:N(),completedAt:N().nullable()}),zY=ce({id:Mt(),taskId:N(),seq:Mt(),ts:Mt(),kind:so(["tool_start","tool_complete"]),toolName:N().nullable(),summary:N().nullable()}),jY=ce({taskId:N(),events:cr(zY)}),BY=ce({model:N()}),UY=ce({previous:N(),current:N()}),ZY=ce({models:cr(N()),current:N()}),NC=ce({enabled:or(),tierModels:Gg(N(),N()),cooldownMessages:Mt(),currentModel:N(),lastRoute:kl()}),FY=ce({path:N(),title:N(),summary:N(),section:N(),tags:cr(N()),updated:N(),scope:so(["personal","team"])}),XY=cr(FY),WY=ce({path:N(),content:N()}),VY=ce({ok:or(),created:or(),path:N()}),HY=ce({ok:or(),path:N()}),YY=ce({path:N(),mtime:Mt()}),qY=cr(YY),GY=ce({slug:N(),name:N(),description:N(),directory:N(),source:so(["bundled","local","global"])}),KY=cr(GY),JY=ce({ok:or(),message:N()}),eq=ce({role:so(["user","assistant"]),content:N(),ts:N()}),tq=ce({sessionKey:N(),messages:cr(eq)}),nq=ce({projectRoot:N(),squadDir:N(),agentCount:Mt(),loadedAt:N(),lastUsedAt:N().optional()}),rq=cr(nq),iq=ce({projectRoot:N(),message:N()}),sq=ce({message:N()}),oq=ce({type:ye("text"),text:N()}),aq=ce({type:ye("thinking"),reasoningId:N(),text:N(),active:or()}),lq=ce({type:ye("tool-call"),toolCallId:N(),toolName:N(),mcpServerName:N().optional(),arguments:Gg(N(),kl()).optional(),status:so(["running","done","failed"]),resultPreview:N().optional(),detailedContent:N().optional(),agentSlug:N().optional()}),cq=ce({type:ye("subagent"),toolCallId:N(),agentName:N(),agentDisplayName:N(),agentDescription:N().optional(),status:so(["running","done","failed"]),durationMs:Mt().optional(),error:N().optional(),agentSlug:N().optional()}),uq=ce({type:ye("activity-heartbeat"),agentSlug:N(),agentName:N(),currentAction:N(),startedAt:Mt(),lastUpdate:Mt()}),hq=dv("type",[oq,aq,lq,cq,uq]),dq=ce({model:N(),routerMode:N().optional(),tier:N().optional(),overrideName:N().optional()}),fq=ce({kind:ye("thinking_delta"),reasoningId:N(),deltaContent:N(),agentSlug:N().optional()}),pq=ce({kind:ye("tool_start"),toolCallId:N(),toolName:N(),mcpServerName:N().optional(),arguments:Gg(N(),kl()).optional(),agentSlug:N().optional()}),gq=ce({kind:ye("tool_complete"),toolCallId:N(),success:or(),resultPreview:N().optional(),detailedContent:N().optional(),agentSlug:N().optional()}),mq=ce({kind:ye("subagent_started"),toolCallId:N(),agentName:N(),agentDisplayName:N(),agentDescription:N(),agentSlug:N().optional()}),Oq=ce({kind:ye("subagent_completed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),durationMs:Mt().optional(),agentSlug:N().optional()}),yq=ce({kind:ye("subagent_failed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),error:N().optional(),agentSlug:N().optional()});dv("kind",[fq,pq,gq,mq,Oq,yq]);const bq=qg([ce({type:ye("connected"),connectionId:N()}),ce({type:ye("delta"),content:N(),sessionKey:N().optional(),turnId:N().optional()}),ce({type:ye("message"),content:N(),sessionKey:N().optional(),turnId:N().optional(),route:dq.optional()}),ce({type:ye("cancelled"),sessionKey:N().optional()}),ce({type:ye("status"),status:so(["idle","dreaming"]),message:N()}),ce({type:ye("queued"),position:Mt(),sessionKey:N().optional(),turnId:N().optional(),msgId:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("thinking_delta"),reasoningId:N(),deltaContent:N(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("tool_start"),toolCallId:N(),toolName:N(),mcpServerName:N().optional(),arguments:Gg(N(),kl()).optional(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("tool_complete"),toolCallId:N(),success:or(),resultPreview:N().optional(),detailedContent:N().optional(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("subagent_started"),toolCallId:N(),agentName:N(),agentDisplayName:N(),agentDescription:N(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("subagent_completed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),durationMs:Mt().optional(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("subagent_failed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),error:N().optional(),agentSlug:N().optional()}),ce({type:ye("queue-advance"),length:Mt(),sessionKey:N().optional()}),ce({type:ye("turn-interrupted"),abortedTurnId:N(),sessionKey:N().optional()})]),wq=ce({running:or(),pid:Mt().nullable(),startedAt:N().nullable(),projectRoot:N().nullable(),interval:Mt().nullable(),lastPollAt:N().nullable()}),Sq=ce({number:Mt(),title:N(),url:N(),state:N(),createdAt:N(),labels:cr(N())}),kq=ce({projectRoot:N(),issues:cr(Sq)}),vq=ce({pid:Mt(),projectRoot:N(),interval:Mt()}),xq=ce({stopped:ye(!0)}),Cq=ce({turnId:N()}),Eq=ce({type:ye("turn:started"),turnId:N(),sessionKey:N(),prompt:N(),attachments:cr(ce({type:ye("file"),path:N(),displayName:N().optional()})).optional()}),_q=ce({type:ye("turn:delta"),turnId:N(),sessionKey:N(),part:hq}),Tq=ce({type:ye("turn:queued"),turnId:N(),sessionKey:N(),position:Mt()}),Aq=ce({type:ye("turn:interrupted"),turnId:N(),sessionKey:N()}),Pq=ce({type:ye("turn:complete"),turnId:N(),sessionKey:N(),finalMessage:N()}),Iq=ce({type:ye("turn:error"),turnId:N(),sessionKey:N(),error:N()}),Rq=dv("type",[Eq,_q,Tq,Aq,Pq,Iq]),Nq=new Set([408,425,429,500,502,503,504]),xp=[400,800,1600];let zb=null,pd=null,gd=null,Kg=!1;function $q(t){return zb=t,t}function Mq(){const t=new URL(window.location.href),e=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash);(t.searchParams.has("access_token")||t.searchParams.has("token")||e.has("access_token")||e.has("token"))&&(t.searchParams.delete("access_token"),t.searchParams.delete("token"),e.delete("access_token"),e.delete("token"),t.hash=e.toString()?`#${e.toString()}`:"",window.history.replaceState({},document.title,t.toString()))}function Qq(t){const e=(t??"GET").toUpperCase();return e==="GET"||e==="HEAD"||e==="OPTIONS"}function Lq(t){return t instanceof DOMException&&t.name==="AbortError"}function Dq(t){if(!t)return null;const e=Number(t);if(Number.isFinite(e))return Math.max(0,e*1e3);const n=Date.parse(t);return Number.isNaN(n)?null:Math.max(0,n-Date.now())}function $C(t,e){return Dq((t==null?void 0:t.headers.get("Retry-After"))??null)??xp[Math.min(e,xp.length-1)]}function MC(t){return new Promise(e=>window.setTimeout(e,t))}async function fv(t,e={},n={}){const r=n.retry??Qq(e.method);for(let i=0;;i+=1)try{const s=await fetch(t,e);if(!r||!Nq.has(s.status)||i>=xp.length)return s;await MC($C(s,i))}catch(s){if(!r||i>=xp.length||Lq(s))throw s;await MC($C(null,i))}}async function zq(){const t=await fv("/api/config/public",{},{retry:!0});if(!t.ok)throw new Error(`Failed to load auth config: ${t.status} ${t.statusText}`);const e=await t.json(),n=NY.safeParse(e);if(!n.success)throw console.error("[api] /api/config/public schema validation failed:",n.error.format()),new Error("The server returned an unexpected auth config shape. Please reload.");return n.data}async function jq(){if(zb)return zb;Mq();const t=await fv("/api/bootstrap",{},{retry:!0});if(!t.ok)throw new Error(`Bootstrap failed: ${t.status} ${t.statusText}`);const e=await t.json(),n=$Y.safeParse(e);if(!n.success)throw console.error("[api] /api/bootstrap schema validation failed:",n.error.format()),new Error("The server returned an unexpected bootstrap shape. Please reload.");const r=n.data;if(r.authMode==="standalone")return Kg=!0,"";if(r.authMode!=="legacy")throw new Error("Entra auth is enabled but the browser auth flow has not been initialized");if(!r.token)throw new Error("Bootstrap did not return an API token");return $q(r.token)}async function Jg(){return pd||(pd=zq().catch(t=>{throw pd=null,t})),await pd}async function em(){gd||(gd=(async()=>{const e=await Jg();return Kg=!e.entraAuthEnabled&&e.standalone,e.entraAuthEnabled?(await XW(e),{config:e,authEnabled:!0,isAuthenticated:aC(),user:lC()}):{config:e,authEnabled:!1,isAuthenticated:!0,user:null}})().catch(e=>{throw gd=null,e}));const t=await gd;return t.authEnabled?{...t,isAuthenticated:aC(),user:lC()}:t}async function Bq(){return(await em()).authEnabled?await WW():Kg?"":await jq()}async function Uu(t){const e=new Headers(t),n=await Bq();return!Kg&&n&&e.set("Authorization",`Bearer ${n}`),e}async function Uq(){if(!(await em()).authEnabled)throw new Error("Microsoft sign-in is not enabled for this Chapterhouse server");await FN()}async function Zq(){(await em()).authEnabled&&await VW()}async function yt(t,e={},n={}){const r=await Uu(e.headers);return e.body&&!r.has("Content-Type")&&r.set("Content-Type","application/json"),fv(t,{...e,headers:r},n)}async function bt(t,e){if(!t.ok){let i;try{const s=await t.json();i=(s==null?void 0:s.error)||JSON.stringify(s)}catch{i=await t.text().catch(()=>{})}throw new Error(`HTTP ${t.status}${i?": "+i:""}`)}const n=await t.json(),r=e.safeParse(n);if(!r.success){const i=t.url?` (${new URL(t.url,"http://localhost").pathname})`:"";throw console.error(`[api] Schema validation failed${i}:`,r.error.format()),new Error(`The server returned an unexpected response${i}. Please try again or contact support.`)}return r.data}const He={sendMessage:(t,e,n,r,i)=>yt("/api/message",{method:"POST",body:JSON.stringify({prompt:t,connectionId:e,...n?{projectPath:n}:{},...r?{sessionKey:r}:{},...i?{msgId:i}:{}})}).then(s=>bt(s,cO)),cancel:()=>yt("/api/cancel",{method:"POST"}).then(t=>bt(t,MY)),interruptMessage:(t,e,n,r)=>yt(`/api/sessions/${encodeURIComponent(t)}/interrupt`,{method:"POST",body:JSON.stringify({prompt:n,connectionId:e,...r&&r.length>0?{attachments:r}:{}})}).then(i=>bt(i,cO)),listWorkers:()=>yt("/api/workers").then(t=>bt(t,LY)),getWorker:t=>yt(`/api/workers/${encodeURIComponent(t)}`).then(e=>bt(e,DY)),getWorkerEvents:(t,e=0)=>yt(`/api/workers/${encodeURIComponent(t)}/events?afterSeq=${e}`).then(n=>bt(n,jY)),getModel:()=>yt("/api/model").then(t=>bt(t,BY)),setModel:t=>yt("/api/model",{method:"POST",body:JSON.stringify({model:t})}).then(e=>bt(e,UY)),listModels:()=>yt("/api/models").then(t=>bt(t,ZY)),getAuto:()=>yt("/api/auto").then(t=>bt(t,NC)),setAuto:t=>yt("/api/auto",{method:"POST",body:JSON.stringify(t)}).then(e=>bt(e,NC)),listPages:()=>yt("/api/wiki/pages").then(t=>bt(t,XY)),readPage:t=>yt(`/api/wiki/page?path=${encodeURIComponent(t)}`).then(e=>bt(e,WY)),writePage:(t,e)=>yt(`/api/wiki/page?path=${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({content:e})}).then(n=>bt(n,VY)),deletePage:t=>yt(`/api/wiki/page?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(e=>bt(e,HY)),listHistory:()=>yt("/api/history").then(t=>bt(t,qY)),listSkills:()=>yt("/api/skills").then(t=>bt(t,KY)),removeSkill:t=>yt(`/api/skills/${encodeURIComponent(t)}`,{method:"DELETE"}).then(e=>bt(e,JY)),restart:()=>yt("/api/restart",{method:"POST"}).then(t=>bt(t,cO)),getSessionMessages:(t,e)=>{const n=`/api/session/${encodeURIComponent(t)}/messages${e!==void 0?`?limit=${e}`:""}`;return yt(n).then(r=>bt(r,tq))},submitTurn:(t,e)=>yt(`/api/sessions/${encodeURIComponent(t)}/turn`,{method:"POST",body:JSON.stringify(e)}).then(n=>bt(n,Cq))};async function xo(t,e,n={}){const r=await yt(t,n);return bt(r,e)}const eu={list:()=>xo("/api/projects",rq),register:t=>xo("/api/projects",iq,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:t})}),remove:t=>xo(`/api/projects/${encodeURIComponent(t)}`,sq,{method:"DELETE"})},md={getStatus:()=>xo("/api/squad/ralph/status",wq),start:(t,e)=>xo("/api/squad/ralph/start",vq,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:t,interval:e})}),stop:()=>xo("/api/squad/ralph/stop",xq,{method:"POST"}),getQueue:t=>xo(`/api/squad/ralph/queue?projectRoot=${encodeURIComponent(t)}`,kq)};function k$(t){return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Fq(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=(4-e.length%4)%4;return atob(e+"=".repeat(n))}function Xq(t){return`project:${t}`}const v$="sidebar.projects.expanded",Wq=5,Vq=[{to:"/chat",label:"Chat"}],Hq=[{to:"/workers",label:"Workers"},{to:"/ralph",label:"Ralph"},{to:"/wiki",label:"Wiki"},{to:"/history",label:"History"},{to:"/skills",label:"Skills"},{to:"/settings",label:"Settings"}];function Yq(){try{return localStorage.getItem(v$)==="true"}catch{return!1}}function qq(){const t=is(),[e,n]=A.useState(Yq),[r,i]=A.useState([]);A.useEffect(()=>{eu.list().then(a=>{const l=[...a].sort((c,u)=>{const h=new Date(c.lastUsedAt??c.loadedAt).getTime();return new Date(u.lastUsedAt??u.loadedAt).getTime()-h});i(l.slice(0,Wq))}).catch(()=>{})},[]);function s(){n(a=>{const l=!a;try{localStorage.setItem(v$,String(l))}catch{}return l})}function o(a){try{const l=Date.now()-new Date(a).getTime(),c=Math.floor(l/6e4);if(c<60)return`${c}m ago`;const u=Math.floor(c/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}catch{return""}}return y.jsxs("aside",{className:"sidebar",children:[y.jsxs("div",{className:"sidebar-brand",children:[y.jsx("img",{src:"/chapterhouse-icon.svg",alt:"",width:28,height:28}),y.jsx("span",{children:"Chapterhouse"})]}),y.jsxs("nav",{"aria-label":"Primary",children:[Vq.map(a=>y.jsx(Gm,{to:a.to,className:({isActive:l})=>"nav-link"+(l?" active":""),children:a.label},a.to)),y.jsxs("div",{className:"nav-group",children:[y.jsxs("div",{className:"nav-group-row",children:[y.jsx(Gm,{to:"/projects",end:!0,className:({isActive:a})=>"nav-link nav-group-label"+(a?" active":""),children:"Projects"}),y.jsx("button",{type:"button",className:"nav-group-toggle","aria-expanded":e,"aria-label":e?"Collapse recent projects":"Expand recent projects",onClick:s,children:y.jsx("span",{className:"nav-chevron"+(e?" nav-chevron-open":""),"aria-hidden":"true",children:"›"})})]}),e&&r.length>0&&y.jsx("ul",{className:"nav-recents",role:"list","aria-label":"Recent projects",children:r.map(a=>{const l=a.projectRoot.split("/").filter(Boolean).pop()??a.projectRoot,c=k$(a.projectRoot),u=o(a.lastUsedAt??a.loadedAt);return y.jsx("li",{children:y.jsxs("button",{type:"button",className:"nav-recent-link",title:a.projectRoot,"aria-label":l,onClick:()=>t(`/projects/chat/${c}`),children:[y.jsx("span",{className:"nav-recent-name",children:l}),u&&y.jsx("span",{className:"nav-recent-hint dim",children:u})]})},a.projectRoot)})}),e&&r.length===0&&y.jsx("p",{className:"nav-recents-empty dim",children:"No projects yet."})]}),Hq.map(a=>y.jsx(Gm,{to:a.to,className:({isActive:l})=>"nav-link"+(l?" active":""),children:a.label},a.to))]})]})}function kn({title:t,message:e,onRetry:n,retryLabel:r="Try again",inline:i=!1,children:s}){return y.jsxs("section",{className:`error-notice${i?" inline":""}`,role:"alert","aria-live":"assertive",children:[t?y.jsx("h2",{className:"error-notice-title",children:t}):null,y.jsx("p",{className:"error-notice-message",children:e}),n||s?y.jsxs("div",{className:"error-notice-actions",children:[n?y.jsx("button",{type:"button",className:"btn",onClick:n,children:r}):null,s]}):null]})}function xn({label:t,detail:e,inline:n=!1,centered:r=!1,children:i}){const s=["loading-state",n?"inline":"",r?"centered":""].filter(Boolean).join(" ");return y.jsxs("div",{className:s,role:"status","aria-live":"polite",children:[y.jsx("span",{className:"loading-spinner","aria-hidden":"true"}),y.jsxs("div",{children:[y.jsx("div",{className:"loading-state-label",children:t}),e?y.jsx("div",{className:"loading-state-detail",children:e}):null,i]})]})}const QC=t=>{let e;const n=new Set,r=(c,u)=>{const h=typeof c=="function"?c(e):c;if(!Object.is(h,e)){const d=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(f=>f(e,d))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,a);return a},Gq=t=>t?QC(t):QC,Kq=t=>t;function Jq(t,e=Kq){const n=Sa.useSyncExternalStore(t.subscribe,Sa.useCallback(()=>e(t.getState()),[t,e]),Sa.useCallback(()=>e(t.getInitialState()),[t,e]));return Sa.useDebugValue(n),n}const LC=t=>{const e=Gq(t),n=r=>Jq(e,r);return Object.assign(n,e),n},eG=t=>t?LC(t):LC;function tG(t,e){const n=[];t&&n.push({type:"text",text:t});for(const r of e)r.kind==="thinking"?n.push({type:"thinking",reasoningId:r.reasoningId,text:r.text,active:r.active}):r.kind==="tool"?n.push({type:"tool-call",toolCallId:r.toolCallId,toolName:r.toolName,mcpServerName:r.mcpServerName,arguments:r.arguments,status:r.status,resultPreview:r.resultPreview,detailedContent:r.detailedContent,agentSlug:r.agentSlug}):r.kind==="subagent"&&n.push({type:"subagent",toolCallId:r.toolCallId,agentName:r.agentName,agentDisplayName:r.agentDisplayName,agentDescription:r.agentDescription,status:r.status,durationMs:r.durationMs,error:r.error,agentSlug:r.agentSlug});return n}const pv=[];let nG=0;const Od=()=>`m-${++nG}-${Date.now()}`;function rG(t,e){const n=e.agentSlug;switch(e.kind){case"thinking_delta":{const r=t.findIndex(o=>o.kind==="thinking"&&o.reasoningId===e.reasoningId&&o.agentSlug===n);if(r===-1)return[...t,{kind:"thinking",reasoningId:e.reasoningId,text:e.deltaContent,active:!0,agentSlug:n}];const i=t.slice(),s=i[r];return i[r]={...s,text:s.text+e.deltaContent,active:!0},i}case"tool_start":return[...t,{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,mcpServerName:e.mcpServerName,arguments:e.arguments,status:"running",agentSlug:n}];case"tool_complete":{const r=t.findIndex(o=>o.kind==="tool"&&o.toolCallId===e.toolCallId);if(r===-1)return t;const i=t.slice(),s=i[r];return i[r]={...s,status:e.success?"done":"failed",resultPreview:e.resultPreview,detailedContent:e.detailedContent},i}case"subagent_started":return[...t,{kind:"subagent",toolCallId:e.toolCallId,agentName:e.agentName,agentDisplayName:e.agentDisplayName,agentDescription:e.agentDescription,status:"running",agentSlug:n}];case"subagent_completed":{const r=t.findIndex(o=>o.kind==="subagent"&&o.toolCallId===e.toolCallId);if(r===-1)return t;const i=t.slice(),s=i[r];return i[r]={...s,status:"done",durationMs:e.durationMs},i}case"subagent_failed":{const r=t.findIndex(o=>o.kind==="subagent"&&o.toolCallId===e.toolCallId);if(r===-1)return t;const i=t.slice(),s=i[r];return i[r]={...s,status:"failed",error:e.error},i}}}function iG(t,e){switch(e.kind){case"thinking_delta":{const n=t.findIndex(s=>s.type==="thinking"&&s.reasoningId===e.reasoningId);if(n===-1)return[...t,{type:"thinking",reasoningId:e.reasoningId,text:e.deltaContent,active:!0}];const r=t.slice(),i=r[n];return r[n]={...i,text:i.text+e.deltaContent,active:!0},r}case"tool_start":{const n={type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,mcpServerName:e.mcpServerName,arguments:e.arguments,status:"running",agentSlug:e.agentSlug};if(!e.agentSlug)return[...t,n];const r=Date.now(),i=t.findIndex(a=>a.type==="activity-heartbeat"&&a.agentSlug===e.agentSlug);if(i===-1)return[...t,n,{type:"activity-heartbeat",agentSlug:e.agentSlug,agentName:e.agentSlug,currentAction:`running ${e.toolName}`,startedAt:r,lastUpdate:r}];const s=t[i],o=t.slice();return r-s.lastUpdate>=5e3&&(o[i]={...s,currentAction:`running ${e.toolName}`,lastUpdate:r}),[...o,n]}case"tool_complete":{const n=t.findIndex(s=>s.type==="tool-call"&&s.toolCallId===e.toolCallId);if(n===-1)return t;const r=t.slice(),i=r[n];return r[n]={...i,status:e.success?"done":"failed",resultPreview:e.resultPreview,detailedContent:e.detailedContent},r}case"subagent_started":{const n={type:"subagent",toolCallId:e.toolCallId,agentName:e.agentName,agentDisplayName:e.agentDisplayName,agentDescription:e.agentDescription,status:"running",agentSlug:e.agentSlug};if(!e.agentSlug)return[...t,n];if(t.findIndex(s=>s.type==="activity-heartbeat"&&s.agentSlug===e.agentSlug)!==-1)return[...t,n];const i=Date.now();return[...t,n,{type:"activity-heartbeat",agentSlug:e.agentSlug,agentName:e.agentDisplayName||e.agentName,currentAction:"starting…",startedAt:i,lastUpdate:i}]}case"subagent_completed":{const n=t.findIndex(i=>i.type==="subagent"&&i.toolCallId===e.toolCallId);let r=t.slice();return n!==-1&&(r[n]={...r[n],status:"done",durationMs:e.durationMs}),e.agentSlug&&(r=r.filter(i=>!(i.type==="activity-heartbeat"&&i.agentSlug===e.agentSlug))),r}case"subagent_failed":{const n=t.findIndex(i=>i.type==="subagent"&&i.toolCallId===e.toolCallId);let r=t.slice();return n!==-1&&(r[n]={...r[n],status:"failed",error:e.error}),e.agentSlug&&(r=r.filter(i=>!(i.type==="activity-heartbeat"&&i.agentSlug===e.agentSlug))),r}}}function sG(t,e){switch(e.type){case"thinking":{const n=t.findIndex(s=>s.type==="thinking"&&s.reasoningId===e.reasoningId);if(n===-1)return[...t,e];const r=t[n],i=t.slice();return i[n]={...r,text:r.text+e.text,active:e.active},i}case"tool-call":{const n=t.findIndex(i=>i.type==="tool-call"&&i.toolCallId===e.toolCallId);if(n===-1)return[...t,e];const r=t.slice();return r[n]={...r[n],...e},r}case"subagent":{const n=t.findIndex(i=>i.type==="subagent"&&i.toolCallId===e.toolCallId);if(n===-1)return[...t,e];const r=t.slice();return r[n]={...r[n],...e},r}default:return[...t,e]}}const Ae=eG((t,e)=>({connectionId:null,setConnectionId:n=>t({connectionId:n}),sseStatus:"idle",setSseStatus:n=>t({sseStatus:n}),messagesBySession:{},getMessages:n=>e().messagesBySession[n]??pv,addUserMessage:(n,r,i)=>{const s=Od(),o=i??crypto.randomUUID();return t(a=>{const l=a.messagesBySession[r]??[];return{messagesBySession:{...a.messagesBySession,[r]:[...l,{role:"user",id:s,content:n,ts:Date.now(),deliveryStatus:"posting",clientMsgId:o}]}}}),s},markMessageSent:(n,r)=>t(i=>{const s=i.messagesBySession[r]??[];return{messagesBySession:{...i.messagesBySession,[r]:s.map(o=>o.id===n&&o.role==="user"&&o.deliveryStatus==="posting"?{...o,deliveryStatus:"sent"}:o)}}}),markQueuedBackend:(n,r,i)=>t(s=>{const o=s.messagesBySession[i]??[];return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>a.role==="user"&&a.clientMsgId===n?{...a,deliveryStatus:"queued-backend",queuePosition:r}:a)}}}),advanceQueuedSession:n=>t(r=>{const i=r.messagesBySession[n]??[];let s=!1;return{messagesBySession:{...r.messagesBySession,[n]:i.map(o=>!s&&o.role==="user"&&o.deliveryStatus==="queued-backend"?(s=!0,{...o,deliveryStatus:"sent",queuePosition:void 0}):o)}}}),receiveQueueAdvance:(n,r)=>t(i=>{const s=i.messagesBySession[n]??[];let o=!1,a=1;return{messagesBySession:{...i.messagesBySession,[n]:s.map(l=>l.role!=="user"||l.deliveryStatus!=="queued-backend"?l:o?{...l,queuePosition:a++}:(o=!0,l))}}}),startAssistantMessage:n=>{const r=Od();return t(i=>{const s=i.messagesBySession[n]??[];return{messagesBySession:{...i.messagesBySession,[n]:[...s,{role:"assistant",id:r,content:"",ts:Date.now(),pending:!0,activities:[],parts:[]}]}}}),r},appendDelta:(n,r,i)=>t(s=>{const o=s.messagesBySession[i]??[];return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>{if(a.id!==n||a.role!=="assistant")return a;const l=a.parts.findIndex(u=>u.type==="text"),c=l===-1?[...a.parts,{type:"text",text:r}]:a.parts.map((u,h)=>h===l?{type:"text",text:r}:u);return{...a,content:r,pending:!0,parts:c}})}}}),finishAssistant:(n,r,i,s)=>t(o=>{const a=o.messagesBySession[i]??[];return{messagesBySession:{...o.messagesBySession,[i]:a.map(l=>{if(l.id!==n||l.role!=="assistant")return l;const c=l.activities.map(d=>d.kind==="thinking"?{...d,active:!1}:d);let u=!1;const h=l.parts.map(d=>d.type==="text"?(u=!0,{...d,text:r}):d.type==="thinking"?{...d,active:!1}:d);return!u&&r&&h.push({type:"text",text:r}),{...l,content:r,pending:!1,route:s,activities:c,parts:h}})}}}),markCancelled:n=>t(r=>{const i=r.messagesBySession[n]??[];return{messagesBySession:{...r.messagesBySession,[n]:i.map(s=>s.role==="assistant"&&s.pending?{...s,content:s.content+`
|
|
130
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const h=u[1];if(e===u[0]){s(u);continue}if(t.external){const f=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&f){s(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){s(u);continue}if(h.cycle){s(u);continue}if(h.count>1&&t.reused==="ref"){s(u);continue}}}function g$(t,e){var a,l,c,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const d=t.seen.get(h);if(d.ref===null)return;const f=d.def??d.schema,p={...f},g=d.ref;if(d.ref=null,g){r(g);const m=t.seen.get(g),O=m.schema;if(O.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(O)):Object.assign(f,O),Object.assign(f,p),h._zod.parent===g)for(const k in f)k==="$ref"||k==="allOf"||k in p||delete f[k];if(O.$ref&&m.def)for(const k in f)k==="$ref"||k==="allOf"||k in m.def&&JSON.stringify(f[k])===JSON.stringify(m.def[k])&&delete f[k]}const b=h._zod.parent;if(b&&b!==g){r(b);const m=t.seen.get(b);if(m!=null&&m.schema.$ref&&(f.$ref=m.schema.$ref,m.def))for(const O in f)O==="$ref"||O==="allOf"||O in m.def&&JSON.stringify(f[O])===JSON.stringify(m.def[O])&&delete f[O]}t.override({zodSchema:h,jsonSchema:f,path:d.path??[]})};for(const h of[...t.seen.entries()].reverse())r(h[0]);const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,(a=t.external)!=null&&a.uri){const h=(l=t.external.registry.get(e))==null?void 0:l.id;if(!h)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(h)}Object.assign(i,n.def??n.schema);const s=(c=t.metadataRegistry.get(e))==null?void 0:c.id;s!==void 0&&i.id===s&&delete i.id;const o=((u=t.external)==null?void 0:u.defs)??{};for(const h of t.seen.entries()){const d=h[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,o[d.defId]=d.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const h=JSON.parse(JSON.stringify(i));return Object.defineProperty(h,"~standard",{value:{...e["~standard"],jsonSchema:{input:vp(e,"input",t.processors),output:vp(e,"output",t.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function hn(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return hn(r.element,n);if(r.type==="set")return hn(r.valueType,n);if(r.type==="lazy")return hn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return hn(r.innerType,n);if(r.type==="intersection")return hn(r.left,n)||hn(r.right,n);if(r.type==="record"||r.type==="map")return hn(r.keyType,n)||hn(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:hn(r.in,n)||hn(r.out,n);if(r.type==="object"){for(const i in r.shape)if(hn(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(hn(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(hn(i,n))return!0;return!!(r.rest&&hn(r.rest,n))}return!1}const V9=(t,e={})=>n=>{const r=f$({...n,processors:e});return It(t,r),p$(r,t),g$(r,t)},vp=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=f$({...i??{},target:s,io:e,processors:n});return It(t,o),p$(o,t),g$(o,t)},H9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Y9=(t,e,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=H9[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),c&&(i.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},q9=(t,e,n,r)=>{const i=n,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(o??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";h?f?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),d?f?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o=="number"&&(i.maximum=o),typeof l=="number"&&(i.multipleOf=l)},G9=(t,e,n,r)=>{n.type="boolean"},K9=(t,e,n,r)=>{n.not={}},J9=(t,e,n,r)=>{},e6=(t,e,n,r)=>{const i=t._zod.def,s=WN(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},t6=(t,e,n,r)=>{const i=t._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),s.every(o=>typeof o=="boolean")&&(n.type="boolean"),s.every(o=>o===null)&&(n.type="null"),n.enum=s},n6=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},r6=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},i6=(t,e,n,r)=>{const i=n,s=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=It(s.element,e,{...r,path:[...r.path,"items"]})},s6=(t,e,n,r)=>{var c;const i=n,s=t._zod.def;i.type="object",i.properties={};const o=s.shape;for(const u in o)i.properties[u]=It(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const h=s.shape[u]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(i.required=Array.from(l)),((c=s.catchall)==null?void 0:c._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=It(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},o6=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>It(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},a6=(t,e,n,r)=>{const i=t._zod.def,s=It(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=It(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=l},l6=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=It(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const h of l)i.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=It(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=It(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(i.required=u)}},c6=(t,e,n,r)=>{const i=t._zod.def,s=It(i.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},u6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},h6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},d6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},f6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},p6=(t,e,n,r)=>{const i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?i.out:i.in:i.out;It(o,e,r);const a=e.seen.get(t);a.ref=o},g6=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},m$=(t,e,n,r)=>{const i=t._zod.def;It(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},m6=X("ZodISODateTime",(t,e)=>{OH.init(t,e),mt.init(t,e)});function O6(t){return v9(m6,t)}const y6=X("ZodISODate",(t,e)=>{yH.init(t,e),mt.init(t,e)});function b6(t){return x9(y6,t)}const w6=X("ZodISOTime",(t,e)=>{bH.init(t,e),mt.init(t,e)});function S6(t){return C9(w6,t)}const k6=X("ZodISODuration",(t,e)=>{wH.init(t,e),mt.init(t,e)});function v6(t){return E9(k6,t)}const x6=(t,e)=>{qN.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>cV(t,n)},flatten:{value:n=>lV(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Qb,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Qb,2)}},isEmpty:{get(){return t.issues.length===0}}})},Er=X("ZodError",x6,{Parent:Error}),C6=cv(Er),E6=uv(Er),_6=Vg(Er),T6=Hg(Er),A6=dV(Er),P6=fV(Er),I6=pV(Er),R6=gV(Er),N6=mV(Er),$6=OV(Er),M6=yV(Er),Q6=bV(Er),EC=new WeakMap;function Eh(t,e,n){const r=Object.getPrototypeOf(t);let i=EC.get(r);if(i||(i=new Set,EC.set(r,i)),!i.has(e)){i.add(e);for(const s in n){const o=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const gt=X("ZodType",(t,e)=>(pt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:vp(t,"input"),output:vp(t,"output")}}),t.toJSONSchema=V9(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>C6(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>_6(t,n,r),t.parseAsync=async(n,r)=>E6(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>T6(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>A6(t,n,r),t.decode=(n,r)=>P6(t,n,r),t.encodeAsync=async(n,r)=>I6(t,n,r),t.decodeAsync=async(n,r)=>R6(t,n,r),t.safeEncode=(n,r)=>N6(t,n,r),t.safeDecode=(n,r)=>$6(t,n,r),t.safeEncodeAsync=async(n,r)=>M6(t,n,r),t.safeDecodeAsync=async(n,r)=>Q6(t,n,r),Eh(t,"ZodType",{check(...n){const r=this.def;return this.clone(ro(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return io(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(TY(n,r))},superRefine(n,r){return this.check(AY(n,r))},overwrite(n){return this.check(Hl(n))},optional(){return PC(this)},exactOptional(){return gY(this)},nullable(){return IC(this)},nullish(){return PC(IC(this))},nonoptional(n){return SY(this,n)},array(){return cr(this)},or(n){return qg([this,n])},and(n){return uY(this,n)},transform(n){return RC(this,fY(n))},default(n){return yY(this,n)},prefault(n){return wY(this,n)},catch(n){return vY(this,n)},pipe(n){return RC(this,n)},readonly(){return EY(this)},describe(n){const r=this.clone();return Lc.add(r,{description:n}),r},meta(...n){if(n.length===0)return Lc.get(this);const r=this.clone();return Lc.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){var n;return(n=Lc.get(t))==null?void 0:n.description},configurable:!0}),t)),O$=X("_ZodString",(t,e)=>{hv.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>Y9(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,Eh(t,"_ZodString",{regex(...r){return this.check(R9(...r))},includes(...r){return this.check(M9(...r))},startsWith(...r){return this.check(Q9(...r))},endsWith(...r){return this.check(L9(...r))},min(...r){return this.check(kp(...r))},max(...r){return this.check(h$(...r))},length(...r){return this.check(d$(...r))},nonempty(...r){return this.check(kp(1,...r))},lowercase(r){return this.check(N9(r))},uppercase(r){return this.check($9(r))},trim(){return this.check(z9())},normalize(...r){return this.check(D9(...r))},toLowerCase(){return this.check(j9())},toUpperCase(){return this.check(B9())},slugify(){return this.check(U9())}})}),L6=X("ZodString",(t,e)=>{hv.init(t,e),O$.init(t,e),t.email=n=>t.check(n9(D6,n)),t.url=n=>t.check(a9(z6,n)),t.jwt=n=>t.check(k9(eY,n)),t.emoji=n=>t.check(l9(j6,n)),t.guid=n=>t.check(kC(_C,n)),t.uuid=n=>t.check(r9(fd,n)),t.uuidv4=n=>t.check(i9(fd,n)),t.uuidv6=n=>t.check(s9(fd,n)),t.uuidv7=n=>t.check(o9(fd,n)),t.nanoid=n=>t.check(c9(B6,n)),t.guid=n=>t.check(kC(_C,n)),t.cuid=n=>t.check(u9(U6,n)),t.cuid2=n=>t.check(h9(Z6,n)),t.ulid=n=>t.check(d9(F6,n)),t.base64=n=>t.check(b9(G6,n)),t.base64url=n=>t.check(w9(K6,n)),t.xid=n=>t.check(f9(X6,n)),t.ksuid=n=>t.check(p9(W6,n)),t.ipv4=n=>t.check(g9(V6,n)),t.ipv6=n=>t.check(m9(H6,n)),t.cidrv4=n=>t.check(O9(Y6,n)),t.cidrv6=n=>t.check(y9(q6,n)),t.e164=n=>t.check(S9(J6,n)),t.datetime=n=>t.check(O6(n)),t.date=n=>t.check(b6(n)),t.time=n=>t.check(S6(n)),t.duration=n=>t.check(v6(n))});function N(t){return t9(L6,t)}const mt=X("ZodStringFormat",(t,e)=>{ct.init(t,e),O$.init(t,e)}),D6=X("ZodEmail",(t,e)=>{lH.init(t,e),mt.init(t,e)}),_C=X("ZodGUID",(t,e)=>{oH.init(t,e),mt.init(t,e)}),fd=X("ZodUUID",(t,e)=>{aH.init(t,e),mt.init(t,e)}),z6=X("ZodURL",(t,e)=>{cH.init(t,e),mt.init(t,e)}),j6=X("ZodEmoji",(t,e)=>{uH.init(t,e),mt.init(t,e)}),B6=X("ZodNanoID",(t,e)=>{hH.init(t,e),mt.init(t,e)}),U6=X("ZodCUID",(t,e)=>{dH.init(t,e),mt.init(t,e)}),Z6=X("ZodCUID2",(t,e)=>{fH.init(t,e),mt.init(t,e)}),F6=X("ZodULID",(t,e)=>{pH.init(t,e),mt.init(t,e)}),X6=X("ZodXID",(t,e)=>{gH.init(t,e),mt.init(t,e)}),W6=X("ZodKSUID",(t,e)=>{mH.init(t,e),mt.init(t,e)}),V6=X("ZodIPv4",(t,e)=>{SH.init(t,e),mt.init(t,e)}),H6=X("ZodIPv6",(t,e)=>{kH.init(t,e),mt.init(t,e)}),Y6=X("ZodCIDRv4",(t,e)=>{vH.init(t,e),mt.init(t,e)}),q6=X("ZodCIDRv6",(t,e)=>{xH.init(t,e),mt.init(t,e)}),G6=X("ZodBase64",(t,e)=>{CH.init(t,e),mt.init(t,e)}),K6=X("ZodBase64URL",(t,e)=>{_H.init(t,e),mt.init(t,e)}),J6=X("ZodE164",(t,e)=>{TH.init(t,e),mt.init(t,e)}),eY=X("ZodJWT",(t,e)=>{PH.init(t,e),mt.init(t,e)}),y$=X("ZodNumber",(t,e)=>{o$.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>q9(t,r,i),Eh(t,"ZodNumber",{gt(r,i){return this.check(xC(r,i))},gte(r,i){return this.check(lO(r,i))},min(r,i){return this.check(lO(r,i))},lt(r,i){return this.check(vC(r,i))},lte(r,i){return this.check(aO(r,i))},max(r,i){return this.check(aO(r,i))},int(r){return this.check(TC(r))},safe(r){return this.check(TC(r))},positive(r){return this.check(xC(0,r))},nonnegative(r){return this.check(lO(0,r))},negative(r){return this.check(vC(0,r))},nonpositive(r){return this.check(aO(0,r))},multipleOf(r,i){return this.check(CC(r,i))},step(r,i){return this.check(CC(r,i))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Mt(t){return _9(y$,t)}const tY=X("ZodNumberFormat",(t,e)=>{IH.init(t,e),y$.init(t,e)});function TC(t){return T9(tY,t)}const nY=X("ZodBoolean",(t,e)=>{RH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>G9(t,n,r)});function or(t){return A9(nY,t)}const rY=X("ZodUnknown",(t,e)=>{NH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>J9()});function kl(){return P9(rY)}const iY=X("ZodNever",(t,e)=>{$H.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>K9(t,n,r)});function sY(t){return I9(iY,t)}const oY=X("ZodArray",(t,e)=>{MH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>i6(t,n,r,i),t.element=e.element,Eh(t,"ZodArray",{min(n,r){return this.check(kp(n,r))},nonempty(n){return this.check(kp(1,n))},max(n,r){return this.check(h$(n,r))},length(n,r){return this.check(d$(n,r))},unwrap(){return this.element}})});function cr(t,e){return Z9(oY,t,e)}const aY=X("ZodObject",(t,e)=>{LH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>s6(t,n,r,i),Ue(t,"shape",()=>e.shape),Eh(t,"ZodObject",{keyof(){return so(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:kl()})},loose(){return this.clone({...this._zod.def,catchall:kl()})},strict(){return this.clone({...this._zod.def,catchall:sY()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return nV(this,n)},safeExtend(n){return rV(this,n)},merge(n){return iV(this,n)},pick(n){return eV(this,n)},omit(n){return tV(this,n)},partial(...n){return sV(w$,this,n[0])},required(...n){return oV(S$,this,n[0])}})});function ce(t,e){const n={type:"object",shape:t??{},...fe(e)};return new aY(n)}const b$=X("ZodUnion",(t,e)=>{c$.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>o6(t,n,r,i),t.options=e.options});function qg(t,e){return new b$({type:"union",options:t,...fe(e)})}const lY=X("ZodDiscriminatedUnion",(t,e)=>{b$.init(t,e),DH.init(t,e)});function dv(t,e,n){return new lY({type:"union",options:e,discriminator:t,...fe(n)})}const cY=X("ZodIntersection",(t,e)=>{zH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>a6(t,n,r,i)});function uY(t,e){return new cY({type:"intersection",left:t,right:e})}const AC=X("ZodRecord",(t,e)=>{jH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>l6(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function Gg(t,e,n){return!e||!e._zod?new AC({type:"record",keyType:N(),valueType:t,...fe(e)}):new AC({type:"record",keyType:t,valueType:e,...fe(n)})}const Db=X("ZodEnum",(t,e)=>{BH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(r,i,s)=>e6(t,r,i),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Db({...e,checks:[],...fe(i),entries:s})},t.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Db({...e,checks:[],...fe(i),entries:s})}});function so(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Db({type:"enum",entries:n,...fe(e)})}const hY=X("ZodLiteral",(t,e)=>{UH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>t6(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ye(t,e){return new hY({type:"literal",values:Array.isArray(t)?t:[t],...fe(e)})}const dY=X("ZodTransform",(t,e)=>{ZH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>r6(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new XN(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Bu(s,n.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(Bu(o))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function fY(t){return new dY({type:"transform",transform:t})}const w$=X("ZodOptional",(t,e)=>{u$.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>m$(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function PC(t){return new w$({type:"optional",innerType:t})}const pY=X("ZodExactOptional",(t,e)=>{FH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>m$(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function gY(t){return new pY({type:"optional",innerType:t})}const mY=X("ZodNullable",(t,e)=>{XH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>c6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function IC(t){return new mY({type:"nullable",innerType:t})}const OY=X("ZodDefault",(t,e)=>{WH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>h6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yY(t,e){return new OY({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():HN(e)}})}const bY=X("ZodPrefault",(t,e)=>{VH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>d6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function wY(t,e){return new bY({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():HN(e)}})}const S$=X("ZodNonOptional",(t,e)=>{HH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>u6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function SY(t,e){return new S$({type:"nonoptional",innerType:t,...fe(e)})}const kY=X("ZodCatch",(t,e)=>{YH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>f6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function vY(t,e){return new kY({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const xY=X("ZodPipe",(t,e)=>{qH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>p6(t,n,r,i),t.in=e.in,t.out=e.out});function RC(t,e){return new xY({type:"pipe",in:t,out:e})}const CY=X("ZodReadonly",(t,e)=>{GH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>g6(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function EY(t){return new CY({type:"readonly",innerType:t})}const _Y=X("ZodCustom",(t,e)=>{KH.init(t,e),gt.init(t,e),t._zod.processJSONSchema=(n,r,i)=>n6(t,n)});function TY(t,e={}){return F9(_Y,t,e)}function AY(t,e){return X9(t,e)}const PY=ce({appName:ye("Chapterhouse"),entraAuthEnabled:ye(!1),standalone:ye(!0),chatSseEnabled:or().optional()}),IY=ce({appName:ye("Chapterhouse"),entraAuthEnabled:ye(!1),standalone:ye(!1),chatSseEnabled:or().optional()}),RY=ce({appName:ye("Chapterhouse"),entraAuthEnabled:ye(!0),entraClientId:N(),entraTenantId:N(),chatSseEnabled:or().optional()}),NY=qg([PY,IY,RY]),$Y=qg([ce({authMode:ye("legacy"),token:N().nullable()}),ce({authMode:ye("entra")}),ce({authMode:ye("standalone")})]),cO=ce({status:N()}),MY=ce({status:N(),cancelled:or()}),QY=ce({slug:N(),name:N(),model:N(),taskId:N(),description:N(),status:N(),startedAt:N(),completedAt:N().nullable()}),LY=cr(QY),DY=ce({taskId:N(),agentSlug:N(),name:N(),description:N(),status:N(),result:N().nullable(),startedAt:N(),completedAt:N().nullable()}),zY=ce({id:Mt(),taskId:N(),seq:Mt(),ts:Mt(),kind:so(["tool_start","tool_complete"]),toolName:N().nullable(),summary:N().nullable()}),jY=ce({taskId:N(),events:cr(zY)}),BY=ce({model:N()}),UY=ce({previous:N(),current:N()}),ZY=ce({models:cr(N()),current:N()}),NC=ce({enabled:or(),tierModels:Gg(N(),N()),cooldownMessages:Mt(),currentModel:N(),lastRoute:kl()}),FY=ce({path:N(),title:N(),summary:N(),section:N(),tags:cr(N()),updated:N(),scope:so(["personal","team"])}),XY=cr(FY),WY=ce({path:N(),content:N()}),VY=ce({ok:or(),created:or(),path:N()}),HY=ce({ok:or(),path:N()}),YY=ce({path:N(),mtime:Mt()}),qY=cr(YY),GY=ce({slug:N(),name:N(),description:N(),directory:N(),source:so(["bundled","local","global"])}),KY=cr(GY),JY=ce({ok:or(),message:N()}),eq=ce({role:so(["user","assistant"]),content:N(),ts:N()}),tq=ce({sessionKey:N(),messages:cr(eq)}),nq=ce({projectRoot:N(),squadDir:N(),agentCount:Mt(),loadedAt:N(),lastUsedAt:N().optional()}),rq=cr(nq),iq=ce({projectRoot:N(),message:N()}),sq=ce({message:N()}),oq=ce({type:ye("text"),text:N()}),aq=ce({type:ye("thinking"),reasoningId:N(),text:N(),active:or()}),lq=ce({type:ye("tool-call"),toolCallId:N(),toolName:N(),mcpServerName:N().optional(),arguments:Gg(N(),kl()).optional(),status:so(["running","done","failed"]),resultPreview:N().optional(),detailedContent:N().optional(),agentSlug:N().optional()}),cq=ce({type:ye("subagent"),toolCallId:N(),agentName:N(),agentDisplayName:N(),agentDescription:N().optional(),status:so(["running","done","failed"]),durationMs:Mt().optional(),error:N().optional(),agentSlug:N().optional()}),uq=ce({type:ye("activity-heartbeat"),agentSlug:N(),agentName:N(),currentAction:N(),startedAt:Mt(),lastUpdate:Mt()}),hq=dv("type",[oq,aq,lq,cq,uq]),dq=ce({model:N(),routerMode:N().optional(),tier:N().nullable().optional(),overrideName:N().optional()}),fq=ce({kind:ye("thinking_delta"),reasoningId:N(),deltaContent:N(),agentSlug:N().optional()}),pq=ce({kind:ye("tool_start"),toolCallId:N(),toolName:N(),mcpServerName:N().optional(),arguments:Gg(N(),kl()).optional(),agentSlug:N().optional()}),gq=ce({kind:ye("tool_complete"),toolCallId:N(),success:or(),resultPreview:N().optional(),detailedContent:N().optional(),agentSlug:N().optional()}),mq=ce({kind:ye("subagent_started"),toolCallId:N(),agentName:N(),agentDisplayName:N(),agentDescription:N(),agentSlug:N().optional()}),Oq=ce({kind:ye("subagent_completed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),durationMs:Mt().optional(),agentSlug:N().optional()}),yq=ce({kind:ye("subagent_failed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),error:N().optional(),agentSlug:N().optional()});dv("kind",[fq,pq,gq,mq,Oq,yq]);const bq=qg([ce({type:ye("connected"),connectionId:N()}),ce({type:ye("delta"),content:N(),sessionKey:N().optional(),turnId:N().optional()}),ce({type:ye("message"),content:N(),sessionKey:N().optional(),turnId:N().optional(),route:dq.optional()}),ce({type:ye("cancelled"),sessionKey:N().optional()}),ce({type:ye("status"),status:so(["idle","dreaming"]),message:N()}),ce({type:ye("queued"),position:Mt(),sessionKey:N().optional(),turnId:N().optional(),msgId:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("thinking_delta"),reasoningId:N(),deltaContent:N(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("tool_start"),toolCallId:N(),toolName:N(),mcpServerName:N().optional(),arguments:Gg(N(),kl()).optional(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("tool_complete"),toolCallId:N(),success:or(),resultPreview:N().optional(),detailedContent:N().optional(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("subagent_started"),toolCallId:N(),agentName:N(),agentDisplayName:N(),agentDescription:N(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("subagent_completed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),durationMs:Mt().optional(),agentSlug:N().optional()}),ce({type:ye("activity"),sessionKey:N().optional(),turnId:N().optional(),kind:ye("subagent_failed"),toolCallId:N(),agentName:N(),agentDisplayName:N(),error:N().optional(),agentSlug:N().optional()}),ce({type:ye("queue-advance"),length:Mt(),sessionKey:N().optional()}),ce({type:ye("turn-interrupted"),abortedTurnId:N(),sessionKey:N().optional()})]),wq=ce({running:or(),pid:Mt().nullable(),startedAt:N().nullable(),projectRoot:N().nullable(),interval:Mt().nullable(),lastPollAt:N().nullable()}),Sq=ce({number:Mt(),title:N(),url:N(),state:N(),createdAt:N(),labels:cr(N())}),kq=ce({projectRoot:N(),issues:cr(Sq)}),vq=ce({pid:Mt(),projectRoot:N(),interval:Mt()}),xq=ce({stopped:ye(!0)}),Cq=ce({turnId:N()}),Eq=ce({type:ye("turn:started"),turnId:N(),sessionKey:N(),prompt:N(),attachments:cr(ce({type:ye("file"),path:N(),displayName:N().optional()})).optional()}),_q=ce({type:ye("turn:delta"),turnId:N(),sessionKey:N(),part:hq}),Tq=ce({type:ye("turn:queued"),turnId:N(),sessionKey:N(),position:Mt()}),Aq=ce({type:ye("turn:interrupted"),turnId:N(),sessionKey:N()}),Pq=ce({type:ye("turn:complete"),turnId:N(),sessionKey:N(),finalMessage:N()}),Iq=ce({type:ye("turn:error"),turnId:N(),sessionKey:N(),error:N()}),Rq=dv("type",[Eq,_q,Tq,Aq,Pq,Iq]),Nq=new Set([408,425,429,500,502,503,504]),xp=[400,800,1600];let zb=null,pd=null,gd=null,Kg=!1;function $q(t){return zb=t,t}function Mq(){const t=new URL(window.location.href),e=new URLSearchParams(t.hash.startsWith("#")?t.hash.slice(1):t.hash);(t.searchParams.has("access_token")||t.searchParams.has("token")||e.has("access_token")||e.has("token"))&&(t.searchParams.delete("access_token"),t.searchParams.delete("token"),e.delete("access_token"),e.delete("token"),t.hash=e.toString()?`#${e.toString()}`:"",window.history.replaceState({},document.title,t.toString()))}function Qq(t){const e=(t??"GET").toUpperCase();return e==="GET"||e==="HEAD"||e==="OPTIONS"}function Lq(t){return t instanceof DOMException&&t.name==="AbortError"}function Dq(t){if(!t)return null;const e=Number(t);if(Number.isFinite(e))return Math.max(0,e*1e3);const n=Date.parse(t);return Number.isNaN(n)?null:Math.max(0,n-Date.now())}function $C(t,e){return Dq((t==null?void 0:t.headers.get("Retry-After"))??null)??xp[Math.min(e,xp.length-1)]}function MC(t){return new Promise(e=>window.setTimeout(e,t))}async function fv(t,e={},n={}){const r=n.retry??Qq(e.method);for(let i=0;;i+=1)try{const s=await fetch(t,e);if(!r||!Nq.has(s.status)||i>=xp.length)return s;await MC($C(s,i))}catch(s){if(!r||i>=xp.length||Lq(s))throw s;await MC($C(null,i))}}async function zq(){const t=await fv("/api/config/public",{},{retry:!0});if(!t.ok)throw new Error(`Failed to load auth config: ${t.status} ${t.statusText}`);const e=await t.json(),n=NY.safeParse(e);if(!n.success)throw console.error("[api] /api/config/public schema validation failed:",n.error.format()),new Error("The server returned an unexpected auth config shape. Please reload.");return n.data}async function jq(){if(zb)return zb;Mq();const t=await fv("/api/bootstrap",{},{retry:!0});if(!t.ok)throw new Error(`Bootstrap failed: ${t.status} ${t.statusText}`);const e=await t.json(),n=$Y.safeParse(e);if(!n.success)throw console.error("[api] /api/bootstrap schema validation failed:",n.error.format()),new Error("The server returned an unexpected bootstrap shape. Please reload.");const r=n.data;if(r.authMode==="standalone")return Kg=!0,"";if(r.authMode!=="legacy")throw new Error("Entra auth is enabled but the browser auth flow has not been initialized");if(!r.token)throw new Error("Bootstrap did not return an API token");return $q(r.token)}async function Jg(){return pd||(pd=zq().catch(t=>{throw pd=null,t})),await pd}async function em(){gd||(gd=(async()=>{const e=await Jg();return Kg=!e.entraAuthEnabled&&e.standalone,e.entraAuthEnabled?(await XW(e),{config:e,authEnabled:!0,isAuthenticated:aC(),user:lC()}):{config:e,authEnabled:!1,isAuthenticated:!0,user:null}})().catch(e=>{throw gd=null,e}));const t=await gd;return t.authEnabled?{...t,isAuthenticated:aC(),user:lC()}:t}async function Bq(){return(await em()).authEnabled?await WW():Kg?"":await jq()}async function Uu(t){const e=new Headers(t),n=await Bq();return!Kg&&n&&e.set("Authorization",`Bearer ${n}`),e}async function Uq(){if(!(await em()).authEnabled)throw new Error("Microsoft sign-in is not enabled for this Chapterhouse server");await FN()}async function Zq(){(await em()).authEnabled&&await VW()}async function yt(t,e={},n={}){const r=await Uu(e.headers);return e.body&&!r.has("Content-Type")&&r.set("Content-Type","application/json"),fv(t,{...e,headers:r},n)}async function bt(t,e){if(!t.ok){let i;try{const s=await t.json();i=(s==null?void 0:s.error)||JSON.stringify(s)}catch{i=await t.text().catch(()=>{})}throw new Error(`HTTP ${t.status}${i?": "+i:""}`)}const n=await t.json(),r=e.safeParse(n);if(!r.success){const i=t.url?` (${new URL(t.url,"http://localhost").pathname})`:"";throw console.error(`[api] Schema validation failed${i}:`,r.error.format()),new Error(`The server returned an unexpected response${i}. Please try again or contact support.`)}return r.data}const He={sendMessage:(t,e,n,r,i)=>yt("/api/message",{method:"POST",body:JSON.stringify({prompt:t,connectionId:e,...n?{projectPath:n}:{},...r?{sessionKey:r}:{},...i?{msgId:i}:{}})}).then(s=>bt(s,cO)),cancel:()=>yt("/api/cancel",{method:"POST"}).then(t=>bt(t,MY)),interruptMessage:(t,e,n,r)=>yt(`/api/sessions/${encodeURIComponent(t)}/interrupt`,{method:"POST",body:JSON.stringify({prompt:n,connectionId:e,...r&&r.length>0?{attachments:r}:{}})}).then(i=>bt(i,cO)),listWorkers:()=>yt("/api/workers").then(t=>bt(t,LY)),getWorker:t=>yt(`/api/workers/${encodeURIComponent(t)}`).then(e=>bt(e,DY)),getWorkerEvents:(t,e=0)=>yt(`/api/workers/${encodeURIComponent(t)}/events?afterSeq=${e}`).then(n=>bt(n,jY)),getModel:()=>yt("/api/model").then(t=>bt(t,BY)),setModel:t=>yt("/api/model",{method:"POST",body:JSON.stringify({model:t})}).then(e=>bt(e,UY)),listModels:()=>yt("/api/models").then(t=>bt(t,ZY)),getAuto:()=>yt("/api/auto").then(t=>bt(t,NC)),setAuto:t=>yt("/api/auto",{method:"POST",body:JSON.stringify(t)}).then(e=>bt(e,NC)),listPages:()=>yt("/api/wiki/pages").then(t=>bt(t,XY)),readPage:t=>yt(`/api/wiki/page?path=${encodeURIComponent(t)}`).then(e=>bt(e,WY)),writePage:(t,e)=>yt(`/api/wiki/page?path=${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({content:e})}).then(n=>bt(n,VY)),deletePage:t=>yt(`/api/wiki/page?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(e=>bt(e,HY)),listHistory:()=>yt("/api/history").then(t=>bt(t,qY)),listSkills:()=>yt("/api/skills").then(t=>bt(t,KY)),removeSkill:t=>yt(`/api/skills/${encodeURIComponent(t)}`,{method:"DELETE"}).then(e=>bt(e,JY)),restart:()=>yt("/api/restart",{method:"POST"}).then(t=>bt(t,cO)),getSessionMessages:(t,e)=>{const n=`/api/session/${encodeURIComponent(t)}/messages${e!==void 0?`?limit=${e}`:""}`;return yt(n).then(r=>bt(r,tq))},submitTurn:(t,e)=>yt(`/api/sessions/${encodeURIComponent(t)}/turn`,{method:"POST",body:JSON.stringify(e)}).then(n=>bt(n,Cq))};async function xo(t,e,n={}){const r=await yt(t,n);return bt(r,e)}const eu={list:()=>xo("/api/projects",rq),register:t=>xo("/api/projects",iq,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:t})}),remove:t=>xo(`/api/projects/${encodeURIComponent(t)}`,sq,{method:"DELETE"})},md={getStatus:()=>xo("/api/squad/ralph/status",wq),start:(t,e)=>xo("/api/squad/ralph/start",vq,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRoot:t,interval:e})}),stop:()=>xo("/api/squad/ralph/stop",xq,{method:"POST"}),getQueue:t=>xo(`/api/squad/ralph/queue?projectRoot=${encodeURIComponent(t)}`,kq)};function k$(t){return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Fq(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=(4-e.length%4)%4;return atob(e+"=".repeat(n))}function Xq(t){return`project:${t}`}const v$="sidebar.projects.expanded",Wq=5,Vq=[{to:"/chat",label:"Chat"}],Hq=[{to:"/workers",label:"Workers"},{to:"/ralph",label:"Ralph"},{to:"/wiki",label:"Wiki"},{to:"/history",label:"History"},{to:"/skills",label:"Skills"},{to:"/settings",label:"Settings"}];function Yq(){try{return localStorage.getItem(v$)==="true"}catch{return!1}}function qq(){const t=is(),[e,n]=A.useState(Yq),[r,i]=A.useState([]);A.useEffect(()=>{eu.list().then(a=>{const l=[...a].sort((c,u)=>{const h=new Date(c.lastUsedAt??c.loadedAt).getTime();return new Date(u.lastUsedAt??u.loadedAt).getTime()-h});i(l.slice(0,Wq))}).catch(()=>{})},[]);function s(){n(a=>{const l=!a;try{localStorage.setItem(v$,String(l))}catch{}return l})}function o(a){try{const l=Date.now()-new Date(a).getTime(),c=Math.floor(l/6e4);if(c<60)return`${c}m ago`;const u=Math.floor(c/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}catch{return""}}return y.jsxs("aside",{className:"sidebar",children:[y.jsxs("div",{className:"sidebar-brand",children:[y.jsx("img",{src:"/chapterhouse-icon.svg",alt:"",width:28,height:28}),y.jsx("span",{children:"Chapterhouse"})]}),y.jsxs("nav",{"aria-label":"Primary",children:[Vq.map(a=>y.jsx(Gm,{to:a.to,className:({isActive:l})=>"nav-link"+(l?" active":""),children:a.label},a.to)),y.jsxs("div",{className:"nav-group",children:[y.jsxs("div",{className:"nav-group-row",children:[y.jsx(Gm,{to:"/projects",end:!0,className:({isActive:a})=>"nav-link nav-group-label"+(a?" active":""),children:"Projects"}),y.jsx("button",{type:"button",className:"nav-group-toggle","aria-expanded":e,"aria-label":e?"Collapse recent projects":"Expand recent projects",onClick:s,children:y.jsx("span",{className:"nav-chevron"+(e?" nav-chevron-open":""),"aria-hidden":"true",children:"›"})})]}),e&&r.length>0&&y.jsx("ul",{className:"nav-recents",role:"list","aria-label":"Recent projects",children:r.map(a=>{const l=a.projectRoot.split("/").filter(Boolean).pop()??a.projectRoot,c=k$(a.projectRoot),u=o(a.lastUsedAt??a.loadedAt);return y.jsx("li",{children:y.jsxs("button",{type:"button",className:"nav-recent-link",title:a.projectRoot,"aria-label":l,onClick:()=>t(`/projects/chat/${c}`),children:[y.jsx("span",{className:"nav-recent-name",children:l}),u&&y.jsx("span",{className:"nav-recent-hint dim",children:u})]})},a.projectRoot)})}),e&&r.length===0&&y.jsx("p",{className:"nav-recents-empty dim",children:"No projects yet."})]}),Hq.map(a=>y.jsx(Gm,{to:a.to,className:({isActive:l})=>"nav-link"+(l?" active":""),children:a.label},a.to))]})]})}function kn({title:t,message:e,onRetry:n,retryLabel:r="Try again",inline:i=!1,children:s}){return y.jsxs("section",{className:`error-notice${i?" inline":""}`,role:"alert","aria-live":"assertive",children:[t?y.jsx("h2",{className:"error-notice-title",children:t}):null,y.jsx("p",{className:"error-notice-message",children:e}),n||s?y.jsxs("div",{className:"error-notice-actions",children:[n?y.jsx("button",{type:"button",className:"btn",onClick:n,children:r}):null,s]}):null]})}function xn({label:t,detail:e,inline:n=!1,centered:r=!1,children:i}){const s=["loading-state",n?"inline":"",r?"centered":""].filter(Boolean).join(" ");return y.jsxs("div",{className:s,role:"status","aria-live":"polite",children:[y.jsx("span",{className:"loading-spinner","aria-hidden":"true"}),y.jsxs("div",{children:[y.jsx("div",{className:"loading-state-label",children:t}),e?y.jsx("div",{className:"loading-state-detail",children:e}):null,i]})]})}const QC=t=>{let e;const n=new Set,r=(c,u)=>{const h=typeof c=="function"?c(e):c;if(!Object.is(h,e)){const d=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(f=>f(e,d))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,a);return a},Gq=t=>t?QC(t):QC,Kq=t=>t;function Jq(t,e=Kq){const n=Sa.useSyncExternalStore(t.subscribe,Sa.useCallback(()=>e(t.getState()),[t,e]),Sa.useCallback(()=>e(t.getInitialState()),[t,e]));return Sa.useDebugValue(n),n}const LC=t=>{const e=Gq(t),n=r=>Jq(e,r);return Object.assign(n,e),n},eG=t=>t?LC(t):LC;function tG(t,e){const n=[];t&&n.push({type:"text",text:t});for(const r of e)r.kind==="thinking"?n.push({type:"thinking",reasoningId:r.reasoningId,text:r.text,active:r.active}):r.kind==="tool"?n.push({type:"tool-call",toolCallId:r.toolCallId,toolName:r.toolName,mcpServerName:r.mcpServerName,arguments:r.arguments,status:r.status,resultPreview:r.resultPreview,detailedContent:r.detailedContent,agentSlug:r.agentSlug}):r.kind==="subagent"&&n.push({type:"subagent",toolCallId:r.toolCallId,agentName:r.agentName,agentDisplayName:r.agentDisplayName,agentDescription:r.agentDescription,status:r.status,durationMs:r.durationMs,error:r.error,agentSlug:r.agentSlug});return n}const pv=[];let nG=0;const Od=()=>`m-${++nG}-${Date.now()}`;function rG(t,e){const n=e.agentSlug;switch(e.kind){case"thinking_delta":{const r=t.findIndex(o=>o.kind==="thinking"&&o.reasoningId===e.reasoningId&&o.agentSlug===n);if(r===-1)return[...t,{kind:"thinking",reasoningId:e.reasoningId,text:e.deltaContent,active:!0,agentSlug:n}];const i=t.slice(),s=i[r];return i[r]={...s,text:s.text+e.deltaContent,active:!0},i}case"tool_start":return[...t,{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,mcpServerName:e.mcpServerName,arguments:e.arguments,status:"running",agentSlug:n}];case"tool_complete":{const r=t.findIndex(o=>o.kind==="tool"&&o.toolCallId===e.toolCallId);if(r===-1)return t;const i=t.slice(),s=i[r];return i[r]={...s,status:e.success?"done":"failed",resultPreview:e.resultPreview,detailedContent:e.detailedContent},i}case"subagent_started":return[...t,{kind:"subagent",toolCallId:e.toolCallId,agentName:e.agentName,agentDisplayName:e.agentDisplayName,agentDescription:e.agentDescription,status:"running",agentSlug:n}];case"subagent_completed":{const r=t.findIndex(o=>o.kind==="subagent"&&o.toolCallId===e.toolCallId);if(r===-1)return t;const i=t.slice(),s=i[r];return i[r]={...s,status:"done",durationMs:e.durationMs},i}case"subagent_failed":{const r=t.findIndex(o=>o.kind==="subagent"&&o.toolCallId===e.toolCallId);if(r===-1)return t;const i=t.slice(),s=i[r];return i[r]={...s,status:"failed",error:e.error},i}}}function iG(t,e){switch(e.kind){case"thinking_delta":{const n=t.findIndex(s=>s.type==="thinking"&&s.reasoningId===e.reasoningId);if(n===-1)return[...t,{type:"thinking",reasoningId:e.reasoningId,text:e.deltaContent,active:!0}];const r=t.slice(),i=r[n];return r[n]={...i,text:i.text+e.deltaContent,active:!0},r}case"tool_start":{const n={type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,mcpServerName:e.mcpServerName,arguments:e.arguments,status:"running",agentSlug:e.agentSlug};if(!e.agentSlug)return[...t,n];const r=Date.now(),i=t.findIndex(a=>a.type==="activity-heartbeat"&&a.agentSlug===e.agentSlug);if(i===-1)return[...t,n,{type:"activity-heartbeat",agentSlug:e.agentSlug,agentName:e.agentSlug,currentAction:`running ${e.toolName}`,startedAt:r,lastUpdate:r}];const s=t[i],o=t.slice();return r-s.lastUpdate>=5e3&&(o[i]={...s,currentAction:`running ${e.toolName}`,lastUpdate:r}),[...o,n]}case"tool_complete":{const n=t.findIndex(s=>s.type==="tool-call"&&s.toolCallId===e.toolCallId);if(n===-1)return t;const r=t.slice(),i=r[n];return r[n]={...i,status:e.success?"done":"failed",resultPreview:e.resultPreview,detailedContent:e.detailedContent},r}case"subagent_started":{const n={type:"subagent",toolCallId:e.toolCallId,agentName:e.agentName,agentDisplayName:e.agentDisplayName,agentDescription:e.agentDescription,status:"running",agentSlug:e.agentSlug};if(!e.agentSlug)return[...t,n];if(t.findIndex(s=>s.type==="activity-heartbeat"&&s.agentSlug===e.agentSlug)!==-1)return[...t,n];const i=Date.now();return[...t,n,{type:"activity-heartbeat",agentSlug:e.agentSlug,agentName:e.agentDisplayName||e.agentName,currentAction:"starting…",startedAt:i,lastUpdate:i}]}case"subagent_completed":{const n=t.findIndex(i=>i.type==="subagent"&&i.toolCallId===e.toolCallId);let r=t.slice();return n!==-1&&(r[n]={...r[n],status:"done",durationMs:e.durationMs}),e.agentSlug&&(r=r.filter(i=>!(i.type==="activity-heartbeat"&&i.agentSlug===e.agentSlug))),r}case"subagent_failed":{const n=t.findIndex(i=>i.type==="subagent"&&i.toolCallId===e.toolCallId);let r=t.slice();return n!==-1&&(r[n]={...r[n],status:"failed",error:e.error}),e.agentSlug&&(r=r.filter(i=>!(i.type==="activity-heartbeat"&&i.agentSlug===e.agentSlug))),r}}}function sG(t,e){switch(e.type){case"thinking":{const n=t.findIndex(s=>s.type==="thinking"&&s.reasoningId===e.reasoningId);if(n===-1)return[...t,e];const r=t[n],i=t.slice();return i[n]={...r,text:r.text+e.text,active:e.active},i}case"tool-call":{const n=t.findIndex(i=>i.type==="tool-call"&&i.toolCallId===e.toolCallId);if(n===-1)return[...t,e];const r=t.slice();return r[n]={...r[n],...e},r}case"subagent":{const n=t.findIndex(i=>i.type==="subagent"&&i.toolCallId===e.toolCallId);if(n===-1)return[...t,e];const r=t.slice();return r[n]={...r[n],...e},r}default:return[...t,e]}}const Ae=eG((t,e)=>({connectionId:null,setConnectionId:n=>t({connectionId:n}),sseStatus:"idle",setSseStatus:n=>t({sseStatus:n}),messagesBySession:{},getMessages:n=>e().messagesBySession[n]??pv,addUserMessage:(n,r,i)=>{const s=Od(),o=i??crypto.randomUUID();return t(a=>{const l=a.messagesBySession[r]??[];return{messagesBySession:{...a.messagesBySession,[r]:[...l,{role:"user",id:s,content:n,ts:Date.now(),deliveryStatus:"posting",clientMsgId:o}]}}}),s},markMessageSent:(n,r)=>t(i=>{const s=i.messagesBySession[r]??[];return{messagesBySession:{...i.messagesBySession,[r]:s.map(o=>o.id===n&&o.role==="user"&&o.deliveryStatus==="posting"?{...o,deliveryStatus:"sent"}:o)}}}),markQueuedBackend:(n,r,i)=>t(s=>{const o=s.messagesBySession[i]??[];return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>a.role==="user"&&a.clientMsgId===n?{...a,deliveryStatus:"queued-backend",queuePosition:r}:a)}}}),advanceQueuedSession:n=>t(r=>{const i=r.messagesBySession[n]??[];let s=!1;return{messagesBySession:{...r.messagesBySession,[n]:i.map(o=>!s&&o.role==="user"&&o.deliveryStatus==="queued-backend"?(s=!0,{...o,deliveryStatus:"sent",queuePosition:void 0}):o)}}}),receiveQueueAdvance:(n,r)=>t(i=>{const s=i.messagesBySession[n]??[];let o=!1,a=1;return{messagesBySession:{...i.messagesBySession,[n]:s.map(l=>l.role!=="user"||l.deliveryStatus!=="queued-backend"?l:o?{...l,queuePosition:a++}:(o=!0,l))}}}),startAssistantMessage:n=>{const r=Od();return t(i=>{const s=i.messagesBySession[n]??[];return{messagesBySession:{...i.messagesBySession,[n]:[...s,{role:"assistant",id:r,content:"",ts:Date.now(),pending:!0,activities:[],parts:[]}]}}}),r},appendDelta:(n,r,i)=>t(s=>{const o=s.messagesBySession[i]??[];return{messagesBySession:{...s.messagesBySession,[i]:o.map(a=>{if(a.id!==n||a.role!=="assistant")return a;const l=a.parts.findIndex(u=>u.type==="text"),c=l===-1?[...a.parts,{type:"text",text:r}]:a.parts.map((u,h)=>h===l?{type:"text",text:r}:u);return{...a,content:r,pending:!0,parts:c}})}}}),finishAssistant:(n,r,i,s)=>t(o=>{const a=o.messagesBySession[i]??[];return{messagesBySession:{...o.messagesBySession,[i]:a.map(l=>{if(l.id!==n||l.role!=="assistant")return l;const c=l.activities.map(d=>d.kind==="thinking"?{...d,active:!1}:d);let u=!1;const h=l.parts.map(d=>d.type==="text"?(u=!0,{...d,text:r}):d.type==="thinking"?{...d,active:!1}:d);return!u&&r&&h.push({type:"text",text:r}),{...l,content:r,pending:!1,route:s,activities:c,parts:h}})}}}),markCancelled:n=>t(r=>{const i=r.messagesBySession[n]??[];return{messagesBySession:{...r.messagesBySession,[n]:i.map(s=>s.role==="assistant"&&s.pending?{...s,content:s.content+`
|
|
131
131
|
|
|
132
132
|
_(cancelled)_`,pending:!1,activities:s.activities.map(o=>o.kind==="thinking"&&o.active?{...o,active:!1}:o),parts:s.parts.map(o=>o.type==="text"?{...o,text:o.text+`
|
|
133
133
|
|
|
@@ -216,4 +216,4 @@ Try sending your message again.`,i)}finally{w(!1)}}function te(q){q.key==="Enter
|
|
|
216
216
|
\${}
|
|
217
217
|
}
|
|
218
218
|
}`,{label:"class",detail:"definition",type:"keyword"}),Tn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Tn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Vge=lz.concat([Tn("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Tn("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Tn("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),NA=new qL,cz=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Pc(t){return(e,n)=>{let r=e.node.getChild("VariableDefinition");return r&&n(r,t),!0}}const Hge=["FunctionDeclaration"],Yge={FunctionDeclaration:Pc("function"),ClassDeclaration:Pc("class"),ClassExpression:()=>!0,EnumDeclaration:Pc("constant"),TypeAliasDeclaration:Pc("type"),NamespaceDeclaration:Pc("namespace"),VariableDefinition(t,e){t.matchContext(Hge)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function uz(t,e){let n=NA.get(e);if(n)return n;let r=[],i=!0;function s(o,a){let l=t.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(je.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=Yge[o.name];if(a&&a(o,s)||cz.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of uz(t,o.node))r.push(a);return!1}}),NA.set(e,r),r}const $A=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,hz=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function qge(t){let e=Je(t.state).resolveInner(t.pos,-1);if(hz.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&$A.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let i=e;i;i=i.parent)cz.has(i.name)&&(r=r.concat(uz(t.state.doc,i)));return{options:r,from:n?e.from:t.pos,validFor:$A}}const vi=Il.define({name:"javascript",parser:Wge.configure({props:[Mh.add({IfStatement:Ef({except:/^\s*({|else\b)/}),TryStatement:Ef({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Sce,SwitchBody:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:r?1:2)*t.unit},Block:wce({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Ef({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),tc.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":iD,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let n=t.lastChild;return{from:e.to,to:n.type.isError?t.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let n=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,r=t.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?t.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),dz={test:t=>/^JSX/.test(t.name),facet:c0({commentTokens:{block:{open:"{/*",close:"*/}"}}})},fz=vi.configure({dialect:"ts"},"typescript"),pz=vi.configure({dialect:"jsx",props:[u0.add(t=>t.isTop?[dz]:void 0)]}),gz=vi.configure({dialect:"jsx ts",props:[u0.add(t=>t.isTop?[dz]:void 0)]},"typescript");let mz=t=>({label:t,type:"keyword"});const Oz="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(mz),Gge=Oz.concat(["declare","implements","private","protected","public"].map(mz));function Kge(t={}){let e=t.jsx?t.typescript?gz:pz:t.typescript?fz:vi,n=t.typescript?Vge.concat(Gge):lz.concat(Oz);return new ih(e,[vi.data.of({autocomplete:Bhe(hz,o2(n))}),vi.data.of({autocomplete:qge}),t.jsx?tme:[]])}function Jge(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function MA(t,e,n=t.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return t.sliceString(r.from,Math.min(r.to,n));return""}const eme=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),tme=re.inputHandler.of((t,e,n,r,i)=>{if((eme?t.composing:t.compositionStarted)||t.state.readOnly||e!=n||r!=">"&&r!="/"||!vi.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:u}=l,h=Je(o).resolveInner(u-1,-1),d;if(h.name=="JSXStartTag"&&(h=h.parent),!(o.doc.sliceString(u-1,u)!=r||h.name=="JSXAttributeValue"&&h.to>u)){if(r==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:u,insert:"</>"}};if(r=="/"&&h.name=="JSXStartCloseTag"){let f=h.parent,p=f.parent;if(p&&f.from==u-2&&((d=MA(o.doc,p.firstChild,u))||((c=p.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let g=`${d}>`;return{range:B.cursor(u+g.length,-1),changes:{from:u,insert:g}}}}else if(r==">"){let f=Jge(h);if(f&&f.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(u,u+2))&&(d=MA(o.doc,f,u)))return{range:l,changes:{from:u,insert:`</${d}>`}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Ic=["_blank","_self","_top","_parent"],py=["ascii","utf-8","utf-16","latin1","latin1"],gy=["get","post","put","delete"],my=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Vn=["true","false"],de={},nme={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ic,hreflang:null}},abbr:de,address:de,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:de,aside:de,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:de,base:{attrs:{href:null,target:Ic}},bdi:de,bdo:de,blockquote:{attrs:{cite:null}},body:de,br:de,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:my,formmethod:gy,formnovalidate:["novalidate"],formtarget:Ic,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:de,center:de,cite:de,code:de,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:de,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:de,div:de,dl:de,dt:de,em:de,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:de,figure:de,footer:de,form:{attrs:{action:null,name:null,"accept-charset":py,autocomplete:["on","off"],enctype:my,method:gy,novalidate:["novalidate"],target:Ic}},h1:de,h2:de,h3:de,h4:de,h5:de,h6:de,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:de,hgroup:de,hr:de,html:{attrs:{manifest:null}},i:de,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:my,formmethod:gy,formnovalidate:["novalidate"],formtarget:Ic,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:de,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:de,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:de,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:py,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:de,noscript:de,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:de,param:{attrs:{name:null,value:null}},pre:de,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:de,rt:de,ruby:de,samp:de,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:py}},section:de,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:de,source:{attrs:{src:null,type:null,media:null}},span:de,strong:de,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:de,summary:de,sup:de,table:de,tbody:de,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:de,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:de,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:de,time:{attrs:{datetime:null}},title:de,tr:de,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:de,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:de},yz={accesskey:null,class:null,contenteditable:Vn,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Vn,autocorrect:Vn,autocapitalize:Vn,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Vn,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Vn,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Vn,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Vn,"aria-hidden":Vn,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Vn,"aria-multiselectable":Vn,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Vn,"aria-relevant":null,"aria-required":Vn,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},bz="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of bz)yz[t]=null;class gh{constructor(e,n){this.tags={...nme,...e},this.globalAttrs={...yz,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}gh.default=new gh;function Ql(t,e,n=t.length){if(!e)return"";let r=e.firstChild,i=r&&r.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,n)):""}function Ll(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function wz(t,e,n){let r=n.tags[Ql(t,Ll(e))];return(r==null?void 0:r.children)||n.allTags}function D0(t,e){let n=[];for(let r=Ll(e);r&&!r.type.isTop;r=Ll(r.parent)){let i=Ql(t,r);if(i&&r.lastChild.name=="CloseTag")break;i&&n.indexOf(i)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&n.push(i)}return n}const Sz=/^[:\-\.\w\u00b7-\uffff]*$/;function QA(t,e,n,r,i){let s=/\s*>/.test(t.sliceDoc(i,i+5))?"":">",o=Ll(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:i,options:wz(t.doc,o,e).map(a=>({label:a,type:"type"})).concat(D0(t.doc,n).map((a,l)=>({label:"/"+a,apply:"/"+a+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function LA(t,e,n,r){let i=/\s*>/.test(t.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:D0(t.doc,e).map((s,o)=>({label:s,apply:s+i,type:"type",boost:99-o})),validFor:Sz}}function rme(t,e,n,r){let i=[],s=0;for(let o of wz(t.doc,n,e))i.push({label:"<"+o,type:"type"});for(let o of D0(t.doc,n))i.push({label:"</"+o+">",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function ime(t,e,n,r,i){let s=Ll(n),o=s?e.tags[Ql(t.doc,s)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:i,options:l.map(c=>({label:c,type:"property"})),validFor:Sz}}function sme(t,e,n,r,i){var s;let o=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),a=[],l;if(o){let c=t.sliceDoc(o.from,o.to),u=e.globalAttrs[c];if(!u){let h=Ll(n),d=h?e.tags[Ql(t.doc,h)]:null;u=(d==null?void 0:d.attrs)&&d.attrs[c]}if(u){let h=t.sliceDoc(r,i).toLowerCase(),d='"',f='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,d="",f=t.sliceDoc(i,i+1)==h[0]?"":h[0],h=h.slice(1),r++):l=/^[^\s<>='"]*$/;for(let p of u)a.push({label:p,apply:d+p+f,type:"constant"})}}return{from:r,to:i,options:a,validFor:l}}function kz(t,e){let{state:n,pos:r}=e,i=Je(n).resolveInner(r,-1),s=i.resolve(r);for(let o=r,a;s==i&&(a=i.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.from<l.to)break;s=i=a,o=l.from}return i.name=="TagName"?i.parent&&/CloseTag$/.test(i.parent.name)?LA(n,i,i.from,r):QA(n,t,i,i.from,r):i.name=="StartTag"||i.name=="IncompleteTag"?QA(n,t,i,r,r):i.name=="StartCloseTag"||i.name=="IncompleteCloseTag"?LA(n,i,r,r):i.name=="OpenTag"||i.name=="SelfClosingTag"||i.name=="AttributeName"?ime(n,t,i,i.name=="AttributeName"?i.from:r,r):i.name=="Is"||i.name=="AttributeValue"||i.name=="UnquotedAttributeValue"?sme(n,t,i,i.name=="Is"?r:i.from,r):e.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?rme(n,t,i,r):null}function ome(t){return kz(gh.default,t)}function ame(t){let{extraTags:e,extraGlobalAttributes:n}=t,r=n||e?new gh(e,n):gh.default;return i=>kz(r,i)}const lme=vi.parser.configure({top:"SingleExpression"}),vz=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:fz.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:pz.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:gz.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:lme},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:vi.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:ug.parser}],xz=[{name:"style",parser:ug.parser.configure({top:"Styles"})}].concat(bz.map(t=>({name:t,parser:vi.parser}))),Cz=Il.define({name:"html",parser:Npe.configure({props:[Mh.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].length<t.node.to)return t.continue();let e=null,n;for(let r=t.node;;){let i=r.lastChild;if(!i||i.name!="Element"||i.to!=r.to)break;e=r=i}return e&&!((n=e.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?t.lineIndent(e.from)+t.unit:null}}),tc.add({Element(t){let e=t.firstChild,n=t.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:n.name=="CloseTag"?n.from:t.to}}}),OD.add({"OpenTag CloseTag":t=>t.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Pf=Cz.configure({wrap:tz(vz,xz)});function cme(t={}){let e="",n;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(n=tz((t.nestedLanguages||[]).concat(vz),(t.nestedAttributes||[]).concat(xz)));let r=n?Cz.configure({wrap:n,dialect:e}):e?Pf.configure({dialect:e}):Pf;return new ih(r,[Pf.data.of({autocomplete:ame(t)}),t.autoCloseTags!==!1?ume:[],Kge().support,gge().support])}const DA=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),ume=re.inputHandler.of((t,e,n,r,i)=>{if(t.composing||t.state.readOnly||e!=n||r!=">"&&r!="/"||!Pf.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c,u,h;let d=o.doc.sliceString(l.from-1,l.to)==r,{head:f}=l,p=Je(o).resolveInner(f,-1),g;if(d&&r==">"&&p.name=="EndTag"){let b=p.parent;if(((u=(c=b.parent)===null||c===void 0?void 0:c.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(g=Ql(o.doc,b.parent,f))&&!DA.has(g)){let m=f+(o.doc.sliceString(f,f+1)===">"?1:0),O=`</${g}>`;return{range:l,changes:{from:f,to:m,insert:O}}}}else if(d&&r=="/"&&p.name=="IncompleteCloseTag"){let b=p.parent;if(p.from==f-2&&((h=b.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(g=Ql(o.doc,b,f))&&!DA.has(g)){let m=f+(o.doc.sliceString(f,f+1)===">"?1:0),O=`${g}>`;return{range:B.cursor(f+O.length,-1),changes:{from:f,to:m,insert:O}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Ez=c0({commentTokens:{block:{open:"<!--",close:"-->"}}}),_z=new Se,Tz=_fe.configure({props:[tc.add(t=>!t.is("Block")||t.is("Document")||rS(t)!=null||hme(t)?void 0:(e,n)=>({from:n.doc.lineAt(e.from).to,to:e.to})),_z.add(rS),Mh.add({Document:()=>null}),_o.add({Document:Ez})]});function rS(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function hme(t){return t.name=="OrderedList"||t.name=="BulletList"}function dme(t,e){let n=t;for(;;){let r=n.nextSibling,i;if(!r||(i=rS(r.type))!=null&&i<=e)break;n=r}return n.to}const fme=rD.of((t,e,n)=>{for(let r=Je(t).resolveInner(n,-1);r&&!(r.from<e);r=r.parent){let i=r.type.prop(_z);if(i==null)continue;let s=dme(r,i);if(s>n)return{from:n,to:s}}return null});function z0(t){return new br(Ez,t,[],"markdown")}const pme=z0(Tz),gme=Tz.configure([Dfe,jfe,zfe,Bfe,{props:[tc.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),hg=z0(gme);function mme(t,e){return n=>{if(n&&t){let r=null;if(n=/\S*/.exec(n)[0],typeof t=="function"?r=t(n):r=Wp.matchLanguageName(t,n,!0),r instanceof Wp)return r.support?r.support.language.parser:rh.getSkippingParser(r.load());if(r)return r.parser}return e?e.parser:null}}class Oy{constructor(e,n,r,i,s,o,a){this.node=e,this.from=n,this.to=r,this.spaceBefore=i,this.spaceAfter=s,this.type=o,this.item=a}blank(e,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;r.length<e;)r+=" ";return r}else{for(let i=this.to-this.from-r.length-this.spaceAfter.length;i>0;i--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(e,n){let r=this.node.name=="OrderedList"?String(+Pz(this.item,e)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Az(t,e){let n=[],r=[];for(let i=t;i;i=i.parent){if(i.name=="FencedCode")return r;(i.name=="ListItem"||i.name=="Blockquote")&&n.push(i)}for(let i=n.length-1;i>=0;i--){let s=n[i],o,a=e.lineAt(s.from),l=s.from-a.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))r.push(new Oy(s,l,l+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=o[3],u=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),u-=4),r.push(new Oy(s.parent,l,l+u,o[1],c,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=o[4],u=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),u-=4);let h=o[2];o[3]&&(h+=o[3].replace(/[xX]/," ")),r.push(new Oy(s.parent,l,l+u,o[1],c,h,s))}}return r}function Pz(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function yy(t,e,n,r=0){for(let i=-1,s=t;;){if(s.name=="ListItem"){let a=Pz(s,e),l=+a[2];if(i>=0){if(l!=i+1)return;n.push({from:s.from+a[1].length,to:s.from+a[0].length,insert:String(i+2+r)})}i=l}let o=s.nextSibling;if(!o)break;s=o}}function j0(t,e){let n=/^[ \t]*/.exec(t)[0].length;if(!n||e.facet(ec)!=" ")return t;let r=Hr(t,4,n),i="";for(let s=r;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+t.slice(n)}const Ome=(t={})=>({state:e,dispatch:n})=>{let r=Je(e),{doc:i}=e,s=null,o=e.changeByRange(a=>{if(!a.empty||!hg.isActiveAt(e,a.from,-1)&&!hg.isActiveAt(e,a.from,1))return s={range:a};let l=a.from,c=i.lineAt(l),u=Az(r.resolveInner(l,-1),i);for(;u.length&&u[u.length-1].from>l-c.from;)u.pop();if(!u.length)return s={range:a};let h=u[u.length-1];if(h.to-h.spaceAfter.length>l-c.from)return s={range:a};let d=l>=h.to-h.spaceAfter.length&&!/\S/.test(c.text.slice(h.to));if(h.item&&d){let m=h.node.firstChild,O=h.node.getChild("ListItem","ListItem");if(m.to>=l||O&&O.to<l||c.from>0&&!/[^\s>]/.test(i.lineAt(c.from-1).text)||t.nonTightLists===!1){let w=u.length>1?u[u.length-2]:null,k,x="";w&&w.item?(k=c.from+w.from,x=w.marker(i,1)):k=c.from+(w?w.to:0);let S=[{from:k,to:l,insert:x}];return h.node.name=="OrderedList"&&yy(h.item,i,S,-2),w&&w.node.name=="OrderedList"&&yy(w.item,i,S),{range:B.cursor(k+x.length),changes:S}}else{let w=jA(u,e,c);return{range:B.cursor(l+w.length+1),changes:{from:c.from,insert:w+e.lineBreak}}}}if(h.node.name=="Blockquote"&&d&&c.from){let m=i.lineAt(c.from-1),O=/>\s*$/.exec(m.text);if(O&&O.index==h.from){let w=e.changes([{from:m.from+O.index,to:m.to},{from:c.from+h.from,to:c.to}]);return{range:a.map(w),changes:w}}}let f=[];h.node.name=="OrderedList"&&yy(h.item,i,f);let p=h.item&&h.item.from<c.from,g="";if(!p||/^[\s\d.)\-+*>]*/.exec(c.text)[0].length>=h.to)for(let m=0,O=u.length-1;m<=O;m++)g+=m==O&&!p?u[m].marker(i,1):u[m].blank(m<O?Hr(c.text,4,u[m+1].from)-g.length:null);let b=l;for(;b>c.from&&/\s/.test(c.text.charAt(b-c.from-1));)b--;return g=j0(g,e),bme(h.node,e.doc)&&(g=jA(u,e,c)+e.lineBreak+g),f.push({from:b,to:l,insert:e.lineBreak+g}),{range:B.cursor(b+g.length+1),changes:f}});return s?!1:(n(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},yme=Ome();function zA(t){return t.name=="QuoteMark"||t.name=="ListMark"}function bme(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let n=t.firstChild,r=t.getChild("ListItem","ListItem");if(!r)return!1;let i=e.lineAt(n.to),s=e.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+(o?0:1)<s.number}function jA(t,e,n){let r="";for(let i=0,s=t.length-2;i<=s;i++)r+=t[i].blank(i<s?Hr(n.text,4,t[i+1].from)-r.length:null,i<s);return j0(r,e)}function wme(t,e){let n=t.resolveInner(e,-1),r=e;zA(n)&&(r=n.from,n=n.parent);for(let i;i=n.childBefore(r);)if(zA(i))r=i.from;else if(i.name=="OrderedList"||i.name=="BulletList")n=i.lastChild,r=n.to;else break;return n}const Sme=({state:t,dispatch:e})=>{let n=Je(t),r=null,i=t.changeByRange(s=>{let o=s.from,{doc:a}=t;if(s.empty&&hg.isActiveAt(t,s.from)){let l=a.lineAt(o),c=Az(wme(n,o),a);if(c.length){let u=c[c.length-1],h=u.to-u.spaceAfter.length+(u.spaceAfter?1:0);if(o-l.from>h&&!/\S/.test(l.text.slice(h,o-l.from)))return{range:B.cursor(l.from+h),changes:{from:l.from+h,to:o}};if(o-l.from==h&&(!u.item||l.from<=u.item.from||!/\S/.test(l.text.slice(0,u.to)))){let d=l.from+u.from;if(u.item&&u.node.from<u.item.from&&/\S/.test(l.text.slice(u.from,u.to))){let f=u.blank(Hr(l.text,4,u.to)-Hr(l.text,4,u.from));return d==l.from&&(f=j0(f,t)),{range:B.cursor(d+f.length),changes:{from:d,to:l.from+u.to,insert:f}}}if(d<o)return{range:B.cursor(d),changes:{from:d,to:o}}}}}return r={range:s}});return r?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"delete"})),!0)},kme=[{key:"Enter",run:yme},{key:"Backspace",run:Sme}],Iz=cme({matchClosingTags:!1});function vme(t={}){let{codeLanguages:e,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:i}=pme,completeHTMLTags:s=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=Iz}=t;if(!(i instanceof vm))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=t.extensions?[t.extensions]:[],c=[a.support,fme],u;o&&c.push(_me),n instanceof ih?(c.push(n.support),u=n.language):n&&(u=n);let h=e||u?mme(e,u):void 0;l.push(Afe({codeParser:h,htmlParser:a.language.parser})),r&&c.push(os.high(Kl.of(kme)));let d=z0(i.configure(l));return s&&c.push(d.data.of({autocomplete:xme})),new ih(d,c)}function xme(t){let{state:e,pos:n}=t,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(n-25,n));if(!r)return null;let i=Je(e).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name=="CodeBlock"||i.name=="FencedCode"||i.name=="ProcessingInstructionBlock"||i.name=="CommentBlock"||i.name=="Link"||i.name=="Image")return null;i=i.parent}return{from:n-r[0].length,to:n,options:Cme(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let by=null;function Cme(){if(by)return by;let t=ome(new w0(Te.create({extensions:Iz}),0,!0));return by=t?t.options:[]}const Eme=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,_me=re.domEventHandlers({paste:(t,e)=>{var n;let{main:r}=e.state.selection;if(r.empty)return!1;let i=(n=t.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!hg.isActiveAt(e.state,r.from,1)))return!1;let s=Je(e.state),o=!1;return s.iterate({from:r.from,to:r.to,enter:a=>{(a.from>r.from||Eme.test(a.name))&&(o=!0)},leave:a=>{a.to<r.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${i})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}});function Tme(){const[t]=dR(),e=t.get("path"),n=t.get("new")==="1",[r,i]=A.useState(e||"pages/"),[s,o]=A.useState(""),[a,l]=A.useState(n),[c,u]=A.useState(!1),[h,d]=A.useState(null),f=is();A.useEffect(()=>{if(!e||n){l(!0);return}l(!1),He.readPage(e).then(g=>{o(g.content),l(!0),d(null)}).catch(g=>d(g instanceof Error?g.message:String(g)))},[e,n]);async function p(){if(!r.startsWith("pages/")||!r.endsWith(".md")){d("Path must start with pages/ and end in .md");return}u(!0),d(null);try{await He.writePage(r,s),f(`/wiki?selected=${encodeURIComponent(r)}`)}catch(g){d(g instanceof Error?g.message:String(g))}finally{u(!1)}}return a?y.jsxs("div",{className:"page wiki-edit",children:[y.jsx("header",{className:"page-header",children:y.jsx("h1",{children:n?"New page":"Edit page"})}),h?y.jsx(kn,{inline:!0,message:h,onRetry:()=>void p()}):null,y.jsx("div",{className:"row",children:y.jsxs("label",{htmlFor:"wiki-path",children:["Path",y.jsx("input",{id:"wiki-path",type:"text",value:r,onChange:g=>i(g.target.value),disabled:!n,"aria-invalid":!!(h&&(!r.startsWith("pages/")||!r.endsWith(".md")))})]})}),y.jsx("div",{className:"wiki-editor","aria-label":"Markdown editor",children:y.jsx(S2,{value:s,height:"60vh",extensions:[vme()],onChange:g=>o(g),theme:"dark"})}),y.jsxs("div",{className:"composer-actions",children:[y.jsx("button",{type:"button",className:"btn primary",onClick:()=>void p(),disabled:c,children:c?"Saving…":"Save"}),y.jsx("button",{type:"button",className:"btn",onClick:()=>f(e?`/wiki?selected=${encodeURIComponent(e)}`:"/wiki"),children:"Cancel"})]})]}):y.jsx(xn,{centered:!0,label:"Loading editor",detail:"Fetching the wiki page content."})}function Ame(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(!0);async function o(){s(!0);try{const l=await He.listSkills();e(l),r(null)}catch(l){r(l instanceof Error?l.message:String(l))}finally{s(!1)}}A.useEffect(()=>{o()},[]);async function a(l){if(confirm(`Uninstall ${l}?`))try{const c=await He.removeSkill(l);if(!c.ok){r(c.message);return}await o()}catch(c){r(c instanceof Error?c.message:String(c))}}return y.jsxs("div",{className:"page skills",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Skills"}),y.jsx("p",{className:"dim",children:"Bundled skills ship with Chapterhouse. Local skills live in ~/.chapterhouse/skills/ and can be uninstalled here."})]}),n?y.jsx(kn,{inline:!0,message:n,onRetry:()=>void o()}):null,i&&t===null?y.jsx(xn,{inline:!0,label:"Loading skills"}):null,y.jsx("div",{className:"skill-grid",children:t==null?void 0:t.map(l=>y.jsxs("div",{className:"skill-card",children:[y.jsxs("div",{className:"skill-head",children:[y.jsx("strong",{children:l.name}),y.jsx("span",{className:`tag tag-${l.source}`,children:l.source})]}),y.jsx("div",{className:"dim small",children:l.slug}),y.jsx("p",{children:l.description}),l.source==="local"?y.jsx("button",{type:"button",className:"btn danger",onClick:()=>void a(l.slug),children:"Uninstall"}):null]},l.directory))})]})}function Pme(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(!0);async function o(){s(!0);try{e(await He.listHistory()),r(null)}catch(a){r(a instanceof Error?a.message:String(a))}finally{s(!1)}}return A.useEffect(()=>{o()},[]),y.jsxs("div",{className:"page history",children:[y.jsxs("header",{className:"page-header",children:[y.jsx("h1",{children:"Conversation history"}),y.jsxs("p",{className:"dim",children:["Daily summaries Chapterhouse writes to ",y.jsx("code",{children:"pages/conversations/"}),". Newest first."]})]}),n?y.jsx(kn,{inline:!0,message:n,onRetry:()=>void o()}):null,i&&t===null?y.jsx(xn,{inline:!0,label:"Loading conversation history"}):null,t&&t.length===0?y.jsx(Ws,{icon:"📄",title:"No history yet",description:"Conversation summaries will appear here once Chapterhouse writes them to pages/conversations/."}):null,y.jsx("ul",{className:"history-list",children:t==null?void 0:t.map(a=>{const l=a.path.split("/").pop()||a.path,c=new Date(a.mtime).toLocaleString();return y.jsxs("li",{children:[y.jsx(hR,{to:`/wiki?selected=${encodeURIComponent(a.path)}`,className:"link",children:l}),y.jsxs("span",{className:"dim small",children:[" · ",c]})]},a.path)})})]})}function Ime(){const[t,e]=A.useState(null),[n,r]=A.useState(null),[i,s]=A.useState(null),[o,a]=A.useState(null),[l,c]=A.useState(!0),[u,h]=A.useState(!1),d=Ae(m=>m.setCurrentModel);async function f(){a(null),c(!0);try{const[m,O]=await Promise.all([He.listModels(),He.getAuto()]);e(m.models),r(m.current),d(m.current),s(O)}catch(m){a(m instanceof Error?m.message:String(m))}finally{c(!1)}}A.useEffect(()=>{f()},[]);async function p(m){if(!(!m||m===n)){h(!0),a(null);try{await He.setModel(m),r(m),d(m)}catch(O){a(O instanceof Error?O.message:String(O))}finally{h(!1)}}}async function g(){if(i){h(!0),a(null);try{await He.setAuto({enabled:!i.enabled}),await f()}catch(m){a(m instanceof Error?m.message:String(m))}finally{h(!1)}}}async function b(){if(confirm("Restart the daemon? In-flight workers will be stopped.")){a(null),h(!0);try{await He.restart()}catch(m){a(m instanceof Error?m.message:String(m))}finally{h(!1)}}}return y.jsxs("div",{className:"page settings",children:[y.jsx("header",{className:"page-header",children:y.jsx("h1",{children:"Settings"})}),o?y.jsx(kn,{inline:!0,message:o,onRetry:()=>void f()}):null,y.jsxs("section",{"aria-busy":l||u,children:[y.jsx("h2",{children:"Model"}),l&&t===null?y.jsx(xn,{inline:!0,label:"Loading available models"}):y.jsxs("div",{className:"row settings-row",children:[y.jsxs("label",{className:"settings-field",htmlFor:"model-select",children:[y.jsx("span",{className:"settings-field-label",children:"Available models"}),y.jsx("select",{id:"model-select",value:n??"",onChange:m=>void p(m.target.value),disabled:u,children:t==null?void 0:t.map(m=>y.jsx("option",{value:m,children:m},m))})]}),y.jsxs("span",{className:"dim small",children:["Current: ",n??"(unknown)"]})]})]}),y.jsxs("section",{"aria-busy":l||u,children:[y.jsx("h2",{children:"Auto-routing"}),l&&i===null?y.jsx(xn,{inline:!0,label:"Loading routing preferences"}):i?y.jsxs(y.Fragment,{children:[y.jsxs("p",{children:["Auto-routing is currently ",y.jsx("strong",{children:i.enabled?"enabled":"disabled"}),". When on, Chapterhouse picks the model tier per message."]}),y.jsx("button",{type:"button",className:"btn",onClick:()=>void g(),disabled:u,children:i.enabled?"Disable":"Enable"})]}):null]}),y.jsxs("section",{children:[y.jsx("h2",{children:"Daemon"}),y.jsx("button",{type:"button",className:"btn danger",onClick:()=>void b(),disabled:u,children:"Restart daemon"})]})]})}wy.createRoot(document.getElementById("root")).render(y.jsx(Sa.StrictMode,{children:y.jsx(gG,{children:y.jsx(uZ,{children:y.jsx(tZ,{children:y.jsxs(Hn,{path:"/",element:y.jsx(pG,{}),children:[y.jsx(Hn,{index:!0,element:y.jsx(KU,{to:"/chat",replace:!0})}),y.jsx(Hn,{path:"chat",element:y.jsx(fse,{})}),y.jsx(Hn,{path:"projects",element:y.jsx(bse,{})}),y.jsx(Hn,{path:"projects/chat/:projectRef",element:y.jsx(gse,{})}),y.jsx(Hn,{path:"workers",element:y.jsx(mse,{})}),y.jsx(Hn,{path:"ralph",element:y.jsx(yse,{})}),y.jsx(Hn,{path:"wiki",element:y.jsx(Ise,{})}),y.jsx(Hn,{path:"wiki/edit",element:y.jsx(Tme,{})}),y.jsx(Hn,{path:"skills",element:y.jsx(Ame,{})}),y.jsx(Hn,{path:"history",element:y.jsx(Pme,{})}),y.jsx(Hn,{path:"settings",element:y.jsx(Ime,{})})]})})})})}));
|
|
219
|
-
//# sourceMappingURL=index-
|
|
219
|
+
//# sourceMappingURL=index-BR2cks94.js.map
|