@tableau/mcp-server 2.18.0 → 2.18.1

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/build/index.js CHANGED
@@ -103,7 +103,7 @@ return fn.apply(this, arguments)
103
103
  </html>
104
104
  `}function W$e(){return function(){this.error(404)}}function Z$e(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=WC.original(this.req);r.path=null,r.pathname=B$e(r.pathname+"/");var n=z$e(F$e.format(r)),i=H$e("Redirecting","Redirecting to "+M$e(n));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(i)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",n),e.end(i)}}});var N7=x((Wn,j7)=>{"use strict";var t_=vW(),G$e=require("node:events").EventEmitter,$7=bW(),R7=EZ(),C7=$C(),P7=e7(),O7=k7();Wn=j7.exports=K$e;function K$e(){var t=function(e,r,n){t.handle(e,r,n)};return $7(t,G$e.prototype,!1),$7(t,R7,!1),t.request=Object.create(P7,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.response=Object.create(O7,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.init(),t}Wn.application=R7;Wn.request=P7;Wn.response=O7;Wn.Route=C7.Route;Wn.Router=C7;Wn.json=t_.json;Wn.raw=t_.raw;Wn.static=I7();Wn.text=t_.text;Wn.urlencoded=t_.urlencoded});var ZC=x((tat,D7)=>{"use strict";D7.exports=N7()});var rG=x((vst,tG)=>{var{isIP:tRe}=require("net");function rRe(t){return t.startsWith("[")&&t.endsWith("]")?t.substring(1,t.length-1):t}function nRe(t){return typeof t!="string"?"":t.trim().normalize("NFKD")}function iRe(t){let e=(t||"").trim().toLowerCase().match(/(?:[a-z,0-9]+?):\/\//);return!!(e&&e.index===0)}function oRe(t){return/\"|<|>|\\|\^|`|{|\||\}/.test(t||"")}function eG(t,e){let r={validSchema:!1};try{let n=new URL(nRe(t)),i=rRe(n.hostname),o=tRe(i),a=!!o,s=oRe(t);return Object.assign(n,{ip:a?i:null,validSchema:!0,hasUnsafeChars:s,ipVersion:o,hostIsIp:a})}catch{return!iRe(t)&&e?eG(`${e}://${t}`,!1):r}}tG.exports={parseURL:eG}});var aG=x((yst,oG)=>{var{BlockList:XC,isIP:nG}=require("net"),aRe=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","224.0.0.0/4","240.0.0.0/4","255.255.255.255/32"],hi=new XC;hi.addAddress("::","ipv6");hi.addAddress("::1","ipv6");hi.addSubnet("fc00::",7,"ipv6");hi.addSubnet("fe80::",10,"ipv6");hi.addSubnet("ff00::",8,"ipv6");hi.addSubnet("100::",64,"ipv6");hi.addSubnet("2001::",32,"ipv6");hi.addSubnet("2001:20::",28,"ipv6");hi.addSubnet("2001:db8::",32,"ipv6");hi.addSubnet("2002::",16,"ipv6");var Fu=new XC;Fu.addSubnet("::ffff:0:0",96,"ipv6");Fu.addSubnet("::ffff:0:0:0",96,"ipv6");Fu.addSubnet("64:ff9b::",96,"ipv6");Fu.addSubnet("64:ff9b:1::",48,"ipv6");Fu.addSubnet("::",96,"ipv6");function sRe(t){var e=t.substr(t,t.indexOf("/")),a=e,r=(1<<32-parseInt(t.substr(t.indexOf("/")+1)))-1,n=e.split(".").map(function(s){return parseInt(s)}),i=new ArrayBuffer(4),o=new Uint32Array(i);o[0]=(n[0]<<24)+(n[1]<<16)+(n[2]<<8)+n[3]+r;var a=Array.apply([],new Uint8Array(i)).reverse().join(".");return[e,a]}function iG(t){for(let e of aRe){let r=sRe(e),n=new XC;if(n.addRange(r[0],r[1]),n.check(t))return!0}return!1}function cRe(t){let e=t.split(".").map(Number);if(e.length!==4||e.some(i=>i<0||i>255||Number.isNaN(i)))return null;let r=(e[0]<<8|e[1]).toString(16),n=(e[2]<<8|e[3]).toString(16);return`${r}:${n}`}function eP(t){let e=String(t||"").toLowerCase(),r=e.match(/^(.*:)(\d{1,3}(?:\.\d{1,3}){3})$/);if(!r)return e;let n=cRe(r[2]);return n?`${r[1]}${n}`:e}function lRe(t){let e=eP(t).toLowerCase();if(nG(e)!==6||(e.match(/::/g)||[]).length>1)return null;let r=[],n=[];if(e.includes("::")){let s=e.split("::");r=s[0]?s[0].split(":").filter(Boolean):[],n=s[1]?s[1].split(":").filter(Boolean):[]}else r=e.split(":").filter(Boolean);let i=/^[0-9a-f]{1,4}$/;if(![...r,...n].every(s=>i.test(s)))return null;let o=8-(r.length+n.length);if(o<0||!e.includes("::")&&o!==0)return null;let a=e.includes("::")?[...r,...Array(o).fill("0"),...n]:r;return a.length!==8?null:a.map(s=>parseInt(s,16))}function uRe(t){let e=eP(t);if(!Fu.check(e,"ipv6"))return null;let r=lRe(e);return r?[r[6]>>8,r[6]&255,r[7]>>8,r[7]&255].join("."):null}function pRe(t){let e=eP(t);if(nG(e)!==6)return!1;let r=uRe(e);return!!(r&&iG(r)||hi.check(e,"ipv6"))}function dRe(t,e){return(e===4?iG:pRe)(t)}oG.exports={isPrivateIP:dRe}});var cG=x((bst,sG)=>{function mRe(t){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(t)||/^::1$/.test(t)}sG.exports={isLoopbackAddr:mRe}});var uG=x((xst,lG)=>{var{parseURL:fRe}=rG(),{isPrivateIP:hRe}=aG(),{isLoopbackAddr:gRe}=cG();function vRe(t,e){if(typeof t!="string"||!t)return!1;let r=Object.assign({quiet:!0,noIP:!1,allowUsername:!1,allowUnsafeChars:!1,autoPrependProtocol:"https",allowedProtocols:["http","https"]},e);try{let{ip:n,hostIsIp:i,ipVersion:o,hostname:a,username:s,protocol:c,validSchema:l,hasUnsafeChars:u}=fRe(t,r.autoPrependProtocol);return!(!l||!a||!r.allowUnsafeChars&&u||s&&!r.allowUsername||[".",".."].includes(a)||["localhost","::"].includes(a)||r.allowedProtocols&&!r.allowedProtocols.includes(c.replace(":",""))||i&&(r.noIP||gRe(n)||hRe(n,o)))}catch(n){if(!r.quiet)throw n;return!1}}lG.exports={isSSRFSafeURL:vRe}});var tT=Ze(require("node:process"),1);LS();var FS="2025-11-25",Fj="2025-03-26",Rc=[FS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Do="io.modelcontextprotocol/related-task",lv="2.0",Ut=qS(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Vj=rt([A(),Ge().int()]),Bj=A(),HPe=br({ttl:Ge().optional(),pollInterval:Ge().optional()}),LQ=H({ttl:Ge().optional()}),UQ=H({taskId:A()}),VS=br({progressToken:Vj.optional(),[Do]:UQ.optional()}),un=H({_meta:VS.optional()}),Zp=un.extend({task:LQ.optional()}),Hj=t=>Zp.safeParse(t).success,ar=H({method:A(),params:un.loose().optional()}),Sn=H({_meta:VS.optional()}),Tn=H({method:A(),params:Sn.loose().optional()}),sr=br({_meta:VS.optional()}),Cc=rt([A(),Ge().int()]),Wj=H({jsonrpc:Y(lv),id:Cc,...ar.shape}).strict(),qo=t=>Wj.safeParse(t).success,Zj=H({jsonrpc:Y(lv),...Tn.shape}).strict(),Gj=t=>Zj.safeParse(t).success,BS=H({jsonrpc:Y(lv),id:Cc,result:sr}).strict(),Ki=t=>BS.safeParse(t).success;var re;(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"})(re||(re={}));var HS=H({jsonrpc:Y(lv),id:Cc.optional(),error:H({code:Ge().int(),message:A(),data:mt().optional()})}).strict();var Pc=t=>HS.safeParse(t).success;var Oc=rt([Wj,Zj,BS,HS]),WPe=rt([BS,HS]),Gp=sr.strict(),FQ=Sn.extend({requestId:Cc.optional(),reason:A().optional()}),uv=Tn.extend({method:Y("notifications/cancelled"),params:FQ}),VQ=H({src:A(),mimeType:A().optional(),sizes:Re(A()).optional(),theme:Pr(["light","dark"]).optional()}),Kp=H({icons:Re(VQ).optional()}),$c=H({name:A(),title:A().optional()}),Jp=$c.extend({...$c.shape,...Kp.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),BQ=Wp(H({applyDefaults:zt().optional()}),nt(A(),mt())),HQ=sv(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Wp(H({form:BQ.optional(),url:Ut.optional()}),nt(A(),mt()).optional())),WQ=br({list:Ut.optional(),cancel:Ut.optional(),requests:br({sampling:br({createMessage:Ut.optional()}).optional(),elicitation:br({create:Ut.optional()}).optional()}).optional()}),ZQ=br({list:Ut.optional(),cancel:Ut.optional(),requests:br({tools:br({call:Ut.optional()}).optional()}).optional()}),GQ=H({experimental:nt(A(),Ut).optional(),sampling:H({context:Ut.optional(),tools:Ut.optional()}).optional(),elicitation:HQ.optional(),roots:H({listChanged:zt().optional()}).optional(),tasks:WQ.optional(),extensions:nt(A(),Ut).optional()}),KQ=un.extend({protocolVersion:A(),capabilities:GQ,clientInfo:Jp}),pv=ar.extend({method:Y("initialize"),params:KQ}),zo=t=>pv.safeParse(t).success,JQ=H({experimental:nt(A(),Ut).optional(),logging:Ut.optional(),completions:Ut.optional(),prompts:H({listChanged:zt().optional()}).optional(),resources:H({subscribe:zt().optional(),listChanged:zt().optional()}).optional(),tools:H({listChanged:zt().optional()}).optional(),tasks:ZQ.optional(),extensions:nt(A(),Ut).optional()}),QQ=sr.extend({protocolVersion:A(),capabilities:JQ,serverInfo:Jp,instructions:A().optional()}),WS=Tn.extend({method:Y("notifications/initialized"),params:Sn.optional()});var Ba=ar.extend({method:Y("ping"),params:un.optional()}),YQ=H({progress:Ge(),total:pt(Ge()),message:pt(A())}),XQ=H({...Sn.shape,...YQ.shape,progressToken:Vj}),dv=Tn.extend({method:Y("notifications/progress"),params:XQ}),eY=un.extend({cursor:Bj.optional()}),Qp=ar.extend({params:eY.optional()}),Yp=sr.extend({nextCursor:Bj.optional()}),tY=Pr(["working","input_required","completed","failed","cancelled"]),Xp=H({taskId:A(),status:tY,ttl:rt([Ge(),tv()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:pt(Ge()),statusMessage:pt(A())}),jc=sr.extend({task:Xp}),rY=Sn.merge(Xp),ed=Tn.extend({method:Y("notifications/tasks/status"),params:rY}),mv=ar.extend({method:Y("tasks/get"),params:un.extend({taskId:A()})}),fv=sr.merge(Xp),hv=ar.extend({method:Y("tasks/result"),params:un.extend({taskId:A()})}),ZPe=sr.loose(),gv=Qp.extend({method:Y("tasks/list")}),vv=Yp.extend({tasks:Re(Xp)}),yv=ar.extend({method:Y("tasks/cancel"),params:un.extend({taskId:A()})}),Kj=sr.merge(Xp),Jj=H({uri:A(),mimeType:pt(A()),_meta:nt(A(),mt()).optional()}),Qj=Jj.extend({text:A()}),ZS=A().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Yj=Jj.extend({blob:ZS}),td=Pr(["user","assistant"]),Nc=H({audience:Re(td).optional(),priority:Ge().min(0).max(1).optional(),lastModified:kc.datetime({offset:!0}).optional()}),Xj=H({...$c.shape,...Kp.shape,uri:A(),description:pt(A()),mimeType:pt(A()),size:pt(Ge()),annotations:Nc.optional(),_meta:pt(br({}))}),nY=H({...$c.shape,...Kp.shape,uriTemplate:A(),description:pt(A()),mimeType:pt(A()),annotations:Nc.optional(),_meta:pt(br({}))}),bv=Qp.extend({method:Y("resources/list")}),eN=Yp.extend({resources:Re(Xj)}),xv=Qp.extend({method:Y("resources/templates/list")}),iY=Yp.extend({resourceTemplates:Re(nY)}),GS=un.extend({uri:A()}),oY=GS,wv=ar.extend({method:Y("resources/read"),params:oY}),tN=sr.extend({contents:Re(rt([Qj,Yj]))}),aY=Tn.extend({method:Y("notifications/resources/list_changed"),params:Sn.optional()}),sY=GS,cY=ar.extend({method:Y("resources/subscribe"),params:sY}),lY=GS,uY=ar.extend({method:Y("resources/unsubscribe"),params:lY}),pY=Sn.extend({uri:A()}),dY=Tn.extend({method:Y("notifications/resources/updated"),params:pY}),mY=H({name:A(),description:pt(A()),required:pt(zt())}),fY=H({...$c.shape,...Kp.shape,description:pt(A()),arguments:pt(Re(mY)),_meta:pt(br({}))}),_v=Qp.extend({method:Y("prompts/list")}),hY=Yp.extend({prompts:Re(fY)}),gY=un.extend({name:A(),arguments:nt(A(),A()).optional()}),Sv=ar.extend({method:Y("prompts/get"),params:gY}),KS=H({type:Y("text"),text:A(),annotations:Nc.optional(),_meta:nt(A(),mt()).optional()}),JS=H({type:Y("image"),data:ZS,mimeType:A(),annotations:Nc.optional(),_meta:nt(A(),mt()).optional()}),QS=H({type:Y("audio"),data:ZS,mimeType:A(),annotations:Nc.optional(),_meta:nt(A(),mt()).optional()}),vY=H({type:Y("tool_use"),name:A(),id:A(),input:nt(A(),mt()),_meta:nt(A(),mt()).optional()}),YS=H({type:Y("resource"),resource:rt([Qj,Yj]),annotations:Nc.optional(),_meta:nt(A(),mt()).optional()}),XS=Xj.extend({type:Y("resource_link")}),Dc=rt([KS,JS,QS,XS,YS]),yY=H({role:td,content:Dc}),bY=sr.extend({description:A().optional(),messages:Re(yY)}),xY=Tn.extend({method:Y("notifications/prompts/list_changed"),params:Sn.optional()}),wY=H({title:A().optional(),readOnlyHint:zt().optional(),destructiveHint:zt().optional(),idempotentHint:zt().optional(),openWorldHint:zt().optional()}),_Y=H({taskSupport:Pr(["required","optional","forbidden"]).optional()}),Tv=H({...$c.shape,...Kp.shape,description:A().optional(),inputSchema:H({type:Y("object"),properties:nt(A(),Ut).optional(),required:Re(A()).optional()}).catchall(mt()),outputSchema:H({type:Y("object"),properties:nt(A(),Ut).optional(),required:Re(A()).optional()}).catchall(mt()).optional(),annotations:wY.optional(),execution:_Y.optional(),_meta:nt(A(),mt()).optional()}),rd=Qp.extend({method:Y("tools/list")}),SY=Yp.extend({tools:Re(Tv)}),Ha=sr.extend({content:Re(Dc).default([]),structuredContent:nt(A(),mt()).optional(),isError:zt().optional()}),GPe=Ha.or(sr.extend({toolResult:mt()})),TY=Zp.extend({name:A(),arguments:nt(A(),mt()).optional()}),Ji=ar.extend({method:Y("tools/call"),params:TY}),EY=Tn.extend({method:Y("notifications/tools/list_changed"),params:Sn.optional()}),KPe=H({autoRefresh:zt().default(!0),debounceMs:Ge().int().nonnegative().default(300)}),nd=Pr(["debug","info","notice","warning","error","critical","alert","emergency"]),kY=un.extend({level:nd}),Wa=ar.extend({method:Y("logging/setLevel"),params:kY}),AY=Sn.extend({level:nd,logger:A().optional(),data:mt()}),IY=Tn.extend({method:Y("notifications/message"),params:AY}),$Y=H({name:A().optional()}),RY=H({hints:Re($Y).optional(),costPriority:Ge().min(0).max(1).optional(),speedPriority:Ge().min(0).max(1).optional(),intelligencePriority:Ge().min(0).max(1).optional()}),CY=H({mode:Pr(["auto","required","none"]).optional()}),PY=H({type:Y("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Re(Dc).default([]),structuredContent:H({}).loose().optional(),isError:zt().optional(),_meta:nt(A(),mt()).optional()}),OY=ov("type",[KS,JS,QS]),cv=ov("type",[KS,JS,QS,vY,PY]),jY=H({role:td,content:rt([cv,Re(cv)]),_meta:nt(A(),mt()).optional()}),NY=Zp.extend({messages:Re(jY),modelPreferences:RY.optional(),systemPrompt:A().optional(),includeContext:Pr(["none","thisServer","allServers"]).optional(),temperature:Ge().optional(),maxTokens:Ge().int(),stopSequences:Re(A()).optional(),metadata:Ut.optional(),tools:Re(Tv).optional(),toolChoice:CY.optional()}),DY=ar.extend({method:Y("sampling/createMessage"),params:NY}),qc=sr.extend({model:A(),stopReason:pt(Pr(["endTurn","stopSequence","maxTokens"]).or(A())),role:td,content:OY}),Ev=sr.extend({model:A(),stopReason:pt(Pr(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:td,content:rt([cv,Re(cv)])}),qY=H({type:Y("boolean"),title:A().optional(),description:A().optional(),default:zt().optional()}),zY=H({type:Y("string"),title:A().optional(),description:A().optional(),minLength:Ge().optional(),maxLength:Ge().optional(),format:Pr(["email","uri","date","date-time"]).optional(),default:A().optional()}),MY=H({type:Pr(["number","integer"]),title:A().optional(),description:A().optional(),minimum:Ge().optional(),maximum:Ge().optional(),default:Ge().optional()}),LY=H({type:Y("string"),title:A().optional(),description:A().optional(),enum:Re(A()),default:A().optional()}),UY=H({type:Y("string"),title:A().optional(),description:A().optional(),oneOf:Re(H({const:A(),title:A()})),default:A().optional()}),FY=H({type:Y("string"),title:A().optional(),description:A().optional(),enum:Re(A()),enumNames:Re(A()).optional(),default:A().optional()}),VY=rt([LY,UY]),BY=H({type:Y("array"),title:A().optional(),description:A().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:H({type:Y("string"),enum:Re(A())}),default:Re(A()).optional()}),HY=H({type:Y("array"),title:A().optional(),description:A().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:H({anyOf:Re(H({const:A(),title:A()}))}),default:Re(A()).optional()}),WY=rt([BY,HY]),ZY=rt([FY,VY,WY]),GY=rt([ZY,qY,zY,MY]),KY=Zp.extend({mode:Y("form").optional(),message:A(),requestedSchema:H({type:Y("object"),properties:nt(A(),GY),required:Re(A()).optional()})}),JY=Zp.extend({mode:Y("url"),message:A(),elicitationId:A(),url:A().url()}),QY=rt([KY,JY]),YY=ar.extend({method:Y("elicitation/create"),params:QY}),XY=Sn.extend({elicitationId:A()}),eX=Tn.extend({method:Y("notifications/elicitation/complete"),params:XY}),zc=sr.extend({action:Pr(["accept","decline","cancel"]),content:sv(t=>t===null?void 0:t,nt(A(),rt([A(),Ge(),zt(),Re(A())])).optional())}),tX=H({type:Y("ref/resource"),uri:A()});var rX=H({type:Y("ref/prompt"),name:A()}),nX=un.extend({ref:rt([rX,tX]),argument:H({name:A(),value:A()}),context:H({arguments:nt(A(),A()).optional()}).optional()}),kv=ar.extend({method:Y("completion/complete"),params:nX});function rN(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function nN(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var iX=sr.extend({completion:br({values:Re(A()).max(100),total:pt(Ge().int()),hasMore:pt(zt())})}),oX=H({uri:A().startsWith("file://"),name:A().optional(),_meta:nt(A(),mt()).optional()}),aX=ar.extend({method:Y("roots/list"),params:un.optional()}),eT=sr.extend({roots:Re(oX)}),sX=Tn.extend({method:Y("notifications/roots/list_changed"),params:Sn.optional()}),JPe=rt([Ba,pv,kv,Wa,Sv,_v,bv,xv,wv,cY,uY,Ji,rd,mv,hv,gv,yv]),QPe=rt([uv,dv,WS,sX,ed]),YPe=rt([Gp,qc,Ev,zc,eT,fv,vv,jc]),XPe=rt([Ba,DY,YY,aX,mv,hv,gv,yv]),eOe=rt([uv,dv,IY,dY,aY,EY,xY,ed,eX]),tOe=rt([Gp,QQ,iX,bY,hY,eN,iY,tN,Ha,SY,fv,vv,jc]),X=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===re.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new US(i.elicitations,r)}return new t(e,r,n)}},US=class extends X{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(re.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};var Av=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
105
105
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),cX(r)}clear(){this._buffer=void 0}};function cX(t){return Oc.parse(JSON.parse(t))}function iN(t){return JSON.stringify(t)+`
106
- `}var Iv=class{constructor(e=tT.default.stdin,r=tT.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Av,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,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(r=>{let n=iN(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var DG=Ze(uN());var Mc={name:"@tableau/mcp-server",description:"Helping agents see and understand data.",version:"2.18.0",repository:{type:"git",url:"git+https://github.com/tableau/tableau-mcp.git"},homepage:"https://github.com/tableau/tableau-mcp",bugs:"https://github.com/tableau/tableau-mcp/issues",author:"Tableau",type:"commonjs",license:"Apache-2.0",keywords:["tableau","mcp"],bin:{"tableau-mcp-server":"./build/index.js"},exports:{".":"./build/index.js","./tracing":"./build/telemetry/tracing.js"},scripts:{build:"tsx src/scripts/build.ts","build:desktop":"tsx src/scripts/build.ts --variant desktop","build:combined":"tsx src/scripts/build.ts --variant combined","build:dev":"tsx src/scripts/build.ts --dev","build:docker":"docker build -t tableau-mcp .",":build:mcpb":"npx -y @anthropic-ai/mcpb pack . tableau-mcp.mcpb","build:mcpb":"run-s build:manifest :build:mcpb","build:manifest":"tsx src/scripts/createClaudeMcpBundleManifest.ts","start:http":"node build/index.js","start:http:apm":"node -r ./build/telemetry/tracing.js build/index.js","start:http:docker":"docker run -p 3927:3927 -i --rm --env-file env.list tableau-mcp",lint:"npm exec eslint","lint:fix":"npm exec eslint -- --fix",inspect:"npx @modelcontextprotocol/inspector --config config.json --server tableau",":inspect:http":"npx @modelcontextprotocol/inspector --config config.http.json --server tableau","inspect:http":"run-p start:http :inspect:http","inspect:docker":"npx @modelcontextprotocol/inspector --config config.docker.json --server tableau","inspect:docker:http":"run-p start:http:docker :inspect:http","build:inspect":"run-s build inspect","build:inspect:docker":"run-s build:docker inspect:docker","build:inspect:docker:http":"run-s build:docker inspect:docker:http",test:"vitest --config ./vitest.config.ts","test:e2e":"vitest --config ./vitest.config.e2e.ts","test:eval":"vitest --config ./vitest.config.eval.ts","test:oauth:embedded":"vitest --config ./vitest.config.oauth.embedded.ts","test:oauth:tableau":"npx playwright test",coverage:"vitest run --config ./vitest.config.ts --coverage","version:major":"npm version major --no-git-tag-version","version:minor":"npm version minor --no-git-tag-version","version:patch":"npm version patch --no-git-tag-version","docs:start":"npm run start --prefix docs"},dependencies:{"@modelcontextprotocol/ext-apps":"^1.7.2","@modelcontextprotocol/sdk":"^1.26.0","@xmldom/xmldom":"^0.9.10","@zodios/core":"^10.9.6","cookie-parser":"^1.4.7",cors:"^2.8.5",dotenv:"^16.5.0",express:"^5.1.0","fast-levenshtein":"^3.0.0",jose:"^6.0.12",ssrfcheck:"^1.2.0","ts-results-es":"^5.0.1",xpath:"^0.0.34",zod:"^3.24.3","zod-validation-error":"^4.0.1"},devDependencies:{"@anthropic-ai/mcpb":"^1.0.0","@eslint/eslintrc":"^3.3.1","@eslint/js":"^9.25.1","@openai/agents":"^0.1.9","@playwright/test":"^1.58.2","@types/cookie-parser":"^1.4.10","@types/cors":"^2.8.19","@types/eslint__js":"^8.42.3","@types/express":"^5.0.3","@types/fast-levenshtein":"^0.0.1","@types/node":"^22.15.3","@types/supertest":"^6.0.3","@typescript-eslint/eslint-plugin":"^8.31.1","@typescript-eslint/parser":"^8.31.1","@vitest/coverage-v8":"^3.1.3",esbuild:"^0.25.5",eslint:"^9.25.1","eslint-config-prettier":"^10.1.2","eslint-plugin-prettier":"^5.2.6","eslint-plugin-simple-import-sort":"^12.1.1",jsdom:"^29.1.1","npm-run-all":"^4.1.5",openai:"^5.23.2",prettier:"^3.5.3",supertest:"^7.1.4",tsx:"^4.21.0",typescript:"^5.8.3","typescript-eslint":"^8.31.1","vite-plugin-singlefile":"^2.3.3",vitest:"^3.1.3"},engines:{node:">=22.7.5"}};var pd=require("fs");var vN=require("path");var pN=require("node:fs/promises"),Cv=require("fs"),dN=require("path");function oe(t){if(t instanceof Error)return t.message;try{return JSON.stringify(t)??"undefined"}catch{return`${t}`}}var mN,fN=t=>{mN=t},Pv=()=>mN,Rv=class{_logDirectory;_fileMutexes=new Map;constructor({logDirectory:e}){this._logDirectory=e,(0,Cv.existsSync)(this._logDirectory)||(0,Cv.mkdirSync)(this._logDirectory,{recursive:!0})}async log(e){let r=new Date().toISOString(),n=`${new Date(new Date().setMinutes(0,0,0)).toISOString().replace(/[:.]/g,"-")}.log`,i=(0,dN.join)(this._logDirectory,n),o=i,s=(this._fileMutexes.get(o)??Promise.resolve()).then(async()=>{try{await(0,pN.appendFile)(i,JSON.stringify({timestamp:r,...e})+`
106
+ `}var Iv=class{constructor(e=tT.default.stdin,r=tT.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Av,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,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(r=>{let n=iN(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var DG=Ze(uN());var Mc={name:"@tableau/mcp-server",description:"Helping agents see and understand data.",version:"2.18.1",repository:{type:"git",url:"git+https://github.com/tableau/tableau-mcp.git"},homepage:"https://github.com/tableau/tableau-mcp",bugs:"https://github.com/tableau/tableau-mcp/issues",author:"Tableau",type:"commonjs",license:"Apache-2.0",keywords:["tableau","mcp"],bin:{"tableau-mcp-server":"./build/index.js"},exports:{".":"./build/index.js","./tracing":"./build/telemetry/tracing.js"},scripts:{build:"tsx src/scripts/build.ts","build:desktop":"tsx src/scripts/build.ts --variant desktop","build:combined":"tsx src/scripts/build.ts --variant combined","build:dev":"tsx src/scripts/build.ts --dev","build:docker":"docker build -t tableau-mcp .",":build:mcpb":"npx -y @anthropic-ai/mcpb pack . tableau-mcp.mcpb","build:mcpb":"run-s build:manifest :build:mcpb","build:manifest":"tsx src/scripts/createClaudeMcpBundleManifest.ts","start:http":"node build/index.js","start:http:apm":"node -r ./build/telemetry/tracing.js build/index.js","start:http:docker":"docker run -p 3927:3927 -i --rm --env-file env.list tableau-mcp",lint:"npm exec eslint","lint:fix":"npm exec eslint -- --fix",inspect:"npx @modelcontextprotocol/inspector --config config.json --server tableau",":inspect:http":"npx @modelcontextprotocol/inspector --config config.http.json --server tableau","inspect:http":"run-p start:http :inspect:http","inspect:docker":"npx @modelcontextprotocol/inspector --config config.docker.json --server tableau","inspect:docker:http":"run-p start:http:docker :inspect:http","build:inspect":"run-s build inspect","build:inspect:docker":"run-s build:docker inspect:docker","build:inspect:docker:http":"run-s build:docker inspect:docker:http",test:"vitest --config ./vitest.config.ts","test:e2e":"vitest --config ./vitest.config.e2e.ts","test:eval":"vitest --config ./vitest.config.eval.ts","test:oauth:embedded":"vitest --config ./vitest.config.oauth.embedded.ts","test:oauth:tableau":"npx playwright test",coverage:"vitest run --config ./vitest.config.ts --coverage","version:major":"npm version major --no-git-tag-version","version:minor":"npm version minor --no-git-tag-version","version:patch":"npm version patch --no-git-tag-version","docs:start":"npm run start --prefix docs"},dependencies:{"@modelcontextprotocol/ext-apps":"^1.7.2","@modelcontextprotocol/sdk":"^1.26.0","@xmldom/xmldom":"^0.9.10","@zodios/core":"^10.9.6","cookie-parser":"^1.4.7",cors:"^2.8.5",dotenv:"^16.5.0",express:"^5.1.0","fast-levenshtein":"^3.0.0",jose:"^6.0.12",ssrfcheck:"^1.2.0","ts-results-es":"^5.0.1",xpath:"^0.0.34",zod:"^3.24.3","zod-validation-error":"^4.0.1"},devDependencies:{"@anthropic-ai/mcpb":"^2.1.2","@eslint/eslintrc":"^3.3.1","@eslint/js":"^9.25.1","@openai/agents":"^0.1.9","@playwright/test":"^1.58.2","@types/cookie-parser":"^1.4.10","@types/cors":"^2.8.19","@types/eslint__js":"^8.42.3","@types/express":"^5.0.3","@types/fast-levenshtein":"^0.0.1","@types/node":"^22.15.3","@types/supertest":"^6.0.3","@typescript-eslint/eslint-plugin":"^8.31.1","@typescript-eslint/parser":"^8.31.1","@vitest/coverage-v8":"^3.1.3",esbuild:"^0.25.5",eslint:"^9.25.1","eslint-config-prettier":"^10.1.2","eslint-plugin-prettier":"^5.2.6","eslint-plugin-simple-import-sort":"^12.1.1",jsdom:"^29.1.1","npm-run-all":"^4.1.5",openai:"^5.23.2",prettier:"^3.5.3",supertest:"^7.1.4",tsx:"^4.21.0",typescript:"^5.8.3","typescript-eslint":"^8.31.1","vite-plugin-singlefile":"^2.3.3",vitest:"^3.1.3"},engines:{node:">=22.7.5"}};var pd=require("fs");var vN=require("path");var pN=require("node:fs/promises"),Cv=require("fs"),dN=require("path");function oe(t){if(t instanceof Error)return t.message;try{return JSON.stringify(t)??"undefined"}catch{return`${t}`}}var mN,fN=t=>{mN=t},Pv=()=>mN,Rv=class{_logDirectory;_fileMutexes=new Map;constructor({logDirectory:e}){this._logDirectory=e,(0,Cv.existsSync)(this._logDirectory)||(0,Cv.mkdirSync)(this._logDirectory,{recursive:!0})}async log(e){let r=new Date().toISOString(),n=`${new Date(new Date().setMinutes(0,0,0)).toISOString().replace(/[:.]/g,"-")}.log`,i=(0,dN.join)(this._logDirectory,n),o=i,s=(this._fileMutexes.get(o)??Promise.resolve()).then(async()=>{try{await(0,pN.appendFile)(i,JSON.stringify({timestamp:r,...e})+`
107
107
  `)}catch(c){process.stderr.write(`Failed to write to log file ${i}: ${oe(c)}
108
108
  `)}});this._fileMutexes.set(o,s),s.finally(()=>{this._fileMutexes.get(o)===s&&this._fileMutexes.delete(o)}),await s}};var iT=["debug","info","notice","warning","error","critical","alert","emergency"],Ov=Object.fromEntries(iT.map((t,e)=>[t,e]));function TX(t,e){return Ov[t]>=Ov[e]}function EX(t){return t in Ov}function hN(t){let e=t?.trim();return e&&EX(e)?e:"info"}function kX(t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack,...t.cause!==void 0&&{cause:t.cause}}:t}function q(t){let e=jv();if(TX(t.level,e.logLevel)){if(t.data=kX(t.data),e.loggers.has("appLogger")){let r=JSON.stringify(t);e.transport==="http"?console.log(r):process.stderr.write(r+`
109
109
  `)}e.loggers.has("fileLogger")&&Pv()?.log(t)}}var AX=["fileLogger","appLogger"],IX=new Set(AX);function gN(t){return t?new Set(t.split(",").map(e=>e.trim()).filter(e=>IX.has(e))):new Set(["appLogger"])}var $X=["stdio","http"];function Nv(t){return!!$X.find(e=>e===t)}function Dv(){if(typeof __dirname=="string")return __dirname;throw new Error("__dirname is not set")}var Ct={fromSeconds:t=>t*1e3,fromMinutes:t=>t*60*1e3,fromHours:t=>t*60*60*1e3,fromDays:t=>t*24*60*60*1e3,fromWeeks:t=>t*7*24*60*60*1e3,fromMonths:t=>t*30*24*60*60*1e3,fromYears:t=>t*365.25*24*60*60*1e3};function Vt(t,{defaultValue:e,minValue:r,maxValue:n}={defaultValue:0,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.POSITIVE_INFINITY}){if(!t)return e;let i=parseFloat(t);return isNaN(i)||r!==void 0&&i<r||n!==void 0&&i>n?e:i}var RX=Dv(),od=class{transport;defaultNotificationLevel;logLevel;loggers;fileLoggerDirectory;disableLogMasking;maxRequestTimeoutMs;notificationPayloadMaxBytes;constructor(){let e=ad(process.env),{TRANSPORT:r,DEFAULT_NOTIFICATION_LEVEL:n,LOG_LEVEL:i,ENABLED_LOGGERS:o,FILE_LOGGER_DIRECTORY:a,DISABLE_LOG_MASKING:s,MAX_REQUEST_TIMEOUT_MS:c,NOTIFICATION_PAYLOAD_MAX_BYTES:l}=e;this.transport=Nv(r)?r:"stdio",this.defaultNotificationLevel=n??"debug",this.logLevel=hN(i),this.loggers=gN(o),this.fileLoggerDirectory=a||(0,vN.join)(RX,"logs"),this.disableLogMasking=s==="true",this.maxRequestTimeoutMs=Vt(c,{defaultValue:Ct.fromMinutes(10),minValue:5e3,maxValue:Ct.fromHours(1)}),this.notificationPayloadMaxBytes=Vt(l,{defaultValue:8192,minValue:1})}};function ad(t){return Object.entries(t).reduce((e,[r,n])=>(n?.startsWith("${user_config.")?e[r]="":e[r]=n,e),{})}var jv=()=>new od;var p={};Vi(p,{BRAND:()=>ree,DIRTY:()=>Za,EMPTY_PATH:()=>jX,INVALID:()=>ne,NEVER:()=>Mee,OK:()=>xr,ParseStatus:()=>cr,Schema:()=>be,ZodAny:()=>Uo,ZodArray:()=>to,ZodBigInt:()=>Ka,ZodBoolean:()=>Ja,ZodBranded:()=>cd,ZodCatch:()=>ss,ZodDate:()=>Qa,ZodDefault:()=>as,ZodDiscriminatedUnion:()=>Mv,ZodEffects:()=>kn,ZodEnum:()=>is,ZodError:()=>Hr,ZodFirstPartyTypeKind:()=>O,ZodFunction:()=>Uv,ZodIntersection:()=>ts,ZodIssueCode:()=>R,ZodLazy:()=>rs,ZodLiteral:()=>ns,ZodMap:()=>Hc,ZodNaN:()=>Zc,ZodNativeEnum:()=>os,ZodNever:()=>Kn,ZodNull:()=>Xa,ZodNullable:()=>bi,ZodNumber:()=>Ga,ZodObject:()=>Zr,ZodOptional:()=>Wr,ZodParsedType:()=>B,ZodPipeline:()=>ld,ZodPromise:()=>Fo,ZodReadonly:()=>cs,ZodRecord:()=>Lv,ZodSchema:()=>be,ZodSet:()=>Wc,ZodString:()=>Lo,ZodSymbol:()=>Vc,ZodTransformer:()=>kn,ZodTuple:()=>yi,ZodType:()=>be,ZodUndefined:()=>Ya,ZodUnion:()=>es,ZodUnknown:()=>eo,ZodVoid:()=>Bc,addIssueToContext:()=>U,any:()=>pee,array:()=>hee,bigint:()=>aee,boolean:()=>IN,coerce:()=>zee,custom:()=>EN,date:()=>see,datetimeRegex:()=>SN,defaultErrorMap:()=>Yi,discriminatedUnion:()=>yee,effect:()=>Ree,enum:()=>Aee,function:()=>Tee,getErrorMap:()=>Lc,getParsedType:()=>vi,instanceof:()=>iee,intersection:()=>bee,isAborted:()=>qv,isAsync:()=>Uc,isDirty:()=>zv,isValid:()=>Mo,late:()=>nee,lazy:()=>Eee,literal:()=>kee,makeIssue:()=>sd,map:()=>_ee,nan:()=>oee,nativeEnum:()=>Iee,never:()=>mee,null:()=>uee,nullable:()=>Pee,number:()=>AN,object:()=>cT,objectUtil:()=>oT,oboolean:()=>qee,onumber:()=>Dee,optional:()=>Cee,ostring:()=>Nee,pipeline:()=>jee,preprocess:()=>Oee,promise:()=>$ee,quotelessJson:()=>CX,record:()=>wee,set:()=>See,setErrorMap:()=>OX,strictObject:()=>gee,string:()=>kN,symbol:()=>cee,transformer:()=>Ree,tuple:()=>xee,undefined:()=>lee,union:()=>vee,unknown:()=>dee,util:()=>Ce,void:()=>fee});var Ce;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let a of i)o[a]=a;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(let s of o)a[s]=i[s];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},t.find=(i,o)=>{for(let a of i)if(o(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Ce||(Ce={}));var oT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(oT||(oT={}));var B=Ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vi=t=>{switch(typeof t){case"undefined":return B.undefined;case"string":return B.string;case"number":return Number.isNaN(t)?B.nan:B.number;case"boolean":return B.boolean;case"function":return B.function;case"bigint":return B.bigint;case"symbol":return B.symbol;case"object":return Array.isArray(t)?B.array:t===null?B.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?B.promise:typeof Map<"u"&&t instanceof Map?B.map:typeof Set<"u"&&t instanceof Set?B.set:typeof Date<"u"&&t instanceof Date?B.date:B.object;default:return B.unknown}};var R=Ce.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"]),CX=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Hr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let l=a.path[c];c===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),n}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,Ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Hr.create=t=>new Hr(t);var PX=(t,e)=>{let r;switch(t.code){case R.invalid_type:t.received===B.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case R.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ce.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ce.joinValues(t.keys,", ")}`;break;case R.invalid_union:r="Invalid input";break;case R.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ce.joinValues(t.options)}`;break;case R.invalid_enum_value:r=`Invalid enum value. Expected ${Ce.joinValues(t.options)}, received '${t.received}'`;break;case R.invalid_arguments:r="Invalid function arguments";break;case R.invalid_return_type:r="Invalid function return type";break;case R.invalid_date:r="Invalid date";break;case R.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ce.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case R.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case R.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case R.custom:r="Invalid input";break;case R.invalid_intersection_types:r="Intersection results could not be merged";break;case R.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case R.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ce.assertNever(t)}return{message:r}},Yi=PX;var yN=Yi;function OX(t){yN=t}function Lc(){return yN}var sd=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],a={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(a,{data:e,defaultError:s}).message;return{...i,path:o,message:s}},jX=[];function U(t,e){let r=Lc(),n=sd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Yi?void 0:Yi].filter(i=>!!i)});t.common.issues.push(n)}var cr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ne;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,a=await i.value;n.push({key:o,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return ne;o.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[o.value]=a.value)}return{status:e.value,value:n}}},ne=Object.freeze({status:"aborted"}),Za=t=>({status:"dirty",value:t}),xr=t=>({status:"valid",value:t}),qv=t=>t.status==="aborted",zv=t=>t.status==="dirty",Mo=t=>t.status==="valid",Uc=t=>typeof Promise<"u"&&t instanceof Promise;var Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var En=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},bN=(t,e)=>{if(Mo(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Hr(t.common.issues);return this._error=r,this._error}}};function he(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,s)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var be=class{get description(){return this._def.description}_getType(e){return vi(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:vi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new cr,ctx:{common:e.parent.common,data:e.data,parsedType:vi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Uc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vi(e)},i=this._parseSync({data:e,path:n.path,parent:n});return bN(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vi(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Mo(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Mo(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vi(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(Uc(i)?i:Promise.resolve(i));return bN(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let a=e(i),s=()=>o.addIssue({code:R.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new kn({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Wr.create(this,this._def)}nullable(){return bi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return to.create(this)}promise(){return Fo.create(this,this._def)}or(e){return es.create([this,e],this._def)}and(e){return ts.create(this,e,this._def)}transform(e){return new kn({...he(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new as({...he(this._def),innerType:this,defaultValue:r,typeName:O.ZodDefault})}brand(){return new cd({typeName:O.ZodBranded,type:this,...he(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ss({...he(this._def),innerType:this,catchValue:r,typeName:O.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ld.create(this,e)}readonly(){return cs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},NX=/^c[^\s-]{8,}$/i,DX=/^[0-9a-z]+$/,qX=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zX=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,MX=/^[a-z0-9_-]{21}$/i,LX=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,UX=/^[-+]?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)?)??$/,FX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,VX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",aT,BX=/^(?:(?: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])$/,HX=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,WX=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ZX=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,GX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,KX=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wN="((\\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])))",JX=new RegExp(`^${wN}$`);function _N(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function QX(t){return new RegExp(`^${_N(t)}$`)}function SN(t){let e=`${wN}T${_N(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function YX(t,e){return!!((e==="v4"||!e)&&BX.test(t)||(e==="v6"||!e)&&WX.test(t))}function XX(t,e){if(!LX.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function eee(t,e){return!!((e==="v4"||!e)&&HX.test(t)||(e==="v6"||!e)&&ZX.test(t))}var Lo=class t extends be{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==B.string){let o=this._getOrReturnCtx(e);return U(o,{code:R.invalid_type,expected:B.string,received:o.parsedType}),ne}let n=new cr,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),U(i,{code:R.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),U(i,{code:R.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let a=e.data.length>o.value,s=e.data.length<o.value;(a||s)&&(i=this._getOrReturnCtx(e,i),a?U(i,{code:R.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&U(i,{code:R.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")FX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"email",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")aT||(aT=new RegExp(VX,"u")),aT.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"emoji",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")zX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"uuid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")MX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"nanoid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")NX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"cuid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")DX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"cuid2",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")qX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"ulid",code:R.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),U(i,{validation:"url",code:R.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"regex",code:R.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),U(i,{code:R.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),U(i,{code:R.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),U(i,{code:R.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?SN(o).test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{code:R.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?JX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{code:R.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?QX(o).test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{code:R.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?UX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"duration",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?YX(e.data,o.version)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"ip",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?XX(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"jwt",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?eee(e.data,o.version)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"cidr",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?GX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"base64",code:R.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?KX.test(e.data)||(i=this._getOrReturnCtx(e,i),U(i,{validation:"base64url",code:R.invalid_string,message:o.message}),n.dirty()):Ce.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:R.invalid_string,...Q.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Q.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Lo.create=t=>new Lo({checks:[],typeName:O.ZodString,coerce:t?.coerce??!1,...he(t)});function tee(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return o%a/10**i}var Ga=class t extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==B.number){let o=this._getOrReturnCtx(e);return U(o,{code:R.invalid_type,expected:B.number,received:o.parsedType}),ne}let n,i=new cr;for(let o of this._def.checks)o.kind==="int"?Ce.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{code:R.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),U(n,{code:R.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),U(n,{code:R.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?tee(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),U(n,{code:R.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{code:R.not_finite,message:o.message}),i.dirty()):Ce.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ce.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Ga.create=t=>new Ga({checks:[],typeName:O.ZodNumber,coerce:t?.coerce||!1,...he(t)});var Ka=class t extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==B.bigint)return this._getInvalidInput(e);let n,i=new cr;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),U(n,{code:R.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),U(n,{code:R.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),U(n,{code:R.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ce.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return U(r,{code:R.invalid_type,expected:B.bigint,received:r.parsedType}),ne}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Ka.create=t=>new Ka({checks:[],typeName:O.ZodBigInt,coerce:t?.coerce??!1,...he(t)});var Ja=class extends be{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==B.boolean){let n=this._getOrReturnCtx(e);return U(n,{code:R.invalid_type,expected:B.boolean,received:n.parsedType}),ne}return xr(e.data)}};Ja.create=t=>new Ja({typeName:O.ZodBoolean,coerce:t?.coerce||!1,...he(t)});var Qa=class t extends be{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==B.date){let o=this._getOrReturnCtx(e);return U(o,{code:R.invalid_type,expected:B.date,received:o.parsedType}),ne}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return U(o,{code:R.invalid_date}),ne}let n=new cr,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),U(i,{code:R.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),U(i,{code:R.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Ce.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Qa.create=t=>new Qa({checks:[],coerce:t?.coerce||!1,typeName:O.ZodDate,...he(t)});var Vc=class extends be{_parse(e){if(this._getType(e)!==B.symbol){let n=this._getOrReturnCtx(e);return U(n,{code:R.invalid_type,expected:B.symbol,received:n.parsedType}),ne}return xr(e.data)}};Vc.create=t=>new Vc({typeName:O.ZodSymbol,...he(t)});var Ya=class extends be{_parse(e){if(this._getType(e)!==B.undefined){let n=this._getOrReturnCtx(e);return U(n,{code:R.invalid_type,expected:B.undefined,received:n.parsedType}),ne}return xr(e.data)}};Ya.create=t=>new Ya({typeName:O.ZodUndefined,...he(t)});var Xa=class extends be{_parse(e){if(this._getType(e)!==B.null){let n=this._getOrReturnCtx(e);return U(n,{code:R.invalid_type,expected:B.null,received:n.parsedType}),ne}return xr(e.data)}};Xa.create=t=>new Xa({typeName:O.ZodNull,...he(t)});var Uo=class extends be{constructor(){super(...arguments),this._any=!0}_parse(e){return xr(e.data)}};Uo.create=t=>new Uo({typeName:O.ZodAny,...he(t)});var eo=class extends be{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xr(e.data)}};eo.create=t=>new eo({typeName:O.ZodUnknown,...he(t)});var Kn=class extends be{_parse(e){let r=this._getOrReturnCtx(e);return U(r,{code:R.invalid_type,expected:B.never,received:r.parsedType}),ne}};Kn.create=t=>new Kn({typeName:O.ZodNever,...he(t)});var Bc=class extends be{_parse(e){if(this._getType(e)!==B.undefined){let n=this._getOrReturnCtx(e);return U(n,{code:R.invalid_type,expected:B.void,received:n.parsedType}),ne}return xr(e.data)}};Bc.create=t=>new Bc({typeName:O.ZodVoid,...he(t)});var to=class t extends be{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==B.array)return U(r,{code:R.invalid_type,expected:B.array,received:r.parsedType}),ne;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(a||s)&&(U(r,{code:a?R.too_big:R.too_small,minimum:s?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(U(r,{code:R.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(U(r,{code:R.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>i.type._parseAsync(new En(r,a,r.path,s)))).then(a=>cr.mergeArray(n,a));let o=[...r.data].map((a,s)=>i.type._parseSync(new En(r,a,r.path,s)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};to.create=(t,e)=>new to({type:t,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...he(e)});function Fc(t){if(t instanceof Zr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Wr.create(Fc(n))}return new Zr({...t._def,shape:()=>e})}else return t instanceof to?new to({...t._def,type:Fc(t.element)}):t instanceof Wr?Wr.create(Fc(t.unwrap())):t instanceof bi?bi.create(Fc(t.unwrap())):t instanceof yi?yi.create(t.items.map(e=>Fc(e))):t}var Zr=class t extends be{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ce.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==B.object){let l=this._getOrReturnCtx(e);return U(l,{code:R.invalid_type,expected:B.object,received:l.parsedType}),ne}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Kn&&this._def.unknownKeys==="strip"))for(let l in i.data)a.includes(l)||s.push(l);let c=[];for(let l of a){let u=o[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new En(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Kn){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(U(i,{code:R.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new En(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,m=await u.value;l.push({key:d,value:m,alwaysSet:u.alwaysSet})}return l}).then(l=>cr.mergeObjectSync(n,l)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Ce.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Ce.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Fc(this)}partial(e){let r={};for(let n of Ce.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ce.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wr;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return TN(Ce.objectKeys(this.shape))}};Zr.create=(t,e)=>new Zr({shape:()=>t,unknownKeys:"strip",catchall:Kn.create(),typeName:O.ZodObject,...he(e)});Zr.strictCreate=(t,e)=>new Zr({shape:()=>t,unknownKeys:"strict",catchall:Kn.create(),typeName:O.ZodObject,...he(e)});Zr.lazycreate=(t,e)=>new Zr({shape:t,unknownKeys:"strip",catchall:Kn.create(),typeName:O.ZodObject,...he(e)});var es=class extends be{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new Hr(s.ctx.common.issues));return U(r,{code:R.invalid_union,unionErrors:a}),ne}if(r.common.async)return Promise.all(n.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let o,a=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(c=>new Hr(c));return U(r,{code:R.invalid_union,unionErrors:s}),ne}}get options(){return this._def.options}};es.create=(t,e)=>new es({options:t,typeName:O.ZodUnion,...he(e)});var Xi=t=>t instanceof rs?Xi(t.schema):t instanceof kn?Xi(t.innerType()):t instanceof ns?[t.value]:t instanceof is?t.options:t instanceof os?Ce.objectValues(t.enum):t instanceof as?Xi(t._def.innerType):t instanceof Ya?[void 0]:t instanceof Xa?[null]:t instanceof Wr?[void 0,...Xi(t.unwrap())]:t instanceof bi?[null,...Xi(t.unwrap())]:t instanceof cd||t instanceof cs?Xi(t.unwrap()):t instanceof ss?Xi(t._def.innerType):[],Mv=class t extends be{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.object)return U(r,{code:R.invalid_type,expected:B.object,received:r.parsedType}),ne;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(U(r,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let a=Xi(o.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,o)}}return new t({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...he(n)})}};function sT(t,e){let r=vi(t),n=vi(e);if(t===e)return{valid:!0,data:t};if(r===B.object&&n===B.object){let i=Ce.objectKeys(e),o=Ce.objectKeys(t).filter(s=>i.indexOf(s)!==-1),a={...t,...e};for(let s of o){let c=sT(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===B.array&&n===B.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let a=t[o],s=e[o],c=sT(a,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===B.date&&n===B.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ts=class extends be{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,a)=>{if(qv(o)||qv(a))return ne;let s=sT(o.value,a.value);return s.valid?((zv(o)||zv(a))&&r.dirty(),{status:r.value,value:s.data}):(U(n,{code:R.invalid_intersection_types}),ne)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ts.create=(t,e,r)=>new ts({left:t,right:e,typeName:O.ZodIntersection,...he(r)});var yi=class t extends be{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.array)return U(n,{code:R.invalid_type,expected:B.array,received:n.parsedType}),ne;if(n.data.length<this._def.items.length)return U(n,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&n.data.length>this._def.items.length&&(U(n,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new En(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(o).then(a=>cr.mergeArray(r,a)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};yi.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yi({items:t,typeName:O.ZodTuple,rest:null,...he(e)})};var Lv=class t extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.object)return U(n,{code:R.invalid_type,expected:B.object,received:n.parsedType}),ne;let i=[],o=this._def.keyType,a=this._def.valueType;for(let s in n.data)i.push({key:o._parse(new En(n,s,n.path,s)),value:a._parse(new En(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?cr.mergeObjectAsync(r,i):cr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof be?new t({keyType:e,valueType:r,typeName:O.ZodRecord,...he(n)}):new t({keyType:Lo.create(),valueType:e,typeName:O.ZodRecord,...he(r)})}},Hc=class extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.map)return U(n,{code:R.invalid_type,expected:B.map,received:n.parsedType}),ne;let i=this._def.keyType,o=this._def.valueType,a=[...n.data.entries()].map(([s,c],l)=>({key:i._parse(new En(n,s,n.path,[l,"key"])),value:o._parse(new En(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return ne;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return ne;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}};Hc.create=(t,e,r)=>new Hc({valueType:e,keyType:t,typeName:O.ZodMap,...he(r)});var Wc=class t extends be{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.set)return U(n,{code:R.invalid_type,expected:B.set,received:n.parsedType}),ne;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(U(n,{code:R.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(U(n,{code:R.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function a(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ne;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((c,l)=>o._parse(new En(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Wc.create=(t,e)=>new Wc({valueType:t,minSize:null,maxSize:null,typeName:O.ZodSet,...he(e)});var Uv=class t extends be{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.function)return U(r,{code:R.invalid_type,expected:B.function,received:r.parsedType}),ne;function n(s,c){return sd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Lc(),Yi].filter(l=>!!l),issueData:{code:R.invalid_arguments,argumentsError:c}})}function i(s,c){return sd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Lc(),Yi].filter(l=>!!l),issueData:{code:R.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Fo){let s=this;return xr(async function(...c){let l=new Hr([]),u=await s._def.args.parseAsync(c,o).catch(h=>{throw l.addIssue(n(c,h)),l}),d=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw l.addIssue(i(d,h)),l})})}else{let s=this;return xr(function(...c){let l=s._def.args.safeParse(c,o);if(!l.success)throw new Hr([n(c,l.error)]);let u=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(u,o);if(!d.success)throw new Hr([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:yi.create(e).rest(eo.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||yi.create([]).rest(eo.create()),returns:r||eo.create(),typeName:O.ZodFunction,...he(n)})}},rs=class extends be{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};rs.create=(t,e)=>new rs({getter:t,typeName:O.ZodLazy,...he(e)});var ns=class extends be{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return U(r,{received:r.data,code:R.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};ns.create=(t,e)=>new ns({value:t,typeName:O.ZodLiteral,...he(e)});function TN(t,e){return new is({values:t,typeName:O.ZodEnum,...he(e)})}var is=class t extends be{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return U(r,{expected:Ce.joinValues(n),received:r.parsedType,code:R.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return U(r,{received:r.data,code:R.invalid_enum_value,options:n}),ne}return xr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};is.create=TN;var os=class extends be{_parse(e){let r=Ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==B.string&&n.parsedType!==B.number){let i=Ce.objectValues(r);return U(n,{expected:Ce.joinValues(i),received:n.parsedType,code:R.invalid_type}),ne}if(this._cache||(this._cache=new Set(Ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ce.objectValues(r);return U(n,{received:n.data,code:R.invalid_enum_value,options:i}),ne}return xr(e.data)}get enum(){return this._def.values}};os.create=(t,e)=>new os({values:t,typeName:O.ZodNativeEnum,...he(e)});var Fo=class extends be{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.promise&&r.common.async===!1)return U(r,{code:R.invalid_type,expected:B.promise,received:r.parsedType}),ne;let n=r.parsedType===B.promise?r.data:Promise.resolve(r.data);return xr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Fo.create=(t,e)=>new Fo({type:t,typeName:O.ZodPromise,...he(e)});var kn=class extends be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:a=>{U(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let a=i.transform(n.data,o);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return ne;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?ne:c.status==="dirty"?Za(c.value):r.value==="dirty"?Za(c.value):c});{if(r.value==="aborted")return ne;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ne:s.status==="dirty"?Za(s.value):r.value==="dirty"?Za(s.value):s}}if(i.type==="refinement"){let a=s=>{let c=i.refinement(s,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ne:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?ne:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Mo(a))return ne;let s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Mo(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:r.value,value:s})):ne);Ce.assertNever(i)}};kn.create=(t,e,r)=>new kn({schema:t,typeName:O.ZodEffects,effect:e,...he(r)});kn.createWithPreprocess=(t,e,r)=>new kn({schema:e,effect:{type:"preprocess",transform:t},typeName:O.ZodEffects,...he(r)});var Wr=class extends be{_parse(e){return this._getType(e)===B.undefined?xr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Wr.create=(t,e)=>new Wr({innerType:t,typeName:O.ZodOptional,...he(e)});var bi=class extends be{_parse(e){return this._getType(e)===B.null?xr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};bi.create=(t,e)=>new bi({innerType:t,typeName:O.ZodNullable,...he(e)});var as=class extends be{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===B.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};as.create=(t,e)=>new as({innerType:t,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...he(e)});var ss=class extends be{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Uc(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Hr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Hr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ss.create=(t,e)=>new ss({innerType:t,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...he(e)});var Zc=class extends be{_parse(e){if(this._getType(e)!==B.nan){let n=this._getOrReturnCtx(e);return U(n,{code:R.invalid_type,expected:B.nan,received:n.parsedType}),ne}return{status:"valid",value:e.data}}};Zc.create=t=>new Zc({typeName:O.ZodNaN,...he(t)});var ree=Symbol("zod_brand"),cd=class extends be{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ld=class t extends be{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ne:o.status==="dirty"?(r.dirty(),Za(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ne:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:O.ZodPipeline})}},cs=class extends be{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Mo(i)&&(i.value=Object.freeze(i.value)),i);return Uc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};cs.create=(t,e)=>new cs({innerType:t,typeName:O.ZodReadonly,...he(e)});function xN(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function EN(t,e={},r){return t?Uo.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(a=>{if(!a){let s=xN(e,n),c=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:c})}});if(!o){let a=xN(e,n),s=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:s})}}):Uo.create()}var nee={object:Zr.lazycreate},O;(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"})(O||(O={}));var iee=(t,e={message:`Input not instance of ${t.name}`})=>EN(r=>r instanceof t,e),kN=Lo.create,AN=Ga.create,oee=Zc.create,aee=Ka.create,IN=Ja.create,see=Qa.create,cee=Vc.create,lee=Ya.create,uee=Xa.create,pee=Uo.create,dee=eo.create,mee=Kn.create,fee=Bc.create,hee=to.create,cT=Zr.create,gee=Zr.strictCreate,vee=es.create,yee=Mv.create,bee=ts.create,xee=yi.create,wee=Lv.create,_ee=Hc.create,See=Wc.create,Tee=Uv.create,Eee=rs.create,kee=ns.create,Aee=is.create,Iee=os.create,$ee=Fo.create,Ree=kn.create,Cee=Wr.create,Pee=bi.create,Oee=kn.createWithPreprocess,jee=ld.create,Nee=()=>kN().optional(),Dee=()=>AN().optional(),qee=()=>IN().optional(),zee={string:(t=>Lo.create({...t,coerce:!0})),number:(t=>Ga.create({...t,coerce:!0})),boolean:(t=>Ja.create({...t,coerce:!0})),bigint:(t=>Ka.create({...t,coerce:!0})),date:(t=>Qa.create({...t,coerce:!0}))};var Mee=ne;var ud=p;var sje=p.record(p.string(),p.union([p.string(),p.number(),p.boolean(),p.undefined()])),Lee=p.enum(["noop","custom"]),Uee=p.object({provider:p.literal("noop")}),lT=p.object({module:p.string({required_error:'Custom provider requires "module" path'})}).passthrough(),Fee=p.object({provider:p.literal("custom"),providerConfig:lT}),cje=p.discriminatedUnion("provider",[Uee,Fee]);function $N(t){return Lee.safeParse(t).success}function kt(t,e){if(!t)throw new Error(e||"Invariant Violation")}var Vee=["pat","uat","direct-trust","oauth"];function Bee(t){return Vee.some(e=>e===t)}var uT=class extends od{auth;server;sslKey;sslCert;httpPort;corsOriginConfig;siteName;patName;patValue;jwtUsername;connectedAppClientId;connectedAppSecretId;connectedAppSecretValue;uatTenantId;uatIssuer;uatUsernameClaimName;uatPrivateKey;uatKeyId;jwtAdditionalPayload;datasourceCredentials;disableSessionManagement;tableauServerVersionCheckIntervalInHours;passthroughAuthUserSessionCheckIntervalInMinutes;mcpSiteSettingsCheckIntervalInMinutes;enableMcpSiteSettings;allowSitesToConfigureRequestOverrides;enablePassthroughAuth;oauth;telemetry;latencyMetricName;productTelemetryEndpoint;productTelemetryEnabled;isHyperforce;breakGlassDisableGlobally;adminToolsEnabled;cspAllowedDomains;constructor(){super();let e=ad(process.env),{AUTH:r,SERVER:n,SITE_NAME:i,TRANSPORT:o,SSL_KEY:a,SSL_CERT:s,HTTP_PORT_ENV_VAR_NAME:c,CORS_ORIGIN_CONFIG:l,PAT_NAME:u,PAT_VALUE:d,JWT_SUB_CLAIM:m,CONNECTED_APP_CLIENT_ID:h,CONNECTED_APP_SECRET_ID:f,CONNECTED_APP_SECRET_VALUE:g,UAT_TENANT_ID:v,UAT_ISSUER:y,UAT_USERNAME_CLAIM_NAME:b,UAT_USERNAME_CLAIM:w,UAT_PRIVATE_KEY:T,UAT_PRIVATE_KEY_PATH:E,UAT_KEY_ID:P,JWT_ADDITIONAL_PAYLOAD:M,DATASOURCE_CREDENTIALS:ie,DISABLE_SESSION_MANAGEMENT:le,TABLEAU_SERVER_VERSION_CHECK_INTERVAL_IN_HOURS:ue,PASSTHROUGH_AUTH_USER_SESSION_CHECK_INTERVAL_IN_MINUTES:fe,MCP_SITE_SETTINGS_CHECK_INTERVAL_IN_MINUTES:we,ENABLE_MCP_SITE_SETTINGS:ye,ALLOW_SITES_TO_CONFIGURE_REQUEST_OVERRIDES:Fe,ENABLE_PASSTHROUGH_AUTH:Et,DANGEROUSLY_DISABLE_OAUTH:It,OAUTH_EMBEDDED_AUTHZ_SERVER:Ur,OAUTH_ISSUER:nr,OAUTH_LOCK_SITE:Ui,OAUTH_JWE_PRIVATE_KEY:lt,OAUTH_JWE_PRIVATE_KEY_PATH:Zt,OAUTH_JWE_PRIVATE_KEY_PASSPHRASE:wn,OAUTH_RESOURCE_URI:$t,OAUTH_GLOBAL_RESOURCE_URIS:Ve,OAUTH_REDIRECT_URI:ir,OAUTH_CLIENT_ID_SECRET_PAIRS:Ao,OAUTH_CIMD_DNS_SERVERS:Fi,ADVERTISE_API_SCOPES:vr,OAUTH_AUTHORIZATION_CODE_TIMEOUT_MS:J,OAUTH_ACCESS_TOKEN_TIMEOUT_MS:F,OAUTH_REFRESH_TOKEN_TIMEOUT_MS:W,OAUTH_DISABLE_SCOPES:et,TELEMETRY_PROVIDER:_e,TELEMETRY_PROVIDER_CONFIG:dt,LATENCY_METRIC_NAME:or,PRODUCT_TELEMETRY_ENDPOINT:bt,PRODUCT_TELEMETRY_ENABLED:Fr,IS_HYPERFORCE:ja,BREAK_GLASS_DISABLE_GLOBALLY:qt,ADMIN_TOOLS_ENABLED:th,CSP_ALLOWED_DOMAINS:rP}=e,y_="";this.siteName=i??"",this.sslKey=a?.trim()??"",this.sslCert=s?.trim()??"",this.httpPort=Vt(e[c?.trim()||"PORT"],{defaultValue:3927,minValue:1,maxValue:65535}),this.corsOriginConfig=Wee(l?.trim()??""),this.datasourceCredentials=ie??"",this.disableSessionManagement=le==="true",this.tableauServerVersionCheckIntervalInHours=Vt(ue,{defaultValue:1,minValue:1,maxValue:168}),this.passthroughAuthUserSessionCheckIntervalInMinutes=Vt(fe,{defaultValue:10,minValue:0,maxValue:1440}),this.mcpSiteSettingsCheckIntervalInMinutes=Vt(we,{defaultValue:10,minValue:1,maxValue:1440}),this.enableMcpSiteSettings=ye!=="false",this.allowSitesToConfigureRequestOverrides=Fe==="true",this.enablePassthroughAuth=Et==="true";let b_=It==="true",qG=!(et==="true"),zG=Ur!=="false";if(this.allowSitesToConfigureRequestOverrides&&!this.enableMcpSiteSettings)throw new Error('ALLOW_SITES_TO_CONFIGURE_REQUEST_OVERRIDES is "true", but MCP site settings are not enabled.');if(this.oauth={enabled:b_?!1:!!nr,embeddedAuthzServer:zG,issuer:nr??"",resourceUri:$t??`http://127.0.0.1:${this.httpPort}`,globalResourceUris:Ve?Ve.split(",").map(Io=>Io.trim()).filter(Boolean):[],redirectUri:ir||(nr?`${nr}/Callback`:""),lockSite:Ui!=="false",jwePrivateKey:lt??"",jwePrivateKeyPath:Zt??"",jwePrivateKeyPassphrase:wn||void 0,dnsServers:Fi?Fi.split(",").map(Io=>Io.trim()):["1.1.1.1","1.0.0.1"],authzCodeTimeoutMs:Vt(J,{defaultValue:Ct.fromMinutes(10),minValue:0,maxValue:Ct.fromHours(1)}),accessTokenTimeoutMs:Vt(F,{defaultValue:Ct.fromHours(1),minValue:0,maxValue:Ct.fromDays(30)}),refreshTokenTimeoutMs:Vt(W,{defaultValue:Ct.fromDays(30),minValue:0,maxValue:Ct.fromYears(1)}),clientIdSecretPairs:Ao?Ao.split(",").reduce((Io,UG)=>{let[iP,oP]=UG.split(":");return iP&&oP&&(Io[iP]=oP),Io},{}):null,enforceScopes:qG,advertiseApiScopes:vr==="true"},this.oauth.clientIdSecretPairs&&Object.keys(this.oauth.clientIdSecretPairs).length===0)throw new Error(`OAUTH_CLIENT_ID_SECRET_PAIRS is in an invalid format: ${Ao}. Should be in the format: clientId:secret`);if(($N(_e)?_e:"noop")==="custom"){if(!dt)throw new Error('TELEMETRY_PROVIDER_CONFIG is required when TELEMETRY_PROVIDER is "custom"');this.telemetry={provider:"custom",providerConfig:lT.parse(JSON.parse(dt))}}else this.telemetry={provider:"noop"};if(this.latencyMetricName=or||"http_server_1agg1_request_duration",this.productTelemetryEndpoint=bt||"https://prod.telemetry.tableausoftware.com",this.productTelemetryEnabled=Fr!=="false",this.isHyperforce=ja==="true",this.breakGlassDisableGlobally=qt==="true",this.adminToolsEnabled=th==="true",this.auth=Bee(r)?r:this.oauth.enabled?"oauth":"pat",this.transport=Nv(o)?o:this.oauth.enabled?"http":"stdio",this.transport==="http"&&!b_&&!this.oauth.issuer)throw new Error('OAUTH_ISSUER must be set when TRANSPORT is "http" unless DANGEROUSLY_DISABLE_OAUTH is "true"');if(this.auth==="oauth"){if(b_)throw new Error('When AUTH is "oauth", DANGEROUSLY_DISABLE_OAUTH cannot be "true"');if(!this.oauth.issuer)throw new Error('When AUTH is "oauth", OAUTH_ISSUER must be set')}else kt(n,"The environment variable SERVER is not set"),Hee(n);if(this.oauth.enabled){if(this.oauth.embeddedAuthzServer){if(kt(this.oauth.redirectUri,"The environment variable OAUTH_REDIRECT_URI is not set"),!this.oauth.jwePrivateKey&&!this.oauth.jwePrivateKeyPath)throw new Error("One of the environment variables: OAUTH_JWE_PRIVATE_KEY_PATH or OAUTH_JWE_PRIVATE_KEY must be set");if(this.oauth.jwePrivateKey&&this.oauth.jwePrivateKeyPath)throw new Error("Only one of the environment variables: OAUTH_JWE_PRIVATE_KEY or OAUTH_JWE_PRIVATE_KEY_PATH must be set");if(this.oauth.jwePrivateKeyPath&&process.env.TABLEAU_MCP_TEST!=="true"&&!(0,pd.existsSync)(this.oauth.jwePrivateKeyPath))throw new Error(`OAuth JWE private key path does not exist: ${this.oauth.jwePrivateKeyPath}`)}if(this.transport==="stdio")throw new Error('TRANSPORT must be "http" when OAUTH_ISSUER is set')}if(this.auth==="pat")kt(u,"The environment variable PAT_NAME is not set"),kt(d,"The environment variable PAT_VALUE is not set");else if(this.auth==="direct-trust")kt(m,"The environment variable JWT_SUB_CLAIM is not set"),kt(h,"The environment variable CONNECTED_APP_CLIENT_ID is not set"),kt(f,"The environment variable CONNECTED_APP_SECRET_ID is not set"),kt(g,"The environment variable CONNECTED_APP_SECRET_VALUE is not set"),y_=m??"";else if(this.auth==="uat"){if(kt(v,"The environment variable UAT_TENANT_ID is not set"),kt(y,"The environment variable UAT_ISSUER is not set"),!w&&!m)throw new Error("One of the environment variables: UAT_USERNAME_CLAIM or JWT_SUB_CLAIM must be set");if(y_=w??m??"",!T&&!E)throw new Error("One of the environment variables: UAT_PRIVATE_KEY_PATH or UAT_PRIVATE_KEY must be set");if(T&&E)throw new Error("Only one of the environment variables: UAT_PRIVATE_KEY or UAT_PRIVATE_KEY_PATH must be set");if(E&&process.env.TABLEAU_MCP_TEST!=="true"&&!(0,pd.existsSync)(E))throw new Error(`UAT private key path does not exist: ${E}`)}this.server=n??"";let nP=this.server?new URL(this.server).origin:"",MG=["https://*.online.tableau.com","https://*.tableau.com",...nP?[nP]:[]],LG=rP?rP.split(",").map(Io=>Io.trim()):[];this.cspAllowedDomains=[...MG,...LG],this.patName=u??"",this.patValue=d??"",this.jwtUsername=y_??"",this.connectedAppClientId=h??"",this.connectedAppSecretId=f??"",this.connectedAppSecretValue=g??"",this.uatTenantId=v??"",this.uatIssuer=y??"",this.uatUsernameClaimName=b||"email",this.uatPrivateKey=T||(E?(0,pd.readFileSync)(E,"utf8"):""),this.uatKeyId=P??"",this.jwtAdditionalPayload=M||"{}"}};function Hee(t){if(!["https://","http://"].find(e=>t.startsWith(e)))throw new Error(`The environment variable SERVER must start with "http://" or "https://": ${t}`);try{new URL(t)}catch(e){let r=e instanceof Error?e.message:String(e);throw new Error(`The environment variable SERVER is not a valid URL: ${t} -- ${r}`)}}function Wee(t){if(!t)return!0;if(t.match(/^true|false$/i))return t.toLowerCase()==="true";if(t==="*")return"*";if(t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t).map(r=>new URL(r).origin)}catch{throw new Error(`The environment variable CORS_ORIGIN_CONFIG is not a valid array of URLs: ${t}`)}try{return new URL(t).origin}catch{throw new Error(`The environment variable CORS_ORIGIN_CONFIG is not a valid URL: ${t}`)}}var L=()=>new uT;function dd(t,e){return function(){return t.apply(e,arguments)}}var{toString:Zee}=Object.prototype,{getPrototypeOf:Vv}=Object,{iterator:Bv,toStringTag:PN}=Symbol,Hv=(t=>e=>{let r=Zee.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Jn=t=>(t=t.toLowerCase(),e=>Hv(e)===t),Wv=t=>e=>typeof e===t,{isArray:us}=Array,Gc=Wv("undefined");function Kc(t){return t!==null&&!Gc(t)&&t.constructor!==null&&!Gc(t.constructor)&&Gr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var ON=Jn("ArrayBuffer");function Gee(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ON(t.buffer),e}var Kee=Wv("string"),Gr=Wv("function"),jN=Wv("number"),md=t=>t!==null&&typeof t=="object",Jee=t=>t===!0||t===!1,Fv=t=>{if(Hv(t)!=="object")return!1;let e=Vv(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(PN in t)&&!(Bv in t)},Qee=t=>{if(!md(t)||Kc(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Yee=Jn("Date"),Xee=Jn("File"),ete=t=>!!(t&&typeof t.uri<"u"),tte=t=>t&&typeof t.getParts<"u",rte=Jn("Blob"),nte=Jn("FileList"),ite=t=>md(t)&&Gr(t.pipe);function ote(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}var RN=ote(),CN=typeof RN.FormData<"u"?RN.FormData:void 0,ate=t=>{if(!t)return!1;if(CN&&t instanceof CN)return!0;let e=Vv(t);if(!e||e===Object.prototype||!Gr(t.append))return!1;let r=Hv(t);return r==="formdata"||r==="object"&&Gr(t.toString)&&t.toString()==="[object FormData]"},ste=Jn("URLSearchParams"),[cte,lte,ute,pte]=["ReadableStream","Request","Response","Headers"].map(Jn),dte=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fd(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,i;if(typeof t!="object"&&(t=[t]),us(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{if(Kc(t))return;let o=r?Object.getOwnPropertyNames(t):Object.keys(t),a=o.length,s;for(n=0;n<a;n++)s=o[n],e.call(null,t[s],s,t)}}function NN(t,e){if(Kc(t))return null;e=e.toLowerCase();let r=Object.keys(t),n=r.length,i;for(;n-- >0;)if(i=r[n],e===i.toLowerCase())return i;return null}var ls=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,DN=t=>!Gc(t)&&t!==ls;function pT(...t){let{caseless:e,skipUndefined:r}=DN(this)&&this||{},n={},i=(o,a)=>{if(a==="__proto__"||a==="constructor"||a==="prototype")return;let s=e&&typeof a=="string"&&NN(n,a)||a,c=dT(n,s)?n[s]:void 0;Fv(c)&&Fv(o)?n[s]=pT(c,o):Fv(o)?n[s]=pT({},o):us(o)?n[s]=o.slice():(!r||!Gc(o))&&(n[s]=o)};for(let o=0,a=t.length;o<a;o++){let s=t[o];if(!s||Kc(s)||(fd(s,i),typeof s!="object"||us(s)))continue;let c=Object.getOwnPropertySymbols(s);for(let l=0;l<c.length;l++){let u=c[l];Tte.call(s,u)&&i(s[u],u)}}return n}var mte=(t,e,r,{allOwnKeys:n}={})=>(fd(e,(i,o)=>{r&&Gr(i)?Object.defineProperty(t,o,{__proto__:null,value:dd(i,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),fte=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),hte=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{__proto__:null,value:e.prototype}),r&&Object.assign(t.prototype,r)},gte=(t,e,r,n)=>{let i,o,a,s={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)a=i[o],(!n||n(a,t,e))&&!s[a]&&(e[a]=t[a],s[a]=!0);t=r!==!1&&Vv(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},vte=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},yte=t=>{if(!t)return null;if(us(t))return t;let e=t.length;if(!jN(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},bte=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Vv(Uint8Array)),xte=(t,e)=>{let n=(t&&t[Bv]).call(t),i;for(;(i=n.next())&&!i.done;){let o=i.value;e.call(t,o[0],o[1])}},wte=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},_te=Jn("HTMLFormElement"),Ste=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),dT=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),{propertyIsEnumerable:Tte}=Object.prototype,Ete=Jn("RegExp"),qN=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};fd(r,(i,o)=>{let a;(a=e(i,o,t))!==!1&&(n[o]=a||i)}),Object.defineProperties(t,n)},kte=t=>{qN(t,(e,r)=>{if(Gr(t)&&["arguments","caller","callee"].includes(r))return!1;let n=t[r];if(Gr(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ate=(t,e)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return us(t)?n(t):n(String(t).split(e)),r},Ite=()=>{},$te=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Rte(t){return!!(t&&Gr(t.append)&&t[PN]==="FormData"&&t[Bv])}var Cte=t=>{let e=new WeakSet,r=n=>{if(md(n)){if(e.has(n))return;if(Kc(n))return n;if(!("toJSON"in n)){e.add(n);let i=us(n)?[]:{};return fd(n,(o,a)=>{let s=r(o);!Gc(s)&&(i[a]=s)}),e.delete(n),i}}return n};return r(t)},Pte=Jn("AsyncFunction"),Ote=t=>t&&(md(t)||Gr(t))&&Gr(t.then)&&Gr(t.catch),zN=((t,e)=>t?setImmediate:e?((r,n)=>(ls.addEventListener("message",({source:i,data:o})=>{i===ls&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),ls.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Gr(ls.postMessage)),jte=typeof queueMicrotask<"u"?queueMicrotask.bind(ls):typeof process<"u"&&process.nextTick||zN,Nte=t=>t!=null&&Gr(t[Bv]),S={isArray:us,isArrayBuffer:ON,isBuffer:Kc,isFormData:ate,isArrayBufferView:Gee,isString:Kee,isNumber:jN,isBoolean:Jee,isObject:md,isPlainObject:Fv,isEmptyObject:Qee,isReadableStream:cte,isRequest:lte,isResponse:ute,isHeaders:pte,isUndefined:Gc,isDate:Yee,isFile:Xee,isReactNativeBlob:ete,isReactNative:tte,isBlob:rte,isRegExp:Ete,isFunction:Gr,isStream:ite,isURLSearchParams:ste,isTypedArray:bte,isFileList:nte,forEach:fd,merge:pT,extend:mte,trim:dte,stripBOM:fte,inherits:hte,toFlatObject:gte,kindOf:Hv,kindOfTest:Jn,endsWith:vte,toArray:yte,forEachEntry:xte,matchAll:wte,isHTMLForm:_te,hasOwnProperty:dT,hasOwnProp:dT,reduceDescriptors:qN,freezeMethods:kte,toObjectSet:Ate,toCamelCase:Ste,noop:Ite,toFiniteNumber:$te,findKey:NN,global:ls,isContextDefined:DN,isSpecCompliantForm:Rte,toJSONObject:Cte,isAsyncFn:Pte,isThenable:Ote,setImmediate:zN,asap:jte,isIterable:Nte};var Dte=S.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),MN=t=>{let e={},r,n,i;return t&&t.split(`
@@ -2760,7 +2760,7 @@ user and get explicit approval before deleting. Do not auto-confirm or compute t
2760
2760
  - List workbooks created after January 1, 2023:
2761
2761
  filter: "createdAt:gt:2023-01-01T00:00:00Z"
2762
2762
  - List workbooks with the name "Superstore" in the "Finance" project and created after January 1, 2023:
2763
- filter: "name:eq:Superstore,projectName:eq:Finance,createdAt:gt:2023-01-01T00:00:00Z"`,paramsSchema:c0e,annotations:{title:"List Workbooks",readOnlyHint:!0,openWorldHint:!1},callback:async({filter:r,pageSize:n,limit:i},o)=>{let a=await o.getConfigWithOverrides(),s=r?K5(r):void 0;return await e.logAndExecute({extra:o,args:{},callback:async()=>new $(await Z({...o,jwtScopes:e.requiredApiScopes,callback:async c=>{let l=a.getMaxResultLimit(e.name),u=await Rr({pageConfig:{pageSize:n,limit:l?Math.min(l,i??Number.MAX_SAFE_INTEGER):i},getDataFn:async d=>{let{pagination:m,workbooks:h}=await c.workbooksMethods.queryWorkbooksForSite({siteId:c.siteId,filter:s??"",pageSize:d.pageSize,pageNumber:d.pageNumber});return{pagination:m,data:h}}});if(a.disableMetadataApiRequests||u.length===0)return u;try{let d=await c.metadataMethods.graphql(Fx(u.map(m=>m.id)));return Bx(u,vu(d),a.boundedContext.datasourceIds)}catch(d){return q({message:"Failed to enrich workbooks with lineage metadata",level:"warning",logger:"lineage",data:oe(d)}),u}}})),constrainSuccessResult:c=>l0e({workbooks:c,boundedContext:a.boundedContext})})}});return e};function l0e({workbooks:t,boundedContext:e}){if(t.length===0)return{type:"empty",message:"No workbooks were found. Either none exist or you do not have permission to view them."};let{projectIds:r,workbookIds:n,tags:i}=e;return r&&(t=t.filter(o=>o.project?.id?r.has(o.project.id):!1)),n&&(t=t.filter(o=>n.has(o.id))),i&&(t=t.filter(o=>o.tags?.tag?.some(a=>i.has(a.label)))),t.length===0?{type:"empty",message:["The set of allowed workbooks that can be queried is limited by the server configuration.","While workbooks were found, they were all filtered out by the server configuration."].join(" ")}:{type:"success",result:t}}var Q5=[B9,H9,j9,C9,z9,N9,M9,G9,C5,E5,e5,t5,r5,n5,o5,X9,Y9,Z5,N5,D5,q5,J5,H5,Q9,V5,L5,P5,j5,I9,A5,k5,m9,d9,p9,u9];var u0e="3.29",rw;async function p0e({restApiArgs:t}){let{config:e,tableauAuthInfo:r}=t;if(!e.enableMcpSiteSettings||!Xt.versionIsAtLeast(u0e))return;rw||(rw=new Sr({defaultExpirationTimeMs:e.mcpSiteSettingsCheckIntervalInMinutes*60*1e3}));let n=e.siteName||Ko(r);if(!n)throw new Error("Could not determine site ID/name");let i=rw.get(n);if(i)return i;let o={};try{let a=await Z({...t,jwtScopes:["tableau:mcp_site_settings:read"],callback:async s=>await s.mcpSettingsMethods.getMcpSiteSettings({siteId:s.siteId})});for(let s of a.settings)hL(s.key)&&(o[s.key]=s.value)}catch(a){if(Bt(a)){if(a.response?.status===500)throw new Error("Internal Server Error: The MCP settings are in a bad state and need to be overwritten.");if(a.response?.status!==403)throw new Error("An unexpected error occurred while getting MCP settings for site.")}}return e.allowSitesToConfigureRequestOverrides||delete o.ALLOWED_REQUEST_OVERRIDES,rw.set(n,o),o}async function R$({restApiArgs:t,requestOverrides:e}){let r=t.config??L(),n=t.signal??AbortSignal.timeout(r.maxRequestTimeoutMs),i=await p0e({restApiArgs:{...t,config:r,signal:n}});return gL(i,e)}var C$="tableau-mcp",d0e=Mc.version,m0e=Dv(),Ys=class extends Nx{constructor({mcpServer:e,clientInfo:r}={}){super({mcpServer:e,clientInfo:r,serverName:C$,serverVersion:d0e})}registerTools=async e=>{let r=L(),n=gb().isFeatureEnabled("mcp-apps");for(let i of await this._getToolsToRegister(e)){let o=async(a,s)=>{if(r.breakGlassDisableGlobally)throw new Wy("The Tableau MCP server is temporarily unavailable. Please try again later.");let c=s.requestInfo?.headers[du]?.toString()??"",l=U3(c),u=await Cr.from(i.callback),d={...s,config:r,server:this,get tableauAuthInfo(){return Pi(s.authInfo)},_userLuid:void 0,_siteLuid:void 0,getUserLuid(){return d._userLuid??Pi(s.authInfo)?.userId??""},setUserLuid(m){d._userLuid=m},getSiteLuid(){return d._siteLuid??Pi(s.authInfo)?.siteId??""},setSiteLuid(m){d._siteLuid=m},getSiteName(){return Pi(s.authInfo)?.siteName??r.siteName},getConfigWithOverrides:async()=>R$({restApiArgs:d,requestOverrides:l})};return u(a,d)};n&&i.app?await this._registerAppTool(i,o):await this._registerTool(i,o)}SL(this)};_getToolsToRegister=async e=>{let r=L(),n=await R$({restApiArgs:{server:this,tableauAuthInfo:e,disableLogging:!0},requestOverrides:{}}),i=await ab(r.server||e?.server),{includeTools:o,excludeTools:a}=n,s=Q5.map(l=>l(this,i.productVersion)),c=[];for(let l of s)await Cr.from(l.disabled)||o.length>0&&!o.includes(l.name)||a.length>0&&a.includes(l.name)||c.push(l);return c};_registerTool=async(e,r)=>{this.mcpServer.registerTool(e.name,{title:await Cr.from(e.title),description:await Cr.from(e.description),inputSchema:await Cr.from(e.paramsSchema),annotations:await Cr.from(e.annotations),_meta:await Cr.from(e.meta)},r)};_registerAppTool=async(e,r)=>{kt(e.app,`Tool ${e.name} is an app but no app details were provided`);let{resourceUri:n,htmlPath:i}=e.app;oL(this.mcpServer,e.name,{title:(await Cr.from(e.annotations)).title,description:await Cr.from(e.description),inputSchema:await Cr.from(e.paramsSchema),annotations:await Cr.from(e.annotations),_meta:{ui:{resourceUri:n}}},r);let a=L().cspAllowedDomains;aL(this.mcpServer,e.name,n,{mimeType:hb},async()=>{let s=await(0,Y5.readFile)((0,X5.join)(m0e,i),"utf-8");return{contents:[{uri:n,mimeType:hb,text:s,_meta:{ui:{csp:{connectDomains:a,resourceDomains:a,frameDomains:a}}}}]}})}};var Rf=require("http2"),nw=require("http2"),O$=require("stream"),oV=Ze(require("crypto"),1),Xs=class extends Error{constructor(t,e){super(t,e),this.name="RequestError"}},f0e=t=>t instanceof Xs?t:new Xs(t.message,{cause:t}),h0e=global.Request,$f=class extends h0e{constructor(t,e){typeof t=="object"&&Su in t&&(t=t[Su]()),typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(t,e)}},g0e=t=>{let e=[],r=t.rawHeaders;for(let n=0;n<r.length;n+=2){let{[n]:i,[n+1]:o}=r;i.charCodeAt(0)!==58&&e.push([i,o])}return new Headers(e)},tV=Symbol("wrapBodyStream"),v0e=(t,e,r,n,i)=>{let o={method:t,headers:r,signal:i.signal};if(t==="TRACE"){o.method="GET";let a=new $f(e,o);return Object.defineProperty(a,"method",{get(){return"TRACE"}}),a}if(!(t==="GET"||t==="HEAD"))if("rawBody"in n&&n.rawBody instanceof Buffer)o.body=new ReadableStream({start(a){a.enqueue(n.rawBody),a.close()}});else if(n[tV]){let a;o.body=new ReadableStream({async pull(s){try{a||=O$.Readable.toWeb(n).getReader();let{done:c,value:l}=await a.read();c?s.close():s.enqueue(l)}catch(c){s.error(c)}}})}else o.body=O$.Readable.toWeb(n);return new $f(e,o)},Su=Symbol("getRequestCache"),rV=Symbol("requestCache"),iw=Symbol("incomingKey"),ow=Symbol("urlKey"),y0e=Symbol("headersKey"),_u=Symbol("abortControllerKey"),b0e=Symbol("getAbortController"),Cf={get method(){return this[iw].method||"GET"},get url(){return this[ow]},get headers(){return this[y0e]||=g0e(this[iw])},[b0e](){return this[Su](),this[_u]},[Su](){return this[_u]||=new AbortController,this[rV]||=v0e(this.method,this[ow],this.headers,this[iw],this[_u])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(t=>{Object.defineProperty(Cf,t,{get(){return this[Su]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(Cf,t,{value:function(){return this[Su]()[t]()}})});Object.defineProperty(Cf,Symbol.for("nodejs.util.inspect.custom"),{value:function(t,e,r){let n={method:this.method,url:this.url,headers:this.headers,nativeRequest:this[rV]};return`Request (lightweight) ${r(n,{...e,depth:t==null?null:t-1})}`}});Object.setPrototypeOf(Cf,$f.prototype);var x0e=(t,e)=>{let r=Object.create(Cf);r[iw]=t;let n=t.url||"";if(n[0]!=="/"&&(n.startsWith("http://")||n.startsWith("https://"))){if(t instanceof nw.Http2ServerRequest)throw new Xs("Absolute URL for :path is not allowed in HTTP/2");try{let s=new URL(n);r[ow]=s.href}catch(s){throw new Xs("Invalid absolute URL",{cause:s})}return r}let i=(t instanceof nw.Http2ServerRequest?t.authority:t.headers.host)||e;if(!i)throw new Xs("Missing host header");let o;if(t instanceof nw.Http2ServerRequest){if(o=t.scheme,!(o==="http"||o==="https"))throw new Xs("Unsupported scheme")}else o=t.socket&&t.socket.encrypted?"https":"http";let a=new URL(`${o}://${i}${n}`);if(a.hostname.length!==i.length&&a.hostname!==i.replace(/:\d+$/,""))throw new Xs("Invalid host header");return r[ow]=a.href,r},j$=Symbol("responseCache"),wu=Symbol("getResponseCache"),ec=Symbol("cache"),q$=global.Response,Tu=class nV{#e;#t;[wu](){return delete this[ec],this[j$]||=new q$(this.#e,this.#t)}constructor(e,r){let n;if(this.#e=e,r instanceof nV){let i=r[j$];if(i){this.#t=i,this[wu]();return}else this.#t=r.#t,n=new Headers(r.#t.headers)}else this.#t=r;(typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(this[ec]=[r?.status||200,e,n||r?.headers])}get headers(){let e=this[ec];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[wu]().headers}get status(){return this[ec]?.[0]??this[wu]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(Tu.prototype,t,{get(){return this[wu]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(Tu.prototype,t,{value:function(){return this[wu]()[t]()}})});Object.defineProperty(Tu.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(t,e,r){let n={status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[j$]};return`Response (lightweight) ${r(n,{...e,depth:t==null?null:t-1})}`}});Object.setPrototypeOf(Tu,q$);Object.setPrototypeOf(Tu.prototype,q$.prototype);async function w0e(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}function iV(t,e,r){let n=s=>{t.cancel(s).catch(()=>{})};return e.on("close",n),e.on("error",n),(r??t.read()).then(a,i),t.closed.finally(()=>{e.off("close",n),e.off("error",n)});function i(s){s&&e.destroy(s)}function o(){t.read().then(a,i)}function a({done:s,value:c}){try{if(s)e.end();else if(!e.write(c))e.once("drain",o);else return t.read().then(a,i)}catch(l){i(l)}}}function _0e(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:iV(t.getReader(),e)}var N$=t=>{let e={};t instanceof Headers||(t=new Headers(t??void 0));let r=[];for(let[n,i]of t)n==="set-cookie"?r.push(i):e[n]=i;return r.length>0&&(e["set-cookie"]=r),e["content-type"]??="text/plain; charset=UTF-8",e},S0e="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=oV.default);var z$=Symbol("outgoingEnded"),eV=Symbol("incomingDraining"),T0e=500,E0e=64*1024*1024,P$=t=>{let e=t;if(t.destroyed||e[eV])return;if(e[eV]=!0,t instanceof Rf.Http2ServerRequest){try{t.stream?.close?.(Rf.constants.NGHTTP2_NO_ERROR)}catch{}return}let r=0,n=()=>{clearTimeout(o),t.off("data",a),t.off("end",n),t.off("error",n)},i=()=>{n();let s=t.socket;s&&!s.destroyed&&s.destroySoon()},o=setTimeout(i,T0e);o.unref?.();let a=s=>{r+=s.length,r>E0e&&i()};t.on("data",a),t.on("end",n),t.on("error",n),t.resume()},k0e=()=>new Response(null,{status:400}),aV=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.constructor.name==="TimeoutError")?504:500}),D$=(t,e)=>{let r=t instanceof Error?t:new Error("unknown error",{cause:t});r.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(t),e.headersSent||e.writeHead(500,{"Content-Type":"text/plain"}),e.end(`Error: ${r.message}`),e.destroy(r))},sV=t=>{"flushHeaders"in t&&t.writable&&t.flushHeaders()},cV=async(t,e)=>{let[r,n,i]=t[ec],o=!1;if(!i)i={"content-type":"text/plain; charset=UTF-8"};else if(i instanceof Headers)o=i.has("content-length"),i=N$(i);else if(Array.isArray(i)){let a=new Headers(i);o=a.has("content-length"),i=N$(a)}else for(let a in i)if(a.length===14&&a.toLowerCase()==="content-length"){o=!0;break}o||(typeof n=="string"?i["Content-Length"]=Buffer.byteLength(n):n instanceof Uint8Array?i["Content-Length"]=n.byteLength:n instanceof Blob&&(i["Content-Length"]=n.size)),e.writeHead(r,i),typeof n=="string"||n instanceof Uint8Array?e.end(n):n instanceof Blob?e.end(new Uint8Array(await n.arrayBuffer())):(sV(e),await _0e(n,e)?.catch(a=>D$(a,e))),e[z$]?.()},A0e=t=>typeof t.then=="function",I0e=async(t,e,r={})=>{if(A0e(t))if(r.errorHandler)try{t=await t}catch(i){let o=await r.errorHandler(i);if(!o)return;t=o}else t=await t.catch(aV);if(ec in t)return cV(t,e);let n=N$(t.headers);if(t.body){let i=t.body.getReader(),o=[],a=!1,s;if(n["transfer-encoding"]!=="chunked"){let c=2;for(let l=0;l<c;l++){s||=i.read();let u=await w0e(s).catch(d=>{console.error(d),a=!0});if(!u){if(l===1){await new Promise(d=>setTimeout(d)),c=3;continue}break}if(s=void 0,u.value&&o.push(u.value),u.done){a=!0;break}}a&&!("content-length"in n)&&(n["content-length"]=o.reduce((l,u)=>l+u.length,0))}e.writeHead(t.status,n),o.forEach(c=>{e.write(c)}),a?e.end():(o.length===0&&sV(e),await iV(i,e,s))}else n[S0e]||(e.writeHead(t.status,n),e.end());e[z$]?.()},M$=(t,e={})=>{let r=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==$f&&(Object.defineProperty(global,"Request",{value:$f}),Object.defineProperty(global,"Response",{value:Tu})),async(n,i)=>{let o,a;try{a=x0e(n,e.hostname);let s=!r||n.method==="GET"||n.method==="HEAD";if(s||(n[tV]=!0,n.on("end",()=>{s=!0}),n instanceof Rf.Http2ServerRequest&&(i[z$]=()=>{s||setTimeout(()=>{s||setTimeout(()=>{P$(n)})})}),i.on("finish",()=>{s||P$(n)})),i.on("close",()=>{a[_u]&&(n.errored?a[_u].abort(n.errored.toString()):i.writableFinished||a[_u].abort("Client connection prematurely closed.")),s||setTimeout(()=>{s||setTimeout(()=>{P$(n)})})}),o=t(a,{incoming:n,outgoing:i}),ec in o)return cV(o,i)}catch(s){if(o)return D$(s,i);if(e.errorHandler){if(o=await e.errorHandler(a?s:f0e(s)),!o)return}else a?o=aV(s):o=k0e()}try{return await I0e(o,i,e)}catch(s){return D$(s,i)}}};var aw=class{constructor(e={}){this._started=!1,this._hasHandledRequest=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}createJsonErrorResponse(e,r,n,i){let o={code:r,message:n};return i?.data!==void 0&&(o.data=i.data),new Response(JSON.stringify({jsonrpc:"2.0",error:o,id:null}),{status:e,headers:{"Content-Type":"application/json",...i?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=e.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let n=`Invalid Host header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=e.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let n=`Invalid Origin header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}}}async handleRequest(e,r){if(!this.sessionIdGenerator&&this._hasHandledRequest)throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;let n=this.validateRequestHeaders(e);if(n)return n;switch(e.method){case"POST":return this.handlePostRequest(e,r);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(e,r,n,i){if(!this._eventStore||i<"2025-11-25")return;let o=await this._eventStore.storeEvent(n,{}),a=`id: ${o}
2763
+ filter: "name:eq:Superstore,projectName:eq:Finance,createdAt:gt:2023-01-01T00:00:00Z"`,paramsSchema:c0e,annotations:{title:"List Workbooks",readOnlyHint:!0,openWorldHint:!1},callback:async({filter:r,pageSize:n,limit:i},o)=>{let a=await o.getConfigWithOverrides(),s=r?K5(r):void 0;return await e.logAndExecute({extra:o,args:{},callback:async()=>new $(await Z({...o,jwtScopes:e.requiredApiScopes,callback:async c=>{let l=a.getMaxResultLimit(e.name),u=await Rr({pageConfig:{pageSize:n,limit:l?Math.min(l,i??Number.MAX_SAFE_INTEGER):i},getDataFn:async d=>{let{pagination:m,workbooks:h}=await c.workbooksMethods.queryWorkbooksForSite({siteId:c.siteId,filter:s??"",pageSize:d.pageSize,pageNumber:d.pageNumber});return{pagination:m,data:h}}});if(a.disableMetadataApiRequests||u.length===0)return u;try{let d=await c.metadataMethods.graphql(Fx(u.map(m=>m.id)));return Bx(u,vu(d),a.boundedContext.datasourceIds)}catch(d){return q({message:"Failed to enrich workbooks with lineage metadata",level:"warning",logger:"lineage",data:oe(d)}),u}}})),constrainSuccessResult:c=>l0e({workbooks:c,boundedContext:a.boundedContext})})}});return e};function l0e({workbooks:t,boundedContext:e}){if(t.length===0)return{type:"empty",message:"No workbooks were found. Either none exist or you do not have permission to view them."};let{projectIds:r,workbookIds:n,tags:i}=e;return r&&(t=t.filter(o=>o.project?.id?r.has(o.project.id):!1)),n&&(t=t.filter(o=>n.has(o.id))),i&&(t=t.filter(o=>o.tags?.tag?.some(a=>i.has(a.label)))),t.length===0?{type:"empty",message:["The set of allowed workbooks that can be queried is limited by the server configuration.","While workbooks were found, they were all filtered out by the server configuration."].join(" ")}:{type:"success",result:t}}var Q5=[B9,H9,j9,C9,z9,N9,M9,G9,C5,E5,e5,t5,r5,n5,o5,X9,Y9,Z5,N5,D5,q5,J5,H5,Q9,V5,L5,P5,j5,I9,A5,k5,m9,d9,p9,u9];var u0e="3.29",rw;async function p0e({restApiArgs:t}){let{config:e,tableauAuthInfo:r}=t;if(!e.enableMcpSiteSettings||!Xt.versionIsAtLeast(u0e))return;rw||(rw=new Sr({defaultExpirationTimeMs:e.mcpSiteSettingsCheckIntervalInMinutes*60*1e3}));let n=e.siteName||Ko(r)||"Default";if(!n)throw new Error("Could not determine site ID/name");let i=rw.get(n);if(i)return i;let o={};try{let a=await Z({...t,jwtScopes:["tableau:mcp_site_settings:read"],callback:async s=>await s.mcpSettingsMethods.getMcpSiteSettings({siteId:s.siteId})});for(let s of a.settings)hL(s.key)&&(o[s.key]=s.value)}catch(a){if(Bt(a)){if(a.response?.status===500)throw new Error("Internal Server Error: The MCP settings are in a bad state and need to be overwritten.");if(a.response?.status!==403)throw new Error("An unexpected error occurred while getting MCP settings for site.")}}return e.allowSitesToConfigureRequestOverrides||delete o.ALLOWED_REQUEST_OVERRIDES,rw.set(n,o),o}async function R$({restApiArgs:t,requestOverrides:e}){let r=t.config??L(),n=t.signal??AbortSignal.timeout(r.maxRequestTimeoutMs),i=await p0e({restApiArgs:{...t,config:r,signal:n}});return gL(i,e)}var C$="tableau-mcp",d0e=Mc.version,m0e=Dv(),Ys=class extends Nx{constructor({mcpServer:e,clientInfo:r}={}){super({mcpServer:e,clientInfo:r,serverName:C$,serverVersion:d0e})}registerTools=async e=>{let r=L(),n=gb().isFeatureEnabled("mcp-apps");for(let i of await this._getToolsToRegister(e)){let o=async(a,s)=>{if(r.breakGlassDisableGlobally)throw new Wy("The Tableau MCP server is temporarily unavailable. Please try again later.");let c=s.requestInfo?.headers[du]?.toString()??"",l=U3(c),u=await Cr.from(i.callback),d={...s,config:r,server:this,get tableauAuthInfo(){return Pi(s.authInfo)},_userLuid:void 0,_siteLuid:void 0,getUserLuid(){return d._userLuid??Pi(s.authInfo)?.userId??""},setUserLuid(m){d._userLuid=m},getSiteLuid(){return d._siteLuid??Pi(s.authInfo)?.siteId??""},setSiteLuid(m){d._siteLuid=m},getSiteName(){return Pi(s.authInfo)?.siteName??r.siteName},getConfigWithOverrides:async()=>R$({restApiArgs:d,requestOverrides:l})};return u(a,d)};n&&i.app?await this._registerAppTool(i,o):await this._registerTool(i,o)}SL(this)};_getToolsToRegister=async e=>{let r=L(),n=await R$({restApiArgs:{server:this,tableauAuthInfo:e,disableLogging:!0},requestOverrides:{}}),i=await ab(r.server||e?.server),{includeTools:o,excludeTools:a}=n,s=Q5.map(l=>l(this,i.productVersion)),c=[];for(let l of s)await Cr.from(l.disabled)||o.length>0&&!o.includes(l.name)||a.length>0&&a.includes(l.name)||c.push(l);return c};_registerTool=async(e,r)=>{this.mcpServer.registerTool(e.name,{title:await Cr.from(e.title),description:await Cr.from(e.description),inputSchema:await Cr.from(e.paramsSchema),annotations:await Cr.from(e.annotations),_meta:await Cr.from(e.meta)},r)};_registerAppTool=async(e,r)=>{kt(e.app,`Tool ${e.name} is an app but no app details were provided`);let{resourceUri:n,htmlPath:i}=e.app;oL(this.mcpServer,e.name,{title:(await Cr.from(e.annotations)).title,description:await Cr.from(e.description),inputSchema:await Cr.from(e.paramsSchema),annotations:await Cr.from(e.annotations),_meta:{ui:{resourceUri:n}}},r);let a=L().cspAllowedDomains;aL(this.mcpServer,e.name,n,{mimeType:hb},async()=>{let s=await(0,Y5.readFile)((0,X5.join)(m0e,i),"utf-8");return{contents:[{uri:n,mimeType:hb,text:s,_meta:{ui:{csp:{connectDomains:a,resourceDomains:a,frameDomains:a}}}}]}})}};var Rf=require("http2"),nw=require("http2"),O$=require("stream"),oV=Ze(require("crypto"),1),Xs=class extends Error{constructor(t,e){super(t,e),this.name="RequestError"}},f0e=t=>t instanceof Xs?t:new Xs(t.message,{cause:t}),h0e=global.Request,$f=class extends h0e{constructor(t,e){typeof t=="object"&&Su in t&&(t=t[Su]()),typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(t,e)}},g0e=t=>{let e=[],r=t.rawHeaders;for(let n=0;n<r.length;n+=2){let{[n]:i,[n+1]:o}=r;i.charCodeAt(0)!==58&&e.push([i,o])}return new Headers(e)},tV=Symbol("wrapBodyStream"),v0e=(t,e,r,n,i)=>{let o={method:t,headers:r,signal:i.signal};if(t==="TRACE"){o.method="GET";let a=new $f(e,o);return Object.defineProperty(a,"method",{get(){return"TRACE"}}),a}if(!(t==="GET"||t==="HEAD"))if("rawBody"in n&&n.rawBody instanceof Buffer)o.body=new ReadableStream({start(a){a.enqueue(n.rawBody),a.close()}});else if(n[tV]){let a;o.body=new ReadableStream({async pull(s){try{a||=O$.Readable.toWeb(n).getReader();let{done:c,value:l}=await a.read();c?s.close():s.enqueue(l)}catch(c){s.error(c)}}})}else o.body=O$.Readable.toWeb(n);return new $f(e,o)},Su=Symbol("getRequestCache"),rV=Symbol("requestCache"),iw=Symbol("incomingKey"),ow=Symbol("urlKey"),y0e=Symbol("headersKey"),_u=Symbol("abortControllerKey"),b0e=Symbol("getAbortController"),Cf={get method(){return this[iw].method||"GET"},get url(){return this[ow]},get headers(){return this[y0e]||=g0e(this[iw])},[b0e](){return this[Su](),this[_u]},[Su](){return this[_u]||=new AbortController,this[rV]||=v0e(this.method,this[ow],this.headers,this[iw],this[_u])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(t=>{Object.defineProperty(Cf,t,{get(){return this[Su]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(Cf,t,{value:function(){return this[Su]()[t]()}})});Object.defineProperty(Cf,Symbol.for("nodejs.util.inspect.custom"),{value:function(t,e,r){let n={method:this.method,url:this.url,headers:this.headers,nativeRequest:this[rV]};return`Request (lightweight) ${r(n,{...e,depth:t==null?null:t-1})}`}});Object.setPrototypeOf(Cf,$f.prototype);var x0e=(t,e)=>{let r=Object.create(Cf);r[iw]=t;let n=t.url||"";if(n[0]!=="/"&&(n.startsWith("http://")||n.startsWith("https://"))){if(t instanceof nw.Http2ServerRequest)throw new Xs("Absolute URL for :path is not allowed in HTTP/2");try{let s=new URL(n);r[ow]=s.href}catch(s){throw new Xs("Invalid absolute URL",{cause:s})}return r}let i=(t instanceof nw.Http2ServerRequest?t.authority:t.headers.host)||e;if(!i)throw new Xs("Missing host header");let o;if(t instanceof nw.Http2ServerRequest){if(o=t.scheme,!(o==="http"||o==="https"))throw new Xs("Unsupported scheme")}else o=t.socket&&t.socket.encrypted?"https":"http";let a=new URL(`${o}://${i}${n}`);if(a.hostname.length!==i.length&&a.hostname!==i.replace(/:\d+$/,""))throw new Xs("Invalid host header");return r[ow]=a.href,r},j$=Symbol("responseCache"),wu=Symbol("getResponseCache"),ec=Symbol("cache"),q$=global.Response,Tu=class nV{#e;#t;[wu](){return delete this[ec],this[j$]||=new q$(this.#e,this.#t)}constructor(e,r){let n;if(this.#e=e,r instanceof nV){let i=r[j$];if(i){this.#t=i,this[wu]();return}else this.#t=r.#t,n=new Headers(r.#t.headers)}else this.#t=r;(typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(this[ec]=[r?.status||200,e,n||r?.headers])}get headers(){let e=this[ec];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[wu]().headers}get status(){return this[ec]?.[0]??this[wu]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(Tu.prototype,t,{get(){return this[wu]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(Tu.prototype,t,{value:function(){return this[wu]()[t]()}})});Object.defineProperty(Tu.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(t,e,r){let n={status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[j$]};return`Response (lightweight) ${r(n,{...e,depth:t==null?null:t-1})}`}});Object.setPrototypeOf(Tu,q$);Object.setPrototypeOf(Tu.prototype,q$.prototype);async function w0e(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}function iV(t,e,r){let n=s=>{t.cancel(s).catch(()=>{})};return e.on("close",n),e.on("error",n),(r??t.read()).then(a,i),t.closed.finally(()=>{e.off("close",n),e.off("error",n)});function i(s){s&&e.destroy(s)}function o(){t.read().then(a,i)}function a({done:s,value:c}){try{if(s)e.end();else if(!e.write(c))e.once("drain",o);else return t.read().then(a,i)}catch(l){i(l)}}}function _0e(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:iV(t.getReader(),e)}var N$=t=>{let e={};t instanceof Headers||(t=new Headers(t??void 0));let r=[];for(let[n,i]of t)n==="set-cookie"?r.push(i):e[n]=i;return r.length>0&&(e["set-cookie"]=r),e["content-type"]??="text/plain; charset=UTF-8",e},S0e="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=oV.default);var z$=Symbol("outgoingEnded"),eV=Symbol("incomingDraining"),T0e=500,E0e=64*1024*1024,P$=t=>{let e=t;if(t.destroyed||e[eV])return;if(e[eV]=!0,t instanceof Rf.Http2ServerRequest){try{t.stream?.close?.(Rf.constants.NGHTTP2_NO_ERROR)}catch{}return}let r=0,n=()=>{clearTimeout(o),t.off("data",a),t.off("end",n),t.off("error",n)},i=()=>{n();let s=t.socket;s&&!s.destroyed&&s.destroySoon()},o=setTimeout(i,T0e);o.unref?.();let a=s=>{r+=s.length,r>E0e&&i()};t.on("data",a),t.on("end",n),t.on("error",n),t.resume()},k0e=()=>new Response(null,{status:400}),aV=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.constructor.name==="TimeoutError")?504:500}),D$=(t,e)=>{let r=t instanceof Error?t:new Error("unknown error",{cause:t});r.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(t),e.headersSent||e.writeHead(500,{"Content-Type":"text/plain"}),e.end(`Error: ${r.message}`),e.destroy(r))},sV=t=>{"flushHeaders"in t&&t.writable&&t.flushHeaders()},cV=async(t,e)=>{let[r,n,i]=t[ec],o=!1;if(!i)i={"content-type":"text/plain; charset=UTF-8"};else if(i instanceof Headers)o=i.has("content-length"),i=N$(i);else if(Array.isArray(i)){let a=new Headers(i);o=a.has("content-length"),i=N$(a)}else for(let a in i)if(a.length===14&&a.toLowerCase()==="content-length"){o=!0;break}o||(typeof n=="string"?i["Content-Length"]=Buffer.byteLength(n):n instanceof Uint8Array?i["Content-Length"]=n.byteLength:n instanceof Blob&&(i["Content-Length"]=n.size)),e.writeHead(r,i),typeof n=="string"||n instanceof Uint8Array?e.end(n):n instanceof Blob?e.end(new Uint8Array(await n.arrayBuffer())):(sV(e),await _0e(n,e)?.catch(a=>D$(a,e))),e[z$]?.()},A0e=t=>typeof t.then=="function",I0e=async(t,e,r={})=>{if(A0e(t))if(r.errorHandler)try{t=await t}catch(i){let o=await r.errorHandler(i);if(!o)return;t=o}else t=await t.catch(aV);if(ec in t)return cV(t,e);let n=N$(t.headers);if(t.body){let i=t.body.getReader(),o=[],a=!1,s;if(n["transfer-encoding"]!=="chunked"){let c=2;for(let l=0;l<c;l++){s||=i.read();let u=await w0e(s).catch(d=>{console.error(d),a=!0});if(!u){if(l===1){await new Promise(d=>setTimeout(d)),c=3;continue}break}if(s=void 0,u.value&&o.push(u.value),u.done){a=!0;break}}a&&!("content-length"in n)&&(n["content-length"]=o.reduce((l,u)=>l+u.length,0))}e.writeHead(t.status,n),o.forEach(c=>{e.write(c)}),a?e.end():(o.length===0&&sV(e),await iV(i,e,s))}else n[S0e]||(e.writeHead(t.status,n),e.end());e[z$]?.()},M$=(t,e={})=>{let r=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==$f&&(Object.defineProperty(global,"Request",{value:$f}),Object.defineProperty(global,"Response",{value:Tu})),async(n,i)=>{let o,a;try{a=x0e(n,e.hostname);let s=!r||n.method==="GET"||n.method==="HEAD";if(s||(n[tV]=!0,n.on("end",()=>{s=!0}),n instanceof Rf.Http2ServerRequest&&(i[z$]=()=>{s||setTimeout(()=>{s||setTimeout(()=>{P$(n)})})}),i.on("finish",()=>{s||P$(n)})),i.on("close",()=>{a[_u]&&(n.errored?a[_u].abort(n.errored.toString()):i.writableFinished||a[_u].abort("Client connection prematurely closed.")),s||setTimeout(()=>{s||setTimeout(()=>{P$(n)})})}),o=t(a,{incoming:n,outgoing:i}),ec in o)return cV(o,i)}catch(s){if(o)return D$(s,i);if(e.errorHandler){if(o=await e.errorHandler(a?s:f0e(s)),!o)return}else a?o=aV(s):o=k0e()}try{return await I0e(o,i,e)}catch(s){return D$(s,i)}}};var aw=class{constructor(e={}){this._started=!1,this._hasHandledRequest=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}createJsonErrorResponse(e,r,n,i){let o={code:r,message:n};return i?.data!==void 0&&(o.data=i.data),new Response(JSON.stringify({jsonrpc:"2.0",error:o,id:null}),{status:e,headers:{"Content-Type":"application/json",...i?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=e.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let n=`Invalid Host header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=e.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let n=`Invalid Origin header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}}}async handleRequest(e,r){if(!this.sessionIdGenerator&&this._hasHandledRequest)throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;let n=this.validateRequestHeaders(e);if(n)return n;switch(e.method){case"POST":return this.handlePostRequest(e,r);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(e,r,n,i){if(!this._eventStore||i<"2025-11-25")return;let o=await this._eventStore.storeEvent(n,{}),a=`id: ${o}
2764
2764
  data:
2765
2765
 
2766
2766
  `;this._retryInterval!==void 0&&(a=`id: ${o}