@softspark/jira-mcp 1.14.2 → 1.14.3

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/README.md CHANGED
@@ -4,16 +4,17 @@
4
4
 
5
5
  [![CI](https://github.com/softspark/jira-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/softspark/jira-mcp/actions/workflows/ci.yml)
6
6
  [![npm](https://img.shields.io/npm/v/@softspark/jira-mcp)](https://www.npmjs.com/package/@softspark/jira-mcp)
7
- [![version](https://img.shields.io/badge/version-1.14.2-blue)](CHANGELOG.md)
7
+ [![version](https://img.shields.io/badge/version-1.14.3-blue)](CHANGELOG.md)
8
8
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
9
9
 
10
10
  ---
11
11
 
12
- ## What's New in v1.14.2
12
+ ## What's New in v1.14.3
13
13
 
14
14
  - Polish versions of all eight built-in comment templates ship with the package. Until now a templated comment was English on every project, including one configured for another language.
15
15
  - `jira-mcp template list-locales` shows which languages are available, and `jira-mcp template install-locale pl` installs them. Add `--keep-english` to keep the originals reachable as `<id>-en`.
16
16
  - Fixed in 1.14.1: `jira-mcp --help` now lists both new commands. 1.14.2 adds the test that would have caught it, on both binaries.
17
+ - 1.14.3 changes nothing in the package itself; it carries knowledge base work only.
17
18
  - Released together with `@softspark/confluence-mcp` under one version. See the [changelog](../../CHANGELOG.md).
18
19
 
19
20
  ## Table of Contents
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import {readFile,mkdir,writeFile,unlink,readdir,rm as rm$1,stat,access,lstat,rename,open}from'fs/promises';import {homedir}from'os';import {join,dirname,resolve}from'path';import {readdirSync,existsSync,readFileSync,constants}from'fs';import {pathToFileURL,fileURLToPath}from'url';import Lh from'process';import {Command}from'commander';/*! jira-mcp | Apache-2.0 | Copyright 2024-2026 Lukasz Krzemien (biuro@softspark.eu) | https://github.com/softspark/jira-mcp */
3
- var vP=Object.create;var am=Object.defineProperty;var _P=Object.getOwnPropertyDescriptor;var kP=Object.getOwnPropertyNames;var $P=Object.getPrototypeOf,bP=Object.prototype.hasOwnProperty;var f=(t,e)=>()=>(t&&(e=t(t=0)),e);var j=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jt=(t,e)=>{for(var n in e)am(t,n,{get:e[n],enumerable:true});},xP=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of kP(e))!bP.call(t,r)&&r!==n&&am(t,r,{get:()=>e[r],enumerable:!(o=_P(e,r))||o.enumerable});return t};var gk=(t,e,n)=>(n=t!=null?vP($P(t)):{},xP(am(n,"default",{value:t,enumerable:true}),t));var ac,sm=f(()=>{ac="1.14.2";});function g(t,e,n){function o(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:false}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s));}}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=n?.Parent?new i:this;o(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?true:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function ze(t){return t&&Object.assign(ji,t),ji}var sc,Ei,Vt,Cr,ji,Vn=f(()=>{sc=Object.freeze({status:"aborted"});Ei=Symbol("zod_brand"),Vt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");}},Cr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError";}},ji={};});var b={};Jt(b,{BIGINT_FORMAT_RANGES:()=>hm,Class:()=>um,NUMBER_FORMAT_RANGES:()=>gm,aborted:()=>Dr,allowsEval:()=>pm,assert:()=>zP,assertEqual:()=>wP,assertIs:()=>TP,assertNever:()=>IP,assertNotEqual:()=>SP,assignProp:()=>Rr,base64ToUint8Array:()=>xk,base64urlToUint8Array:()=>ZP,cached:()=>Gn,captureStackTrace:()=>uc,cleanEnum:()=>UP,cleanRegex:()=>Ri,clone:()=>Me,cloneDef:()=>jP,createTransparentProxy:()=>DP,defineLazy:()=>X,esc:()=>cc,escapeRegex:()=>It,extend:()=>_k,finalizeIssue:()=>lt,floatSafeRemainder:()=>lm,getElementAtPath:()=>EP,getEnumValues:()=>Oi,getLengthableOrigin:()=>Ai,getParsedType:()=>NP,getSizableOrigin:()=>Di,hexToUint8Array:()=>LP,isObject:()=>ln,isPlainObject:()=>Nr,issue:()=>Kn,joinValues:()=>v,jsonStringifyReplacer:()=>Bn,merge:()=>AP,mergeDefs:()=>yr,normalizeParams:()=>S,nullish:()=>Or,numKeys:()=>RP,objectClone:()=>PP,omit:()=>vk,optionalKeys:()=>fm,parsedType:()=>w,partial:()=>$k,pick:()=>yk,prefixIssues:()=>$t,primitiveTypes:()=>mm,promiseAllObject:()=>CP,propertyKeyTypes:()=>Ni,randomString:()=>OP,required:()=>bk,safeExtend:()=>kk,shallowClone:()=>lc,slugify:()=>dm,stringifyPrimitive:()=>$,uint8ArrayToBase64:()=>wk,uint8ArrayToBase64url:()=>MP,uint8ArrayToHex:()=>FP,unwrapMessage:()=>Ci});function wP(t){return t}function SP(t){return t}function TP(t){}function IP(t){throw new Error("Unexpected value in exhaustive check")}function zP(t){}function Oi(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,r])=>e.indexOf(+o)===-1).map(([o,r])=>r)}function v(t,e="|"){return t.map(n=>$(n)).join(e)}function Bn(t,e){return typeof e=="bigint"?e.toString():e}function Gn(t){return {get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}}}}function Or(t){return t==null}function Ri(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function lm(t,e){let n=(t.toString().split(".")[1]||"").length,o=e.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let c=o.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]));}let i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}function X(t,e,n){let o;Object.defineProperty(t,e,{get(){if(o!==hk)return o===void 0&&(o=hk,o=n()),o},set(r){Object.defineProperty(t,e,{value:r});},configurable:true});}function PP(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Rr(t,e,n){Object.defineProperty(t,e,{value:n,writable:true,enumerable:true,configurable:true});}function yr(...t){let e={};for(let n of t){let o=Object.getOwnPropertyDescriptors(n);Object.assign(e,o);}return Object.defineProperties({},e)}function jP(t){return yr(t._zod.def)}function EP(t,e){return e?e.reduce((n,o)=>n?.[o],t):t}function CP(t){let e=Object.keys(t),n=e.map(o=>t[o]);return Promise.all(n).then(o=>{let r={};for(let i=0;i<e.length;i++)r[e[i]]=o[i];return r})}function OP(t=10){let e="abcdefghijklmnopqrstuvwxyz",n="";for(let o=0;o<t;o++)n+=e[Math.floor(Math.random()*e.length)];return n}function cc(t){return JSON.stringify(t)}function dm(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ln(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Nr(t){if(ln(t)===false)return false;let e=t.constructor;if(e===void 0||typeof e!="function")return true;let n=e.prototype;return !(ln(n)===false||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===false)}function lc(t){return Nr(t)?{...t}:Array.isArray(t)?[...t]:t}function RP(t){let e=0;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function It(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(t,e,n){let o=new t._zod.constr(e??t._zod.def);return (!e||n?.parent)&&(o._zod.parent=t),o}function S(t){let e=t;if(!e)return {};if(typeof e=="string")return {error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message;}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function DP(t){let e;return new Proxy({},{get(n,o,r){return e??(e=t()),Reflect.get(e,o,r)},set(n,o,r,i){return e??(e=t()),Reflect.set(e,o,r,i)},has(n,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(n,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(n,o,r){return e??(e=t()),Reflect.defineProperty(e,o,r)}})}function $(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function fm(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function yk(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=yr(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=n.shape[s]);}return Rr(this,"shape",a),a},checks:[]});return Me(t,i)}function vk(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=yr(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s];}return Rr(this,"shape",a),a},checks:[]});return Me(t,i)}function _k(t,e){if(!Nr(e))throw new Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=yr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Rr(this,"shape",i),i}});return Me(t,r)}function kk(t,e){if(!Nr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let n=yr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Rr(this,"shape",o),o}});return Me(t,n)}function AP(t,e){let n=yr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return Rr(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:[]});return Me(t,n)}function $k(t,e,n){let r=e._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=yr(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(n)for(let u in n){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u]);}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return Rr(this,"shape",c),c},checks:[]});return Me(e,a)}function bk(t,e,n){let o=yr(e._zod.def,{get shape(){let r=e._zod.def.shape,i={...r};if(n)for(let a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new t({type:"nonoptional",innerType:r[a]}));}else for(let a in r)i[a]=new t({type:"nonoptional",innerType:r[a]});return Rr(this,"shape",i),i}});return Me(e,o)}function Dr(t,e=0){if(t.aborted===true)return true;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==true)return true;return false}function $t(t,e){return e.map(n=>{var o;return (o=n).path??(o.path=[]),n.path.unshift(t),n})}function Ci(t){return typeof t=="string"?t:t?.message}function lt(t,e,n){let o={...t,path:t.path??[]};if(!t.message){let r=Ci(t.inst?._zod.def?.error?.(t))??Ci(e?.error?.(t))??Ci(n.customError?.(t))??Ci(n.localeError?.(t))??"Invalid input";o.message=r;}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function Di(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Ai(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function w(t){let e=typeof t;switch(e){case "number":return Number.isNaN(t)?"nan":"number";case "object":{if(t===null)return "null";if(Array.isArray(t))return "array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function Kn(...t){let[e,n,o]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:o}:{...e}}function UP(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function xk(t){let e=atob(t),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n}function wk(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function ZP(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-e.length%4)%4);return xk(e+n)}function MP(t){return wk(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function LP(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)n[o/2]=Number.parseInt(e.slice(o,o+2),16);return n}function FP(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var hk,uc,pm,NP,Ni,mm,gm,hm,um,U=f(()=>{hk=Symbol("evaluating");uc="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};pm=Gn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return false;try{let t=Function;return new t(""),!0}catch{return false}});NP=t=>{let e=typeof t;switch(e){case "undefined":return "undefined";case "string":return "string";case "number":return Number.isNaN(t)?"nan":"number";case "boolean":return "boolean";case "function":return "function";case "bigint":return "bigint";case "symbol":return "symbol";case "object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Ni=new Set(["string","number","symbol"]),mm=new Set(["string","number","bigint","boolean","symbol","undefined"]);gm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},hm={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};um=class{constructor(...e){}};});function Wn(t,e=n=>n.message){let n={},o=[];for(let r of t.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):o.push(e(r));return {formErrors:o,fieldErrors:n}}function Hn(t,e=n=>n.message){let n={_errors:[]},o=r=>{for(let i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(e(i));else {let a=n,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++;}}};return o(t),n}function dc(t,e=n=>n.message){let n={errors:[]},o=(r,i=[])=>{var a,s;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>o({issues:u},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else {let u=[...i,...c.path];if(u.length===0){n.errors.push(e(c));continue}let l=n,d=0;for(;d<u.length;){let p=u[d],m=d===u.length-1;typeof p=="string"?(l.properties??(l.properties={}),(a=l.properties)[p]??(a[p]={errors:[]}),l=l.properties[p]):(l.items??(l.items=[]),(s=l.items)[p]??(s[p]={errors:[]}),l=l.items[p]),m&&l.errors.push(e(c)),d++;}}};return o(t),n}function Tk(t){let e=[],n=t.map(o=>typeof o=="object"?o.key:o);for(let o of n)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function pc(t){let e=[],n=[...t.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${Tk(o.path)}`);return e.join(`
3
+ var vP=Object.create;var am=Object.defineProperty;var _P=Object.getOwnPropertyDescriptor;var kP=Object.getOwnPropertyNames;var $P=Object.getPrototypeOf,bP=Object.prototype.hasOwnProperty;var f=(t,e)=>()=>(t&&(e=t(t=0)),e);var j=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jt=(t,e)=>{for(var n in e)am(t,n,{get:e[n],enumerable:true});},xP=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of kP(e))!bP.call(t,r)&&r!==n&&am(t,r,{get:()=>e[r],enumerable:!(o=_P(e,r))||o.enumerable});return t};var gk=(t,e,n)=>(n=t!=null?vP($P(t)):{},xP(am(n,"default",{value:t,enumerable:true}),t));var ac,sm=f(()=>{ac="1.14.3";});function g(t,e,n){function o(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:false}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s));}}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=n?.Parent?new i:this;o(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?true:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function ze(t){return t&&Object.assign(ji,t),ji}var sc,Ei,Vt,Cr,ji,Vn=f(()=>{sc=Object.freeze({status:"aborted"});Ei=Symbol("zod_brand"),Vt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");}},Cr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError";}},ji={};});var b={};Jt(b,{BIGINT_FORMAT_RANGES:()=>hm,Class:()=>um,NUMBER_FORMAT_RANGES:()=>gm,aborted:()=>Dr,allowsEval:()=>pm,assert:()=>zP,assertEqual:()=>wP,assertIs:()=>TP,assertNever:()=>IP,assertNotEqual:()=>SP,assignProp:()=>Rr,base64ToUint8Array:()=>xk,base64urlToUint8Array:()=>ZP,cached:()=>Gn,captureStackTrace:()=>uc,cleanEnum:()=>UP,cleanRegex:()=>Ri,clone:()=>Me,cloneDef:()=>jP,createTransparentProxy:()=>DP,defineLazy:()=>X,esc:()=>cc,escapeRegex:()=>It,extend:()=>_k,finalizeIssue:()=>lt,floatSafeRemainder:()=>lm,getElementAtPath:()=>EP,getEnumValues:()=>Oi,getLengthableOrigin:()=>Ai,getParsedType:()=>NP,getSizableOrigin:()=>Di,hexToUint8Array:()=>LP,isObject:()=>ln,isPlainObject:()=>Nr,issue:()=>Kn,joinValues:()=>v,jsonStringifyReplacer:()=>Bn,merge:()=>AP,mergeDefs:()=>yr,normalizeParams:()=>S,nullish:()=>Or,numKeys:()=>RP,objectClone:()=>PP,omit:()=>vk,optionalKeys:()=>fm,parsedType:()=>w,partial:()=>$k,pick:()=>yk,prefixIssues:()=>$t,primitiveTypes:()=>mm,promiseAllObject:()=>CP,propertyKeyTypes:()=>Ni,randomString:()=>OP,required:()=>bk,safeExtend:()=>kk,shallowClone:()=>lc,slugify:()=>dm,stringifyPrimitive:()=>$,uint8ArrayToBase64:()=>wk,uint8ArrayToBase64url:()=>MP,uint8ArrayToHex:()=>FP,unwrapMessage:()=>Ci});function wP(t){return t}function SP(t){return t}function TP(t){}function IP(t){throw new Error("Unexpected value in exhaustive check")}function zP(t){}function Oi(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,r])=>e.indexOf(+o)===-1).map(([o,r])=>r)}function v(t,e="|"){return t.map(n=>$(n)).join(e)}function Bn(t,e){return typeof e=="bigint"?e.toString():e}function Gn(t){return {get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}}}}function Or(t){return t==null}function Ri(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function lm(t,e){let n=(t.toString().split(".")[1]||"").length,o=e.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let c=o.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]));}let i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}function X(t,e,n){let o;Object.defineProperty(t,e,{get(){if(o!==hk)return o===void 0&&(o=hk,o=n()),o},set(r){Object.defineProperty(t,e,{value:r});},configurable:true});}function PP(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Rr(t,e,n){Object.defineProperty(t,e,{value:n,writable:true,enumerable:true,configurable:true});}function yr(...t){let e={};for(let n of t){let o=Object.getOwnPropertyDescriptors(n);Object.assign(e,o);}return Object.defineProperties({},e)}function jP(t){return yr(t._zod.def)}function EP(t,e){return e?e.reduce((n,o)=>n?.[o],t):t}function CP(t){let e=Object.keys(t),n=e.map(o=>t[o]);return Promise.all(n).then(o=>{let r={};for(let i=0;i<e.length;i++)r[e[i]]=o[i];return r})}function OP(t=10){let e="abcdefghijklmnopqrstuvwxyz",n="";for(let o=0;o<t;o++)n+=e[Math.floor(Math.random()*e.length)];return n}function cc(t){return JSON.stringify(t)}function dm(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ln(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Nr(t){if(ln(t)===false)return false;let e=t.constructor;if(e===void 0||typeof e!="function")return true;let n=e.prototype;return !(ln(n)===false||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===false)}function lc(t){return Nr(t)?{...t}:Array.isArray(t)?[...t]:t}function RP(t){let e=0;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function It(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(t,e,n){let o=new t._zod.constr(e??t._zod.def);return (!e||n?.parent)&&(o._zod.parent=t),o}function S(t){let e=t;if(!e)return {};if(typeof e=="string")return {error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message;}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function DP(t){let e;return new Proxy({},{get(n,o,r){return e??(e=t()),Reflect.get(e,o,r)},set(n,o,r,i){return e??(e=t()),Reflect.set(e,o,r,i)},has(n,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(n,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(n,o,r){return e??(e=t()),Reflect.defineProperty(e,o,r)}})}function $(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function fm(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function yk(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=yr(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=n.shape[s]);}return Rr(this,"shape",a),a},checks:[]});return Me(t,i)}function vk(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=yr(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s];}return Rr(this,"shape",a),a},checks:[]});return Me(t,i)}function _k(t,e){if(!Nr(e))throw new Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=yr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Rr(this,"shape",i),i}});return Me(t,r)}function kk(t,e){if(!Nr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let n=yr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Rr(this,"shape",o),o}});return Me(t,n)}function AP(t,e){let n=yr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return Rr(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:[]});return Me(t,n)}function $k(t,e,n){let r=e._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=yr(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(n)for(let u in n){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u]);}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return Rr(this,"shape",c),c},checks:[]});return Me(e,a)}function bk(t,e,n){let o=yr(e._zod.def,{get shape(){let r=e._zod.def.shape,i={...r};if(n)for(let a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new t({type:"nonoptional",innerType:r[a]}));}else for(let a in r)i[a]=new t({type:"nonoptional",innerType:r[a]});return Rr(this,"shape",i),i}});return Me(e,o)}function Dr(t,e=0){if(t.aborted===true)return true;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==true)return true;return false}function $t(t,e){return e.map(n=>{var o;return (o=n).path??(o.path=[]),n.path.unshift(t),n})}function Ci(t){return typeof t=="string"?t:t?.message}function lt(t,e,n){let o={...t,path:t.path??[]};if(!t.message){let r=Ci(t.inst?._zod.def?.error?.(t))??Ci(e?.error?.(t))??Ci(n.customError?.(t))??Ci(n.localeError?.(t))??"Invalid input";o.message=r;}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function Di(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Ai(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function w(t){let e=typeof t;switch(e){case "number":return Number.isNaN(t)?"nan":"number";case "object":{if(t===null)return "null";if(Array.isArray(t))return "array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function Kn(...t){let[e,n,o]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:o}:{...e}}function UP(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function xk(t){let e=atob(t),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n}function wk(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function ZP(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-e.length%4)%4);return xk(e+n)}function MP(t){return wk(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function LP(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)n[o/2]=Number.parseInt(e.slice(o,o+2),16);return n}function FP(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var hk,uc,pm,NP,Ni,mm,gm,hm,um,U=f(()=>{hk=Symbol("evaluating");uc="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};pm=Gn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return false;try{let t=Function;return new t(""),!0}catch{return false}});NP=t=>{let e=typeof t;switch(e){case "undefined":return "undefined";case "string":return "string";case "number":return Number.isNaN(t)?"nan":"number";case "boolean":return "boolean";case "function":return "function";case "bigint":return "bigint";case "symbol":return "symbol";case "object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Ni=new Set(["string","number","symbol"]),mm=new Set(["string","number","bigint","boolean","symbol","undefined"]);gm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},hm={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};um=class{constructor(...e){}};});function Wn(t,e=n=>n.message){let n={},o=[];for(let r of t.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):o.push(e(r));return {formErrors:o,fieldErrors:n}}function Hn(t,e=n=>n.message){let n={_errors:[]},o=r=>{for(let i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(e(i));else {let a=n,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++;}}};return o(t),n}function dc(t,e=n=>n.message){let n={errors:[]},o=(r,i=[])=>{var a,s;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>o({issues:u},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else {let u=[...i,...c.path];if(u.length===0){n.errors.push(e(c));continue}let l=n,d=0;for(;d<u.length;){let p=u[d],m=d===u.length-1;typeof p=="string"?(l.properties??(l.properties={}),(a=l.properties)[p]??(a[p]={errors:[]}),l=l.properties[p]):(l.items??(l.items=[]),(s=l.items)[p]??(s[p]={errors:[]}),l=l.items[p]),m&&l.errors.push(e(c)),d++;}}};return o(t),n}function Tk(t){let e=[],n=t.map(o=>typeof o=="object"?o.key:o);for(let o of n)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function pc(t){let e=[],n=[...t.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${Tk(o.path)}`);return e.join(`
4
4
  `)}var Sk,Ui,dt,ym=f(()=>{Vn();U();Sk=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:false}),Object.defineProperty(t,"issues",{value:e,enumerable:false}),t.message=JSON.stringify(e,Bn,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:false});},Ui=g("$ZodError",Sk),dt=g("$ZodError",Sk,{Parent:Error});});var Xn,Yn,Qn,eo,to,dn,ro,no,mc,Ik,fc,zk,gc,Pk,hc,jk,yc,Ek,vc,Ck,_c,Ok,kc,Rk,vm=f(()=>{Vn();ym();U();Xn=t=>(e,n,o,r)=>{let i=o?Object.assign(o,{async:false}):{async:false},a=e._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Vt;if(a.issues.length){let s=new(r?.Err??t)(a.issues.map(c=>lt(c,i,ze())));throw uc(s,r?.callee),s}return a.value},Yn=Xn(dt),Qn=t=>async(e,n,o,r)=>{let i=o?Object.assign(o,{async:true}):{async:true},a=e._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(r?.Err??t)(a.issues.map(c=>lt(c,i,ze())));throw uc(s,r?.callee),s}return a.value},eo=Qn(dt),to=t=>(e,n,o)=>{let r=o?{...o,async:false}:{async:false},i=e._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new Vt;return i.issues.length?{success:false,error:new(t??Ui)(i.issues.map(a=>lt(a,r,ze())))}:{success:true,data:i.value}},dn=to(dt),ro=t=>async(e,n,o)=>{let r=o?Object.assign(o,{async:true}):{async:true},i=e._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:false,error:new t(i.issues.map(a=>lt(a,r,ze())))}:{success:true,data:i.value}},no=ro(dt),mc=t=>(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Xn(t)(e,n,r)},Ik=mc(dt),fc=t=>(e,n,o)=>Xn(t)(e,n,o),zk=fc(dt),gc=t=>async(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Qn(t)(e,n,r)},Pk=gc(dt),hc=t=>async(e,n,o)=>Qn(t)(e,n,o),jk=hc(dt),yc=t=>(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return to(t)(e,n,r)},Ek=yc(dt),vc=t=>(e,n,o)=>to(t)(e,n,o),Ck=vc(dt),_c=t=>async(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ro(t)(e,n,r)},Ok=_c(dt),kc=t=>async(e,n,o)=>ro(t)(e,n,o),Rk=kc(dt);});var pt={};Jt(pt,{base64:()=>Rm,base64url:()=>$c,bigint:()=>Mm,boolean:()=>Fm,browserEmail:()=>XP,cidrv4:()=>Cm,cidrv6:()=>Om,cuid:()=>_m,cuid2:()=>km,date:()=>Dm,datetime:()=>Um,domain:()=>ej,duration:()=>Sm,e164:()=>Nm,email:()=>Im,emoji:()=>zm,extendedDuration:()=>JP,guid:()=>Tm,hex:()=>tj,hostname:()=>QP,html5Email:()=>KP,idnEmail:()=>HP,integer:()=>Lm,ipv4:()=>Pm,ipv6:()=>jm,ksuid:()=>xm,lowercase:()=>Vm,mac:()=>Em,md5_base64:()=>nj,md5_base64url:()=>oj,md5_hex:()=>rj,nanoid:()=>wm,null:()=>qm,number:()=>bc,rfc5322Email:()=>WP,sha1_base64:()=>aj,sha1_base64url:()=>sj,sha1_hex:()=>ij,sha256_base64:()=>uj,sha256_base64url:()=>lj,sha256_hex:()=>cj,sha384_base64:()=>pj,sha384_base64url:()=>mj,sha384_hex:()=>dj,sha512_base64:()=>gj,sha512_base64url:()=>hj,sha512_hex:()=>fj,string:()=>Zm,time:()=>Am,ulid:()=>$m,undefined:()=>Jm,unicodeEmail:()=>Nk,uppercase:()=>Bm,uuid:()=>pn,uuid4:()=>VP,uuid6:()=>BP,uuid7:()=>GP,xid:()=>bm});function zm(){return new RegExp(YP,"u")}function Ak(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Am(t){return new RegExp(`^${Ak(t)}$`)}function Um(t){let e=Ak({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${e}(?:${n.join("|")})`;return new RegExp(`^${Dk}T(?:${o})$`)}function Zi(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function Mi(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var _m,km,$m,bm,xm,wm,Sm,JP,Tm,pn,VP,BP,GP,Im,KP,WP,Nk,HP,XP,YP,Pm,jm,Em,Cm,Om,Rm,$c,QP,ej,Nm,Dk,Dm,Zm,Mm,Lm,bc,Fm,qm,Jm,Vm,Bm,tj,rj,nj,oj,ij,aj,sj,cj,uj,lj,dj,pj,mj,fj,gj,hj,xc=f(()=>{U();_m=/^[cC][^\s-]{8,}$/,km=/^[0-9a-z]+$/,$m=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bm=/^[0-9a-vA-V]{20}$/,xm=/^[A-Za-z0-9]{27}$/,wm=/^[a-zA-Z0-9_-]{21}$/,Sm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,JP=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Tm=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,pn=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,VP=pn(4),BP=pn(6),GP=pn(7),Im=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,KP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,WP=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Nk=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,HP=Nk,XP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,YP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Pm=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jm=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Em=t=>{let e=It(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Cm=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Om=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$c=/^[A-Za-z0-9_-]*$/,QP=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,ej=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Nm=/^\+[1-9]\d{6,14}$/,Dk="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Dm=new RegExp(`^${Dk}$`);Zm=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Mm=/^-?\d+n?$/,Lm=/^-?\d+$/,bc=/^-?\d+(?:\.\d+)?$/,Fm=/^(?:true|false)$/i,qm=/^null$/i,Jm=/^undefined$/i,Vm=/^[^A-Z]*$/,Bm=/^[^a-z]*$/,tj=/^[0-9a-fA-F]*$/;rj=/^[0-9a-fA-F]{32}$/,nj=Zi(22,"=="),oj=Mi(22),ij=/^[0-9a-fA-F]{40}$/,aj=Zi(27,"="),sj=Mi(27),cj=/^[0-9a-fA-F]{64}$/,uj=Zi(43,"="),lj=Mi(43),dj=/^[0-9a-fA-F]{96}$/,pj=Zi(64,""),mj=Mi(64),fj=/^[0-9a-fA-F]{128}$/,gj=Zi(86,"=="),hj=Mi(86);});function Uk(t,e,n){t.issues.length&&e.issues.push(...$t(n,t.issues));}var ve,Zk,wc,Sc,Gm,Km,Wm,Hm,Xm,Ym,Qm,ef,tf,oo,rf,nf,of,af,sf,cf,uf,lf,df,Tc=f(()=>{Vn();xc();U();ve=g("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[]);}),Zk={number:"number",bigint:"bigint",object:"date"},wc=g("$ZodCheckLessThan",(t,e)=>{ve.init(t,e);let n=Zk[typeof e.value];t._zod.onattach.push(o=>{let r=o._zod.bag,i=(e.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?r.maximum=e.value:r.exclusiveMaximum=e.value);}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort});};}),Sc=g("$ZodCheckGreaterThan",(t,e)=>{ve.init(t,e);let n=Zk[typeof e.value];t._zod.onattach.push(o=>{let r=o._zod.bag,i=(e.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?r.minimum=e.value:r.exclusiveMinimum=e.value);}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort});};}),Gm=g("$ZodCheckMultipleOf",(t,e)=>{ve.init(t,e),t._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=e.value);}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):lm(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort});};}),Km=g("$ZodCheckNumberFormat",(t,e)=>{ve.init(t,e),e.format=e.format||"float64";let n=e.format?.includes("int"),o=n?"int":"number",[r,i]=gm[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=r,s.maximum=i,n&&(s.pattern=Lm);}),t._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:o,format:e.format,code:"invalid_type",continue:false,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:true,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:true,continue:!e.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:true,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:true,inst:t,continue:!e.abort});};}),Wm=g("$ZodCheckBigIntFormat",(t,e)=>{ve.init(t,e);let[n,o]=hm[e.format];t._zod.onattach.push(r=>{let i=r._zod.bag;i.format=e.format,i.minimum=n,i.maximum=o;}),t._zod.check=r=>{let i=r.value;i<n&&r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:true,inst:t,continue:!e.abort}),i>o&&r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:true,inst:t,continue:!e.abort});};}),Hm=g("$ZodCheckMaxSize",(t,e)=>{var n;ve.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !Or(r)&&r.size!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(o._zod.bag.maximum=e.maximum);}),t._zod.check=o=>{let r=o.value;r.size<=e.maximum||o.issues.push({origin:Di(r),code:"too_big",maximum:e.maximum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),Xm=g("$ZodCheckMinSize",(t,e)=>{var n;ve.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !Or(r)&&r.size!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(o._zod.bag.minimum=e.minimum);}),t._zod.check=o=>{let r=o.value;r.size>=e.minimum||o.issues.push({origin:Di(r),code:"too_small",minimum:e.minimum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),Ym=g("$ZodCheckSizeEquals",(t,e)=>{var n;ve.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !Or(r)&&r.size!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=e.size,r.maximum=e.size,r.size=e.size;}),t._zod.check=o=>{let r=o.value,i=r.size;if(i===e.size)return;let a=i>e.size;o.issues.push({origin:Di(r),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:true,exact:true,input:o.value,inst:t,continue:!e.abort});};}),Qm=g("$ZodCheckMaxLength",(t,e)=>{var n;ve.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !Or(r)&&r.length!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(o._zod.bag.maximum=e.maximum);}),t._zod.check=o=>{let r=o.value;if(r.length<=e.maximum)return;let a=Ai(r);o.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),ef=g("$ZodCheckMinLength",(t,e)=>{var n;ve.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !Or(r)&&r.length!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(o._zod.bag.minimum=e.minimum);}),t._zod.check=o=>{let r=o.value;if(r.length>=e.minimum)return;let a=Ai(r);o.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),tf=g("$ZodCheckLengthEquals",(t,e)=>{var n;ve.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !Or(r)&&r.length!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=e.length,r.maximum=e.length,r.length=e.length;}),t._zod.check=o=>{let r=o.value,i=r.length;if(i===e.length)return;let a=Ai(r),s=i>e.length;o.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:true,exact:true,input:o.value,inst:t,continue:!e.abort});};}),oo=g("$ZodCheckStringFormat",(t,e)=>{var n,o;ve.init(t,e),t._zod.onattach.push(r=>{let i=r._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern));}),e.pattern?(n=t._zod).check??(n.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:e.format,input:r.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort});}):(o=t._zod).check??(o.check=()=>{});}),rf=g("$ZodCheckRegex",(t,e)=>{oo.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort});};}),nf=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Vm),oo.init(t,e);}),of=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Bm),oo.init(t,e);}),af=g("$ZodCheckIncludes",(t,e)=>{ve.init(t,e);let n=It(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=o,t._zod.onattach.push(r=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o);}),t._zod.check=r=>{r.value.includes(e.includes,e.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:r.value,inst:t,continue:!e.abort});};}),sf=g("$ZodCheckStartsWith",(t,e)=>{ve.init(t,e);let n=new RegExp(`^${It(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n);}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort});};}),cf=g("$ZodCheckEndsWith",(t,e)=>{ve.init(t,e);let n=new RegExp(`.*${It(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n);}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort});};});uf=g("$ZodCheckProperty",(t,e)=>{ve.init(t,e),t._zod.check=n=>{let o=e.schema._zod.run({value:n.value[e.property],issues:[]},{});if(o instanceof Promise)return o.then(r=>Uk(r,n,e.property));Uk(o,n,e.property);};}),lf=g("$ZodCheckMimeType",(t,e)=>{ve.init(t,e);let n=new Set(e.mime);t._zod.onattach.push(o=>{o._zod.bag.mime=e.mime;}),t._zod.check=o=>{n.has(o.value.type)||o.issues.push({code:"invalid_value",values:e.mime,input:o.value.type,inst:t,continue:!e.abort});};}),df=g("$ZodCheckOverwrite",(t,e)=>{ve.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value);};});});var Li,pf=f(()=>{Li=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e);}indented(e){this.indent+=1,e(this),this.indent-=1;}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
5
5
  `).filter(a=>a),r=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a);}compile(){let e=Function,n=this?.args,r=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...n,r.join(`
6
6
  `))}};});var mf,ff=f(()=>{mf={major:4,minor:3,patch:6};});function hf(t){if(t==="")return true;if(t.length%4!==0)return false;try{return atob(t),!0}catch{return false}}function Yk(t){if(!$c.test(t))return false;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return hf(n)}function Qk(t,e=null){try{let n=t.split(".");if(n.length!==3)return !1;let[o]=n;if(!o)return !1;let r=JSON.parse(atob(o));return !("typ"in r&&r?.typ!=="JWT"||!r.alg||e&&(!("alg"in r)||r.alg!==e))}catch{return false}}function Lk(t,e,n){t.issues.length&&e.issues.push(...$t(n,t.issues)),e.value[n]=t.value;}function Ec(t,e,n,o,r){if(t.issues.length){if(r&&!(n in o))return;e.issues.push(...$t(n,t.issues));}t.value===void 0?n in o&&(e.value[n]=void 0):e.value[n]=t.value;}function e$(t){let e=Object.keys(t.shape);for(let o of e)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let n=fm(t.shape);return {...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function t$(t,e,n,o,r,i){let a=[],s=r.keySet,c=r.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:e[d],issues:[]},o);p instanceof Promise?t.push(p.then(m=>Ec(m,n,d,e,l))):Ec(p,n,d,e,l);}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>n):n}function Fk(t,e,n,o){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let r=t.filter(i=>!Dr(i));return r.length===1?(e.value=r[0].value,r[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(a=>lt(a,o,ze())))}),e)}function qk(t,e,n,o){let r=t.filter(i=>i.issues.length===0);return r.length===1?(e.value=r[0].value,e):(r.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(a=>lt(a,o,ze())))}):e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:[],inclusive:false}),e)}function gf(t,e){if(t===e)return {valid:true,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return {valid:true,data:t};if(Nr(t)&&Nr(e)){let n=Object.keys(e),o=Object.keys(t).filter(i=>n.indexOf(i)!==-1),r={...t,...e};for(let i of o){let a=gf(t[i],e[i]);if(!a.valid)return {valid:false,mergeErrorPath:[i,...a.mergeErrorPath]};r[i]=a.data;}return {valid:true,data:r}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return {valid:false,mergeErrorPath:[]};let n=[];for(let o=0;o<t.length;o++){let r=t[o],i=e[o],a=gf(r,i);if(!a.valid)return {valid:false,mergeErrorPath:[o,...a.mergeErrorPath]};n.push(a.data);}return {valid:true,data:n}}return {valid:false,mergeErrorPath:[]}}function Jk(t,e,n){let o=new Map,r;for(let s of e.issues)if(s.code==="unrecognized_keys"){r??(r=s);for(let c of s.keys)o.has(c)||o.set(c,{}),o.get(c).l=true;}else t.issues.push(s);for(let s of n.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)o.has(c)||o.set(c,{}),o.get(c).r=true;else t.issues.push(s);let i=[...o].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&r&&t.issues.push({...r,keys:i}),Dr(t))return t;let a=gf(e.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}function Ic(t,e,n){t.issues.length&&e.issues.push(...$t(n,t.issues)),e.value[n]=t.value;}function Vk(t,e,n,o,r,i,a){t.issues.length&&(Ni.has(typeof o)?n.issues.push(...$t(o,t.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:t.issues.map(s=>lt(s,a,ze()))})),e.issues.length&&(Ni.has(typeof o)?n.issues.push(...$t(o,e.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:o,issues:e.issues.map(s=>lt(s,a,ze()))})),n.value.set(t.value,e.value);}function Bk(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value);}function Gk(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}function Kk(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function Wk(t,e){return !t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function zc(t,e,n){return t.issues.length?(t.aborted=true,t):e._zod.run({value:t.value,issues:t.issues},n)}function Pc(t,e,n){if(t.issues.length)return t.aborted=true,t;if((n.direction||"forward")==="forward"){let r=e.transform(t.value,t);return r instanceof Promise?r.then(i=>jc(t,i,e.out,n)):jc(t,r,e.out,n)}else {let r=e.reverseTransform(t.value,t);return r instanceof Promise?r.then(i=>jc(t,i,e.in,n)):jc(t,r,e.in,n)}}function jc(t,e,n,o){return t.issues.length?(t.aborted=true,t):n._zod.run({value:e,issues:t.issues},o)}function Hk(t){return t.value=Object.freeze(t.value),t}function Xk(t,e,n,o){if(!t){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),e.issues.push(Kn(r));}}var B,Ar,he,Cc,Oc,Rc,Nc,Dc,Ac,Uc,Zc,Mc,Lc,Fc,qc,Jc,Vc,Bc,Gc,Kc,Wc,Hc,Xc,Yc,Qc,eu,tu,ru,Fi,nu,io,qi,ou,iu,au,su,cu,uu,lu,du,pu,mu,yf,vf,ao,fu,gu,hu,Ji,yu,vu,_u,ku,$u,bu,xu,Vi,wu,Su,Tu,Iu,zu,Pu,ju,Eu,Cu,so,Ou,Ru,Nu,Du,Au,Uu,_f=f(()=>{Tc();Vn();pf();vm();xc();U();ff();U();B=g("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=mf;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let r of o)for(let i of r._zod.onattach)i(t);if(o.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse;});else {let r=(a,s,c)=>{let u=Dr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,m=d._zod.check(a);if(m instanceof Promise&&c?.async===false)throw new Vt;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(u||(u=Dr(a,p)));});else {if(a.issues.length===p)continue;u||(u=Dr(a,p));}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Dr(a))return a.aborted=true,a;let u=r(s,o,c);if(u instanceof Promise){if(c.async===false)throw new Vt;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:true});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===false)throw new Vt;return c.then(u=>r(u,o,s))}return r(c,o,s)};}X(t,"~standard",()=>({validate:r=>{try{let i=dn(t,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return no(t,r).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}));}),Ar=g("$ZodString",(t,e)=>{B.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Zm(t._zod.bag),t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=String(n.value);}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n};}),he=g("$ZodStringFormat",(t,e)=>{oo.init(t,e),Ar.init(t,e);}),Cc=g("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Tm),he.init(t,e);}),Oc=g("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=pn(o));}else e.pattern??(e.pattern=pn());he.init(t,e);}),Rc=g("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Im),he.init(t,e);}),Nc=g("$ZodURL",(t,e)=>{he.init(t,e),t._zod.check=n=>{try{let o=n.value.trim(),r=new URL(o);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort});}};}),Dc=g("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=zm()),he.init(t,e);}),Ac=g("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=wm),he.init(t,e);}),Uc=g("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=_m),he.init(t,e);}),Zc=g("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=km),he.init(t,e);}),Mc=g("$ZodULID",(t,e)=>{e.pattern??(e.pattern=$m),he.init(t,e);}),Lc=g("$ZodXID",(t,e)=>{e.pattern??(e.pattern=bm),he.init(t,e);}),Fc=g("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=xm),he.init(t,e);}),qc=g("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Um(e)),he.init(t,e);}),Jc=g("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Dm),he.init(t,e);}),Vc=g("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Am(e)),he.init(t,e);}),Bc=g("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Sm),he.init(t,e);}),Gc=g("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Pm),he.init(t,e),t._zod.bag.format="ipv4";}),Kc=g("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=jm),he.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`);}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort});}};}),Wc=g("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Em(e.delimiter)),he.init(t,e),t._zod.bag.format="mac";}),Hc=g("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Cm),he.init(t,e);}),Xc=g("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Om),he.init(t,e),t._zod.check=n=>{let o=n.value.split("/");try{if(o.length!==2)throw new Error;let[r,i]=o;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`);}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort});}};});Yc=g("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Rm),he.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{hf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort});};});Qc=g("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=$c),he.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{Yk(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort});};}),eu=g("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Nm),he.init(t,e);});tu=g("$ZodJWT",(t,e)=>{he.init(t,e),t._zod.check=n=>{Qk(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort});};}),ru=g("$ZodCustomStringFormat",(t,e)=>{he.init(t,e),t._zod.check=n=>{e.fn(n.value)||n.issues.push({code:"invalid_format",format:e.format,input:n.value,inst:t,continue:!e.abort});};}),Fi=g("$ZodNumber",(t,e)=>{B.init(t,e),t._zod.pattern=t._zod.bag.pattern??bc,t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=Number(n.value);}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:t,...i?{received:i}:{}}),n};}),nu=g("$ZodNumberFormat",(t,e)=>{Km.init(t,e),Fi.init(t,e);}),io=g("$ZodBoolean",(t,e)=>{B.init(t,e),t._zod.pattern=Fm,t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=!!n.value;}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:t}),n};}),qi=g("$ZodBigInt",(t,e)=>{B.init(t,e),t._zod.pattern=Mm,t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=BigInt(n.value);}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n};}),ou=g("$ZodBigIntFormat",(t,e)=>{Wm.init(t,e),qi.init(t,e);}),iu=g("$ZodSymbol",(t,e)=>{B.init(t,e),t._zod.parse=(n,o)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:t}),n};}),au=g("$ZodUndefined",(t,e)=>{B.init(t,e),t._zod.pattern=Jm,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:t}),n};}),su=g("$ZodNull",(t,e)=>{B.init(t,e),t._zod.pattern=qm,t._zod.values=new Set([null]),t._zod.parse=(n,o)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:t}),n};}),cu=g("$ZodAny",(t,e)=>{B.init(t,e),t._zod.parse=n=>n;}),uu=g("$ZodUnknown",(t,e)=>{B.init(t,e),t._zod.parse=n=>n;}),lu=g("$ZodNever",(t,e)=>{B.init(t,e),t._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n);}),du=g("$ZodVoid",(t,e)=>{B.init(t,e),t._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:t}),n};}),pu=g("$ZodDate",(t,e)=>{B.init(t,e),t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=new Date(n.value);}catch{}let r=n.value,i=r instanceof Date;return i&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:t}),n};});mu=g("$ZodArray",(t,e)=>{B.init(t,e),t._zod.parse=(n,o)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:t}),n;n.value=Array(r.length);let i=[];for(let a=0;a<r.length;a++){let s=r[a],c=e.element._zod.run({value:s,issues:[]},o);c instanceof Promise?i.push(c.then(u=>Lk(u,n,a))):Lk(c,n,a);}return i.length?Promise.all(i).then(()=>n):n};});yf=g("$ZodObject",(t,e)=>{if(B.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}});}let o=Gn(()=>e$(e));X(t._zod,"propValues",()=>{let s=e.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d);}}return c});let r=ln,i=e.catchall,a;t._zod.parse=(s,c)=>{a??(a=o.value);let u=s.value;if(!r(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let m=d[p],y=m._zod.optout==="optional",k=m._zod.run({value:u[p],issues:[]},c);k instanceof Promise?l.push(k.then(T=>Ec(T,s,p,u,y))):Ec(k,s,p,u,y);}return i?t$(l,u,s,c,o.value,t):l.length?Promise.all(l).then(()=>s):s};}),vf=g("$ZodObjectJIT",(t,e)=>{yf.init(t,e);let n=t._zod.parse,o=Gn(()=>e$(e)),r=p=>{let m=new Li(["shape","payload","ctx"]),y=o.value,k=O=>{let q=cc(O);return `shape[${q}]._zod.run({ value: input[${q}], issues: [] }, ctx)`};m.write("const input = payload.value;");let T=Object.create(null),I=0;for(let O of y.keys)T[O]=`key_${I++}`;m.write("const newResult = {};");for(let O of y.keys){let q=T[O],Z=cc(O),Xe=p[O]?._zod?.optout==="optional";m.write(`const ${q} = ${k(O)};`),Xe?m.write(`
package/dist/index.js CHANGED
@@ -85,5 +85,5 @@ ${n}
85
85
 
86
86
  `)}function bn(t,e){let n=O1(t,e);if(n.length>0)return {success:false,error:`Missing required variables: ${n.join(", ")}`,missingVariables:n};let o=E1(t),r=t.body;return r=r.replace(P1,(i,a,s)=>{let c=e[a];return c!==void 0&&c!==""?s:""}),r=r.replace(j1,(i,a)=>a in e?e[a]??"":o.get(a)??""),{success:true,markdown:R1(r).trim(),usedVariables:Object.keys(e)}}var P1,j1,g0=w(()=>{P1=/\{\{#(\w+)\}\}([\s\S]*?)\{\{\/\1\}\}/g,j1=/\{\{(\w+)\}\}/g;});function tv(t){console.log(t);}function rv(t){console.warn(`Warning: ${t}`);}function nv(t){console.error(`Error: ${t}`);}function y0(t,e){let n=t.map((i,a)=>Math.max(i.length,...e.map(s=>(s[a]??"").length))),o=t.map((i,a)=>i.padEnd(n[a]??0)).join(" "),r=n.map(i=>"-".repeat(i)).join(" ");console.log(o),console.log(r);for(let i of e)console.log(i.map((a,s)=>(a??"").padEnd(n[s]??0)).join(" "));}var v0=w(()=>{});var _0={};qt(_0,{AdfConversionError:()=>qy,AdfDocumentSchema:()=>s0,ApprovalError:()=>gs,AtlassianHttpClient:()=>Xo,BODY_FORMATS:()=>Ry,BodyFormatSchema:()=>Lo,CacheCorruptionError:()=>pr,CacheError:()=>Fo,CacheNotFoundError:()=>St,CommentApprovalRequiredError:()=>ys,CommentNotFoundError:()=>_s,ConfigError:()=>ps,ConfigFileSchema:()=>Zd,ConfigNotFoundError:()=>qo,ConfigValidationError:()=>qe,ConfluenceAuthenticationError:()=>Dy,ConfluenceConfigSchema:()=>CS,ConfluenceConnectionError:()=>hs,ConfluencePermissionError:()=>Ay,ConfluenceSpaceInstanceConfigSchema:()=>ds,CredentialsFileSchema:()=>Md,DEFAULT_BODY_FORMAT:()=>Ud,DEFAULT_LANGUAGE:()=>Yt,DeletionApprovalRequiredError:()=>vs,GLOBAL_CACHE_DIR:()=>xs,GLOBAL_CONFIG_DIR:()=>Lr,GLOBAL_CONFIG_PATH:()=>ks,GLOBAL_CREDENTIALS_PATH:()=>bs,GLOBAL_STATE_PATH:()=>Fy,JiraAuthenticationError:()=>ms,JiraConfigSchema:()=>RS,JiraConnectionError:()=>wt,JiraInstanceConfigSchema:()=>ls,JiraMcpError:()=>Pe,JiraPermissionError:()=>fs,LanguageCodeSchema:()=>Zt,MarkupLossError:()=>Uy,MultiCredentialsSchema:()=>us,OwnershipError:()=>Vo,PageNotFoundError:()=>Zy,ProjectConfigSchema:()=>Oy,SUPPORTED_LANGUAGES:()=>Ey,SingleCredentialsSchema:()=>dr,SpaceConfigSchema:()=>Cy,TaskNotFoundError:()=>Tt,TemplateError:()=>mr,TemplateMissingVariableError:()=>Ly,TemplateNotFoundError:()=>kn,VersionConflictError:()=>My,adfToMarkdown:()=>Wo,asOptionalBoolean:()=>qr,asOptionalNumber:()=>Jd,asOptionalRecord:()=>Ts,asOptionalString:()=>ke,asOptionalStringArray:()=>Ss,assertCommentApproved:()=>Yo,assertDeletionApproved:()=>Qo,createEmptyDoc:()=>e0,createHeading:()=>n0,createParagraph:()=>o0,createTextDoc:()=>t0,error:()=>nv,failure:()=>M,getProjectConfig:()=>MS,getSpaceConfig:()=>ZS,getUniqueInstances:()=>Ld,info:()=>tv,loadConfig:()=>Go,loadConfluenceConfig:()=>US,loadJsonFile:()=>ES,markdownToAdf:()=>zt,pathExists:()=>Xt,renderTemplate:()=>bn,requireString:()=>Ie,saveJsonFile:()=>OS,success:()=>K,table:()=>y0,warn:()=>rv,wrapInPanel:()=>r0,writeSecureFile:()=>jS});var le=w(()=>{LS();Ny();Vy();Jo();WS();QS();i0();c0();d0();p0();m0();f0();h0();g0();v0();jy();});var ne;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{let i={};for(let a of r)i[a]=a;return i},t.getValidEnumValues=r=>{let i=t.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of i)a[s]=r[s];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let i=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},t.find=(r,i)=>{for(let a of r)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function o(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=o,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i;})(ne||(ne={}));var pv;(function(t){t.mergeShapes=(e,n)=>({...e,...n});})(pv||(pv={}));ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var ct=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o];},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o];};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e;}format(e){let n=e||function(i){return i.message},o={_errors:[]},r=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)o._errors.push(n(a));else {let s=o,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(n(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++;}}};return r(this),o}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),o=[];for(let r of this.issues)if(r.path.length>0){let i=r.path[0];n[i]=n[i]||[],n[i].push(e(r));}else o.push(e(r));return {formErrors:o,fieldErrors:n}}get formErrors(){return this.flatten()}};ct.create=t=>new ct(t);var C;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message;})(C||(C={}));var L;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly";})(L||(L={}));Se();Se();Se();D();Se();Se();co();mu();Se();Se();function uo(t){return !!t._zod}function Pr(t,e){return uo(t)?Kr(t,e):t.safeParse(e)}function il(t){if(!t)return;let e;if(uo(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Q$(t){if(uo(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}ka();ka();var vh="2025-11-25";var fb=[vh,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Er="io.modelcontextprotocol/related-task",Zl="2.0",Ee=Al(t=>t!==null&&(typeof t=="object"||typeof t=="function")),hb=ye([y(),ce().int()]),gb=y();Ne({ttl:ce().optional(),pollInterval:ce().optional()});var vP=E({ttl:ce().optional()}),_P=E({taskId:y()}),_h=Ne({progressToken:hb.optional(),[Er]:_P.optional()}),pt=E({_meta:_h.optional()}),ba=pt.extend({task:vP.optional()}),yb=t=>ba.safeParse(t).success,Ae=E({method:y(),params:pt.loose().optional()}),vt=E({_meta:_h.optional()}),_t=E({method:y(),params:vt.loose().optional()}),Ue=Ne({_meta:_h.optional()}),Ml=ye([y(),ce().int()]),vb=E({jsonrpc:N(Zl),id:Ml,...Ae.shape}).strict(),$h=t=>vb.safeParse(t).success,_b=E({jsonrpc:N(Zl),..._t.shape}).strict(),$b=t=>_b.safeParse(t).success,kh=E({jsonrpc:N(Zl),id:Ml,result:Ue}).strict(),xa=t=>kh.safeParse(t).success;var oe;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired";})(oe||(oe={}));var bh=E({jsonrpc:N(Zl),id:Ml.optional(),error:E({code:ce().int(),message:y(),data:ge().optional()})}).strict();var kb=t=>bh.safeParse(t).success;var bb=ye([vb,_b,kh,bh]);ye([kh,bh]);var Ll=Ue.strict(),$P=vt.extend({requestId:Ml.optional(),reason:y().optional()}),ql=_t.extend({method:N("notifications/cancelled"),params:$P}),kP=E({src:y(),mimeType:y().optional(),sizes:ee(y()).optional(),theme:De(["light","dark"]).optional()}),wa=E({icons:ee(kP).optional()}),vo=E({name:y(),title:y().optional()}),xb=vo.extend({...vo.shape,...wa.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),bP=yo(E({applyDefaults:Te().optional()}),me(y(),ge())),xP=$a(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,yo(E({form:bP.optional(),url:Ee.optional()}),me(y(),ge()).optional())),wP=Ne({list:Ee.optional(),cancel:Ee.optional(),requests:Ne({sampling:Ne({createMessage:Ee.optional()}).optional(),elicitation:Ne({create:Ee.optional()}).optional()}).optional()}),SP=Ne({list:Ee.optional(),cancel:Ee.optional(),requests:Ne({tools:Ne({call:Ee.optional()}).optional()}).optional()}),TP=E({experimental:me(y(),Ee).optional(),sampling:E({context:Ee.optional(),tools:Ee.optional()}).optional(),elicitation:xP.optional(),roots:E({listChanged:Te().optional()}).optional(),tasks:wP.optional(),extensions:me(y(),Ee).optional()}),zP=pt.extend({protocolVersion:y(),capabilities:TP,clientInfo:xb}),xh=Ae.extend({method:N("initialize"),params:zP});var IP=E({experimental:me(y(),Ee).optional(),logging:Ee.optional(),completions:Ee.optional(),prompts:E({listChanged:Te().optional()}).optional(),resources:E({subscribe:Te().optional(),listChanged:Te().optional()}).optional(),tools:E({listChanged:Te().optional()}).optional(),tasks:SP.optional(),extensions:me(y(),Ee).optional()}),PP=Ue.extend({protocolVersion:y(),capabilities:IP,serverInfo:xb,instructions:y().optional()}),wh=_t.extend({method:N("notifications/initialized"),params:vt.optional()});var Fl=Ae.extend({method:N("ping"),params:pt.optional()}),jP=E({progress:ce(),total:_e(ce()),message:_e(y())}),EP=E({...vt.shape,...jP.shape,progressToken:hb}),Vl=_t.extend({method:N("notifications/progress"),params:EP}),OP=pt.extend({cursor:gb.optional()}),Sa=Ae.extend({params:OP.optional()}),Ta=Ue.extend({nextCursor:gb.optional()}),RP=De(["working","input_required","completed","failed","cancelled"]),za=E({taskId:y(),status:RP,ttl:ye([ce(),ma()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:_e(ce()),statusMessage:_e(y())}),_o=Ue.extend({task:za}),CP=vt.merge(za),Ia=_t.extend({method:N("notifications/tasks/status"),params:CP}),Jl=Ae.extend({method:N("tasks/get"),params:pt.extend({taskId:y()})}),Bl=Ue.merge(za),Gl=Ae.extend({method:N("tasks/result"),params:pt.extend({taskId:y()})});Ue.loose();var Kl=Sa.extend({method:N("tasks/list")}),Hl=Ta.extend({tasks:ee(za)}),Wl=Ae.extend({method:N("tasks/cancel"),params:pt.extend({taskId:y()})}),wb=Ue.merge(za),Sb=E({uri:y(),mimeType:_e(y()),_meta:me(y(),ge()).optional()}),Tb=Sb.extend({text:y()}),Sh=y().refine(t=>{try{return atob(t),!0}catch{return false}},{message:"Invalid Base64 string"}),zb=Sb.extend({blob:Sh}),Pa=De(["user","assistant"]),$o=E({audience:ee(Pa).optional(),priority:ce().min(0).max(1).optional(),lastModified:jr.datetime({offset:true}).optional()}),Ib=E({...vo.shape,...wa.shape,uri:y(),description:_e(y()),mimeType:_e(y()),size:_e(ce()),annotations:$o.optional(),_meta:_e(Ne({}))}),NP=E({...vo.shape,...wa.shape,uriTemplate:y(),description:_e(y()),mimeType:_e(y()),annotations:$o.optional(),_meta:_e(Ne({}))}),DP=Sa.extend({method:N("resources/list")}),AP=Ta.extend({resources:ee(Ib)}),UP=Sa.extend({method:N("resources/templates/list")}),ZP=Ta.extend({resourceTemplates:ee(NP)}),Th=pt.extend({uri:y()}),MP=Th,LP=Ae.extend({method:N("resources/read"),params:MP}),qP=Ue.extend({contents:ee(ye([Tb,zb]))}),FP=_t.extend({method:N("notifications/resources/list_changed"),params:vt.optional()}),VP=Th,JP=Ae.extend({method:N("resources/subscribe"),params:VP}),BP=Th,GP=Ae.extend({method:N("resources/unsubscribe"),params:BP}),KP=vt.extend({uri:y()}),HP=_t.extend({method:N("notifications/resources/updated"),params:KP}),WP=E({name:y(),description:_e(y()),required:_e(Te())}),XP=E({...vo.shape,...wa.shape,description:_e(y()),arguments:_e(ee(WP)),_meta:_e(Ne({}))}),YP=Sa.extend({method:N("prompts/list")}),QP=Ta.extend({prompts:ee(XP)}),ej=pt.extend({name:y(),arguments:me(y(),y()).optional()}),tj=Ae.extend({method:N("prompts/get"),params:ej}),zh=E({type:N("text"),text:y(),annotations:$o.optional(),_meta:me(y(),ge()).optional()}),Ih=E({type:N("image"),data:Sh,mimeType:y(),annotations:$o.optional(),_meta:me(y(),ge()).optional()}),Ph=E({type:N("audio"),data:Sh,mimeType:y(),annotations:$o.optional(),_meta:me(y(),ge()).optional()}),rj=E({type:N("tool_use"),name:y(),id:y(),input:me(y(),ge()),_meta:me(y(),ge()).optional()}),nj=E({type:N("resource"),resource:ye([Tb,zb]),annotations:$o.optional(),_meta:me(y(),ge()).optional()}),oj=Ib.extend({type:N("resource_link")}),jh=ye([zh,Ih,Ph,oj,nj]),ij=E({role:Pa,content:jh}),aj=Ue.extend({description:y().optional(),messages:ee(ij)}),sj=_t.extend({method:N("notifications/prompts/list_changed"),params:vt.optional()}),cj=E({title:y().optional(),readOnlyHint:Te().optional(),destructiveHint:Te().optional(),idempotentHint:Te().optional(),openWorldHint:Te().optional()}),uj=E({taskSupport:De(["required","optional","forbidden"]).optional()}),Pb=E({...vo.shape,...wa.shape,description:y().optional(),inputSchema:E({type:N("object"),properties:me(y(),Ee).optional(),required:ee(y()).optional()}).catchall(ge()),outputSchema:E({type:N("object"),properties:me(y(),Ee).optional(),required:ee(y()).optional()}).catchall(ge()).optional(),annotations:cj.optional(),execution:uj.optional(),_meta:me(y(),ge()).optional()}),Eh=Sa.extend({method:N("tools/list")}),lj=Ta.extend({tools:ee(Pb)}),Xl=Ue.extend({content:ee(jh).default([]),structuredContent:me(y(),ge()).optional(),isError:Te().optional()});Xl.or(Ue.extend({toolResult:ge()}));var dj=ba.extend({name:y(),arguments:me(y(),ge()).optional()}),ja=Ae.extend({method:N("tools/call"),params:dj}),pj=_t.extend({method:N("notifications/tools/list_changed"),params:vt.optional()});E({autoRefresh:Te().default(true),debounceMs:ce().int().nonnegative().default(300)});var Ea=De(["debug","info","notice","warning","error","critical","alert","emergency"]),mj=pt.extend({level:Ea}),Oh=Ae.extend({method:N("logging/setLevel"),params:mj}),fj=vt.extend({level:Ea,logger:y().optional(),data:ge()}),hj=_t.extend({method:N("notifications/message"),params:fj}),gj=E({name:y().optional()}),yj=E({hints:ee(gj).optional(),costPriority:ce().min(0).max(1).optional(),speedPriority:ce().min(0).max(1).optional(),intelligencePriority:ce().min(0).max(1).optional()}),vj=E({mode:De(["auto","required","none"]).optional()}),_j=E({type:N("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:ee(jh).default([]),structuredContent:E({}).loose().optional(),isError:Te().optional(),_meta:me(y(),ge()).optional()}),$j=ya("type",[zh,Ih,Ph]),Ul=ya("type",[zh,Ih,Ph,rj,_j]),kj=E({role:Pa,content:ye([Ul,ee(Ul)]),_meta:me(y(),ge()).optional()}),bj=ba.extend({messages:ee(kj),modelPreferences:yj.optional(),systemPrompt:y().optional(),includeContext:De(["none","thisServer","allServers"]).optional(),temperature:ce().optional(),maxTokens:ce().int(),stopSequences:ee(y()).optional(),metadata:Ee.optional(),tools:ee(Pb).optional(),toolChoice:vj.optional()}),xj=Ae.extend({method:N("sampling/createMessage"),params:bj}),Oa=Ue.extend({model:y(),stopReason:_e(De(["endTurn","stopSequence","maxTokens"]).or(y())),role:Pa,content:$j}),Rh=Ue.extend({model:y(),stopReason:_e(De(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:Pa,content:ye([Ul,ee(Ul)])}),wj=E({type:N("boolean"),title:y().optional(),description:y().optional(),default:Te().optional()}),Sj=E({type:N("string"),title:y().optional(),description:y().optional(),minLength:ce().optional(),maxLength:ce().optional(),format:De(["email","uri","date","date-time"]).optional(),default:y().optional()}),Tj=E({type:De(["number","integer"]),title:y().optional(),description:y().optional(),minimum:ce().optional(),maximum:ce().optional(),default:ce().optional()}),zj=E({type:N("string"),title:y().optional(),description:y().optional(),enum:ee(y()),default:y().optional()}),Ij=E({type:N("string"),title:y().optional(),description:y().optional(),oneOf:ee(E({const:y(),title:y()})),default:y().optional()}),Pj=E({type:N("string"),title:y().optional(),description:y().optional(),enum:ee(y()),enumNames:ee(y()).optional(),default:y().optional()}),jj=ye([zj,Ij]),Ej=E({type:N("array"),title:y().optional(),description:y().optional(),minItems:ce().optional(),maxItems:ce().optional(),items:E({type:N("string"),enum:ee(y())}),default:ee(y()).optional()}),Oj=E({type:N("array"),title:y().optional(),description:y().optional(),minItems:ce().optional(),maxItems:ce().optional(),items:E({anyOf:ee(E({const:y(),title:y()}))}),default:ee(y()).optional()}),Rj=ye([Ej,Oj]),Cj=ye([Pj,jj,Rj]),Nj=ye([Cj,wj,Sj,Tj]),Dj=ba.extend({mode:N("form").optional(),message:y(),requestedSchema:E({type:N("object"),properties:me(y(),Nj),required:ee(y()).optional()})}),Aj=ba.extend({mode:N("url"),message:y(),elicitationId:y(),url:y().url()}),Uj=ye([Dj,Aj]),Zj=Ae.extend({method:N("elicitation/create"),params:Uj}),Mj=vt.extend({elicitationId:y()}),Lj=_t.extend({method:N("notifications/elicitation/complete"),params:Mj}),ko=Ue.extend({action:De(["accept","decline","cancel"]),content:$a(t=>t===null?void 0:t,me(y(),ye([y(),ce(),Te(),ee(y())])).optional())}),qj=E({type:N("ref/resource"),uri:y()});var Fj=E({type:N("ref/prompt"),name:y()}),Vj=pt.extend({ref:ye([Fj,qj]),argument:E({name:y(),value:y()}),context:E({arguments:me(y(),y()).optional()}).optional()}),Jj=Ae.extend({method:N("completion/complete"),params:Vj});var Bj=Ue.extend({completion:Ne({values:ee(y()).max(100),total:_e(ce().int()),hasMore:_e(Te())})}),Gj=E({uri:y().startsWith("file://"),name:y().optional(),_meta:me(y(),ge()).optional()}),Kj=Ae.extend({method:N("roots/list"),params:pt.optional()}),Ch=Ue.extend({roots:ee(Gj)}),Hj=_t.extend({method:N("notifications/roots/list_changed"),params:vt.optional()});ye([Fl,xh,Jj,Oh,tj,YP,DP,UP,LP,JP,GP,ja,Eh,Jl,Gl,Kl,Wl]);ye([ql,Vl,wh,Hj,Ia]);ye([Ll,Oa,Rh,ko,Ch,Bl,Hl,_o]);ye([Fl,xj,Zj,Kj,Jl,Gl,Kl,Wl]);ye([ql,Vl,hj,HP,FP,pj,sj,Ia,Lj]);ye([Ll,PP,Bj,aj,QP,AP,ZP,qP,Xl,lj,Bl,Hl,_o]);var W=class t extends Error{constructor(e,n,o){super(`MCP error ${e}: ${n}`),this.code=e,this.data=o,this.name="McpError";}static fromError(e,n,o){if(e===oe.UrlElicitationRequired&&o){let r=o;if(r.elicitations)return new yh(r.elicitations,n)}return new t(e,n,o)}},yh=class extends W{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super(oe.UrlElicitationRequired,n,{elicitations:e});}get elicitations(){return this.data?.elicitations??[]}};function Or(t){return t==="completed"||t==="failed"||t==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Nh(t){let n=il(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let o=Q$(n);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Dh(t,e){let n=Pr(t,e);if(!n.success)throw n.error;return n.data}var tE=6e4,Yl=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ql,n=>{this._oncancel(n);}),this.setNotificationHandler(Vl,n=>{this._onprogress(n);}),this.setRequestHandler(Fl,n=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Jl,async(n,o)=>{let r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new W(oe.InvalidParams,"Failed to retrieve task: Task not found");return {...r}}),this.setRequestHandler(Gl,async(n,o)=>{let r=async()=>{let i=n.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,o.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else {let d=c,p=new W(d.error.code,d.error.message,d.error.data);l(p);}else {let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`));}continue}await this._transport?.send(s.message,{relatedRequestId:o.requestId});}}let a=await this._taskStore.getTask(i,o.sessionId);if(!a)throw new W(oe.InvalidParams,`Task not found: ${i}`);if(!Or(a.status))return await this._waitForTaskUpdate(i,o.signal),await r();if(Or(a.status)){let s=await this._taskStore.getTaskResult(i,o.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[Er]:{taskId:i}}}}return await r()};return await r()}),this.setRequestHandler(Kl,async(n,o)=>{try{let{tasks:r,nextCursor:i}=await this._taskStore.listTasks(n.params?.cursor,o.sessionId);return {tasks:r,nextCursor:i,_meta:{}}}catch(r){throw new W(oe.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(Wl,async(n,o)=>{try{let r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new W(oe.InvalidParams,`Task not found: ${n.params.taskId}`);if(Or(r.status))throw new W(oe.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(n.params.taskId);let i=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!i)throw new W(oe.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return {_meta:{},...i}}catch(r){throw r instanceof W?r:new W(oe.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}));}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason);}_setupTimeout(e,n,o,r,i=false){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:o,resetTimeoutOnProgress:i,onTimeout:r});}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return false;let o=Date.now()-n.startTime;if(n.maxTotalTimeout&&o>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),W.fromError(oe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:o});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),true}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(e));}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose();};let o=this.transport?.onerror;this._transport.onerror=i=>{o?.(i),this._onerror(i);};let r=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{r?.(i,a),xa(i)||kb(i)?this._onresponse(i):$h(i)?this._onrequest(i,a):$b(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`));},await this._transport.start();}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let n=W.fromError(oe.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(n);}_onerror(e){this.onerror?.(e);}_onnotification(e){let n=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)));}_onrequest(e,n){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[Er]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:oe.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):r?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=yb(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,u={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d);},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new W(oe.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:e.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let h=m.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,m)},authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method);}).then(()=>o(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d);},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:oe.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d);}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id);});}_onprogress(e){let{progressToken:n,...o}=e.params,r=Number(n),i=this._progressHandlers.get(r);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r);}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(c);return}i(o);}_onresponse(e){let n=Number(e.id),o=this._requestResolvers.get(n);if(o){if(this._requestResolvers.delete(n),xa(e))o(e);else {let a=new W(e.error.code,e.error.message,e.error.data);o(a);}return}let r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=false;if(xa(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=true,this._taskProgressTokens.set(s.taskId,n));}}if(i||this._progressHandlers.delete(n),xa(e))r(e);else {let a=W.fromError(e.error.code,e.error.message,e.error.data);r(a);}}get transport(){return this._transport}async close(){await this._transport?.close();}async*requestStream(e,n,o){let{task:r}=o??{};if(!r){try{yield {type:"result",result:await this.request(e,n,o)};}catch(a){yield {type:"error",error:a instanceof W?a:new W(oe.InternalError,String(a))};}return}let i;try{let a=await this.request(e,_o,o);if(a.task)i=a.task.taskId,yield {type:"taskCreated",task:a.task};else throw new W(oe.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},o);if(yield {type:"taskStatus",task:s},Or(s.status)){s.status==="completed"?yield {type:"result",result:await this.getTaskResult({taskId:i},n,o)}:s.status==="failed"?yield {type:"error",error:new W(oe.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield {type:"error",error:new W(oe.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield {type:"result",result:await this.getTaskResult({taskId:i},n,o)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted();}}catch(a){yield {type:"error",error:a instanceof W?a:new W(oe.InternalError,String(a))};}}request(e,n,o){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=A=>{l(A);};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===true)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method);}catch(A){d(A);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Er]:c}});let h=A=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(A)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(q=>this._onerror(new Error(`Failed to send cancellation: ${q}`)));let R=A instanceof W?A:new W(oe.RequestTimeout,String(A));l(R);};this._responseHandlers.set(p,A=>{if(!o?.signal?.aborted){if(A instanceof Error)return l(A);try{let R=Pr(n,A.result);R.success?u(R.data):l(R.error);}catch(R){l(R);}}}),o?.signal?.addEventListener("abort",()=>{h(o?.signal?.reason);});let v=o?.timeout??tE,T=()=>h(W.fromError(oe.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(p,v,o?.maxTotalTimeout,T,o?.resetTimeoutOnProgress??false);let z=c?.taskId;if(z){let A=R=>{let q=this._responseHandlers.get(p);q?q(R):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`));};this._requestResolvers.set(p,A),this._enqueueTaskMessage(z,{type:"request",message:m,timestamp:Date.now()}).catch(R=>{this._cleanupTimeout(p),l(R);});}else this._transport.send(m,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(A=>{this._cleanupTimeout(p),l(A);});})}async getTask(e,n){return this.request({method:"tasks/get",params:e},Bl,n)}async getTaskResult(e,n,o){return this.request({method:"tasks/result",params:e},n,o)}async listTasks(e,n){return this.request({method:"tasks/list",params:e},Hl,n)}async cancelTask(e,n){return this.request({method:"tasks/cancel",params:e},wb,n)}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=n?.relatedTask?.taskId;if(o){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Er]:n.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Er]:n.relatedTask}}}),this._transport?.send(s,n).catch(c=>this._onerror(c));});return}let a={...e,jsonrpc:"2.0"};n?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Er]:n.relatedTask}}}),await this._transport.send(a,n);}setRequestHandler(e,n){let o=Nh(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(r,i)=>{let a=Dh(e,r);return Promise.resolve(n(a,i))});}removeRequestHandler(e){this._requestHandlers.delete(e);}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,n){let o=Nh(e);this._notificationHandlers.set(o,r=>{let i=Dh(e,r);return Promise.resolve(n(i))});}removeNotificationHandler(e){this._notificationHandlers.delete(e);}_cleanupTaskProgressHandler(e){let n=this._taskProgressTokens.get(e);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(e));}async _enqueueTaskMessage(e,n,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,n,o,r);}async _clearTaskQueue(e,n){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,n);for(let r of o)if(r.type==="request"&&$h(r.message)){let i=r.message.id,a=this._requestResolvers.get(i);a?(a(new W(oe.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`));}}}async _waitForTaskUpdate(e,n){let o=this._options?.defaultTaskPollInterval??1e3;try{let r=await this._taskStore?.getTask(e);r?.pollInterval&&(o=r.pollInterval);}catch{}return new Promise((r,i)=>{if(n.aborted){i(new W(oe.InvalidRequest,"Request cancelled"));return}let a=setTimeout(r,o);n.addEventListener("abort",()=>{clearTimeout(a),i(new W(oe.InvalidRequest,"Request cancelled"));},{once:true});})}requestTaskStore(e,n){let o=this._taskStore;if(!o)throw new Error("No task store configured");return {createTask:async r=>{if(!e)throw new Error("No request provided");return await o.createTask(r,e.id,{method:e.method,params:e.params},n)},getTask:async r=>{let i=await o.getTask(r,n);if(!i)throw new W(oe.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(r,i,a)=>{await o.storeTaskResult(r,i,a,n);let s=await o.getTask(r,n);if(s){let c=Ia.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Or(s.status)&&this._cleanupTaskProgressHandler(r);}},getTaskResult:r=>o.getTaskResult(r,n),updateTaskStatus:async(r,i,a)=>{let s=await o.getTask(r,n);if(!s)throw new W(oe.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(Or(s.status))throw new W(oe.InvalidParams,`Cannot update task "${r}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(r,i,a,n);let c=await o.getTask(r,n);if(c){let u=Ia.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Or(c.status)&&this._cleanupTaskProgressHandler(r);}},listTasks:r=>o.listTasks(r,n)}}};function jb(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Eb(t,e){let n={...t};for(let o in e){let r=o,i=e[r];if(i===void 0)continue;let a=n[r];jb(a)&&jb(i)?n[r]={...a,...i}:n[r]=i;}return n}var bS=dv(by()),xS=dv(kS());function o1(){let t=new bS.default({strict:false,validateFormats:true,validateSchema:false,allErrors:true});return (0, xS.default)(t),t}var Rd=class{constructor(e){this._ajv=e??o1();}getValidator(e){let n="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:true,data:o,errorMessage:void 0}:{valid:false,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Cd=class{constructor(e){this._server=e;}requestStream(e,n,o){return this._server.requestStream(e,n,o)}createMessageStream(e,n){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],a=i.some(l=>l.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Oa,n)}elicitInputStream(e,n){let o=this._server.getClientCapabilities(),r=e.mode??"form";switch(r){case "url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case "form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=r==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:i},ko,n)}async getTask(e,n){return this._server.getTask({taskId:e},n)}async getTaskResult(e,n,o){return this._server.getTaskResult({taskId:e},n,o)}async listTasks(e,n){return this._server.listTasks(e?{cursor:e}:void 0,n)}async cancelTask(e,n){return this._server.cancelTask({taskId:e},n)}};function wS(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case "tools/call":if(!t.tools?.call)throw new Error(`${n} does not support task creation for tools/call (required for ${e})`);break;}}function SS(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case "sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case "elicitation/create":if(!t.elicitation?.create)throw new Error(`${n} does not support task creation for elicitation/create (required for ${e})`);break;}}var Nd=class extends Yl{constructor(e,n){super(n),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ea.options.map((o,r)=>[o,r])),this.isMessageIgnored=(o,r)=>{let i=this._loggingLevels.get(r);return i?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(i):false},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new Rd,this.setRequestHandler(xh,o=>this._oninitialize(o)),this.setNotificationHandler(wh,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Oh,async(o,r)=>{let i=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=o.params,s=Ea.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}});}get experimental(){return this._experimental||(this._experimental={tasks:new Cd(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Eb(this._capabilities,e);}setRequestHandler(e,n){let r=il(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let i;if(uo(r)){let s=r;i=s._zod?.def?.value??s.value;}else {let s=r;i=s._def?.value??s.value;}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Pr(ja,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new W(oe.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(n(c,u));if(d.task){let h=Pr(_o,p);if(!h.success){let v=h.error instanceof Error?h.error.message:String(h.error);throw new W(oe.InvalidParams,`Invalid task creation result: ${v}`)}return h.data}let m=Pr(Xl,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new W(oe.InvalidParams,`Invalid tools/call result: ${h}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,n)}assertCapabilityForMethod(e){switch(e){case "sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case "elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case "roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;}}assertNotificationCapability(e){switch(e){case "notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case "notifications/resources/updated":case "notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case "notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case "notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case "notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case "completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case "logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case "prompts/get":case "prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case "resources/list":case "resources/templates/list":case "resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case "tools/call":case "tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case "tasks/get":case "tasks/list":case "tasks/result":case "tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;}}assertTaskCapability(e){SS(this._clientCapabilities?.tasks?.requests,e,"Client");}assertTaskHandlerCapability(e){this._capabilities&&wS(this._capabilities.tasks?.requests,e,"Server");}async _oninitialize(e){let n=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:fb.includes(n)?n:vh,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ll)}async createMessage(e,n){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],r=Array.isArray(o.content)?o.content:[o.content],i=r.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(r.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(r.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Rh,n):this.request({method:"sampling/createMessage",params:e},Oa,n)}async elicitInput(e,n){switch(e.mode??"form"){case "url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let r=e;return this.request({method:"elicitation/create",params:r},ko,n)}case "form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let r=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:r},ko,n);if(i.action==="accept"&&i.content&&r.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(r.requestedSchema)(i.content);if(!s.valid)throw new W(oe.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof W?a:new W(oe.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,n){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return ()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},n)}async listRoots(e,n){return this.request({method:"roots/list",params:e},Ch,n)}async sendLoggingMessage(e,n){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,n))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Dd=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e;}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
87
87
  `);if(e===-1)return null;let n=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),i1(n)}clear(){this._buffer=void 0;}};function i1(t){return bb.parse(JSON.parse(t))}function TS(t){return JSON.stringify(t)+`
88
- `}var Ad=class{constructor(e=zS.stdin,n=zS.stdout){this._stdin=e,this._stdout=n,this._readBuffer=new Dd,this._started=false,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer();},this._onerror=o=>{this.onerror?.(o);};}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=true,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror);}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e);}catch(e){this.onerror?.(e);}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.();}send(e){return new Promise(n=>{let o=TS(e);this._stdout.write(o)?n():this._stdout.once("drain",n);})}};var IS="1.14.2";le();le();le();le();var C1=1e3,N1=["summary","status","assignee","priority","issuetype","created","updated","project","customfield_10014"];function D1({status:t,detail:e}){return t===401?new ms(`Authentication failed: ${e}`):t===403?new fs(`Permission denied: ${e}`):new wt(`Jira API error (${t}): ${e}`)}var Bd=class{http;instanceUrl;constructor(e){this.instanceUrl=e.url,this.http=new Xo(e,D1);}async request(e,n,o,r){return this.http.requestJson(e,n,o,r)}async searchIssues(e,n){return ((await this.request("GET","/rest/api/3/search/jql",void 0,{jql:e,fields:(n?[...n]:N1).join(","),maxResults:String(C1)})).issues??[]).map(i=>{let a=i.fields;return {key:i.key,summary:a.summary,status:a.status?.name??"Unknown",assignee:a.assignee?.emailAddress??null,priority:a.priority?.name??"None",issueType:a.issuetype?.name??a.issueType?.name??"Unknown",created:a.created,updated:a.updated,projectKey:i.key.split("-")[0]??"",epicLink:a.customfield_10014??null}})}async getIssue(e){let n=["summary","description","creator","status","assignee","priority","issuetype","created","updated","project","comment","timetracking"],o=await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}`,void 0,{fields:n.join(",")}),r=o.fields,i=(r.comment?.comments??[]).map(a=>({id:a.id??"",author:a.author?.emailAddress??a.author?.displayName??"Unknown",authorAccountId:a.author?.accountId??null,body:a.body??null,created:a.created??""}));return {key:o.key,summary:r.summary,description:r.description??null,creator:r.creator?.emailAddress??r.creator?.displayName??"Unknown",creatorAccountId:r.creator?.accountId??null,status:r.status?.name??"Unknown",assignee:r.assignee?.emailAddress??null,priority:r.priority?.name??"None",issueType:r.issuetype?.name??r.issueType?.name??"Unknown",created:r.created,updated:r.updated,projectKey:o.key.split("-")[0]??"",comments:i,timeTracking:{originalEstimate:r.timetracking?.originalEstimate??null,remainingEstimate:r.timetracking?.remainingEstimate??null,timeSpent:r.timetracking?.timeSpent??null,originalEstimateSeconds:r.timetracking?.originalEstimateSeconds??null,remainingEstimateSeconds:r.timetracking?.remainingEstimateSeconds??null,timeSpentSeconds:r.timetracking?.timeSpentSeconds??null}}}async addComment(e,n){let o=await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/comment`,{body:n});return {id:o.id??"",author:o.author?.emailAddress??o.author?.displayName??"Unknown",authorAccountId:o.author?.accountId??null,body:o.body??null,created:o.created??""}}async deleteIssue(e){await this.request("DELETE",`/rest/api/3/issue/${encodeURIComponent(e)}`);}async deleteComment(e,n){await this.request("DELETE",`/rest/api/3/issue/${encodeURIComponent(e)}/comment/${encodeURIComponent(n)}`);}async getTransitions(e){return ((await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}/transitions`)).transitions??[]).map(o=>({id:o.id??"",name:o.name??"",toStatus:o.to?.name??""}))}async doTransition(e,n){await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/transitions`,{transition:{id:n}});}async assignIssue(e,n){await this.request("PUT",`/rest/api/3/issue/${encodeURIComponent(e)}/assignee`,{accountId:n});}async findUser(e){let o=(await this.request("GET","/rest/api/3/user/search",void 0,{query:e,maxResults:"1"}))?.[0];if(!o?.accountId)throw new wt(`User not found for email: ${e}`);return o.accountId}async getCurrentUser(){let e=await this.request("GET","/rest/api/3/myself");return {accountId:e.accountId,emailAddress:e.emailAddress??null,displayName:e.displayName??"Unknown",active:e.active}}async addWorklog(e,n,o){let r={timeSpentSeconds:n};o&&(r.comment=o);let i=await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/worklog`,r);return {id:i.id??"",timeSpent:i.timeSpent??"",timeSpentSeconds:i.timeSpentSeconds??n,created:i.created??""}}async getTimeTracking(e){let o=(await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}`,void 0,{fields:"timetracking"})).fields.timetracking;return {originalEstimate:o?.originalEstimate??null,remainingEstimate:o?.remainingEstimate??null,timeSpent:o?.timeSpent??null,originalEstimateSeconds:o?.originalEstimateSeconds??null,remainingEstimateSeconds:o?.remainingEstimateSeconds??null,timeSpentSeconds:o?.timeSpentSeconds??null}}async createIssue(e){let n=await this.request("POST","/rest/api/3/issue",{fields:e});return {key:n.key,id:n.id,url:`${this.instanceUrl}/browse/${n.key}`}}async updateIssue(e,n){await this.request("PUT",`/rest/api/3/issue/${encodeURIComponent(e)}`,{fields:n});}async getFields(){return (await this.request("GET","/rest/api/3/field")).map(n=>({id:n.id??"",name:n.name??"",custom:n.custom??false,...n.schema?.custom!==void 0?{schema:{custom:n.schema.custom}}:{}}))}async searchUsers(e,n=50){return (await this.request("GET","/rest/api/3/user/search",void 0,{query:e,maxResults:String(n)})??[]).map(r=>({accountId:r.accountId,emailAddress:r.emailAddress??null,displayName:r.displayName??"Unknown",active:r.active}))}async getProjectStatuses(e){return (await this.request("GET",`/rest/api/3/project/${encodeURIComponent(e)}/statuses`)).map(o=>({id:o.id,name:o.name,statuses:o.statuses.map(r=>({name:r.name??"",id:r.id??""}))}))}};var ei=class{byProject=new Map;byUrl=new Map;config;constructor(e){this.config=e,this.#e();}getConnector(e){let n=this.byProject.get(e);if(!n)throw new qe(`Project '${e}' not found in configuration`);return n}getConnectorForTask(e){let n=e.split("-")[0];if(!n)throw new qe(`Invalid task key format: '${e}'. Expected 'PROJECT-NUMBER'.`);return this.getConnector(n)}getInstances(){return this.byUrl}#e(){let e=new Map;for(let[n,o]of Object.entries(this.config.projects)){let r=e.get(o.url);r?r.push(n):e.set(o.url,[n]);}for(let[n,o]of e){let r=o[0];if(!r)continue;let i=this.config.projects[r];if(!i)continue;let a=new Bd(i),s={connector:a,projectKeys:o};this.byUrl.set(n,s);for(let c of o)this.byProject.set(c,a);}}};Mo();var zs="1.0",A1=_.object({key:_.string(),summary:_.string(),status:_.string(),assignee:_.string().nullable(),priority:_.string(),issue_type:_.string(),created:_.string(),updated:_.string(),project_key:_.string(),project_url:_.string().url(),epic_link:_.string().nullable()}),U1=_.object({version:_.string(),last_sync:_.string(),jira_user:_.string()}),ov=_.object({metadata:U1,tasks:_.array(A1)});le();le();function V1(t){return t.replaceAll("@","_at_").replaceAll(".","_")}var Gd=class{cacheDir;jiraUser;cachePath;constructor(e,n){this.cacheDir=e,this.jiraUser=n,this.cachePath=join(e,`tasks_${V1(n)}.json`);}async initialize(){if(await mkdir(this.cacheDir,{recursive:true,mode:448}),await Xt(this.cachePath)){try{await this.load();}catch(n){if(!(n instanceof St)){let o=n instanceof Error?n.message:String(n);throw new pr(`Existing cache is corrupted: ${o}`)}}return}let e={metadata:{version:zs,last_sync:new Date().toISOString(),jira_user:this.jiraUser},tasks:[]};await this.#e(e);}async load(){if(!await Xt(this.cachePath))throw new St(`Cache not found: ${this.cachePath}`);let e;try{e=await readFile(this.cachePath,"utf-8");}catch(r){let i=r instanceof Error?r.message:String(r);throw new St(`Failed to read cache file: ${i}`)}let n;try{n=JSON.parse(e);}catch(r){let i=r instanceof Error?r.message:String(r);throw new pr(`Cache file is corrupted (invalid JSON): ${i}`)}let o=ov.safeParse(n);if(!o.success)throw new pr(`Cache data failed validation: ${o.error.message}`);if(o.data.metadata.version!==zs)throw new pr(`Cache version ${o.data.metadata.version} !== ${zs}`);return o.data}async save(e){let n={metadata:{version:zs,last_sync:new Date().toISOString(),jira_user:this.jiraUser},tasks:[...e]},o=ov.safeParse(n);if(!o.success)throw new pr(`Task data failed validation: ${o.error.message}`);await this.#e(o.data);}async getTask(e){let o=(await this.load()).tasks.find(r=>r.key===e);if(!o)throw new Tt(`Task ${e} not found in cache`);return o}async getAllTasks(){return (await this.load()).tasks}async updateTask(e,n){let o=await this.load(),r=o.tasks.findIndex(c=>c.key===e);if(r===-1)throw new Tt(`Task ${e} not found in cache`);let i=o.tasks[r];if(!i)throw new Tt(`Task ${e} not found in cache`);let a={...i,...n,key:e,updated:new Date().toISOString()},s=[...o.tasks.slice(0,r),a,...o.tasks.slice(r+1)];return await this.save(s),a}async deleteTask(e){let n=await this.load(),o=n.tasks.filter(r=>r.key!==e);if(o.length===n.tasks.length)throw new Tt(`Task ${e} not found in cache`);await this.save(o);}async upsertTask(e){let n=[];try{n=(await this.load()).tasks;}catch(i){if(!(i instanceof St))throw i}let o=n.findIndex(i=>i.key===e.key),r=o===-1?[...n,e]:n.map((i,a)=>a===o?e:i);return await this.save(r),e}async getMetadata(){return (await this.load()).metadata}async#e(e){let n=`${this.cachePath}.tmp`,o=JSON.stringify(e,null,2);await writeFile(n,o,{encoding:"utf-8",mode:384}),await rename(n,this.cachePath);}};le();function Is(t){return t.replace(/([\\"])/g,"\\$1")}var Kd=class{#e;#t;#r;constructor(e,n,o){this.#e=e,this.#t=n,this.#r=o;}async sync(e){let n=e?.jql??`assignee = "${Is(this.#t.credentials.username)}" ORDER BY updated DESC`,o=Ld(this.#t);if(e?.projectKey){let i=this.#t.projects[e.projectKey];i&&(o=o.filter(a=>a.url===i.url));}let r=[];for(let i of o){let c=(await this.#r(i.url,i.username,i.api_token).searchIssues(n)).map(u=>this.#n(u,i.url));r.push(...c);}return await this.#e.save(r),r.length}#n(e,n){let o=e.fields.assignee?.emailAddress??null,r=e.fields.priority?.name??"None",i=e.fields.customfield_10014??null;return {key:e.key,summary:e.fields.summary,status:e.fields.status.name,assignee:o,priority:r,issue_type:e.fields.issuetype.name,created:e.fields.created,updated:e.fields.updated,project_key:e.fields.project.key,project_url:n,epic_link:i}}};le();function B1(t){let e=t;for(;;){if(existsSync(join(e,"package.json")))return e;let n=dirname(e);if(n===e)return fileURLToPath(new URL("..",import.meta.url));e=n;}}var G1=B1(dirname(fileURLToPath(import.meta.url)));join(xs,"workflows.json");join(xs,"users.json");var iv=join(Lr,"templates"),b0=join(iv,"comments"),x0=join(iv,"task-templates"),w0=join(iv,"tasks"),av=join(G1,"templates-system"),S0=join(av,"comments"),T0=join(av,"task-templates");join(av,"locales");Mo();var Fr={WORKFLOW:"workflow",COMMUNICATION:"communication",REPORTING:"reporting",DEVELOPMENT:"development"};le();var P0=/^[a-z][a-z0-9-]*$/,j0=_.object({name:_.string().regex(/^\w+$/,"Variable name must be alphanumeric/underscore"),description:_.string().default(""),required:_.boolean().default(false),default:_.string().optional(),example:_.string().optional()}),H1=_.object({kind:_.literal("comment"),id:_.string().regex(P0,"Template id must be a URL-safe slug"),name:_.string().min(1),description:_.string().min(1),category:_.enum([Fr.WORKFLOW,Fr.COMMUNICATION,Fr.REPORTING,Fr.DEVELOPMENT]),variables:_.array(j0).default([])}),W1=_.object({kind:_.literal("task"),id:_.string().regex(P0,"Template id must be a URL-safe slug"),name:_.string().min(1),description:_.string().min(1),summary:_.string().min(1),issue_type:_.string().optional(),priority:_.string().optional(),labels:_.array(_.string()).optional(),epic_key:_.string().optional(),variables:_.array(j0).default([])});function E0(t){return t.map(e=>({name:e.name,description:e.description,required:e.required,defaultValue:e.default,example:e.example}))}function O0(t,e){let n=t.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);if(!n)throw new mr(`Template file "${e}" must start with a JSON metadata block delimited by ---`);let[,o,r=""]=n;if(o===void 0)throw new mr(`Template file "${e}" is missing metadata.`);let i;try{i=JSON.parse(o);}catch(a){let s=a instanceof Error?a.message:String(a);throw new mr(`Template file "${e}" contains invalid JSON metadata: ${s}`)}return {metadata:i,body:r.trim()}}function R0(t){if(!readdirSync||!t)return [];try{return readdirSync(t).filter(e=>e.endsWith(".md")).sort().map(e=>join(t,e))}catch{return []}}function Hd(t,e){let n=[];for(let o of R0(t)){let r=readFileSync(o,"utf-8"),i=O0(r,o),a=H1.parse(i.metadata);n.push({id:a.id,name:a.name,description:a.description,category:a.category,variables:E0(a.variables),body:i.body,source:e,filePath:o});}return n}function Wd(t,e){let n=[];for(let o of R0(t)){let r=readFileSync(o,"utf-8"),i=O0(r,o),a=W1.parse(i.metadata);n.push({id:a.id,name:a.name,description:a.description,summary:a.summary,issueType:a.issue_type,priority:a.priority,labels:a.labels,epicKey:a.epic_key,variables:E0(a.variables),body:i.body,source:e,filePath:o});}return n}var C0=Hd(S0,"system");le();var Xd=class{templates;constructor(e){let n=new Map;for(let o of C0)n.set(o.id,o);if(e)for(let o of e)n.set(o.id,o);this.templates=n;}getTemplate(e){let n=this.templates.get(e);if(!n)throw new kn(`Template "${e}" not found. Use listTemplates() to see available templates.`);return n}listTemplates(e){let n=[...this.templates.values()];return e?n.filter(o=>o.category===e):n}listCategories(){let e=new Set;for(let n of this.templates.values())e.add(n.category);return [...e]}};le();var N0=Wd(T0,"system");var Yd=class{templates;constructor(e){let n=new Map;for(let o of N0)n.set(o.id,o);if(e)for(let o of e)n.set(o.id,o);this.templates=n;}getTemplate(e){let n=this.templates.get(e);if(!n)throw new kn(`Task template "${e}" not found. Use listTaskTemplates() to see available templates.`);return n}listTemplates(){return [...this.templates.values()]}};function D0(t){let e=Hd(b0,"user"),n=Wd(x0,"user");return {commentRegistry:new Xd(e),taskRegistry:new Yd(n)}}le();var sv=[{name:"sync_tasks",description:"Sync tasks from Jira to local cache. By default syncs from all configured instances. Optionally scope to a single project or provide a custom JQL query.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:"Optional project key to sync from a single instance."},jql:{type:"string",description:"Optional JQL query. If omitted, fetches tasks assigned to the current user."}}}},{name:"read_cached_tasks",description:"Read tasks from local cache without hitting the Jira API. Returns a single task when task_key is provided, or all cached tasks otherwise.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Optional task key (e.g. "PROJ-123"). If omitted, returns all cached tasks.'}}}},{name:"update_task_status",description:"Change a task status via Jira workflow transition and update the local cache.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},status:{type:"string",description:'Target status name (e.g. "In Progress", "Done"). Use get_task_statuses first to check valid transitions.'}},required:["task_key","status"]}},{name:"add_task_comment",description:"Add a markdown comment to a Jira task. The markdown is automatically converted to ADF format.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},comment:{type:"string",description:"Comment text in markdown format."},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves posting this comment."}},required:["task_key","comment"]}},{name:"delete_task",description:"Delete a Jira task, but only when the authenticated user is the task creator.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves deleting this task."}},required:["task_key"]}},{name:"delete_comment",description:"Delete a Jira comment, but only when the authenticated user is the comment author.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},comment_id:{type:"string",description:"Comment ID to delete."},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves deleting this comment."}},required:["task_key","comment_id"]}},{name:"reassign_task",description:"Reassign a task to a different user by email, or unassign by providing an empty string or omitting assignee_email.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},assignee_email:{type:"string",description:"Email of the new assignee. Empty string or omit to unassign."}},required:["task_key"]}},{name:"get_task_statuses",description:"Get available workflow transitions for a task. Call this before update_task_status to see valid target statuses.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"get_task_details",description:"Get full task details from Jira including description and all comments, with ADF content converted to markdown.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"log_task_time",description:"Log work time to a Jira task. Uses hours and minutes format only (no days). Invalidates cache after logging.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},time_spent:{type:"string",description:'Time in format "2h", "30m", or "2h 30m". Days are not supported.'},comment:{type:"string",description:"Optional work description."}},required:["task_key","time_spent"]}},{name:"get_task_time_tracking",description:"Get time tracking information for a Jira task (original estimate, time spent, remaining estimate).",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"list_comment_templates",description:"List all available comment templates with optional category filter. Returns template metadata including required variables.",inputSchema:{type:"object",properties:{category:{type:"string",description:'Optional category filter: "workflow", "communication", "reporting", or "development".',enum:["workflow","communication","reporting","development"]}}}},{name:"add_templated_comment",description:"Add a comment using a registered template (with variable substitution) or raw markdown. Provide exactly one of template_id or markdown.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},template_id:{type:"string",description:"Template identifier. Use list_comment_templates to see available templates."},variables:{type:"object",description:"Key-value map of template variables. Required when using template_id.",additionalProperties:{type:"string"}},markdown:{type:"string",description:"Raw markdown comment. Use instead of template_id for freeform comments."},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves posting this comment."}},required:["task_key"]}},{name:"create_task",description:"Create a new Jira issue with either explicit fields or a registered task template, plus optional assignee, labels, epic link, sub-task parent, and original estimate.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:'Project key (e.g. "DEVOPS"). Determines which Jira instance to use.'},summary:{type:"string",description:"Issue title / summary. Do not provide when using template_id."},description:{type:"string",description:"Optional issue description in markdown format. Automatically converted to ADF. Do not provide when using template_id."},template_id:{type:"string",description:"Task template identifier. Use list_task_templates to see available templates."},variables:{type:"object",description:"Key-value map of template variables. Required when using template_id.",additionalProperties:{type:"string"}},type:{type:"string",description:'Issue type name (default "Task"). E.g. "Bug", "Story", "Epic".'},priority:{type:"string",description:'Priority name (default "Medium"). E.g. "High", "Low", "Critical".'},assignee_email:{type:"string",description:"Email of the assignee. Resolved to Jira account ID."},labels:{type:"array",items:{type:"string"},description:"Array of label strings to apply to the issue."},epic_key:{type:"string",description:'Epic issue key to link this issue under (e.g. "PROJ-100").'},parent_key:{type:"string",description:'Parent issue key (e.g. "PROJ-69"). Required when type is a sub-task; Jira rejects sub-task creation without it.'},original_estimate:{type:"string",description:'Original estimate in format "2h", "30m", or "2h 30m". Days are not supported.'}},required:["project_key"]}},{name:"list_task_templates",description:"List all available single-task templates used by create_task. Returns template metadata including required variables.",inputSchema:{type:"object",properties:{}}},{name:"get_project_language",description:"Get the configured language for a project. Use before writing comments or descriptions to determine the correct language.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:'Project key (e.g. "DEVOPS"). Inferred from task key prefix.'}},required:["project_key"]}},{name:"update_task",description:"Update an existing Jira issue, including its original and remaining estimates. Only provided fields are changed; omitted fields are left untouched.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "DEVOPS-37"). Project is inferred from the key prefix.'},summary:{type:"string",description:"New issue title / summary."},description:{type:"string",description:"New issue description in markdown format. Automatically converted to ADF."},priority:{type:"string",description:'New priority name. E.g. "Medium", "Low", "Critical".'},labels:{type:"array",items:{type:"string"},description:"New set of label strings (replaces existing labels)."},original_estimate:{type:"string",description:'New original estimate in format "2h", "30m", or "2h 30m". Days are not supported.'},remaining_estimate:{type:"string",description:'New remaining estimate in format "2h", "30m", or "2h 30m". Days are not supported. Independent of original_estimate -- setting one leaves the other unchanged.'}},required:["task_key"]}},{name:"search_tasks",description:"Search Jira issues using JQL. Returns results directly without caching.",inputSchema:{type:"object",properties:{jql:{type:"string",description:"JQL query string."},max_results:{type:"number",description:"Maximum number of results to return (default 50)."},project_key:{type:"string",description:"Optional project key to determine which Jira instance to query. Defaults to the configured default project."}},required:["jql"]}},{name:"create_monthly_tasks",description:"Run all monthly_admin.json bulk task configs from ~/.softspark/jira-mcp/templates/tasks/<KEY>/. Defaults to dry-run. Set execute=true to actually create the tasks. Optionally filter to a single project key.",inputSchema:{type:"object",properties:{execute:{type:"boolean",description:"When true, create tasks for real. When false or omitted, run a dry-run preview."},project:{type:"string",description:"Optional project key (case-insensitive) to restrict execution to a single project subdirectory."}}}}];le();le();le();var X1=/(\d+)\s*h/i,Y1=/(\d+)\s*m/i,Q1=/\d+\s*d/i;function xn(t){let e=t.trim();if(e.length===0)throw new Error("Invalid time format: empty string. Use: '2h', '30m', or '2h 30m'");if(Q1.test(e))throw new Error("Days (d) not supported. Use hours (h) and minutes (m) only. Example: '2h', '30m', or '2h 30m'");let n=0,o=X1.exec(e);o?.[1]&&(n+=parseInt(o[1],10)*3600);let r=Y1.exec(e);if(r?.[1]&&(n+=parseInt(r[1],10)*60),n===0)throw new Error(`Invalid time format: '${t}'. Use: '2h', '30m', or '2h 30m'`);return n}le();var Qd=class{constructor(e,n){this.connector=e;this.cacheManager=n;}connector;cacheManager;async changeStatus(e,n){let o=await this.connector.getTransitions(e),r=o.find(a=>a.toStatus.toLowerCase()===n.toLowerCase())??o.find(a=>a.name.toLowerCase()===n.toLowerCase());if(!r){let a=o.map(s=>`${s.name} -> ${s.toStatus}`).join(", ");throw new wt(`Status '${n}' not available for ${e}. Available transitions: ${a}`)}await this.connector.doTransition(e,r.id);let i=await this.#e(e,{status:r.toStatus||n});return {taskKey:e,updatedTask:i}}async getAvailableStatuses(e){return (await this.connector.getTransitions(e)).map(o=>({id:o.id,name:o.name,toStatus:o.toStatus}))}async addComment(e,n){let o=zt(n),r=await this.connector.addComment(e,o);return {taskKey:e,commentId:r.id,author:r.author,bodyMarkdown:Wo(r.body),created:r.created}}async deleteComment(e,n){let o=await this.connector.getCurrentUser(),i=(await this.connector.getIssue(e)).comments.find(a=>a.id===n);if(!i)throw new _s(`Comment ${n} not found on ${e}.`);if(i.authorAccountId==null||i.authorAccountId!==o.accountId)throw new Vo(`Comment ${n} on ${e} can only be deleted by its author.`);return await this.connector.deleteComment(e,n),{taskKey:e,commentId:n}}async reassign(e,n){if(n){let r=await this.connector.findUser(n);await this.connector.assignIssue(e,r);}else await this.connector.assignIssue(e,null);let o=await this.#e(e,{assignee:n??null});return {taskKey:e,updatedTask:o}}async getTaskDetails(e){let n=await this.connector.getIssue(e),o=n.comments.map(r=>({id:r.id,author:r.author,body:Wo(r.body),created:r.created}));return {key:n.key,summary:n.summary,description:Wo(n.description),status:n.status,assignee:n.assignee,priority:n.priority,issueType:n.issueType,created:n.created,updated:n.updated,comments:o}}async deleteTask(e){let n=await this.connector.getCurrentUser(),o=await this.connector.getIssue(e);if(o.creatorAccountId==null||o.creatorAccountId!==n.accountId)throw new Vo(`Task ${e} can only be deleted by its creator.`);await this.connector.deleteIssue(e);try{await this.cacheManager.deleteTask(e);}catch(r){if(!(r instanceof Tt||r instanceof St))throw r}return {taskKey:e}}async logTime(e,n,o){let r=xn(n),i=o?zt(o):void 0,a=await this.connector.addWorklog(e,r,i);try{await this.cacheManager.deleteTask(e);}catch(s){if(!(s instanceof Tt||s instanceof St))throw s}return {taskKey:e,worklogId:a.id,timeSpent:n,timeSpentSeconds:a.timeSpentSeconds}}async getTimeTracking(e){let n=await this.connector.getTimeTracking(e);return {taskKey:e,originalEstimate:n.originalEstimate,remainingEstimate:n.remainingEstimate,timeSpent:n.timeSpent}}async#e(e,n){try{return await this.cacheManager.updateTask(e,n)}catch(o){if(!(o instanceof Tt||o instanceof St))throw o;let r=await this.connector.getIssue(e),i={key:r.key,summary:r.summary,status:r.status,assignee:r.assignee,priority:r.priority,issue_type:r.issueType,created:r.created,updated:r.updated,project_key:r.projectKey,project_url:this.connector.instanceUrl,epic_link:null,...n};return await this.cacheManager.upsertTask(i)}}};function je(t,e,n){let o=t.getConnectorForTask(n);return new Qd(o,e)}async function A0(t,e){try{let n={...t.jql?{jql:t.jql}:{},...t.project_key?{projectKey:t.project_key}:{}},o=await e.syncer.sync(n);return K({tasks_synced:o,message:`Synced ${o} tasks`})}catch(n){return M(n)}}async function U0(t,e){try{if(t.task_key){let o=await e.cacheManager.getTask(t.task_key);return K({task:o})}let n=await e.cacheManager.getAllTasks();return K({tasks:n,count:n.length})}catch(n){return M(n)}}async function Z0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).changeStatus(t.task_key,t.status);return K({task:o.updatedTask,message:`Updated ${t.task_key} status to '${t.status}'`})}catch(n){return M(n)}}le();async function M0(t,e){try{Yo(t.user_approved);let o=await je(e.pool,e.cacheManager,t.task_key).addComment(t.task_key,t.comment);return K({comment:{id:o.commentId,author:o.author,body:o.bodyMarkdown,created:o.created},message:`Added comment to ${t.task_key}`})}catch(n){return M(n)}}le();async function L0(t,e){try{Qo(t.user_approved);let o=await je(e.pool,e.cacheManager,t.task_key).deleteTask(t.task_key);return K({deleted:{task_key:o.taskKey},message:`Deleted task ${t.task_key}`})}catch(n){return M(n)}}le();async function q0(t,e){try{Qo(t.user_approved);let o=await je(e.pool,e.cacheManager,t.task_key).deleteComment(t.task_key,t.comment_id);return K({deleted:{task_key:o.taskKey,comment_id:o.commentId},message:`Deleted comment ${t.comment_id} from ${t.task_key}`})}catch(n){return M(n)}}async function F0(t,e){try{let n=je(e.pool,e.cacheManager,t.task_key),o=t.assignee_email?.trim()||null,r=await n.reassign(t.task_key,o),i=o?`Reassigned ${t.task_key} to ${o}`:`Unassigned ${t.task_key}`;return K({task:r.updatedTask,message:i})}catch(n){return M(n)}}async function V0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).getAvailableStatuses(t.task_key);return K({task_key:t.task_key,statuses:o.map(r=>({id:r.id,name:r.name,to_status:r.toStatus}))})}catch(n){return M(n)}}async function J0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).getTaskDetails(t.task_key),r=t.task_key.split("-")[0]??"",i=e.config.projects[r]?.language??e.config.default_language;return K({task:o,language:i,message:`Retrieved details for ${t.task_key}`})}catch(n){return M(n)}}async function B0(t,e){try{let n=e.config.projects[t.project_key],o=n?.language??e.config.default_language;return K({project_key:t.project_key,language:o,source:n?.language?"project":"default",message:`Project ${t.project_key} language: ${o}`})}catch(n){return M(n)}}async function G0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).logTime(t.task_key,t.time_spent,t.comment);return K({message:`Logged ${t.time_spent} to ${t.task_key}`,worklog_id:o.worklogId,time_spent:o.timeSpent,time_spent_seconds:o.timeSpentSeconds})}catch(n){return M(n)}}async function K0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).getTimeTracking(t.task_key);return K({task_key:t.task_key,time_tracking:{original_estimate:o.originalEstimate,time_spent:o.timeSpent,remaining_estimate:o.remainingEstimate},message:`Retrieved time tracking for ${t.task_key}`})}catch(n){return M(n)}}function eA(t){return Object.values(Fr).includes(t)}async function H0(t,e){try{let n;if(t.category){if(!eA(t.category)){let i=Object.values(Fr).join(", ");return M(new Error(`Invalid category '${t.category}'. Valid categories: ${i}`))}n=t.category;}let o=e.templateRegistry.listTemplates(n),r=e.templateRegistry.listCategories();return K({templates:o.map(i=>({id:i.id,name:i.name,description:i.description,category:i.category,source:i.source??"system",file_path:i.filePath,variables:i.variables.map(a=>({name:a.name,description:a.description,required:a.required,example:a.example}))})),categories:r,count:o.length})}catch(n){return M(n)}}async function W0(t,e){try{let n=e.taskTemplateRegistry.listTemplates();return K({templates:n.map(o=>({id:o.id,name:o.name,description:o.description,summary:o.summary,issue_type:o.issueType??"Task",priority:o.priority??"Medium",labels:o.labels??[],source:o.source??"system",file_path:o.filePath,variables:o.variables.map(r=>({name:r.name,description:r.description,required:r.required,example:r.example}))})),count:n.length})}catch(n){return M(n)}}le();le();async function X0(t,e){try{if(Yo(t.user_approved),t.template_id&&t.markdown)return M(new Error("Provide either template_id or markdown, not both."));if(!t.template_id&&!t.markdown)return M(new Error("Provide either template_id (with variables) or markdown."));let n,o;if(t.template_id){let a=e.templateRegistry.getTemplate(t.template_id),s=bn(a,t.variables??{});if(!s.success)return M(new Error(s.error));n=s.markdown,o={template_id:a.id,template_name:a.name};}else n=t.markdown??"";let i=await je(e.pool,e.cacheManager,t.task_key).addComment(t.task_key,n);return K({comment:{id:i.commentId,author:i.author,body:i.bodyMarkdown,created:i.created},...o?{template:o}:{},message:`Added comment to ${t.task_key}`})}catch(n){return M(n)}}le();le();async function tA(t){return (await t.getFields()).find(o=>o.custom&&o.name.toLowerCase()==="epic link")?.id}async function Y0(t,e){try{let n=t.template_id!==void 0;if(n&&(t.summary!==""||t.description!==void 0))return M(new Error("When template_id is provided, do not also provide summary or description."));if(!n&&t.summary.trim()==="")return M(new Error("Provide either template_id (with variables) or a non-empty summary."));let o=e.pool.getConnector(t.project_key),r=t.summary,i=t.description,a=t.type,s=t.priority,c=t.labels,u=t.epic_key,l;if(n){let m=e.taskTemplateRegistry.getTemplate(t.template_id??""),h=bn({variables:m.variables,body:m.summary},t.variables??{});if(!h.success)return M(new Error(h.error));let v=bn({variables:m.variables,body:m.body},t.variables??{});if(!v.success)return M(new Error(v.error));r=h.markdown,i=v.markdown===""?void 0:v.markdown,a=t.type??m.issueType,s=t.priority??m.priority,c=t.labels??m.labels,u=t.epic_key??m.epicKey,l={template_id:m.id,template_name:m.name,source:m.source??"system"};}let d={project:{key:t.project_key},summary:r,issuetype:{name:a??"Task"},priority:{name:s??"Medium"}};if(i&&(d.description=zt(i)),c&&c.length>0&&(d.labels=c),t.assignee_email){let m=await o.findUser(t.assignee_email);d.assignee={accountId:m};}if(t.parent_key&&(d.parent={key:t.parent_key}),t.original_estimate&&(xn(t.original_estimate),d.timetracking={originalEstimate:t.original_estimate}),u){let m=await tA(o);m&&(d[m]=u);}let p=await o.createIssue(d);return K({issue_key:p.key,url:p.url,summary:r,...l?{template:l}:{},message:`Created ${p.key}: ${r}`})}catch(n){return M(n)}}le();async function Q0(t,e){try{let n=t.task_key.split("-")[0]??"",o=e.pool.getConnector(n),r={};t.summary!==void 0&&(r.summary=t.summary),t.description!==void 0&&(r.description=zt(t.description)),t.priority!==void 0&&(r.priority={name:t.priority}),t.labels!==void 0&&(r.labels=t.labels);let i={};if(t.original_estimate!==void 0&&(xn(t.original_estimate),i.originalEstimate=t.original_estimate),t.remaining_estimate!==void 0&&(xn(t.remaining_estimate),i.remainingEstimate=t.remaining_estimate),Object.keys(i).length>0&&(r.timetracking=i),Object.keys(r).length===0)return M(new Error("No fields to update. Provide at least one of: summary, description, priority, labels, original_estimate, remaining_estimate."));await o.updateIssue(t.task_key,r);let a=Object.keys(r).join(", ");return K({task_key:t.task_key,updated_fields:a,message:`Updated ${t.task_key}: ${a}`})}catch(n){return M(n)}}var rA=50,nA=["summary","status","assignee","priority","issuetype","created","updated","project","customfield_10014"];async function eT(t,e){try{let n=t.project_key??e.config.default_project,o=e.pool.getConnector(n),r=t.max_results??rA,i=await o.searchIssues(t.jql,nA),a=i.slice(0,r);return K({results:a,count:a.length,total_available:i.length,message:`Found ${a.length} issue(s) matching JQL query`})}catch(n){return M(n)}}Mo();le();var oA=_.object({summary:_.string().min(1,"Summary is required").max(255),description:_.string().optional().default(""),type:_.string().default("Task"),assignee:_.string().email("Invalid assignee email format").optional(),priority:_.enum(["Highest","High","Medium","Low","Lowest"]).default("Medium"),labels:_.array(_.string()).default([]),estimate_hours:_.number().positive("Estimate must be positive").optional(),status:_.union([_.string(),_.array(_.string().min(1)).min(1,"Status path must not be empty")]).optional()}).catchall(_.string().optional()),iA=_.object({dry_run:_.boolean().default(true),update_existing:_.boolean().default(false),match_field:_.string().default("summary"),rate_limit_ms:_.number().int().min(0).default(500),force_reassign:_.boolean().default(false),reassign_delay_ms:_.number().int().min(0).default(0),language:Zt.default(Yt)}),tT=_.object({epic_key:_.string().regex(/^[A-Z][A-Z0-9]*-\d+$/,"Invalid epic key format (e.g., PROJ-123)"),tasks:_.array(oA).min(1,"At least one task is required"),options:iA.default(()=>({dry_run:true,update_existing:false,match_field:"summary",rate_limit_ms:500,force_reassign:false,reassign_delay_ms:0,language:Yt}))});function aA(t){let e=new Date;return {MONTH:`${String(e.getMonth()+1).padStart(2,"0")}.${e.getFullYear()}`,YEAR:String(e.getFullYear()),DATE:e.toISOString().slice(0,10)}}function rT(t,e){let n=aA(),o=JSON.stringify(t);return o=o.replaceAll("{MONTH}",n.MONTH),o=o.replaceAll("{YEAR}",n.YEAR),o=o.replaceAll("{DATE}",n.DATE),JSON.parse(o)}le();le();function nT(t){return new Promise(e=>setTimeout(e,t))}var cv=class extends Pe{constructor(e){super(e,"EPIC_NOT_FOUND"),this.name="EpicNotFoundError";}},ep=class extends Pe{constructor(e){super(e,"EPIC_LINK_FIELD_NOT_FOUND"),this.name="EpicLinkFieldNotFoundError";}},tp=class{constructor(e,n){this.connector=e;this.projectKey=n;}connector;projectKey;epicLinkFieldId=null;assigneeCache=new Map;async execute(e){let n=Date.now(),o=e.epic_key,r=e.options;if(!await this.validateEpic(o))throw new cv(`Epic '${o}' not found or not accessible`);this.epicLinkFieldId=await this.discoverEpicLinkField();let a=new Set;for(let l of e.tasks)l.assignee&&a.add(l.assignee);for(let l of a)try{await this.resolveAssignee(l);}catch{}let s=[];for(let l=0;l<e.tasks.length;l++){l>0&&r.rate_limit_ms>0&&await nT(r.rate_limit_ms);let d=e.tasks[l];if(!d)continue;let p=await this.processTask(d,o,r);s.push(p);}let c=sA(s),u=Date.now()-n;return {results:s,summary:c,dry_run:r.dry_run,total_time_ms:u}}async validateEpic(e){try{return await this.connector.getIssue(e),!0}catch{return false}}async discoverEpicLinkField(){let e;try{e=await this.connector.getFields();}catch(n){let o=n instanceof Error?n.message:String(n);throw new ep(`Failed to fetch fields from Jira: ${o}`)}for(let n of e){if(n.name.toLowerCase().includes("epic link"))return n.id;let r=n.schema?.custom??"";if(r.includes("epic-link")||r.includes("gh-epic-link"))return n.id}throw new ep("Epic Link custom field not found. Ensure Jira instance has Epic support enabled.")}async resolveAssignee(e){let n=this.assigneeCache.get(e);if(n!==void 0)return n;let o=await this.connector.findUser(e);return this.assigneeCache.set(e,o),o}async processTask(e,n,o){let r=this.selectSummary(e,o.language);if(o.dry_run)return {summary:r,issue_key:null,action:"preview",error:null,url:null,warning:null};try{let i=await this.findExistingTask(r,this.projectKey);if(i!==null){if(o.update_existing){let c=await this.updateTask(i,e,n,this.epicLinkFieldId,o);return {summary:r,issue_key:i,action:"updated",error:null,url:`${this.connector.instanceUrl}/browse/${i}`,warning:c}}return {summary:r,issue_key:i,action:"skipped",error:null,url:`${this.connector.instanceUrl}/browse/${i}`,warning:null}}let a=await this.createTask(e,n,this.epicLinkFieldId,o),s=e.status?await this.applyStatusPath(a.key,e.status):null;return o.force_reassign&&e.assignee&&await this.forceReassign(a.key,e.assignee,o.reassign_delay_ms),{summary:r,issue_key:a.key,action:"created",error:null,url:a.url,warning:s}}catch(i){let a=i instanceof Error?i.message:String(i);return {summary:r,issue_key:null,action:"failed",error:a,url:null,warning:null}}}async createTask(e,n,o,r){let i=this.selectSummary(e,r.language),a=this.selectDescription(e,r.language),s={project:{key:this.projectKey},summary:i,issuetype:{name:e.type??"Task"},priority:{name:e.priority??"Medium"}};if(a&&(s.description=zt(a)),e.labels&&e.labels.length>0&&(s.labels=[...e.labels]),e.estimate_hours&&(s.timetracking={originalEstimate:`${e.estimate_hours}h`}),e.assignee){let u=this.assigneeCache.get(e.assignee);if(u!==void 0)s.assignee={accountId:u};else throw new wt(`Assignee not resolved: ${e.assignee}`)}o&&(s[o]=n);let c=await this.connector.createIssue(s);return {key:c.key,url:c.url}}async updateTask(e,n,o,r,i){let a=this.selectDescription(n,i.language),s={};if(a&&(s.description=zt(a)),n.priority&&(s.priority={name:n.priority}),n.labels&&n.labels.length>0&&(s.labels=[...n.labels]),n.estimate_hours&&(s.timetracking={originalEstimate:`${n.estimate_hours}h`}),n.assignee){let c=this.assigneeCache.get(n.assignee);c!==void 0&&(s.assignee={accountId:c});}return r&&(s[r]=o),Object.keys(s).length>0&&await this.connector.updateIssue(e,s),n.status?this.applyStatusPath(e,n.status):null}async findExistingTask(e,n){try{let o=Is(`"${e}"`),r=`project = "${Is(n)}" AND summary ~ "${o}"`;return (await this.connector.searchIssues(r)).find(s=>s.summary===e)?.key??null}catch{return null}}async applyStatusPath(e,n){let o=typeof n=="string"?[n]:n;for(let[r,i]of o.entries()){let a;try{a=await this.connector.getTransitions(e);}catch(c){let u=c instanceof Error?c.message:String(c);return `Could not read transitions while moving to "${i}": ${u}`}let s=a.find(c=>c.toStatus.toLowerCase()===i.toLowerCase());if(!s){let c=a.map(l=>l.toStatus).join(", "),u=r===0?"":` (stopped after reaching "${o[r-1]??""}")`;return `Status "${i}" is not reachable${u}. Available from here: ${c||"(none)"}`}try{await this.connector.doTransition(e,s.id);}catch(c){let u=c instanceof Error?c.message:String(c);return `Transition "${s.name}" to "${i}" failed: ${u}`}}return null}async forceReassign(e,n,o){let r=this.assigneeCache.get(n);if(r!==void 0){o>0&&await nT(o);try{await this.connector.assignIssue(e,r);}catch{}}}selectSummary(e,n){if(n!==Yt){let o=e[`summary_${n}`];if(o)return o}return e.summary}selectDescription(e,n){if(n!==Yt){let o=e[`description_${n}`];if(o)return o}return e.description||void 0}};function sA(t){let e=0,n=0,o=0,r=0,i=0;for(let a of t)switch(a.action){case "created":e++;break;case "updated":n++;break;case "failed":o++;break;case "skipped":r++;break;case "preview":i++;break}return {created:e,updated:n,failed:o,skipped:r,previewed:i}}le();le();async function cA(t,e){let{readdir:n,stat:o,access:r}=await import('fs/promises'),{join:i}=await import('path'),a=w0,s=[],c;try{let u=await n(a);c=(await Promise.all(u.map(async d=>{let p=await o(i(a,d));return {name:d,isDir:p.isDirectory()}}))).filter(d=>d.isDir).map(d=>d.name);}catch{return []}for(let u of c){if(t&&u.toUpperCase()!==t.toUpperCase())continue;let l=i(a,u,"monthly_admin.json");try{await r(l),s.push({projectKey:u.toUpperCase(),configPath:l});}catch{}}return s.sort((u,l)=>u.projectKey.localeCompare(l.projectKey)),s}async function oT(t,e){let{readFile:n}=await import('fs/promises'),o=await cA(t.project);if(o.length===0)return {configs:[],totalProcessed:0,totalFailed:0};let i=await(Go)(),s=((l=>new ei(l)))(i),c=[],u=0;for(let l of o)try{let d=await n(l.configPath,"utf-8"),p=JSON.parse(d),m=tT.safeParse(p);if(!m.success){c.push({projectKey:l.projectKey,configPath:l.configPath,error:`Invalid config: ${m.error.message}`}),u++;continue}let h=rT(m.data),z="language"in(p.options??{}),A=h.epic_key.split("-")[0]??"",R=i.projects[A]?.language??i.default_language,q={...h,options:{...h.options,dry_run:t.execute!==!0,...!z&&R?{language:R}:{}}};if(!A){c.push({projectKey:l.projectKey,configPath:l.configPath,error:`Invalid epic_key format: '${q.epic_key}'`}),u++;continue}let Z=s.getConnector(A),ti=await(e?.createBulkCreator??((ri,Vr)=>new tp(ri,Vr)))(Z,A).execute(q);c.push({projectKey:l.projectKey,configPath:l.configPath,result:ti});}catch(d){let p=d instanceof Error?d.message:String(d);c.push({projectKey:l.projectKey,configPath:l.configPath,error:p}),u++;}return {configs:c,totalProcessed:o.length,totalFailed:u}}function uA(t){if(t.error)return {project_key:t.projectKey,config_path:t.configPath,status:"error",error:t.error};if(t.result){let e=t.result.results.filter(n=>n.warning!==null).map(n=>`${n.issue_key??n.summary}: ${n.warning??""}`);return {project_key:t.projectKey,config_path:t.configPath,status:"success",summary:t.result.summary,dry_run:t.result.dry_run,...e.length>0?{warnings:e}:{}}}return {project_key:t.projectKey,config_path:t.configPath,status:"error",error:"No result and no error reported."}}function lA(t,e){return {execute:e,total_processed:t.totalProcessed,total_failed:t.totalFailed,total_succeeded:t.totalProcessed-t.totalFailed,configs:t.configs.map(uA)}}async function iT(t,e){try{let n=await oT({execute:t.execute,project:t.project},e?.createMonthlyDeps);return K(lA(n,t.execute===!0))}catch(n){return M(n)}}function dA(t){return {instanceUrl:t.instanceUrl,async searchIssues(e){return (await t.searchIssues(e)).map(o=>({key:o.key,fields:{summary:o.summary,status:{name:o.status},assignee:o.assignee?{emailAddress:o.assignee}:null,priority:o.priority?{name:o.priority}:null,issuetype:{name:o.issueType},created:o.created,updated:o.updated,project:{key:o.projectKey},customfield_10014:o.epicLink}}))}}}function aT(){return new Nd({name:"@softspark/jira-mcp",version:IS},{capabilities:{tools:{}}})}async function pA(){let t=await Go(),e=new ei(t),{GLOBAL_CACHE_DIR:n}=await Promise.resolve().then(()=>(le(),_0)),o=new Gd(n,t.credentials.username);await o.initialize();let{commentRegistry:r,taskRegistry:i}=D0(),a=new Kd(o,t,(u,l,d)=>dA(e.getConnector(mA(t,u)??""))),s=aT();s.setRequestHandler(Eh,()=>({tools:sv})),s.setRequestHandler(ja,async u=>{let{name:l}=u.params,d=u.params.arguments??{};switch(l){case "sync_tasks":return A0({project_key:ke(d.project_key),jql:ke(d.jql)},{syncer:a});case "read_cached_tasks":return U0({task_key:ke(d.task_key)},{cacheManager:o});case "update_task_status":return Z0({task_key:Ie(d.task_key,"task_key"),status:Ie(d.status,"status")},{pool:e,cacheManager:o});case "add_task_comment":return M0({task_key:Ie(d.task_key,"task_key"),comment:Ie(d.comment,"comment"),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o});case "delete_task":return L0({task_key:Ie(d.task_key,"task_key"),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o});case "delete_comment":return q0({task_key:Ie(d.task_key,"task_key"),comment_id:Ie(d.comment_id,"comment_id"),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o});case "reassign_task":return F0({task_key:Ie(d.task_key,"task_key"),assignee_email:ke(d.assignee_email)},{pool:e,cacheManager:o});case "get_task_statuses":return V0({task_key:Ie(d.task_key,"task_key")},{pool:e,cacheManager:o});case "get_task_details":return J0({task_key:Ie(d.task_key,"task_key")},{pool:e,cacheManager:o,config:t});case "log_task_time":return G0({task_key:Ie(d.task_key,"task_key"),time_spent:Ie(d.time_spent,"time_spent"),comment:ke(d.comment)},{pool:e,cacheManager:o});case "get_task_time_tracking":return K0({task_key:Ie(d.task_key,"task_key")},{pool:e,cacheManager:o});case "list_comment_templates":return H0({category:ke(d.category)},{templateRegistry:r});case "add_templated_comment":return X0({task_key:Ie(d.task_key,"task_key"),template_id:ke(d.template_id),variables:Ts(d.variables),markdown:ke(d.markdown),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o,templateRegistry:r});case "create_task":return Y0({project_key:Ie(d.project_key,"project_key"),summary:ke(d.summary)??"",description:ke(d.description),template_id:ke(d.template_id),variables:Ts(d.variables),type:ke(d.type),priority:ke(d.priority),assignee_email:ke(d.assignee_email),labels:Ss(d.labels),epic_key:ke(d.epic_key),parent_key:ke(d.parent_key),original_estimate:ke(d.original_estimate)},{pool:e,cacheManager:o,taskTemplateRegistry:i});case "list_task_templates":return W0({},{taskTemplateRegistry:i});case "get_project_language":return B0({project_key:Ie(d.project_key,"project_key")},{config:t});case "update_task":return Q0({task_key:Ie(d.task_key,"task_key"),summary:ke(d.summary),description:ke(d.description),priority:ke(d.priority),labels:Ss(d.labels),original_estimate:ke(d.original_estimate),remaining_estimate:ke(d.remaining_estimate)},{pool:e});case "search_tasks":return eT({jql:Ie(d.jql,"jql"),max_results:Jd(d.max_results),project_key:ke(d.project_key)},{pool:e,config:t});case "create_monthly_tasks":return iT({execute:qr(d.execute),project:ke(d.project)});default:return M(new Error(`Unknown tool: ${l}`))}});let c=new Ad;await s.connect(c);}function mA(t,e){for(let[n,o]of Object.entries(t.projects))if(o.url===e)return n}export{aT as createServer,pA as startServer};//# sourceMappingURL=index.js.map
88
+ `}var Ad=class{constructor(e=zS.stdin,n=zS.stdout){this._stdin=e,this._stdout=n,this._readBuffer=new Dd,this._started=false,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer();},this._onerror=o=>{this.onerror?.(o);};}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=true,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror);}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e);}catch(e){this.onerror?.(e);}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.();}send(e){return new Promise(n=>{let o=TS(e);this._stdout.write(o)?n():this._stdout.once("drain",n);})}};var IS="1.14.3";le();le();le();le();var C1=1e3,N1=["summary","status","assignee","priority","issuetype","created","updated","project","customfield_10014"];function D1({status:t,detail:e}){return t===401?new ms(`Authentication failed: ${e}`):t===403?new fs(`Permission denied: ${e}`):new wt(`Jira API error (${t}): ${e}`)}var Bd=class{http;instanceUrl;constructor(e){this.instanceUrl=e.url,this.http=new Xo(e,D1);}async request(e,n,o,r){return this.http.requestJson(e,n,o,r)}async searchIssues(e,n){return ((await this.request("GET","/rest/api/3/search/jql",void 0,{jql:e,fields:(n?[...n]:N1).join(","),maxResults:String(C1)})).issues??[]).map(i=>{let a=i.fields;return {key:i.key,summary:a.summary,status:a.status?.name??"Unknown",assignee:a.assignee?.emailAddress??null,priority:a.priority?.name??"None",issueType:a.issuetype?.name??a.issueType?.name??"Unknown",created:a.created,updated:a.updated,projectKey:i.key.split("-")[0]??"",epicLink:a.customfield_10014??null}})}async getIssue(e){let n=["summary","description","creator","status","assignee","priority","issuetype","created","updated","project","comment","timetracking"],o=await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}`,void 0,{fields:n.join(",")}),r=o.fields,i=(r.comment?.comments??[]).map(a=>({id:a.id??"",author:a.author?.emailAddress??a.author?.displayName??"Unknown",authorAccountId:a.author?.accountId??null,body:a.body??null,created:a.created??""}));return {key:o.key,summary:r.summary,description:r.description??null,creator:r.creator?.emailAddress??r.creator?.displayName??"Unknown",creatorAccountId:r.creator?.accountId??null,status:r.status?.name??"Unknown",assignee:r.assignee?.emailAddress??null,priority:r.priority?.name??"None",issueType:r.issuetype?.name??r.issueType?.name??"Unknown",created:r.created,updated:r.updated,projectKey:o.key.split("-")[0]??"",comments:i,timeTracking:{originalEstimate:r.timetracking?.originalEstimate??null,remainingEstimate:r.timetracking?.remainingEstimate??null,timeSpent:r.timetracking?.timeSpent??null,originalEstimateSeconds:r.timetracking?.originalEstimateSeconds??null,remainingEstimateSeconds:r.timetracking?.remainingEstimateSeconds??null,timeSpentSeconds:r.timetracking?.timeSpentSeconds??null}}}async addComment(e,n){let o=await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/comment`,{body:n});return {id:o.id??"",author:o.author?.emailAddress??o.author?.displayName??"Unknown",authorAccountId:o.author?.accountId??null,body:o.body??null,created:o.created??""}}async deleteIssue(e){await this.request("DELETE",`/rest/api/3/issue/${encodeURIComponent(e)}`);}async deleteComment(e,n){await this.request("DELETE",`/rest/api/3/issue/${encodeURIComponent(e)}/comment/${encodeURIComponent(n)}`);}async getTransitions(e){return ((await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}/transitions`)).transitions??[]).map(o=>({id:o.id??"",name:o.name??"",toStatus:o.to?.name??""}))}async doTransition(e,n){await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/transitions`,{transition:{id:n}});}async assignIssue(e,n){await this.request("PUT",`/rest/api/3/issue/${encodeURIComponent(e)}/assignee`,{accountId:n});}async findUser(e){let o=(await this.request("GET","/rest/api/3/user/search",void 0,{query:e,maxResults:"1"}))?.[0];if(!o?.accountId)throw new wt(`User not found for email: ${e}`);return o.accountId}async getCurrentUser(){let e=await this.request("GET","/rest/api/3/myself");return {accountId:e.accountId,emailAddress:e.emailAddress??null,displayName:e.displayName??"Unknown",active:e.active}}async addWorklog(e,n,o){let r={timeSpentSeconds:n};o&&(r.comment=o);let i=await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/worklog`,r);return {id:i.id??"",timeSpent:i.timeSpent??"",timeSpentSeconds:i.timeSpentSeconds??n,created:i.created??""}}async getTimeTracking(e){let o=(await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}`,void 0,{fields:"timetracking"})).fields.timetracking;return {originalEstimate:o?.originalEstimate??null,remainingEstimate:o?.remainingEstimate??null,timeSpent:o?.timeSpent??null,originalEstimateSeconds:o?.originalEstimateSeconds??null,remainingEstimateSeconds:o?.remainingEstimateSeconds??null,timeSpentSeconds:o?.timeSpentSeconds??null}}async createIssue(e){let n=await this.request("POST","/rest/api/3/issue",{fields:e});return {key:n.key,id:n.id,url:`${this.instanceUrl}/browse/${n.key}`}}async updateIssue(e,n){await this.request("PUT",`/rest/api/3/issue/${encodeURIComponent(e)}`,{fields:n});}async getFields(){return (await this.request("GET","/rest/api/3/field")).map(n=>({id:n.id??"",name:n.name??"",custom:n.custom??false,...n.schema?.custom!==void 0?{schema:{custom:n.schema.custom}}:{}}))}async searchUsers(e,n=50){return (await this.request("GET","/rest/api/3/user/search",void 0,{query:e,maxResults:String(n)})??[]).map(r=>({accountId:r.accountId,emailAddress:r.emailAddress??null,displayName:r.displayName??"Unknown",active:r.active}))}async getProjectStatuses(e){return (await this.request("GET",`/rest/api/3/project/${encodeURIComponent(e)}/statuses`)).map(o=>({id:o.id,name:o.name,statuses:o.statuses.map(r=>({name:r.name??"",id:r.id??""}))}))}};var ei=class{byProject=new Map;byUrl=new Map;config;constructor(e){this.config=e,this.#e();}getConnector(e){let n=this.byProject.get(e);if(!n)throw new qe(`Project '${e}' not found in configuration`);return n}getConnectorForTask(e){let n=e.split("-")[0];if(!n)throw new qe(`Invalid task key format: '${e}'. Expected 'PROJECT-NUMBER'.`);return this.getConnector(n)}getInstances(){return this.byUrl}#e(){let e=new Map;for(let[n,o]of Object.entries(this.config.projects)){let r=e.get(o.url);r?r.push(n):e.set(o.url,[n]);}for(let[n,o]of e){let r=o[0];if(!r)continue;let i=this.config.projects[r];if(!i)continue;let a=new Bd(i),s={connector:a,projectKeys:o};this.byUrl.set(n,s);for(let c of o)this.byProject.set(c,a);}}};Mo();var zs="1.0",A1=_.object({key:_.string(),summary:_.string(),status:_.string(),assignee:_.string().nullable(),priority:_.string(),issue_type:_.string(),created:_.string(),updated:_.string(),project_key:_.string(),project_url:_.string().url(),epic_link:_.string().nullable()}),U1=_.object({version:_.string(),last_sync:_.string(),jira_user:_.string()}),ov=_.object({metadata:U1,tasks:_.array(A1)});le();le();function V1(t){return t.replaceAll("@","_at_").replaceAll(".","_")}var Gd=class{cacheDir;jiraUser;cachePath;constructor(e,n){this.cacheDir=e,this.jiraUser=n,this.cachePath=join(e,`tasks_${V1(n)}.json`);}async initialize(){if(await mkdir(this.cacheDir,{recursive:true,mode:448}),await Xt(this.cachePath)){try{await this.load();}catch(n){if(!(n instanceof St)){let o=n instanceof Error?n.message:String(n);throw new pr(`Existing cache is corrupted: ${o}`)}}return}let e={metadata:{version:zs,last_sync:new Date().toISOString(),jira_user:this.jiraUser},tasks:[]};await this.#e(e);}async load(){if(!await Xt(this.cachePath))throw new St(`Cache not found: ${this.cachePath}`);let e;try{e=await readFile(this.cachePath,"utf-8");}catch(r){let i=r instanceof Error?r.message:String(r);throw new St(`Failed to read cache file: ${i}`)}let n;try{n=JSON.parse(e);}catch(r){let i=r instanceof Error?r.message:String(r);throw new pr(`Cache file is corrupted (invalid JSON): ${i}`)}let o=ov.safeParse(n);if(!o.success)throw new pr(`Cache data failed validation: ${o.error.message}`);if(o.data.metadata.version!==zs)throw new pr(`Cache version ${o.data.metadata.version} !== ${zs}`);return o.data}async save(e){let n={metadata:{version:zs,last_sync:new Date().toISOString(),jira_user:this.jiraUser},tasks:[...e]},o=ov.safeParse(n);if(!o.success)throw new pr(`Task data failed validation: ${o.error.message}`);await this.#e(o.data);}async getTask(e){let o=(await this.load()).tasks.find(r=>r.key===e);if(!o)throw new Tt(`Task ${e} not found in cache`);return o}async getAllTasks(){return (await this.load()).tasks}async updateTask(e,n){let o=await this.load(),r=o.tasks.findIndex(c=>c.key===e);if(r===-1)throw new Tt(`Task ${e} not found in cache`);let i=o.tasks[r];if(!i)throw new Tt(`Task ${e} not found in cache`);let a={...i,...n,key:e,updated:new Date().toISOString()},s=[...o.tasks.slice(0,r),a,...o.tasks.slice(r+1)];return await this.save(s),a}async deleteTask(e){let n=await this.load(),o=n.tasks.filter(r=>r.key!==e);if(o.length===n.tasks.length)throw new Tt(`Task ${e} not found in cache`);await this.save(o);}async upsertTask(e){let n=[];try{n=(await this.load()).tasks;}catch(i){if(!(i instanceof St))throw i}let o=n.findIndex(i=>i.key===e.key),r=o===-1?[...n,e]:n.map((i,a)=>a===o?e:i);return await this.save(r),e}async getMetadata(){return (await this.load()).metadata}async#e(e){let n=`${this.cachePath}.tmp`,o=JSON.stringify(e,null,2);await writeFile(n,o,{encoding:"utf-8",mode:384}),await rename(n,this.cachePath);}};le();function Is(t){return t.replace(/([\\"])/g,"\\$1")}var Kd=class{#e;#t;#r;constructor(e,n,o){this.#e=e,this.#t=n,this.#r=o;}async sync(e){let n=e?.jql??`assignee = "${Is(this.#t.credentials.username)}" ORDER BY updated DESC`,o=Ld(this.#t);if(e?.projectKey){let i=this.#t.projects[e.projectKey];i&&(o=o.filter(a=>a.url===i.url));}let r=[];for(let i of o){let c=(await this.#r(i.url,i.username,i.api_token).searchIssues(n)).map(u=>this.#n(u,i.url));r.push(...c);}return await this.#e.save(r),r.length}#n(e,n){let o=e.fields.assignee?.emailAddress??null,r=e.fields.priority?.name??"None",i=e.fields.customfield_10014??null;return {key:e.key,summary:e.fields.summary,status:e.fields.status.name,assignee:o,priority:r,issue_type:e.fields.issuetype.name,created:e.fields.created,updated:e.fields.updated,project_key:e.fields.project.key,project_url:n,epic_link:i}}};le();function B1(t){let e=t;for(;;){if(existsSync(join(e,"package.json")))return e;let n=dirname(e);if(n===e)return fileURLToPath(new URL("..",import.meta.url));e=n;}}var G1=B1(dirname(fileURLToPath(import.meta.url)));join(xs,"workflows.json");join(xs,"users.json");var iv=join(Lr,"templates"),b0=join(iv,"comments"),x0=join(iv,"task-templates"),w0=join(iv,"tasks"),av=join(G1,"templates-system"),S0=join(av,"comments"),T0=join(av,"task-templates");join(av,"locales");Mo();var Fr={WORKFLOW:"workflow",COMMUNICATION:"communication",REPORTING:"reporting",DEVELOPMENT:"development"};le();var P0=/^[a-z][a-z0-9-]*$/,j0=_.object({name:_.string().regex(/^\w+$/,"Variable name must be alphanumeric/underscore"),description:_.string().default(""),required:_.boolean().default(false),default:_.string().optional(),example:_.string().optional()}),H1=_.object({kind:_.literal("comment"),id:_.string().regex(P0,"Template id must be a URL-safe slug"),name:_.string().min(1),description:_.string().min(1),category:_.enum([Fr.WORKFLOW,Fr.COMMUNICATION,Fr.REPORTING,Fr.DEVELOPMENT]),variables:_.array(j0).default([])}),W1=_.object({kind:_.literal("task"),id:_.string().regex(P0,"Template id must be a URL-safe slug"),name:_.string().min(1),description:_.string().min(1),summary:_.string().min(1),issue_type:_.string().optional(),priority:_.string().optional(),labels:_.array(_.string()).optional(),epic_key:_.string().optional(),variables:_.array(j0).default([])});function E0(t){return t.map(e=>({name:e.name,description:e.description,required:e.required,defaultValue:e.default,example:e.example}))}function O0(t,e){let n=t.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);if(!n)throw new mr(`Template file "${e}" must start with a JSON metadata block delimited by ---`);let[,o,r=""]=n;if(o===void 0)throw new mr(`Template file "${e}" is missing metadata.`);let i;try{i=JSON.parse(o);}catch(a){let s=a instanceof Error?a.message:String(a);throw new mr(`Template file "${e}" contains invalid JSON metadata: ${s}`)}return {metadata:i,body:r.trim()}}function R0(t){if(!readdirSync||!t)return [];try{return readdirSync(t).filter(e=>e.endsWith(".md")).sort().map(e=>join(t,e))}catch{return []}}function Hd(t,e){let n=[];for(let o of R0(t)){let r=readFileSync(o,"utf-8"),i=O0(r,o),a=H1.parse(i.metadata);n.push({id:a.id,name:a.name,description:a.description,category:a.category,variables:E0(a.variables),body:i.body,source:e,filePath:o});}return n}function Wd(t,e){let n=[];for(let o of R0(t)){let r=readFileSync(o,"utf-8"),i=O0(r,o),a=W1.parse(i.metadata);n.push({id:a.id,name:a.name,description:a.description,summary:a.summary,issueType:a.issue_type,priority:a.priority,labels:a.labels,epicKey:a.epic_key,variables:E0(a.variables),body:i.body,source:e,filePath:o});}return n}var C0=Hd(S0,"system");le();var Xd=class{templates;constructor(e){let n=new Map;for(let o of C0)n.set(o.id,o);if(e)for(let o of e)n.set(o.id,o);this.templates=n;}getTemplate(e){let n=this.templates.get(e);if(!n)throw new kn(`Template "${e}" not found. Use listTemplates() to see available templates.`);return n}listTemplates(e){let n=[...this.templates.values()];return e?n.filter(o=>o.category===e):n}listCategories(){let e=new Set;for(let n of this.templates.values())e.add(n.category);return [...e]}};le();var N0=Wd(T0,"system");var Yd=class{templates;constructor(e){let n=new Map;for(let o of N0)n.set(o.id,o);if(e)for(let o of e)n.set(o.id,o);this.templates=n;}getTemplate(e){let n=this.templates.get(e);if(!n)throw new kn(`Task template "${e}" not found. Use listTaskTemplates() to see available templates.`);return n}listTemplates(){return [...this.templates.values()]}};function D0(t){let e=Hd(b0,"user"),n=Wd(x0,"user");return {commentRegistry:new Xd(e),taskRegistry:new Yd(n)}}le();var sv=[{name:"sync_tasks",description:"Sync tasks from Jira to local cache. By default syncs from all configured instances. Optionally scope to a single project or provide a custom JQL query.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:"Optional project key to sync from a single instance."},jql:{type:"string",description:"Optional JQL query. If omitted, fetches tasks assigned to the current user."}}}},{name:"read_cached_tasks",description:"Read tasks from local cache without hitting the Jira API. Returns a single task when task_key is provided, or all cached tasks otherwise.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Optional task key (e.g. "PROJ-123"). If omitted, returns all cached tasks.'}}}},{name:"update_task_status",description:"Change a task status via Jira workflow transition and update the local cache.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},status:{type:"string",description:'Target status name (e.g. "In Progress", "Done"). Use get_task_statuses first to check valid transitions.'}},required:["task_key","status"]}},{name:"add_task_comment",description:"Add a markdown comment to a Jira task. The markdown is automatically converted to ADF format.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},comment:{type:"string",description:"Comment text in markdown format."},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves posting this comment."}},required:["task_key","comment"]}},{name:"delete_task",description:"Delete a Jira task, but only when the authenticated user is the task creator.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves deleting this task."}},required:["task_key"]}},{name:"delete_comment",description:"Delete a Jira comment, but only when the authenticated user is the comment author.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},comment_id:{type:"string",description:"Comment ID to delete."},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves deleting this comment."}},required:["task_key","comment_id"]}},{name:"reassign_task",description:"Reassign a task to a different user by email, or unassign by providing an empty string or omitting assignee_email.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},assignee_email:{type:"string",description:"Email of the new assignee. Empty string or omit to unassign."}},required:["task_key"]}},{name:"get_task_statuses",description:"Get available workflow transitions for a task. Call this before update_task_status to see valid target statuses.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"get_task_details",description:"Get full task details from Jira including description and all comments, with ADF content converted to markdown.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"log_task_time",description:"Log work time to a Jira task. Uses hours and minutes format only (no days). Invalidates cache after logging.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},time_spent:{type:"string",description:'Time in format "2h", "30m", or "2h 30m". Days are not supported.'},comment:{type:"string",description:"Optional work description."}},required:["task_key","time_spent"]}},{name:"get_task_time_tracking",description:"Get time tracking information for a Jira task (original estimate, time spent, remaining estimate).",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"list_comment_templates",description:"List all available comment templates with optional category filter. Returns template metadata including required variables.",inputSchema:{type:"object",properties:{category:{type:"string",description:'Optional category filter: "workflow", "communication", "reporting", or "development".',enum:["workflow","communication","reporting","development"]}}}},{name:"add_templated_comment",description:"Add a comment using a registered template (with variable substitution) or raw markdown. Provide exactly one of template_id or markdown.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},template_id:{type:"string",description:"Template identifier. Use list_comment_templates to see available templates."},variables:{type:"object",description:"Key-value map of template variables. Required when using template_id.",additionalProperties:{type:"string"}},markdown:{type:"string",description:"Raw markdown comment. Use instead of template_id for freeform comments."},user_approved:{type:"boolean",description:"Must be true only after the user explicitly approves posting this comment."}},required:["task_key"]}},{name:"create_task",description:"Create a new Jira issue with either explicit fields or a registered task template, plus optional assignee, labels, epic link, sub-task parent, and original estimate.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:'Project key (e.g. "DEVOPS"). Determines which Jira instance to use.'},summary:{type:"string",description:"Issue title / summary. Do not provide when using template_id."},description:{type:"string",description:"Optional issue description in markdown format. Automatically converted to ADF. Do not provide when using template_id."},template_id:{type:"string",description:"Task template identifier. Use list_task_templates to see available templates."},variables:{type:"object",description:"Key-value map of template variables. Required when using template_id.",additionalProperties:{type:"string"}},type:{type:"string",description:'Issue type name (default "Task"). E.g. "Bug", "Story", "Epic".'},priority:{type:"string",description:'Priority name (default "Medium"). E.g. "High", "Low", "Critical".'},assignee_email:{type:"string",description:"Email of the assignee. Resolved to Jira account ID."},labels:{type:"array",items:{type:"string"},description:"Array of label strings to apply to the issue."},epic_key:{type:"string",description:'Epic issue key to link this issue under (e.g. "PROJ-100").'},parent_key:{type:"string",description:'Parent issue key (e.g. "PROJ-69"). Required when type is a sub-task; Jira rejects sub-task creation without it.'},original_estimate:{type:"string",description:'Original estimate in format "2h", "30m", or "2h 30m". Days are not supported.'}},required:["project_key"]}},{name:"list_task_templates",description:"List all available single-task templates used by create_task. Returns template metadata including required variables.",inputSchema:{type:"object",properties:{}}},{name:"get_project_language",description:"Get the configured language for a project. Use before writing comments or descriptions to determine the correct language.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:'Project key (e.g. "DEVOPS"). Inferred from task key prefix.'}},required:["project_key"]}},{name:"update_task",description:"Update an existing Jira issue, including its original and remaining estimates. Only provided fields are changed; omitted fields are left untouched.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "DEVOPS-37"). Project is inferred from the key prefix.'},summary:{type:"string",description:"New issue title / summary."},description:{type:"string",description:"New issue description in markdown format. Automatically converted to ADF."},priority:{type:"string",description:'New priority name. E.g. "Medium", "Low", "Critical".'},labels:{type:"array",items:{type:"string"},description:"New set of label strings (replaces existing labels)."},original_estimate:{type:"string",description:'New original estimate in format "2h", "30m", or "2h 30m". Days are not supported.'},remaining_estimate:{type:"string",description:'New remaining estimate in format "2h", "30m", or "2h 30m". Days are not supported. Independent of original_estimate -- setting one leaves the other unchanged.'}},required:["task_key"]}},{name:"search_tasks",description:"Search Jira issues using JQL. Returns results directly without caching.",inputSchema:{type:"object",properties:{jql:{type:"string",description:"JQL query string."},max_results:{type:"number",description:"Maximum number of results to return (default 50)."},project_key:{type:"string",description:"Optional project key to determine which Jira instance to query. Defaults to the configured default project."}},required:["jql"]}},{name:"create_monthly_tasks",description:"Run all monthly_admin.json bulk task configs from ~/.softspark/jira-mcp/templates/tasks/<KEY>/. Defaults to dry-run. Set execute=true to actually create the tasks. Optionally filter to a single project key.",inputSchema:{type:"object",properties:{execute:{type:"boolean",description:"When true, create tasks for real. When false or omitted, run a dry-run preview."},project:{type:"string",description:"Optional project key (case-insensitive) to restrict execution to a single project subdirectory."}}}}];le();le();le();var X1=/(\d+)\s*h/i,Y1=/(\d+)\s*m/i,Q1=/\d+\s*d/i;function xn(t){let e=t.trim();if(e.length===0)throw new Error("Invalid time format: empty string. Use: '2h', '30m', or '2h 30m'");if(Q1.test(e))throw new Error("Days (d) not supported. Use hours (h) and minutes (m) only. Example: '2h', '30m', or '2h 30m'");let n=0,o=X1.exec(e);o?.[1]&&(n+=parseInt(o[1],10)*3600);let r=Y1.exec(e);if(r?.[1]&&(n+=parseInt(r[1],10)*60),n===0)throw new Error(`Invalid time format: '${t}'. Use: '2h', '30m', or '2h 30m'`);return n}le();var Qd=class{constructor(e,n){this.connector=e;this.cacheManager=n;}connector;cacheManager;async changeStatus(e,n){let o=await this.connector.getTransitions(e),r=o.find(a=>a.toStatus.toLowerCase()===n.toLowerCase())??o.find(a=>a.name.toLowerCase()===n.toLowerCase());if(!r){let a=o.map(s=>`${s.name} -> ${s.toStatus}`).join(", ");throw new wt(`Status '${n}' not available for ${e}. Available transitions: ${a}`)}await this.connector.doTransition(e,r.id);let i=await this.#e(e,{status:r.toStatus||n});return {taskKey:e,updatedTask:i}}async getAvailableStatuses(e){return (await this.connector.getTransitions(e)).map(o=>({id:o.id,name:o.name,toStatus:o.toStatus}))}async addComment(e,n){let o=zt(n),r=await this.connector.addComment(e,o);return {taskKey:e,commentId:r.id,author:r.author,bodyMarkdown:Wo(r.body),created:r.created}}async deleteComment(e,n){let o=await this.connector.getCurrentUser(),i=(await this.connector.getIssue(e)).comments.find(a=>a.id===n);if(!i)throw new _s(`Comment ${n} not found on ${e}.`);if(i.authorAccountId==null||i.authorAccountId!==o.accountId)throw new Vo(`Comment ${n} on ${e} can only be deleted by its author.`);return await this.connector.deleteComment(e,n),{taskKey:e,commentId:n}}async reassign(e,n){if(n){let r=await this.connector.findUser(n);await this.connector.assignIssue(e,r);}else await this.connector.assignIssue(e,null);let o=await this.#e(e,{assignee:n??null});return {taskKey:e,updatedTask:o}}async getTaskDetails(e){let n=await this.connector.getIssue(e),o=n.comments.map(r=>({id:r.id,author:r.author,body:Wo(r.body),created:r.created}));return {key:n.key,summary:n.summary,description:Wo(n.description),status:n.status,assignee:n.assignee,priority:n.priority,issueType:n.issueType,created:n.created,updated:n.updated,comments:o}}async deleteTask(e){let n=await this.connector.getCurrentUser(),o=await this.connector.getIssue(e);if(o.creatorAccountId==null||o.creatorAccountId!==n.accountId)throw new Vo(`Task ${e} can only be deleted by its creator.`);await this.connector.deleteIssue(e);try{await this.cacheManager.deleteTask(e);}catch(r){if(!(r instanceof Tt||r instanceof St))throw r}return {taskKey:e}}async logTime(e,n,o){let r=xn(n),i=o?zt(o):void 0,a=await this.connector.addWorklog(e,r,i);try{await this.cacheManager.deleteTask(e);}catch(s){if(!(s instanceof Tt||s instanceof St))throw s}return {taskKey:e,worklogId:a.id,timeSpent:n,timeSpentSeconds:a.timeSpentSeconds}}async getTimeTracking(e){let n=await this.connector.getTimeTracking(e);return {taskKey:e,originalEstimate:n.originalEstimate,remainingEstimate:n.remainingEstimate,timeSpent:n.timeSpent}}async#e(e,n){try{return await this.cacheManager.updateTask(e,n)}catch(o){if(!(o instanceof Tt||o instanceof St))throw o;let r=await this.connector.getIssue(e),i={key:r.key,summary:r.summary,status:r.status,assignee:r.assignee,priority:r.priority,issue_type:r.issueType,created:r.created,updated:r.updated,project_key:r.projectKey,project_url:this.connector.instanceUrl,epic_link:null,...n};return await this.cacheManager.upsertTask(i)}}};function je(t,e,n){let o=t.getConnectorForTask(n);return new Qd(o,e)}async function A0(t,e){try{let n={...t.jql?{jql:t.jql}:{},...t.project_key?{projectKey:t.project_key}:{}},o=await e.syncer.sync(n);return K({tasks_synced:o,message:`Synced ${o} tasks`})}catch(n){return M(n)}}async function U0(t,e){try{if(t.task_key){let o=await e.cacheManager.getTask(t.task_key);return K({task:o})}let n=await e.cacheManager.getAllTasks();return K({tasks:n,count:n.length})}catch(n){return M(n)}}async function Z0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).changeStatus(t.task_key,t.status);return K({task:o.updatedTask,message:`Updated ${t.task_key} status to '${t.status}'`})}catch(n){return M(n)}}le();async function M0(t,e){try{Yo(t.user_approved);let o=await je(e.pool,e.cacheManager,t.task_key).addComment(t.task_key,t.comment);return K({comment:{id:o.commentId,author:o.author,body:o.bodyMarkdown,created:o.created},message:`Added comment to ${t.task_key}`})}catch(n){return M(n)}}le();async function L0(t,e){try{Qo(t.user_approved);let o=await je(e.pool,e.cacheManager,t.task_key).deleteTask(t.task_key);return K({deleted:{task_key:o.taskKey},message:`Deleted task ${t.task_key}`})}catch(n){return M(n)}}le();async function q0(t,e){try{Qo(t.user_approved);let o=await je(e.pool,e.cacheManager,t.task_key).deleteComment(t.task_key,t.comment_id);return K({deleted:{task_key:o.taskKey,comment_id:o.commentId},message:`Deleted comment ${t.comment_id} from ${t.task_key}`})}catch(n){return M(n)}}async function F0(t,e){try{let n=je(e.pool,e.cacheManager,t.task_key),o=t.assignee_email?.trim()||null,r=await n.reassign(t.task_key,o),i=o?`Reassigned ${t.task_key} to ${o}`:`Unassigned ${t.task_key}`;return K({task:r.updatedTask,message:i})}catch(n){return M(n)}}async function V0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).getAvailableStatuses(t.task_key);return K({task_key:t.task_key,statuses:o.map(r=>({id:r.id,name:r.name,to_status:r.toStatus}))})}catch(n){return M(n)}}async function J0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).getTaskDetails(t.task_key),r=t.task_key.split("-")[0]??"",i=e.config.projects[r]?.language??e.config.default_language;return K({task:o,language:i,message:`Retrieved details for ${t.task_key}`})}catch(n){return M(n)}}async function B0(t,e){try{let n=e.config.projects[t.project_key],o=n?.language??e.config.default_language;return K({project_key:t.project_key,language:o,source:n?.language?"project":"default",message:`Project ${t.project_key} language: ${o}`})}catch(n){return M(n)}}async function G0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).logTime(t.task_key,t.time_spent,t.comment);return K({message:`Logged ${t.time_spent} to ${t.task_key}`,worklog_id:o.worklogId,time_spent:o.timeSpent,time_spent_seconds:o.timeSpentSeconds})}catch(n){return M(n)}}async function K0(t,e){try{let o=await je(e.pool,e.cacheManager,t.task_key).getTimeTracking(t.task_key);return K({task_key:t.task_key,time_tracking:{original_estimate:o.originalEstimate,time_spent:o.timeSpent,remaining_estimate:o.remainingEstimate},message:`Retrieved time tracking for ${t.task_key}`})}catch(n){return M(n)}}function eA(t){return Object.values(Fr).includes(t)}async function H0(t,e){try{let n;if(t.category){if(!eA(t.category)){let i=Object.values(Fr).join(", ");return M(new Error(`Invalid category '${t.category}'. Valid categories: ${i}`))}n=t.category;}let o=e.templateRegistry.listTemplates(n),r=e.templateRegistry.listCategories();return K({templates:o.map(i=>({id:i.id,name:i.name,description:i.description,category:i.category,source:i.source??"system",file_path:i.filePath,variables:i.variables.map(a=>({name:a.name,description:a.description,required:a.required,example:a.example}))})),categories:r,count:o.length})}catch(n){return M(n)}}async function W0(t,e){try{let n=e.taskTemplateRegistry.listTemplates();return K({templates:n.map(o=>({id:o.id,name:o.name,description:o.description,summary:o.summary,issue_type:o.issueType??"Task",priority:o.priority??"Medium",labels:o.labels??[],source:o.source??"system",file_path:o.filePath,variables:o.variables.map(r=>({name:r.name,description:r.description,required:r.required,example:r.example}))})),count:n.length})}catch(n){return M(n)}}le();le();async function X0(t,e){try{if(Yo(t.user_approved),t.template_id&&t.markdown)return M(new Error("Provide either template_id or markdown, not both."));if(!t.template_id&&!t.markdown)return M(new Error("Provide either template_id (with variables) or markdown."));let n,o;if(t.template_id){let a=e.templateRegistry.getTemplate(t.template_id),s=bn(a,t.variables??{});if(!s.success)return M(new Error(s.error));n=s.markdown,o={template_id:a.id,template_name:a.name};}else n=t.markdown??"";let i=await je(e.pool,e.cacheManager,t.task_key).addComment(t.task_key,n);return K({comment:{id:i.commentId,author:i.author,body:i.bodyMarkdown,created:i.created},...o?{template:o}:{},message:`Added comment to ${t.task_key}`})}catch(n){return M(n)}}le();le();async function tA(t){return (await t.getFields()).find(o=>o.custom&&o.name.toLowerCase()==="epic link")?.id}async function Y0(t,e){try{let n=t.template_id!==void 0;if(n&&(t.summary!==""||t.description!==void 0))return M(new Error("When template_id is provided, do not also provide summary or description."));if(!n&&t.summary.trim()==="")return M(new Error("Provide either template_id (with variables) or a non-empty summary."));let o=e.pool.getConnector(t.project_key),r=t.summary,i=t.description,a=t.type,s=t.priority,c=t.labels,u=t.epic_key,l;if(n){let m=e.taskTemplateRegistry.getTemplate(t.template_id??""),h=bn({variables:m.variables,body:m.summary},t.variables??{});if(!h.success)return M(new Error(h.error));let v=bn({variables:m.variables,body:m.body},t.variables??{});if(!v.success)return M(new Error(v.error));r=h.markdown,i=v.markdown===""?void 0:v.markdown,a=t.type??m.issueType,s=t.priority??m.priority,c=t.labels??m.labels,u=t.epic_key??m.epicKey,l={template_id:m.id,template_name:m.name,source:m.source??"system"};}let d={project:{key:t.project_key},summary:r,issuetype:{name:a??"Task"},priority:{name:s??"Medium"}};if(i&&(d.description=zt(i)),c&&c.length>0&&(d.labels=c),t.assignee_email){let m=await o.findUser(t.assignee_email);d.assignee={accountId:m};}if(t.parent_key&&(d.parent={key:t.parent_key}),t.original_estimate&&(xn(t.original_estimate),d.timetracking={originalEstimate:t.original_estimate}),u){let m=await tA(o);m&&(d[m]=u);}let p=await o.createIssue(d);return K({issue_key:p.key,url:p.url,summary:r,...l?{template:l}:{},message:`Created ${p.key}: ${r}`})}catch(n){return M(n)}}le();async function Q0(t,e){try{let n=t.task_key.split("-")[0]??"",o=e.pool.getConnector(n),r={};t.summary!==void 0&&(r.summary=t.summary),t.description!==void 0&&(r.description=zt(t.description)),t.priority!==void 0&&(r.priority={name:t.priority}),t.labels!==void 0&&(r.labels=t.labels);let i={};if(t.original_estimate!==void 0&&(xn(t.original_estimate),i.originalEstimate=t.original_estimate),t.remaining_estimate!==void 0&&(xn(t.remaining_estimate),i.remainingEstimate=t.remaining_estimate),Object.keys(i).length>0&&(r.timetracking=i),Object.keys(r).length===0)return M(new Error("No fields to update. Provide at least one of: summary, description, priority, labels, original_estimate, remaining_estimate."));await o.updateIssue(t.task_key,r);let a=Object.keys(r).join(", ");return K({task_key:t.task_key,updated_fields:a,message:`Updated ${t.task_key}: ${a}`})}catch(n){return M(n)}}var rA=50,nA=["summary","status","assignee","priority","issuetype","created","updated","project","customfield_10014"];async function eT(t,e){try{let n=t.project_key??e.config.default_project,o=e.pool.getConnector(n),r=t.max_results??rA,i=await o.searchIssues(t.jql,nA),a=i.slice(0,r);return K({results:a,count:a.length,total_available:i.length,message:`Found ${a.length} issue(s) matching JQL query`})}catch(n){return M(n)}}Mo();le();var oA=_.object({summary:_.string().min(1,"Summary is required").max(255),description:_.string().optional().default(""),type:_.string().default("Task"),assignee:_.string().email("Invalid assignee email format").optional(),priority:_.enum(["Highest","High","Medium","Low","Lowest"]).default("Medium"),labels:_.array(_.string()).default([]),estimate_hours:_.number().positive("Estimate must be positive").optional(),status:_.union([_.string(),_.array(_.string().min(1)).min(1,"Status path must not be empty")]).optional()}).catchall(_.string().optional()),iA=_.object({dry_run:_.boolean().default(true),update_existing:_.boolean().default(false),match_field:_.string().default("summary"),rate_limit_ms:_.number().int().min(0).default(500),force_reassign:_.boolean().default(false),reassign_delay_ms:_.number().int().min(0).default(0),language:Zt.default(Yt)}),tT=_.object({epic_key:_.string().regex(/^[A-Z][A-Z0-9]*-\d+$/,"Invalid epic key format (e.g., PROJ-123)"),tasks:_.array(oA).min(1,"At least one task is required"),options:iA.default(()=>({dry_run:true,update_existing:false,match_field:"summary",rate_limit_ms:500,force_reassign:false,reassign_delay_ms:0,language:Yt}))});function aA(t){let e=new Date;return {MONTH:`${String(e.getMonth()+1).padStart(2,"0")}.${e.getFullYear()}`,YEAR:String(e.getFullYear()),DATE:e.toISOString().slice(0,10)}}function rT(t,e){let n=aA(),o=JSON.stringify(t);return o=o.replaceAll("{MONTH}",n.MONTH),o=o.replaceAll("{YEAR}",n.YEAR),o=o.replaceAll("{DATE}",n.DATE),JSON.parse(o)}le();le();function nT(t){return new Promise(e=>setTimeout(e,t))}var cv=class extends Pe{constructor(e){super(e,"EPIC_NOT_FOUND"),this.name="EpicNotFoundError";}},ep=class extends Pe{constructor(e){super(e,"EPIC_LINK_FIELD_NOT_FOUND"),this.name="EpicLinkFieldNotFoundError";}},tp=class{constructor(e,n){this.connector=e;this.projectKey=n;}connector;projectKey;epicLinkFieldId=null;assigneeCache=new Map;async execute(e){let n=Date.now(),o=e.epic_key,r=e.options;if(!await this.validateEpic(o))throw new cv(`Epic '${o}' not found or not accessible`);this.epicLinkFieldId=await this.discoverEpicLinkField();let a=new Set;for(let l of e.tasks)l.assignee&&a.add(l.assignee);for(let l of a)try{await this.resolveAssignee(l);}catch{}let s=[];for(let l=0;l<e.tasks.length;l++){l>0&&r.rate_limit_ms>0&&await nT(r.rate_limit_ms);let d=e.tasks[l];if(!d)continue;let p=await this.processTask(d,o,r);s.push(p);}let c=sA(s),u=Date.now()-n;return {results:s,summary:c,dry_run:r.dry_run,total_time_ms:u}}async validateEpic(e){try{return await this.connector.getIssue(e),!0}catch{return false}}async discoverEpicLinkField(){let e;try{e=await this.connector.getFields();}catch(n){let o=n instanceof Error?n.message:String(n);throw new ep(`Failed to fetch fields from Jira: ${o}`)}for(let n of e){if(n.name.toLowerCase().includes("epic link"))return n.id;let r=n.schema?.custom??"";if(r.includes("epic-link")||r.includes("gh-epic-link"))return n.id}throw new ep("Epic Link custom field not found. Ensure Jira instance has Epic support enabled.")}async resolveAssignee(e){let n=this.assigneeCache.get(e);if(n!==void 0)return n;let o=await this.connector.findUser(e);return this.assigneeCache.set(e,o),o}async processTask(e,n,o){let r=this.selectSummary(e,o.language);if(o.dry_run)return {summary:r,issue_key:null,action:"preview",error:null,url:null,warning:null};try{let i=await this.findExistingTask(r,this.projectKey);if(i!==null){if(o.update_existing){let c=await this.updateTask(i,e,n,this.epicLinkFieldId,o);return {summary:r,issue_key:i,action:"updated",error:null,url:`${this.connector.instanceUrl}/browse/${i}`,warning:c}}return {summary:r,issue_key:i,action:"skipped",error:null,url:`${this.connector.instanceUrl}/browse/${i}`,warning:null}}let a=await this.createTask(e,n,this.epicLinkFieldId,o),s=e.status?await this.applyStatusPath(a.key,e.status):null;return o.force_reassign&&e.assignee&&await this.forceReassign(a.key,e.assignee,o.reassign_delay_ms),{summary:r,issue_key:a.key,action:"created",error:null,url:a.url,warning:s}}catch(i){let a=i instanceof Error?i.message:String(i);return {summary:r,issue_key:null,action:"failed",error:a,url:null,warning:null}}}async createTask(e,n,o,r){let i=this.selectSummary(e,r.language),a=this.selectDescription(e,r.language),s={project:{key:this.projectKey},summary:i,issuetype:{name:e.type??"Task"},priority:{name:e.priority??"Medium"}};if(a&&(s.description=zt(a)),e.labels&&e.labels.length>0&&(s.labels=[...e.labels]),e.estimate_hours&&(s.timetracking={originalEstimate:`${e.estimate_hours}h`}),e.assignee){let u=this.assigneeCache.get(e.assignee);if(u!==void 0)s.assignee={accountId:u};else throw new wt(`Assignee not resolved: ${e.assignee}`)}o&&(s[o]=n);let c=await this.connector.createIssue(s);return {key:c.key,url:c.url}}async updateTask(e,n,o,r,i){let a=this.selectDescription(n,i.language),s={};if(a&&(s.description=zt(a)),n.priority&&(s.priority={name:n.priority}),n.labels&&n.labels.length>0&&(s.labels=[...n.labels]),n.estimate_hours&&(s.timetracking={originalEstimate:`${n.estimate_hours}h`}),n.assignee){let c=this.assigneeCache.get(n.assignee);c!==void 0&&(s.assignee={accountId:c});}return r&&(s[r]=o),Object.keys(s).length>0&&await this.connector.updateIssue(e,s),n.status?this.applyStatusPath(e,n.status):null}async findExistingTask(e,n){try{let o=Is(`"${e}"`),r=`project = "${Is(n)}" AND summary ~ "${o}"`;return (await this.connector.searchIssues(r)).find(s=>s.summary===e)?.key??null}catch{return null}}async applyStatusPath(e,n){let o=typeof n=="string"?[n]:n;for(let[r,i]of o.entries()){let a;try{a=await this.connector.getTransitions(e);}catch(c){let u=c instanceof Error?c.message:String(c);return `Could not read transitions while moving to "${i}": ${u}`}let s=a.find(c=>c.toStatus.toLowerCase()===i.toLowerCase());if(!s){let c=a.map(l=>l.toStatus).join(", "),u=r===0?"":` (stopped after reaching "${o[r-1]??""}")`;return `Status "${i}" is not reachable${u}. Available from here: ${c||"(none)"}`}try{await this.connector.doTransition(e,s.id);}catch(c){let u=c instanceof Error?c.message:String(c);return `Transition "${s.name}" to "${i}" failed: ${u}`}}return null}async forceReassign(e,n,o){let r=this.assigneeCache.get(n);if(r!==void 0){o>0&&await nT(o);try{await this.connector.assignIssue(e,r);}catch{}}}selectSummary(e,n){if(n!==Yt){let o=e[`summary_${n}`];if(o)return o}return e.summary}selectDescription(e,n){if(n!==Yt){let o=e[`description_${n}`];if(o)return o}return e.description||void 0}};function sA(t){let e=0,n=0,o=0,r=0,i=0;for(let a of t)switch(a.action){case "created":e++;break;case "updated":n++;break;case "failed":o++;break;case "skipped":r++;break;case "preview":i++;break}return {created:e,updated:n,failed:o,skipped:r,previewed:i}}le();le();async function cA(t,e){let{readdir:n,stat:o,access:r}=await import('fs/promises'),{join:i}=await import('path'),a=w0,s=[],c;try{let u=await n(a);c=(await Promise.all(u.map(async d=>{let p=await o(i(a,d));return {name:d,isDir:p.isDirectory()}}))).filter(d=>d.isDir).map(d=>d.name);}catch{return []}for(let u of c){if(t&&u.toUpperCase()!==t.toUpperCase())continue;let l=i(a,u,"monthly_admin.json");try{await r(l),s.push({projectKey:u.toUpperCase(),configPath:l});}catch{}}return s.sort((u,l)=>u.projectKey.localeCompare(l.projectKey)),s}async function oT(t,e){let{readFile:n}=await import('fs/promises'),o=await cA(t.project);if(o.length===0)return {configs:[],totalProcessed:0,totalFailed:0};let i=await(Go)(),s=((l=>new ei(l)))(i),c=[],u=0;for(let l of o)try{let d=await n(l.configPath,"utf-8"),p=JSON.parse(d),m=tT.safeParse(p);if(!m.success){c.push({projectKey:l.projectKey,configPath:l.configPath,error:`Invalid config: ${m.error.message}`}),u++;continue}let h=rT(m.data),z="language"in(p.options??{}),A=h.epic_key.split("-")[0]??"",R=i.projects[A]?.language??i.default_language,q={...h,options:{...h.options,dry_run:t.execute!==!0,...!z&&R?{language:R}:{}}};if(!A){c.push({projectKey:l.projectKey,configPath:l.configPath,error:`Invalid epic_key format: '${q.epic_key}'`}),u++;continue}let Z=s.getConnector(A),ti=await(e?.createBulkCreator??((ri,Vr)=>new tp(ri,Vr)))(Z,A).execute(q);c.push({projectKey:l.projectKey,configPath:l.configPath,result:ti});}catch(d){let p=d instanceof Error?d.message:String(d);c.push({projectKey:l.projectKey,configPath:l.configPath,error:p}),u++;}return {configs:c,totalProcessed:o.length,totalFailed:u}}function uA(t){if(t.error)return {project_key:t.projectKey,config_path:t.configPath,status:"error",error:t.error};if(t.result){let e=t.result.results.filter(n=>n.warning!==null).map(n=>`${n.issue_key??n.summary}: ${n.warning??""}`);return {project_key:t.projectKey,config_path:t.configPath,status:"success",summary:t.result.summary,dry_run:t.result.dry_run,...e.length>0?{warnings:e}:{}}}return {project_key:t.projectKey,config_path:t.configPath,status:"error",error:"No result and no error reported."}}function lA(t,e){return {execute:e,total_processed:t.totalProcessed,total_failed:t.totalFailed,total_succeeded:t.totalProcessed-t.totalFailed,configs:t.configs.map(uA)}}async function iT(t,e){try{let n=await oT({execute:t.execute,project:t.project},e?.createMonthlyDeps);return K(lA(n,t.execute===!0))}catch(n){return M(n)}}function dA(t){return {instanceUrl:t.instanceUrl,async searchIssues(e){return (await t.searchIssues(e)).map(o=>({key:o.key,fields:{summary:o.summary,status:{name:o.status},assignee:o.assignee?{emailAddress:o.assignee}:null,priority:o.priority?{name:o.priority}:null,issuetype:{name:o.issueType},created:o.created,updated:o.updated,project:{key:o.projectKey},customfield_10014:o.epicLink}}))}}}function aT(){return new Nd({name:"@softspark/jira-mcp",version:IS},{capabilities:{tools:{}}})}async function pA(){let t=await Go(),e=new ei(t),{GLOBAL_CACHE_DIR:n}=await Promise.resolve().then(()=>(le(),_0)),o=new Gd(n,t.credentials.username);await o.initialize();let{commentRegistry:r,taskRegistry:i}=D0(),a=new Kd(o,t,(u,l,d)=>dA(e.getConnector(mA(t,u)??""))),s=aT();s.setRequestHandler(Eh,()=>({tools:sv})),s.setRequestHandler(ja,async u=>{let{name:l}=u.params,d=u.params.arguments??{};switch(l){case "sync_tasks":return A0({project_key:ke(d.project_key),jql:ke(d.jql)},{syncer:a});case "read_cached_tasks":return U0({task_key:ke(d.task_key)},{cacheManager:o});case "update_task_status":return Z0({task_key:Ie(d.task_key,"task_key"),status:Ie(d.status,"status")},{pool:e,cacheManager:o});case "add_task_comment":return M0({task_key:Ie(d.task_key,"task_key"),comment:Ie(d.comment,"comment"),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o});case "delete_task":return L0({task_key:Ie(d.task_key,"task_key"),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o});case "delete_comment":return q0({task_key:Ie(d.task_key,"task_key"),comment_id:Ie(d.comment_id,"comment_id"),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o});case "reassign_task":return F0({task_key:Ie(d.task_key,"task_key"),assignee_email:ke(d.assignee_email)},{pool:e,cacheManager:o});case "get_task_statuses":return V0({task_key:Ie(d.task_key,"task_key")},{pool:e,cacheManager:o});case "get_task_details":return J0({task_key:Ie(d.task_key,"task_key")},{pool:e,cacheManager:o,config:t});case "log_task_time":return G0({task_key:Ie(d.task_key,"task_key"),time_spent:Ie(d.time_spent,"time_spent"),comment:ke(d.comment)},{pool:e,cacheManager:o});case "get_task_time_tracking":return K0({task_key:Ie(d.task_key,"task_key")},{pool:e,cacheManager:o});case "list_comment_templates":return H0({category:ke(d.category)},{templateRegistry:r});case "add_templated_comment":return X0({task_key:Ie(d.task_key,"task_key"),template_id:ke(d.template_id),variables:Ts(d.variables),markdown:ke(d.markdown),user_approved:qr(d.user_approved)},{pool:e,cacheManager:o,templateRegistry:r});case "create_task":return Y0({project_key:Ie(d.project_key,"project_key"),summary:ke(d.summary)??"",description:ke(d.description),template_id:ke(d.template_id),variables:Ts(d.variables),type:ke(d.type),priority:ke(d.priority),assignee_email:ke(d.assignee_email),labels:Ss(d.labels),epic_key:ke(d.epic_key),parent_key:ke(d.parent_key),original_estimate:ke(d.original_estimate)},{pool:e,cacheManager:o,taskTemplateRegistry:i});case "list_task_templates":return W0({},{taskTemplateRegistry:i});case "get_project_language":return B0({project_key:Ie(d.project_key,"project_key")},{config:t});case "update_task":return Q0({task_key:Ie(d.task_key,"task_key"),summary:ke(d.summary),description:ke(d.description),priority:ke(d.priority),labels:Ss(d.labels),original_estimate:ke(d.original_estimate),remaining_estimate:ke(d.remaining_estimate)},{pool:e});case "search_tasks":return eT({jql:Ie(d.jql,"jql"),max_results:Jd(d.max_results),project_key:ke(d.project_key)},{pool:e,config:t});case "create_monthly_tasks":return iT({execute:qr(d.execute),project:ke(d.project)});default:return M(new Error(`Unknown tool: ${l}`))}});let c=new Ad;await s.connect(c);}function mA(t,e){for(let[n,o]of Object.entries(t.projects))if(o.url===e)return n}export{aT as createServer,pA as startServer};//# sourceMappingURL=index.js.map
89
89
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softspark/jira-mcp",
3
- "version": "1.14.2",
3
+ "version": "1.14.3",
4
4
  "description": "MCP server for Jira integration \u2014 multi-instance routing, ADF formatting, task caching, and comment templates via the Model Context Protocol.",
5
5
  "keywords": [
6
6
  "mcp",