@inkeep/open-knowledge 0.0.0-dev-20260501054734 → 0.0.0-dev-20260501071238
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/assets/skills/open-knowledge/SKILL.md +12 -12
- package/dist/cli.mjs +345 -346
- package/dist/config-schema.json +1 -30
- package/dist/config.project.schema.json +1 -30
- package/dist/constants-Ccx0q5EO.mjs +2 -0
- package/dist/dist-B-uWyCj3.mjs +1 -0
- package/dist/{dist-Bk22-nn7.mjs → dist-CUghvkAf.mjs} +72 -70
- package/dist/{dist-BKxD-v-w.mjs → dist-WQbZIrx7.mjs} +36 -36
- package/dist/index.d.mts +1 -3
- package/dist/index.mjs +1 -1
- package/dist/{init-DEHyWHMa.mjs → init-DMUmlRUV.mjs} +29 -29
- package/dist/{init-DVZtt6e-.mjs → init-DQVmtI8h.mjs} +25 -16
- package/dist/init-Dd-ypqWc.mjs +1 -0
- package/dist/init-jnyR2hTf.mjs +1 -0
- package/dist/loader-IVNXMdm0.mjs +4 -0
- package/dist/loader-dh9DEQFy.mjs +1 -0
- package/dist/paths-Bp5ooOJg.mjs +2 -0
- package/dist/paths-CcnZRq8W.mjs +1 -0
- package/dist/preview-SUAZQ5h2.mjs +1 -0
- package/dist/preview-tSq0pzNL.mjs +3 -0
- package/dist/public/assets/{ActivityModeContent-BSkmKRy4.js → ActivityModeContent-Bj0kOgDy.js} +1 -1
- package/dist/public/assets/{DocumentContext-D3zjM2ax.js → DocumentContext-CDvFNgd7.js} +1 -1
- package/dist/public/assets/{GraphPanel-jbwIk-JX.js → GraphPanel-YIuSwj1X.js} +1 -1
- package/dist/public/assets/{SettingsPane-Bj0EiYda.js → SettingsPane-BYRRZ2yt.js} +1 -1
- package/dist/public/assets/{SourceEditor-Dz2Lc5LE.js → SourceEditor-BkBM9oYb.js} +1 -1
- package/dist/public/assets/{clipboard-i7TzBQ01.js → clipboard-BTbzStNo.js} +1 -1
- package/dist/public/assets/{config-validation-events-DpHbVC_H.js → config-validation-events-gPU2C30Q.js} +1 -1
- package/dist/public/assets/{index-joGKm2Br.js → index-C0JKXDVX.js} +71 -71
- package/dist/public/assets/{target-navigation-intent-CK4Ee17H.js → target-navigation-intent-BeUCdVKa.js} +1 -1
- package/dist/public/assets/{toggle-group-n36XMgMC.js → toggle-group-CyBGhndP.js} +6 -4
- package/dist/public/assets/{tooltip-BM5o_T0o.js → tooltip-FdwzzIbl.js} +1 -1
- package/dist/public/index.html +7 -7
- package/dist/schemas/v0/config.project.schema.json +1 -30
- package/dist/server-Bc0tGxRk.mjs +3 -0
- package/dist/{server-lock-n3Y5JWNv-3o7br8XE.mjs → server-lock-BAi_a4NX-CRPhQdIH.mjs} +1 -1
- package/dist/server-lock-BAi_a4NX-uRxotxS6.mjs +1 -0
- package/dist/src-B-NdiXlJ.mjs +1 -0
- package/dist/start-CUBxPqPc.mjs +2 -0
- package/dist/start-GoM45WVd.mjs +1 -0
- package/package.json +1 -1
- package/scripts/build-config-schema.mjs +2 -2
- package/dist/constants-C_Xn28oM.mjs +0 -2
- package/dist/dist-BuWOuGGO.mjs +0 -1
- package/dist/init-BrZlKzcx.mjs +0 -1
- package/dist/init-gZdio8Wt.mjs +0 -1
- package/dist/loader-CEV6AVlU.mjs +0 -1
- package/dist/loader-DD2NITvw.mjs +0 -2
- package/dist/paths-Dwr32i3p.mjs +0 -1
- package/dist/paths-ajeOK0uP.mjs +0 -2
- package/dist/preview-C86aCB1t.mjs +0 -3
- package/dist/preview-D6fWJCDu.mjs +0 -1
- package/dist/server-CYax-BjV.mjs +0 -3
- package/dist/server-lock-n3Y5JWNv-DXpg9_eU.mjs +0 -1
- package/dist/src-D6R3jg-t.mjs +0 -1
- package/dist/start-D5tAdx92.mjs +0 -2
- package/dist/start-DG0Lr5vX.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./toggle-group-
|
|
1
|
+
import{f as e}from"./toggle-group-CyBGhndP.js";import{S as t}from"./button-Dyz7QGIk.js";var n=t(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),r=t(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]);function i(e){switch(e.kind){case`doc`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:return`missing`}}function a(t,n){let r=e(t,n);return{resolvedTarget:r,hashDocName:r.target,displayState:i(r)}}export{r as n,n as r,a as t};
|
|
@@ -243,7 +243,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
243
243
|
|
|
244
244
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=_b,s=!nb.jitless,c=s&&vb.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?zS([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function HS(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Nb(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ib(e,r,rb())))}),t)}var US=L(`$ZodUnion`,(e,t)=>{eS.init(e,t),db(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),db(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),db(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),db(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>cb(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>HS(t,i,e,a)):HS(s,i,e,a)}}),WS=L(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,US.init(e,t);let n=e._zod.parse;db(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=ob(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!_b(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),GS=L(`$ZodIntersection`,(e,t)=>{eS.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>qS(e,t,n)):qS(e,i,a)}});function KS(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yb(e)&&yb(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=KS(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=KS(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function qS(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Nb(e))return e;let o=KS(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var JS=L(`$ZodRecord`,(e,t)=>{eS.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!yb(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Pb(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Pb(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Ax.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ib(e,r,rb())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Pb(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Pb(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),YS=L(`$ZodEnum`,(e,t)=>{eS.init(e,t);let n=ib(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>xb.has(typeof e)).map(e=>typeof e==`string`?Sb(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),XS=L(`$ZodLiteral`,(e,t)=>{if(eS.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Sb(e):e?Sb(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ZS=L(`$ZodTransform`,(e,t)=>{eS.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tb(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new eb;return n.value=i,n}});function QS(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var $S=L(`$ZodOptional`,(e,t)=>{eS.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,db(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),db(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cb(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>QS(t,e.value)):QS(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),eC=L(`$ZodExactOptional`,(e,t)=>{$S.init(e,t),db(e._zod,`values`,()=>t.innerType._zod.values),db(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),tC=L(`$ZodNullable`,(e,t)=>{eS.init(e,t),db(e._zod,`optin`,()=>t.innerType._zod.optin),db(e._zod,`optout`,()=>t.innerType._zod.optout),db(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cb(e.source)}|null)$`):void 0}),db(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),nC=L(`$ZodDefault`,(e,t)=>{eS.init(e,t),e._zod.optin=`optional`,db(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>rC(e,t)):rC(r,t)}});function rC(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var iC=L(`$ZodPrefault`,(e,t)=>{eS.init(e,t),e._zod.optin=`optional`,db(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),aC=L(`$ZodNonOptional`,(e,t)=>{eS.init(e,t),db(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>oC(t,e)):oC(i,e)}});function oC(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var sC=L(`$ZodCatch`,(e,t)=>{eS.init(e,t),db(e._zod,`optin`,()=>t.innerType._zod.optin),db(e._zod,`optout`,()=>t.innerType._zod.optout),db(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ib(e,n,rb()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ib(e,n,rb()))},input:e.value}),e.issues=[]),e)}}),cC=L(`$ZodPipe`,(e,t)=>{eS.init(e,t),db(e._zod,`values`,()=>t.in._zod.values),db(e._zod,`optin`,()=>t.in._zod.optin),db(e._zod,`optout`,()=>t.out._zod.optout),db(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>lC(e,t.in,n)):lC(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>lC(e,t.out,n)):lC(r,t.out,n)}});function lC(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var uC=L(`$ZodReadonly`,(e,t)=>{eS.init(e,t),db(e._zod,`propValues`,()=>t.innerType._zod.propValues),db(e._zod,`values`,()=>t.innerType._zod.values),db(e._zod,`optin`,()=>t.innerType?._zod?.optin),db(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(dC):dC(r)}});function dC(e){return e.value=Object.freeze(e.value),e}var fC=L(`$ZodCustom`,(e,t)=>{Fx.init(e,t),eS.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>pC(t,n,r,e));pC(i,n,r,e)}});function pC(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Rb(e))}}var mC,hC=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function gC(){return new hC}(mC=globalThis).__zod_globalRegistry??(mC.__zod_globalRegistry=gC());var _C=globalThis.__zod_globalRegistry;function vC(e,t){return new e({type:`string`,...R(t)})}function yC(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...R(t)})}function bC(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...R(t)})}function xC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...R(t)})}function SC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...R(t)})}function CC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...R(t)})}function wC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...R(t)})}function TC(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...R(t)})}function EC(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...R(t)})}function DC(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...R(t)})}function OC(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...R(t)})}function kC(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...R(t)})}function AC(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...R(t)})}function jC(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...R(t)})}function MC(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...R(t)})}function NC(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...R(t)})}function PC(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...R(t)})}function FC(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...R(t)})}function IC(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...R(t)})}function LC(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...R(t)})}function RC(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...R(t)})}function zC(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...R(t)})}function BC(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...R(t)})}function VC(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...R(t)})}function HC(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...R(t)})}function UC(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...R(t)})}function WC(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...R(t)})}function GC(e,t){return new e({type:`number`,checks:[],...R(t)})}function KC(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...R(t)})}function qC(e,t){return new e({type:`boolean`,...R(t)})}function JC(e,t){return new e({type:`null`,...R(t)})}function YC(e){return new e({type:`unknown`})}function XC(e,t){return new e({type:`never`,...R(t)})}function ZC(e,t){return new Lx({check:`less_than`,...R(t),value:e,inclusive:!1})}function QC(e,t){return new Lx({check:`less_than`,...R(t),value:e,inclusive:!0})}function $C(e,t){return new Rx({check:`greater_than`,...R(t),value:e,inclusive:!1})}function ew(e,t){return new Rx({check:`greater_than`,...R(t),value:e,inclusive:!0})}function tw(e,t){return new zx({check:`multiple_of`,...R(t),value:e})}function nw(e,t){return new Vx({check:`max_length`,...R(t),maximum:e})}function rw(e,t){return new Hx({check:`min_length`,...R(t),minimum:e})}function iw(e,t){return new Ux({check:`length_equals`,...R(t),length:e})}function aw(e,t){return new Gx({check:`string_format`,format:`regex`,...R(t),pattern:e})}function ow(e){return new Kx({check:`string_format`,format:`lowercase`,...R(e)})}function sw(e){return new qx({check:`string_format`,format:`uppercase`,...R(e)})}function cw(e,t){return new Jx({check:`string_format`,format:`includes`,...R(t),includes:e})}function lw(e,t){return new Yx({check:`string_format`,format:`starts_with`,...R(t),prefix:e})}function uw(e,t){return new Xx({check:`string_format`,format:`ends_with`,...R(t),suffix:e})}function dw(e){return new Zx({check:`overwrite`,tx:e})}function fw(e){return dw(t=>t.normalize(e))}function pw(){return dw(e=>e.trim())}function mw(){return dw(e=>e.toLowerCase())}function hw(){return dw(e=>e.toUpperCase())}function gw(){return dw(e=>hb(e))}function _w(e,t,n){return new e({type:`array`,element:t,...R(n)})}function vw(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...R(n)})}function yw(e){let t=bw(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Rb(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Rb(r))}},e(n.value,n)));return t}function bw(e,t){let n=new Fx({check:`custom`,...R(t)});return n._zod.check=e,n}function xw(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??_C,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Sw(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Sw(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Tw(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Cw(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
245
245
|
|
|
246
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ww(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Dw(t,`input`,e.processors),output:Dw(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Tw(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Tw(r.element,n);if(r.type===`set`)return Tw(r.valueType,n);if(r.type===`lazy`)return Tw(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 Tw(r.innerType,n);if(r.type===`intersection`)return Tw(r.left,n)||Tw(r.right,n);if(r.type===`record`||r.type===`map`)return Tw(r.keyType,n)||Tw(r.valueType,n);if(r.type===`pipe`)return Tw(r.in,n)||Tw(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Tw(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Tw(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Tw(e,n))return!0;return!!(r.rest&&Tw(r.rest,n))}return!1}var Ew=(e,t={})=>n=>{let r=xw({...n,processors:t});return Sw(e,r),Cw(r,e),ww(r,e)},Dw=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=xw({...i??{},target:a,io:t,processors:n});return Sw(e,o),Cw(o,e),ww(o,e)},Ow={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},kw=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ow[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Aw=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},jw=(e,t,n,r)=>{n.type=`boolean`},Mw=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Nw=(e,t,n,r)=>{n.not={}},Pw=(e,t,n,r)=>{let i=e._zod.def,a=ib(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Fw=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Iw=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Lw=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Rw=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Sw(a.element,t,{...r,path:[...r.path,`items`]})},zw=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Sw(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Sw(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Bw=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Sw(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Vw=(e,t,n,r)=>{let i=e._zod.def,a=Sw(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Sw(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Hw=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Sw(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Sw(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Sw(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Uw=(e,t,n,r)=>{let i=e._zod.def,a=Sw(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ww=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Gw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Kw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},qw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Jw=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Sw(a,t,r);let o=t.seen.get(e);o.ref=a},Yw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Xw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zw=L(`ZodISODateTime`,(e,t)=>{mS.init(e,t),ST.init(e,t)});function Qw(e){return VC(Zw,e)}var $w=L(`ZodISODate`,(e,t)=>{hS.init(e,t),ST.init(e,t)});function eT(e){return HC($w,e)}var tT=L(`ZodISOTime`,(e,t)=>{gS.init(e,t),ST.init(e,t)});function nT(e){return UC(tT,e)}var rT=L(`ZodISODuration`,(e,t)=>{_S.init(e,t),ST.init(e,t)});function iT(e){return WC(rT,e)}var aT=(e,t)=>{Bb.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ub(e,t)},flatten:{value:t=>Hb(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ab,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ab,2)}},isEmpty:{get(){return e.issues.length===0}}})};L(`ZodError`,aT);var oT=L(`ZodError`,aT,{Parent:Error}),sT=Wb(oT),cT=Gb(oT),lT=Kb(oT),uT=Jb(oT),dT=Xb(oT),fT=Zb(oT),pT=Qb(oT),mT=$b(oT),hT=ex(oT),gT=tx(oT),_T=nx(oT),vT=rx(oT),yT=L(`ZodType`,(e,t)=>(eS.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Dw(e,`input`),output:Dw(e,`output`)}}),e.toJSONSchema=Ew(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(pb(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Cb(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>sT(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>lT(e,t,n),e.parseAsync=async(t,n)=>cT(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>uT(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>dT(e,t,n),e.decode=(t,n)=>fT(e,t,n),e.encodeAsync=async(t,n)=>pT(e,t,n),e.decodeAsync=async(t,n)=>mT(e,t,n),e.safeEncode=(t,n)=>hT(e,t,n),e.safeDecode=(t,n)=>gT(e,t,n),e.safeEncodeAsync=async(t,n)=>_T(e,t,n),e.safeDecodeAsync=async(t,n)=>vT(e,t,n),e.refine=(t,n)=>e.check(zE(t,n)),e.superRefine=t=>e.check(BE(t)),e.overwrite=t=>e.check(dw(t)),e.optional=()=>xE(e),e.exactOptional=()=>CE(e),e.nullable=()=>TE(e),e.nullish=()=>xE(TE(e)),e.nonoptional=t=>jE(e,t),e.array=()=>nE(e),e.or=t=>sE([e,t]),e.and=t=>dE(e,t),e.transform=t=>FE(e,yE(t)),e.default=t=>DE(e,t),e.prefault=t=>kE(e,t),e.catch=t=>NE(e,t),e.pipe=t=>FE(e,t),e.readonly=()=>LE(e),e.describe=t=>{let n=e.clone();return _C.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return _C.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return _C.get(e);let n=e.clone();return _C.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),bT=L(`_ZodString`,(e,t)=>{tS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kw(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(aw(...t)),e.includes=(...t)=>e.check(cw(...t)),e.startsWith=(...t)=>e.check(lw(...t)),e.endsWith=(...t)=>e.check(uw(...t)),e.min=(...t)=>e.check(rw(...t)),e.max=(...t)=>e.check(nw(...t)),e.length=(...t)=>e.check(iw(...t)),e.nonempty=(...t)=>e.check(rw(1,...t)),e.lowercase=t=>e.check(ow(t)),e.uppercase=t=>e.check(sw(t)),e.trim=()=>e.check(pw()),e.normalize=(...t)=>e.check(fw(...t)),e.toLowerCase=()=>e.check(mw()),e.toUpperCase=()=>e.check(hw()),e.slugify=()=>e.check(gw())}),xT=L(`ZodString`,(e,t)=>{tS.init(e,t),bT.init(e,t),e.email=t=>e.check(yC(CT,t)),e.url=t=>e.check(TC(ET,t)),e.jwt=t=>e.check(BC(HT,t)),e.emoji=t=>e.check(EC(OT,t)),e.guid=t=>e.check(bC(wT,t)),e.uuid=t=>e.check(xC(TT,t)),e.uuidv4=t=>e.check(SC(TT,t)),e.uuidv6=t=>e.check(CC(TT,t)),e.uuidv7=t=>e.check(wC(TT,t)),e.nanoid=t=>e.check(DC(kT,t)),e.guid=t=>e.check(bC(wT,t)),e.cuid=t=>e.check(OC(AT,t)),e.cuid2=t=>e.check(kC(jT,t)),e.ulid=t=>e.check(AC(MT,t)),e.base64=t=>e.check(LC(zT,t)),e.base64url=t=>e.check(RC(BT,t)),e.xid=t=>e.check(jC(NT,t)),e.ksuid=t=>e.check(MC(PT,t)),e.ipv4=t=>e.check(NC(FT,t)),e.ipv6=t=>e.check(PC(IT,t)),e.cidrv4=t=>e.check(FC(LT,t)),e.cidrv6=t=>e.check(IC(RT,t)),e.e164=t=>e.check(zC(VT,t)),e.datetime=t=>e.check(Qw(t)),e.date=t=>e.check(eT(t)),e.time=t=>e.check(nT(t)),e.duration=t=>e.check(iT(t))});function z(e){return vC(xT,e)}var ST=L(`ZodStringFormat`,(e,t)=>{nS.init(e,t),bT.init(e,t)}),CT=L(`ZodEmail`,(e,t)=>{aS.init(e,t),ST.init(e,t)}),wT=L(`ZodGUID`,(e,t)=>{rS.init(e,t),ST.init(e,t)}),TT=L(`ZodUUID`,(e,t)=>{iS.init(e,t),ST.init(e,t)}),ET=L(`ZodURL`,(e,t)=>{oS.init(e,t),ST.init(e,t)});function DT(e){return TC(ET,e)}var OT=L(`ZodEmoji`,(e,t)=>{sS.init(e,t),ST.init(e,t)}),kT=L(`ZodNanoID`,(e,t)=>{cS.init(e,t),ST.init(e,t)}),AT=L(`ZodCUID`,(e,t)=>{lS.init(e,t),ST.init(e,t)}),jT=L(`ZodCUID2`,(e,t)=>{uS.init(e,t),ST.init(e,t)}),MT=L(`ZodULID`,(e,t)=>{dS.init(e,t),ST.init(e,t)}),NT=L(`ZodXID`,(e,t)=>{fS.init(e,t),ST.init(e,t)}),PT=L(`ZodKSUID`,(e,t)=>{pS.init(e,t),ST.init(e,t)}),FT=L(`ZodIPv4`,(e,t)=>{vS.init(e,t),ST.init(e,t)}),IT=L(`ZodIPv6`,(e,t)=>{yS.init(e,t),ST.init(e,t)}),LT=L(`ZodCIDRv4`,(e,t)=>{bS.init(e,t),ST.init(e,t)}),RT=L(`ZodCIDRv6`,(e,t)=>{xS.init(e,t),ST.init(e,t)}),zT=L(`ZodBase64`,(e,t)=>{CS.init(e,t),ST.init(e,t)}),BT=L(`ZodBase64URL`,(e,t)=>{TS.init(e,t),ST.init(e,t)}),VT=L(`ZodE164`,(e,t)=>{ES.init(e,t),ST.init(e,t)}),HT=L(`ZodJWT`,(e,t)=>{OS.init(e,t),ST.init(e,t)}),UT=L(`ZodNumber`,(e,t)=>{kS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aw(e,t,n,r),e.gt=(t,n)=>e.check($C(t,n)),e.gte=(t,n)=>e.check(ew(t,n)),e.min=(t,n)=>e.check(ew(t,n)),e.lt=(t,n)=>e.check(ZC(t,n)),e.lte=(t,n)=>e.check(QC(t,n)),e.max=(t,n)=>e.check(QC(t,n)),e.int=t=>e.check(KT(t)),e.safe=t=>e.check(KT(t)),e.positive=t=>e.check($C(0,t)),e.nonnegative=t=>e.check(ew(0,t)),e.negative=t=>e.check(ZC(0,t)),e.nonpositive=t=>e.check(QC(0,t)),e.multipleOf=(t,n)=>e.check(tw(t,n)),e.step=(t,n)=>e.check(tw(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function WT(e){return GC(UT,e)}var GT=L(`ZodNumberFormat`,(e,t)=>{AS.init(e,t),UT.init(e,t)});function KT(e){return KC(GT,e)}var qT=L(`ZodBoolean`,(e,t)=>{jS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jw(e,t,n,r)});function JT(e){return qC(qT,e)}var YT=L(`ZodNull`,(e,t)=>{MS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mw(e,t,n,r)});function XT(e){return JC(YT,e)}var ZT=L(`ZodUnknown`,(e,t)=>{NS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function QT(){return YC(ZT)}var $T=L(`ZodNever`,(e,t)=>{PS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nw(e,t,n,r)});function eE(e){return XC($T,e)}var tE=L(`ZodArray`,(e,t)=>{IS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rw(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(rw(t,n)),e.nonempty=t=>e.check(rw(1,t)),e.max=(t,n)=>e.check(nw(t,n)),e.length=(t,n)=>e.check(iw(t,n)),e.unwrap=()=>e.element});function nE(e,t){return _w(tE,e,t)}var rE=L(`ZodObject`,(e,t)=>{VS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zw(e,t,n,r),db(e,`shape`,()=>t.shape),e.keyof=()=>hE(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:QT()}),e.loose=()=>e.clone({...e._zod.def,catchall:QT()}),e.strict=()=>e.clone({...e._zod.def,catchall:eE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Ob(e,t),e.safeExtend=t=>kb(e,t),e.merge=t=>Ab(e,t),e.pick=t=>Eb(e,t),e.omit=t=>Db(e,t),e.partial=(...t)=>jb(bE,e,t[0]),e.required=(...t)=>Mb(AE,e,t[0])});function iE(e,t){return new rE({type:`object`,shape:e??{},...R(t)})}function aE(e,t){return new rE({type:`object`,shape:e,catchall:QT(),...R(t)})}var oE=L(`ZodUnion`,(e,t)=>{US.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bw(e,t,n,r),e.options=t.options});function sE(e,t){return new oE({type:`union`,options:e,...R(t)})}var cE=L(`ZodDiscriminatedUnion`,(e,t)=>{oE.init(e,t),WS.init(e,t)});function lE(e,t,n){return new cE({type:`union`,options:t,discriminator:e,...R(n)})}var uE=L(`ZodIntersection`,(e,t)=>{GS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vw(e,t,n,r)});function dE(e,t){return new uE({type:`intersection`,left:e,right:t})}var fE=L(`ZodRecord`,(e,t)=>{JS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hw(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function pE(e,t,n){return new fE({type:`record`,keyType:e,valueType:t,...R(n)})}var mE=L(`ZodEnum`,(e,t)=>{YS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pw(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new mE({...t,checks:[],...R(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new mE({...t,checks:[],...R(r),entries:i})}});function hE(e,t){return new mE({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var gE=L(`ZodLiteral`,(e,t)=>{XS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fw(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function _E(e,t){return new gE({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var vE=L(`ZodTransform`,(e,t)=>{ZS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lw(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tb(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Rb(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Rb(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function yE(e){return new vE({type:`transform`,transform:e})}var bE=L(`ZodOptional`,(e,t)=>{$S.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xE(e){return new bE({type:`optional`,innerType:e})}var SE=L(`ZodExactOptional`,(e,t)=>{eC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function CE(e){return new SE({type:`optional`,innerType:e})}var wE=L(`ZodNullable`,(e,t)=>{tC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function TE(e){return new wE({type:`nullable`,innerType:e})}var EE=L(`ZodDefault`,(e,t)=>{nC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function DE(e,t){return new EE({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():bb(t)}})}var OE=L(`ZodPrefault`,(e,t)=>{iC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kE(e,t){return new OE({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():bb(t)}})}var AE=L(`ZodNonOptional`,(e,t)=>{aC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ww(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jE(e,t){return new AE({type:`nonoptional`,innerType:e,...R(t)})}var ME=L(`ZodCatch`,(e,t)=>{sC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function NE(e,t){return new ME({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var PE=L(`ZodPipe`,(e,t)=>{cC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jw(e,t,n,r),e.in=t.in,e.out=t.out});function FE(e,t){return new PE({type:`pipe`,in:e,out:t})}var IE=L(`ZodReadonly`,(e,t)=>{uC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function LE(e){return new IE({type:`readonly`,innerType:e})}var RE=L(`ZodCustom`,(e,t)=>{fC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iw(e,t,n,r)});function zE(e,t={}){return vw(RE,e,t)}function BE(e){return yw(e)}var VE=Symbol.for(`@inkeep/open-knowledge/field-registry`),HE=globalThis;HE[VE]===void 0&&(HE[VE]=gC());var UE=HE[VE];function WE(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=GE(t)?UE.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function GE(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}var KE=aE({title:z().optional(),description:z().optional(),tags:nE(z()).optional()}),qE=aE({match:z().min(1,"`match` must be a non-empty glob pattern (e.g. 'specs/**' or 'reports/*/**')"),frontmatter:KE}),JE=aE({content:aE({dir:z().register(UE,{scope:`project`,agentSettable:!1,defaultScope:`project`}).default(`.`),include:nE(z()).min(1).register(UE,{scope:`project`,agentSettable:!0,defaultScope:`project`}).default([`**/*.md`,`**/*.mdx`]),exclude:nE(z()).register(UE,{scope:`project`,agentSettable:!0,defaultScope:`project`}).default([])}).default({dir:`.`,include:[`**/*.md`,`**/*.mdx`],exclude:[]}),github:aE({oauthAppClientId:z().register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(`Ov23liqlSd0V1MwR6rhI`)}).default({oauthAppClientId:`Ov23liqlSd0V1MwR6rhI`}),server:aE({host:z().regex(/^[\w.\-:]+$/,`Invalid hostname`).register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(`localhost`),openOnAgentEdit:JT().register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(!1)}).default({host:`localhost`,openOnAgentEdit:!1}),preview:aE({baseUrl:DT().register(UE,{scope:`project`,agentSettable:!1}).optional()}).default({}),folders:nE(qE).register(UE,{scope:`either`,agentSettable:!0,defaultScope:`project`}).default([]),mcp:aE({autoStart:JT().register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(!0),tools:aE({read_document:aE({historyDepth:WT().int().min(0).register(UE,{scope:`either`,agentSettable:!0,defaultScope:`user`}).default(5)}).default({historyDepth:5}),search:aE({maxResults:WT().int().min(1).register(UE,{scope:`either`,agentSettable:!0,defaultScope:`user`}).default(50)}).default({maxResults:50})}).default({read_document:{historyDepth:5},search:{maxResults:50}})}).default({autoStart:!0,tools:{read_document:{historyDepth:5},search:{maxResults:50}}}),appearance:aE({theme:hE([`light`,`dark`,`system`]).register(UE,{scope:`user`,agentSettable:!1,defaultScope:`user`}).optional(),editorModeDefault:hE([`wysiwyg`,`source`]).register(UE,{scope:`user`,agentSettable:!1,defaultScope:`user`}).optional()}).default({})}),YE=`open-knowledge-config`;function XE(e,t,n){let r=S.getTracer(YE),i=t?{attributes:t}:{};return r.startActiveSpan(e,i,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:x.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function ZE(e,t){let n=S.getActiveSpan();n&&n.addEvent(e,t)}function QE(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(wg(e.getIn(r,!0))||e.deleteIn(r))}}function $E(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){QE(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}QE(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function eD(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function tD(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?rD(e.position):`start`in e||`end`in e?rD(e):`line`in e||`column`in e?nD(e):``}function nD(e){return iD(e&&e.line)+`:`+iD(e&&e.column)}function rD(e){return nD(e&&e.start)+`-`+nD(e&&e.end)}function iD(e){return e&&typeof e==`number`?e:1}var aD=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=tD(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};aD.prototype.file=``,aD.prototype.name=``,aD.prototype.reason=``,aD.prototype.message=``,aD.prototype.stack=``,aD.prototype.column=void 0,aD.prototype.line=void 0,aD.prototype.ancestors=void 0,aD.prototype.cause=void 0,aD.prototype.fatal=void 0,aD.prototype.place=void 0,aD.prototype.ruleId=void 0,aD.prototype.source=void 0;var oD=4,sD=/^```([a-z]+)?[\s\n]$/,cD=/^~~~([a-z]+)?[\s\n]$/,lD=cg.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:oD,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,$p(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
246
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ww(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Dw(t,`input`,e.processors),output:Dw(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Tw(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Tw(r.element,n);if(r.type===`set`)return Tw(r.valueType,n);if(r.type===`lazy`)return Tw(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 Tw(r.innerType,n);if(r.type===`intersection`)return Tw(r.left,n)||Tw(r.right,n);if(r.type===`record`||r.type===`map`)return Tw(r.keyType,n)||Tw(r.valueType,n);if(r.type===`pipe`)return Tw(r.in,n)||Tw(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Tw(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Tw(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Tw(e,n))return!0;return!!(r.rest&&Tw(r.rest,n))}return!1}var Ew=(e,t={})=>n=>{let r=xw({...n,processors:t});return Sw(e,r),Cw(r,e),ww(r,e)},Dw=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=xw({...i??{},target:a,io:t,processors:n});return Sw(e,o),Cw(o,e),ww(o,e)},Ow={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},kw=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ow[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Aw=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},jw=(e,t,n,r)=>{n.type=`boolean`},Mw=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Nw=(e,t,n,r)=>{n.not={}},Pw=(e,t,n,r)=>{let i=e._zod.def,a=ib(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Fw=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Iw=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Lw=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Rw=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Sw(a.element,t,{...r,path:[...r.path,`items`]})},zw=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Sw(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Sw(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Bw=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Sw(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Vw=(e,t,n,r)=>{let i=e._zod.def,a=Sw(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Sw(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Hw=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Sw(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Sw(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Sw(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Uw=(e,t,n,r)=>{let i=e._zod.def,a=Sw(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ww=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Gw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Kw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},qw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Jw=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Sw(a,t,r);let o=t.seen.get(e);o.ref=a},Yw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Xw=(e,t,n,r)=>{let i=e._zod.def;Sw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zw=L(`ZodISODateTime`,(e,t)=>{mS.init(e,t),ST.init(e,t)});function Qw(e){return VC(Zw,e)}var $w=L(`ZodISODate`,(e,t)=>{hS.init(e,t),ST.init(e,t)});function eT(e){return HC($w,e)}var tT=L(`ZodISOTime`,(e,t)=>{gS.init(e,t),ST.init(e,t)});function nT(e){return UC(tT,e)}var rT=L(`ZodISODuration`,(e,t)=>{_S.init(e,t),ST.init(e,t)});function iT(e){return WC(rT,e)}var aT=(e,t)=>{Bb.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ub(e,t)},flatten:{value:t=>Hb(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ab,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ab,2)}},isEmpty:{get(){return e.issues.length===0}}})};L(`ZodError`,aT);var oT=L(`ZodError`,aT,{Parent:Error}),sT=Wb(oT),cT=Gb(oT),lT=Kb(oT),uT=Jb(oT),dT=Xb(oT),fT=Zb(oT),pT=Qb(oT),mT=$b(oT),hT=ex(oT),gT=tx(oT),_T=nx(oT),vT=rx(oT),yT=L(`ZodType`,(e,t)=>(eS.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Dw(e,`input`),output:Dw(e,`output`)}}),e.toJSONSchema=Ew(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(pb(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Cb(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>sT(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>lT(e,t,n),e.parseAsync=async(t,n)=>cT(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>uT(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>dT(e,t,n),e.decode=(t,n)=>fT(e,t,n),e.encodeAsync=async(t,n)=>pT(e,t,n),e.decodeAsync=async(t,n)=>mT(e,t,n),e.safeEncode=(t,n)=>hT(e,t,n),e.safeDecode=(t,n)=>gT(e,t,n),e.safeEncodeAsync=async(t,n)=>_T(e,t,n),e.safeDecodeAsync=async(t,n)=>vT(e,t,n),e.refine=(t,n)=>e.check(zE(t,n)),e.superRefine=t=>e.check(BE(t)),e.overwrite=t=>e.check(dw(t)),e.optional=()=>xE(e),e.exactOptional=()=>CE(e),e.nullable=()=>TE(e),e.nullish=()=>xE(TE(e)),e.nonoptional=t=>jE(e,t),e.array=()=>nE(e),e.or=t=>sE([e,t]),e.and=t=>dE(e,t),e.transform=t=>FE(e,yE(t)),e.default=t=>DE(e,t),e.prefault=t=>kE(e,t),e.catch=t=>NE(e,t),e.pipe=t=>FE(e,t),e.readonly=()=>LE(e),e.describe=t=>{let n=e.clone();return _C.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return _C.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return _C.get(e);let n=e.clone();return _C.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),bT=L(`_ZodString`,(e,t)=>{tS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kw(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(aw(...t)),e.includes=(...t)=>e.check(cw(...t)),e.startsWith=(...t)=>e.check(lw(...t)),e.endsWith=(...t)=>e.check(uw(...t)),e.min=(...t)=>e.check(rw(...t)),e.max=(...t)=>e.check(nw(...t)),e.length=(...t)=>e.check(iw(...t)),e.nonempty=(...t)=>e.check(rw(1,...t)),e.lowercase=t=>e.check(ow(t)),e.uppercase=t=>e.check(sw(t)),e.trim=()=>e.check(pw()),e.normalize=(...t)=>e.check(fw(...t)),e.toLowerCase=()=>e.check(mw()),e.toUpperCase=()=>e.check(hw()),e.slugify=()=>e.check(gw())}),xT=L(`ZodString`,(e,t)=>{tS.init(e,t),bT.init(e,t),e.email=t=>e.check(yC(CT,t)),e.url=t=>e.check(TC(ET,t)),e.jwt=t=>e.check(BC(HT,t)),e.emoji=t=>e.check(EC(OT,t)),e.guid=t=>e.check(bC(wT,t)),e.uuid=t=>e.check(xC(TT,t)),e.uuidv4=t=>e.check(SC(TT,t)),e.uuidv6=t=>e.check(CC(TT,t)),e.uuidv7=t=>e.check(wC(TT,t)),e.nanoid=t=>e.check(DC(kT,t)),e.guid=t=>e.check(bC(wT,t)),e.cuid=t=>e.check(OC(AT,t)),e.cuid2=t=>e.check(kC(jT,t)),e.ulid=t=>e.check(AC(MT,t)),e.base64=t=>e.check(LC(zT,t)),e.base64url=t=>e.check(RC(BT,t)),e.xid=t=>e.check(jC(NT,t)),e.ksuid=t=>e.check(MC(PT,t)),e.ipv4=t=>e.check(NC(FT,t)),e.ipv6=t=>e.check(PC(IT,t)),e.cidrv4=t=>e.check(FC(LT,t)),e.cidrv6=t=>e.check(IC(RT,t)),e.e164=t=>e.check(zC(VT,t)),e.datetime=t=>e.check(Qw(t)),e.date=t=>e.check(eT(t)),e.time=t=>e.check(nT(t)),e.duration=t=>e.check(iT(t))});function z(e){return vC(xT,e)}var ST=L(`ZodStringFormat`,(e,t)=>{nS.init(e,t),bT.init(e,t)}),CT=L(`ZodEmail`,(e,t)=>{aS.init(e,t),ST.init(e,t)}),wT=L(`ZodGUID`,(e,t)=>{rS.init(e,t),ST.init(e,t)}),TT=L(`ZodUUID`,(e,t)=>{iS.init(e,t),ST.init(e,t)}),ET=L(`ZodURL`,(e,t)=>{oS.init(e,t),ST.init(e,t)});function DT(e){return TC(ET,e)}var OT=L(`ZodEmoji`,(e,t)=>{sS.init(e,t),ST.init(e,t)}),kT=L(`ZodNanoID`,(e,t)=>{cS.init(e,t),ST.init(e,t)}),AT=L(`ZodCUID`,(e,t)=>{lS.init(e,t),ST.init(e,t)}),jT=L(`ZodCUID2`,(e,t)=>{uS.init(e,t),ST.init(e,t)}),MT=L(`ZodULID`,(e,t)=>{dS.init(e,t),ST.init(e,t)}),NT=L(`ZodXID`,(e,t)=>{fS.init(e,t),ST.init(e,t)}),PT=L(`ZodKSUID`,(e,t)=>{pS.init(e,t),ST.init(e,t)}),FT=L(`ZodIPv4`,(e,t)=>{vS.init(e,t),ST.init(e,t)}),IT=L(`ZodIPv6`,(e,t)=>{yS.init(e,t),ST.init(e,t)}),LT=L(`ZodCIDRv4`,(e,t)=>{bS.init(e,t),ST.init(e,t)}),RT=L(`ZodCIDRv6`,(e,t)=>{xS.init(e,t),ST.init(e,t)}),zT=L(`ZodBase64`,(e,t)=>{CS.init(e,t),ST.init(e,t)}),BT=L(`ZodBase64URL`,(e,t)=>{TS.init(e,t),ST.init(e,t)}),VT=L(`ZodE164`,(e,t)=>{ES.init(e,t),ST.init(e,t)}),HT=L(`ZodJWT`,(e,t)=>{OS.init(e,t),ST.init(e,t)}),UT=L(`ZodNumber`,(e,t)=>{kS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aw(e,t,n,r),e.gt=(t,n)=>e.check($C(t,n)),e.gte=(t,n)=>e.check(ew(t,n)),e.min=(t,n)=>e.check(ew(t,n)),e.lt=(t,n)=>e.check(ZC(t,n)),e.lte=(t,n)=>e.check(QC(t,n)),e.max=(t,n)=>e.check(QC(t,n)),e.int=t=>e.check(KT(t)),e.safe=t=>e.check(KT(t)),e.positive=t=>e.check($C(0,t)),e.nonnegative=t=>e.check(ew(0,t)),e.negative=t=>e.check(ZC(0,t)),e.nonpositive=t=>e.check(QC(0,t)),e.multipleOf=(t,n)=>e.check(tw(t,n)),e.step=(t,n)=>e.check(tw(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function WT(e){return GC(UT,e)}var GT=L(`ZodNumberFormat`,(e,t)=>{AS.init(e,t),UT.init(e,t)});function KT(e){return KC(GT,e)}var qT=L(`ZodBoolean`,(e,t)=>{jS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jw(e,t,n,r)});function JT(e){return qC(qT,e)}var YT=L(`ZodNull`,(e,t)=>{MS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mw(e,t,n,r)});function XT(e){return JC(YT,e)}var ZT=L(`ZodUnknown`,(e,t)=>{NS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function QT(){return YC(ZT)}var $T=L(`ZodNever`,(e,t)=>{PS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nw(e,t,n,r)});function eE(e){return XC($T,e)}var tE=L(`ZodArray`,(e,t)=>{IS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rw(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(rw(t,n)),e.nonempty=t=>e.check(rw(1,t)),e.max=(t,n)=>e.check(nw(t,n)),e.length=(t,n)=>e.check(iw(t,n)),e.unwrap=()=>e.element});function nE(e,t){return _w(tE,e,t)}var rE=L(`ZodObject`,(e,t)=>{VS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zw(e,t,n,r),db(e,`shape`,()=>t.shape),e.keyof=()=>hE(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:QT()}),e.loose=()=>e.clone({...e._zod.def,catchall:QT()}),e.strict=()=>e.clone({...e._zod.def,catchall:eE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Ob(e,t),e.safeExtend=t=>kb(e,t),e.merge=t=>Ab(e,t),e.pick=t=>Eb(e,t),e.omit=t=>Db(e,t),e.partial=(...t)=>jb(bE,e,t[0]),e.required=(...t)=>Mb(AE,e,t[0])});function iE(e,t){return new rE({type:`object`,shape:e??{},...R(t)})}function aE(e,t){return new rE({type:`object`,shape:e,catchall:QT(),...R(t)})}var oE=L(`ZodUnion`,(e,t)=>{US.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bw(e,t,n,r),e.options=t.options});function sE(e,t){return new oE({type:`union`,options:e,...R(t)})}var cE=L(`ZodDiscriminatedUnion`,(e,t)=>{oE.init(e,t),WS.init(e,t)});function lE(e,t,n){return new cE({type:`union`,options:t,discriminator:e,...R(n)})}var uE=L(`ZodIntersection`,(e,t)=>{GS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vw(e,t,n,r)});function dE(e,t){return new uE({type:`intersection`,left:e,right:t})}var fE=L(`ZodRecord`,(e,t)=>{JS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hw(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function pE(e,t,n){return new fE({type:`record`,keyType:e,valueType:t,...R(n)})}var mE=L(`ZodEnum`,(e,t)=>{YS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pw(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new mE({...t,checks:[],...R(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new mE({...t,checks:[],...R(r),entries:i})}});function hE(e,t){return new mE({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var gE=L(`ZodLiteral`,(e,t)=>{XS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fw(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function _E(e,t){return new gE({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var vE=L(`ZodTransform`,(e,t)=>{ZS.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lw(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tb(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Rb(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Rb(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function yE(e){return new vE({type:`transform`,transform:e})}var bE=L(`ZodOptional`,(e,t)=>{$S.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xE(e){return new bE({type:`optional`,innerType:e})}var SE=L(`ZodExactOptional`,(e,t)=>{eC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function CE(e){return new SE({type:`optional`,innerType:e})}var wE=L(`ZodNullable`,(e,t)=>{tC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function TE(e){return new wE({type:`nullable`,innerType:e})}var EE=L(`ZodDefault`,(e,t)=>{nC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function DE(e,t){return new EE({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():bb(t)}})}var OE=L(`ZodPrefault`,(e,t)=>{iC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kE(e,t){return new OE({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():bb(t)}})}var AE=L(`ZodNonOptional`,(e,t)=>{aC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ww(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jE(e,t){return new AE({type:`nonoptional`,innerType:e,...R(t)})}var ME=L(`ZodCatch`,(e,t)=>{sC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function NE(e,t){return new ME({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var PE=L(`ZodPipe`,(e,t)=>{cC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jw(e,t,n,r),e.in=t.in,e.out=t.out});function FE(e,t){return new PE({type:`pipe`,in:e,out:t})}var IE=L(`ZodReadonly`,(e,t)=>{uC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function LE(e){return new IE({type:`readonly`,innerType:e})}var RE=L(`ZodCustom`,(e,t)=>{fC.init(e,t),yT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iw(e,t,n,r)});function zE(e,t={}){return vw(RE,e,t)}function BE(e){return yw(e)}var VE=Symbol.for(`@inkeep/open-knowledge/field-registry`),HE=globalThis;HE[VE]===void 0&&(HE[VE]=gC());var UE=HE[VE];function WE(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=GE(t)?UE.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function GE(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}var KE=aE({title:z().optional(),description:z().optional(),tags:nE(z()).optional()}),qE=aE({match:z().min(1,"`match` must be a non-empty glob pattern (e.g. 'specs/**' or 'reports/*/**')"),frontmatter:KE}),JE=aE({content:aE({dir:z().register(UE,{scope:`project`,agentSettable:!1,defaultScope:`project`}).default(`.`)}).default({dir:`.`}),github:aE({oauthAppClientId:z().register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(`Ov23liqlSd0V1MwR6rhI`)}).default({oauthAppClientId:`Ov23liqlSd0V1MwR6rhI`}),server:aE({host:z().regex(/^[\w.\-:]+$/,`Invalid hostname`).register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(`localhost`),openOnAgentEdit:JT().register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(!1)}).default({host:`localhost`,openOnAgentEdit:!1}),preview:aE({baseUrl:DT().register(UE,{scope:`project`,agentSettable:!1}).optional()}).default({}),folders:nE(qE).register(UE,{scope:`either`,agentSettable:!0,defaultScope:`project`}).default([]),mcp:aE({autoStart:JT().register(UE,{scope:`either`,agentSettable:!1,defaultScope:`user`}).default(!0),tools:aE({read_document:aE({historyDepth:WT().int().min(0).register(UE,{scope:`either`,agentSettable:!0,defaultScope:`user`}).default(5)}).default({historyDepth:5}),search:aE({maxResults:WT().int().min(1).register(UE,{scope:`either`,agentSettable:!0,defaultScope:`user`}).default(50)}).default({maxResults:50})}).default({read_document:{historyDepth:5},search:{maxResults:50}})}).default({autoStart:!0,tools:{read_document:{historyDepth:5},search:{maxResults:50}}}),appearance:aE({theme:hE([`light`,`dark`,`system`]).register(UE,{scope:`user`,agentSettable:!1,defaultScope:`user`}).optional(),editorModeDefault:hE([`wysiwyg`,`source`]).register(UE,{scope:`user`,agentSettable:!1,defaultScope:`user`}).optional()}).default({})}),YE=`open-knowledge-config`;function XE(e,t,n){let r=S.getTracer(YE),i=t?{attributes:t}:{};return r.startActiveSpan(e,i,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:x.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function ZE(e,t){let n=S.getActiveSpan();n&&n.addEvent(e,t)}function QE(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(wg(e.getIn(r,!0))||e.deleteIn(r))}}function $E(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){QE(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}QE(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function eD(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function tD(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?rD(e.position):`start`in e||`end`in e?rD(e):`line`in e||`column`in e?nD(e):``}function nD(e){return iD(e&&e.line)+`:`+iD(e&&e.column)}function rD(e){return nD(e&&e.start)+`-`+nD(e&&e.end)}function iD(e){return e&&typeof e==`number`?e:1}var aD=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=tD(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};aD.prototype.file=``,aD.prototype.name=``,aD.prototype.reason=``,aD.prototype.message=``,aD.prototype.stack=``,aD.prototype.column=void 0,aD.prototype.line=void 0,aD.prototype.ancestors=void 0,aD.prototype.cause=void 0,aD.prototype.fatal=void 0,aD.prototype.place=void 0,aD.prototype.ruleId=void 0,aD.prototype.source=void 0;var oD=4,sD=/^```([a-z]+)?[\s\n]$/,cD=/^~~~([a-z]+)?[\s\n]$/,lD=cg.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:oD,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,$p(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
247
247
|
`):`\`\`\`${r}
|
|
248
248
|
|
|
249
249
|
\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??oD,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
@@ -362,11 +362,13 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
362
362
|
`,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``;break}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&`).replace(o,`<`).replace(s,`>`).replace(c,`¶<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`;break}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0;break}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length;break}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o)if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p);break}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
|
|
363
363
|
`),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
|
|
364
364
|
`],o,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case i:o=`+`;break;case r:o=`-`;break;case a:o=` `;break}n[s+1]=o+encodeURI(this.diffs[s][1])+`
|
|
365
|
-
`}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1),I$=`source`;function L$(e){return{ok:!1,error:e}}function R$(e){return{ok:!0,...e}}function z$(){return JE.parse({})}function B$(e,t){let n=e.toString();if(n.length===0)return z$();let r=$y(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),z$();let i=r.toJSON()??{},a=JE.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),z$())}function V$(e,t,n={}){return XE(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>H$(e,t,n))}function H$(e,t,n){let{ytextKey:r=I$}=n,i=e.document,a=i.getText(r),o=new Set,s=!1;function c(){if(s)return;let e=B$(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}a.observe(c),e.on(`synced`,c);function l(e){if(s)return L$({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=$y(a.toString()),r=n.contents!==null&&!bg(n.contents);if(n.errors.length>0||r){ZE(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":n.errors.length,"config.parse.topLevelNonMap":r});let e=n.errors.length>0?n.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),n=$y(``)}n.contents===null&&(n.contents=n.createNode({}));let o=$E(n,e),c=n.toJSON()??{},l=XE(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=JE.safeParse(c);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)ZE(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!l.success)return L$({code:`SCHEMA_INVALID`,issues:l.error.issues.map(eD)});let u=n.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,u)}),R$({effective:l.data,appliedPaths:o})}return{current(){return B$(a,t)},patch(e){return XE(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=l(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},dispose(){s||(s=!0,a.unobserve(c),e.off(`synced`,c),o.clear())}}}var U$=iE({file:z(),line:WT().int().min(1),column:WT().int().min(1),snippet:z().optional()}),W$=iE({path:nE(sE([z(),WT()])),message:z(),issueCode:z(),params:pE(z(),QT()).optional(),source:U$.optional()}),G$=hE([`user`,`project`,`either`]),K$=hE([`user`,`project`]),q$=lE(`code`,[iE({code:_E(`YAML_PARSE`),detail:z()}),iE({code:_E(`SCHEMA_INVALID`),issues:nE(W$)}),iE({code:_E(`SCOPE_VIOLATION`),path:nE(z()),expectedScope:G$,actualScope:K$}),iE({code:_E(`NOT_AGENT_SETTABLE`),path:nE(z())}),iE({code:_E(`MIXED_SCOPE`),paths:nE(iE({path:nE(z()),scope:K$}))}),iE({code:_E(`WRITE_ERROR`),detail:z()}),iE({code:_E(`UNKNOWN`),message:z().optional()})]),J$=new Set(q$.options.map(e=>e.shape.code.value)),Y$=sE([q$,aE({code:z(),message:z().optional()})]);function X$(e){return J$.has(e.code)}function Z$(e){if(!X$(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
365
|
+
`}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1),I$=`source`;function L$(e){return{ok:!1,error:e}}function R$(e){return{ok:!0,...e}}function z$(){return JE.parse({})}function B$(e,t){let n=e.toString();if(n.length===0)return z$();let r=$y(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),z$();let i=r.toJSON()??{},a=JE.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),z$())}function V$(e,t,n={}){return XE(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>H$(e,t,n))}function H$(e,t,n){let{ytextKey:r=I$}=n,i=e.document,a=i.getText(r),o=new Set,s=!1;function c(){if(s)return;let e=B$(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}a.observe(c),e.on(`synced`,c);function l(e){if(s)return L$({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=$y(a.toString()),r=n.contents!==null&&!bg(n.contents);if(n.errors.length>0||r){ZE(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":n.errors.length,"config.parse.topLevelNonMap":r});let e=n.errors.length>0?n.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),n=$y(``)}n.contents===null&&(n.contents=n.createNode({}));let o=$E(n,e),c=n.toJSON()??{},l=XE(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=JE.safeParse(c);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)ZE(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!l.success)return L$({code:`SCHEMA_INVALID`,issues:l.error.issues.map(eD)});let u=n.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,u)}),R$({effective:l.data,appliedPaths:o})}return{current(){return B$(a,t)},patch(e){return XE(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=l(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},dispose(){s||(s=!0,a.unobserve(c),e.off(`synced`,c),o.clear())}}}var U$=iE({file:z(),line:WT().int().min(1),column:WT().int().min(1),snippet:z().optional()}),W$=iE({path:nE(sE([z(),WT()])),message:z(),issueCode:z(),params:pE(z(),QT()).optional(),source:U$.optional()}),G$=hE([`user`,`project`,`either`]),K$=hE([`user`,`project`]),q$=lE(`code`,[iE({code:_E(`YAML_PARSE`),detail:z()}),iE({code:_E(`SCHEMA_INVALID`),issues:nE(W$)}),iE({code:_E(`SCOPE_VIOLATION`),path:nE(z()),expectedScope:G$,actualScope:K$}),iE({code:_E(`NOT_AGENT_SETTABLE`),path:nE(z())}),iE({code:_E(`MIXED_SCOPE`),paths:nE(iE({path:nE(z()),scope:K$}))}),iE({code:_E(`REMOVED_KEY`),path:nE(z()),redirect:z(),source:U$.optional()}),iE({code:_E(`WRITE_ERROR`),detail:z()}),iE({code:_E(`UNKNOWN`),message:z().optional()})]),J$=new Set(q$.options.map(e=>e.shape.code.value)),Y$=sE([q$,aE({code:z(),message:z().optional()})]);function X$(e){return J$.has(e.code)}function Z$(e){if(!X$(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
366
366
|
`))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
|
|
367
|
-
`)}case`SCOPE_VIOLATION`:return`Field ${e.path.join(`.`)} cannot be set at ${e.actualScope} scope (expected: ${e.expectedScope}).`;case`NOT_AGENT_SETTABLE`:return[`Field ${e.path.join(`.`)} is not agent-settable.`,`Agent-settable paths:
|
|
367
|
+
`)}case`SCOPE_VIOLATION`:return`Field ${e.path.join(`.`)} cannot be set at ${e.actualScope} scope (expected: ${e.expectedScope}).`;case`NOT_AGENT_SETTABLE`:return[`Field ${e.path.join(`.`)} is not agent-settable.`,`Agent-settable paths: folders[], mcp.tools.search.maxResults,`,`mcp.tools.read_document.historyDepth.`,`Other fields can be edited via the Settings pane or by hand-editing config.yml.`].join(` `);case`MIXED_SCOPE`:return[`Patch contains fields targeting multiple scopes:`,e.paths.map(({path:e,scope:t})=>` ${e.join(`.`)} → ${t}`).join(`
|
|
368
368
|
`)].join(`
|
|
369
|
-
`);case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function Q$(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function $$(e,t){let n=e;for(let e of t){n=Q$(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function e1(e,t){let n=$$(e,t);if(n!==void 0)return WE(n)}var t1=2e3;function n1(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function r1(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var i1=`__system__`,a1=`__config__/project`,o1=`__user__/config.yml`;Object.freeze([a1,o1]);var s1=[`incoming`,`outgoing`,`both`];function c1(e){return s1.includes(e)}var l1=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],u1=[`video/mp4`,`video/webm`,`video/ogg`],d1=[`audio/mpeg`,`audio/wav`,`audio/ogg`],f1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),p1=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),m1=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),h1=`wikiembed`,g1=`toast`,_1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`,`pdf`,`mp4`,`webm`,`mov`,`m4v`,`mkv`,`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),v1=uD.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3}}}}),y1=CD.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}}}),b1=_D.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}}}),x1=hh.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),S1=/^---\r?\n([\s\S]*?\r?\n)?---(\r?\n|$)/;function C1(e){let t=e.match(S1);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function w1(e){if(e===``)return``;let t=e.match(S1);return t?(t[1]??``).replace(/\r?\n$/,``):e}var T1=TD.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),E1=DD.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`}}}}),D1=cg.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),O1=cg.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),k1=cg.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),A1=Hk.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:e=>{try{let t=new URL(e,`https://placeholder.invalid`).protocol.toLowerCase();return![`javascript:`,`data:`,`vbscript:`].includes(t)}catch{return!1}},validate:()=>!0,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1}}}}),j1=cg.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function M1(e){return e.type.name===`list`&&!e.attrs.ordered}function N1(e){return e.type.name===`list`&&!!e.attrs.ordered}function P1(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function F1(e,t,n,r,i,a,o){let s=Up(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Vs(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o??{}})}}),t(n),!0}return Rs(n,a)(e,void 0)?t?Rs(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var I1=cg.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,$p(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&!P1(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>N1(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&P1(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Uh({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Uh({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new sh({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Ga(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),L1=cg.create({name:`listItem`,content:`paragraph block*`,defining:!0,priority:60,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,$p(t),0]:[`li`,$p(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries($p(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),R1=I1,z1=L1,B1=cg.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),V1=iM.extend({excludes:``}),H1=hh.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}}),U1=sM.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}}});function W1(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function G1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var K1=cg.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},G1({target:n,alias:r,anchor:i})]}});function q1(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function J1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var Y1=cg.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=W1(e.attrs.resolvedSrc),o=q1(n);if(f1.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},J1({target:n,alias:r,anchor:i})]}}),X1=[O1,B1,k1,K1,Y1,R1,z1,y1,b1,V1,v1,E1,U1,A1,D1,j1,T1,x1,H1,LN.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1}),Qj.configure({resizable:!0}),zj,Rj,Lj,qk.configure({inline:!0}),Gk];function Z1(e,t){let n=encodeURIComponent(t.prompt),r=encodeURIComponent(t.projectDir),i=encodeURIComponent(t.docPath);return`claude://${e.mode}/new?q=${n}&folder=${r}&file=${i}`}function Q1(e){return`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${encodeURIComponent(e.projectDir)}`}function $1(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function e0(e){return`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${encodeURIComponent($1(e.projectDir))}&mode=agent`}function t0(e){return`Open Knowledge doc: ${e.relativePath}. Use the open-knowledge MCP tool for backlinks and related context.`}function n0(e){return`https://claude.ai/new?q=${encodeURIComponent(e)}`}var r0=/notionvc:/i,i0=()=>e=>{a0(e)&&(o0(e),s0(e))};function a0(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(r0.test(e))return!0}if(t.type===`element`&&a0(t))return!0}return!1}function o0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&o0(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
|
|
369
|
+
`);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
|
|
370
|
+
`))n.push(` ${t}`);return n.join(`
|
|
371
|
+
`)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function Q$(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function $$(e,t){let n=e;for(let e of t){n=Q$(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function e1(e,t){let n=$$(e,t);if(n!==void 0)return WE(n)}var t1=2e3;function n1(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function r1(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var i1=`__system__`,a1=`__config__/project`,o1=`__user__/config.yml`;Object.freeze([a1,o1]);var s1=[`incoming`,`outgoing`,`both`];function c1(e){return s1.includes(e)}var l1=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],u1=[`video/mp4`,`video/webm`,`video/ogg`],d1=[`audio/mpeg`,`audio/wav`,`audio/ogg`],f1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),p1=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),m1=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),h1=`wikiembed`,g1=`toast`,_1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`,`pdf`,`mp4`,`webm`,`mov`,`m4v`,`mkv`,`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),v1=uD.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3}}}}),y1=CD.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}}}),b1=_D.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}}}),x1=hh.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),S1=/^---\r?\n([\s\S]*?\r?\n)?---(\r?\n|$)/;function C1(e){let t=e.match(S1);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function w1(e){if(e===``)return``;let t=e.match(S1);return t?(t[1]??``).replace(/\r?\n$/,``):e}var T1=TD.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),E1=DD.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`}}}}),D1=cg.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),O1=cg.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),k1=cg.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),A1=Hk.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:e=>{try{let t=new URL(e,`https://placeholder.invalid`).protocol.toLowerCase();return![`javascript:`,`data:`,`vbscript:`].includes(t)}catch{return!1}},validate:()=>!0,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1}}}}),j1=cg.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function M1(e){return e.type.name===`list`&&!e.attrs.ordered}function N1(e){return e.type.name===`list`&&!!e.attrs.ordered}function P1(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function F1(e,t,n,r,i,a,o){let s=Up(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Vs(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o??{}})}}),t(n),!0}return Rs(n,a)(e,void 0)?t?Rs(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var I1=cg.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,$p(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&!P1(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>N1(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&P1(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Uh({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Uh({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new sh({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Ga(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),L1=cg.create({name:`listItem`,content:`paragraph block*`,defining:!0,priority:60,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,$p(t),0]:[`li`,$p(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries($p(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),R1=I1,z1=L1,B1=cg.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),V1=iM.extend({excludes:``}),H1=hh.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}}),U1=sM.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}}});function W1(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function G1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var K1=cg.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},G1({target:n,alias:r,anchor:i})]}});function q1(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function J1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var Y1=cg.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=W1(e.attrs.resolvedSrc),o=q1(n);if(f1.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},J1({target:n,alias:r,anchor:i})]}}),X1=[O1,B1,k1,K1,Y1,R1,z1,y1,b1,V1,v1,E1,U1,A1,D1,j1,T1,x1,H1,LN.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1}),Qj.configure({resizable:!0}),zj,Rj,Lj,qk.configure({inline:!0}),Gk];function Z1(e,t){let n=encodeURIComponent(t.prompt),r=encodeURIComponent(t.projectDir),i=encodeURIComponent(t.docPath);return`claude://${e.mode}/new?q=${n}&folder=${r}&file=${i}`}function Q1(e){return`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${encodeURIComponent(e.projectDir)}`}function $1(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function e0(e){return`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${encodeURIComponent($1(e.projectDir))}&mode=agent`}function t0(e){return`Open Knowledge doc: ${e.relativePath}. Use the open-knowledge MCP tool for backlinks and related context.`}function n0(e){return`https://claude.ai/new?q=${encodeURIComponent(e)}`}var r0=/notionvc:/i,i0=()=>e=>{a0(e)&&(o0(e),s0(e))};function a0(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(r0.test(e))return!0}if(t.type===`element`&&a0(t))return!0}return!1}function o0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&o0(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
|
|
370
372
|
`)){t.push(n);continue}let r=e.split(`
|
|
371
373
|
`);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function s0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!r0.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&s0(t)}}var c0=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),l0=()=>e=>{u0(e)};function u0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&u0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return d0(t)?[]:f0(t)?t.children:[t]})}}function d0(e){if(e.tagName!==`meta`)return!1;let t=e.properties?.name,n=e.properties?.content;return t===`Generator`&&typeof n==`string`&&/Cocoa/i.test(n)}function f0(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>c0.has(String(e))):!1}var p0=`docs-internal-guid-`;function m0(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var h0=()=>e=>{g0(e)};function g0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&g0(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(!n||n.type!==`element`){t++;continue}let r=n;if(_0(r)||v0(r)){m0(e,t);continue}t++}}function _0(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(p0)}function v0(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.children.filter(e=>e.type===`element`);return t.length===1?t[0]?.tagName===`table`:!1}var y0=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),b0=()=>e=>{x0(e)};function x0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&x0(t);for(let t of e.children)t.type===`element`&&S0(t)}}function S0(e){if(!e.properties)return;for(let t of Object.keys(e.properties))t.startsWith(`dataHovercard`)&&delete e.properties[t];let t=e.properties.className;if(Array.isArray(t)){let n=t.filter(e=>!y0.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var C0=/^gmail_/,w0=()=>e=>{T0(e)};function T0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&T0(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(n.type!==`element`){t++;continue}let r=n;if(r.tagName===`div`&&E0(r,`gmail_quote`)&&(r.tagName=`blockquote`),D0(r),O0(r)){e.children.splice(t,1,...r.children);continue}t++}}function E0(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function D0(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!C0.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function O0(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.properties?.className;return t!=null&&!(Array.isArray(t)&&t.length===0)?!1:e.children.filter(e=>e.type===`element`).length<=1}var k0=()=>e=>{A0(e)};function A0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&A0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return t.tagName===`google-sheets-html-origin`?t.children:t.tagName===`style`?[]:(j0(t),[t])})}}function j0(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var M0=[`o:`,`w:`,`m:`,`v:`,`u1:`],N0=/^Mso[A-Z]/,P0=/^\s*\[if\s+[^\]]*\]/,F0=()=>e=>{I0(e)};function I0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&I0(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return P0.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return L0(t)?[]:(R0(t),[t])})}}function L0(e){return M0.some(t=>e.tagName.startsWith(t))}function R0(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!N0.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&N0.test(n)&&delete t.className;let r=t.style;typeof r==`string`&&/mso-/i.test(r)&&delete t.style;for(let e of Object.keys(t))if(e.startsWith(`xmlns:`)){let n=e.slice(6);M0.some(e=>e===`${n}:`)&&delete t[e]}}var z0=/^c-(message_kit__|message__|compose|timestamp)/,B0=()=>e=>{V0(e)};function V0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&V0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return H0(t)?[]:(U0(t),[t])})}}function H0(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function U0(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!z0.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var W0=()=>e=>{G0(e)};function G0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&G0(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;K0(r)&&(e.children[t]=J0(r))}}}function K0(e){if(e.tagName!==`div`)return!1;let t=e.children.filter(e=>e.type===`element`&&e.tagName===`div`);return t.length<2?!1:t.some(e=>q0(e))}function q0(e){for(let t of e.children){if(t.type!==`element`)continue;let e=t,n=e.properties?.style;if(typeof n==`string`&&/color\s*:/i.test(n)||q0(e))return!0}return!1}function J0(e){return{type:`element`,tagName:`pre`,properties:{},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:e.children.filter(e=>e.type===`element`&&e.tagName===`div`).map(e=>Y0(e)).join(`
|
|
372
374
|
`)}]}]}}function Y0(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=Y0(n));return t}var X0=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},Z0=[h0,F0,l0,w0,i0,W0,k0,B0,b0];function Q0(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new X0(e.length,n);let r=SJ().use(kz,{fragment:!0});for(let e of Z0)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(AH);let i=r.parse(e);return r.runSync(i)}function $0(e){return String(SJ().use(pJ).use(mJ).stringify(e))}function e2(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=t2(e,t);r>=0?n[r]=o:n.push(o)}return n}function t2(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function n2(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:e2(t,r),children:n.all(t),data:{}}}var r2=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`],defaultValue:`note`,required:!1,description:`GFM alert variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],i2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:l1,autoFocus:!0},{name:`alt`,type:`string`,required:!1,defaultValue:``,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`}],a2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:u1,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`}],o2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:d1,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],s2=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],c2=[r2[0],r2[1],r2[4],r2[5],r2[6]],l2=[i2[0],i2[1],i2[7]],u2=[s2[0],s2[1],s2[4],s2[5]],d2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],f2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],p2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}];function m2(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function h2(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function g2(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}var _2=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:r2,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`GFM alert / admonition with 5 type variants (note, tip, important, warning, caution)`,searchTerms:[`note`,`warning`,`tip`,`important`,`caution`,`alert`,`admonition`],serialize:(e,t)=>n2(`Callout`,e,t,r2)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:i2,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>n2(`img`,e,t,i2)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:a2,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>n2(`video`,e,t,a2)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:o2,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>n2(`audio`,e,t,o2)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:s2,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],serialize:(e,t)=>n2(`Accordion`,e,t,s2)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:c2,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:l2,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:d2,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:g2},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:f2,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:g2},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:p2,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:g2},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:u2,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${m2(n.name)}"`:``,a=n?.id?` id="${m2(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${h2(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}}],v2={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>n2(e.attrs.componentName||`*`,e,t)};function y2(){let e=new Map;e.set(`*`,v2);for(let t of _2)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}var b2={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{}};function x2(){b2.parseFallback.blockLevel++}function S2(){b2.parseFallback.wholeDoc++}function C2(e){b2.jsxRenderFailure[e]=(b2.jsxRenderFailure[e]??0)+1}function w2(e){b2.jsxAutoConvertFailed[e]=(b2.jsxAutoConvertFailed[e]??0)+1}function T2(e){b2.jsxAutoConvertSucceeded[e]=(b2.jsxAutoConvertSucceeded[e]??0)+1}function E2(e){b2.jsxPropDropped[e]=(b2.jsxPropDropped[e]??0)+1}function D2(e){b2.jsxMoveFailed[e]=(b2.jsxMoveFailed[e]??0)+1}function O2(e){b2.jsxStuckCopyFailed[e]=(b2.jsxStuckCopyFailed[e]??0)+1}function k2(e){b2.jsxStuckDeleteFailed[e]=(b2.jsxStuckDeleteFailed[e]??0)+1}var A2=/^(`{3,}|~{3,})/gm;function j2(e){let t=[],n=null;for(let r of e.matchAll(A2)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function M2(e,t){return t.some(([t,n])=>e>=t&&e<n)}var N2=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function P2(e){let t=j2(e),n=[];for(let r of e.matchAll(N2))M2(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{An as i,Dn as a,On as o,jn as s,kn as c}from"./toggle-group-
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{An as i,Dn as a,On as o,jn as s,kn as c}from"./toggle-group-CyBGhndP.js";import{a as l,b as u,c as d,d as f,i as p,l as m,m as h,p as g,r as _,s as ee,v}from"./button-Dyz7QGIk.js";var y=e(t(),1),b=n(),x=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),S=`VisuallyHidden`,C=y.forwardRef((e,t)=>(0,b.jsx)(h.span,{...e,ref:t,style:{...x,...e.style}}));C.displayName=S;var w=C,[T,E]=g(`Tooltip`,[s]),D=s(),O=`TooltipProvider`,k=700,A=`tooltip.open`,[te,j]=T(O),M=e=>{let{__scopeTooltip:t,delayDuration:n=k,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=y.useRef(!0),s=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,b.jsx)(te,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};M.displayName=O;var N=`Tooltip`,[P,F]=T(N),I=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:o,disableHoverableContent:s,delayDuration:c}=e,l=j(N,e.__scopeTooltip),u=D(t),[d,f]=y.useState(null),p=ee(),h=y.useRef(0),g=s??l.disableHoverableContent,_=c??l.delayDuration,v=y.useRef(!1),[x,S]=m({prop:r,defaultProp:a??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(A))):l.onClose(),o?.(e)},caller:N}),C=y.useMemo(()=>x?v.current?`delayed-open`:`instant-open`:`closed`,[x]),w=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,S(!0)},[S]),T=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,S(!1)},[S]),E=y.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,S(!0),h.current=0},_)},[_,S]);return y.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,b.jsx)(i,{...u,children:(0,b.jsx)(P,{scope:t,contentId:p,open:x,stateAttribute:C,trigger:d,onTriggerChange:f,onTriggerEnter:y.useCallback(()=>{l.isOpenDelayedRef.current?E():w()},[l.isOpenDelayedRef,E,w]),onTriggerLeave:y.useCallback(()=>{g?T():(window.clearTimeout(h.current),h.current=0)},[T,g]),onOpen:w,onClose:T,disableHoverableContent:g,children:n})})};I.displayName=N;var L=`TooltipTrigger`,R=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F(L,n),o=j(L,n),s=D(n),c=u(t,y.useRef(null),i.onTriggerChange),l=y.useRef(!1),d=y.useRef(!1),p=y.useCallback(()=>l.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,b.jsx)(a,{asChild:!0,...s,children:(0,b.jsx)(h.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:f(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:f(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:f(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:f(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:f(e.onBlur,i.onClose),onClick:f(e.onClick,i.onClose)})})});R.displayName=L;var z=`TooltipPortal`,[B,V]=T(z,{forceMount:void 0}),H=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=F(z,t);return(0,b.jsx)(B,{scope:t,forceMount:n,children:(0,b.jsx)(d,{present:n||a.open,children:(0,b.jsx)(p,{asChild:!0,container:i,children:r})})})};H.displayName=z;var U=`TooltipContent`,W=y.forwardRef((e,t)=>{let n=V(U,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=F(U,e.__scopeTooltip);return(0,b.jsx)(d,{present:r||o.open,children:o.disableHoverableContent?(0,b.jsx)(Y,{side:i,...a,ref:t}):(0,b.jsx)(G,{side:i,...a,ref:t})})}),G=y.forwardRef((e,t)=>{let n=F(U,e.__scopeTooltip),r=j(U,e.__scopeTooltip),i=y.useRef(null),a=u(t,i),[o,s]=y.useState(null),{trigger:c,onClose:l}=n,d=i.current,{onPointerInTransitChange:f}=r,p=y.useCallback(()=>{s(null),f(!1)},[f]),m=y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=re(r,ne(r,n.getBoundingClientRect())),a=ie(t.getBoundingClientRect());s(oe([...i,...a])),f(!0)},[f]);return y.useEffect(()=>()=>p(),[p]),y.useEffect(()=>{if(c&&d){let e=e=>m(e,d),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[c,d,m,p]),y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||d?.contains(t),i=!ae(n,o);r?p():i&&(p(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,d,o,l,p]),(0,b.jsx)(Y,{...e,ref:a})}),[K,q]=T(N,{isInside:!1}),J=v(`TooltipContent`),Y=y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,u=F(U,n),d=D(n),{onClose:f}=u;return y.useEffect(()=>(document.addEventListener(A,f),()=>document.removeEventListener(A,f)),[f]),y.useEffect(()=>{if(u.trigger){let e=e=>{e.target?.contains(u.trigger)&&f()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]),(0,b.jsx)(l,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,b.jsxs)(c,{"data-state":u.stateAttribute,...d,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,b.jsx)(J,{children:r}),(0,b.jsx)(K,{scope:n,isInside:!0,children:(0,b.jsx)(w,{id:u.contentId,role:`tooltip`,children:i||r})})]})})});W.displayName=U;var X=`TooltipArrow`,Z=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=D(n);return q(X,n).isInside?null:(0,b.jsx)(o,{...i,...r,ref:t})});Z.displayName=X;function ne(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function re(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ie(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function oe(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),se(t)}function se(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Q=M,ce=I,le=R,ue=H,de=W,fe=Z,$=r();function pe(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,b.jsx)(Q,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function me(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(ce,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function he(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(le,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function ge(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=_(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,b.jsx)(fe,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,b.jsx)(ue,{children:(0,b.jsxs)(de,{"data-slot":`tooltip-content`,sideOffset:o,className:s,...i,children:[n,c]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}export{he as i,ge as n,pe as r,me as t};
|
package/dist/public/index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
nothing for the formatter to reindent.
|
|
21
21
|
-->
|
|
22
22
|
<script>(() => { let mode = 'wysiwyg'; try { const raw = localStorage.getItem('ok-editor-mode-v1'); if (raw === 'wysiwyg' || raw === 'source') mode = raw; } catch {} window.__OK_EDITOR_MODE__ = mode; })();</script>
|
|
23
|
-
<script type="module" crossorigin src="./assets/index-
|
|
23
|
+
<script type="module" crossorigin src="./assets/index-C0JKXDVX.js"></script>
|
|
24
24
|
<link rel="modulepreload" crossorigin href="./assets/chunk-DECur_0Z.js">
|
|
25
25
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-CbLDdnQA.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-LnD10wq2.js">
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
<link rel="modulepreload" crossorigin href="./assets/dist-oNAFjGrp.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Y11fyRVL.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="./assets/button-Dyz7QGIk.js">
|
|
32
|
-
<link rel="modulepreload" crossorigin href="./assets/toggle-group-
|
|
32
|
+
<link rel="modulepreload" crossorigin href="./assets/toggle-group-CyBGhndP.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="./assets/dist-RVD4DzGH.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="./assets/dialog-FUclf-NK.js">
|
|
35
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
35
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-CDvFNgd7.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="./assets/panel-DT62BXGr.js">
|
|
37
|
-
<link rel="modulepreload" crossorigin href="./assets/clipboard-
|
|
37
|
+
<link rel="modulepreload" crossorigin href="./assets/clipboard-BTbzStNo.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="./assets/circle-check-C-DpX4dU.js">
|
|
39
|
-
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-
|
|
40
|
-
<link rel="modulepreload" crossorigin href="./assets/tooltip-
|
|
39
|
+
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-gPU2C30Q.js">
|
|
40
|
+
<link rel="modulepreload" crossorigin href="./assets/tooltip-FdwzzIbl.js">
|
|
41
41
|
<link rel="modulepreload" crossorigin href="./assets/agent-presence-BxT9uQ-C.js">
|
|
42
|
-
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-
|
|
42
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BeUCdVKa.js">
|
|
43
43
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-BBTXqzE6.js">
|
|
44
44
|
<link rel="stylesheet" crossorigin href="./assets/index-Du0-WJgD.css">
|
|
45
45
|
</head>
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
"properties": {
|
|
5
5
|
"content": {
|
|
6
6
|
"default": {
|
|
7
|
-
"dir": "."
|
|
8
|
-
"include": [
|
|
9
|
-
"**/*.md",
|
|
10
|
-
"**/*.mdx"
|
|
11
|
-
],
|
|
12
|
-
"exclude": []
|
|
7
|
+
"dir": "."
|
|
13
8
|
},
|
|
14
9
|
"type": "object",
|
|
15
10
|
"properties": {
|
|
@@ -19,30 +14,6 @@
|
|
|
19
14
|
"scope": "project",
|
|
20
15
|
"agentSettable": false,
|
|
21
16
|
"defaultScope": "project"
|
|
22
|
-
},
|
|
23
|
-
"include": {
|
|
24
|
-
"default": [
|
|
25
|
-
"**/*.md",
|
|
26
|
-
"**/*.mdx"
|
|
27
|
-
],
|
|
28
|
-
"minItems": 1,
|
|
29
|
-
"type": "array",
|
|
30
|
-
"items": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
},
|
|
33
|
-
"scope": "project",
|
|
34
|
-
"agentSettable": true,
|
|
35
|
-
"defaultScope": "project"
|
|
36
|
-
},
|
|
37
|
-
"exclude": {
|
|
38
|
-
"default": [],
|
|
39
|
-
"type": "array",
|
|
40
|
-
"items": {
|
|
41
|
-
"type": "string"
|
|
42
|
-
},
|
|
43
|
-
"scope": "project",
|
|
44
|
-
"agentSettable": true,
|
|
45
|
-
"defaultScope": "project"
|
|
46
17
|
}
|
|
47
18
|
},
|
|
48
19
|
"additionalProperties": {}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{$ as e,Lt as t,X as n,Z as r,et as i,it as a,nt as o,rt as s,tt as c}from"./dist-CUghvkAf.mjs";import{dirname as l,isAbsolute as u,resolve as d}from"node:path";import{existsSync as f,readFileSync as p,renameSync as m,unlinkSync as h}from"node:fs";import{homedir as g}from"node:os";import{mkdir as _,rename as v,writeFile as y}from"node:fs/promises";var b=t();function x(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${n}/${e===`user`?`config.user.schema.json`:`config.project.schema.json`}`}function S(e){return`# yaml-language-server: $schema=${x(e)}\n`}function C(e,t,n){return d(e===`user`?n??g():u(t)?t:d(t),`.ok`,`config.yml`)}function w(e){return{ok:!1,error:e}}function T(e){return{ok:!0,...e}}async function E(e,t){let n=`${e}.tmp.${crypto.randomUUID()}`;try{await y(n,t,{encoding:`utf-8`,mode:420}),await v(n,e)}catch(e){try{h(n)}catch{}throw e}}async function D(e){return s(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await O(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function O(t){let{cwd:n,scope:s,patch:c,homedirOverride:u,firstWriteHeader:d}=t,m=C(s,n,u),h=``,g=!1;if(f(m)){g=!0;try{h=p(m,`utf-8`)}catch(e){return w({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let v=(0,b.parseDocument)(h);if(v.errors.length>0)return w({code:`YAML_PARSE`,detail:v.errors.map(e=>e.message).join(`; `)});if(v.contents===null)v.contents=v.createNode({});else if(!(0,b.isMap)(v.contents))return w({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,b.isSeq)(v.contents)?`sequence`:`scalar`}`});let y=i(v,c),x=v.toJSON(),D=a(`config.validate`,{"config.scope":s,"config.validation.layer":`L2`},t=>{let n=r.safeParse(x);if(t.setAttribute(`config.outcome`,n.success?`success`:`rejected`),!n.success)for(let t of n.error.issues)e(`config.validation.issue`,{"issue.path":t.path.map(e=>String(e)).join(`.`),"issue.message":t.message});return n});if(!D.success)return w({code:`SCHEMA_INVALID`,issues:D.error.issues.map(o)});let O=v.toString();if(!g){let e=d===void 0?S(s):d??``;e.length>0&&(O=`${e.endsWith(`
|
|
2
|
+
`)?e:`${e}\n`}${O}`)}try{await _(l(m),{recursive:!0})}catch(e){return w({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${m}: ${e instanceof Error?e.message:String(e)}`})}try{await E(m,O)}catch(e){return w({code:`WRITE_ERROR`,detail:`Could not write ${m}: ${e instanceof Error?e.message:String(e)}`})}return T({effective:D.data,appliedPaths:y,path:m,created:!g})}function k(e){if(!f(e))return[];let t=(0,b.parseDocument)(p(e,`utf-8`));if(t.errors.length>0)return[];let n=t.toJSON();if(!n||typeof n!=`object`||Array.isArray(n))return[];let r=n.folders;return Array.isArray(r)?r:[]}function A(e){return{ok:!1,error:e}}function j(e){return{ok:!0,...e}}async function M(e){let t=e.scope??`project`,n=C(t,e.cwd,e.homedirOverride),r;try{r=k(n)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not read current folders: ${e instanceof Error?e.message:String(e)}`})}let i=r.map(e=>({match:e.match,frontmatter:{...e.frontmatter}}));for(let t of e.rules){let e=t.new_match??t.match,n=i.findIndex(e=>e.match===t.match);if(t.new_match!==void 0&&t.new_match!==t.match){if(n>=0){let e=i.findIndex((e,r)=>r!==n&&e.match===t.new_match);e>=0&&i.splice(e,1);let r=e>=0&&e<n?n-1:n;i[r]={match:t.new_match,frontmatter:{...t.frontmatter}}}else{let n=i.findIndex(t=>t.match===e);n>=0?i[n]={match:e,frontmatter:{...t.frontmatter}}:i.push({match:e,frontmatter:{...t.frontmatter}})}continue}n>=0?i[n]={match:t.match,frontmatter:{...t.frontmatter}}:i.push({match:t.match,frontmatter:{...t.frontmatter}})}let a=await D({cwd:e.cwd,scope:t,patch:{folders:i},homedirOverride:e.homedirOverride});return a.ok?j({effective:a.effective,appliedPaths:a.appliedPaths,path:a.path,created:a.created}):A(a.error)}function N(e,t){let n=P(`user`,t),r=P(`project`,t),i=new Map;for(let t of e){let e=t.join(`.`);i.set(e,{user:F(n,t),project:F(r,t)})}return i}function P(e,t){let n=C(e,t.cwd,t.homedirOverride);if(!f(n))return null;let r;try{r=p(n,`utf-8`)}catch(t){return t.code!==`ENOENT`&&console.warn(`[inspectConfigPaths] could not read ${e} config at ${n}: ${t.message??t}`),null}let i=(0,b.parseDocument)(r);return i.errors.length>0?(console.warn(`[inspectConfigPaths] ${e} config at ${n} has YAML parse errors; treating as absent for scope inference`),null):i.toJSON()}function F(e,t){if(t.length===0)return e!=null;let n=e;for(let e of t){if(n==null)return!1;if(Array.isArray(n)&&typeof e==`number`){n=n[e];continue}if(typeof n==`object`){let t=String(e);if(!(t in n))return!1;n=n[t];continue}return!1}return n!==void 0}function I(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=c({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function L(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return m(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function R(e){let{absPath:t,sideline:n=!0,timestamp:i=new Date().toISOString()}=e,a=e.warn??(e=>console.warn(e)),o=r.parse({});if(!f(t))return{valid:!0,value:o,source:void 0};let s;try{s=p(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);return a(`[config] Could not read ${t}: ${n}. Using schema defaults.`),{valid:!1,value:o,error:{code:`UNKNOWN`,message:`Read failed: ${n}`}}}let c=(0,b.parseDocument)(s);if(c.errors.length>0){let e=c.errors.map(e=>e.message).join(`; `);a(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?L(t,i,a):void 0;return{valid:!1,value:o,error:{code:`YAML_PARSE`,detail:e},...r===void 0?{}:{sidelinedTo:r}}}let l=c.toJSON()??{},u=r.safeParse(l);if(!u.success){let e=I(u,c,s,t);a(`[config] ${t} fails schema validation (${u.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?L(t,i,a):void 0;return{valid:!1,value:o,error:e,...r===void 0?{}:{sidelinedTo:r}}}return{valid:!0,value:u.data,source:t}}export{D as a,C as i,N as n,R as r,M as t};
|
|
3
|
+
//# sourceMappingURL=server-Bc0tGxRk.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{t as e}from"./rolldown-runtime-wcPFST8Q-BB0WpHs3.mjs";import{dirname as t,resolve as n}from"node:path";import{closeSync as r,existsSync as i,mkdirSync as a,openSync as o,readFileSync as s,unlinkSync as c,writeFileSync as l,writeSync as u}from"node:fs";import{hostname as d}from"node:os";import{fileURLToPath as f}from"node:url";function p(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function m(){try{let e=n(t(f(import.meta.url)),`..`,`package.json`),r=JSON.parse(s(e,`utf-8`));if(typeof r.version==`string`&&r.version.length>0)return r.version}catch{}return`0.0.0-unknown`}const h=m();var g=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function _(e,t){return n(e,`${t}.lock`)}const v=new Map;function y(e){v.set(e,(v.get(e)??0)+1)}function b(e){let t=v.get(e);return t===void 0||t<=1?(v.delete(e),!0):(v.set(e,t-1),!1)}function x(e,t){try{let n=JSON.parse(s(e,`utf-8`));return n&&typeof n==`object`&&typeof n.pid==`number`?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function S(e){let{lockName:t,lockDir:n,metadata:s}=e,f=`[${t}-lock]`;a(n,{recursive:!0});let m=_(n,t),v={pid:process.pid,hostname:d(),port:s.port,startedAt:new Date().toISOString(),worktreeRoot:s.worktreeRoot,...s.kind!==void 0&&{kind:s.kind},...s.parentPid!==void 0&&{parentPid:s.parentPid},...s.capabilities!==void 0&&{capabilities:s.capabilities},protocolVersion:s.protocolVersion??1,runtimeVersion:s.runtimeVersion??h},b=JSON.stringify(v,null,2);for(let e=0;e<3;e++){if(!i(m))try{let e=o(m,`wx`,384);try{u(e,b)}finally{r(e)}return y(m),C({lockName:t,lockDir:n,lockPath:m})}catch(e){if(e.code!==`EEXIST`)throw e}let e=x(m,f);if(e){let r=e.hostname===d();if(r&&e.pid===process.pid)return l(m,b,{encoding:`utf-8`,mode:384}),y(m),C({lockName:t,lockDir:n,lockPath:m});if(r&&p(e.pid))throw new g(e,m,t);console.warn(`${f} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{c(m)}catch{}}throw Error(`${f} Failed to acquire ${m} after 3 attempts (concurrent acquire contention).`)}function C(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>E({lockName:t,lockDir:n}),updatePort:e=>w({lockName:t,lockDir:n,port:e})}}function w(e){let{lockName:t,lockDir:n,port:r}=e,a=`[${t}-lock]`,o=_(n,t);if(!i(o)){console.warn(`${a} Lock file missing at ${o} during port update — skipping`);return}let c;try{let e=JSON.parse(s(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`){console.warn(`${a} Corrupt lock at ${o} during port update — skipping`);return}c=e}catch{console.warn(`${a} Unreadable lock at ${o} during port update — skipping`);return}if(c.pid===process.pid&&!(typeof c.hostname==`string`&&c.hostname!==d())){c.port=r;try{l(o,JSON.stringify(c,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${a} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function T(e){let{lockName:t,lockDir:n}=e,r=_(n,t);if(!i(r))return null;let a;try{let e=JSON.parse(s(r,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`)return null;a=e}catch{return null}if(a.hostname!==d())return null;if(!p(a.pid)){try{c(r)}catch{}return null}return a}function E(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,a=_(n,t);if(b(a)&&i(a))try{let e=JSON.parse(s(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==d())return;c(a)}catch(e){console.warn(`${r} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}var D=e({ServerLockCollisionError:()=>O,acquireServerLock:()=>k,readServerLock:()=>j,releaseServerLock:()=>M,updateServerLockPort:()=>A}),O=class extends g{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function k(e,t){try{return S({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof g&&e.lockName===`server`?new O(e.existing,e.lockPath):e}}function A(e,t){w({lockName:`server`,lockDir:e,port:t})}function j(e){return T({lockName:`server`,lockDir:e})}function M(e){E({lockName:`server`,lockDir:e})}export{k as a,T as c,M as d,D as f,S as i,j as l,A as m,h as n,p as o,w as p,O as r,_ as s,g as t,E as u};
|
|
2
|
-
//# sourceMappingURL=server-lock-
|
|
2
|
+
//# sourceMappingURL=server-lock-BAi_a4NX-CRPhQdIH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e}from"./server-lock-BAi_a4NX-CRPhQdIH.mjs";export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./loader-IVNXMdm0.mjs";import"./init-DMUmlRUV.mjs";export{};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./esm-wByiX8MO.mjs";import{i as t}from"./constants-Ccx0q5EO.mjs";import{spawn as n}from"node:child_process";import{join as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s}from"node:fs";import{setTimeout as c}from"node:timers/promises";function l(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function u(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function d(e){a(e.lockDir)||o(e.lockDir,{recursive:!0});let t=s(r(e.lockDir,`last-spawn-error.log`),`w`),c=e.spawn??n,{PORT:u,...d}=process.env,f=l();try{let n=c(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return n.unref(),n}finally{try{i(t)}catch{}}}async function f(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}function p(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>c(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function m(e){let{config:t,cwd:n}=e,r=e.skipAutoInit??!1,i=e.skipUiAutoSpawn??!1,a=e.idleThresholdMs??18e5,{existsSync:o,mkdirSync:s}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:m,ensureProjectGit:h,getLogger:g,isProcessAlive:_,readUiLock:v}=await import(`./dist-B-uWyCj3.mjs`),{resolveContentDir:y}=await import(`./paths-CcnZRq8W.mjs`),b=e.log??g(`start`),x=y(t,n);o(x)||(s(x,{recursive:!0}),b.info({contentDir:x},`Created content directory`));let S=!o(l(n,`.ok`)),C=r?void 0:async()=>{try{let{initContent:e}=await import(`./init-Dd-ypqWc.mjs`),t=e(n);return S||t.created.length>0||t.updated.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},w=!1,T=l(x,`.ok`),E=t.server.openOnAgentEdit?()=>{if(w)return;let e=v(T);if(!e||e.port<=0||!_(e.pid))return;w=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-hvFa-TeR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,D=null,O=await m({contentDir:x,projectDir:n,contentRoot:t.content.dir,port:e.port,host:t.server.host,quiet:!1,onAgentWrite:E,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:a,skipAutoInit:r,autoInitFn:C,ensureProjectGitFn:r?void 0:()=>h(n),spawnUiSiblingFn:async({lockDir:t})=>{if(D=u({uiLock:v(t),isAlive:_}),D.action===`spawn`&&!i)try{d({lockDir:t,cwd:n,spawn:e.spawn}),b.info({reason:D.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else D.action===`skip`&&b.info({port:D.port,pid:D.pid},`UI already running at port ${D.port}`)},idleShutdownHandler:e=>p({readUiLock:()=>v(O.lockDir),isAlive:_,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:b}),log:b});D||={action:`skip`,reason:`alive`,pid:0,port:0};let k=D,A=null;if(k.action===`skip`)A=k.port>0?k.port:null;else if(!i){let t=e.uiBindTimeoutMs??3e3;A=await f({readUiLock:()=>v(O.lockDir),now:Date.now,sleep:e=>c(e),timeoutMs:t,pollIntervalMs:50}),A===null&&b.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:O.httpServer,destroy:O.destroy,lockDir:O.lockDir,contentDir:x,port:O.port,ready:O.ready,degraded:O.degraded,uiSpawnDecision:D,resolvedUiPort:A,didAutoInit:O.didAutoInit,didGitInit:O.didGitInit}}function h(n){return new e(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of .ok/`).action(async e=>{let{renderBanner:r}=await import(`./banner-DoFNyNUH.mjs`),{dim:i,error:a,info:o,warning:s}=await import(`./colors-CswooXAS.mjs`),c=n(),l=process.cwd();e.host!==void 0&&(c.server.host=e.host);let u=e.port===void 0?void 0:Number(e.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await m({config:c,cwd:l,port:f,skipAutoInit:e.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./dist-B-uWyCj3.mjs`);e instanceof t&&(console.error(a(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(i(e.stderr.trim())),process.exit(1)),console.error(`${a(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let h=!1,g=async e=>{if(!h){h=!0,console.log(i(`\nShutting down (${e})...`));try{await p.destroy()}catch(e){console.error(`${a(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{g(`SIGINT`)}),process.once(`SIGTERM`,()=>{g(`SIGTERM`)});let _=`http://${c.server.host}:${p.port}`,v=c.server.host===`0.0.0.0`||c.server.host===`::`?`http://0.0.0.0:${p.port}`:void 0,y=p.resolvedUiPort,b=y!==null&&y>0?`http://${c.server.host}:${y}`:_;console.log(r({name:`open-knowledge`,version:t,localUrl:b,apiUrl:b===_?void 0:_,networkUrl:v})),p.didAutoInit&&(console.log(` ${o(`✓`)} Scaffolded .ok/ (first run)`),console.log(` ${i("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let x={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=x[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${i(t)}`)}console.log()}if(p.didAutoInit||p.didGitInit)if(p.didGitInit&&console.log(`\n ${o(`✓`)} Initialized git repo at ${l}/.git/ (default branch: main)`),p.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-SUAZQ5h2.mjs`),n=e({projectDir:l,contentDir:p.contentDir});console.log(`\n${t(n,l)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(e.open){let{openBrowser:e}=await import(`./open-browser-hvFa-TeR.mjs`);e(b)}}).catch(e=>{console.error(` ${a(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{d as a,u as i,m as n,h as o,p as r,l as s,f as t};
|
|
2
|
+
//# sourceMappingURL=start-CUBxPqPc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./start-CUBxPqPc.mjs";export{e as startCommand};
|