likec4 1.51.0 → 1.52.0

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.
@@ -1 +1 @@
1
- import e from"crypto";import{createServer as t}from"http";import{Http2ServerRequest as n}from"http2";import{Readable as r}from"stream";var i=class extends Error{constructor(e,t){super(e,t),this.name=`RequestError`}},a=e=>e instanceof i?e:new i(e.message,{cause:e}),o=global.Request,s=class extends o{constructor(e,t){typeof e==`object`&&d in e&&(e=e[d]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},c=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},l=Symbol(`wrapBodyStream`),u=(e,t,n,i,a)=>{let o={method:e,headers:n,signal:a.signal};if(e===`TRACE`){o.method=`GET`;let e=new s(t,o);return Object.defineProperty(e,`method`,{get(){return`TRACE`}}),e}if(!(e===`GET`||e===`HEAD`))if(`rawBody`in i&&i.rawBody instanceof Buffer)o.body=new ReadableStream({start(e){e.enqueue(i.rawBody),e.close()}});else if(i[l]){let e;o.body=new ReadableStream({async pull(t){try{e||=r.toWeb(i).getReader();let{done:n,value:a}=await e.read();n?t.close():t.enqueue(a)}catch(e){t.error(e)}}})}else o.body=r.toWeb(i);return new s(t,o)},d=Symbol(`getRequestCache`),f=Symbol(`requestCache`),p=Symbol(`incomingKey`),m=Symbol(`urlKey`),h=Symbol(`headersKey`),g=Symbol(`abortControllerKey`),_={get method(){return this[p].method||`GET`},get url(){return this[m]},get headers(){return this[h]||=c(this[p])},[Symbol(`getAbortController`)](){return this[d](),this[g]},[d](){return this[g]||=new AbortController,this[f]||=u(this.method,this[m],this.headers,this[p],this[g])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(_,e,{get(){return this[d]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(_,e,{value:function(){return this[d]()[e]()}})}),Object.setPrototypeOf(_,s.prototype);var v=(e,t)=>{let r=Object.create(_);r[p]=e;let a=e.url||``;if(a[0]!==`/`&&(a.startsWith(`http://`)||a.startsWith(`https://`))){if(e instanceof n)throw new i(`Absolute URL for :path is not allowed in HTTP/2`);try{r[m]=new URL(a).href}catch(e){throw new i(`Invalid absolute URL`,{cause:e})}return r}let o=(e instanceof n?e.authority:e.headers.host)||t;if(!o)throw new i(`Missing host header`);let s;if(e instanceof n){if(s=e.scheme,!(s===`http`||s===`https`))throw new i(`Unsupported scheme`)}else s=e.socket&&e.socket.encrypted?`https`:`http`;let c=new URL(`${s}://${o}${a}`);if(c.hostname.length!==o.length&&c.hostname!==o.replace(/:\d+$/,``))throw new i(`Invalid host header`);return r[m]=c.href,r},y=Symbol(`responseCache`),b=Symbol(`getResponseCache`),x=Symbol(`cache`),S=global.Response,C=class e{#e;#t;[b](){return delete this[x],this[y]||=new S(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[y];if(e){this.#t=e,this[b]();return}else this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(r||=n?.headers||{"content-type":`text/plain; charset=UTF-8`},this[x]=[n?.status||200,t,r])}get headers(){let e=this[x];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2])),e[2]):this[b]().headers}get status(){return this[x]?.[0]??this[b]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(C.prototype,e,{get(){return this[b]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(C.prototype,e,{value:function(){return this[b]()[e]()}})}),Object.setPrototypeOf(C,S),Object.setPrototypeOf(C.prototype,S.prototype);async function w(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function T(e,t,n){let r=t=>{e.cancel(t).catch(()=>{})};return t.on(`close`,r),t.on(`error`,r),(n??e.read()).then(o,i),e.closed.finally(()=>{t.off(`close`,r),t.off(`error`,r)});function i(e){e&&t.destroy(e)}function a(){e.read().then(o,i)}function o({done:n,value:r}){try{if(n)t.end();else if(!t.write(r))t.once(`drain`,a);else return e.read().then(o,i)}catch(e){i(e)}}}function E(e,t){if(e.locked)throw TypeError(`ReadableStream is locked.`);return t.destroyed?void 0:T(e.getReader(),t)}var D=e=>{let t={};e instanceof Headers||(e=new Headers(e??void 0));let n=[];for(let[r,i]of e)r===`set-cookie`?n.push(i):t[r]=i;return n.length>0&&(t[`set-cookie`]=n),t[`content-type`]??=`text/plain; charset=UTF-8`,t},O=`x-hono-already-sent`;global.crypto===void 0&&(global.crypto=e);var k=Symbol(`outgoingEnded`),A=()=>new Response(null,{status:400}),j=e=>new Response(null,{status:e instanceof Error&&(e.name===`TimeoutError`||e.constructor.name===`TimeoutError`)?504:500}),M=(e,t)=>{let n=e instanceof Error?e:Error(`unknown error`,{cause:e});n.code===`ERR_STREAM_PREMATURE_CLOSE`?console.info(`The user aborted a request.`):(console.error(e),t.headersSent||t.writeHead(500,{"Content-Type":`text/plain`}),t.end(`Error: ${n.message}`),t.destroy(n))},N=e=>{`flushHeaders`in e&&e.writable&&e.flushHeaders()},P=async(e,t)=>{let[n,r,i]=e[x];i instanceof Headers&&(i=D(i)),typeof r==`string`?i[`Content-Length`]=Buffer.byteLength(r):r instanceof Uint8Array?i[`Content-Length`]=r.byteLength:r instanceof Blob&&(i[`Content-Length`]=r.size),t.writeHead(n,i),typeof r==`string`||r instanceof Uint8Array?t.end(r):r instanceof Blob?t.end(new Uint8Array(await r.arrayBuffer())):(N(t),await E(r,t)?.catch(e=>M(e,t))),t[k]?.()},F=e=>typeof e.then==`function`,I=async(e,t,n={})=>{if(F(e))if(n.errorHandler)try{e=await e}catch(t){let r=await n.errorHandler(t);if(!r)return;e=r}else e=await e.catch(j);if(x in e)return P(e,t);let r=D(e.headers);if(e.body){let n=e.body.getReader(),i=[],a=!1,o;if(r[`transfer-encoding`]!==`chunked`){let e=2;for(let t=0;t<e;t++){o||=n.read();let r=await w(o).catch(e=>{console.error(e),a=!0});if(!r){if(t===1){await new Promise(e=>setTimeout(e)),e=3;continue}break}if(o=void 0,r.value&&i.push(r.value),r.done){a=!0;break}}a&&!(`content-length`in r)&&(r[`content-length`]=i.reduce((e,t)=>e+t.length,0))}t.writeHead(e.status,r),i.forEach(e=>{t.write(e)}),a?t.end():(i.length===0&&N(t),await T(n,t,o))}else r[O]||(t.writeHead(e.status,r),t.end());t[k]?.()},L=(e,t={})=>{let r=t.autoCleanupIncoming??!0;return t.overrideGlobalObjects!==!1&&global.Request!==s&&(Object.defineProperty(global,`Request`,{value:s}),Object.defineProperty(global,`Response`,{value:C})),async(i,o)=>{let s,c;try{c=v(i,t.hostname);let a=!r||i.method===`GET`||i.method===`HEAD`;if(a||(i[l]=!0,i.on(`end`,()=>{a=!0}),i instanceof n&&(o[k]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{i.destroy(),o.destroy()})})})),o.on(`close`,()=>{c[g]&&(i.errored?c[g].abort(i.errored.toString()):o.writableFinished||c[g].abort(`Client connection prematurely closed.`)),a||setTimeout(()=>{a||setTimeout(()=>{i.destroy()})})}),s=e(c,{incoming:i,outgoing:o}),x in s)return P(s,o)}catch(e){if(s)return M(e,o);if(t.errorHandler){if(s=await t.errorHandler(c?e:a(e)),!s)return}else s=c?j(e):A()}try{return await I(s,o,t)}catch(e){return M(e,o)}}},R=e=>{let n=e.fetch,r=L(n,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming});return(e.createServer||t)(e.serverOptions||{},r)},z=(e,t)=>{let n=R(e);return n.listen(e?.port??3e3,e.hostname,()=>{let e=n.address();t&&t(e)}),n};export{z as t};
1
+ import e from"crypto";import{createServer as t}from"http";import{Http2ServerRequest as n}from"http2";import{Readable as r}from"stream";var i=class extends Error{constructor(e,t){super(e,t),this.name=`RequestError`}},a=e=>e instanceof i?e:new i(e.message,{cause:e}),o=global.Request,s=class extends o{constructor(e,t){typeof e==`object`&&d in e&&(e=e[d]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},c=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},l=Symbol(`wrapBodyStream`),u=(e,t,n,i,a)=>{let o={method:e,headers:n,signal:a.signal};if(e===`TRACE`){o.method=`GET`;let e=new s(t,o);return Object.defineProperty(e,`method`,{get(){return`TRACE`}}),e}if(!(e===`GET`||e===`HEAD`))if(`rawBody`in i&&i.rawBody instanceof Buffer)o.body=new ReadableStream({start(e){e.enqueue(i.rawBody),e.close()}});else if(i[l]){let e;o.body=new ReadableStream({async pull(t){try{e||=r.toWeb(i).getReader();let{done:n,value:a}=await e.read();n?t.close():t.enqueue(a)}catch(e){t.error(e)}}})}else o.body=r.toWeb(i);return new s(t,o)},d=Symbol(`getRequestCache`),f=Symbol(`requestCache`),p=Symbol(`incomingKey`),m=Symbol(`urlKey`),h=Symbol(`headersKey`),g=Symbol(`abortControllerKey`),_={get method(){return this[p].method||`GET`},get url(){return this[m]},get headers(){return this[h]||=c(this[p])},[Symbol(`getAbortController`)](){return this[d](),this[g]},[d](){return this[g]||=new AbortController,this[f]||=u(this.method,this[m],this.headers,this[p],this[g])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(_,e,{get(){return this[d]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(_,e,{value:function(){return this[d]()[e]()}})}),Object.setPrototypeOf(_,s.prototype);var v=(e,t)=>{let r=Object.create(_);r[p]=e;let a=e.url||``;if(a[0]!==`/`&&(a.startsWith(`http://`)||a.startsWith(`https://`))){if(e instanceof n)throw new i(`Absolute URL for :path is not allowed in HTTP/2`);try{r[m]=new URL(a).href}catch(e){throw new i(`Invalid absolute URL`,{cause:e})}return r}let o=(e instanceof n?e.authority:e.headers.host)||t;if(!o)throw new i(`Missing host header`);let s;if(e instanceof n){if(s=e.scheme,!(s===`http`||s===`https`))throw new i(`Unsupported scheme`)}else s=e.socket&&e.socket.encrypted?`https`:`http`;let c=new URL(`${s}://${o}${a}`);if(c.hostname.length!==o.length&&c.hostname!==o.replace(/:\d+$/,``))throw new i(`Invalid host header`);return r[m]=c.href,r},y=Symbol(`responseCache`),b=Symbol(`getResponseCache`),x=Symbol(`cache`),S=global.Response,C=class e{#e;#t;[b](){return delete this[x],this[y]||=new S(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[y];if(e){this.#t=e,this[b]();return}else this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[x]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[x];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[b]().headers}get status(){return this[x]?.[0]??this[b]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(C.prototype,e,{get(){return this[b]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(C.prototype,e,{value:function(){return this[b]()[e]()}})}),Object.setPrototypeOf(C,S),Object.setPrototypeOf(C.prototype,S.prototype);async function w(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function T(e,t,n){let r=t=>{e.cancel(t).catch(()=>{})};return t.on(`close`,r),t.on(`error`,r),(n??e.read()).then(o,i),e.closed.finally(()=>{t.off(`close`,r),t.off(`error`,r)});function i(e){e&&t.destroy(e)}function a(){e.read().then(o,i)}function o({done:n,value:r}){try{if(n)t.end();else if(!t.write(r))t.once(`drain`,a);else return e.read().then(o,i)}catch(e){i(e)}}}function E(e,t){if(e.locked)throw TypeError(`ReadableStream is locked.`);return t.destroyed?void 0:T(e.getReader(),t)}var D=e=>{let t={};e instanceof Headers||(e=new Headers(e??void 0));let n=[];for(let[r,i]of e)r===`set-cookie`?n.push(i):t[r]=i;return n.length>0&&(t[`set-cookie`]=n),t[`content-type`]??=`text/plain; charset=UTF-8`,t},O=`x-hono-already-sent`;global.crypto===void 0&&(global.crypto=e);var k=Symbol(`outgoingEnded`),A=()=>new Response(null,{status:400}),j=e=>new Response(null,{status:e instanceof Error&&(e.name===`TimeoutError`||e.constructor.name===`TimeoutError`)?504:500}),M=(e,t)=>{let n=e instanceof Error?e:Error(`unknown error`,{cause:e});n.code===`ERR_STREAM_PREMATURE_CLOSE`?console.info(`The user aborted a request.`):(console.error(e),t.headersSent||t.writeHead(500,{"Content-Type":`text/plain`}),t.end(`Error: ${n.message}`),t.destroy(n))},N=e=>{`flushHeaders`in e&&e.writable&&e.flushHeaders()},P=async(e,t)=>{let[n,r,i]=e[x],a=!1;if(!i)i={"content-type":`text/plain; charset=UTF-8`};else if(i instanceof Headers)a=i.has(`content-length`),i=D(i);else if(Array.isArray(i)){let e=new Headers(i);a=e.has(`content-length`),i=D(e)}else for(let e in i)if(e.length===14&&e.toLowerCase()===`content-length`){a=!0;break}a||(typeof r==`string`?i[`Content-Length`]=Buffer.byteLength(r):r instanceof Uint8Array?i[`Content-Length`]=r.byteLength:r instanceof Blob&&(i[`Content-Length`]=r.size)),t.writeHead(n,i),typeof r==`string`||r instanceof Uint8Array?t.end(r):r instanceof Blob?t.end(new Uint8Array(await r.arrayBuffer())):(N(t),await E(r,t)?.catch(e=>M(e,t))),t[k]?.()},F=e=>typeof e.then==`function`,I=async(e,t,n={})=>{if(F(e))if(n.errorHandler)try{e=await e}catch(t){let r=await n.errorHandler(t);if(!r)return;e=r}else e=await e.catch(j);if(x in e)return P(e,t);let r=D(e.headers);if(e.body){let n=e.body.getReader(),i=[],a=!1,o;if(r[`transfer-encoding`]!==`chunked`){let e=2;for(let t=0;t<e;t++){o||=n.read();let r=await w(o).catch(e=>{console.error(e),a=!0});if(!r){if(t===1){await new Promise(e=>setTimeout(e)),e=3;continue}break}if(o=void 0,r.value&&i.push(r.value),r.done){a=!0;break}}a&&!(`content-length`in r)&&(r[`content-length`]=i.reduce((e,t)=>e+t.length,0))}t.writeHead(e.status,r),i.forEach(e=>{t.write(e)}),a?t.end():(i.length===0&&N(t),await T(n,t,o))}else r[O]||(t.writeHead(e.status,r),t.end());t[k]?.()},L=(e,t={})=>{let r=t.autoCleanupIncoming??!0;return t.overrideGlobalObjects!==!1&&global.Request!==s&&(Object.defineProperty(global,`Request`,{value:s}),Object.defineProperty(global,`Response`,{value:C})),async(i,o)=>{let s,c;try{c=v(i,t.hostname);let a=!r||i.method===`GET`||i.method===`HEAD`;if(a||(i[l]=!0,i.on(`end`,()=>{a=!0}),i instanceof n&&(o[k]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{i.destroy(),o.destroy()})})})),o.on(`close`,()=>{c[g]&&(i.errored?c[g].abort(i.errored.toString()):o.writableFinished||c[g].abort(`Client connection prematurely closed.`)),a||setTimeout(()=>{a||setTimeout(()=>{i.destroy()})})}),s=e(c,{incoming:i,outgoing:o}),x in s)return P(s,o)}catch(e){if(s)return M(e,o);if(t.errorHandler){if(s=await t.errorHandler(c?e:a(e)),!s)return}else s=c?j(e):A()}try{return await I(s,o,t)}catch(e){return M(e,o)}}},R=e=>{let n=e.fetch,r=L(n,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming});return(e.createServer||t)(e.serverOptions||{},r)},z=(e,t)=>{let n=R(e);return n.listen(e?.port??3e3,e.hostname,()=>{let e=n.address();t&&t(e)}),n};export{z as t};
@@ -2316,7 +2316,7 @@ declare enum ZodFirstPartyTypeKind {
2316
2316
  ZodReadonly = "ZodReadonly"
2317
2317
  }
2318
2318
  //#endregion
2319
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts
2319
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts
2320
2320
  type AnySchema = ZodTypeAny | $ZodType;
2321
2321
  type AnyObjectSchema = AnyZodObject | $ZodObject | AnySchema;
2322
2322
  type ZodRawShapeCompat = Record<string, AnySchema>;
@@ -2327,7 +2327,7 @@ type SchemaOutput<S> = S extends ZodTypeAny ? TypeOf<S> : S extends $ZodType ? o
2327
2327
  */
2328
2328
  type ShapeOutput<Shape extends ZodRawShapeCompat> = { [K in keyof Shape]: SchemaOutput<Shape[K]> };
2329
2329
  //#endregion
2330
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts
2330
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts
2331
2331
  /**
2332
2332
  * Information about a validated access token, provided to request handlers.
2333
2333
  */
@@ -2360,7 +2360,7 @@ interface AuthInfo {
2360
2360
  extra?: Record<string, unknown>;
2361
2361
  }
2362
2362
  //#endregion
2363
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts
2363
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts
2364
2364
  /**
2365
2365
  * Task creation parameters, used to ask that the server create a task to represent a request.
2366
2366
  */
@@ -6058,7 +6058,7 @@ type ServerRequest = Infer<typeof ServerRequestSchema>;
6058
6058
  type ServerNotification = Infer<typeof ServerNotificationSchema>;
6059
6059
  type ServerResult = Infer<typeof ServerResultSchema>;
6060
6060
  //#endregion
6061
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts
6061
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts
6062
6062
  /**
6063
6063
  * Options for sending a JSON-RPC message.
6064
6064
  */
@@ -6132,7 +6132,7 @@ interface Transport {
6132
6132
  setProtocolVersion?: (version: string) => void;
6133
6133
  }
6134
6134
  //#endregion
6135
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts
6135
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts
6136
6136
  /**
6137
6137
  * Extended handler extra with task store for task creation.
6138
6138
  * @experimental
@@ -6348,7 +6348,7 @@ interface TaskStore {
6348
6348
  }>;
6349
6349
  }
6350
6350
  //#endregion
6351
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts
6351
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts
6352
6352
  /**
6353
6353
  * Base message type
6354
6354
  */
@@ -6390,7 +6390,7 @@ interface ErrorMessage extends BaseResponseMessage {
6390
6390
  */
6391
6391
  type ResponseMessage<T extends Result$1> = TaskStatusMessage | TaskCreatedMessage | ResultMessage<T> | ErrorMessage;
6392
6392
  //#endregion
6393
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts
6393
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts
6394
6394
  /**
6395
6395
  * Callback for progress notifications.
6396
6396
  */
@@ -7856,7 +7856,7 @@ declare enum TypeName {
7856
7856
  String = "string"
7857
7857
  }
7858
7858
  //#endregion
7859
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts
7859
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts
7860
7860
  /**
7861
7861
  * JSON Schema type definition (JSON Schema Draft 2020-12)
7862
7862
  *
@@ -7921,7 +7921,7 @@ interface jsonSchemaValidator {
7921
7921
  getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T>;
7922
7922
  }
7923
7923
  //#endregion
7924
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts
7924
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts
7925
7925
  /**
7926
7926
  * Experimental task features for low-level MCP servers.
7927
7927
  *
@@ -8081,7 +8081,7 @@ declare class ExperimentalServerTasks<RequestT extends Request = Request, Notifi
8081
8081
  cancelTask(taskId: string, options?: RequestOptions): Promise<CancelTaskResult>;
8082
8082
  }
8083
8083
  //#endregion
8084
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts
8084
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts
8085
8085
  type ServerOptions = ProtocolOptions & {
8086
8086
  /**
8087
8087
  * Capabilities to advertise as being supported by this server.
@@ -8272,7 +8272,7 @@ declare class Server<RequestT extends Request = Request, NotificationT extends N
8272
8272
  sendPromptListChanged(): Promise<void>;
8273
8273
  }
8274
8274
  //#endregion
8275
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts
8275
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts
8276
8276
  type Variables = Record<string, string | string[]>;
8277
8277
  declare class UriTemplate {
8278
8278
  /**
@@ -8298,7 +8298,7 @@ declare class UriTemplate {
8298
8298
  match(uri: string): Variables | null;
8299
8299
  }
8300
8300
  //#endregion
8301
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts
8301
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts
8302
8302
  /**
8303
8303
  * Experimental task features for McpServer.
8304
8304
  *
@@ -8366,7 +8366,7 @@ declare class ExperimentalMcpServerTasks {
8366
8366
  }, handler: ToolTaskHandler<InputArgs>): RegisteredTool;
8367
8367
  }
8368
8368
  //#endregion
8369
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts
8369
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts
8370
8370
  /**
8371
8371
  * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
8372
8372
  * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
@@ -30,4 +30,4 @@ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../rolldown-runtime.mjs"
30
30
  `.repeat(a)}${r}`,range:e}}fitIntoOptions(e,t,n){return n.allowMore?e=Math.max(t,e):n.allowLess&&(e=Math.min(t,e)),e}findFittingMove(e,t,n){if(t.length===0)return;if(t.length===1)return t[0];let r=e.end.line-e.start.line;for(let e of t)if(e.lines!==void 0&&r<=e.lines)return e;else if(e.lines===void 0&&r===0)return e;return t[t.length-1]}iterateCstTree(e,t){let n=e.parseResult.value.$cstNode;return n?new ne(n,e=>this.iterateCst(e,t)):k}iterateCst(e,t){if(!T(e))return k;let n=t.indentation;return new O(()=>({index:0}),r=>r.index<e.content.length?{done:!1,value:e.content[r.index++]}:(t.indentation=n,A))}},ju=class{constructor(e,t){this.astNode=e,this.collector=t}node(e){return new Mu(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let t=[];for(let n of e)n.$cstNode&&t.push(n.$cstNode);return new Mu(t,this.collector)}property(e,t){let n=Kn(this.astNode.$cstNode,e,t);return new Mu(n?[n]:[],this.collector)}properties(...e){let t=[];for(let n of e){let e=Gn(this.astNode.$cstNode,n);t.push(...e)}return new Mu(t,this.collector)}keyword(e,t){let n=Yn(this.astNode.$cstNode,e,t);return new Mu(n?[n]:[],this.collector)}keywords(...e){let t=[];for(let n of e){let e=Jn(this.astNode.$cstNode,n);t.push(...e)}return new Mu(t,this.collector)}cst(e){return new Mu([...e],this.collector)}interior(e,t){let n=e.nodes,r=t.nodes;if(n.length!==1||r.length!==1)return new Mu([],this.collector);let i=n[0],a=r[0];if(i.offset>a.offset){let e=i;i=a,a=e}return new Mu(_e(i,a),this.collector)}},Mu=class e{constructor(e,t){this.nodes=e,this.collector=t}prepend(e){for(let t of this.nodes)this.collector(t,`prepend`,e);return this}append(e){for(let t of this.nodes)this.collector(t,`append`,e);return this}surround(e){for(let t of this.nodes)this.collector(t,`prepend`,e),this.collector(t,`append`,e);return this}slice(t,n){return new e(this.nodes.slice(t,n),this.collector)}},Nu;(function(e){function t(...e){return{options:{},moves:e.flatMap(e=>e.moves).sort(l)}}e.fit=t;function n(e){return i(0,e)}e.noSpace=n;function r(e){return i(1,e)}e.oneSpace=r;function i(e,t){return{options:t??{},moves:[{characters:e}]}}e.spaces=i;function a(e){return o(1,e)}e.newLine=a;function o(e,t){return{options:t??{},moves:[{lines:e}]}}e.newLines=o;function s(e){return{options:e??{},moves:[{tabs:1,lines:1}]}}e.indent=s;function c(e){return{options:e??{},moves:[{tabs:0}]}}e.noIndent=c;function l(e,t){let n=e.lines??0,r=t.lines??0,i=e.tabs??0,a=t.tabs??0,o=e.characters??0,s=t.characters??0;return n<r?-1:n>r?1:i<a?-1:i>a?1:o<s?-1:o>s?1:0}})(Nu||={});var Pu=class{constructor(){this.encoding=`utf-8`}readFile(e){return y.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await y.promises.readdir(e.fsPath,{withFileTypes:!0})).map(t=>({dirent:t,isFile:t.isFile(),isDirectory:t.isDirectory(),uri:J.joinPath(e,t.name)}))}};function Fu(e){if(e){if(`astNode`in e)return Ru(e);if(Array.isArray(e))return e.reduce(Vu,void 0);{let t=e;return Bu(t,Iu(t)?Lu(t?.root?.astNode??t?.astNode):void 0)}}}function Iu(e){return e!==void 0&&`element`in e&&`text`in e}function Lu(e){try{return B(e).uri.toString()}catch{return}}function Ru(e){let{astNode:t,property:n,index:r}=e??{},i=t?.$cstNode??t?.$textRegion;if(!(t===void 0||i===void 0)){if(n===void 0)return Bu(i,zu(t));{let e=e=>r!==void 0&&r>-1&&Array.isArray(t[n])?r<e.length?e[r]:void 0:e.reduce(Vu,void 0);if(i.assignments?.[n]){let r=e(i.assignments[n]);return r&&Bu(r,zu(t))}else if(t.$cstNode){let r=e(Gn(t.$cstNode,n));return r&&Bu(r,zu(t))}else return}}}function zu(e){if(e.$cstNode)return(B(e)?.uri)?.toString();if(e.$textRegion)return e.$textRegion.documentURI||new ne(e,e=>e.$container?[e.$container]:[]).find(e=>e.$textRegion?.documentURI)?.$textRegion?.documentURI}function Bu(e,t){let n={offset:e.offset,end:e.end??e.offset+e.length,length:e.length??e.end-e.offset};return e.range&&(n.range=e.range),t??=e.fileURI,t&&(n.fileURI=t),n}function Vu(e,t){if(!e)return t&&Bu(t);if(!t)return e&&Bu(e);let n=e.end??e.offset+e.length,r=t.end??t.offset+t.length,i=Math.min(e.offset,t.offset),a=Math.max(n,r),o={offset:i,end:a,length:a-i};if(e.range&&t.range&&(o.range={start:t.range.start.line<e.range.start.line||t.range.start.line===e.range.start.line&&t.range.start.character<e.range.start.character?t.range.start:e.range.start,end:t.range.end.line>e.range.end.line||t.range.end.line===e.range.end.line&&t.range.end.character>e.range.end.character?t.range.end:e.range.end}),e.fileURI||t.fileURI){let n=e.fileURI,r=t.fileURI;o.fileURI=n&&r&&n!==r?`<unmergable text regions of ${n}, ${r}>`:n??r}return o}var Hu=class{constructor(e){this.defaultIndentation=` `,this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof e==`string`?this.defaultIndentation=e:typeof e==`number`&&(this.defaultIndentation=``.padStart(e))}get content(){return this.lines.map(e=>e.join(``)).join(``)}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join(``)}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,t){if(e.length>0){let n=t&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let t=this.traceData.length-1;t>=0;t--){let n=this.traceData[t];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join(``).length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}addNewLine(){this.lines.push([]),this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}pushTraceRegion(e){let t=Uu(e,this.currentPosition,e=>(this.traceData[this.traceData.length-1]?.children)?.push(e));return this.traceData.push(t),t}popTraceRegion(e){let t=this.traceData.pop();return this.assertTrue(t===e,`Trace region mismatch!`),t}getParentTraceSourceFileURI(){for(let e=this.traceData.length-1;e>-1;e--){let t=this.traceData[e].sourceRegion?.fileURI;if(t)return t}}assertTrue(e,t){if(!e)throw Error(t)}};function Uu(e,t,n){let r={sourceRegion:e,targetRegion:void 0,children:[],targetStart:t,complete:e=>(r.targetRegion={offset:r.targetStart.offset,end:e.offset,length:e.offset-r.targetStart.offset,range:{start:{line:r.targetStart.line,character:r.targetStart.character},end:{line:e.line,character:e.character}}},delete r.targetStart,r.children?.length===0&&delete r.children,r.targetRegion?.length&&n(r),delete r.complete,r)};return r}function Wu(e,t){let n=new Hu(t),r=n.pushTraceRegion(void 0);Gu(e,n),n.popTraceRegion(r),r.complete&&r.complete(n.currentPosition);let i=r.children&&r.children.length===1?r.children[0]:void 0,a=i?.targetRegion,o=r.targetRegion;return a&&i.sourceRegion&&a.offset===o.offset&&a.length===o.length?{text:n.content,trace:i}:{text:n.content,trace:r}}function Gu(e,t){typeof e==`string`?qu(e,t):e instanceof gd?Xu(e,t):e instanceof md?Yu(e,t):e instanceof _d&&Zu(e,t)}function Ku(e,t){return typeof e==`string`?e.length!==0:e instanceof md?e.contents.some(e=>Ku(e,t)):e instanceof _d?!(e.ifNotEmpty&&t.currentLineContent.length===0):!1}function qu(e,t){e&&(Ju(t,!1),t.append(e))}function Ju(e,t){if(e.pendingIndent){let n=``;for(let r of e.relevantIndents.filter(e=>e.indentEmptyLines||!t))n+=r.indentation??e.defaultIndentation;e.append(n,!0),e.pendingIndent=!1}}function Yu(e,t){let n,r=Fu(e.tracedSource);r&&(n=t.pushTraceRegion(r));for(let n of e.contents)Gu(n,t);if(n){t.popTraceRegion(n);let e=t.getParentTraceSourceFileURI();e&&r?.fileURI===e&&delete r.fileURI,n.complete&&n.complete(t.currentPosition)}}function Xu(e,t){if(Ku(e,t)){e.indentImmediately&&!t.pendingIndent&&t.append(e.indentation??t.defaultIndentation,!0);try{t.increaseIndent(e),Yu(e,t)}finally{t.decreaseIndent()}}}function Zu(e,t){e.ifNotEmpty&&!Qu(t.currentLineContent)?t.resetCurrentLine():(Ju(t,!0),t.append(e.lineDelimiter),t.addNewLine())}function Qu(e){return e.trimStart()!==``}Object.freeze(`__«SKIP^NEW^LINE^IF^EMPTY»__`);const $u=/\S|$/;function ed(e){let t=e.filter(e=>e.length>0).map(e=>e.search($u)),n=t.length===0?0:Math.min(...t);return Math.max(0,n)}function td(e,...t){return ud(id(e,t,rd(e)))}function nd(e,t,n){return(r,...i)=>hd(e,t,n)(td(r,...i))}function rd(e){let t=e.join(`_`).split(En),n=t.length>1&&t[0].trim().length===0,r=n&&t.length>1&&t[t.length-1].trim().length===0;if(t.length===1||t.length!==0&&t[0].trim().length!==0||t.length===2&&t[1].trim().length===0)return{indentation:0,omitFirstLine:n,omitLastLine:r,trimLastLine:t.length!==1&&t[t.length-1].trim().length===0};{let e=n?t.slice(1):t;e=r?e.slice(0,e.length-1):e,e=e.filter(e=>e.length!==0);let i=ed(e);return{indentation:i,omitFirstLine:n,omitLastLine:r&&(t[t.length-1].length<i||!t[t.length-1].startsWith(e[0].substring(0,i)))}}}function id(e,t,{indentation:n,omitFirstLine:r,omitLastLine:i,trimLastLine:a}){let o=[];e.forEach((e,i)=>{o.push(...e.split(En).map((e,t)=>t===0||e.length<n?e:e.substring(n)).reduce(i===0?(e,t,n)=>n===0?r?[]:[t]:n===1&&e.length===0?[t]:e.concat(ad,t):(e,t,n)=>n===0?[t]:e.concat(ad,t),[]).filter(e=>!(typeof e==`string`&&e.length===0)).concat(fd(t[i])?t[i]:t[i]===void 0?i<t.length?od:[]:{content:String(t[i])}))});let s=o.length,c=s===0?void 0:o[s-1];return(i||a)&&typeof c==`string`&&c.trim().length===0?r&&s!==1&&o[s-2]===ad?o.slice(0,s-2):o.slice(0,s-1):o}const ad={isNewLine:!0},od={isUndefinedSegment:!0},sd=e=>e===ad,cd=e=>e===od,ld=e=>e.content!==void 0;function ud(e){return e.reduce((t,n,r)=>cd(n)?t:sd(n)?{node:r!==0&&(cd(e[r-1])||fd(e[r-1]))||r>1&&typeof e[r-1]==`string`&&(cd(e[r-2])||fd(e[r-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{let i=(r===0||sd(e[r-1]))&&typeof n==`string`&&n.length!==0?``.padStart(n.length-n.trimStart().length):``,a=ld(n)?n.content:n,o;return{node:t.indented?t.node:i.length===0?t.node.append(a):t.node.indent({indentation:i,indentImmediately:!1,indentedChildren:e=>o=e.append(a)}),indented:o??t.indented?.append(a)}})(),{node:new md}).node}const dd=typeof process>`u`?`
31
31
  `:process.platform===`win32`?`\r
32
32
  `:`
33
- `;function fd(e){return e instanceof md||e instanceof gd||e instanceof _d}function pd(e,t){return fd(e)?Wu(e,t).text:String(e)}var md=class e{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(b(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw Error(`Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.`)}else this.tracedSource=e;return this}append(...e){for(let t of e)typeof t==`function`?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(vd)}appendNewLineIf(e){return e?this.append(vd):this}appendNewLineIfNotEmpty(){return this.append(yd)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(td(e,...t))}appendTemplateIf(e){return e?(e,...t)=>this.appendTemplate(e,...t):()=>this}indent(e){let{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:i}=Array.isArray(e)||typeof e==`function`?{indentedChildren:e}:typeof e==`object`?e:{},a=new gd(n,i,r);return this.contents.push(a),Array.isArray(t)?a.append(...t):t&&a.append(t),this}appendTraced(t,n,r){return i=>this.append(new e().trace(t,n,r).append(i))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t==`function`?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...i)=>this.append(nd(e,t,n)(r,...i))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t==`function`?t():t,n,r):()=>this}};function hd(e,t,n){return r=>r instanceof md&&r.tracedSource===void 0?r.trace(e,t,n):new md().trace(e,t,n).append(r)}var gd=class extends md{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e==`string`?this.indentation=e:typeof e==`number`&&(this.indentation=``.padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}},_d=class{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??dd,this.ifNotEmpty=t}};const vd=new _d,yd=new _d(void 0,!0),bd=e=>e===void 0||typeof e==`string`||fd(e)?e:String(e);function xd(e,t=bd,n={}){let r=typeof t==`function`?t:bd,{filter:i,prefix:a,suffix:o,separator:s,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:l}=typeof t==`object`?t:n,u=typeof a==`function`?a:(()=>a),d=typeof o==`function`?o:(()=>o);return Sd(e,(e,t,n,a)=>{if(i&&!i(t,n,a))return e;let o=r(t,n,a);return o===void 0?e:(e??=new md).append(u(t,n,a)).append(o).append(d(t,n,a)).appendIf(!a,s).appendNewLineIfNotEmptyIf(!e.isEmpty()&&!!c&&(!a||!l))})}function Sd(e,t,n){let r=e[Symbol.iterator](),i=r.next(),a=0,o=n;for(;!i.done;){let e=r.next();o=t(o,i.value,a,!!e.done),i=e,a++}return o}export{yi as $,So as A,J as B,Wo as C,jo as D,Io as E,fo as F,La as G,K as H,lo as I,oi as J,ai as K,co as L,go as M,ho as N,Co as O,mo as P,Mi as Q,ao as R,ws as S,Vo as T,Ja as U,q as V,Ia as W,H as X,V as Y,Ni as Z,al as _,w as _t,td as a,Ln as at,Xs as b,Nu as c,B as ct,Su as d,Rt as dt,Hr as et,Hl as f,Wt as ft,yl as g,j as gt,xl as h,k as ht,pd as i,Gn as it,_o as j,yo as k,Eu as l,mn as lt,jl as m,le as mt,md as n,Yn as nt,Pu as o,dn as ot,Ll as p,Xt as pt,Lr as q,vd as r,Kn as rt,Au as s,pn as st,xd as t,Qi as tt,Ou as u,_n as ut,Z as v,b as vt,Uo as w,Ps as x,uc as y,Y as z};
33
+ `;function fd(e){return e instanceof md||e instanceof gd||e instanceof _d}function pd(e,t){return fd(e)?Wu(e,t).text:String(e)}var md=class e{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(b(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw Error(`Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.`)}else this.tracedSource=e;return this}append(...e){for(let t of e)typeof t==`function`?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(vd)}appendNewLineIf(e){return e?this.append(vd):this}appendNewLineIfNotEmpty(){return this.append(yd)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(td(e,...t))}appendTemplateIf(e){return e?(e,...t)=>this.appendTemplate(e,...t):()=>this}indent(e){let{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:i}=Array.isArray(e)||typeof e==`function`?{indentedChildren:e}:typeof e==`object`?e:{},a=new gd(n,i,r);return this.contents.push(a),Array.isArray(t)?a.append(...t):t&&a.append(t),this}appendTraced(t,n,r){return i=>this.append(new e().trace(t,n,r).append(i))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t==`function`?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...i)=>this.append(nd(e,t,n)(r,...i))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t==`function`?t():t,n,r):()=>this}};function hd(e,t,n){return r=>r instanceof md&&r.tracedSource===void 0?r.trace(e,t,n):new md().trace(e,t,n).append(r)}var gd=class extends md{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e==`string`?this.indentation=e:typeof e==`number`&&(this.indentation=``.padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}},_d=class{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??dd,this.ifNotEmpty=t}};const vd=new _d,yd=new _d(void 0,!0),bd=e=>e===void 0||typeof e==`string`||fd(e)?e:String(e);function xd(e,t=bd,n={}){let r=typeof t==`function`?t:bd,{filter:i,prefix:a,suffix:o,separator:s,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:l}=typeof t==`object`?t:n,u=typeof a==`function`?a:(()=>a),d=typeof o==`function`?o:(()=>o);return Sd(e,(e,t,n,a)=>{if(i&&!i(t,n,a))return e;let o=r(t,n,a);return o===void 0?e:(e??=new md).append(u(t,n,a)).append(o).append(d(t,n,a)).appendIf(!a,s).appendNewLineIfNotEmptyIf(!e.isEmpty()&&!!c&&(!a||!l))})}function Sd(e,t,n){let r=e[Symbol.iterator](),i=r.next(),a=0,o=n;for(;!i.done;){let e=r.next();o=t(o,i.value,a,!!e.done),i=e,a++}return o}export{Mi as $,So as A,J as B,Wo as C,jo as D,Io as E,fo as F,Ia as G,Za as H,lo as I,Lr as J,La as K,co as L,go as M,ho as N,Co as O,mo as P,Ni as Q,ao as R,ws as S,Vo as T,K as U,q as V,Ja as W,V as X,oi as Y,H as Z,al as _,j as _t,td as a,Gn as at,Xs as b,Nu as c,pn as ct,Su as d,_n as dt,yi as et,Hl as f,Rt as ft,yl as g,k as gt,xl as h,le as ht,pd as i,Kn as it,_o as j,yo as k,Eu as l,B as lt,jl as m,Xt as mt,md as n,Qi as nt,Pu as o,Ln as ot,Ll as p,Wt as pt,ai as q,vd as r,Yn as rt,Au as s,dn as st,xd as t,Hr as tt,Ou as u,mn as ut,Z as v,w as vt,Uo as w,Ps as x,uc as y,b as yt,Y as z};
@@ -11,5 +11,5 @@ These values will be used if such property is not defined`}),relationship:P.opti
11
11
  These values will be used if such property is not defined`})}).meta({id:`DefaultStyleValues`}),I=t.union([t.string().min(1,`Custom CSS file path cannot be empty`),t.array(t.string().min(1,`Custom CSS file path cannot be empty`))]).meta({id:`CustomStylesheets`}),L=t.strictObject({theme:M.optional().meta({description:`Project theme customization`}),defaults:F.optional().meta({description:`Override default values for style properties
12
12
  These values will be used if such property is not defined`}),customCss:I.optional().meta({description:`Custom CSS (or list of CSS files) to be included in the generated diagrams`})}).transform(({theme:e,defaults:t,customCss:n})=>l({defaults:R(t),customCss:ne(n),theme:e}));function R(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function ne(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const z=t.strictObject({outDir:t.string().default(`.likec4`).meta({description:[`Path to the directory where manual layouts will be stored,`,`relative to the folder containing the project config. `,``,`Defaults to '.likec4'.`].join(`
13
13
  `)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),B=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!==`default`,{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:L.optional().meta({description:`Project styles customization`}),imageAliases:m.optional(),include:g.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:z.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
14
- `)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to true.`})}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),V=t.instanceof(Function),H=t.record(t.string(),V),U=B.extend({generators:H.optional()});function W(e){let n=U.safeParse(e);if(n.success)return n.data;throw Error(`Config validation failed:
14
+ `)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to false.`})}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),V=t.instanceof(Function),H=t.record(t.string(),V),U=B.extend({generators:H.optional()});function W(e){let n=U.safeParse(e);if(n.success)return n.data;throw Error(`Config validation failed:
15
15
  `+t.prettifyError(n.error))}function G(t){return W(e.parse(t.trim()||`{}`))}const K={parse:G,validate:W,normalizeInclude:e=>{let t=g.safeParse(e);return t.success?t.data:{paths:[],maxDepth:3,fileThreshold:30}}};function q(e){let t=e.length;for(;t>0&&(e[t-1]===`/`||e[t-1]===`\\`);)t--;return e.slice(0,t)}function J(e){return e.split(`/`).flatMap(e=>e.split(`\\`))}function Y(e){let t=q(e),n=J(t);return n[n.length-1]||t}const X=[`.likec4rc`,`.likec4.config.json`,`likec4.config.json`],Z=[`likec4.config.js`,`likec4.config.cjs`,`likec4.config.mjs`,`likec4.config.ts`,`likec4.config.cts`,`likec4.config.mts`];[...X,...Z];function Q(e){return X.includes(Y(e))}function $(e){return Z.includes(Y(e))}function re(e){return Q(e)||$(e)}function ie(e){return U.parse(e)}function ae(e){return H.parse(e)}function oe(e){return O.parse(e)}function se(e){return M.parse(e)}function ce(e){return L.parse(e)}export{oe as a,$ as c,W as d,se as i,K as l,ae as n,re as o,ce as r,Q as s,ie as t,B as u};
@@ -2,7 +2,7 @@ import{t as e}from"./libs/birpc.mjs";import{C as t,D as n,I as r,S as i,W as a,Z
2
2
  `),n=/^\s+at\s+/,r=t.findIndex(e=>n.test(e));return r===-1&&(r=1),{message:t.slice(0,r).join(`
3
3
  `),stack:t.slice(r).join(`
4
4
  `)}}function ye(e,{name:t,error:n}){e.hot.send({type:`error`,err:{...ve(n),name:t??`LikeC4PluginError`,plugin:`vite-plugin-likec4`}})}async function be({logger:e,likec4:t},n){e.info([E.green(`view:onChange`),E.dim(`project`)+`:`,n.projectId,E.dim(`view`)+`:`,n.viewId,E.dim(`change`)+`:`,n.change.op].join(` `));let r=await t.editor.applyChange(n);if(!r.success){e.error(`Failed to apply view change:\n${r.error}`);let t=Error(r.error);throw t.stack=r.error,t}e.info([E.green(`view:onChange`),`✅`].join(` `))}function xe(t){let n=null,r=t.server;e({updateView:e=>be(t,e),calcAdhocView:e=>_e(t,e)},{on:e=>r.hot.on(`likec4:rpc`,e),post:e=>r.hot.send(`likec4:rpc`,e),onFunctionError:(e,i)=>{t.logger.error(`RPC error in ${i}`,{error:e});let a=e.stack??e.message;try{n!==a&&(n=a,ye(r,{name:e.name,error:a}))}catch(e){t.logger.error(`Failed to send error to client`,{error:e})}}})}const Se=e=>e.charAt(0).toLocaleUpperCase()+e.slice(1),Ce=e=>e.split(`.`).map(Se).join(``),we=e=>Ce(e.parent?e.id.slice(e.parent.length+1):e.id),Te=({autoLayout:e})=>{switch(e.direction){case`TB`:return`down`;case`BT`:return`up`;case`LR`:return`right`;case`RL`:return`left`}},Ee=({shape:e})=>{switch(e){case`queue`:case`cylinder`:case`rectangle`:case`document`:return e;case`person`:return`c4-person`;case`storage`:return`stored_data`;case`component`:case`bucket`:case`mobile`:case`browser`:return`rectangle`}};function De(e){let t=e.$view,{nodes:r,edges:i}=t,a=new Map,o=(e,t)=>{let n=we(e),i=(t?t+`.`:``)+n;a.set(e.id,i);let s=JSON.stringify(e.title),c=Ee(e);return new A().append(n,`: {`,j).indent({indentedChildren:t=>t.append(`label: `,s,j).appendIf(c!==`rectangle`,`shape: `,c,j).appendIf(e.children.length>0,j,M(r.filter(t=>t.parent===e.id),e=>o(e,i))),indentation:2}).append(`}`,j)},s=e=>new A().append(a.get(e.source),` -> `,a.get(e.target)).append(t=>e.label&&t.append(`: `,JSON.stringify(e.label)));return k(new A().append(`direction: `,Te(t),j,j).append(M(r.filter(e=>n(e.parent)),e=>o(e),{appendNewLineIfNotEmpty:!0})).appendIf(i.length>0,j,M(i,e=>s(e),{appendNewLineIfNotEmpty:!0})))}const I=`data:page/id,likec4-`,L=1e4,R=`#dae8fc`,Oe=`#2563eb`,z=`#1e40af`,ke=`diagrams.drawio`,Ae=`#74c0fc`;function B(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&apos;`)}function je(e){let t=e.split(/\r?\n/),n={},r={},i={},a={},o=!1,s=0;for(;s<t.length;){let e=t[s];if(e==null){s+=1;continue}if(e.trim()===`// <likec4.layout.drawio>`){o=!0,s+=1;let e=[];for(;s<t.length&&t[s]?.trim()!==`// </likec4.layout.drawio>`;){let n=t[s]?.trim();n?.startsWith(`// `)&&e.push(n.slice(3)),s+=1}if(e.length>0)try{let t=e.join(`
5
- `);n=JSON.parse(t)}catch{}s+=1;continue}if(e.trim()===`// <likec4.strokeColor.vertices>`){for(o=!0,s+=1;s<t.length&&t[s]?.trim()!==`// </likec4.strokeColor.vertices>`;){let e=t[s]?.trim();if(e?.startsWith(`// `)&&e.includes(`=`)){let t=e.slice(3).trim(),n=t.indexOf(`=`);if(n>0){let e=t.slice(0,n).trim(),i=t.slice(n+1).trim();e&&i&&(r[e]=i)}}s+=1}s+=1;continue}if(e.trim()===`// <likec4.strokeWidth.vertices>`){for(o=!0,s+=1;s<t.length&&t[s]?.trim()!==`// </likec4.strokeWidth.vertices>`;){let e=t[s]?.trim();if(e?.startsWith(`// `)&&e.includes(`=`)){let t=e.slice(3).trim(),n=t.indexOf(`=`);if(n>0){let e=t.slice(0,n).trim(),r=t.slice(n+1).trim();e&&r!==``&&(i[e]=r)}}s+=1}s+=1;continue}if(e.trim()===`// <likec4.edge.waypoints>`){for(o=!0,s+=1;s<t.length&&t[s]?.trim()!==`// </likec4.edge.waypoints>`;){let e=t[s]?.trim();if(e?.startsWith(`// `)){let t=e.slice(3).trim(),n=t.indexOf(` `);if(n>0){let e=t.slice(0,n).trim(),r=t.slice(n+1).trim();if(e&&r)try{let t=JSON.parse(r);Array.isArray(t)&&(a[e]=t)}catch{}}}s+=1}s+=1;continue}s+=1}return o?{layoutByView:n,strokeColorByFqn:r,strokeWidthByFqn:i,edgeWaypoints:a}:null}function Me(e){let t=encodeURIComponent(e),n=new TextEncoder().encode(t);return Ne(ie.deflateRaw(n))}function Ne(e){if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}const V={getNotes(e){return e.notes},getSummary(e){return e.summary},getTags(e){return e.tags},getNavigateTo(e){return e.navigateTo},getIcon(e){return e.icon},getLinks(e){return e.links},getNotation(e){return e.notation},getCustomData(e){return e.customData},getChildren(e){return e.children}},H={getKind(e){return e.kind},getNotation(e){return e.notation},getLinks(e){return e.links},getMetadata(e){return e.metadata},getCustomData(e){return e.customData}};function Pe(e){return e.$styles??P.DEFAULT}function U(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`)}function W(e){if(e==null)return``;let t=typeof e;if(t===`string`){let t=e;return t.trim()===``?``:t}return t===`number`||t===`boolean`?String(e):``}function Fe(e,t){return e&&t!==`none`||t===`dashed`?`dashed=1;`:``}function Ie(e,t){return e===`none`?`0`:t||e?`1`:``}function Le(e,t){return{fill:e?.fill??R,stroke:t,font:e?.font??t}}function Re(e,t,n){return t&&t in e.theme.colors?t:n}function ze(e,t,n){let r=Pe(e),i=Re(r,t??n,n);try{return r.colors(i)}catch{return P.DEFAULT.colors(n)}}function Be(e){let t=`shape=rectangle;rounded=1;arcSize=12;`;switch(e){case`person`:return`shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;`;case`rectangle`:case`browser`:case`mobile`:case`bucket`:return t;case`cylinder`:case`queue`:case`storage`:return`shape=cylinder3;whiteSpace=wrap;boundedLbl=1;backgroundOutline=1;size=15;`;case`document`:return`shape=document;whiteSpace=wrap;html=1;boundedLbl=1;`;case`component`:return`shape=component;`;default:return t}}function Ve(e,t){let n=ze(e,t,`primary`).elements;return{fill:String(n.fill??R),stroke:String(n.stroke??Oe),font:String(n.hiContrast??n.stroke??z)}}function He(e,t){let n=ze(e,t??`gray`,`gray`);return String(n.relationships?.line??z)}function Ue(e,t){let n=ze(e,t??`gray`,`gray`).relationships;return{font:String(n?.label??n?.line??z),background:String(n?.labelBg??`#ffffff`)}}function We(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t.x+t.width/2,a=t.y+t.height/2,o=i-n,s=a-r,c=Math.abs(o)>=Math.abs(s);return{exitX:c?o>=0?1:0:.5,exitY:c?.5:s>=0?1:0,entryX:c?o>=0?0:1:.5,entryY:c?.5:s>=0?0:1}}function Ge(e){if(Array.isArray(e)&&e.length>=2&&typeof e[0]==`number`&&typeof e[1]==`number`)return[[e[0],e[1]]];let t=e;return typeof t.x==`number`&&typeof t.y==`number`?[[t.x,t.y]]:[]}function Ke(e,t,n,r,i,a){return n?``:t===``?`<div style="box-sizing:border-box;width:100%;min-height:100%;display:flex;align-items:center;justify-content:center;text-align:center;color:${r};font-family:${i};"><b style="font-size:${a}px;">${U(e)}</b></div>`:`<div style="box-sizing:border-box;width:100%;min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:${r};font-family:${i};"><b style="font-size:${a}px;">${U(e)}</b><br/><span style="font-weight:normal;font-size:${a}px;">${U(t)}</span></div>`}function G(e,t,n){n!=null&&n!==``&&e.push(`${t}=${encodeURIComponent(n)}`)}function qe(e,t,n){n!=null&&e.push(`${t}=${n}`)}function Je(e){return e===``?``:`link=${encodeURIComponent(`${I}${e}`)};`}function K(e){let t=e==null?null:de(e);return t!=null&&!l(t)?t.trim():``}function Ye(e){return!Array.isArray(e)||e.length===0?``:encodeURIComponent(JSON.stringify(e.map(e=>({url:e.url,title:e.title}))))}function Xe(e){return typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length===0?``:encodeURIComponent(JSON.stringify(e))}const Ze=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;function Qe(e){let t=[];return G(t,`likec4Description`,e.desc),G(t,`likec4Technology`,e.tech),G(t,`likec4Notes`,e.notes),G(t,`likec4Tags`,e.tagList),G(t,`likec4NavigateTo`,e.navTo),G(t,`likec4Icon`,e.iconName),G(t,`likec4Summary`,e.summaryStr),e.linksJson!==``&&t.push(`likec4Links=${e.linksJson}`),G(t,`likec4Border`,e.borderVal),qe(t,`likec4Opacity`,e.containerOpacityNum),G(t,`likec4StrokeWidth`,e.strokeWidth),e.colorNameForRoundtrip!==``&&t.push(`likec4ColorName=${e.colorNameForRoundtrip}`),G(t,`likec4Size`,e.nodeStyle?.size),G(t,`likec4Padding`,e.nodeStyle?.padding),G(t,`likec4TextSize`,e.nodeStyle?.textSize),G(t,`likec4IconPosition`,e.nodeStyle?.iconPosition),e.strokeHex&&Ze.test(e.strokeHex)&&G(t,`likec4StrokeColor`,e.strokeHex),G(t,`likec4Notation`,e.nodeNotation??void 0),t.length>0?t.join(`;`)+`;`:``}function $e(e){return!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length===0?``:`
5
+ `);n=JSON.parse(t)}catch{}s+=1;continue}if(e.trim()===`// <likec4.strokeColor.vertices>`){for(o=!0,s+=1;s<t.length&&t[s]?.trim()!==`// </likec4.strokeColor.vertices>`;){let e=t[s]?.trim();if(e?.startsWith(`// `)&&e.includes(`=`)){let t=e.slice(3).trim(),n=t.indexOf(`=`);if(n>0){let e=t.slice(0,n).trim(),i=t.slice(n+1).trim();e&&i&&(r[e]=i)}}s+=1}s+=1;continue}if(e.trim()===`// <likec4.strokeWidth.vertices>`){for(o=!0,s+=1;s<t.length&&t[s]?.trim()!==`// </likec4.strokeWidth.vertices>`;){let e=t[s]?.trim();if(e?.startsWith(`// `)&&e.includes(`=`)){let t=e.slice(3).trim(),n=t.indexOf(`=`);if(n>0){let e=t.slice(0,n).trim(),r=t.slice(n+1).trim();e&&r!==``&&(i[e]=r)}}s+=1}s+=1;continue}if(e.trim()===`// <likec4.edge.waypoints>`){for(o=!0,s+=1;s<t.length&&t[s]?.trim()!==`// </likec4.edge.waypoints>`;){let e=t[s]?.trim();if(e?.startsWith(`// `)){let t=e.slice(3).trim(),n=t.indexOf(` `);if(n>0){let e=t.slice(0,n).trim(),r=t.slice(n+1).trim();if(e&&r)try{let t=JSON.parse(r);Array.isArray(t)&&(a[e]=t)}catch{}}}s+=1}s+=1;continue}s+=1}return o?{layoutByView:n,strokeColorByFqn:r,strokeWidthByFqn:i,edgeWaypoints:a}:null}function Me(e){let t=encodeURIComponent(e),n=new TextEncoder().encode(t);return Ne(ie.deflateRaw(n))}function Ne(e){if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}const V={getNotes(e){return e.notes},getSummary(e){return e.summary},getTags(e){return e.tags},getNavigateTo(e){return e.navigateTo},getIcon(e){return e.icon},getLinks(e){return e.links},getNotation(e){return e.notation},getCustomData(e){return e.customData},getChildren(e){return e.children}},H={getKind(e){return e.kind},getNotation(e){return e.notation},getLinks(e){return e.links},getMetadata(e){return e.metadata},getCustomData(e){return e.customData}};function Pe(e){return e.$styles??P.DEFAULT}function U(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`)}function W(e){if(e==null)return``;let t=typeof e;if(t===`string`){let t=e;return t.trim()===``?``:t}return t===`number`||t===`boolean`?String(e):``}function Fe(e,t){return e&&t!==`none`||t===`dashed`?`dashed=1;`:``}function Ie(e,t){return e===`none`?`0`:t||e?`1`:``}function Le(e,t){return{fill:e?.fill??R,stroke:t,font:e?.font??t}}function Re(e,t,n){return t&&t in e.theme.colors?t:n}function ze(e,t,n){let r=Pe(e),i=Re(r,t??n,n);try{return r.colors(i)}catch{return P.DEFAULT.colors(n)}}function Be(e){let t=`shape=rectangle;rounded=1;arcSize=12;`;switch(e){case`person`:return`shape=actor;`;case`rectangle`:case`browser`:case`mobile`:case`bucket`:return t;case`cylinder`:case`queue`:case`storage`:return`shape=cylinder3;whiteSpace=wrap;boundedLbl=1;backgroundOutline=1;size=15;`;case`document`:return`shape=document;whiteSpace=wrap;html=1;boundedLbl=1;`;case`component`:return`shape=component;`;default:return t}}function Ve(e,t){let n=ze(e,t,`primary`).elements;return{fill:String(n.fill??R),stroke:String(n.stroke??Oe),font:String(n.hiContrast??n.stroke??z)}}function He(e,t){let n=ze(e,t??`gray`,`gray`);return String(n.relationships?.line??z)}function Ue(e,t){let n=ze(e,t??`gray`,`gray`).relationships;return{font:String(n?.label??n?.line??z),background:String(n?.labelBg??`#ffffff`)}}function We(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=t.x+t.width/2,a=t.y+t.height/2,o=i-n,s=a-r,c=Math.abs(o)>=Math.abs(s);return{exitX:c?o>=0?1:0:.5,exitY:c?.5:s>=0?1:0,entryX:c?o>=0?0:1:.5,entryY:c?.5:s>=0?0:1}}function Ge(e){if(Array.isArray(e)&&e.length>=2&&typeof e[0]==`number`&&typeof e[1]==`number`)return[[e[0],e[1]]];let t=e;return typeof t.x==`number`&&typeof t.y==`number`?[[t.x,t.y]]:[]}function Ke(e,t,n,r,i,a){return n?``:t===``?`<div style="box-sizing:border-box;width:100%;min-height:100%;display:flex;align-items:center;justify-content:center;text-align:center;color:${r};font-family:${i};"><b style="font-size:${a}px;">${U(e)}</b></div>`:`<div style="box-sizing:border-box;width:100%;min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:${r};font-family:${i};"><b style="font-size:${a}px;">${U(e)}</b><br/><span style="font-weight:normal;font-size:${a}px;">${U(t)}</span></div>`}function G(e,t,n){n!=null&&n!==``&&e.push(`${t}=${encodeURIComponent(n)}`)}function qe(e,t,n){n!=null&&e.push(`${t}=${n}`)}function Je(e){return e===``?``:`link=${encodeURIComponent(`${I}${e}`)};`}function K(e){let t=e==null?null:de(e);return t!=null&&!l(t)?t.trim():``}function Ye(e){return!Array.isArray(e)||e.length===0?``:encodeURIComponent(JSON.stringify(e.map(e=>({url:e.url,title:e.title}))))}function Xe(e){return typeof e!=`object`||!e||Array.isArray(e)||Object.keys(e).length===0?``:encodeURIComponent(JSON.stringify(e))}const Ze=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/;function Qe(e){let t=[];return G(t,`likec4Description`,e.desc),G(t,`likec4Technology`,e.tech),G(t,`likec4Notes`,e.notes),G(t,`likec4Tags`,e.tagList),G(t,`likec4NavigateTo`,e.navTo),G(t,`likec4Icon`,e.iconName),G(t,`likec4Summary`,e.summaryStr),e.linksJson!==``&&t.push(`likec4Links=${e.linksJson}`),G(t,`likec4Border`,e.borderVal),qe(t,`likec4Opacity`,e.containerOpacityNum),G(t,`likec4StrokeWidth`,e.strokeWidth),e.colorNameForRoundtrip!==``&&t.push(`likec4ColorName=${e.colorNameForRoundtrip}`),G(t,`likec4Size`,e.nodeStyle?.size),G(t,`likec4Padding`,e.nodeStyle?.padding),G(t,`likec4TextSize`,e.nodeStyle?.textSize),G(t,`likec4IconPosition`,e.nodeStyle?.iconPosition),e.strokeHex&&Ze.test(e.strokeHex)&&G(t,`likec4StrokeColor`,e.strokeHex),G(t,`likec4Notation`,e.nodeNotation??void 0),t.length>0?t.join(`;`)+`;`:``}function $e(e){return!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).length===0?``:`
6
6
  <mxUserObject>`+Object.entries(e).map(([e,t])=>{let n=typeof t==`string`?t:t==null?``:String(t);return`<data key="${B(e)}">${B(n)}</data>`}).join(``)+`</mxUserObject>`}function et(e){let t=[];return G(t,`likec4Description`,e.edgeDesc),G(t,`likec4Technology`,e.edgeTech),G(t,`likec4Notes`,e.edgeNotes),G(t,`likec4NavigateTo`,e.edgeNavTo),G(t,`likec4RelationshipKind`,e.edgeKind??void 0),G(t,`likec4Notation`,e.edgeNotation??void 0),e.edgeLinksJson!==``&&t.push(`likec4Links=${e.edgeLinksJson}`),e.edgeMetadataJson!==``&&t.push(`likec4Metadata=${e.edgeMetadataJson}`),t.length>0?t.join(`;`)+`;`:``}function tt(e){return e.label?B(e.label):``}function nt(e,t){let n=t?.[`${e.source}|${e.target}|${e.id}`]??t?.[`${e.source}|${e.target}`],r=Array.isArray(n)?n.flatMap(Ge):[];return r.length>0?`<mxGeometry relative="1" as="geometry">${`<Array as="points">`+r.map(([e,t])=>`<mxPoint x="${Math.round(e)}" y="${Math.round(t)}"/>`).join(``)+`</Array>`}</mxGeometry>`:`<mxGeometry relative="1" as="geometry" />`}function rt(e,t,n,r){let{bboxes:i,fontFamily:a}=t,o=i.get(e.source),s=i.get(e.target),c=o&&s?We(o,s):{exitX:1,exitY:.5,entryX:0,entryY:.5},l=`exitX=${c.exitX};exitY=${c.exitY};entryX=${c.entryX};entryY=${c.entryY};`,u=He(n,e.color),d=e.line===`dashed`?`dashed=1;`:e.line===`dotted`?`dashed=1;dashPattern=1 1;`:``,f=pt(e.head),p=e.tail==null||e.tail===`none`?`none`:pt(e.tail),m=et({edgeDesc:K(e.description),edgeTech:K(e.technology),edgeNotes:K(e.notes),edgeNavTo:W(e.navigateTo),edgeKind:H.getKind(e),edgeNotation:H.getNotation(e),edgeLinksJson:Ye(H.getLinks(e)),edgeMetadataJson:Xe(H.getMetadata(e))}),h=Ue(n,e.color);return`endArrow=${f};startArrow=${p};html=1;rounded=0;${l}strokeColor=${u};strokeWidth=2;${d}${r===``?``:`fontColor=${h.font};fontSize=12;align=center;verticalAlign=middle;labelBackgroundColor=none;fontFamily=${encodeURIComponent(a)};`}${m}`}function it(e,t,n,r,i,a){let{defaultParentId:o}=t,s=i(e.source),c=i(e.target),l=tt(e),u=nt(e,n?.edgeWaypoints);return`<mxCell id="${a}" value="${l}" style="${rt(e,t,r,l)}" edge="1" parent="${o}" source="${s}" target="${c}">
7
7
  ${u}${$e(H.getCustomData(e))}
8
8
  </mxCell>`}function at(e,t,n){let{bboxes:r,defaultParentId:i,nodeIdsInView:a}=t,o=n(e.id),s=r.get(e.id),{width:c,height:l}=s,u=e.parent!=null&&a.has(e.parent)?n(e.parent):i,d=e.parent==null?void 0:r.get(e.parent);return{id:o,parentId:u,x:d==null?s.x+t.offsetX:s.x-d.x,y:d==null?s.y+t.offsetY:s.y-d.y,width:c,height:l}}function ot(e,t,n,r){let{containerNodeIds:i,effectiveStyles:a,fontFamily:o,containerTitleFontSizePx:s,containerTitleColor:c}=t,l=n?.strokeColorByNodeId,u=n?.strokeWidthByNodeId,d=i.has(e.id),f=e.title,p=K(e.description),m=K(e.technology),h=K(V.getNotes(e)),g=V.getTags(e),_=Array.isArray(g)&&g.length>0?g.join(`,`):``,v=W(V.getNavigateTo(e)),y=W(V.getIcon(e)),b=d?`shape=rectangle;rounded=0;container=1;collapsible=0;startSize=0;`:Be(e.shape),x=l?.[e.id],ee=u?.[e.id],S=x?Le(Ve(r,e.color),x):Ve(r,e.color),te=S?.fill??R,ne=S?.stroke??Oe,re=S?.font??S?.stroke??z,C=`fillColor=${te};strokeColor=${ne};fontColor=${re};`,w=e.style,T=a.fontSize(w?.textSize),E=B(Ke(f,p,d,re,o,T)),D=w?.border,O=ee??Ie(D,d),k=O===``?``:`strokeWidth=${O};`,A=Fe(d,D),j=d===!0?w?.opacity??15:void 0,M=j!=null&&d===!0?`fillOpacity=${Math.min(100,Math.max(0,j))};`:``,N=Qe({desc:p,tech:m,notes:h,tagList:_,navTo:v,iconName:y,summaryStr:K(V.getSummary(e)),linksJson:Ye(V.getLinks(e)),borderVal:D,containerOpacityNum:j,strokeWidth:O,colorNameForRoundtrip:e.color?encodeURIComponent(String(e.color)):``,nodeStyle:w,strokeHex:ne,nodeNotation:V.getNotation(e)}),ie=$e(V.getCustomData(e)),P=Je(v);return{value:E,styleStr:`${d?`align=left;verticalAlign=top;overflow=fill;whiteSpace=wrap;html=1;`:`align=center;verticalAlign=middle;verticalLabelPosition=middle;labelPosition=center;fontSize=${T};fontStyle=1;spacingTop=4;spacingLeft=2;spacingRight=2;spacingBottom=2;overflow=fill;whiteSpace=wrap;html=1;fontFamily=${encodeURIComponent(o)};`}${b}${C}${k}${A}${M}${P}${N}`,userObjectXml:ie,navTo:v,isContainer:d,title:f,fontFamily:o,containerTitleFontSizePx:s,containerTitleColor:c}}function st(e,t,n,r,i,a){let o=at(e,t,i),s=ot(e,t,n,r);return{...o,value:s.value,styleStr:s.styleStr,userObjectXml:s.userObjectXml,navTo:s.navTo,isContainer:s.isContainer,fontFamily:s.fontFamily,...s.isContainer&&{title:s.title??``,titleCellId:String(a),containerTitleFontSizePx:s.containerTitleFontSizePx,containerTitleColor:s.containerTitleColor}}}function ct(e){let t=`<mxGeometry height="${Math.round(e.height)}" width="${Math.round(e.width)}" x="${Math.round(e.x)}" y="${Math.round(e.y)}" as="geometry" />`,n=e.userObjectXml===``?`\n ${t}`:`${e.userObjectXml}\n ${t}`,r=e.isContainer&&e.title!=null?B(e.title):e.value,i=e.navTo===``?`<mxCell id="${e.id}" value="${e.value}" style="${e.styleStr}" vertex="1" parent="${e.parentId}">\n ${n}\n</mxCell>`:`<UserObject label="${r}" link="${I}${B(e.navTo)}" id="${e.id}">\n <mxCell parent="${e.parentId}" style="${e.styleStr}" value="${e.value}" vertex="1">\n ${n}\n</mxCell>\n</UserObject>`;return e.isContainer?{vertexXml:i,titleCellXml:lt(e.title??``,e.titleCellId??e.id,e.navTo,e.id,e.fontFamily,e.containerTitleFontSizePx??12,e.containerTitleColor??Ae),isContainer:!0}:{vertexXml:i,isContainer:!1}}function lt(e,t,n,r,i,a,o){let s=B(e),c=Math.max(60,Math.min(260,e.length*8)),l=Je(n),u=`shape=text;html=1;fillColor=none;strokeColor=none;align=left;verticalAlign=top;fontSize=${a};fontStyle=1;fontColor=${o};fontFamily=${encodeURIComponent(i)};${l}`;if(n===``)return`<mxCell id="${t}" value="${s}" style="${u}" vertex="1" parent="${r}">\n <mxGeometry x="8" y="8" width="${c}" height="18" as="geometry" />\n</mxCell>`;let d=`<mxCell parent="${r}" style="${u}" value="${s}" vertex="1">\n <mxGeometry x="8" y="8" width="${c}" height="18" as="geometry" />\n</mxCell>`;return`<UserObject label="${B(e)}" link="${I}${B(n)}" id="${t}">\n ${d}\n</UserObject>`}function ut(e){return typeof e.title==`string`?e.title:null}function dt(e){let t=e.description;return typeof t==`object`&&t&&`txt`in t?String(t.txt):typeof t==`object`&&t&&`md`in t?String(t.md):typeof t==`string`?t:``}function ft(e){let t=ut(e),n=dt(e),r=n.trim()===``?``:encodeURIComponent(n.trim()),i=e.notation,a=typeof i==`string`&&i!==``?i:void 0,o=a==null?``:encodeURIComponent(a);return[`rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=none;`,`likec4ViewTitle=${encodeURIComponent(t??e.id)};`,r===``?``:`likec4ViewDescription=${r};`,o===``?``:`likec4ViewNotation=${o};`].join(``)}function pt(e){switch(e){case`none`:return`none`;case`open`:case`onormal`:case`vee`:return`open`;case`diamond`:case`odiamond`:return`diamond`;case`dot`:case`odot`:return`oval`;case`crow`:return`block`;default:return`block`}}const q={x:0,y:0,width:120,height:60};function mt(e){return e.x===q.x&&e.y===q.y&&e.width===q.width&&e.height===q.height}function ht(e,t,n){let r=e=>`${e.x},${e.y},${e.width},${e.height}`,i=t.filter(e=>!n.has(e.id)),a=new Map;for(let t of i){let n=e.get(t.id);if(!n)continue;let i=r(n),o=a.get(i)??[];o.push(t),a.set(i,o)}for(let t of a.values()){if(t.length<=1)continue;let n=t[0],r=n?e.get(n.id):void 0;r&&mt(r)&&t.forEach((t,n)=>{e.set(t.id,{...r,x:r.x,y:r.y+n*(r.height+24)})})}}function gt(e,t,n,r,i,a){let o=[...n].filter(e=>t.has(e.id)).sort((e,t)=>(t.level??0)-(e.level??0));for(let t of o){let n=(V.getChildren(t)??[]).filter(e=>r.has(e));if(n.length===0||!mt(e.get(t.id)))continue;let o=1/0,s=1/0,c=-1/0,l=-1/0;for(let t of n){let n=e.get(t);n&&(o=Math.min(o,n.x),s=Math.min(s,n.y),c=Math.max(c,n.x+n.width),l=Math.max(l,n.y+n.height))}o!==1/0&&e.set(t.id,{x:o-i,y:s-a,width:c-o+2*i,height:l-s+2*a})}}function _t(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e.values())t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height);t===1/0&&(t=0),n===1/0&&(n=0),r===-1/0&&(r=t+800),i===-1/0&&(i=n+600);let a=t+(r-t)/2,o=n+(i-n)/2;return{offsetX:800/2-a,offsetY:600/2-o,canvasWidth:800,canvasHeight:600}}function vt(e,t){let r=e.$view,{nodes:i}=r,a=t?.layoutOverride,o=[...i].sort((e,t)=>n(e.parent)&&n(t.parent)?0:n(e.parent)?-1:n(t.parent)?1:e.parent===t.parent?0:e.id.startsWith(t.id+`.`)?1:t.id.startsWith(e.id+`.`)?-1:0),s=e=>{let t=a?.[e.id];if(t)return t;let n=e;return{x:typeof n.x==`number`?n.x:Array.isArray(n.position)?n.position[0]:0,y:typeof n.y==`number`?n.y:Array.isArray(n.position)?n.position[1]:0,width:typeof n.width==`number`?n.width:n.size?.width??120,height:typeof n.height==`number`?n.height:n.size?.height??60}},c=new Map;for(let e of o)c.set(e.id,s(e));let l=new Set(i.map(e=>e.id)),u=new Set(i.filter(e=>{let t=V.getChildren(e);return Array.isArray(t)&&t.some(e=>l.has(e))}).map(e=>e.id));ht(c,o,u);let d=Pe(e),f=d.theme.spacing.xl;gt(c,u,o,l,f,d.theme.spacing.xl+d.theme.spacing.md);let{offsetX:p,offsetY:m,canvasWidth:h,canvasHeight:g}=_t(c);return{view:r,bboxes:c,containerNodeIds:u,sortedNodes:o,offsetX:p,offsetY:m,canvasWidth:h,canvasHeight:g,defaultParentId:`1`,rootId:`0`,effectiveStyles:d,fontFamily:`'IBM Plex Sans Variable',ui-sans-serif,system-ui,sans-serif`,containerTitleFontSizePx:Math.round(d.theme.textSizes.xs),containerTitleColor:Ae,nodeIdsInView:l}}function yt(e,t){let n=e.$view,{edges:r}=n,i=t?.compressed!==!1,a=vt(e,t),{sortedNodes:o,defaultParentId:s,rootId:c,canvasWidth:l,canvasHeight:u}=a,d=new Map,f=2,p=e=>{let t=d.get(e);if(!t){if(f>=L)throw Error(`DrawIO cell ID range exhausted`);t=String(f++),d.set(e,t)}return t},m=[],h=[],g=[],_=L;for(let n of o){let r=ct(st(n,a,t,e,p,_));r.isContainer?(m.push(r.vertexXml),r.titleCellXml&&m.push(r.titleCellXml),_++):h.push(r.vertexXml)}for(let n of r){if(f>=L)throw Error(`DrawIO cell ID range exhausted`);let r=String(f++);g.push(it(n,a,t,e,p,r))}let v=[`<mxCell id="${s}" value="" style="${ft(n)}" vertex="1" parent="${c}">