@tableau/mcp-server 1.9.3 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/build/index.js +29 -28
- package/build/index.js.map +4 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var nn=Object.defineProperty;var an=(t,e)=>{for(var r in e)nn(t,r,{get:e[r],enumerable:!0})};import{StdioServerTransport as Hu}from"@modelcontextprotocol/sdk/server/stdio.js";import Gu from"dotenv";import{join as un}from"path";import{fileURLToPath as dn}from"url";var dr=["list-datasources","list-workbooks","list-views","query-datasource","get-datasource-metadata","get-workbook","get-view-data","get-view-image","list-all-pulse-metric-definitions","list-pulse-metric-definitions-from-definition-ids","list-pulse-metrics-from-metric-definition-id","list-pulse-metrics-from-metric-ids","list-pulse-metric-subscriptions","generate-pulse-metric-value-insight-bundle","search-content"],ln=["datasource","workbook","view","pulse","content-exploration"],pr={datasource:["list-datasources","get-datasource-metadata","query-datasource"],workbook:["list-workbooks","get-workbook"],view:["list-views","get-view-data","get-view-image"],pulse:["list-all-pulse-metric-definitions","list-pulse-metric-definitions-from-definition-ids","list-pulse-metrics-from-metric-definition-id","list-pulse-metrics-from-metric-ids","list-pulse-metric-subscriptions","generate-pulse-metric-value-insight-bundle"],"content-exploration":["search-content"]};function mr(t){return!!dr.find(e=>e===t)}function fr(t){return!!ln.find(e=>e===t)}var cn=["stdio","http"];function yi(t){return!!cn.find(e=>e===t)}function ge(t,e){if(!t)throw new Error(e||"Invariant Violation")}var pn=dn(new URL(".",import.meta.url)),mn=["pat","direct-trust"],hr=class{auth;server;transport;sslKey;sslCert;httpPort;corsOriginConfig;siteName;patName;patValue;jwtSubClaim;connectedAppClientId;connectedAppSecretId;connectedAppSecretValue;jwtAdditionalPayload;datasourceCredentials;defaultLogLevel;disableLogMasking;includeTools;excludeTools;maxResultLimit;disableQueryDatasourceFilterValidation;disableMetadataApiRequests;enableServerLogging;serverLogDirectory;constructor(){let e=gn(process.env),{AUTH:r,SERVER:i,SITE_NAME:o,TRANSPORT:n,SSL_KEY:s,SSL_CERT:l,HTTP_PORT_ENV_VAR_NAME:u,CORS_ORIGIN_CONFIG:m,PAT_NAME:c,PAT_VALUE:h,JWT_SUB_CLAIM:b,CONNECTED_APP_CLIENT_ID:w,CONNECTED_APP_SECRET_ID:f,CONNECTED_APP_SECRET_VALUE:y,JWT_ADDITIONAL_PAYLOAD:T,DATASOURCE_CREDENTIALS:C,DEFAULT_LOG_LEVEL:N,DISABLE_LOG_MASKING:A,INCLUDE_TOOLS:x,EXCLUDE_TOOLS:v,MAX_RESULT_LIMIT:q,DISABLE_QUERY_DATASOURCE_FILTER_VALIDATION:U,DISABLE_METADATA_API_REQUESTS:ue,ENABLE_SERVER_LOGGING:ne,SERVER_LOG_DIRECTORY:fe}=e,he=3927,Y=e[u?.trim()||"PORT"]||he.toString(),X=parseInt(Y,10);this.siteName=o??"",this.auth=mn.find(B=>B===r)??"pat",this.transport=yi(n)?n:"stdio",this.sslKey=s?.trim()??"",this.sslCert=l?.trim()??"",this.httpPort=isNaN(X)?he:X,this.corsOriginConfig=hn(m?.trim()??""),this.datasourceCredentials=C??"",this.defaultLogLevel=N??"debug",this.disableLogMasking=A==="true",this.disableQueryDatasourceFilterValidation=U==="true",this.disableMetadataApiRequests=ue==="true",this.enableServerLogging=ne==="true",this.serverLogDirectory=fe||un(pn,"logs");let j=q?parseInt(q):NaN;if(this.maxResultLimit=isNaN(j)||j<=0?null:j,this.includeTools=x?x.split(",").flatMap(B=>{let G=B.trim();return mr(G)?G:fr(G)?pr[G]:[]}):[],this.excludeTools=v?v.split(",").flatMap(B=>{let G=B.trim();return mr(G)?G:fr(G)?pr[G]:[]}):[],this.includeTools.length>0&&this.excludeTools.length>0)throw new Error("Cannot include and exclude tools simultaneously");ge(i,"The environment variable SERVER is not set"),fn(i),this.auth==="pat"?(ge(c,"The environment variable PAT_NAME is not set"),ge(h,"The environment variable PAT_VALUE is not set")):this.auth==="direct-trust"&&(ge(b,"The environment variable JWT_SUB_CLAIM is not set"),ge(w,"The environment variable CONNECTED_APP_CLIENT_ID is not set"),ge(f,"The environment variable CONNECTED_APP_SECRET_ID is not set"),ge(y,"The environment variable CONNECTED_APP_SECRET_VALUE is not set")),this.server=i,this.patName=c??"",this.patValue=h??"",this.jwtSubClaim=b??"",this.connectedAppClientId=w??"",this.connectedAppSecretId=f??"",this.connectedAppSecretValue=y??"",this.jwtAdditionalPayload=T||"{}"}};function fn(t){if(!t.startsWith("https://"))throw new Error(`The environment variable SERVER must start with "https://": ${t}`);try{let e=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 hn(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}`)}}function gn(t){return Object.entries(t).reduce((e,[r,i])=>(i?.startsWith("${user_config.")?e[r]="":e[r]=i,e),{})}var R=()=>new hr;var gr=["debug","info","notice","warning","error","critical","alert","emergency"],st="debug",bi;function Ti(t){return!!gr.find(e=>e===t)}var ke=(t,e,{silent:r=!1}={})=>{st!==e&&(st=e,r||oe.notice(t,`Logging level set to: ${e}`))},wi=t=>{bi=t},oe={debug:Te("debug"),info:Te("info"),notice:Te("notice"),warning:Te("warning"),error:Te("error"),critical:Te("critical"),alert:Te("alert"),emergency:Te("emergency")},Ae=(t=st)=>gr.indexOf(t)>=gr.indexOf(st),Se=t=>{process.env.TABLEAU_MCP_TEST!=="true"&&(t=t.endsWith(`
|
|
3
3
|
`)?t:`${t}
|
|
4
|
-
`,process.stderr.write(t))},bo=({requestId:t,toolName:e,args:r})=>({type:"tool",requestId:t,tool:{name:e,...r!==void 0?{args:r}:{}}});function be(t){return async(e,r,{logger:o,requestId:i}={logger:e.name})=>{if(Ee(t))return e.server.notification({method:"notifications/message",params:{level:t,logger:o,message:JSON.stringify({timestamp:new Date().toISOString(),currentLogLevel:it,message:r},null,2)}},{relatedRequestId:i})}}import{McpServer as Su}from"@modelcontextprotocol/sdk/server/mcp.js";import{SetLevelRequestSchema as Cu}from"@modelcontextprotocol/sdk/types.js";var To={name:"@tableau/mcp-server",description:"An MCP server for Tableau, providing a suite of tools that will make it easier for developers to build AI applications that integrate with Tableau.",version:"1.9.3",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:"module",license:"Apache-2.0",keywords:["tableau","mcp"],bin:{"tableau-mcp-server":"./build/index.js"},scripts:{":build":"npx rimraf ./build && esbuild src/index.ts --bundle --packages=external --platform=node --format=esm --minify --outdir=build --sourcemap",build:"run-s :build exec-perms","build:watch":"npm run :build -- --watch","build:docker":"docker build -t tableau-mcp .",":build:mcpb":"npx -y @anthropic-ai/mcpb pack . tableau-mcp.mcpb","build:mcpb":"run-s build:manifest:script build:manifest :build:mcpb","build:manifest":"node build/scripts/createClaudeMcpBundleManifest.mjs","build:manifest:script":"esbuild src/scripts/createClaudeMcpBundleManifest.ts --bundle --platform=node --format=esm --outdir=build/scripts --sourcemap=inline --out-extension:.js=.mjs","start:http":"node build/index.js","start:http:docker":"docker run -p 3927:3927 -i --rm --env-file env.list tableau-mcp",lint:"npm exec eslint",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","exec-perms":"shx chmod +x build/*.js",test:"vitest --config ./vitest.config.ts","test:e2e":"vitest --config ./vitest.config.e2e.ts","test:eval":"vitest --config ./vitest.config.eval.ts",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"},dependencies:{"@modelcontextprotocol/sdk":"^1.12.1","@zodios/core":"^10.9.6",cors:"^2.8.5",dotenv:"^16.5.0",express:"^5.1.0","fast-levenshtein":"^3.0.0",jose:"^6.0.12","ts-results-es":"^5.0.1",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","@modelcontextprotocol/inspector":"^0.16.6","@openai/agents":"^0.1.9","@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","@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","npm-run-all":"^4.1.5",openai:"^5.23.2",prettier:"^3.5.3",rimraf:"^6.0.1",shx:"^0.4.0",typescript:"^5.8.3","typescript-eslint":"^8.31.1",vitest:"^3.1.3"},engines:{node:">=20"}};import{Ok as Ic}from"ts-results-es";import{z as as}from"zod";import{Err as wo,Ok as ln}from"ts-results-es";function he(t){if(t instanceof Error)return t.message;try{return JSON.stringify(t)??"undefined"}catch{return`${t}`}}var Eo=t=>{let e=So(t);if(e.isErr())return t;let r=e.value;return Ee("debug")?(r.data?.credentials&&(r.data.credentials="<redacted>"),Array.isArray(r?.data?.datasource?.connections)&&r.data.datasource.connections.forEach(i=>{i.connectionUsername="<redacted>",i.connectionPassword="<redacted>"}),r.headers?.["X-Tableau-Auth"]&&(r.headers["X-Tableau-Auth"]="<redacted>"),r.params?.user_id&&(r.params.user_id="<redacted>")):(delete r.data,delete r.headers,delete r.params),r},Ao=t=>{let e=So(t);if(e.isErr())return t;let r=e.value;return Ee("debug")?r.data?.credentials&&(r.data.credentials="<redacted>"):(delete r.data,delete r.headers),r};function So(t){try{return ln(structuredClone(t))}catch(e){if(e instanceof Error)return wo(e);let r=he(e);return st(`Could not clone object, notification may not be sanitized! Error: ${r}`),wo(new Error(r))}}function Ot(t){return{method:t.method??"UNKNOWN METHOD",url:t.url??"UNKNOWN URL",headers:t.headers,data:t.data,params:t.params}}function Pt(t){return{url:t.config.url??"UNKNOWN URL",status:t.status,headers:t.headers,data:t.data}}import{Zodios as xo}from"@zodios/core";import{randomUUID as cn}from"node:crypto";import{SignJWT as un}from"jose";async function Co({username:t,connectedApp:e,scopes:r,additionalPayload:o}){let i={alg:"HS256",typ:"JWT",kid:e.secretId},n={jti:cn(),iss:e.clientId,aud:"tableau",sub:t,scp:[...r],iat:Math.floor(Date.now()/1e3)-5,exp:Math.floor(Date.now()/1e3)+5*60,...o};return await new un(n).setProtectedHeader(i).sign(new TextEncoder().encode(e.secretValue))}import{makeApi as dn,makeEndpoint as Ro}from"@zodios/core";import{z as ce}from"zod";import{z as Ae}from"zod";var _o=Ae.object({credentials:Ae.object({site:Ae.object({id:Ae.string()}),user:Ae.object({id:Ae.string()}),token:Ae.string()})});var pn=ce.object({credentials:ce.object({site:ce.object({contentUrl:ce.string()})}).and(ce.object({personalAccessTokenName:ce.string(),personalAccessTokenSecret:ce.string()}).or(ce.object({jwt:ce.string()})))}),mn=Ro({method:"post",path:"/auth/signin",alias:"signIn",description:"Signs in with Tableau credentials.",response:_o,parameters:[{name:"credentials",type:"Body",schema:pn}]}),fn=Ro({method:"post",path:"/auth/signout",alias:"signOut",description:"Signs you out of the current session. This call invalidates the authentication token that is created by a call to Sign In.",response:ce.void()}),hn=dn([mn,fn]),hr=[...hn];var Se=class{_apiClient;constructor(e){this._apiClient=e}get interceptors(){return this._apiClient.axios.interceptors}};var z=class extends Se{_creds;get authHeader(){if(!this._creds)throw new Error("Authenticate by calling signIn() first");return{headers:{"X-Tableau-Auth":this._creds.token}}}get userId(){if(!this._creds)throw new Error("Authenticate by calling signIn() first");return this._creds.user.id}constructor(e,r){super(e),this._creds=r}};var nt=class extends Se{constructor(e){super(new xo(e,hr))}signIn=async e=>(await this._apiClient.signIn({credentials:{site:{contentUrl:e.siteName},...await(async()=>{switch(e.type){case"pat":return{personalAccessTokenName:e.patName,personalAccessTokenSecret:e.patValue};case"direct-trust":return{jwt:await Co({username:e.username,connectedApp:{clientId:e.clientId,secretId:e.secretId,secretValue:e.secretValue},scopes:e.scopes,additionalPayload:e.additionalPayload})}}})()}})).credentials},Ft=class extends z{constructor(e,r){super(new xo(e,hr),r)}signOut=async()=>{await this._apiClient.signOut(void 0,{...this.authHeader})}};import{Zodios as An}from"@zodios/core";import{makeApi as bn,makeEndpoint as Tn}from"@zodios/core";import{z as ke}from"zod";import{z as D}from"zod";var gn=D.enum(["hitsTotal","hitsSmallSpanTotal","hitsMediumSpanTotal","hitsLargeSpanTotal","downstreamWorkbookCount"]),vo=D.array(D.object({method:gn,sortDirection:D.enum(["asc","desc"]).default("asc").optional()})).nonempty(),Lo=D.enum(["lens","datasource","virtualconnection","collection","project","flow","datarole","table","database","view","workbook"]),Do=D.union([D.array(D.string().datetime()).nonempty(),D.object({startDate:D.string().datetime(),endDate:D.string().datetime().optional()}).strict(),D.object({startDate:D.string().datetime().optional(),endDate:D.string().datetime()}).strict()]),gr=D.object({contentTypes:D.array(Lo).nonempty(),ownerIds:D.array(D.number().int()).nonempty(),modifiedTime:Do}).partial(),Io=D.union([gr.extend({contentTypes:D.array(Lo).nonempty()}).strict(),gr.extend({ownerIds:D.array(D.number().int()).nonempty()}).strict(),gr.extend({modifiedTime:Do}).strict()]),yn=D.object({uri:D.string(),content:D.record(D.string(),D.unknown())}),Oo=D.object({next:D.string(),prev:D.string(),pageIndex:D.number().int(),startIndex:D.number().int(),total:D.number().int(),limit:D.number().int(),items:D.array(yn)}).partial();var wn=Tn({method:"get",path:"/search",alias:"searchContent",description:"Searches across all supported content types for objects relevant to the search expression specified in the querystring of the request URI.",parameters:[{name:"terms",type:"Query",schema:ke.string().optional()},{name:"page",type:"Query",schema:ke.number().int().optional()},{name:"limit",type:"Query",schema:ke.number().int().optional()},{name:"order_by",type:"Query",schema:ke.string().optional()},{name:"filter",type:"Query",schema:ke.string().optional()}],response:ke.object({hits:Oo})}),En=bn([wn]),Po=[...En];var at=class extends z{constructor(e,r){super(new An(e,Po),r)}searchContent=async e=>(Object.entries(e).forEach(([o,i])=>{i===void 0&&delete e[o]}),(await this._apiClient.searchContent({queries:e,...this.authHeader})).hits)};import{Zodios as xn}from"@zodios/core";import{makeApi as Sn,makeEndpoint as Cn}from"@zodios/core";import{z as Ue}from"zod";import{z as kt}from"zod";import{z as yr}from"zod";var Nt=yr.object({name:yr.string(),id:yr.string()});var Fo=kt.object({id:kt.string(),name:kt.string(),description:kt.string().optional(),project:Nt});import{z as Mt}from"zod";var Me=Mt.object({pageNumber:Mt.coerce.number(),pageSize:Mt.coerce.number(),totalAvailable:Mt.coerce.number()});import{z as No}from"zod";var qe=[{name:"pageSize",type:"Query",schema:No.number().optional(),description:"The number of items to return in one response. The minimum is 1. The maximum is 1000. The default is 100."},{name:"pageNumber",type:"Query",schema:No.number().optional(),description:"The offset for paging. The default is 1."}];var _n=Cn({method:"get",path:"/sites/:siteId/datasources",alias:"listDatasources",description:"Returns a list of published data sources on the specified site. Supports a filter string as a query parameter in the format field:operator:value.",parameters:[...qe,{name:"siteId",type:"Path",schema:Ue.string()},{name:"filter",type:"Query",schema:Ue.string().optional(),description:"Filter string in the format field:operator:value (e.g., name:eq:Project Views)"}],response:Ue.object({pagination:Me,datasources:Ue.object({datasource:Ue.optional(Ue.array(Fo))})})}),Rn=Sn([_n]),ko=[...Rn];var lt=class extends z{constructor(e,r){super(new xn(e,ko),r)}listDatasources=async({siteId:e,filter:r,pageSize:o,pageNumber:i})=>{let n=await this._apiClient.listDatasources({params:{siteId:e},queries:{filter:r,pageSize:o,pageNumber:i},...this.authHeader});return{pagination:n.pagination,datasources:n.datasources.datasource??[]}}};import{Zodios as Pn}from"@zodios/core";import{makeApi as vn,makeEndpoint as Ln}from"@zodios/core";import{z as w}from"zod";var Dn=w.object({data:w.object({publishedDatasources:w.array(w.object({name:w.string().or(w.null()),description:w.string().or(w.null()),owner:w.object({name:w.string().or(w.null())}),fields:w.array(w.object({name:w.string(),isHidden:w.boolean().or(w.null()),description:w.string().or(w.null()),descriptionInherited:w.array(w.object({attribute:w.string(),value:w.string().or(w.null())}).or(w.null())).or(w.null()),fullyQualifiedName:w.string(),__typename:w.string(),dataCategory:w.string().or(w.null()).optional(),role:w.string().or(w.null()).optional(),dataType:w.string().or(w.null()).optional(),defaultFormat:w.string().or(w.null()).optional(),semanticRole:w.string().or(w.null()).optional(),aggregation:w.string().or(w.null()).optional(),aggregationParam:w.string().or(w.null()).optional(),formula:w.string().or(w.null()).optional(),isAutoGenerated:w.boolean().or(w.null()).optional(),hasUserReference:w.boolean().or(w.null()).optional(),binSize:w.number().or(w.null()).optional(),hasOther:w.boolean().or(w.null()).optional(),delimiter:w.string().or(w.null()).optional(),combinationType:w.string().or(w.null()).optional()}))}))})}),In=Ln({method:"post",path:"/graphql",alias:"graphql",response:Dn,parameters:[{name:"query",type:"Body",schema:w.object({query:w.string()})}]}),On=vn([In]),Mo=[...On];var ct=class extends z{constructor(e,r){super(new Pn(e,Mo),r)}graphql=async e=>await this._apiClient.graphql({query:e},{...this.authHeader})};import{Zodios as Ul}from"@zodios/core";import{Err as Hi,Ok as jl}from"ts-results-es";function ut(t,e){return function(){return t.apply(e,arguments)}}var{toString:Fn}=Object.prototype,{getPrototypeOf:Tr}=Object,{iterator:Ut,toStringTag:Uo}=Symbol,jt=(t=>e=>{let r=Fn.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ne=t=>(t=t.toLowerCase(),e=>jt(e)===t),Bt=t=>e=>typeof e===t,{isArray:Be}=Array,je=Bt("undefined");function dt(t){return t!==null&&!je(t)&&t.constructor!==null&&!je(t.constructor)&&K(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var jo=ne("ArrayBuffer");function Nn(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&jo(t.buffer),e}var kn=Bt("string"),K=Bt("function"),Bo=Bt("number"),pt=t=>t!==null&&typeof t=="object",Mn=t=>t===!0||t===!1,qt=t=>{if(jt(t)!=="object")return!1;let e=Tr(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Uo in t)&&!(Ut in t)},qn=t=>{if(!pt(t)||dt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Un=ne("Date"),jn=ne("File"),Bn=ne("Blob"),Vn=ne("FileList"),zn=t=>pt(t)&&K(t.pipe),Wn=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||K(t.append)&&((e=jt(t))==="formdata"||e==="object"&&K(t.toString)&&t.toString()==="[object FormData]"))},Hn=ne("URLSearchParams"),[Gn,Qn,$n,Zn]=["ReadableStream","Request","Response","Headers"].map(ne),Jn=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function mt(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let o,i;if(typeof t!="object"&&(t=[t]),Be(t))for(o=0,i=t.length;o<i;o++)e.call(null,t[o],o,t);else{if(dt(t))return;let n=r?Object.getOwnPropertyNames(t):Object.keys(t),s=n.length,l;for(o=0;o<s;o++)l=n[o],e.call(null,t[l],l,t)}}function Vo(t,e){if(dt(t))return null;e=e.toLowerCase();let r=Object.keys(t),o=r.length,i;for(;o-- >0;)if(i=r[o],e===i.toLowerCase())return i;return null}var Ce=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,zo=t=>!je(t)&&t!==Ce;function br(){let{caseless:t,skipUndefined:e}=zo(this)&&this||{},r={},o=(i,n)=>{let s=t&&Vo(r,n)||n;qt(r[s])&&qt(i)?r[s]=br(r[s],i):qt(i)?r[s]=br({},i):Be(i)?r[s]=i.slice():(!e||!je(i))&&(r[s]=i)};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&mt(arguments[i],o);return r}var Kn=(t,e,r,{allOwnKeys:o}={})=>(mt(e,(i,n)=>{r&&K(i)?t[n]=ut(i,r):t[n]=i},{allOwnKeys:o}),t),Yn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Xn=(t,e,r,o)=>{t.prototype=Object.create(e.prototype,o),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},ea=(t,e,r,o)=>{let i,n,s,l={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),n=i.length;n-- >0;)s=i[n],(!o||o(s,t,e))&&!l[s]&&(e[s]=t[s],l[s]=!0);t=r!==!1&&Tr(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ta=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let o=t.indexOf(e,r);return o!==-1&&o===r},ra=t=>{if(!t)return null;if(Be(t))return t;let e=t.length;if(!Bo(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},oa=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Tr(Uint8Array)),ia=(t,e)=>{let o=(t&&t[Ut]).call(t),i;for(;(i=o.next())&&!i.done;){let n=i.value;e.call(t,n[0],n[1])}},sa=(t,e)=>{let r,o=[];for(;(r=t.exec(e))!==null;)o.push(r);return o},na=ne("HTMLFormElement"),aa=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,o,i){return o.toUpperCase()+i}),qo=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),la=ne("RegExp"),Wo=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),o={};mt(r,(i,n)=>{let s;(s=e(i,n,t))!==!1&&(o[n]=s||i)}),Object.defineProperties(t,o)},ca=t=>{Wo(t,(e,r)=>{if(K(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let o=t[r];if(K(o)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},ua=(t,e)=>{let r={},o=i=>{i.forEach(n=>{r[n]=!0})};return Be(t)?o(t):o(String(t).split(e)),r},da=()=>{},pa=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function ma(t){return!!(t&&K(t.append)&&t[Uo]==="FormData"&&t[Ut])}var fa=t=>{let e=new Array(10),r=(o,i)=>{if(pt(o)){if(e.indexOf(o)>=0)return;if(dt(o))return o;if(!("toJSON"in o)){e[i]=o;let n=Be(o)?[]:{};return mt(o,(s,l)=>{let u=r(s,i+1);!je(u)&&(n[l]=u)}),e[i]=void 0,n}}return o};return r(t,0)},ha=ne("AsyncFunction"),ga=t=>t&&(pt(t)||K(t))&&K(t.then)&&K(t.catch),Ho=((t,e)=>t?setImmediate:e?((r,o)=>(Ce.addEventListener("message",({source:i,data:n})=>{i===Ce&&n===r&&o.length&&o.shift()()},!1),i=>{o.push(i),Ce.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",K(Ce.postMessage)),ya=typeof queueMicrotask<"u"?queueMicrotask.bind(Ce):typeof process<"u"&&process.nextTick||Ho,ba=t=>t!=null&&K(t[Ut]),a={isArray:Be,isArrayBuffer:jo,isBuffer:dt,isFormData:Wn,isArrayBufferView:Nn,isString:kn,isNumber:Bo,isBoolean:Mn,isObject:pt,isPlainObject:qt,isEmptyObject:qn,isReadableStream:Gn,isRequest:Qn,isResponse:$n,isHeaders:Zn,isUndefined:je,isDate:Un,isFile:jn,isBlob:Bn,isRegExp:la,isFunction:K,isStream:zn,isURLSearchParams:Hn,isTypedArray:oa,isFileList:Vn,forEach:mt,merge:br,extend:Kn,trim:Jn,stripBOM:Yn,inherits:Xn,toFlatObject:ea,kindOf:jt,kindOfTest:ne,endsWith:ta,toArray:ra,forEachEntry:ia,matchAll:sa,isHTMLForm:na,hasOwnProperty:qo,hasOwnProp:qo,reduceDescriptors:Wo,freezeMethods:ca,toObjectSet:ua,toCamelCase:aa,noop:da,toFiniteNumber:pa,findKey:Vo,global:Ce,isContextDefined:zo,isSpecCompliantForm:ma,toJSONObject:fa,isAsyncFn:ha,isThenable:ga,setImmediate:Ho,asap:ya,isIterable:ba};function Ve(t,e,r,o,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),o&&(this.request=o),i&&(this.response=i,this.status=i.status?i.status:null)}a.inherits(Ve,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});var Go=Ve.prototype,Qo={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Qo[t]={value:t}});Object.defineProperties(Ve,Qo);Object.defineProperty(Go,"isAxiosError",{value:!0});Ve.from=(t,e,r,o,i,n)=>{let s=Object.create(Go);a.toFlatObject(t,s,function(c){return c!==Error.prototype},p=>p!=="isAxiosError");let l=t&&t.message?t.message:"Error",u=e==null&&t?t.code:e;return Ve.call(s,l,u,r,o,i),t&&s.cause==null&&Object.defineProperty(s,"cause",{value:t,configurable:!0}),s.name=t&&t.name||"Error",n&&Object.assign(s,n),s};var g=Ve;import Ta from"form-data";var Vt=Ta;function wr(t){return a.isPlainObject(t)||a.isArray(t)}function Zo(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function $o(t,e,r){return t?t.concat(e).map(function(i,n){return i=Zo(i),!r&&n?"["+i+"]":i}).join(r?".":""):e}function wa(t){return a.isArray(t)&&!t.some(wr)}var Ea=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function Aa(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new(Vt||FormData),r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,T){return!a.isUndefined(T[y])});let o=r.metaTokens,i=r.visitor||c,n=r.dots,s=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(i))throw new TypeError("visitor must be a function");function p(m){if(m===null)return"";if(a.isDate(m))return m.toISOString();if(a.isBoolean(m))return m.toString();if(!u&&a.isBlob(m))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(m)||a.isTypedArray(m)?u&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function c(m,y,T){let _=m;if(m&&!T&&typeof m=="object"){if(a.endsWith(y,"{}"))y=o?y:y.slice(0,-2),m=JSON.stringify(m);else if(a.isArray(m)&&wa(m)||(a.isFileList(m)||a.endsWith(y,"[]"))&&(_=a.toArray(m)))return y=Zo(y),_.forEach(function(S,x){!(a.isUndefined(S)||S===null)&&e.append(s===!0?$o([y],x,n):s===null?y:y+"[]",p(S))}),!1}return wr(m)?!0:(e.append($o(T,y,n),p(m)),!1)}let h=[],b=Object.assign(Ea,{defaultVisitor:c,convertValue:p,isVisitable:wr});function E(m,y){if(!a.isUndefined(m)){if(h.indexOf(m)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(m),a.forEach(m,function(_,F){(!(a.isUndefined(_)||_===null)&&i.call(e,_,a.isString(F)?F.trim():F,y,b))===!0&&E(_,y?y.concat(F):[F])}),h.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return E(t),e}var Te=Aa;function Jo(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(o){return e[o]})}function Ko(t,e){this._pairs=[],t&&Te(t,this,e)}var Yo=Ko.prototype;Yo.append=function(e,r){this._pairs.push([e,r])};Yo.toString=function(e){let r=e?function(o){return e.call(this,o,Jo)}:Jo;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var Xo=Ko;function Sa(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function _e(t,e,r){if(!e)return t;let o=r&&r.encode||Sa;a.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,n;if(i?n=i(e,r):n=a.isURLSearchParams(e)?e.toString():new Xo(e,r).toString(o),n){let s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+n}return t}var Er=class{constructor(){this.handlers=[]}use(e,r,o){return this.handlers.push({fulfilled:e,rejected:r,synchronous:o?o.synchronous:!1,runWhen:o?o.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(o){o!==null&&e(o)})}},Ar=Er;var ze={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};import _a from"crypto";import Ca from"url";var ei=Ca.URLSearchParams;var Sr="abcdefghijklmnopqrstuvwxyz",ti="0123456789",ri={DIGIT:ti,ALPHA:Sr,ALPHA_DIGIT:Sr+Sr.toUpperCase()+ti},Ra=(t=16,e=ri.ALPHA_DIGIT)=>{let r="",{length:o}=e,i=new Uint32Array(t);_a.randomFillSync(i);for(let n=0;n<t;n++)r+=e[i[n]%o];return r},oi={isNode:!0,classes:{URLSearchParams:ei,FormData:Vt,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:ri,generateString:Ra,protocols:["http","https","file","data"]};var Rr={};Xs(Rr,{hasBrowserEnv:()=>_r,hasStandardBrowserEnv:()=>xa,hasStandardBrowserWebWorkerEnv:()=>va,navigator:()=>Cr,origin:()=>La});var _r=typeof window<"u"&&typeof document<"u",Cr=typeof navigator=="object"&&navigator||void 0,xa=_r&&(!Cr||["ReactNative","NativeScript","NS"].indexOf(Cr.product)<0),va=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",La=_r&&window.location.href||"http://localhost";var I={...Rr,...oi};function xr(t,e){return Te(t,new I.classes.URLSearchParams,{visitor:function(r,o,i,n){return I.isNode&&a.isBuffer(r)?(this.append(o,r.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function Da(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ia(t){let e={},r=Object.keys(t),o,i=r.length,n;for(o=0;o<i;o++)n=r[o],e[n]=t[n];return e}function Oa(t){function e(r,o,i,n){let s=r[n++];if(s==="__proto__")return!0;let l=Number.isFinite(+s),u=n>=r.length;return s=!s&&a.isArray(i)?i.length:s,u?(a.hasOwnProp(i,s)?i[s]=[i[s],o]:i[s]=o,!l):((!i[s]||!a.isObject(i[s]))&&(i[s]=[]),e(r,o,i[s],n)&&a.isArray(i[s])&&(i[s]=Ia(i[s])),!l)}if(a.isFormData(t)&&a.isFunction(t.entries)){let r={};return a.forEachEntry(t,(o,i)=>{e(Da(o),i,r,0)}),r}return null}var zt=Oa;function Pa(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(o){if(o.name!=="SyntaxError")throw o}return(r||JSON.stringify)(t)}var vr={transitional:ze,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let o=r.getContentType()||"",i=o.indexOf("application/json")>-1,n=a.isObject(e);if(n&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return i?JSON.stringify(zt(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(n){if(o.indexOf("application/x-www-form-urlencoded")>-1)return xr(e,this.formSerializer).toString();if((l=a.isFileList(e))||o.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return Te(l?{"files[]":e}:e,u&&new u,this.formSerializer)}}return n||i?(r.setContentType("application/json",!1),Pa(e)):e}],transformResponse:[function(e){let r=this.transitional||vr.transitional,o=r&&r.forcedJSONParsing,i=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(o&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(l){if(s)throw l.name==="SyntaxError"?g.from(l,g.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:I.classes.FormData,Blob:I.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{vr.headers[t]={}});var We=vr;var Fa=a.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"]),ii=t=>{let e={},r,o,i;return t&&t.split(`
|
|
5
|
-
`).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),o=s.substring(i+1).trim(),!(!r||e[r]&&Fa[r])&&(r==="set-cookie"?e[r]?e[r].push(o):e[r]=[o]:e[r]=e[r]?e[r]+", "+o:o)}),e};var si=Symbol("internals");function ft(t){return t&&String(t).trim().toLowerCase()}function Wt(t){return t===!1||t==null?t:a.isArray(t)?t.map(Wt):String(t)}function Na(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,o;for(;o=r.exec(t);)e[o[1]]=o[2];return e}var ka=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Lr(t,e,r,o,i){if(a.isFunction(o))return o.call(this,e,r);if(i&&(e=r),!!a.isString(e)){if(a.isString(o))return e.indexOf(o)!==-1;if(a.isRegExp(o))return o.test(e)}}function Ma(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,o)=>r.toUpperCase()+o)}function qa(t,e){let r=a.toCamelCase(" "+e);["get","set","has"].forEach(o=>{Object.defineProperty(t,o+r,{value:function(i,n,s){return this[o].call(this,e,i,n,s)},configurable:!0})})}var He=class{constructor(e){e&&this.set(e)}set(e,r,o){let i=this;function n(l,u,p){let c=ft(u);if(!c)throw new Error("header name must be a non-empty string");let h=a.findKey(i,c);(!h||i[h]===void 0||p===!0||p===void 0&&i[h]!==!1)&&(i[h||u]=Wt(l))}let s=(l,u)=>a.forEach(l,(p,c)=>n(p,c,u));if(a.isPlainObject(e)||e instanceof this.constructor)s(e,r);else if(a.isString(e)&&(e=e.trim())&&!ka(e))s(ii(e),r);else if(a.isObject(e)&&a.isIterable(e)){let l={},u,p;for(let c of e){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[p=c[0]]=(u=l[p])?a.isArray(u)?[...u,c[1]]:[u,c[1]]:c[1]}s(l,r)}else e!=null&&n(r,e,o);return this}get(e,r){if(e=ft(e),e){let o=a.findKey(this,e);if(o){let i=this[o];if(!r)return i;if(r===!0)return Na(i);if(a.isFunction(r))return r.call(this,i,o);if(a.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ft(e),e){let o=a.findKey(this,e);return!!(o&&this[o]!==void 0&&(!r||Lr(this,this[o],o,r)))}return!1}delete(e,r){let o=this,i=!1;function n(s){if(s=ft(s),s){let l=a.findKey(o,s);l&&(!r||Lr(o,o[l],l,r))&&(delete o[l],i=!0)}}return a.isArray(e)?e.forEach(n):n(e),i}clear(e){let r=Object.keys(this),o=r.length,i=!1;for(;o--;){let n=r[o];(!e||Lr(this,this[n],n,e,!0))&&(delete this[n],i=!0)}return i}normalize(e){let r=this,o={};return a.forEach(this,(i,n)=>{let s=a.findKey(o,n);if(s){r[s]=Wt(i),delete r[n];return}let l=e?Ma(n):String(n).trim();l!==n&&delete r[n],r[l]=Wt(i),o[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return a.forEach(this,(o,i)=>{o!=null&&o!==!1&&(r[i]=e&&a.isArray(o)?o.join(", "):o)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
6
|
-
`)
|
|
7
|
-
`,Ha=bt.encode(ve),Ga=2,kr=class{constructor(e,r){let{escapeName:o}=this.constructor,i=a.isString(r),n=`Content-Disposition: form-data; name="${o(e)}"${!i&&r.name?`; filename="${o(r.name)}"`:""}${ve}`;i?r=bt.encode(String(r).replace(/\r?\n|\r\n?/g,ve)):n+=`Content-Type: ${r.type||"application/octet-stream"}${ve}`,this.headers=bt.encode(n+ve),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+Ga,this.name=e,this.value=r}async*encode(){yield this.headers;let{value:e}=this;a.isTypedArray(e)?yield e:yield*Ht(e),yield Ha}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},Qa=(t,e,r)=>{let{tag:o="form-data-boundary",size:i=25,boundary:n=o+"-"+I.generateString(i,Wa)}=r||{};if(!a.isFormData(t))throw TypeError("FormData instance required");if(n.length<1||n.length>70)throw Error("boundary must be 10-70 characters long");let s=bt.encode("--"+n+ve),l=bt.encode("--"+n+"--"+ve),u=l.byteLength,p=Array.from(t.entries()).map(([h,b])=>{let E=new kr(h,b);return u+=E.size,E});u+=s.byteLength*p.length,u=a.toFiniteNumber(u);let c={"Content-Type":`multipart/form-data; boundary=${n}`};return Number.isFinite(u)&&(c["Content-Length"]=u),e&&e(c),za.from(async function*(){for(let h of p)yield s,yield*h.encode();yield l}())},li=Qa;import $a from"stream";var Mr=class extends $a.Transform{__transform(e,r,o){this.push(e),o()}_transform(e,r,o){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(e,r,o)}},ci=Mr;var Za=(t,e)=>a.isAsyncFn(t)?function(...r){let o=r.pop();t.apply(this,r).then(i=>{try{e?o(null,...e(i)):o(null,i)}catch(n){o(n)}},o)}:t,ui=Za;function Ja(t,e){t=t||10;let r=new Array(t),o=new Array(t),i=0,n=0,s;return e=e!==void 0?e:1e3,function(u){let p=Date.now(),c=o[n];s||(s=p),r[i]=u,o[i]=p;let h=n,b=0;for(;h!==i;)b+=r[h++],h=h%t;if(i=(i+1)%t,i===n&&(n=(n+1)%t),p-s<e)return;let E=c&&p-c;return E?Math.round(b*1e3/E):void 0}}var di=Ja;function Ka(t,e){let r=0,o=1e3/e,i,n,s=(p,c=Date.now())=>{r=c,i=null,n&&(clearTimeout(n),n=null),t(...p)};return[(...p)=>{let c=Date.now(),h=c-r;h>=o?s(p,c):(i=p,n||(n=setTimeout(()=>{n=null,s(i)},o-h)))},()=>i&&s(i)]}var pi=Ka;var ge=(t,e,r=3)=>{let o=0,i=di(50,250);return pi(n=>{let s=n.loaded,l=n.lengthComputable?n.total:void 0,u=s-o,p=i(u),c=s<=l;o=s;let h={loaded:s,total:l,progress:l?s/l:void 0,bytes:u,rate:p||void 0,estimated:p&&l&&c?(l-s)/p:void 0,event:n,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(h)},r)},Ge=(t,e)=>{let r=t!=null;return[o=>e[0]({lengthComputable:r,total:t,loaded:o}),e[1]]},Qe=t=>(...e)=>a.asap(()=>t(...e));function qr(t){if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;let e=t.indexOf(",");if(e<0)return 0;let r=t.slice(5,e),o=t.slice(e+1);if(/;base64/i.test(r)){let n=o.length,s=o.length;for(let b=0;b<s;b++)if(o.charCodeAt(b)===37&&b+2<s){let E=o.charCodeAt(b+1),m=o.charCodeAt(b+2);(E>=48&&E<=57||E>=65&&E<=70||E>=97&&E<=102)&&(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(n-=2,b+=2)}let l=0,u=s-1,p=b=>b>=2&&o.charCodeAt(b-2)===37&&o.charCodeAt(b-1)===51&&(o.charCodeAt(b)===68||o.charCodeAt(b)===100);u>=0&&(o.charCodeAt(u)===61?(l++,u--):p(u)&&(l++,u-=3)),l===1&&u>=0&&(o.charCodeAt(u)===61||p(u))&&l++;let h=Math.floor(n/4)*3-(l||0);return h>0?h:0}return Buffer.byteLength(o,"utf8")}var mi={flush:we.constants.Z_SYNC_FLUSH,finishFlush:we.constants.Z_SYNC_FLUSH},il={flush:we.constants.BROTLI_OPERATION_FLUSH,finishFlush:we.constants.BROTLI_OPERATION_FLUSH},fi=a.isFunction(we.createBrotliDecompress),{http:sl,https:nl}=rl,al=/https:?/,hi=I.protocols.map(t=>t+":"),gi=(t,[e,r])=>(t.on("end",r).on("error",r),e);function ll(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function bi(t,e,r){let o=e;if(!o&&o!==!1){let i=Ya.getProxyForUrl(r);i&&(o=new URL(i))}if(o){if(o.username&&(o.auth=(o.username||"")+":"+(o.password||"")),o.auth){(o.auth.username||o.auth.password)&&(o.auth=(o.auth.username||"")+":"+(o.auth.password||""));let n=Buffer.from(o.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+n}t.headers.host=t.hostname+(t.port?":"+t.port:"");let i=o.hostname||o.host;t.hostname=i,t.host=i,t.port=o.port,t.path=r,o.protocol&&(t.protocol=o.protocol.includes(":")?o.protocol:`${o.protocol}:`)}t.beforeRedirects.proxy=function(n){bi(n,e,n.href)}}var cl=typeof process<"u"&&a.kindOf(process)==="process",ul=t=>new Promise((e,r)=>{let o,i,n=(u,p)=>{i||(i=!0,o&&o(u,p))},s=u=>{n(u),e(u)},l=u=>{n(u,!0),r(u)};t(s,l,u=>o=u).catch(l)}),dl=({address:t,family:e})=>{if(!a.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},yi=(t,e)=>dl(a.isObject(t)?t:{address:t,family:e}),Ti=cl&&function(e){return ul(async function(o,i,n){let{data:s,lookup:l,family:u}=e,{responseType:p,responseEncoding:c}=e,h=e.method.toUpperCase(),b,E=!1,m;if(l){let A=ui(l,C=>a.isArray(C)?C:[C]);l=(C,V,G)=>{A(C,V,(k,re,ye)=>{if(k)return G(k);let X=a.isArray(re)?re.map(oe=>yi(oe)):[yi(re,ye)];V.all?G(k,X):G(k,X[0].address,X[0].family)})}}let y=new ol,T=()=>{e.cancelToken&&e.cancelToken.unsubscribe(_),e.signal&&e.signal.removeEventListener("abort",_),y.removeAllListeners()};n((A,C)=>{b=!0,C&&(E=!0,T())});function _(A){y.emit("abort",!A||A.type?new ee(null,e,m):A)}y.once("abort",i),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(_),e.signal&&(e.signal.aborted?_():e.signal.addEventListener("abort",_)));let F=Re(e.baseURL,e.url,e.allowAbsoluteUrls),S=new URL(F,I.hasBrowserEnv?I.origin:void 0),x=S.protocol||hi[0];if(x==="data:"){if(e.maxContentLength>-1){let C=String(e.url||F||"");if(qr(C)>e.maxContentLength)return i(new g("maxContentLength size of "+e.maxContentLength+" exceeded",g.ERR_BAD_RESPONSE,e))}let A;if(h!=="GET")return ue(o,i,{status:405,statusText:"method not allowed",headers:{},config:e});try{A=Or(e.url,p==="blob",{Blob:e.env&&e.env.Blob})}catch(C){throw g.from(C,g.ERR_BAD_REQUEST,e)}return p==="text"?(A=A.toString(c),(!c||c==="utf8")&&(A=a.stripBOM(A))):p==="stream"&&(A=$e.Readable.from(A)),ue(o,i,{data:A,status:200,statusText:"OK",headers:new q,config:e})}if(hi.indexOf(x)===-1)return i(new g("Unsupported protocol "+x,g.ERR_BAD_REQUEST,e));let L=q.from(e.headers).normalize();L.set("User-Agent","axios/"+xe,!1);let{onUploadProgress:U,onDownloadProgress:j}=e,le=e.maxRate,te,pe;if(a.isSpecCompliantForm(s)){let A=L.getContentType(/boundary=([-_\w\d]{10,70})/i);s=li(s,C=>{L.set(C)},{tag:`axios-${xe}-boundary`,boundary:A&&A[1]||void 0})}else if(a.isFormData(s)&&a.isFunction(s.getHeaders)){if(L.set(s.getHeaders()),!L.hasContentLength())try{let A=await tl.promisify(s.getLength).call(s);Number.isFinite(A)&&A>=0&&L.setContentLength(A)}catch{}}else if(a.isBlob(s)||a.isFile(s))s.size&&L.setContentType(s.type||"application/octet-stream"),L.setContentLength(s.size||0),s=$e.Readable.from(Ht(s));else if(s&&!a.isStream(s)){if(!Buffer.isBuffer(s))if(a.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else if(a.isString(s))s=Buffer.from(s,"utf-8");else return i(new g("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",g.ERR_BAD_REQUEST,e));if(L.setContentLength(s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return i(new g("Request body larger than maxBodyLength limit",g.ERR_BAD_REQUEST,e))}let me=a.toFiniteNumber(L.getContentLength());a.isArray(le)?(te=le[0],pe=le[1]):te=pe=le,s&&(U||te)&&(a.isStream(s)||(s=$e.Readable.from(s,{objectMode:!1})),s=$e.pipeline([s,new Nr({maxRate:a.toFiniteNumber(te)})],a.noop),U&&s.on("progress",gi(s,Ge(me,ge(Qe(U),!1,3)))));let Q;if(e.auth){let A=e.auth.username||"",C=e.auth.password||"";Q=A+":"+C}if(!Q&&S.username){let A=S.username,C=S.password;Q=A+":"+C}Q&&L.delete("authorization");let H;try{H=_e(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(A){let C=new Error(A.message);return C.config=e,C.url=e.url,C.exists=!0,i(C)}L.set("Accept-Encoding","gzip, compress, deflate"+(fi?", br":""),!1);let N={path:H,method:h,headers:L.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:Q,protocol:x,family:u,beforeRedirect:ll,beforeRedirects:{}};!a.isUndefined(l)&&(N.lookup=l),e.socketPath?N.socketPath=e.socketPath:(N.hostname=S.hostname.startsWith("[")?S.hostname.slice(1,-1):S.hostname,N.port=S.port,bi(N,e.proxy,x+"//"+S.hostname+(S.port?":"+S.port:"")+N.path));let $,Fe=al.test(N.protocol);if(N.agent=Fe?e.httpsAgent:e.httpAgent,e.transport?$=e.transport:e.maxRedirects===0?$=Fe?el:Xa:(e.maxRedirects&&(N.maxRedirects=e.maxRedirects),e.beforeRedirect&&(N.beforeRedirects.config=e.beforeRedirect),$=Fe?nl:sl),e.maxBodyLength>-1?N.maxBodyLength=e.maxBodyLength:N.maxBodyLength=1/0,e.insecureHTTPParser&&(N.insecureHTTPParser=e.insecureHTTPParser),m=$.request(N,function(C){if(m.destroyed)return;let V=[C],G=+C.headers["content-length"];if(j||pe){let oe=new Nr({maxRate:a.toFiniteNumber(pe)});j&&oe.on("progress",gi(oe,Ge(G,ge(Qe(j),!0,3)))),V.push(oe)}let k=C,re=C.req||m;if(e.decompress!==!1&&C.headers["content-encoding"])switch((h==="HEAD"||C.statusCode===204)&&delete C.headers["content-encoding"],(C.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":V.push(we.createUnzip(mi)),delete C.headers["content-encoding"];break;case"deflate":V.push(new ci),V.push(we.createUnzip(mi)),delete C.headers["content-encoding"];break;case"br":fi&&(V.push(we.createBrotliDecompress(il)),delete C.headers["content-encoding"])}k=V.length>1?$e.pipeline(V,a.noop):V[0];let ye=$e.finished(k,()=>{ye(),T()}),X={status:C.statusCode,statusText:C.statusMessage,headers:new q(C.headers),config:e,request:re};if(p==="stream")X.data=k,ue(o,i,X);else{let oe=[],ho=0;k.on("data",function(Z){oe.push(Z),ho+=Z.length,e.maxContentLength>-1&&ho>e.maxContentLength&&(E=!0,k.destroy(),i(new g("maxContentLength size of "+e.maxContentLength+" exceeded",g.ERR_BAD_RESPONSE,e,re)))}),k.on("aborted",function(){if(E)return;let Z=new g("stream has been aborted",g.ERR_BAD_RESPONSE,e,re);k.destroy(Z),i(Z)}),k.on("error",function(Z){m.destroyed||i(g.from(Z,null,e,re))}),k.on("end",function(){try{let Z=oe.length===1?oe[0]:Buffer.concat(oe);p!=="arraybuffer"&&(Z=Z.toString(c),(!c||c==="utf8")&&(Z=a.stripBOM(Z))),X.data=Z}catch(Z){return i(g.from(Z,null,e,X.request,X))}ue(o,i,X)})}y.once("abort",oe=>{k.destroyed||(k.emit("error",oe),k.destroy())})}),y.once("abort",A=>{i(A),m.destroy(A)}),m.on("error",function(C){i(g.from(C,null,e,m))}),m.on("socket",function(C){C.setKeepAlive(!0,1e3*60)}),e.timeout){let A=parseInt(e.timeout,10);if(Number.isNaN(A)){i(new g("error trying to parse `config.timeout` to int",g.ERR_BAD_OPTION_VALUE,e,m));return}m.setTimeout(A,function(){if(b)return;let V=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",G=e.transitional||ze;e.timeoutErrorMessage&&(V=e.timeoutErrorMessage),i(new g(V,G.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,m)),_()})}if(a.isStream(s)){let A=!1,C=!1;s.on("end",()=>{A=!0}),s.once("error",V=>{C=!0,m.destroy(V)}),s.on("close",()=>{!A&&!C&&_(new ee("Request stream has been aborted",e,m))}),s.pipe(m)}else m.end(s)})};var wi=I.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,I.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(I.origin),I.navigator&&/(msie|trident)/i.test(I.navigator.userAgent)):()=>!0;var Ei=I.hasStandardBrowserEnv?{write(t,e,r,o,i,n){let s=[t+"="+encodeURIComponent(e)];a.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),a.isString(o)&&s.push("path="+o),a.isString(i)&&s.push("domain="+i),n===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Ai=t=>t instanceof q?{...t}:t;function ae(t,e){e=e||{};let r={};function o(p,c,h,b){return a.isPlainObject(p)&&a.isPlainObject(c)?a.merge.call({caseless:b},p,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function i(p,c,h,b){if(a.isUndefined(c)){if(!a.isUndefined(p))return o(void 0,p,h,b)}else return o(p,c,h,b)}function n(p,c){if(!a.isUndefined(c))return o(void 0,c)}function s(p,c){if(a.isUndefined(c)){if(!a.isUndefined(p))return o(void 0,p)}else return o(void 0,c)}function l(p,c,h){if(h in e)return o(p,c);if(h in t)return o(void 0,p)}let u={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:l,headers:(p,c,h)=>i(Ai(p),Ai(c),h,!0)};return a.forEach(Object.keys({...t,...e}),function(c){let h=u[c]||i,b=h(t[c],e[c],c);a.isUndefined(b)&&h!==l||(r[c]=b)}),r}var Gt=t=>{let e=ae({},t),{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:n,headers:s,auth:l}=e;if(e.headers=s=q.from(s),e.url=_e(Re(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&s.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(r)){if(I.hasStandardBrowserEnv||I.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(a.isFunction(r.getHeaders)){let u=r.getHeaders(),p=["content-type","content-length"];Object.entries(u).forEach(([c,h])=>{p.includes(c.toLowerCase())&&s.set(c,h)})}}if(I.hasStandardBrowserEnv&&(o&&a.isFunction(o)&&(o=o(e)),o||o!==!1&&wi(e.url))){let u=i&&n&&Ei.read(n);u&&s.set(i,u)}return e};var pl=typeof XMLHttpRequest<"u",Si=pl&&function(t){return new Promise(function(r,o){let i=Gt(t),n=i.data,s=q.from(i.headers).normalize(),{responseType:l,onUploadProgress:u,onDownloadProgress:p}=i,c,h,b,E,m;function y(){E&&E(),m&&m(),i.cancelToken&&i.cancelToken.unsubscribe(c),i.signal&&i.signal.removeEventListener("abort",c)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function _(){if(!T)return;let S=q.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),L={data:!l||l==="text"||l==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:S,config:t,request:T};ue(function(j){r(j),y()},function(j){o(j),y()},L),T=null}"onloadend"in T?T.onloadend=_:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(_)},T.onabort=function(){T&&(o(new g("Request aborted",g.ECONNABORTED,t,T)),T=null)},T.onerror=function(x){let L=x&&x.message?x.message:"Network Error",U=new g(L,g.ERR_NETWORK,t,T);U.event=x||null,o(U),T=null},T.ontimeout=function(){let x=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",L=i.transitional||ze;i.timeoutErrorMessage&&(x=i.timeoutErrorMessage),o(new g(x,L.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,T)),T=null},n===void 0&&s.setContentType(null),"setRequestHeader"in T&&a.forEach(s.toJSON(),function(x,L){T.setRequestHeader(L,x)}),a.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),l&&l!=="json"&&(T.responseType=i.responseType),p&&([b,m]=ge(p,!0),T.addEventListener("progress",b)),u&&T.upload&&([h,E]=ge(u),T.upload.addEventListener("progress",h),T.upload.addEventListener("loadend",E)),(i.cancelToken||i.signal)&&(c=S=>{T&&(o(!S||S.type?new ee(null,t,T):S),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(c),i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c)));let F=yt(i.url);if(F&&I.protocols.indexOf(F)===-1){o(new g("Unsupported protocol "+F+":",g.ERR_BAD_REQUEST,t));return}T.send(n||null)})};var ml=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let o=new AbortController,i,n=function(p){if(!i){i=!0,l();let c=p instanceof Error?p:this.reason;o.abort(c instanceof g?c:new ee(c instanceof Error?c.message:c))}},s=e&&setTimeout(()=>{s=null,n(new g(`timeout ${e} of ms exceeded`,g.ETIMEDOUT))},e),l=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(p=>{p.unsubscribe?p.unsubscribe(n):p.removeEventListener("abort",n)}),t=null)};t.forEach(p=>p.addEventListener("abort",n));let{signal:u}=o;return u.unsubscribe=()=>a.asap(l),u}},Ci=ml;var fl=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let o=0,i;for(;o<r;)i=o+e,yield t.slice(o,i),o=i},hl=async function*(t,e){for await(let r of gl(t))yield*fl(r,e)},gl=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:o}=await e.read();if(r)break;yield o}}finally{await e.cancel()}},Ur=(t,e,r,o)=>{let i=hl(t,e),n=0,s,l=u=>{s||(s=!0,o&&o(u))};return new ReadableStream({async pull(u){try{let{done:p,value:c}=await i.next();if(p){l(),u.close();return}let h=c.byteLength;if(r){let b=n+=h;r(b)}u.enqueue(new Uint8Array(c))}catch(p){throw l(p),p}},cancel(u){return l(u),i.return()}},{highWaterMark:2})};var _i=64*1024,{isFunction:Qt}=a,Li=(({fetch:t,Request:e,Response:r})=>({fetch:t,Request:e,Response:r}))(a.global),{ReadableStream:Ri,TextEncoder:xi}=a.global,vi=(t,...e)=>{try{return!!t(...e)}catch{return!1}},yl=t=>{let{fetch:e,Request:r,Response:o}=Object.assign({},Li,t),i=Qt(e),n=Qt(r),s=Qt(o);if(!i)return!1;let l=i&&Qt(Ri),u=i&&(typeof xi=="function"?(m=>y=>m.encode(y))(new xi):async m=>new Uint8Array(await new r(m).arrayBuffer())),p=n&&l&&vi(()=>{let m=!1,y=new r(I.origin,{body:new Ri,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!y}),c=s&&l&&vi(()=>a.isReadableStream(new o("").body)),h={stream:c&&(m=>m.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!h[m]&&(h[m]=(y,T)=>{let _=y&&y[m];if(_)return _.call(y);throw new g(`Response type '${m}' is not supported`,g.ERR_NOT_SUPPORT,T)})});let b=async m=>{if(m==null)return 0;if(a.isBlob(m))return m.size;if(a.isSpecCompliantForm(m))return(await new r(I.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(a.isArrayBufferView(m)||a.isArrayBuffer(m))return m.byteLength;if(a.isURLSearchParams(m)&&(m=m+""),a.isString(m))return(await u(m)).byteLength},E=async(m,y)=>{let T=a.toFiniteNumber(m.getContentLength());return T??b(y)};return async m=>{let{url:y,method:T,data:_,signal:F,cancelToken:S,timeout:x,onDownloadProgress:L,onUploadProgress:U,responseType:j,headers:le,withCredentials:te="same-origin",fetchOptions:pe}=Gt(m);j=j?(j+"").toLowerCase():"text";let me=Ci([F,S&&S.toAbortSignal()],x),Q=null,H=me&&me.unsubscribe&&(()=>{me.unsubscribe()}),N;try{if(U&&p&&T!=="get"&&T!=="head"&&(N=await E(le,_))!==0){let G=new r(y,{method:"POST",body:_,duplex:"half"}),k;if(a.isFormData(_)&&(k=G.headers.get("content-type"))&&le.setContentType(k),G.body){let[re,ye]=Ge(N,ge(Qe(U)));_=Ur(G.body,_i,re,ye)}}a.isString(te)||(te=te?"include":"omit");let $=n&&"credentials"in r.prototype,Fe={...pe,signal:me,method:T.toUpperCase(),headers:le.normalize().toJSON(),body:_,duplex:"half",credentials:$?te:void 0};Q=n&&new r(y,Fe);let A=await(n?e(Q,pe):e(y,Fe)),C=c&&(j==="stream"||j==="response");if(c&&(L||C&&H)){let G={};["status","statusText","headers"].forEach(X=>{G[X]=A[X]});let k=a.toFiniteNumber(A.headers.get("content-length")),[re,ye]=L&&Ge(k,ge(Qe(L),!0))||[];A=new o(Ur(A.body,_i,re,()=>{ye&&ye(),H&&H()}),G)}j=j||"text";let V=await h[a.findKey(h,j)||"text"](A,m);return!C&&H&&H(),await new Promise((G,k)=>{ue(G,k,{data:V,headers:q.from(A.headers),status:A.status,statusText:A.statusText,config:m,request:Q})})}catch($){throw H&&H(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,m,Q),{cause:$.cause||$}):g.from($,$&&$.code,m,Q)}}},bl=new Map,jr=t=>{let e=a.merge.call({skipUndefined:!0},Li,t?t.env:null),{fetch:r,Request:o,Response:i}=e,n=[o,i,r],s=n.length,l=s,u,p,c=bl;for(;l--;)u=n[l],p=c.get(u),p===void 0&&c.set(u,p=l?new Map:yl(e)),c=p;return p},eh=jr();var Br={http:Ti,xhr:Si,fetch:{get:jr}};a.forEach(Br,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var Di=t=>`- ${t}`,wl=t=>a.isFunction(t)||t===null||t===!1,$t={getAdapter:(t,e)=>{t=a.isArray(t)?t:[t];let{length:r}=t,o,i,n={};for(let s=0;s<r;s++){o=t[s];let l;if(i=o,!wl(o)&&(i=Br[(l=String(o)).toLowerCase()],i===void 0))throw new g(`Unknown adapter '${l}'`);if(i&&(a.isFunction(i)||(i=i.get(e))))break;n[l||"#"+s]=i}if(!i){let s=Object.entries(n).map(([u,p])=>`adapter ${u} `+(p===!1?"is not supported by the environment":"is not available in the build")),l=r?s.length>1?`since :
|
|
8
|
-
`+s.map(Di).join(`
|
|
9
|
-
|
|
10
|
-
`+n):o.stack=n}catch{}}throw o}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=ae(this.defaults,r);let{transitional:o,paramsSerializer:i,headers:n}=r;o!==void 0&&Tt.assertOptions(o,{silentJSONParsing:de.transitional(de.boolean),forcedJSONParsing:de.transitional(de.boolean),clarifyTimeoutError:de.transitional(de.boolean)},!1),i!=null&&(a.isFunction(i)?r.paramsSerializer={serialize:i}:Tt.assertOptions(i,{encode:de.function,serialize:de.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Tt.assertOptions(r,{baseUrl:de.spelling("baseURL"),withXsrfToken:de.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=n&&a.merge(n.common,n[r.method]);n&&a.forEach(["delete","get","head","post","put","patch","common"],m=>{delete n[m]}),r.headers=q.concat(s,n);let l=[],u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(r)===!1||(u=u&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});let p=[];this.interceptors.response.forEach(function(y){p.push(y.fulfilled,y.rejected)});let c,h=0,b;if(!u){let m=[Zt.bind(this),void 0];for(m.unshift(...l),m.push(...p),b=m.length,c=Promise.resolve(r);h<b;)c=c.then(m[h++],m[h++]);return c}b=l.length;let E=r;for(h=0;h<b;){let m=l[h++],y=l[h++];try{E=m(E)}catch(T){y.call(this,T);break}}try{c=Zt.call(this,E)}catch(m){return Promise.reject(m)}for(h=0,b=p.length;h<b;)c=c.then(p[h++],p[h++]);return c}getUri(e){e=ae(this.defaults,e);let r=Re(e.baseURL,e.url,e.allowAbsoluteUrls);return _e(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){Ze.prototype[e]=function(r,o){return this.request(ae(o||{},{method:e,url:r,data:(o||{}).data}))}});a.forEach(["post","put","patch"],function(e){function r(o){return function(n,s,l){return this.request(ae(l||{},{method:e,headers:o?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Ze.prototype[e]=r(),Ze.prototype[e+"Form"]=r(!0)});var wt=Ze;var zr=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(n){r=n});let o=this;this.promise.then(i=>{if(!o._listeners)return;let n=o._listeners.length;for(;n-- >0;)o._listeners[n](i);o._listeners=null}),this.promise.then=i=>{let n,s=new Promise(l=>{o.subscribe(l),n=l}).then(i);return s.cancel=function(){o.unsubscribe(n)},s},e(function(n,s,l){o.reason||(o.reason=new ee(n,s,l),r(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=o=>{e.abort(o)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Oi=zr;function Wr(t){return function(r){return t.apply(null,r)}}function Hr(t){return a.isObject(t)&&t.isAxiosError===!0}var Gr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Gr).forEach(([t,e])=>{Gr[e]=t});var Pi=Gr;function Fi(t){let e=new wt(t),r=ut(wt.prototype.request,e);return a.extend(r,wt.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return Fi(ae(t,i))},r}var B=Fi(We);B.Axios=wt;B.CanceledError=ee;B.CancelToken=Oi;B.isCancel=gt;B.VERSION=xe;B.toFormData=Te;B.AxiosError=g;B.Cancel=B.CanceledError;B.all=function(e){return Promise.all(e)};B.spread=Wr;B.isAxiosError=Hr;B.mergeConfig=ae;B.AxiosHeaders=q;B.formToJSON=t=>zt(a.isHTMLForm(t)?new FormData(t):t);B.getAdapter=$t.getAdapter;B.HttpStatusCode=Pi;B.default=B;var Ni=B;var{Axios:Jh,AxiosError:Kh,CanceledError:Yh,isCancel:Xh,CancelToken:eg,VERSION:tg,all:rg,Cancel:og,isAxiosError:Je,spread:ig,toFormData:sg,AxiosHeaders:ng,HttpStatusCode:ag,formToJSON:lg,getAdapter:cg,mergeConfig:ug}=Ni;import{makeApi as Il,makeEndpoint as Ke}from"@zodios/core";import{z as M}from"zod";import{z as d}from"zod";var Al=d.object({name:d.string(),description:d.string(),id:d.string(),schema_version:d.string(),metric_version:d.coerce.number(),definition_version:d.coerce.number(),last_updated_user:d.object({id:d.string()}).optional()}),Sl=d.object({id:d.string()}),ki=d.object({field:d.string(),operator:d.string(),categorical_values:d.array(d.object({string_value:d.string().optional(),bool_value:d.boolean().optional(),null_value:d.string().optional()}))}),Qr=d.object({measure:d.object({field:d.string(),aggregation:d.string()}),time_dimension:d.object({field:d.string()}),filters:d.array(ki)}),Cl=d.object({datasource:Sl,basic_specification:Qr,viz_state_specification:d.object({viz_state_string:d.string()}).optional(),is_running_total:d.boolean()}),Mi=d.object({allowed_dimensions:d.array(d.string()),allowed_granularities:d.array(d.string()),offset_from_today:d.number()}),qi=d.object({filters:d.array(ki),measurement_period:d.object({granularity:d.string(),range:d.string()}),comparison:d.object({comparison:d.string()})}),Ui=d.object({target:d.object({value:d.number()}).optional()}),Kt=d.object({id:d.string(),specification:qi,definition_id:d.string(),is_default:d.boolean(),schema_version:d.string(),metric_version:d.coerce.number(),goals:Ui.optional(),is_followed:d.boolean()}),ji=d.object({type:d.string(),number_units:d.object({singular_noun:d.string(),plural_noun:d.string()}),sentiment_type:d.string(),row_level_id_field:d.object({identifier_col:d.string()}),row_level_entity_names:d.object({entity_name_singular:d.string().optional(),entity_name_plural:d.string().optional()}),row_level_name_field:d.object({name_col:d.string()}),currency_code:d.string()}),Bi=d.object({settings:d.array(d.object({type:d.string(),disabled:d.boolean()}))}),_l=d.object({comparisons:d.array(d.object({compare_config:d.object({comparison:d.string()}),index:d.coerce.number()}))}),Rl=d.array(d.object({basic_specification:Qr,viz_state_specification:d.object({viz_state_string:d.string()}).optional(),minimum_granularity:d.string()})),$r=d.object({metadata:Al,specification:Cl,extension_options:Mi,metrics:d.array(Kt),total_metrics:d.coerce.number(),representation_options:ji,insights_options:Bi,comparisons:_l,datasource_goals:Rl}),Vi=d.object({id:d.string(),metric_id:d.string()}),xl=d.enum(["LANGUAGE_UNSPECIFIED","LANGUAGE_DE_DE","LANGUAGE_EN_US","LANGUAGE_EN_GB","LANGUAGE_ES_ES","LANGUAGE_FR_FR","LANGUAGE_FR_CA","LANGUAGE_GA_IE","LANGUAGE_IT_IT","LANGUAGE_JA_JP","LANGUAGE_KO_KR","LANGUAGE_NL_NL","LANGUAGE_PT_BR","LANGUAGE_SV_SE","LANGUAGE_TH_TH","LANGUAGE_ZH_CN","LANGUAGE_ZH_TW"]),vl=d.enum(["LOCALE_UNSPECIFIED","LOCALE_AR_AE","LOCALE_AR_BH","LOCALE_AR_DZ","LOCALE_AR_EG","LOCALE_AR_IQ","LOCALE_AR_JO","LOCALE_AR_KW","LOCALE_AR_LB","LOCALE_AR_LY","LOCALE_AR_MA","LOCALE_AR_OM","LOCALE_AR_QA","LOCALE_AR_SA","LOCALE_AR_SD","LOCALE_AR_SY","LOCALE_AR_TN","LOCALE_AR_YE","LOCALE_BE_BY","LOCALE_BG_BG","LOCALE_CA_ES","LOCALE_CS_CZ","LOCALE_DA_DK","LOCALE_DE_AT","LOCALE_DE_CH","LOCALE_DE_DE","LOCALE_DE_LU","LOCALE_EL_CY","LOCALE_EL_GR","LOCALE_EN_AU","LOCALE_EN_CA","LOCALE_EN_GB","LOCALE_EN_IE","LOCALE_EN_IN","LOCALE_EN_MT","LOCALE_EN_NZ","LOCALE_EN_PH","LOCALE_EN_SG","LOCALE_EN_US","LOCALE_EN_ZA","LOCALE_ES_AR","LOCALE_ES_BO","LOCALE_ES_CL","LOCALE_ES_CO","LOCALE_ES_CR","LOCALE_ES_DO","LOCALE_ES_EC","LOCALE_ES_ES","LOCALE_ES_GT","LOCALE_ES_HN","LOCALE_ES_MX","LOCALE_ES_NI","LOCALE_ES_PA","LOCALE_ES_PE","LOCALE_ES_PR","LOCALE_ES_PY","LOCALE_ES_SV","LOCALE_ES_US","LOCALE_ES_UY","LOCALE_ES_VE","LOCALE_ET_EE","LOCALE_FI_FI","LOCALE_FR_BE","LOCALE_FR_CA","LOCALE_FR_CH","LOCALE_FR_FR","LOCALE_FR_LU","LOCALE_GA_IE","LOCALE_HE_IL","LOCALE_HI_IN","LOCALE_HR_HR","LOCALE_HU_HU","LOCALE_ID_ID","LOCALE_IN_ID","LOCALE_IS_IS","LOCALE_IT_CH","LOCALE_IT_IT","LOCALE_IW_IL","LOCALE_JA_JP","LOCALE_KO_KR","LOCALE_LT_LT","LOCALE_LV_LV","LOCALE_MK_MK","LOCALE_MS_MY","LOCALE_MT_MT","LOCALE_NL_BE","LOCALE_NL_NL","LOCALE_NB_NO","LOCALE_NO_NO","LOCALE_PL_PL","LOCALE_PT_BR","LOCALE_PT_PT","LOCALE_RO_RO","LOCALE_RU_RU","LOCALE_SK_SK","LOCALE_SL_SI","LOCALE_SQ_AL","LOCALE_SR_BA","LOCALE_SR_ME","LOCALE_SR_RS","LOCALE_SV_SE","LOCALE_TH_TH","LOCALE_TR_TR","LOCALE_UK_UA","LOCALE_VI_VN","LOCALE_ZH_CN","LOCALE_ZH_HK","LOCALE_ZH_SG","LOCALE_ZH_TW"]),Ll=d.enum(["OUTPUT_FORMAT_UNSPECIFIED","OUTPUT_FORMAT_HTML","OUTPUT_FORMAT_TEXT"]),Yt=d.object({bundle_request:d.object({version:d.number(),options:d.object({output_format:Ll,time_zone:d.string(),language:xl,locale:vl}),input:d.object({metadata:d.object({name:d.string().nonempty(),metric_id:d.string().nonempty(),definition_id:d.string().nonempty()}),metric:d.object({definition:d.object({datasource:d.object({id:d.string()}),basic_specification:Qr,is_running_total:d.boolean()}),metric_specification:qi,extension_options:Mi,representation_options:ji,insights_options:Bi,goals:Ui.optional()})})})}),Dl=d.object({type:d.string(),insights:d.array(d.object({result:d.object({type:d.string(),version:d.number(),content:d.string().optional(),markup:d.string().optional(),viz:d.any().optional(),facts:d.any().optional(),characterization:d.string().optional(),question:d.string(),score:d.number()}),insight_type:d.string()})),summaries:d.array(d.object({result:d.object({id:d.string(),markup:d.string().optional(),viz:d.any().optional(),generation_id:d.string(),timestamp:d.string().optional(),last_attempted_timestamp:d.string().optional()})}))}),zi=d.object({bundle_response:d.object({result:d.object({insight_groups:d.array(Dl),has_errors:d.boolean(),characterization:d.string()})})}),Xt=["ban","springboard","basic","detail"],Le=["DEFINITION_VIEW_BASIC","DEFINITION_VIEW_FULL","DEFINITION_VIEW_DEFAULT"];var Ol=Ke({method:"get",path:"/pulse/definitions",alias:"listAllPulseMetricDefinitions",description:"Returns a list of all published Pulse Metric Definitions on the specified site.",parameters:[{name:"view",type:"Query",schema:M.optional(M.enum(Le)),description:`The range of metrics to return for a definition. The default is 'DEFINITION_VIEW_BASIC' if not specified.
|
|
4
|
+
`,process.stderr.write(t))},Ei=({requestId:t,toolName:e,args:r})=>({type:"tool",requestId:t,tool:{name:e,...r!==void 0?{args:r}:{}}});function Te(t){return async(e,r,{logger:i,requestId:o}={logger:e.name})=>{if(bi?.log({message:r,level:t,logger:i}),!!Ae(t))return e.server.notification({method:"notifications/message",params:{level:t,logger:i,data:JSON.stringify({timestamp:new Date().toISOString(),currentLogLevel:st,message:r},null,2)}},{relatedRequestId:o})}}import{appendFile as yn}from"node:fs/promises";import{existsSync as bn,mkdirSync as Tn}from"fs";import{join as wn}from"path";function ae(t){if(t instanceof Error)return t.message;try{return JSON.stringify(t)??"undefined"}catch{return`${t}`}}var Ot=class{_logDirectory;_fileMutexes=new Map;constructor({logDirectory:e}){this._logDirectory=e,bn(this._logDirectory)||Tn(this._logDirectory,{recursive:!0})}async log(e){let r=new Date().toISOString(),i=`${new Date(new Date().setMinutes(0,0,0)).toISOString().replace(/[:.]/g,"-")}.log`,o=wn(this._logDirectory,i),n=o,l=(this._fileMutexes.get(n)??Promise.resolve()).then(async()=>{try{await yn(o,JSON.stringify({timestamp:r,...e})+`
|
|
5
|
+
`)}catch(u){Se(`Failed to write to log file ${o}: ${ae(u)}`)}});this._fileMutexes.set(n,l),l.finally(()=>{this._fileMutexes.get(n)===l&&this._fileMutexes.delete(n)}),await l}};import{McpServer as Uu}from"@modelcontextprotocol/sdk/server/mcp.js";import{SetLevelRequestSchema as ju}from"@modelcontextprotocol/sdk/types.js";var Ai={name:"@tableau/mcp-server",description:"An MCP server for Tableau, providing a suite of tools that will make it easier for developers to build AI applications that integrate with Tableau.",version:"1.10.2",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:"module",license:"Apache-2.0",keywords:["tableau","mcp"],bin:{"tableau-mcp-server":"./build/index.js"},scripts:{":build":"npx rimraf ./build && esbuild src/index.ts --bundle --packages=external --platform=node --format=esm --minify --outdir=build --sourcemap",build:"run-s :build exec-perms","build:watch":"npm run :build -- --watch","build:docker":"docker build -t tableau-mcp .",":build:mcpb":"npx -y @anthropic-ai/mcpb pack . tableau-mcp.mcpb","build:mcpb":"run-s build:manifest:script build:manifest :build:mcpb","build:manifest":"node build/scripts/createClaudeMcpBundleManifest.mjs","build:manifest:script":"esbuild src/scripts/createClaudeMcpBundleManifest.ts --bundle --platform=node --format=esm --outdir=build/scripts --sourcemap=inline --out-extension:.js=.mjs","start:http":"node build/index.js","start:http:docker":"docker run -p 3927:3927 -i --rm --env-file env.list tableau-mcp",lint:"npm exec eslint",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","exec-perms":"shx chmod +x build/*.js",test:"vitest --config ./vitest.config.ts","test:e2e":"vitest --config ./vitest.config.e2e.ts","test:eval":"vitest --config ./vitest.config.eval.ts",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"},dependencies:{"@modelcontextprotocol/sdk":"^1.12.1","@zodios/core":"^10.9.6",cors:"^2.8.5",dotenv:"^16.5.0",express:"^5.1.0","fast-levenshtein":"^3.0.0",jose:"^6.0.12","ts-results-es":"^5.0.1",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","@modelcontextprotocol/inspector":"^0.16.6","@openai/agents":"^0.1.9","@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","@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","npm-run-all":"^4.1.5",openai:"^5.23.2",prettier:"^3.5.3",rimraf:"^6.0.1",shx:"^0.4.0",typescript:"^5.8.3","typescript-eslint":"^8.31.1",vitest:"^3.1.3"},engines:{node:">=20"}};import{Ok as Gc}from"ts-results-es";import{z as fs}from"zod";import{Err as Si,Ok as An}from"ts-results-es";var _i=t=>{let e=Ri(t);if(e.isErr())return t;let r=e.value;return Ae("debug")?(r.data?.credentials&&(r.data.credentials="<redacted>"),Array.isArray(r?.data?.datasource?.connections)&&r.data.datasource.connections.forEach(o=>{o.connectionUsername="<redacted>",o.connectionPassword="<redacted>"}),r.headers?.["X-Tableau-Auth"]&&(r.headers["X-Tableau-Auth"]="<redacted>"),r.params?.user_id&&(r.params.user_id="<redacted>")):(delete r.data,delete r.headers,delete r.params),r},Ci=t=>{let e=Ri(t);if(e.isErr())return t;let r=e.value;return Ae("debug")?r.data?.credentials&&(r.data.credentials="<redacted>"):(delete r.data,delete r.headers),r};function Ri(t){try{return An(structuredClone(t))}catch(e){if(e instanceof Error)return Si(e);let r=ae(e);return Se(`Could not clone object, notification may not be sanitized! Error: ${r}`),Si(new Error(r))}}function Pt(t){return{method:t.method??"UNKNOWN METHOD",url:t.url??"UNKNOWN URL",headers:t.headers,data:t.data,params:t.params}}function Nt(t){return{url:t.config.url??"UNKNOWN URL",status:t.status,headers:t.headers,data:t.data}}import{Zodios as Di}from"@zodios/core";import{randomUUID as Sn}from"node:crypto";import{SignJWT as _n}from"jose";async function xi({username:t,connectedApp:e,scopes:r,additionalPayload:i}){let o={alg:"HS256",typ:"JWT",kid:e.secretId},n={jti:Sn(),iss:e.clientId,aud:"tableau",sub:t,scp:[...r],iat:Math.floor(Date.now()/1e3)-5,exp:Math.floor(Date.now()/1e3)+5*60,...i};return await new _n(n).setProtectedHeader(o).sign(new TextEncoder().encode(e.secretValue))}import{makeApi as Cn,makeEndpoint as Li}from"@zodios/core";import{z as de}from"zod";import{z as _e}from"zod";var vi=_e.object({credentials:_e.object({site:_e.object({id:_e.string()}),user:_e.object({id:_e.string()}),token:_e.string()})});var Rn=de.object({credentials:de.object({site:de.object({contentUrl:de.string()})}).and(de.object({personalAccessTokenName:de.string(),personalAccessTokenSecret:de.string()}).or(de.object({jwt:de.string()})))}),xn=Li({method:"post",path:"/auth/signin",alias:"signIn",description:"Signs in with Tableau credentials.",response:vi,parameters:[{name:"credentials",type:"Body",schema:Rn}]}),vn=Li({method:"post",path:"/auth/signout",alias:"signOut",description:"Signs you out of the current session. This call invalidates the authentication token that is created by a call to Sign In.",response:de.void()}),Ln=Cn([xn,vn]),yr=[...Ln];var Ce=class{_apiClient;constructor(e){this._apiClient=e}get interceptors(){return this._apiClient.axios.interceptors}};var W=class extends Ce{_creds;get authHeader(){if(!this._creds)throw new Error("Authenticate by calling signIn() first");return{headers:{"X-Tableau-Auth":this._creds.token}}}get userId(){if(!this._creds)throw new Error("Authenticate by calling signIn() first");return this._creds.user.id}constructor(e,r){super(e),this._creds=r}};var nt=class extends Ce{constructor(e){super(new Di(e,yr))}signIn=async e=>(await this._apiClient.signIn({credentials:{site:{contentUrl:e.siteName},...await(async()=>{switch(e.type){case"pat":return{personalAccessTokenName:e.patName,personalAccessTokenSecret:e.patValue};case"direct-trust":return{jwt:await xi({username:e.username,connectedApp:{clientId:e.clientId,secretId:e.secretId,secretValue:e.secretValue},scopes:e.scopes,additionalPayload:e.additionalPayload})}}})()}})).credentials},Ft=class extends W{constructor(e,r){super(new Di(e,yr),r)}signOut=async()=>{await this._apiClient.signOut(void 0,{...this.authHeader})}};import{Zodios as kn}from"@zodios/core";import{makeApi as On,makeEndpoint as Pn}from"@zodios/core";import{z as Me}from"zod";import{z as L}from"zod";var Dn=L.enum(["hitsTotal","hitsSmallSpanTotal","hitsMediumSpanTotal","hitsLargeSpanTotal","downstreamWorkbookCount"]),Ii=L.array(L.object({method:Dn,sortDirection:L.enum(["asc","desc"]).default("asc").optional()})).nonempty(),Oi=L.enum(["lens","datasource","virtualconnection","collection","project","flow","datarole","table","database","view","workbook"]),Pi=L.union([L.array(L.string().datetime()).nonempty(),L.object({startDate:L.string().datetime(),endDate:L.string().datetime().optional()}).strict(),L.object({startDate:L.string().datetime().optional(),endDate:L.string().datetime()}).strict()]),br=L.object({contentTypes:L.array(Oi).nonempty(),ownerIds:L.array(L.number().int()).nonempty(),modifiedTime:Pi}).partial(),Ni=L.union([br.extend({contentTypes:L.array(Oi).nonempty()}).strict(),br.extend({ownerIds:L.array(L.number().int()).nonempty()}).strict(),br.extend({modifiedTime:Pi}).strict()]),In=L.object({uri:L.string(),content:L.record(L.string(),L.unknown())}),Fi=L.object({next:L.string(),prev:L.string(),pageIndex:L.number().int(),startIndex:L.number().int(),total:L.number().int(),limit:L.number().int(),items:L.array(In)}).partial();var Nn=Pn({method:"get",path:"/search",alias:"searchContent",description:"Searches across all supported content types for objects relevant to the search expression specified in the querystring of the request URI.",parameters:[{name:"terms",type:"Query",schema:Me.string().optional()},{name:"page",type:"Query",schema:Me.number().int().optional()},{name:"limit",type:"Query",schema:Me.number().int().optional()},{name:"order_by",type:"Query",schema:Me.string().optional()},{name:"filter",type:"Query",schema:Me.string().optional()}],response:Me.object({hits:Fi})}),Fn=On([Nn]),ki=[...Fn];var at=class extends W{constructor(e,r){super(new kn(e,ki),r)}searchContent=async e=>(Object.entries(e).forEach(([i,o])=>{o===void 0&&delete e[i]}),(await this._apiClient.searchContent({queries:e,...this.authHeader})).hits)};import{Zodios as Bn}from"@zodios/core";import{makeApi as Mn,makeEndpoint as qn}from"@zodios/core";import{z as je}from"zod";import{z as Mt}from"zod";import{z as Tr}from"zod";var kt=Tr.object({name:Tr.string(),id:Tr.string()});var Mi=Mt.object({id:Mt.string(),name:Mt.string(),description:Mt.string().optional(),project:kt});import{z as qt}from"zod";var qe=qt.object({pageNumber:qt.coerce.number(),pageSize:qt.coerce.number(),totalAvailable:qt.coerce.number()});import{z as qi}from"zod";var Ue=[{name:"pageSize",type:"Query",schema:qi.number().optional(),description:"The number of items to return in one response. The minimum is 1. The maximum is 1000. The default is 100."},{name:"pageNumber",type:"Query",schema:qi.number().optional(),description:"The offset for paging. The default is 1."}];var Un=qn({method:"get",path:"/sites/:siteId/datasources",alias:"listDatasources",description:"Returns a list of published data sources on the specified site. Supports a filter string as a query parameter in the format field:operator:value.",parameters:[...Ue,{name:"siteId",type:"Path",schema:je.string()},{name:"filter",type:"Query",schema:je.string().optional(),description:"Filter string in the format field:operator:value (e.g., name:eq:Project Views)"}],response:je.object({pagination:qe,datasources:je.object({datasource:je.optional(je.array(Mi))})})}),jn=Mn([Un]),Ui=[...jn];var lt=class extends W{constructor(e,r){super(new Bn(e,Ui),r)}listDatasources=async({siteId:e,filter:r,pageSize:i,pageNumber:o})=>{let n=await this._apiClient.listDatasources({params:{siteId:e},queries:{filter:r,pageSize:i,pageNumber:o},...this.authHeader});return{pagination:n.pagination,datasources:n.datasources.datasource??[]}}};import{Zodios as Qn}from"@zodios/core";import{makeApi as Vn,makeEndpoint as zn}from"@zodios/core";import{z as D}from"zod";var Wn=D.object({data:D.object({publishedDatasources:D.array(D.object({name:D.string().nullable(),description:D.string().nullable(),owner:D.object({name:D.string().nullable()}),fields:D.array(D.object({name:D.string(),isHidden:D.boolean().nullable(),description:D.string().nullable(),descriptionInherited:D.array(D.object({attribute:D.string(),value:D.string().nullable()}).nullable()).nullable(),fullyQualifiedName:D.string(),__typename:D.string(),dataCategory:D.string().nullish(),role:D.string().nullish(),dataType:D.string().nullish(),defaultFormat:D.string().nullish(),semanticRole:D.string().nullish(),aggregation:D.string().nullish(),aggregationParam:D.string().nullish(),formula:D.string().nullish(),isAutoGenerated:D.boolean().nullish(),hasUserReference:D.boolean().nullish(),binSize:D.number().nullish(),hasOther:D.boolean().nullish(),delimiter:D.string().nullish(),combinationType:D.string().nullish()}))}))})}),Hn=zn({method:"post",path:"/graphql",alias:"graphql",response:Wn,parameters:[{name:"query",type:"Body",schema:D.object({query:D.string()})}]}),Gn=Vn([Hn]),ji=[...Gn];var ct=class extends W{constructor(e,r){super(new Qn(e,ji),r)}graphql=async e=>await this._apiClient.graphql({query:e},{...this.authHeader})};import{Zodios as Xl}from"@zodios/core";import{Err as Zo,Ok as ec}from"ts-results-es";function ut(t,e){return function(){return t.apply(e,arguments)}}var{toString:$n}=Object.prototype,{getPrototypeOf:Er}=Object,{iterator:jt,toStringTag:Vi}=Symbol,Bt=(t=>e=>{let r=$n.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),le=t=>(t=t.toLowerCase(),e=>Bt(e)===t),Vt=t=>e=>typeof e===t,{isArray:Ve}=Array,Be=Vt("undefined");function dt(t){return t!==null&&!Be(t)&&t.constructor!==null&&!Be(t.constructor)&&J(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var zi=le("ArrayBuffer");function Zn(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&zi(t.buffer),e}var Jn=Vt("string"),J=Vt("function"),Wi=Vt("number"),pt=t=>t!==null&&typeof t=="object",Kn=t=>t===!0||t===!1,Ut=t=>{if(Bt(t)!=="object")return!1;let e=Er(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Vi in t)&&!(jt in t)},Yn=t=>{if(!pt(t)||dt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Xn=le("Date"),ea=le("File"),ta=le("Blob"),ra=le("FileList"),ia=t=>pt(t)&&J(t.pipe),oa=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||J(t.append)&&((e=Bt(t))==="formdata"||e==="object"&&J(t.toString)&&t.toString()==="[object FormData]"))},sa=le("URLSearchParams"),[na,aa,la,ca]=["ReadableStream","Request","Response","Headers"].map(le),ua=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function mt(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let i,o;if(typeof t!="object"&&(t=[t]),Ve(t))for(i=0,o=t.length;i<o;i++)e.call(null,t[i],i,t);else{if(dt(t))return;let n=r?Object.getOwnPropertyNames(t):Object.keys(t),s=n.length,l;for(i=0;i<s;i++)l=n[i],e.call(null,t[l],l,t)}}function Hi(t,e){if(dt(t))return null;e=e.toLowerCase();let r=Object.keys(t),i=r.length,o;for(;i-- >0;)if(o=r[i],e===o.toLowerCase())return o;return null}var Re=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gi=t=>!Be(t)&&t!==Re;function wr(){let{caseless:t,skipUndefined:e}=Gi(this)&&this||{},r={},i=(o,n)=>{let s=t&&Hi(r,n)||n;Ut(r[s])&&Ut(o)?r[s]=wr(r[s],o):Ut(o)?r[s]=wr({},o):Ve(o)?r[s]=o.slice():(!e||!Be(o))&&(r[s]=o)};for(let o=0,n=arguments.length;o<n;o++)arguments[o]&&mt(arguments[o],i);return r}var da=(t,e,r,{allOwnKeys:i}={})=>(mt(e,(o,n)=>{r&&J(o)?t[n]=ut(o,r):t[n]=o},{allOwnKeys:i}),t),pa=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),ma=(t,e,r,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},fa=(t,e,r,i)=>{let o,n,s,l={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),n=o.length;n-- >0;)s=o[n],(!i||i(s,t,e))&&!l[s]&&(e[s]=t[s],l[s]=!0);t=r!==!1&&Er(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ha=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let i=t.indexOf(e,r);return i!==-1&&i===r},ga=t=>{if(!t)return null;if(Ve(t))return t;let e=t.length;if(!Wi(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},ya=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Er(Uint8Array)),ba=(t,e)=>{let i=(t&&t[jt]).call(t),o;for(;(o=i.next())&&!o.done;){let n=o.value;e.call(t,n[0],n[1])}},Ta=(t,e)=>{let r,i=[];for(;(r=t.exec(e))!==null;)i.push(r);return i},wa=le("HTMLFormElement"),Ea=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,o){return i.toUpperCase()+o}),Bi=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Aa=le("RegExp"),Qi=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),i={};mt(r,(o,n)=>{let s;(s=e(o,n,t))!==!1&&(i[n]=s||o)}),Object.defineProperties(t,i)},Sa=t=>{Qi(t,(e,r)=>{if(J(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=t[r];if(J(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},_a=(t,e)=>{let r={},i=o=>{o.forEach(n=>{r[n]=!0})};return Ve(t)?i(t):i(String(t).split(e)),r},Ca=()=>{},Ra=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xa(t){return!!(t&&J(t.append)&&t[Vi]==="FormData"&&t[jt])}var va=t=>{let e=new Array(10),r=(i,o)=>{if(pt(i)){if(e.indexOf(i)>=0)return;if(dt(i))return i;if(!("toJSON"in i)){e[o]=i;let n=Ve(i)?[]:{};return mt(i,(s,l)=>{let u=r(s,o+1);!Be(u)&&(n[l]=u)}),e[o]=void 0,n}}return i};return r(t,0)},La=le("AsyncFunction"),Da=t=>t&&(pt(t)||J(t))&&J(t.then)&&J(t.catch),$i=((t,e)=>t?setImmediate:e?((r,i)=>(Re.addEventListener("message",({source:o,data:n})=>{o===Re&&n===r&&i.length&&i.shift()()},!1),o=>{i.push(o),Re.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",J(Re.postMessage)),Ia=typeof queueMicrotask<"u"?queueMicrotask.bind(Re):typeof process<"u"&&process.nextTick||$i,Oa=t=>t!=null&&J(t[jt]),a={isArray:Ve,isArrayBuffer:zi,isBuffer:dt,isFormData:oa,isArrayBufferView:Zn,isString:Jn,isNumber:Wi,isBoolean:Kn,isObject:pt,isPlainObject:Ut,isEmptyObject:Yn,isReadableStream:na,isRequest:aa,isResponse:la,isHeaders:ca,isUndefined:Be,isDate:Xn,isFile:ea,isBlob:ta,isRegExp:Aa,isFunction:J,isStream:ia,isURLSearchParams:sa,isTypedArray:ya,isFileList:ra,forEach:mt,merge:wr,extend:da,trim:ua,stripBOM:pa,inherits:ma,toFlatObject:fa,kindOf:Bt,kindOfTest:le,endsWith:ha,toArray:ga,forEachEntry:ba,matchAll:Ta,isHTMLForm:wa,hasOwnProperty:Bi,hasOwnProp:Bi,reduceDescriptors:Qi,freezeMethods:Sa,toObjectSet:_a,toCamelCase:Ea,noop:Ca,toFiniteNumber:Ra,findKey:Hi,global:Re,isContextDefined:Gi,isSpecCompliantForm:xa,toJSONObject:va,isAsyncFn:La,isThenable:Da,setImmediate:$i,asap:Ia,isIterable:Oa};function ze(t,e,r,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),i&&(this.request=i),o&&(this.response=o,this.status=o.status?o.status:null)}a.inherits(ze,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});var Zi=ze.prototype,Ji={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Ji[t]={value:t}});Object.defineProperties(ze,Ji);Object.defineProperty(Zi,"isAxiosError",{value:!0});ze.from=(t,e,r,i,o,n)=>{let s=Object.create(Zi);a.toFlatObject(t,s,function(c){return c!==Error.prototype},m=>m!=="isAxiosError");let l=t&&t.message?t.message:"Error",u=e==null&&t?t.code:e;return ze.call(s,l,u,r,i,o),t&&s.cause==null&&Object.defineProperty(s,"cause",{value:t,configurable:!0}),s.name=t&&t.name||"Error",n&&Object.assign(s,n),s};var g=ze;import Pa from"form-data";var zt=Pa;function Ar(t){return a.isPlainObject(t)||a.isArray(t)}function Yi(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function Ki(t,e,r){return t?t.concat(e).map(function(o,n){return o=Yi(o),!r&&n?"["+o+"]":o}).join(r?".":""):e}function Na(t){return a.isArray(t)&&!t.some(Ar)}var Fa=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function ka(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new(zt||FormData),r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,T){return!a.isUndefined(T[y])});let i=r.metaTokens,o=r.visitor||c,n=r.dots,s=r.indexes,u=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(o))throw new TypeError("visitor must be a function");function m(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!u&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?u&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function c(f,y,T){let C=f;if(f&&!T&&typeof f=="object"){if(a.endsWith(y,"{}"))y=i?y:y.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Na(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(C=a.toArray(f)))return y=Yi(y),C.forEach(function(A,x){!(a.isUndefined(A)||A===null)&&e.append(s===!0?Ki([y],x,n):s===null?y:y+"[]",m(A))}),!1}return Ar(f)?!0:(e.append(Ki(T,y,n),m(f)),!1)}let h=[],b=Object.assign(Fa,{defaultVisitor:c,convertValue:m,isVisitable:Ar});function w(f,y){if(!a.isUndefined(f)){if(h.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(f),a.forEach(f,function(C,N){(!(a.isUndefined(C)||C===null)&&o.call(e,C,a.isString(N)?N.trim():N,y,b))===!0&&w(C,y?y.concat(N):[N])}),h.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return w(t),e}var we=ka;function Xi(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function eo(t,e){this._pairs=[],t&&we(t,this,e)}var to=eo.prototype;to.append=function(e,r){this._pairs.push([e,r])};to.toString=function(e){let r=e?function(i){return e.call(this,i,Xi)}:Xi;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var ro=eo;function Ma(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xe(t,e,r){if(!e)return t;let i=r&&r.encode||Ma;a.isFunction(r)&&(r={serialize:r});let o=r&&r.serialize,n;if(o?n=o(e,r):n=a.isURLSearchParams(e)?e.toString():new ro(e,r).toString(i),n){let s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+n}return t}var Sr=class{constructor(){this.handlers=[]}use(e,r,i){return this.handlers.push({fulfilled:e,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(i){i!==null&&e(i)})}},_r=Sr;var We={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};import Ua from"crypto";import qa from"url";var io=qa.URLSearchParams;var Cr="abcdefghijklmnopqrstuvwxyz",oo="0123456789",so={DIGIT:oo,ALPHA:Cr,ALPHA_DIGIT:Cr+Cr.toUpperCase()+oo},ja=(t=16,e=so.ALPHA_DIGIT)=>{let r="",{length:i}=e,o=new Uint32Array(t);Ua.randomFillSync(o);for(let n=0;n<t;n++)r+=e[o[n]%i];return r},no={isNode:!0,classes:{URLSearchParams:io,FormData:zt,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:so,generateString:ja,protocols:["http","https","file","data"]};var vr={};an(vr,{hasBrowserEnv:()=>xr,hasStandardBrowserEnv:()=>Ba,hasStandardBrowserWebWorkerEnv:()=>Va,navigator:()=>Rr,origin:()=>za});var xr=typeof window<"u"&&typeof document<"u",Rr=typeof navigator=="object"&&navigator||void 0,Ba=xr&&(!Rr||["ReactNative","NativeScript","NS"].indexOf(Rr.product)<0),Va=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",za=xr&&window.location.href||"http://localhost";var I={...vr,...no};function Lr(t,e){return we(t,new I.classes.URLSearchParams,{visitor:function(r,i,o,n){return I.isNode&&a.isBuffer(r)?(this.append(i,r.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function Wa(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ha(t){let e={},r=Object.keys(t),i,o=r.length,n;for(i=0;i<o;i++)n=r[i],e[n]=t[n];return e}function Ga(t){function e(r,i,o,n){let s=r[n++];if(s==="__proto__")return!0;let l=Number.isFinite(+s),u=n>=r.length;return s=!s&&a.isArray(o)?o.length:s,u?(a.hasOwnProp(o,s)?o[s]=[o[s],i]:o[s]=i,!l):((!o[s]||!a.isObject(o[s]))&&(o[s]=[]),e(r,i,o[s],n)&&a.isArray(o[s])&&(o[s]=Ha(o[s])),!l)}if(a.isFormData(t)&&a.isFunction(t.entries)){let r={};return a.forEachEntry(t,(i,o)=>{e(Wa(i),o,r,0)}),r}return null}var Wt=Ga;function Qa(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(t)}var Dr={transitional:We,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let i=r.getContentType()||"",o=i.indexOf("application/json")>-1,n=a.isObject(e);if(n&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return o?JSON.stringify(Wt(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Lr(e,this.formSerializer).toString();if((l=a.isFileList(e))||i.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return we(l?{"files[]":e}:e,u&&new u,this.formSerializer)}}return n||o?(r.setContentType("application/json",!1),Qa(e)):e}],transformResponse:[function(e){let r=this.transitional||Dr.transitional,i=r&&r.forcedJSONParsing,o=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(i&&!this.responseType||o)){let s=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(l){if(s)throw l.name==="SyntaxError"?g.from(l,g.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:I.classes.FormData,Blob:I.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{Dr.headers[t]={}});var He=Dr;var $a=a.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"]),ao=t=>{let e={},r,i,o;return t&&t.split(`
|
|
6
|
+
`).forEach(function(s){o=s.indexOf(":"),r=s.substring(0,o).trim().toLowerCase(),i=s.substring(o+1).trim(),!(!r||e[r]&&$a[r])&&(r==="set-cookie"?e[r]?e[r].push(i):e[r]=[i]:e[r]=e[r]?e[r]+", "+i:i)}),e};var lo=Symbol("internals");function ft(t){return t&&String(t).trim().toLowerCase()}function Ht(t){return t===!1||t==null?t:a.isArray(t)?t.map(Ht):String(t)}function Za(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(t);)e[i[1]]=i[2];return e}var Ja=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ir(t,e,r,i,o){if(a.isFunction(i))return i.call(this,e,r);if(o&&(e=r),!!a.isString(e)){if(a.isString(i))return e.indexOf(i)!==-1;if(a.isRegExp(i))return i.test(e)}}function Ka(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,i)=>r.toUpperCase()+i)}function Ya(t,e){let r=a.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+r,{value:function(o,n,s){return this[i].call(this,e,o,n,s)},configurable:!0})})}var Ge=class{constructor(e){e&&this.set(e)}set(e,r,i){let o=this;function n(l,u,m){let c=ft(u);if(!c)throw new Error("header name must be a non-empty string");let h=a.findKey(o,c);(!h||o[h]===void 0||m===!0||m===void 0&&o[h]!==!1)&&(o[h||u]=Ht(l))}let s=(l,u)=>a.forEach(l,(m,c)=>n(m,c,u));if(a.isPlainObject(e)||e instanceof this.constructor)s(e,r);else if(a.isString(e)&&(e=e.trim())&&!Ja(e))s(ao(e),r);else if(a.isObject(e)&&a.isIterable(e)){let l={},u,m;for(let c of e){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[m=c[0]]=(u=l[m])?a.isArray(u)?[...u,c[1]]:[u,c[1]]:c[1]}s(l,r)}else e!=null&&n(r,e,i);return this}get(e,r){if(e=ft(e),e){let i=a.findKey(this,e);if(i){let o=this[i];if(!r)return o;if(r===!0)return Za(o);if(a.isFunction(r))return r.call(this,o,i);if(a.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ft(e),e){let i=a.findKey(this,e);return!!(i&&this[i]!==void 0&&(!r||Ir(this,this[i],i,r)))}return!1}delete(e,r){let i=this,o=!1;function n(s){if(s=ft(s),s){let l=a.findKey(i,s);l&&(!r||Ir(i,i[l],l,r))&&(delete i[l],o=!0)}}return a.isArray(e)?e.forEach(n):n(e),o}clear(e){let r=Object.keys(this),i=r.length,o=!1;for(;i--;){let n=r[i];(!e||Ir(this,this[n],n,e,!0))&&(delete this[n],o=!0)}return o}normalize(e){let r=this,i={};return a.forEach(this,(o,n)=>{let s=a.findKey(i,n);if(s){r[s]=Ht(o),delete r[n];return}let l=e?Ka(n):String(n).trim();l!==n&&delete r[n],r[l]=Ht(o),i[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return a.forEach(this,(i,o)=>{i!=null&&i!==!1&&(r[o]=e&&a.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
7
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let i=new this(e);return r.forEach(o=>i.set(o)),i}static accessor(e){let i=(this[lo]=this[lo]={accessors:{}}).accessors,o=this.prototype;function n(s){let l=ft(s);i[l]||(Ya(o,s),i[l]=!0)}return a.isArray(e)?e.forEach(n):n(e),this}};Ge.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(Ge.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[r]=i}}});a.freezeMethods(Ge);var M=Ge;function ht(t,e){let r=this||He,i=e||r,o=M.from(i.headers),n=i.data;return a.forEach(t,function(l){n=l.call(r,n,o.normalize(),e?e.status:void 0)}),o.normalize(),n}function gt(t){return!!(t&&t.__CANCEL__)}function co(t,e,r){g.call(this,t??"canceled",g.ERR_CANCELED,e,r),this.name="CanceledError"}a.inherits(co,g,{__CANCEL__:!0});var te=co;function pe(t,e,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Or(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Pr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function ve(t,e,r){let i=!Or(e);return t&&(i||r==!1)?Pr(t,e):e}import pl from"proxy-from-env";import ml from"http";import fl from"https";import hl from"util";import gl from"follow-redirects";import Ee from"zlib";var Le="1.12.1";function yt(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}var Xa=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Nr(t,e,r){let i=r&&r.Blob||I.classes.Blob,o=yt(t);if(e===void 0&&i&&(e=!0),o==="data"){t=o.length?t.slice(o.length+1):t;let n=Xa.exec(t);if(!n)throw new g("Invalid URL",g.ERR_INVALID_URL);let s=n[1],l=n[2],u=n[3],m=Buffer.from(decodeURIComponent(u),l?"base64":"utf8");if(e){if(!i)throw new g("Blob is not supported",g.ERR_NOT_SUPPORT);return new i([m],{type:s})}return m}throw new g("Unsupported protocol "+o,g.ERR_NOT_SUPPORT)}import Ze from"stream";import el from"stream";var Fr=Symbol("internals"),kr=class extends el.Transform{constructor(e){e=a.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,o)=>!a.isUndefined(o[i])),super({readableHighWaterMark:e.chunkSize});let r=this[Fr]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(e){let r=this[Fr];return r.onReadCallback&&r.onReadCallback(),super._read(e)}_transform(e,r,i){let o=this[Fr],n=o.maxRate,s=this.readableHighWaterMark,l=o.timeWindow,u=1e3/l,m=n/u,c=o.minChunkSize!==!1?Math.max(o.minChunkSize,m*.01):0,h=(w,f)=>{let y=Buffer.byteLength(w);o.bytesSeen+=y,o.bytes+=y,o.isCaptured&&this.emit("progress",o.bytesSeen),this.push(w)?process.nextTick(f):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(f)}},b=(w,f)=>{let y=Buffer.byteLength(w),T=null,C=s,N,A=0;if(n){let x=Date.now();(!o.ts||(A=x-o.ts)>=l)&&(o.ts=x,N=m-o.bytes,o.bytes=N<0?-N:0,A=0),N=m-o.bytes}if(n){if(N<=0)return setTimeout(()=>{f(null,w)},l-A);N<C&&(C=N)}C&&y>C&&y-C>c&&(T=w.subarray(C),w=w.subarray(0,C)),h(w,T?()=>{process.nextTick(f,null,T)}:f)};b(e,function w(f,y){if(f)return i(f);y?b(y,w):i(null)})}},Mr=kr;import{EventEmitter as yl}from"events";import rl from"util";import{Readable as il}from"stream";var{asyncIterator:uo}=Symbol,tl=async function*(t){t.stream?yield*t.stream():t.arrayBuffer?yield await t.arrayBuffer():t[uo]?yield*t[uo]():yield t},Gt=tl;var ol=I.ALPHABET.ALPHA_DIGIT+"-_",bt=typeof TextEncoder=="function"?new TextEncoder:new rl.TextEncoder,De=`\r
|
|
8
|
+
`,sl=bt.encode(De),nl=2,qr=class{constructor(e,r){let{escapeName:i}=this.constructor,o=a.isString(r),n=`Content-Disposition: form-data; name="${i(e)}"${!o&&r.name?`; filename="${i(r.name)}"`:""}${De}`;o?r=bt.encode(String(r).replace(/\r?\n|\r\n?/g,De)):n+=`Content-Type: ${r.type||"application/octet-stream"}${De}`,this.headers=bt.encode(n+De),this.contentLength=o?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+nl,this.name=e,this.value=r}async*encode(){yield this.headers;let{value:e}=this;a.isTypedArray(e)?yield e:yield*Gt(e),yield sl}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},al=(t,e,r)=>{let{tag:i="form-data-boundary",size:o=25,boundary:n=i+"-"+I.generateString(o,ol)}=r||{};if(!a.isFormData(t))throw TypeError("FormData instance required");if(n.length<1||n.length>70)throw Error("boundary must be 10-70 characters long");let s=bt.encode("--"+n+De),l=bt.encode("--"+n+"--"+De),u=l.byteLength,m=Array.from(t.entries()).map(([h,b])=>{let w=new qr(h,b);return u+=w.size,w});u+=s.byteLength*m.length,u=a.toFiniteNumber(u);let c={"Content-Type":`multipart/form-data; boundary=${n}`};return Number.isFinite(u)&&(c["Content-Length"]=u),e&&e(c),il.from(async function*(){for(let h of m)yield s,yield*h.encode();yield l}())},po=al;import ll from"stream";var Ur=class extends ll.Transform{__transform(e,r,i){this.push(e),i()}_transform(e,r,i){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let o=Buffer.alloc(2);o[0]=120,o[1]=156,this.push(o,r)}this.__transform(e,r,i)}},mo=Ur;var cl=(t,e)=>a.isAsyncFn(t)?function(...r){let i=r.pop();t.apply(this,r).then(o=>{try{e?i(null,...e(o)):i(null,o)}catch(n){i(n)}},i)}:t,fo=cl;function ul(t,e){t=t||10;let r=new Array(t),i=new Array(t),o=0,n=0,s;return e=e!==void 0?e:1e3,function(u){let m=Date.now(),c=i[n];s||(s=m),r[o]=u,i[o]=m;let h=n,b=0;for(;h!==o;)b+=r[h++],h=h%t;if(o=(o+1)%t,o===n&&(n=(n+1)%t),m-s<e)return;let w=c&&m-c;return w?Math.round(b*1e3/w):void 0}}var ho=ul;function dl(t,e){let r=0,i=1e3/e,o,n,s=(m,c=Date.now())=>{r=c,o=null,n&&(clearTimeout(n),n=null),t(...m)};return[(...m)=>{let c=Date.now(),h=c-r;h>=i?s(m,c):(o=m,n||(n=setTimeout(()=>{n=null,s(o)},i-h)))},()=>o&&s(o)]}var go=dl;var ye=(t,e,r=3)=>{let i=0,o=ho(50,250);return go(n=>{let s=n.loaded,l=n.lengthComputable?n.total:void 0,u=s-i,m=o(u),c=s<=l;i=s;let h={loaded:s,total:l,progress:l?s/l:void 0,bytes:u,rate:m||void 0,estimated:m&&l&&c?(l-s)/m:void 0,event:n,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(h)},r)},Qe=(t,e)=>{let r=t!=null;return[i=>e[0]({lengthComputable:r,total:t,loaded:i}),e[1]]},$e=t=>(...e)=>a.asap(()=>t(...e));function jr(t){if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;let e=t.indexOf(",");if(e<0)return 0;let r=t.slice(5,e),i=t.slice(e+1);if(/;base64/i.test(r)){let n=i.length,s=i.length;for(let b=0;b<s;b++)if(i.charCodeAt(b)===37&&b+2<s){let w=i.charCodeAt(b+1),f=i.charCodeAt(b+2);(w>=48&&w<=57||w>=65&&w<=70||w>=97&&w<=102)&&(f>=48&&f<=57||f>=65&&f<=70||f>=97&&f<=102)&&(n-=2,b+=2)}let l=0,u=s-1,m=b=>b>=2&&i.charCodeAt(b-2)===37&&i.charCodeAt(b-1)===51&&(i.charCodeAt(b)===68||i.charCodeAt(b)===100);u>=0&&(i.charCodeAt(u)===61?(l++,u--):m(u)&&(l++,u-=3)),l===1&&u>=0&&(i.charCodeAt(u)===61||m(u))&&l++;let h=Math.floor(n/4)*3-(l||0);return h>0?h:0}return Buffer.byteLength(i,"utf8")}var yo={flush:Ee.constants.Z_SYNC_FLUSH,finishFlush:Ee.constants.Z_SYNC_FLUSH},bl={flush:Ee.constants.BROTLI_OPERATION_FLUSH,finishFlush:Ee.constants.BROTLI_OPERATION_FLUSH},bo=a.isFunction(Ee.createBrotliDecompress),{http:Tl,https:wl}=gl,El=/https:?/,To=I.protocols.map(t=>t+":"),wo=(t,[e,r])=>(t.on("end",r).on("error",r),e);function Al(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function Ao(t,e,r){let i=e;if(!i&&i!==!1){let o=pl.getProxyForUrl(r);o&&(i=new URL(o))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let n=Buffer.from(i.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+n}t.headers.host=t.hostname+(t.port?":"+t.port:"");let o=i.hostname||i.host;t.hostname=o,t.host=o,t.port=i.port,t.path=r,i.protocol&&(t.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}t.beforeRedirects.proxy=function(n){Ao(n,e,n.href)}}var Sl=typeof process<"u"&&a.kindOf(process)==="process",_l=t=>new Promise((e,r)=>{let i,o,n=(u,m)=>{o||(o=!0,i&&i(u,m))},s=u=>{n(u),e(u)},l=u=>{n(u,!0),r(u)};t(s,l,u=>i=u).catch(l)}),Cl=({address:t,family:e})=>{if(!a.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},Eo=(t,e)=>Cl(a.isObject(t)?t:{address:t,family:e}),So=Sl&&function(e){return _l(async function(i,o,n){let{data:s,lookup:l,family:u}=e,{responseType:m,responseEncoding:c}=e,h=e.method.toUpperCase(),b,w=!1,f;if(l){let E=fo(l,S=>a.isArray(S)?S:[S]);l=(S,z,Q)=>{E(S,z,(F,re,be)=>{if(F)return Q(F);let ee=a.isArray(re)?re.map(ie=>Eo(ie)):[Eo(re,be)];z.all?Q(F,ee):Q(F,ee[0].address,ee[0].family)})}}let y=new yl,T=()=>{e.cancelToken&&e.cancelToken.unsubscribe(C),e.signal&&e.signal.removeEventListener("abort",C),y.removeAllListeners()};n((E,S)=>{b=!0,S&&(w=!0,T())});function C(E){y.emit("abort",!E||E.type?new te(null,e,f):E)}y.once("abort",o),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(C),e.signal&&(e.signal.aborted?C():e.signal.addEventListener("abort",C)));let N=ve(e.baseURL,e.url,e.allowAbsoluteUrls),A=new URL(N,I.hasBrowserEnv?I.origin:void 0),x=A.protocol||To[0];if(x==="data:"){if(e.maxContentLength>-1){let S=String(e.url||N||"");if(jr(S)>e.maxContentLength)return o(new g("maxContentLength size of "+e.maxContentLength+" exceeded",g.ERR_BAD_RESPONSE,e))}let E;if(h!=="GET")return pe(i,o,{status:405,statusText:"method not allowed",headers:{},config:e});try{E=Nr(e.url,m==="blob",{Blob:e.env&&e.env.Blob})}catch(S){throw g.from(S,g.ERR_BAD_REQUEST,e)}return m==="text"?(E=E.toString(c),(!c||c==="utf8")&&(E=a.stripBOM(E))):m==="stream"&&(E=Ze.Readable.from(E)),pe(i,o,{data:E,status:200,statusText:"OK",headers:new M,config:e})}if(To.indexOf(x)===-1)return o(new g("Unsupported protocol "+x,g.ERR_BAD_REQUEST,e));let v=M.from(e.headers).normalize();v.set("User-Agent","axios/"+Le,!1);let{onUploadProgress:q,onDownloadProgress:U}=e,ue=e.maxRate,ne,fe;if(a.isSpecCompliantForm(s)){let E=v.getContentType(/boundary=([-_\w\d]{10,70})/i);s=po(s,S=>{v.set(S)},{tag:`axios-${Le}-boundary`,boundary:E&&E[1]||void 0})}else if(a.isFormData(s)&&a.isFunction(s.getHeaders)){if(v.set(s.getHeaders()),!v.hasContentLength())try{let E=await hl.promisify(s.getLength).call(s);Number.isFinite(E)&&E>=0&&v.setContentLength(E)}catch{}}else if(a.isBlob(s)||a.isFile(s))s.size&&v.setContentType(s.type||"application/octet-stream"),v.setContentLength(s.size||0),s=Ze.Readable.from(Gt(s));else if(s&&!a.isStream(s)){if(!Buffer.isBuffer(s))if(a.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else if(a.isString(s))s=Buffer.from(s,"utf-8");else return o(new g("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",g.ERR_BAD_REQUEST,e));if(v.setContentLength(s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return o(new g("Request body larger than maxBodyLength limit",g.ERR_BAD_REQUEST,e))}let he=a.toFiniteNumber(v.getContentLength());a.isArray(ue)?(ne=ue[0],fe=ue[1]):ne=fe=ue,s&&(q||ne)&&(a.isStream(s)||(s=Ze.Readable.from(s,{objectMode:!1})),s=Ze.pipeline([s,new Mr({maxRate:a.toFiniteNumber(ne)})],a.noop),q&&s.on("progress",wo(s,Qe(he,ye($e(q),!1,3)))));let Y;if(e.auth){let E=e.auth.username||"",S=e.auth.password||"";Y=E+":"+S}if(!Y&&A.username){let E=A.username,S=A.password;Y=E+":"+S}Y&&v.delete("authorization");let X;try{X=xe(A.pathname+A.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(E){let S=new Error(E.message);return S.config=e,S.url=e.url,S.exists=!0,o(S)}v.set("Accept-Encoding","gzip, compress, deflate"+(bo?", br":""),!1);let j={path:X,method:h,headers:v.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:Y,protocol:x,family:u,beforeRedirect:Al,beforeRedirects:{}};!a.isUndefined(l)&&(j.lookup=l),e.socketPath?j.socketPath=e.socketPath:(j.hostname=A.hostname.startsWith("[")?A.hostname.slice(1,-1):A.hostname,j.port=A.port,Ao(j,e.proxy,x+"//"+A.hostname+(A.port?":"+A.port:"")+j.path));let B,G=El.test(j.protocol);if(j.agent=G?e.httpsAgent:e.httpAgent,e.transport?B=e.transport:e.maxRedirects===0?B=G?fl:ml:(e.maxRedirects&&(j.maxRedirects=e.maxRedirects),e.beforeRedirect&&(j.beforeRedirects.config=e.beforeRedirect),B=G?wl:Tl),e.maxBodyLength>-1?j.maxBodyLength=e.maxBodyLength:j.maxBodyLength=1/0,e.insecureHTTPParser&&(j.insecureHTTPParser=e.insecureHTTPParser),f=B.request(j,function(S){if(f.destroyed)return;let z=[S],Q=+S.headers["content-length"];if(U||fe){let ie=new Mr({maxRate:a.toFiniteNumber(fe)});U&&ie.on("progress",wo(ie,Qe(Q,ye($e(U),!0,3)))),z.push(ie)}let F=S,re=S.req||f;if(e.decompress!==!1&&S.headers["content-encoding"])switch((h==="HEAD"||S.statusCode===204)&&delete S.headers["content-encoding"],(S.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":z.push(Ee.createUnzip(yo)),delete S.headers["content-encoding"];break;case"deflate":z.push(new mo),z.push(Ee.createUnzip(yo)),delete S.headers["content-encoding"];break;case"br":bo&&(z.push(Ee.createBrotliDecompress(bl)),delete S.headers["content-encoding"])}F=z.length>1?Ze.pipeline(z,a.noop):z[0];let be=Ze.finished(F,()=>{be(),T()}),ee={status:S.statusCode,statusText:S.statusMessage,headers:new M(S.headers),config:e,request:re};if(m==="stream")ee.data=F,pe(i,o,ee);else{let ie=[],gi=0;F.on("data",function($){ie.push($),gi+=$.length,e.maxContentLength>-1&&gi>e.maxContentLength&&(w=!0,F.destroy(),o(new g("maxContentLength size of "+e.maxContentLength+" exceeded",g.ERR_BAD_RESPONSE,e,re)))}),F.on("aborted",function(){if(w)return;let $=new g("stream has been aborted",g.ERR_BAD_RESPONSE,e,re);F.destroy($),o($)}),F.on("error",function($){f.destroyed||o(g.from($,null,e,re))}),F.on("end",function(){try{let $=ie.length===1?ie[0]:Buffer.concat(ie);m!=="arraybuffer"&&($=$.toString(c),(!c||c==="utf8")&&($=a.stripBOM($))),ee.data=$}catch($){return o(g.from($,null,e,ee.request,ee))}pe(i,o,ee)})}y.once("abort",ie=>{F.destroyed||(F.emit("error",ie),F.destroy())})}),y.once("abort",E=>{o(E),f.destroy(E)}),f.on("error",function(S){o(g.from(S,null,e,f))}),f.on("socket",function(S){S.setKeepAlive(!0,1e3*60)}),e.timeout){let E=parseInt(e.timeout,10);if(Number.isNaN(E)){o(new g("error trying to parse `config.timeout` to int",g.ERR_BAD_OPTION_VALUE,e,f));return}f.setTimeout(E,function(){if(b)return;let z=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",Q=e.transitional||We;e.timeoutErrorMessage&&(z=e.timeoutErrorMessage),o(new g(z,Q.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,f)),C()})}if(a.isStream(s)){let E=!1,S=!1;s.on("end",()=>{E=!0}),s.once("error",z=>{S=!0,f.destroy(z)}),s.on("close",()=>{!E&&!S&&C(new te("Request stream has been aborted",e,f))}),s.pipe(f)}else f.end(s)})};var _o=I.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,I.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(I.origin),I.navigator&&/(msie|trident)/i.test(I.navigator.userAgent)):()=>!0;var Co=I.hasStandardBrowserEnv?{write(t,e,r,i,o,n){let s=[t+"="+encodeURIComponent(e)];a.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),a.isString(i)&&s.push("path="+i),a.isString(o)&&s.push("domain="+o),n===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Ro=t=>t instanceof M?{...t}:t;function ce(t,e){e=e||{};let r={};function i(m,c,h,b){return a.isPlainObject(m)&&a.isPlainObject(c)?a.merge.call({caseless:b},m,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function o(m,c,h,b){if(a.isUndefined(c)){if(!a.isUndefined(m))return i(void 0,m,h,b)}else return i(m,c,h,b)}function n(m,c){if(!a.isUndefined(c))return i(void 0,c)}function s(m,c){if(a.isUndefined(c)){if(!a.isUndefined(m))return i(void 0,m)}else return i(void 0,c)}function l(m,c,h){if(h in e)return i(m,c);if(h in t)return i(void 0,m)}let u={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:l,headers:(m,c,h)=>o(Ro(m),Ro(c),h,!0)};return a.forEach(Object.keys({...t,...e}),function(c){let h=u[c]||o,b=h(t[c],e[c],c);a.isUndefined(b)&&h!==l||(r[c]=b)}),r}var Qt=t=>{let e=ce({},t),{data:r,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:n,headers:s,auth:l}=e;if(e.headers=s=M.from(s),e.url=xe(ve(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&s.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(r)){if(I.hasStandardBrowserEnv||I.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(a.isFunction(r.getHeaders)){let u=r.getHeaders(),m=["content-type","content-length"];Object.entries(u).forEach(([c,h])=>{m.includes(c.toLowerCase())&&s.set(c,h)})}}if(I.hasStandardBrowserEnv&&(i&&a.isFunction(i)&&(i=i(e)),i||i!==!1&&_o(e.url))){let u=o&&n&&Co.read(n);u&&s.set(o,u)}return e};var Rl=typeof XMLHttpRequest<"u",xo=Rl&&function(t){return new Promise(function(r,i){let o=Qt(t),n=o.data,s=M.from(o.headers).normalize(),{responseType:l,onUploadProgress:u,onDownloadProgress:m}=o,c,h,b,w,f;function y(){w&&w(),f&&f(),o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let T=new XMLHttpRequest;T.open(o.method.toUpperCase(),o.url,!0),T.timeout=o.timeout;function C(){if(!T)return;let A=M.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:A,config:t,request:T};pe(function(U){r(U),y()},function(U){i(U),y()},v),T=null}"onloadend"in T?T.onloadend=C:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(C)},T.onabort=function(){T&&(i(new g("Request aborted",g.ECONNABORTED,t,T)),T=null)},T.onerror=function(x){let v=x&&x.message?x.message:"Network Error",q=new g(v,g.ERR_NETWORK,t,T);q.event=x||null,i(q),T=null},T.ontimeout=function(){let x=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",v=o.transitional||We;o.timeoutErrorMessage&&(x=o.timeoutErrorMessage),i(new g(x,v.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,T)),T=null},n===void 0&&s.setContentType(null),"setRequestHeader"in T&&a.forEach(s.toJSON(),function(x,v){T.setRequestHeader(v,x)}),a.isUndefined(o.withCredentials)||(T.withCredentials=!!o.withCredentials),l&&l!=="json"&&(T.responseType=o.responseType),m&&([b,f]=ye(m,!0),T.addEventListener("progress",b)),u&&T.upload&&([h,w]=ye(u),T.upload.addEventListener("progress",h),T.upload.addEventListener("loadend",w)),(o.cancelToken||o.signal)&&(c=A=>{T&&(i(!A||A.type?new te(null,t,T):A),T.abort(),T=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));let N=yt(o.url);if(N&&I.protocols.indexOf(N)===-1){i(new g("Unsupported protocol "+N+":",g.ERR_BAD_REQUEST,t));return}T.send(n||null)})};var xl=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let i=new AbortController,o,n=function(m){if(!o){o=!0,l();let c=m instanceof Error?m:this.reason;i.abort(c instanceof g?c:new te(c instanceof Error?c.message:c))}},s=e&&setTimeout(()=>{s=null,n(new g(`timeout ${e} of ms exceeded`,g.ETIMEDOUT))},e),l=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(m=>{m.unsubscribe?m.unsubscribe(n):m.removeEventListener("abort",n)}),t=null)};t.forEach(m=>m.addEventListener("abort",n));let{signal:u}=i;return u.unsubscribe=()=>a.asap(l),u}},vo=xl;var vl=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let i=0,o;for(;i<r;)o=i+e,yield t.slice(i,o),i=o},Ll=async function*(t,e){for await(let r of Dl(t))yield*vl(r,e)},Dl=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:i}=await e.read();if(r)break;yield i}}finally{await e.cancel()}},Br=(t,e,r,i)=>{let o=Ll(t,e),n=0,s,l=u=>{s||(s=!0,i&&i(u))};return new ReadableStream({async pull(u){try{let{done:m,value:c}=await o.next();if(m){l(),u.close();return}let h=c.byteLength;if(r){let b=n+=h;r(b)}u.enqueue(new Uint8Array(c))}catch(m){throw l(m),m}},cancel(u){return l(u),o.return()}},{highWaterMark:2})};var Lo=64*1024,{isFunction:$t}=a,Po=(({fetch:t,Request:e,Response:r})=>({fetch:t,Request:e,Response:r}))(a.global),{ReadableStream:Do,TextEncoder:Io}=a.global,Oo=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Il=t=>{let{fetch:e,Request:r,Response:i}=Object.assign({},Po,t),o=$t(e),n=$t(r),s=$t(i);if(!o)return!1;let l=o&&$t(Do),u=o&&(typeof Io=="function"?(f=>y=>f.encode(y))(new Io):async f=>new Uint8Array(await new r(f).arrayBuffer())),m=n&&l&&Oo(()=>{let f=!1,y=new r(I.origin,{body:new Do,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),c=s&&l&&Oo(()=>a.isReadableStream(new i("").body)),h={stream:c&&(f=>f.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!h[f]&&(h[f]=(y,T)=>{let C=y&&y[f];if(C)return C.call(y);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,T)})});let b=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(I.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await u(f)).byteLength},w=async(f,y)=>{let T=a.toFiniteNumber(f.getContentLength());return T??b(y)};return async f=>{let{url:y,method:T,data:C,signal:N,cancelToken:A,timeout:x,onDownloadProgress:v,onUploadProgress:q,responseType:U,headers:ue,withCredentials:ne="same-origin",fetchOptions:fe}=Qt(f);U=U?(U+"").toLowerCase():"text";let he=vo([N,A&&A.toAbortSignal()],x),Y=null,X=he&&he.unsubscribe&&(()=>{he.unsubscribe()}),j;try{if(q&&m&&T!=="get"&&T!=="head"&&(j=await w(ue,C))!==0){let Q=new r(y,{method:"POST",body:C,duplex:"half"}),F;if(a.isFormData(C)&&(F=Q.headers.get("content-type"))&&ue.setContentType(F),Q.body){let[re,be]=Qe(j,ye($e(q)));C=Br(Q.body,Lo,re,be)}}a.isString(ne)||(ne=ne?"include":"omit");let B=n&&"credentials"in r.prototype,G={...fe,signal:he,method:T.toUpperCase(),headers:ue.normalize().toJSON(),body:C,duplex:"half",credentials:B?ne:void 0};Y=n&&new r(y,G);let E=await(n?e(Y,fe):e(y,G)),S=c&&(U==="stream"||U==="response");if(c&&(v||S&&X)){let Q={};["status","statusText","headers"].forEach(ee=>{Q[ee]=E[ee]});let F=a.toFiniteNumber(E.headers.get("content-length")),[re,be]=v&&Qe(F,ye($e(v),!0))||[];E=new i(Br(E.body,Lo,re,()=>{be&&be(),X&&X()}),Q)}U=U||"text";let z=await h[a.findKey(h,U)||"text"](E,f);return!S&&X&&X(),await new Promise((Q,F)=>{pe(Q,F,{data:z,headers:M.from(E.headers),status:E.status,statusText:E.statusText,config:f,request:Y})})}catch(B){throw X&&X(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,Y),{cause:B.cause||B}):g.from(B,B&&B.code,f,Y)}}},Ol=new Map,Vr=t=>{let e=a.merge.call({skipUndefined:!0},Po,t?t.env:null),{fetch:r,Request:i,Response:o}=e,n=[i,o,r],s=n.length,l=s,u,m,c=Ol;for(;l--;)u=n[l],m=c.get(u),m===void 0&&c.set(u,m=l?new Map:Il(e)),c=m;return m},_h=Vr();var zr={http:So,xhr:xo,fetch:{get:Vr}};a.forEach(zr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var No=t=>`- ${t}`,Nl=t=>a.isFunction(t)||t===null||t===!1,Zt={getAdapter:(t,e)=>{t=a.isArray(t)?t:[t];let{length:r}=t,i,o,n={};for(let s=0;s<r;s++){i=t[s];let l;if(o=i,!Nl(i)&&(o=zr[(l=String(i)).toLowerCase()],o===void 0))throw new g(`Unknown adapter '${l}'`);if(o&&(a.isFunction(o)||(o=o.get(e))))break;n[l||"#"+s]=o}if(!o){let s=Object.entries(n).map(([u,m])=>`adapter ${u} `+(m===!1?"is not supported by the environment":"is not available in the build")),l=r?s.length>1?`since :
|
|
9
|
+
`+s.map(No).join(`
|
|
10
|
+
`):" "+No(s[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:zr};function Wr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new te(null,t)}function Jt(t){return Wr(t),t.headers=M.from(t.headers),t.data=ht.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Zt.getAdapter(t.adapter||He.adapter,t)(t).then(function(i){return Wr(t),i.data=ht.call(t,t.transformResponse,i),i.headers=M.from(i.headers),i},function(i){return gt(i)||(Wr(t),i&&i.response&&(i.response.data=ht.call(t,t.transformResponse,i.response),i.response.headers=M.from(i.response.headers))),Promise.reject(i)})}var Kt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Kt[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});var Fo={};Kt.transitional=function(e,r,i){function o(n,s){return"[Axios v"+Le+"] Transitional option '"+n+"'"+s+(i?". "+i:"")}return(n,s,l)=>{if(e===!1)throw new g(o(s," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!Fo[s]&&(Fo[s]=!0,console.warn(o(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(n,s,l):!0}};Kt.spelling=function(e){return(r,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function Fl(t,e,r){if(typeof t!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);let i=Object.keys(t),o=i.length;for(;o-- >0;){let n=i[o],s=e[n];if(s){let l=t[n],u=l===void 0||s(l,n,t);if(u!==!0)throw new g("option "+n+" must be "+u,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+n,g.ERR_BAD_OPTION)}}var Tt={assertOptions:Fl,validators:Kt};var me=Tt.validators,Je=class{constructor(e){this.defaults=e||{},this.interceptors={request:new _r,response:new _r}}async request(e,r){try{return await this._request(e,r)}catch(i){if(i instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;let n=o.stack?o.stack.replace(/^.+\n/,""):"";try{i.stack?n&&!String(i.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(i.stack+=`
|
|
11
|
+
`+n):i.stack=n}catch{}}throw i}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=ce(this.defaults,r);let{transitional:i,paramsSerializer:o,headers:n}=r;i!==void 0&&Tt.assertOptions(i,{silentJSONParsing:me.transitional(me.boolean),forcedJSONParsing:me.transitional(me.boolean),clarifyTimeoutError:me.transitional(me.boolean)},!1),o!=null&&(a.isFunction(o)?r.paramsSerializer={serialize:o}:Tt.assertOptions(o,{encode:me.function,serialize:me.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Tt.assertOptions(r,{baseUrl:me.spelling("baseURL"),withXsrfToken:me.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=n&&a.merge(n.common,n[r.method]);n&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete n[f]}),r.headers=M.concat(s,n);let l=[],u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(r)===!1||(u=u&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});let m=[];this.interceptors.response.forEach(function(y){m.push(y.fulfilled,y.rejected)});let c,h=0,b;if(!u){let f=[Jt.bind(this),void 0];for(f.unshift(...l),f.push(...m),b=f.length,c=Promise.resolve(r);h<b;)c=c.then(f[h++],f[h++]);return c}b=l.length;let w=r;for(h=0;h<b;){let f=l[h++],y=l[h++];try{w=f(w)}catch(T){y.call(this,T);break}}try{c=Jt.call(this,w)}catch(f){return Promise.reject(f)}for(h=0,b=m.length;h<b;)c=c.then(m[h++],m[h++]);return c}getUri(e){e=ce(this.defaults,e);let r=ve(e.baseURL,e.url,e.allowAbsoluteUrls);return xe(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){Je.prototype[e]=function(r,i){return this.request(ce(i||{},{method:e,url:r,data:(i||{}).data}))}});a.forEach(["post","put","patch"],function(e){function r(i){return function(n,s,l){return this.request(ce(l||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Je.prototype[e]=r(),Je.prototype[e+"Form"]=r(!0)});var wt=Je;var Hr=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(n){r=n});let i=this;this.promise.then(o=>{if(!i._listeners)return;let n=i._listeners.length;for(;n-- >0;)i._listeners[n](o);i._listeners=null}),this.promise.then=o=>{let n,s=new Promise(l=>{i.subscribe(l),n=l}).then(o);return s.cancel=function(){i.unsubscribe(n)},s},e(function(n,s,l){i.reason||(i.reason=new te(n,s,l),r(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=i=>{e.abort(i)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(o){e=o}),cancel:e}}},ko=Hr;function Gr(t){return function(r){return t.apply(null,r)}}function Qr(t){return a.isObject(t)&&t.isAxiosError===!0}var $r={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries($r).forEach(([t,e])=>{$r[e]=t});var Mo=$r;function qo(t){let e=new wt(t),r=ut(wt.prototype.request,e);return a.extend(r,wt.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return qo(ce(t,o))},r}var V=qo(He);V.Axios=wt;V.CanceledError=te;V.CancelToken=ko;V.isCancel=gt;V.VERSION=Le;V.toFormData=we;V.AxiosError=g;V.Cancel=V.CanceledError;V.all=function(e){return Promise.all(e)};V.spread=Gr;V.isAxiosError=Qr;V.mergeConfig=ce;V.AxiosHeaders=M;V.formToJSON=t=>Wt(a.isHTMLForm(t)?new FormData(t):t);V.getAdapter=Zt.getAdapter;V.HttpStatusCode=Mo;V.default=V;var Uo=V;var{Axios:wg,AxiosError:Eg,CanceledError:Ag,isCancel:Sg,CancelToken:_g,VERSION:Cg,all:Rg,Cancel:xg,isAxiosError:Ke,spread:vg,toFormData:Lg,AxiosHeaders:Dg,HttpStatusCode:Ig,formToJSON:Og,getAdapter:Pg,mergeConfig:Ng}=Uo;import{makeApi as Hl,makeEndpoint as Ye}from"@zodios/core";import{z as k}from"zod";import{z as p}from"zod";var kl=p.object({name:p.string(),description:p.string(),id:p.string(),schema_version:p.string(),metric_version:p.coerce.number(),definition_version:p.coerce.number(),last_updated_user:p.object({id:p.string()}).optional()}),Ml=p.object({id:p.string()}),jo=p.object({field:p.string(),operator:p.string(),categorical_values:p.array(p.object({string_value:p.string().optional(),bool_value:p.boolean().optional(),null_value:p.string().optional()}))}),Zr=p.object({measure:p.object({field:p.string(),aggregation:p.string()}),time_dimension:p.object({field:p.string()}),filters:p.array(jo)}),ql=p.object({datasource:Ml,basic_specification:Zr,viz_state_specification:p.object({viz_state_string:p.string()}).optional(),is_running_total:p.boolean()}),Bo=p.object({allowed_dimensions:p.array(p.string()),allowed_granularities:p.array(p.string()),offset_from_today:p.number()}),Vo=p.object({filters:p.array(jo),measurement_period:p.object({granularity:p.string(),range:p.string()}),comparison:p.object({comparison:p.string()})}),zo=p.object({target:p.object({value:p.number()}).optional()}),Yt=p.object({id:p.string(),specification:Vo,definition_id:p.string(),is_default:p.boolean(),schema_version:p.string(),metric_version:p.coerce.number(),goals:zo.optional(),is_followed:p.boolean()}),Wo=p.object({type:p.string(),number_units:p.object({singular_noun:p.string(),plural_noun:p.string()}),sentiment_type:p.string(),row_level_id_field:p.object({identifier_col:p.string()}),row_level_entity_names:p.object({entity_name_singular:p.string().optional(),entity_name_plural:p.string().optional()}),row_level_name_field:p.object({name_col:p.string()}),currency_code:p.string()}),Ho=p.object({settings:p.array(p.object({type:p.string(),disabled:p.boolean()}))}),Ul=p.object({comparisons:p.array(p.object({compare_config:p.object({comparison:p.string()}),index:p.coerce.number()}))}),jl=p.array(p.object({basic_specification:Zr,viz_state_specification:p.object({viz_state_string:p.string()}).optional(),minimum_granularity:p.string()})),Jr=p.object({metadata:kl,specification:ql,extension_options:Bo,metrics:p.array(Yt),total_metrics:p.coerce.number(),representation_options:Wo,insights_options:Ho,comparisons:Ul,datasource_goals:jl}),Go=p.object({id:p.string(),metric_id:p.string()}),Bl=p.enum(["LANGUAGE_UNSPECIFIED","LANGUAGE_DE_DE","LANGUAGE_EN_US","LANGUAGE_EN_GB","LANGUAGE_ES_ES","LANGUAGE_FR_FR","LANGUAGE_FR_CA","LANGUAGE_GA_IE","LANGUAGE_IT_IT","LANGUAGE_JA_JP","LANGUAGE_KO_KR","LANGUAGE_NL_NL","LANGUAGE_PT_BR","LANGUAGE_SV_SE","LANGUAGE_TH_TH","LANGUAGE_ZH_CN","LANGUAGE_ZH_TW"]),Vl=p.enum(["LOCALE_UNSPECIFIED","LOCALE_AR_AE","LOCALE_AR_BH","LOCALE_AR_DZ","LOCALE_AR_EG","LOCALE_AR_IQ","LOCALE_AR_JO","LOCALE_AR_KW","LOCALE_AR_LB","LOCALE_AR_LY","LOCALE_AR_MA","LOCALE_AR_OM","LOCALE_AR_QA","LOCALE_AR_SA","LOCALE_AR_SD","LOCALE_AR_SY","LOCALE_AR_TN","LOCALE_AR_YE","LOCALE_BE_BY","LOCALE_BG_BG","LOCALE_CA_ES","LOCALE_CS_CZ","LOCALE_DA_DK","LOCALE_DE_AT","LOCALE_DE_CH","LOCALE_DE_DE","LOCALE_DE_LU","LOCALE_EL_CY","LOCALE_EL_GR","LOCALE_EN_AU","LOCALE_EN_CA","LOCALE_EN_GB","LOCALE_EN_IE","LOCALE_EN_IN","LOCALE_EN_MT","LOCALE_EN_NZ","LOCALE_EN_PH","LOCALE_EN_SG","LOCALE_EN_US","LOCALE_EN_ZA","LOCALE_ES_AR","LOCALE_ES_BO","LOCALE_ES_CL","LOCALE_ES_CO","LOCALE_ES_CR","LOCALE_ES_DO","LOCALE_ES_EC","LOCALE_ES_ES","LOCALE_ES_GT","LOCALE_ES_HN","LOCALE_ES_MX","LOCALE_ES_NI","LOCALE_ES_PA","LOCALE_ES_PE","LOCALE_ES_PR","LOCALE_ES_PY","LOCALE_ES_SV","LOCALE_ES_US","LOCALE_ES_UY","LOCALE_ES_VE","LOCALE_ET_EE","LOCALE_FI_FI","LOCALE_FR_BE","LOCALE_FR_CA","LOCALE_FR_CH","LOCALE_FR_FR","LOCALE_FR_LU","LOCALE_GA_IE","LOCALE_HE_IL","LOCALE_HI_IN","LOCALE_HR_HR","LOCALE_HU_HU","LOCALE_ID_ID","LOCALE_IN_ID","LOCALE_IS_IS","LOCALE_IT_CH","LOCALE_IT_IT","LOCALE_IW_IL","LOCALE_JA_JP","LOCALE_KO_KR","LOCALE_LT_LT","LOCALE_LV_LV","LOCALE_MK_MK","LOCALE_MS_MY","LOCALE_MT_MT","LOCALE_NL_BE","LOCALE_NL_NL","LOCALE_NB_NO","LOCALE_NO_NO","LOCALE_PL_PL","LOCALE_PT_BR","LOCALE_PT_PT","LOCALE_RO_RO","LOCALE_RU_RU","LOCALE_SK_SK","LOCALE_SL_SI","LOCALE_SQ_AL","LOCALE_SR_BA","LOCALE_SR_ME","LOCALE_SR_RS","LOCALE_SV_SE","LOCALE_TH_TH","LOCALE_TR_TR","LOCALE_UK_UA","LOCALE_VI_VN","LOCALE_ZH_CN","LOCALE_ZH_HK","LOCALE_ZH_SG","LOCALE_ZH_TW"]),zl=p.enum(["OUTPUT_FORMAT_UNSPECIFIED","OUTPUT_FORMAT_HTML","OUTPUT_FORMAT_TEXT"]),Xt=p.object({bundle_request:p.object({version:p.number(),options:p.object({output_format:zl,time_zone:p.string(),language:Bl,locale:Vl}),input:p.object({metadata:p.object({name:p.string().nonempty(),metric_id:p.string().nonempty(),definition_id:p.string().nonempty()}),metric:p.object({definition:p.object({datasource:p.object({id:p.string()}),basic_specification:Zr,is_running_total:p.boolean()}),metric_specification:Vo,extension_options:Bo,representation_options:Wo,insights_options:Ho,goals:zo.optional()})})})}),Wl=p.object({type:p.string(),insights:p.array(p.object({result:p.object({type:p.string(),version:p.number(),content:p.string().optional(),markup:p.string().optional(),viz:p.any().optional(),facts:p.any().optional(),characterization:p.string().optional(),question:p.string(),score:p.number()}),insight_type:p.string()})),summaries:p.array(p.object({result:p.object({id:p.string(),markup:p.string().optional(),viz:p.any().optional(),generation_id:p.string(),timestamp:p.string().optional(),last_attempted_timestamp:p.string().optional()})}))}),Qo=p.object({bundle_response:p.object({result:p.object({insight_groups:p.array(Wl),has_errors:p.boolean(),characterization:p.string()})})}),er=["ban","springboard","basic","detail"],Ie=["DEFINITION_VIEW_BASIC","DEFINITION_VIEW_FULL","DEFINITION_VIEW_DEFAULT"];var Gl=Ye({method:"get",path:"/pulse/definitions",alias:"listAllPulseMetricDefinitions",description:"Returns a list of all published Pulse Metric Definitions on the specified site.",parameters:[{name:"view",type:"Query",schema:k.optional(k.enum(Ie)),description:`The range of metrics to return for a definition. The default is 'DEFINITION_VIEW_BASIC' if not specified.
|
|
11
12
|
- 'DEFINITION_VIEW_BASIC' - Return only the specified metric definition.
|
|
12
13
|
- 'DEFINITION_VIEW_FULL' - Return the metric definition and the specified number of metrics.
|
|
13
|
-
- 'DEFINITION_VIEW_DEFAULT' - Return the metric definition and the default metric.`}],response:
|
|
14
|
+
- 'DEFINITION_VIEW_DEFAULT' - Return the metric definition and the default metric.`}],response:k.object({definitions:k.array(Jr)})}),Ql=Ye({method:"post",path:"/pulse/definitions%3AbatchGet",alias:"listPulseMetricDefinitionsFromMetricDefinitionIds",description:"Returns a list of published Pulse Metric Definitions from a list of metric definition IDs.",parameters:[{name:"definition_ids",type:"Body",schema:k.object({definition_ids:k.array(k.string().nonempty()).min(1)}),description:"A list of metric definition IDs to retrieve."},{name:"view",type:"Query",schema:k.optional(k.enum(Ie)),description:`The range of metrics to return for a definition. The default is 'DEFINITION_VIEW_BASIC' if not specified.
|
|
14
15
|
- 'DEFINITION_VIEW_BASIC' - Return only the specified metric definition.
|
|
15
16
|
- 'DEFINITION_VIEW_FULL' - Return the metric definition and the specified number of metrics.
|
|
16
|
-
- 'DEFINITION_VIEW_DEFAULT' - Return the metric definition and the default metric.`}],response:M.object({definitions:M.array($r)})}),Fl=Ke({method:"get",path:"/pulse/definitions/:pulseMetricDefinitionID/metrics",alias:"listPulseMetricsFromMetricDefinitionId",description:"Returns a list of published Pulse Metrics for a specific Pulse Metric Definition.",parameters:[{name:"pulseMetricDefinitionID",type:"Path",schema:M.string().nonempty()}],response:M.object({metrics:M.array(Kt),total_available:M.number()})}),Nl=Ke({method:"post",path:"/pulse/metrics%3AbatchGet",alias:"listPulseMetricsFromMetricIds",description:"Returns a list of Pulse Metrics for a list of metric IDs.",parameters:[{name:"metric_ids",type:"Body",schema:M.object({metric_ids:M.array(M.string().nonempty())})}],response:M.object({metrics:M.array(Kt)})}),kl=Ke({method:"get",path:"/pulse/subscriptions",alias:"listPulseMetricSubscriptionsForCurrentUser",description:"Returns a list of Pulse Subscriptions for the current user.",parameters:[{name:"user_id",type:"Query",schema:M.string().nonempty()}],response:M.object({subscriptions:M.array(Vi)})}),Ml=Ke({method:"post",path:"/pulse/insights/:bundle_type",alias:"generatePulseMetricValueInsightBundle",description:"Generates a bundle for the current aggregated value for the Pulse metric.",parameters:[{name:"bundle_request",type:"Body",schema:Yt},{name:"bundle_type",type:"Path",schema:M.enum(Xt)}],response:zi}),ql=Il([Ml,Ol,Pl,Fl,kl,Nl]),Wi=[...ql];var Et=class extends z{constructor(e,r){super(new Ul(e,Wi),r)}listAllPulseMetricDefinitions=async e=>await Ye(async()=>(await this._apiClient.listAllPulseMetricDefinitions({queries:{view:e},...this.authHeader})).definitions??[]);listPulseMetricDefinitionsFromMetricDefinitionIds=async(e,r)=>await Ye(async()=>(await this._apiClient.listPulseMetricDefinitionsFromMetricDefinitionIds({definition_ids:e},{queries:{view:r},...this.authHeader})).definitions??[]);listPulseMetricsFromMetricDefinitionId=async e=>await Ye(async()=>(await this._apiClient.listPulseMetricsFromMetricDefinitionId({params:{pulseMetricDefinitionID:e},...this.authHeader})).metrics??[]);listPulseMetricsFromMetricIds=async e=>await Ye(async()=>(await this._apiClient.listPulseMetricsFromMetricIds({metric_ids:e},{...this.authHeader})).metrics??[]);listPulseMetricSubscriptionsForCurrentUser=async()=>await Ye(async()=>(await this._apiClient.listPulseMetricSubscriptionsForCurrentUser({queries:{user_id:this.userId},...this.authHeader})).subscriptions??[]);generatePulseMetricValueInsightBundle=async(e,r)=>await Ye(async()=>await this._apiClient.generatePulseMetricValueInsightBundle({bundle_request:e.bundle_request},{params:{bundle_type:r},...this.authHeader})??{})};async function Ye(t){try{return new jl(await t())}catch(e){if(Je(e)){if(e.response?.status===404)return new Hi("tableau-server");if(e.response?.status===400&&e.response.headers.tableau_error_code==="0xd3408984"&&e.response.headers.validation_code==="400999")return new Hi("pulse-disabled")}throw e}}import{Zodios as Ql}from"@zodios/core";import{makeApi as Bl,makeEndpoint as er}from"@zodios/core";import{z as Y}from"zod";import{z as W}from"zod";var At=W.object({id:W.string(),name:W.string(),createdAt:W.string(),updatedAt:W.string(),workbook:W.object({id:W.string()}).optional(),owner:W.object({id:W.string()}).optional(),project:W.object({id:W.string()}).optional(),tags:W.object({tag:W.array(W.object({label:W.string()})).optional()}),usage:W.object({totalViewCount:W.coerce.number()}).optional()});var Vl=er({method:"get",path:"/sites/:siteId/views/:viewId/data",alias:"queryViewData",description:"Returns a specified view rendered as data in comma separated value (CSV) format.",response:Y.string()}),zl=er({method:"get",path:"/sites/:siteId/views/:viewId/image",alias:"queryViewImage",description:"Returns an image of the specified view.",parameters:[{name:"vizWidth",type:"Query",schema:Y.number().optional(),description:"The width of the rendered image in pixels that, along with the value of vizHeight determine its resolution and aspect ratio."},{name:"vizHeight",type:"Query",schema:Y.number().optional(),description:"The height of the rendered image in pixels that, along with the value of vizWidth determine its resolution and aspect ratio."},{name:"resolution",type:"Query",schema:Y.literal("high").optional(),description:"The resolution of the image. Image width and actual pixel density are determined by the display context of the image. Aspect ratio is always preserved. Set the value to high to ensure maximum pixel density."}],response:Y.string()}),Wl=er({method:"get",path:"/sites/:siteId/workbooks/:workbookId/views",alias:"queryViewsForWorkbook",description:"Returns all the views for the specified workbook, optionally including usage statistics.",parameters:[{name:"includeUsageStatistics",type:"Query",schema:Y.boolean().optional(),description:"true to return usage statistics. The default is false."}],response:Y.object({views:Y.object({view:Y.array(At)})})}),Hl=er({method:"get",path:"/sites/:siteId/views",alias:"queryViewsForSite",description:"Returns all the views for the specified site, optionally including usage statistics.",parameters:[...qe,{name:"includeUsageStatistics",type:"Query",schema:Y.boolean().optional(),description:"true to return usage statistics. The default is false."},{name:"filter",type:"Query",schema:Y.string().optional(),description:"An expression that lets you specify a subset of views to return. You can filter on predefined fields such as name, tags, and createdAt. You can include multiple filter expressions."}],response:Y.object({pagination:Me,views:Y.object({view:Y.array(At).optional()})})}),Gl=Bl([Vl,zl,Wl,Hl]),Gi=[...Gl];var St=class extends z{constructor(e,r){super(new Ql(e,Gi),r)}queryViewData=async({viewId:e,siteId:r})=>await this._apiClient.queryViewData({params:{siteId:r,viewId:e},...this.authHeader});queryViewImage=async({viewId:e,siteId:r,width:o,height:i,resolution:n})=>await this._apiClient.queryViewImage({params:{siteId:r,viewId:e},queries:{vizWidth:o,vizHeight:i,resolution:n},...this.authHeader,responseType:"arraybuffer"});queryViewsForWorkbook=async({workbookId:e,siteId:r,includeUsageStatistics:o})=>(await this._apiClient.queryViewsForWorkbook({params:{siteId:r,workbookId:e},queries:{includeUsageStatistics:o},...this.authHeader})).views.view;queryViewsForSite=async({siteId:e,includeUsageStatistics:r,filter:o,pageSize:i,pageNumber:n})=>{let s=await this._apiClient.queryViewsForSite({params:{siteId:e},queries:{includeUsageStatistics:r,filter:o,pageSize:i,pageNumber:n},...this.authHeader});return{pagination:s.pagination,views:s.views.view??[]}}};import{isErrorFromAlias as Ki,Zodios as fc,ZodiosError as hc}from"@zodios/core";import{Err as tr,Ok as Yi}from"ts-results-es";import{makeApi as $l}from"@zodios/core";import{z as f}from"zod";var Zl=f.object({connectionLuid:f.string().optional(),connectionUsername:f.string(),connectionPassword:f.string()}),Qi=f.object({datasourceLuid:f.string().nonempty(),connections:f.array(Zl).optional()}),Jl=f.enum(["OBJECTS","ARRAYS"]),$i=f.object({returnFormat:Jl,debug:f.boolean().default(!1)}).partial().passthrough(),Kl=f.object({datasource:Qi,options:$i.optional()}).passthrough(),Kr=f.enum(["SUM","AVG","MEDIAN","COUNT","COUNTD","MIN","MAX","STDEV","VAR","COLLECT","YEAR","QUARTER","MONTH","WEEK","DAY","TRUNC_YEAR","TRUNC_QUARTER","TRUNC_MONTH","TRUNC_WEEK","TRUNC_DAY","AGG","NONE","UNSPECIFIED"]),Yl=f.object({fieldName:f.string(),fieldCaption:f.string(),dataType:f.enum(["INTEGER","REAL","STRING","DATETIME","BOOLEAN","DATE","SPATIAL","UNKNOWN"]),defaultAggregation:Kr,logicalTableId:f.string()}).partial().passthrough(),Xl=f.object({data:f.array(Yl)}).partial().passthrough(),ec=f.object({errorCode:f.string(),message:f.string(),datetime:f.string().datetime({offset:!0}),debug:f.object({}).partial().passthrough(),"tab-error-code":f.string()}).partial().passthrough(),tc=f.enum(["ASC","DESC"]),Zr=f.object({fieldCaption:f.string(),fieldAlias:f.string().optional(),maxDecimalPlaces:f.number().int().optional(),sortDirection:tc.optional(),sortPriority:f.number().int().optional()}),rc=f.union([Zr.strict(),Zr.extend({function:Kr}).strict(),Zr.extend({calculation:f.string()}).strict()]),Zi=f.union([f.object({fieldCaption:f.string()}).strict(),f.object({fieldCaption:f.string(),function:Kr}).strict(),f.object({calculation:f.string()}).strict()]),Yr=f.object({field:Zi,context:f.boolean().optional()}),Xr=f.object({field:f.object({fieldCaption:f.string()}).strict(),context:f.boolean().optional()}),oc=Xr.extend({filterType:f.literal("SET"),values:f.union([f.array(f.string()),f.array(f.number()),f.array(f.boolean())]),exclude:f.boolean().optional()}),Xe=Xr.extend({filterType:f.literal("DATE"),periodType:f.enum(["MINUTES","HOURS","DAYS","WEEKS","MONTHS","QUARTERS","YEARS"]),anchorDate:f.string().optional(),includeNulls:f.boolean().optional()}),ic=f.discriminatedUnion("dateRangeType",[Xe.extend({dateRangeType:f.literal("CURRENT")}).strict(),Xe.extend({dateRangeType:f.literal("LAST")}).strict(),Xe.extend({dateRangeType:f.literal("NEXT")}).strict(),Xe.extend({dateRangeType:f.literal("TODATE")}).strict(),Xe.extend({dateRangeType:f.literal("LASTN"),rangeN:f.number().int()}).strict(),Xe.extend({dateRangeType:f.literal("NEXTN"),rangeN:f.number().int()}).strict()]),Jr=Xr.extend({filterType:f.literal("MATCH"),startsWith:f.string().optional(),endsWith:f.string().optional(),contains:f.string().optional(),exclude:f.boolean().optional()}),sc=f.union([Jr.extend({startsWith:f.string()}).strict(),Jr.extend({endsWith:f.string()}).strict(),Jr.extend({contains:f.string()}).strict()]),Ct=Yr.extend({filterType:f.literal("QUANTITATIVE_NUMERICAL")}),nc=f.discriminatedUnion("quantitativeFilterType",[Ct.extend({quantitativeFilterType:f.literal("RANGE"),min:f.number(),max:f.number(),includeNulls:f.boolean().optional()}).strict(),Ct.extend({quantitativeFilterType:f.literal("MIN"),min:f.number(),includeNulls:f.boolean().optional()}).strict(),Ct.extend({quantitativeFilterType:f.literal("MAX"),max:f.number(),includeNulls:f.boolean().optional()}).strict(),Ct.extend({quantitativeFilterType:f.literal("ONLY_NULL")}).strict(),Ct.extend({quantitativeFilterType:f.literal("ONLY_NON_NULL")}).strict()]),_t=Yr.extend({filterType:f.literal("QUANTITATIVE_DATE")}),ac=f.discriminatedUnion("quantitativeFilterType",[_t.extend({quantitativeFilterType:f.literal("RANGE"),minDate:f.string(),maxDate:f.string(),includeNulls:f.boolean().optional()}).strict(),_t.extend({quantitativeFilterType:f.literal("MIN"),minDate:f.string(),includeNulls:f.boolean().optional()}).strict(),_t.extend({quantitativeFilterType:f.literal("MAX"),maxDate:f.string(),includeNulls:f.boolean().optional()}).strict(),_t.extend({quantitativeFilterType:f.literal("ONLY_NULL")}).strict(),_t.extend({quantitativeFilterType:f.literal("ONLY_NON_NULL")}).strict()]),lc=Yr.extend({filterType:f.literal("TOP"),howMany:f.number().int(),fieldToMeasure:Zi,direction:f.enum(["TOP","BOTTOM"]).optional().default("TOP")}),cc=f.union([oc.strict(),lc.strict(),...sc.options,...nc.options,...ac.options,...ic.options]),Rt=f.strictObject({fields:f.array(rc),filters:f.array(cc).optional()}),uc=$i.and(f.object({disaggregate:f.boolean()}).partial().passthrough()),dc=f.object({datasource:Qi,query:Rt,options:uc.optional()}).passthrough(),pc=f.object({data:f.array(f.unknown())}).partial().passthrough(),mc=$l([{method:"post",path:"/query-datasource",alias:"queryDatasource",description:"Queries a specific data source and returns the resulting data.",requestFormat:"json",parameters:[{name:"body",type:"Body",schema:dc}],response:pc,errors:[{status:"default",schema:ec},{status:404,schema:f.any()}]},{method:"post",path:"/read-metadata",alias:"readMetadata",description:"Requests metadata for a specific data source. The metadata provides information about the data fields, such as field names, data types, and descriptions.",requestFormat:"json",parameters:[{name:"body",type:"Body",schema:Kl}],response:Xl,errors:[{status:404,schema:f.any()}]},{method:"get",path:"/simple-request",alias:"simpleRequest",description:"Sends a request that can be used for testing or doing a health check.",requestFormat:"json",response:f.string()}]),Ji=[...mc];var xt=class extends z{constructor(e,r){super(new fc(e,Ji),r)}queryDatasource=async e=>{try{return Yi(await this._apiClient.queryDatasource(e,{...this.authHeader}))}catch(r){if(Ki(this._apiClient.api,"queryDatasource",r))return r.response.status===404?tr("feature-disabled"):tr(r.response.data);if(r instanceof hc)return tr(r);throw r}};readMetadata=async e=>{try{return Yi(await this._apiClient.readMetadata(e,{...this.authHeader}))}catch(r){if(Ki(this._apiClient.api,"readMetadata",r)&&r.response.status===404)return tr("feature-disabled");throw r}}};import{Zodios as wc}from"@zodios/core";import{makeApi as gc,makeEndpoint as Xi}from"@zodios/core";import{z as De}from"zod";import{z as J}from"zod";var eo=J.object({id:J.string(),name:J.string(),description:J.string().optional(),webpageUrl:J.string().optional(),contentUrl:J.string(),project:Nt.optional(),showTabs:J.coerce.boolean(),defaultViewId:J.string().optional(),tags:J.object({tag:J.array(J.object({label:J.string()})).optional()}),views:J.optional(J.object({view:J.array(At)}))});var yc=Xi({method:"get",path:"/sites/:siteId/workbooks/:workbookId",alias:"getWorkbook",description:"Returns information about the specified workbook, including information about views and tags.",response:De.object({workbook:eo})}),bc=Xi({method:"get",path:"/sites/:siteId/workbooks",alias:"queryWorkbooksForSite",description:"Returns the workbooks on a site.",parameters:[...qe,{name:"siteId",type:"Path",schema:De.string()},{name:"filter",type:"Query",schema:De.string().optional(),description:"An expression that lets you specify a subset of workbooks to return. You can filter on predefined fields such as name, tags, and createdAt. You can include multiple filter expressions."}],response:De.object({pagination:Me,workbooks:De.object({workbook:De.optional(De.array(eo))})})}),Tc=gc([bc,yc]),es=[...Tc];var vt=class extends z{constructor(e,r){super(new wc(e,es),r)}getWorkbook=async({workbookId:e,siteId:r})=>(await this._apiClient.getWorkbook({params:{siteId:r,workbookId:e},...this.authHeader})).workbook;queryWorkbooksForSite=async({siteId:e,filter:r,pageSize:o,pageNumber:i})=>{let n=await this._apiClient.queryWorkbooksForSite({params:{siteId:e},queries:{filter:r,pageSize:o,pageNumber:i},...this.authHeader});return{pagination:n.pagination,workbooks:n.workbooks.workbook??[]}}};var Lt=class t{_creds;_host;_baseUrl;_baseUrlWithoutVersion;_authenticationMethods;_authenticatedAuthenticationMethods;_contentExplorationMethods;_datasourcesMethods;_metadataMethods;_pulseMethods;_vizqlDataServiceMethods;_viewsMethods;_workbooksMethods;static _version="3.24";_requestInterceptor;_responseInterceptor;constructor(e,r){this._host=e,this._baseUrl=`${this._host}/api/${t._version}`,this._baseUrlWithoutVersion=`${this._host}/api/-`,this._requestInterceptor=r?.requestInterceptor,this._responseInterceptor=r?.responseInterceptor}get creds(){if(!this._creds)throw new Error("No credentials found. Authenticate by calling signIn() first.");return this._creds}get siteId(){return this.creds.site.id}get authenticationMethods(){return this._authenticationMethods||(this._authenticationMethods=new nt(this._baseUrl),this._addInterceptors(this._baseUrl,this._authenticationMethods.interceptors)),this._authenticationMethods}get authenticatedAuthenticationMethods(){return this._authenticatedAuthenticationMethods||(this._authenticatedAuthenticationMethods=new Ft(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._authenticatedAuthenticationMethods.interceptors)),this._authenticatedAuthenticationMethods}get contentExplorationMethods(){return this._contentExplorationMethods||(this._contentExplorationMethods=new at(this._baseUrlWithoutVersion,this.creds),this._addInterceptors(this._baseUrlWithoutVersion,this._contentExplorationMethods.interceptors)),this._contentExplorationMethods}get datasourcesMethods(){return this._datasourcesMethods||(this._datasourcesMethods=new lt(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._datasourcesMethods.interceptors)),this._datasourcesMethods}get metadataMethods(){if(!this._metadataMethods){let e=`${this._host}/api/metadata`;this._metadataMethods=new ct(e,this.creds),this._addInterceptors(e,this._metadataMethods.interceptors)}return this._metadataMethods}get pulseMethods(){return this._pulseMethods||(this._pulseMethods=new Et(this._baseUrlWithoutVersion,this.creds),this._addInterceptors(this._baseUrlWithoutVersion,this._pulseMethods.interceptors)),this._pulseMethods}get vizqlDataServiceMethods(){if(!this._vizqlDataServiceMethods){let e=`${this._host}/api/v1/vizql-data-service`;this._vizqlDataServiceMethods=new xt(e,this.creds),this._addInterceptors(e,this._vizqlDataServiceMethods.interceptors)}return this._vizqlDataServiceMethods}get viewsMethods(){return this._viewsMethods||(this._viewsMethods=new St(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._viewsMethods.interceptors)),this._viewsMethods}get workbooksMethods(){return this._workbooksMethods||(this._workbooksMethods=new vt(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._workbooksMethods.interceptors)),this._workbooksMethods}signIn=async e=>{this._creds=await this.authenticationMethods.signIn(e)};signOut=async()=>{await this.authenticatedAuthenticationMethods.signOut(),this._creds=void 0};_addInterceptors=(e,r)=>{r.request.use(o=>(this._requestInterceptor?.[0]({baseUrl:e,...Ot(o)}),o),o=>(this._requestInterceptor?.[1]?.(o,e),Promise.reject(o))),r.response.use(o=>(this._responseInterceptor?.[0]({baseUrl:e,...Pt(o)}),o),o=>(this._responseInterceptor?.[1]?.(o,e),Promise.reject(o)))}};var Ec=async(t,e,r,o)=>{let i=new Lt(t.server,{requestInterceptor:[Ac(r,e),Sc(r,e)],responseInterceptor:[Cc(r,e),_c(r,e)]});return t.auth==="pat"?await i.signIn({type:"pat",patName:t.patName,patValue:t.patValue,siteName:t.siteName}):t.auth==="direct-trust"&&await i.signIn({type:"direct-trust",siteName:t.siteName,username:Rc(t),clientId:t.connectedAppClientId,secretId:t.connectedAppSecretId,secretValue:t.connectedAppSecretValue,scopes:o,additionalPayload:xc(t)}),i},P=async({config:t,requestId:e,server:r,callback:o,jwtScopes:i})=>{let n=await Ec(t,e,r,new Set(i));try{return await o(n)}finally{await n.signOut()}},Ac=(t,e)=>r=>(r.headers["User-Agent"]=`${t.name}/${t.version}`,ts(t,r,e),r),Sc=(t,e)=>(r,o)=>{if(!Je(r)||!r.request){ie.error(t,`Request ${e} failed with error: ${he(r)}`,{logger:"rest-api",requestId:e});return}let{request:i}=r;ts(t,{baseUrl:o,...Ot(i)},e)},Cc=(t,e)=>r=>(rs(t,r,e),r),_c=(t,e)=>(r,o)=>{if(!Je(r)||!r.response){ie.error(t,`Response from request ${e} failed with error: ${he(r)}`,{logger:"rest-api",requestId:e});return}let{response:i}=r;rs(t,{baseUrl:o,...Pt(i)},e)};function ts(t,e,r){let i=R().disableLogMasking?e:Eo(e),n=new URL(i.url??"",i.baseUrl);e.params&&Object.keys(e.params).length>0&&(n.search=new URLSearchParams(e.params).toString());let s={type:"request",requestId:r,method:i.method,url:n.toString(),...Ee("debug")&&{headers:i.headers,data:i.data,params:i.params}};ie.info(t,s,{logger:"rest-api",requestId:r})}function rs(t,e,r){let i=R().disableLogMasking?e:Ao(e),n=new URL(i.url??"",i.baseUrl);e.request?.params&&Object.keys(e.request.params).length>0&&(n.search=new URLSearchParams(e.request.params).toString());let s={type:"response",requestId:r,url:n.toString(),status:i.status,...Ee("debug")&&{headers:i.headers,data:i.data}};ie.info(t,s,{logger:"rest-api",requestId:r})}function Rc(t){return t.jwtSubClaim}function xc(t){let e=t.jwtAdditionalPayload;return JSON.parse(e||"{}")}import{ZodiosError as os}from"@zodios/core";import{fromError as vc,isZodErrorLike as Lc}from"zod-validation-error";var O=class{server;name;description;paramsSchema;annotations;argsValidator;callback;constructor({server:e,name:r,description:o,paramsSchema:i,annotations:n,argsValidator:s,callback:l}){this.server=e,this.name=r,this.description=o,this.paramsSchema=i,this.annotations=n,this.argsValidator=s,this.callback=l}logInvocation({requestId:e,args:r}){ie.debug(this.server,bo({requestId:e,toolName:this.name,args:r}))}async logAndExecute({requestId:e,args:r,callback:o,getSuccessResult:i,getErrorText:n}){if(this.logInvocation({requestId:e,args:r}),r)try{this.argsValidator?.(r)}catch(s){return rr(e,s)}try{let s=await o();return s.isOk()?i?i(s.value):{isError:!1,content:[{type:"text",text:JSON.stringify(s.value)}]}:s.error instanceof os?rr(e,s.error):n?{isError:!0,content:[{type:"text",text:n(s.error)}]}:rr(e,s.error)}catch(s){return rr(e,s)}}};function rr(t,e){if(e instanceof os&&Lc(e.cause)){let r=vc(e.cause);return{isError:!1,content:[{type:"text",text:JSON.stringify({data:e.data,warning:r.toString()})}]}}return{isError:!0,content:[{type:"text",text:`requestId: ${t}, error: ${he(e)}`}]}}function is(t){let e=new Set;return t.flatMap(r=>e.has(r.method)?[]:(e.add(r.method),r.method+(r.sortDirection?`:${r.sortDirection}`:""))).join(",")}function ss(t){let e=[];if(t.contentTypes)if(t.contentTypes.length===1)e.push(`type:eq:${t.contentTypes[0]}`);else{let r=new Set;for(let o of t.contentTypes)r.add(o);e.push(`type:in:[${Array.from(r).join(",")}]`)}if(t.ownerIds)if(t.ownerIds.length===1)e.push(`ownerId:eq:${t.ownerIds[0]}`);else{let r=new Set;for(let o of t.ownerIds)r.add(o);e.push(`ownerId:in:[${Array.from(r).join(",")}]`)}if(t.modifiedTime)if(Array.isArray(t.modifiedTime))if(t.modifiedTime.length===1)e.push(`modifiedTime:eq:${t.modifiedTime[0]}`);else{let r=new Set;for(let o of t.modifiedTime)r.add(o);e.push(`modifiedTime:in:[${Array.from(r).join(",")}]`)}else if(t.modifiedTime.startDate&&t.modifiedTime.endDate){let r=t.modifiedTime.startDate,o=t.modifiedTime.endDate;r>o&&(r=t.modifiedTime.endDate,o=t.modifiedTime.startDate),e.push(`modifiedTime:gte:${r}`),e.push(`modifiedTime:lte:${o}`)}else t.modifiedTime.startDate?e.push(`modifiedTime:gte:${t.modifiedTime.startDate}`):t.modifiedTime.endDate&&e.push(`modifiedTime:lte:${t.modifiedTime.endDate}`);return e.join(",")}function ns(t){let e=[];if(t.items)for(let r of t.items)e.push(Dc(r.content));return e}function Dc(t){let e={};return t.modifiedTime&&(e.modifiedTime=t.modifiedTime),t.sheetType&&(e.sheetType=t.sheetType),t.caption&&(e.caption=t.caption),t.workbookDescription&&(e.workbookDescription=t.workbookDescription),t.type&&(e.type=t.type),t.ownerId&&(e.ownerId=t.ownerId),t.title&&(e.title=t.title),t.ownerName&&(e.ownerName=t.ownerName),t.containerName&&(t.type==="view"?e.parentWorkbookName=t.containerName:e.containerName=t.containerName),t.luid&&(e.luid=t.luid),t.locationName&&(e.locationName=t.locationName),t.comments?.length&&(e.comments=t.comments),t.hitsTotal!=null&&(e.totalViewCount=t.hitsTotal),t.favoritesTotal!=null&&(e.favoritesTotal=t.favoritesTotal),t.tags?.length&&(e.tags=t.tags),t.projectName&&(e.projectName=t.projectName),t.hitsSmallSpanTotal!=null&&(e.viewCountLastMonth=t.hitsSmallSpanTotal),t.downstreamWorkbookCount!=null&&(e.downstreamWorkbookCount=t.downstreamWorkbookCount),t.isConnectable!=null&&(e.isConnectable=t.isConnectable),t.datasourceIsPublished!=null&&(e.datasourceIsPublished=t.datasourceIsPublished),t.connectionType&&(e.connectionType=t.connectionType),t.isCertified!=null&&(e.isCertified=t.isCertified),t.hasExtracts!=null&&(e.hasExtracts=t.hasExtracts),t.extractRefreshedAt&&(e.extractRefreshedAt=t.extractRefreshedAt),t.extractUpdatedAt&&(e.extractUpdatedAt=t.extractUpdatedAt),t.connectedWorkbooksCount!=null&&(e.connectedWorkbooksCount=t.connectedWorkbooksCount),t.extractCreationPending!=null&&(e.extractCreationPending=t.extractCreationPending),t.hasSevereDataQualityWarning!=null&&(e.hasSevereDataQualityWarning=t.hasSevereDataQualityWarning),t.datasourceLuid&&(e.datasourceLuid=t.datasourceLuid),t.hasActiveDataQualityWarning!=null&&(e.hasActiveDataQualityWarning=t.hasActiveDataQualityWarning),e}var Oc={terms:as.string().trim().nonempty().optional(),limit:as.number().int().min(1).max(2e3).default(100).optional(),orderBy:vo.optional(),filter:Io.optional()},ls=t=>{let e=new O({server:t,name:"search-content",description:"\nThis tool searches across all supported content types for objects relevant to the search expression specified by search terms and filters.\n\n**Parameters:**\n\n- `terms` (optional): A string containing one or more search terms that the search uses as the basis for determining which items are relevant to return. If the terms parameter is not provided, it searches for everything bound by the specified filters.\n\n- `filter` (optional): Allows you to limit search results based on:\n - `contentTypes`: Filter by content types. Supported types are: 'lens', 'datasource', 'virtualconnection', 'collection', 'project', 'flow', 'datarole', 'table', 'database', 'view', 'workbook'\n - `ownerIds`: Filter by specific owner IDs (array of integers)\n - `modifiedTime`: Filter by last modified times using ISO 8601 date-time strings. Can be either a range (with startDate/endDate) or an array of specific date-times to include\n\n- `limit` (optional): The number of items to return in the search response (default: 100, max: 2000)\n\n- `orderBy` (optional): Determines the sorting method for returned items. Available sorting methods:\n - `hitsTotal`: Number of times a content item has been viewed since it was created\n - `hitsSmallSpanTotal`: Number of times a content item was viewed in the last month\n - `hitsMediumSpanTotal`: Number of times a content item was viewed in the last 3 months\n - `hitsLargeSpanTotal`: Number of times a content item was viewed in the last year\n - `downstreamWorkbookCount`: Number of workbooks in a given project. This value is only available when the content type filter includes 'database' or 'table'\n \n For each sort method, you can specify a sort direction: 'asc' for ascending or 'desc' for descending (default: 'asc'). The orderBy parameter is an array of objects containing the sorting method and direction. The first element determines primary sorting, with subsequent elements used as tiebreakers.\n\n**Important Notes:**\n- If `orderBy` is omitted, the search will sort items by their \"relevance score\" in descending order, which is Tableau's internal algorithm for providing the most relevant results",paramsSchema:Oc,annotations:{title:"Search Content",readOnlyHint:!0,openWorldHint:!1},callback:async({terms:r,limit:o,orderBy:i,filter:n},{requestId:s})=>{let l=R(),u=i?is(i):void 0,p=n?ss(n):void 0;return await e.logAndExecute({requestId:s,args:{},callback:async()=>new Ic(await P({config:l,requestId:s,server:t,jwtScopes:["tableau:content:read"],callback:async c=>{let h=await c.contentExplorationMethods.searchContent({terms:r,page:0,limit:l.maxResultLimit?Math.min(l.maxResultLimit,o??100):o??100,orderBy:u,filter:p});return ns(h)}}))})}});return e};import{Err as Fc,Ok as ro}from"ts-results-es";import{z as Nc}from"zod";function or(){return["The VizQL Data Service is disabled on this Tableau Server.","To enable it, use TSM using the instructions at https://help.tableau.com/current/server-linux/en-us/cli_configuration-set_tsm.htm#featuresvizqldataservicedeploywithtsm."].join(" ")}function ir({datasourceLuid:t}){if(!t)throw new Error("datasourceLuid must be a non-empty string.")}import{z as v}from"zod";var Pc=v.object({name:v.string(),dataType:v.string().or(v.null()),defaultAggregation:v.string().or(v.null()),description:v.string().or(v.null()),descriptionInherited:v.array(v.object({attribute:v.string(),value:v.string().or(v.null())}).or(v.null())).or(v.null()),dataCategory:v.string().or(v.null()),role:v.string().or(v.null()),defaultFormat:v.string().or(v.null()),semanticRole:v.string().or(v.null()),aggregation:v.string().or(v.null()),aggregationParam:v.string().or(v.null()),formula:v.string().or(v.null()),isAutoGenerated:v.boolean().or(v.null()),hasUserReference:v.boolean().or(v.null()),binSize:v.number().or(v.null())}).partial(),cb=v.object({fields:v.array(Pc)});function to(t){let e={fields:[]};if(!t.data)return e;for(let r of t.data){let o={name:r.fieldCaption,dataType:r.dataType};r.defaultAggregation&&(o.defaultAggregation=r.defaultAggregation),e.fields.push(o)}return e}function us(t,e){let r={fields:[]};if(!t.data){if(e.data.publishedDatasources[0]?.fields.length)for(let o of e.data.publishedDatasources[0].fields){let i={name:o.name};o.dataType&&(i.dataType=o.dataType),o.aggregation&&(i.defaultAggregation=o.aggregation),cs(o,i),r.fields.push(i)}return r}for(let o of t.data){let i={name:o.fieldCaption,dataType:o.dataType};o.defaultAggregation&&(i.defaultAggregation=o.defaultAggregation),r.fields.push(i)}if(!e.data.publishedDatasources[0]?.fields.length)return r;for(let o of r.fields){let i=e.data.publishedDatasources[0].fields.find(n=>n.name===o.name);i&&cs(i,o)}return r}function cs(t,e){t.description&&(e.description=t.description),t.descriptionInherited?.length&&(e.descriptionInherited=t.descriptionInherited),t.dataCategory&&(e.dataCategory=t.dataCategory),t.role&&(e.role=t.role),t.defaultFormat&&(e.defaultFormat=t.defaultFormat),t.formula&&(e.formula=t.formula,t.isAutoGenerated!=null&&(e.isAutoGenerated=t.isAutoGenerated),t.hasUserReference!=null&&(e.hasUserReference=t.hasUserReference)),t.binSize!=null&&(e.binSize=t.binSize)}var kc=t=>`
|
|
17
|
+
- 'DEFINITION_VIEW_DEFAULT' - Return the metric definition and the default metric.`}],response:k.object({definitions:k.array(Jr)})}),$l=Ye({method:"get",path:"/pulse/definitions/:pulseMetricDefinitionID/metrics",alias:"listPulseMetricsFromMetricDefinitionId",description:"Returns a list of published Pulse Metrics for a specific Pulse Metric Definition.",parameters:[{name:"pulseMetricDefinitionID",type:"Path",schema:k.string().nonempty()}],response:k.object({metrics:k.array(Yt),total_available:k.number()})}),Zl=Ye({method:"post",path:"/pulse/metrics%3AbatchGet",alias:"listPulseMetricsFromMetricIds",description:"Returns a list of Pulse Metrics for a list of metric IDs.",parameters:[{name:"metric_ids",type:"Body",schema:k.object({metric_ids:k.array(k.string().nonempty())})}],response:k.object({metrics:k.array(Yt)})}),Jl=Ye({method:"get",path:"/pulse/subscriptions",alias:"listPulseMetricSubscriptionsForCurrentUser",description:"Returns a list of Pulse Subscriptions for the current user.",parameters:[{name:"user_id",type:"Query",schema:k.string().nonempty()}],response:k.object({subscriptions:k.array(Go)})}),Kl=Ye({method:"post",path:"/pulse/insights/:bundle_type",alias:"generatePulseMetricValueInsightBundle",description:"Generates a bundle for the current aggregated value for the Pulse metric.",parameters:[{name:"bundle_request",type:"Body",schema:Xt},{name:"bundle_type",type:"Path",schema:k.enum(er)}],response:Qo}),Yl=Hl([Kl,Gl,Ql,$l,Jl,Zl]),$o=[...Yl];var Et=class extends W{constructor(e,r){super(new Xl(e,$o),r)}listAllPulseMetricDefinitions=async e=>await Xe(async()=>(await this._apiClient.listAllPulseMetricDefinitions({queries:{view:e},...this.authHeader})).definitions??[]);listPulseMetricDefinitionsFromMetricDefinitionIds=async(e,r)=>await Xe(async()=>(await this._apiClient.listPulseMetricDefinitionsFromMetricDefinitionIds({definition_ids:e},{queries:{view:r},...this.authHeader})).definitions??[]);listPulseMetricsFromMetricDefinitionId=async e=>await Xe(async()=>(await this._apiClient.listPulseMetricsFromMetricDefinitionId({params:{pulseMetricDefinitionID:e},...this.authHeader})).metrics??[]);listPulseMetricsFromMetricIds=async e=>await Xe(async()=>(await this._apiClient.listPulseMetricsFromMetricIds({metric_ids:e},{...this.authHeader})).metrics??[]);listPulseMetricSubscriptionsForCurrentUser=async()=>await Xe(async()=>(await this._apiClient.listPulseMetricSubscriptionsForCurrentUser({queries:{user_id:this.userId},...this.authHeader})).subscriptions??[]);generatePulseMetricValueInsightBundle=async(e,r)=>await Xe(async()=>await this._apiClient.generatePulseMetricValueInsightBundle({bundle_request:e.bundle_request},{params:{bundle_type:r},...this.authHeader})??{})};async function Xe(t){try{return new ec(await t())}catch(e){if(Ke(e)){if(e.response?.status===404)return new Zo("tableau-server");if(e.response?.status===400&&e.response.headers.tableau_error_code==="0xd3408984"&&e.response.headers.validation_code==="400999")return new Zo("pulse-disabled")}throw e}}import{Zodios as ac}from"@zodios/core";import{makeApi as tc,makeEndpoint as tr}from"@zodios/core";import{z as K}from"zod";import{z as H}from"zod";var At=H.object({id:H.string(),name:H.string(),createdAt:H.string(),updatedAt:H.string(),workbook:H.object({id:H.string()}).optional(),owner:H.object({id:H.string()}).optional(),project:H.object({id:H.string()}).optional(),tags:H.object({tag:H.array(H.object({label:H.string()})).optional()}),usage:H.object({totalViewCount:H.coerce.number()}).optional()});var rc=tr({method:"get",path:"/sites/:siteId/views/:viewId/data",alias:"queryViewData",description:"Returns a specified view rendered as data in comma separated value (CSV) format.",response:K.string()}),ic=tr({method:"get",path:"/sites/:siteId/views/:viewId/image",alias:"queryViewImage",description:"Returns an image of the specified view.",parameters:[{name:"vizWidth",type:"Query",schema:K.number().optional(),description:"The width of the rendered image in pixels that, along with the value of vizHeight determine its resolution and aspect ratio."},{name:"vizHeight",type:"Query",schema:K.number().optional(),description:"The height of the rendered image in pixels that, along with the value of vizWidth determine its resolution and aspect ratio."},{name:"resolution",type:"Query",schema:K.literal("high").optional(),description:"The resolution of the image. Image width and actual pixel density are determined by the display context of the image. Aspect ratio is always preserved. Set the value to high to ensure maximum pixel density."}],response:K.string()}),oc=tr({method:"get",path:"/sites/:siteId/workbooks/:workbookId/views",alias:"queryViewsForWorkbook",description:"Returns all the views for the specified workbook, optionally including usage statistics.",parameters:[{name:"includeUsageStatistics",type:"Query",schema:K.boolean().optional(),description:"true to return usage statistics. The default is false."}],response:K.object({views:K.object({view:K.array(At)})})}),sc=tr({method:"get",path:"/sites/:siteId/views",alias:"queryViewsForSite",description:"Returns all the views for the specified site, optionally including usage statistics.",parameters:[...Ue,{name:"includeUsageStatistics",type:"Query",schema:K.boolean().optional(),description:"true to return usage statistics. The default is false."},{name:"filter",type:"Query",schema:K.string().optional(),description:"An expression that lets you specify a subset of views to return. You can filter on predefined fields such as name, tags, and createdAt. You can include multiple filter expressions."}],response:K.object({pagination:qe,views:K.object({view:K.array(At).optional()})})}),nc=tc([rc,ic,oc,sc]),Jo=[...nc];var St=class extends W{constructor(e,r){super(new ac(e,Jo),r)}queryViewData=async({viewId:e,siteId:r})=>await this._apiClient.queryViewData({params:{siteId:r,viewId:e},...this.authHeader});queryViewImage=async({viewId:e,siteId:r,width:i,height:o,resolution:n})=>await this._apiClient.queryViewImage({params:{siteId:r,viewId:e},queries:{vizWidth:i,vizHeight:o,resolution:n},...this.authHeader,responseType:"arraybuffer"});queryViewsForWorkbook=async({workbookId:e,siteId:r,includeUsageStatistics:i})=>(await this._apiClient.queryViewsForWorkbook({params:{siteId:r,workbookId:e},queries:{includeUsageStatistics:i},...this.authHeader})).views.view;queryViewsForSite=async({siteId:e,includeUsageStatistics:r,filter:i,pageSize:o,pageNumber:n})=>{let s=await this._apiClient.queryViewsForSite({params:{siteId:e},queries:{includeUsageStatistics:r,filter:i,pageSize:o,pageNumber:n},...this.authHeader});return{pagination:s.pagination,views:s.views.view??[]}}};import{isErrorFromAlias as os,Zodios as Lc,ZodiosError as Dc}from"@zodios/core";import{Err as ir,Ok as ss}from"ts-results-es";import{makeApi as lc}from"@zodios/core";import{z as d}from"zod";var cc=d.object({connectionLuid:d.string().optional(),connectionUsername:d.string(),connectionPassword:d.string()}),Ko=d.object({datasourceLuid:d.string().nonempty(),connections:d.array(cc).optional()}),uc=d.enum(["OBJECTS","ARRAYS"]),Yo=d.object({returnFormat:uc,debug:d.boolean().default(!1)}).partial().passthrough(),dc=d.object({datasource:Ko,options:Yo.optional()}).passthrough(),Xr=d.enum(["SUM","AVG","MEDIAN","COUNT","COUNTD","MIN","MAX","STDEV","VAR","COLLECT","YEAR","QUARTER","MONTH","WEEK","DAY","TRUNC_YEAR","TRUNC_QUARTER","TRUNC_MONTH","TRUNC_WEEK","TRUNC_DAY","AGG","NONE","UNSPECIFIED"]),Xo=d.enum(["INTEGER","REAL","STRING","DATETIME","BOOLEAN","DATE","SPATIAL","UNKNOWN"]),es=d.enum(["MINUTES","HOURS","DAYS","WEEKS","MONTHS","QUARTERS","YEARS"]),pc=d.object({fieldName:d.string(),fieldCaption:d.string(),dataType:Xo,defaultAggregation:Xr,columnClass:d.enum(["COLUMN","BIN","GROUP","CALCULATION","TABLE_CALCULATION"]),formula:d.string(),logicalTableId:d.string()}).partial().passthrough(),ts=d.union([d.number(),d.string(),d.boolean(),d.null()]),rr=d.object({parameterCaption:d.string(),dataType:Xo.exclude(["DATETIME","SPATIAL","UNKNOWN"]),parameterName:d.string().optional(),value:ts}),mc=d.discriminatedUnion("parameterType",[rr.extend({parameterType:d.literal("ANY_VALUE")}).strict(),rr.extend({parameterType:d.literal("LIST"),members:d.array(ts)}).strict(),rr.extend({parameterType:d.literal("QUANTITATIVE_DATE"),value:d.string().nullable(),minDate:d.string().nullish(),maxDate:d.string().nullish(),periodValue:d.number().nullish(),periodType:es.nullish()}).strict(),rr.extend({parameterType:d.literal("QUANTITATIVE_RANGE"),value:d.number().nullable(),min:d.number().nullish(),max:d.number().nullish(),step:d.number().nullish()}).strict()]),fc=d.object({data:d.array(pc),extraData:d.object({parameters:d.array(mc)})}).partial().passthrough(),hc=d.object({errorCode:d.string(),message:d.string(),datetime:d.string().datetime({offset:!0}),debug:d.object({}).partial().passthrough(),"tab-error-code":d.string()}).partial().passthrough(),gc=d.enum(["ASC","DESC"]),Kr=d.object({fieldCaption:d.string(),fieldAlias:d.string().optional(),maxDecimalPlaces:d.number().int().optional(),sortDirection:gc.optional(),sortPriority:d.number().int().optional()}),yc=d.union([Kr.strict(),Kr.extend({function:Xr}).strict(),Kr.extend({calculation:d.string()}).strict()]),rs=d.union([d.object({fieldCaption:d.string()}).strict(),d.object({fieldCaption:d.string(),function:Xr}).strict(),d.object({calculation:d.string()}).strict()]),ei=d.object({field:rs,context:d.boolean().optional()}),ti=d.object({field:d.object({fieldCaption:d.string()}).strict(),context:d.boolean().optional()}),bc=ti.extend({filterType:d.literal("SET"),values:d.union([d.array(d.string()),d.array(d.number()),d.array(d.boolean())]),exclude:d.boolean().optional()}),et=ti.extend({filterType:d.literal("DATE"),periodType:es,anchorDate:d.string().optional(),includeNulls:d.boolean().optional()}),Tc=d.discriminatedUnion("dateRangeType",[et.extend({dateRangeType:d.literal("CURRENT")}).strict(),et.extend({dateRangeType:d.literal("LAST")}).strict(),et.extend({dateRangeType:d.literal("NEXT")}).strict(),et.extend({dateRangeType:d.literal("TODATE")}).strict(),et.extend({dateRangeType:d.literal("LASTN"),rangeN:d.number().int()}).strict(),et.extend({dateRangeType:d.literal("NEXTN"),rangeN:d.number().int()}).strict()]),Yr=ti.extend({filterType:d.literal("MATCH"),startsWith:d.string().optional(),endsWith:d.string().optional(),contains:d.string().optional(),exclude:d.boolean().optional()}),wc=d.union([Yr.extend({startsWith:d.string()}).strict(),Yr.extend({endsWith:d.string()}).strict(),Yr.extend({contains:d.string()}).strict()]),_t=ei.extend({filterType:d.literal("QUANTITATIVE_NUMERICAL")}),Ec=d.discriminatedUnion("quantitativeFilterType",[_t.extend({quantitativeFilterType:d.literal("RANGE"),min:d.number(),max:d.number(),includeNulls:d.boolean().optional()}).strict(),_t.extend({quantitativeFilterType:d.literal("MIN"),min:d.number(),includeNulls:d.boolean().optional()}).strict(),_t.extend({quantitativeFilterType:d.literal("MAX"),max:d.number(),includeNulls:d.boolean().optional()}).strict(),_t.extend({quantitativeFilterType:d.literal("ONLY_NULL")}).strict(),_t.extend({quantitativeFilterType:d.literal("ONLY_NON_NULL")}).strict()]),Ct=ei.extend({filterType:d.literal("QUANTITATIVE_DATE")}),Ac=d.discriminatedUnion("quantitativeFilterType",[Ct.extend({quantitativeFilterType:d.literal("RANGE"),minDate:d.string(),maxDate:d.string(),includeNulls:d.boolean().optional()}).strict(),Ct.extend({quantitativeFilterType:d.literal("MIN"),minDate:d.string(),includeNulls:d.boolean().optional()}).strict(),Ct.extend({quantitativeFilterType:d.literal("MAX"),maxDate:d.string(),includeNulls:d.boolean().optional()}).strict(),Ct.extend({quantitativeFilterType:d.literal("ONLY_NULL")}).strict(),Ct.extend({quantitativeFilterType:d.literal("ONLY_NON_NULL")}).strict()]),Sc=ei.extend({filterType:d.literal("TOP"),howMany:d.number().int(),fieldToMeasure:rs,direction:d.enum(["TOP","BOTTOM"]).optional().default("TOP")}),_c=d.union([bc.strict(),Sc.strict(),...wc.options,...Ec.options,...Ac.options,...Tc.options]),Rt=d.strictObject({fields:d.array(yc),filters:d.array(_c).optional()}),Cc=Yo.and(d.object({disaggregate:d.boolean()}).partial().passthrough()),Rc=d.object({datasource:Ko,query:Rt,options:Cc.optional()}).passthrough(),xc=d.object({data:d.array(d.unknown())}).partial().passthrough(),vc=lc([{method:"post",path:"/query-datasource",alias:"queryDatasource",description:"Queries a specific data source and returns the resulting data.",requestFormat:"json",parameters:[{name:"body",type:"Body",schema:Rc}],response:xc,errors:[{status:"default",schema:hc},{status:404,schema:d.any()}]},{method:"post",path:"/read-metadata",alias:"readMetadata",description:"Requests metadata for a specific data source. The metadata provides information about the data fields, such as field names, data types, and descriptions.",requestFormat:"json",parameters:[{name:"body",type:"Body",schema:dc}],response:fc,errors:[{status:404,schema:d.any()}]},{method:"get",path:"/simple-request",alias:"simpleRequest",description:"Sends a request that can be used for testing or doing a health check.",requestFormat:"json",response:d.string()}]),is=[...vc];var xt=class extends W{constructor(e,r){super(new Lc(e,is),r)}queryDatasource=async e=>{try{return ss(await this._apiClient.queryDatasource(e,{...this.authHeader}))}catch(r){if(os(this._apiClient.api,"queryDatasource",r))return r.response.status===404?ir("feature-disabled"):ir(r.response.data);if(r instanceof Dc)return ir(r);throw r}};readMetadata=async e=>{try{return ss(await this._apiClient.readMetadata(e,{...this.authHeader}))}catch(r){if(os(this._apiClient.api,"readMetadata",r)&&r.response.status===404)return ir("feature-disabled");throw r}}};import{Zodios as Fc}from"@zodios/core";import{makeApi as Ic,makeEndpoint as ns}from"@zodios/core";import{z as Oe}from"zod";import{z as Z}from"zod";var ri=Z.object({id:Z.string(),name:Z.string(),description:Z.string().optional(),webpageUrl:Z.string().optional(),contentUrl:Z.string(),project:kt.optional(),showTabs:Z.coerce.boolean(),defaultViewId:Z.string().optional(),tags:Z.object({tag:Z.array(Z.object({label:Z.string()})).optional()}),views:Z.optional(Z.object({view:Z.array(At)}))});var Oc=ns({method:"get",path:"/sites/:siteId/workbooks/:workbookId",alias:"getWorkbook",description:"Returns information about the specified workbook, including information about views and tags.",response:Oe.object({workbook:ri})}),Pc=ns({method:"get",path:"/sites/:siteId/workbooks",alias:"queryWorkbooksForSite",description:"Returns the workbooks on a site.",parameters:[...Ue,{name:"siteId",type:"Path",schema:Oe.string()},{name:"filter",type:"Query",schema:Oe.string().optional(),description:"An expression that lets you specify a subset of workbooks to return. You can filter on predefined fields such as name, tags, and createdAt. You can include multiple filter expressions."}],response:Oe.object({pagination:qe,workbooks:Oe.object({workbook:Oe.optional(Oe.array(ri))})})}),Nc=Ic([Pc,Oc]),as=[...Nc];var vt=class extends W{constructor(e,r){super(new Fc(e,as),r)}getWorkbook=async({workbookId:e,siteId:r})=>(await this._apiClient.getWorkbook({params:{siteId:r,workbookId:e},...this.authHeader})).workbook;queryWorkbooksForSite=async({siteId:e,filter:r,pageSize:i,pageNumber:o})=>{let n=await this._apiClient.queryWorkbooksForSite({params:{siteId:e},queries:{filter:r,pageSize:i,pageNumber:o},...this.authHeader});return{pagination:n.pagination,workbooks:n.workbooks.workbook??[]}}};var Lt=class t{_creds;_host;_baseUrl;_baseUrlWithoutVersion;_authenticationMethods;_authenticatedAuthenticationMethods;_contentExplorationMethods;_datasourcesMethods;_metadataMethods;_pulseMethods;_vizqlDataServiceMethods;_viewsMethods;_workbooksMethods;static _version="3.24";_requestInterceptor;_responseInterceptor;constructor(e,r){this._host=e,this._baseUrl=`${this._host}/api/${t._version}`,this._baseUrlWithoutVersion=`${this._host}/api/-`,this._requestInterceptor=r?.requestInterceptor,this._responseInterceptor=r?.responseInterceptor}get creds(){if(!this._creds)throw new Error("No credentials found. Authenticate by calling signIn() first.");return this._creds}get siteId(){return this.creds.site.id}get authenticationMethods(){return this._authenticationMethods||(this._authenticationMethods=new nt(this._baseUrl),this._addInterceptors(this._baseUrl,this._authenticationMethods.interceptors)),this._authenticationMethods}get authenticatedAuthenticationMethods(){return this._authenticatedAuthenticationMethods||(this._authenticatedAuthenticationMethods=new Ft(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._authenticatedAuthenticationMethods.interceptors)),this._authenticatedAuthenticationMethods}get contentExplorationMethods(){return this._contentExplorationMethods||(this._contentExplorationMethods=new at(this._baseUrlWithoutVersion,this.creds),this._addInterceptors(this._baseUrlWithoutVersion,this._contentExplorationMethods.interceptors)),this._contentExplorationMethods}get datasourcesMethods(){return this._datasourcesMethods||(this._datasourcesMethods=new lt(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._datasourcesMethods.interceptors)),this._datasourcesMethods}get metadataMethods(){if(!this._metadataMethods){let e=`${this._host}/api/metadata`;this._metadataMethods=new ct(e,this.creds),this._addInterceptors(e,this._metadataMethods.interceptors)}return this._metadataMethods}get pulseMethods(){return this._pulseMethods||(this._pulseMethods=new Et(this._baseUrlWithoutVersion,this.creds),this._addInterceptors(this._baseUrlWithoutVersion,this._pulseMethods.interceptors)),this._pulseMethods}get vizqlDataServiceMethods(){if(!this._vizqlDataServiceMethods){let e=`${this._host}/api/v1/vizql-data-service`;this._vizqlDataServiceMethods=new xt(e,this.creds),this._addInterceptors(e,this._vizqlDataServiceMethods.interceptors)}return this._vizqlDataServiceMethods}get viewsMethods(){return this._viewsMethods||(this._viewsMethods=new St(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._viewsMethods.interceptors)),this._viewsMethods}get workbooksMethods(){return this._workbooksMethods||(this._workbooksMethods=new vt(this._baseUrl,this.creds),this._addInterceptors(this._baseUrl,this._workbooksMethods.interceptors)),this._workbooksMethods}signIn=async e=>{this._creds=await this.authenticationMethods.signIn(e)};signOut=async()=>{await this.authenticatedAuthenticationMethods.signOut(),this._creds=void 0};_addInterceptors=(e,r)=>{r.request.use(i=>(this._requestInterceptor?.[0]({baseUrl:e,...Pt(i)}),i),i=>(this._requestInterceptor?.[1]?.(i,e),Promise.reject(i))),r.response.use(i=>(this._responseInterceptor?.[0]({baseUrl:e,...Nt(i)}),i),i=>(this._responseInterceptor?.[1]?.(i,e),Promise.reject(i)))}};var kc=async(t,e,r,i)=>{let o=new Lt(t.server,{requestInterceptor:[Mc(r,e),qc(r,e)],responseInterceptor:[Uc(r,e),jc(r,e)]});return t.auth==="pat"?await o.signIn({type:"pat",patName:t.patName,patValue:t.patValue,siteName:t.siteName}):t.auth==="direct-trust"&&await o.signIn({type:"direct-trust",siteName:t.siteName,username:Bc(t),clientId:t.connectedAppClientId,secretId:t.connectedAppSecretId,secretValue:t.connectedAppSecretValue,scopes:i,additionalPayload:Vc(t)}),o},P=async({config:t,requestId:e,server:r,callback:i,jwtScopes:o})=>{let n=await kc(t,e,r,new Set(o));try{return await i(n)}finally{await n.signOut()}},Mc=(t,e)=>r=>(r.headers["User-Agent"]=`${t.name}/${t.version}`,ls(t,r,e),r),qc=(t,e)=>(r,i)=>{if(!Ke(r)||!r.request){oe.error(t,`Request ${e} failed with error: ${ae(r)}`,{logger:"rest-api",requestId:e});return}let{request:o}=r;ls(t,{baseUrl:i,...Pt(o)},e)},Uc=(t,e)=>r=>(cs(t,r,e),r),jc=(t,e)=>(r,i)=>{if(!Ke(r)||!r.response){oe.error(t,`Response from request ${e} failed with error: ${ae(r)}`,{logger:"rest-api",requestId:e});return}let{response:o}=r;cs(t,{baseUrl:i,...Nt(o)},e)};function ls(t,e,r){let o=R().disableLogMasking?e:_i(e),n=new URL(o.url??"",o.baseUrl);e.params&&Object.keys(e.params).length>0&&(n.search=new URLSearchParams(e.params).toString());let s={type:"request",requestId:r,method:o.method,url:n.toString(),...Ae("debug")&&{headers:o.headers,data:o.data,params:o.params}};oe.info(t,s,{logger:"rest-api",requestId:r})}function cs(t,e,r){let o=R().disableLogMasking?e:Ci(e),n=new URL(o.url??"",o.baseUrl);e.request?.params&&Object.keys(e.request.params).length>0&&(n.search=new URLSearchParams(e.request.params).toString());let s={type:"response",requestId:r,url:n.toString(),status:o.status,...Ae("debug")&&{headers:o.headers,data:o.data}};oe.info(t,s,{logger:"rest-api",requestId:r})}function Bc(t){return t.jwtSubClaim}function Vc(t){let e=t.jwtAdditionalPayload;return JSON.parse(e||"{}")}import{ZodiosError as us}from"@zodios/core";import{fromError as zc,isZodErrorLike as Wc}from"zod-validation-error";var O=class{server;name;description;paramsSchema;annotations;argsValidator;callback;constructor({server:e,name:r,description:i,paramsSchema:o,annotations:n,argsValidator:s,callback:l}){this.server=e,this.name=r,this.description=i,this.paramsSchema=o,this.annotations=n,this.argsValidator=s,this.callback=l}logInvocation({requestId:e,args:r}){oe.debug(this.server,Ei({requestId:e,toolName:this.name,args:r}))}async logAndExecute({requestId:e,args:r,callback:i,getSuccessResult:o,getErrorText:n}){if(this.logInvocation({requestId:e,args:r}),r)try{this.argsValidator?.(r)}catch(s){return or(e,s)}try{let s=await i();return s.isOk()?o?o(s.value):{isError:!1,content:[{type:"text",text:JSON.stringify(s.value)}]}:s.error instanceof us?or(e,s.error):n?{isError:!0,content:[{type:"text",text:n(s.error)}]}:or(e,s.error)}catch(s){return or(e,s)}}};function or(t,e){if(e instanceof us&&Wc(e.cause)){let r=zc(e.cause);return{isError:!1,content:[{type:"text",text:JSON.stringify({data:e.data,warning:r.toString()})}]}}return{isError:!0,content:[{type:"text",text:`requestId: ${t}, error: ${ae(e)}`}]}}function ds(t){let e=new Set;return t.flatMap(r=>e.has(r.method)?[]:(e.add(r.method),r.method+(r.sortDirection?`:${r.sortDirection}`:""))).join(",")}function ps(t){let e=[];if(t.contentTypes)if(t.contentTypes.length===1)e.push(`type:eq:${t.contentTypes[0]}`);else{let r=new Set;for(let i of t.contentTypes)r.add(i);e.push(`type:in:[${Array.from(r).join(",")}]`)}if(t.ownerIds)if(t.ownerIds.length===1)e.push(`ownerId:eq:${t.ownerIds[0]}`);else{let r=new Set;for(let i of t.ownerIds)r.add(i);e.push(`ownerId:in:[${Array.from(r).join(",")}]`)}if(t.modifiedTime)if(Array.isArray(t.modifiedTime))if(t.modifiedTime.length===1)e.push(`modifiedTime:eq:${t.modifiedTime[0]}`);else{let r=new Set;for(let i of t.modifiedTime)r.add(i);e.push(`modifiedTime:in:[${Array.from(r).join(",")}]`)}else if(t.modifiedTime.startDate&&t.modifiedTime.endDate){let r=t.modifiedTime.startDate,i=t.modifiedTime.endDate;r>i&&(r=t.modifiedTime.endDate,i=t.modifiedTime.startDate),e.push(`modifiedTime:gte:${r}`),e.push(`modifiedTime:lte:${i}`)}else t.modifiedTime.startDate?e.push(`modifiedTime:gte:${t.modifiedTime.startDate}`):t.modifiedTime.endDate&&e.push(`modifiedTime:lte:${t.modifiedTime.endDate}`);return e.join(",")}function ms(t){let e=[];if(t.items)for(let r of t.items)e.push(Hc(r.content));return e}function Hc(t){let e={};return t.modifiedTime&&(e.modifiedTime=t.modifiedTime),t.sheetType&&(e.sheetType=t.sheetType),t.caption&&(e.caption=t.caption),t.workbookDescription&&(e.workbookDescription=t.workbookDescription),t.type&&(e.type=t.type),t.ownerId&&(e.ownerId=t.ownerId),t.title&&(e.title=t.title),t.ownerName&&(e.ownerName=t.ownerName),t.containerName&&(t.type==="view"?e.parentWorkbookName=t.containerName:e.containerName=t.containerName),t.luid&&(e.luid=t.luid),t.locationName&&(e.locationName=t.locationName),t.comments?.length&&(e.comments=t.comments),t.hitsTotal!=null&&(e.totalViewCount=t.hitsTotal),t.favoritesTotal!=null&&(e.favoritesTotal=t.favoritesTotal),t.tags?.length&&(e.tags=t.tags),t.projectName&&(e.projectName=t.projectName),t.hitsSmallSpanTotal!=null&&(e.viewCountLastMonth=t.hitsSmallSpanTotal),t.downstreamWorkbookCount!=null&&(e.downstreamWorkbookCount=t.downstreamWorkbookCount),t.isConnectable!=null&&(e.isConnectable=t.isConnectable),t.datasourceIsPublished!=null&&(e.datasourceIsPublished=t.datasourceIsPublished),t.connectionType&&(e.connectionType=t.connectionType),t.isCertified!=null&&(e.isCertified=t.isCertified),t.hasExtracts!=null&&(e.hasExtracts=t.hasExtracts),t.extractRefreshedAt&&(e.extractRefreshedAt=t.extractRefreshedAt),t.extractUpdatedAt&&(e.extractUpdatedAt=t.extractUpdatedAt),t.connectedWorkbooksCount!=null&&(e.connectedWorkbooksCount=t.connectedWorkbooksCount),t.extractCreationPending!=null&&(e.extractCreationPending=t.extractCreationPending),t.hasSevereDataQualityWarning!=null&&(e.hasSevereDataQualityWarning=t.hasSevereDataQualityWarning),t.datasourceLuid&&(e.datasourceLuid=t.datasourceLuid),t.hasActiveDataQualityWarning!=null&&(e.hasActiveDataQualityWarning=t.hasActiveDataQualityWarning),e}var Qc={terms:fs.string().trim().nonempty().optional(),limit:fs.number().int().min(1).max(2e3).default(100).optional(),orderBy:Ii.optional(),filter:Ni.optional()},hs=t=>{let e=new O({server:t,name:"search-content",description:"\nThis tool searches across all supported content types for objects relevant to the search expression specified by search terms and filters.\n\n**Parameters:**\n\n- `terms` (optional): A string containing one or more search terms that the search uses as the basis for determining which items are relevant to return. If the terms parameter is not provided, it searches for everything bound by the specified filters.\n\n- `filter` (optional): Allows you to limit search results based on:\n - `contentTypes`: Filter by content types. Supported types are: 'lens', 'datasource', 'virtualconnection', 'collection', 'project', 'flow', 'datarole', 'table', 'database', 'view', 'workbook'\n - `ownerIds`: Filter by specific owner IDs (array of integers)\n - `modifiedTime`: Filter by last modified times using ISO 8601 date-time strings. Can be either a range (with startDate/endDate) or an array of specific date-times to include\n\n- `limit` (optional): The number of items to return in the search response (default: 100, max: 2000)\n\n- `orderBy` (optional): Determines the sorting method for returned items. Available sorting methods:\n - `hitsTotal`: Number of times a content item has been viewed since it was created\n - `hitsSmallSpanTotal`: Number of times a content item was viewed in the last month\n - `hitsMediumSpanTotal`: Number of times a content item was viewed in the last 3 months\n - `hitsLargeSpanTotal`: Number of times a content item was viewed in the last year\n - `downstreamWorkbookCount`: Number of workbooks in a given project. This value is only available when the content type filter includes 'database' or 'table'\n \n For each sort method, you can specify a sort direction: 'asc' for ascending or 'desc' for descending (default: 'asc'). The orderBy parameter is an array of objects containing the sorting method and direction. The first element determines primary sorting, with subsequent elements used as tiebreakers.\n\n**Important Notes:**\n- If `orderBy` is omitted, the search will sort items by their \"relevance score\" in descending order, which is Tableau's internal algorithm for providing the most relevant results",paramsSchema:Qc,annotations:{title:"Search Content",readOnlyHint:!0,openWorldHint:!1},callback:async({terms:r,limit:i,orderBy:o,filter:n},{requestId:s})=>{let l=R(),u=o?ds(o):void 0,m=n?ps(n):void 0;return await e.logAndExecute({requestId:s,args:{},callback:async()=>new Gc(await P({config:l,requestId:s,server:t,jwtScopes:["tableau:content:read"],callback:async c=>{let h=await c.contentExplorationMethods.searchContent({terms:r,page:0,limit:l.maxResultLimit?Math.min(l.maxResultLimit,i??100):i??100,orderBy:u,filter:m});return ms(h)}}))})}});return e};import{Err as Jc,Ok as oi}from"ts-results-es";import{z as Kc}from"zod";function sr(){return["The VizQL Data Service is disabled on this Tableau Server.","To enable it, use TSM using the instructions at https://help.tableau.com/current/server-linux/en-us/cli_configuration-set_tsm.htm#featuresvizqldataservicedeploywithtsm."].join(" ")}function nr({datasourceLuid:t}){if(!t)throw new Error("datasourceLuid must be a non-empty string.")}import{z as _}from"zod";var $c=_.object({name:_.string(),columnClass:_.string(),dataType:_.string().nullable(),defaultAggregation:_.string().nullable(),description:_.string().nullable(),descriptionInherited:_.array(_.object({attribute:_.string(),value:_.string().nullable()}).nullable()).nullable(),dataCategory:_.string().nullable(),role:_.string().nullable(),defaultFormat:_.string().nullable(),semanticRole:_.string().nullable(),aggregation:_.string().nullable(),aggregationParam:_.string().nullable(),formula:_.string().nullable(),isAutoGenerated:_.boolean().nullable(),hasUserReference:_.boolean().nullable(),binSize:_.number().nullable()}).partial(),Zc=_.object({name:_.string(),parameterType:_.string(),dataType:_.string().nullable(),value:_.union([_.number(),_.string(),_.boolean(),_.null()]),members:_.array(_.union([_.number(),_.string(),_.boolean(),_.null()])),min:_.number().nullable(),max:_.number().nullable(),step:_.number().nullable(),minDate:_.string().nullable(),maxDate:_.string().nullable(),periodValue:_.number().nullable(),periodType:_.string().nullable()}).partial(),Pb=_.object({fields:_.array($c),parameters:_.array(Zc)});function ii(t){let e={fields:[],parameters:[]};if(!t.data)return e;for(let r of t.data){let i={name:r.fieldCaption,dataType:r.dataType,columnClass:r.columnClass};r.defaultAggregation&&(i.defaultAggregation=r.defaultAggregation),r.formula&&(i.formula=r.formula),e.fields.push(i)}if(t.extraData?.parameters)for(let r of t.extraData.parameters){let i={name:r.parameterCaption,parameterType:r.parameterType,dataType:r.dataType,value:r.value};r.parameterType==="LIST"&&r.members?i.members=r.members:r.parameterType==="QUANTITATIVE_DATE"?(i.minDate=r.minDate,i.maxDate=r.maxDate,i.periodValue=r.periodValue,i.periodType=r.periodType):r.parameterType==="QUANTITATIVE_RANGE"&&(i.min=r.min,i.max=r.max,i.step=r.step),e.parameters.push(i)}return e}function ys(t,e){let r={fields:[],parameters:[]};if(!t.data){if(e.data.publishedDatasources[0]?.fields.length)for(let i of e.data.publishedDatasources[0].fields){let o={name:i.name};i.dataType&&(o.dataType=i.dataType),i.aggregation&&(o.defaultAggregation=i.aggregation),gs(i,o),r.fields.push(o)}return r}for(let i of t.data){let o={name:i.fieldCaption,dataType:i.dataType,columnClass:i.columnClass};i.defaultAggregation&&(o.defaultAggregation=i.defaultAggregation),i.formula&&(o.formula=i.formula),r.fields.push(o)}if(t.extraData?.parameters)for(let i of t.extraData.parameters){let o={name:i.parameterCaption,parameterType:i.parameterType,dataType:i.dataType,value:i.value};i.parameterType==="LIST"&&i.members?o.members=i.members:i.parameterType==="QUANTITATIVE_DATE"?(o.minDate=i.minDate,o.maxDate=i.maxDate,o.periodValue=i.periodValue,o.periodType=i.periodType):i.parameterType==="QUANTITATIVE_RANGE"&&(o.min=i.min,o.max=i.max,o.step=i.step),r.parameters.push(o)}if(!e.data.publishedDatasources[0]?.fields.length)return r;for(let i of r.fields){let o=e.data.publishedDatasources[0].fields.find(n=>n.name===i.name);o&&gs(o,i)}return r}function gs(t,e){t.description&&(e.description=t.description),t.descriptionInherited?.length&&(e.descriptionInherited=t.descriptionInherited),t.dataCategory&&(e.dataCategory=t.dataCategory),t.role&&(e.role=t.role),t.defaultFormat&&(e.defaultFormat=t.defaultFormat),t.formula&&(e.formula=t.formula,t.isAutoGenerated!=null&&(e.isAutoGenerated=t.isAutoGenerated),t.hasUserReference!=null&&(e.hasUserReference=t.hasUserReference)),t.binSize!=null&&(e.binSize=t.binSize)}var Yc=t=>`
|
|
17
18
|
query datasourceFieldInfo {
|
|
18
19
|
publishedDatasources(filter: { luid: "${t}" }) {
|
|
19
20
|
name
|
|
@@ -74,11 +75,11 @@ var Ys=Object.defineProperty;var Xs=(t,e)=>{for(var r in e)Ys(t,r,{get:e[r],enum
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
}`,
|
|
78
|
+
}`,Xc={datasourceLuid:Kc.string().nonempty()},bs=t=>{let e=new O({server:t,name:"get-datasource-metadata",description:`
|
|
78
79
|
This tool retrieves field metadata for a specified datasource by taking the basic, high level, metadata results from Tableau's VizQL Data Service and enriches them with additional context provided by Tableau's Metadata API.
|
|
79
80
|
The fields provided by this tool will contain properties such as name and dataType, but may also expose richer context such as descriptions, dataCategories, roles, etc.
|
|
80
81
|
This tool should be used for getting the metadata to ground the use of a tool that queries Tableau published data sources.
|
|
81
|
-
`,paramsSchema:
|
|
82
|
+
`,paramsSchema:Xc,annotations:{title:"Get Datasource Metadata",readOnlyHint:!0,openWorldHint:!1},argsValidator:nr,callback:async({datasourceLuid:r},{requestId:i})=>{let o=R(),n=Yc(r);return await e.logAndExecute({requestId:i,args:{datasourceLuid:r},callback:async()=>await P({config:o,requestId:i,server:t,jwtScopes:["tableau:content:read","tableau:viz_data_service:read"],callback:async s=>{let l=await s.vizqlDataServiceMethods.readMetadata({datasource:{datasourceLuid:r}});if(l.isErr())return Jc({type:"feature-disabled"});if(o.disableMetadataApiRequests)return oi(ii(l.value));let u;try{u=await s.metadataMethods.graphql(n)}catch{return oi(ii(l.value))}return oi(ys(l.value,u))}}),getErrorText:s=>{switch(s.type){case"feature-disabled":return sr()}}})}});return e};import{Ok as su}from"ts-results-es";import{z as ni}from"zod";import{z as ar}from"zod";var eu=ar.object({pageSize:ar.coerce.number().gt(0),pageNumber:ar.coerce.number().gt(0),limit:ar.coerce.number().gt(0)}).partial();async function tt({pageConfig:t,getDataFn:e}){let{pageSize:r,limit:i}=eu.parse(t),{pagination:o,data:n}=await e(t),s=[...n],{totalAvailable:l,pageNumber:u}=o;for(;l>s.length&&(!i||i>s.length);){let{pagination:m,data:c}=await e({pageSize:r,pageNumber:u+1,limit:i});if(c.length===0)throw new Error(`No more data available. Last fetched page number: ${u}, Total available: ${l}, Total fetched: ${s.length}`);({totalAvailable:l,pageNumber:u}=m),s.push(...c)}return i&&i<s.length&&(s.length=i),s}var rt="**Supported Operators**\n - `eq`: equals\n - `gt`: greater than\n - `gte`: greater than or equal\n - `in`: any of [list] (for searching tags)\n - `lt`: less than\n - `lte`: less than or equal\n \n **Filter Expression Notes**\n - Filter expressions can't contain ampersand (&) or comma (,) characters even if those characters are encoded.\n - Operators are delimited with colons (:). For example: `filter=name:eq:Project Views`\n - Field names, operator names, and values are case-sensitive.\n - To filter on multiple fields, combine expressions using a comma: `filter=lastLogin:gte:2016-01-01T00:00:00Z,siteRole:eq:Publisher`\n - Multiple expressions are combined using a logical AND.\n - If you include the same field multiple times, only the last reference is used.\n - For date-time values, use ISO 8601 format (e.g., `2016-05-04T21:24:49Z`).\n - Wildcard searches (starts with, ends with, contains) are supported in recent Tableau versions:\n - Starts with: `?filter=name:eq:mark*`\n - Ends with: `?filter=name:eq:*-ample`\n - Contains: `?filter=name:eq:mark*ex*`";import{z as si}from"zod";import tu from"zod";var Pe=tu.enum(["eq","in","gt","gte","lt","lte"]);function ru(t){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(t)}var iu=["createdAt","updatedAt"];function it({filterString:t,allowedOperatorsByField:e,filterFieldSchema:r}){function i(s,l){return e[s].includes(l)}let o=t.split(",").map(s=>s.trim()).filter(Boolean),n={};for(let s of o){let[l,u,...m]=s.split(":");if(!l||!u||m.length===0)throw new Error(`Invalid filter expression format: "${s}"`);let c=m.join(":"),h=r.parse(l),b=Pe.parse(u);if(!i(h,b))throw new Error(`Operator '${b}' is not allowed for field '${h}'. Allowed operators: ${e[h].join(", ")}`);if(iu.includes(h)&&!ru(c))throw new Error(`Value for field '${h}' must be a valid ISO 8601 date-time string (e.g., 2016-05-04T21:24:49Z)`);n[h]={field:h,operator:b,value:c}}return Object.values(n).map(s=>`${s.field}:${s.operator}:${s.value}`).join(",")}var Ts=si.enum(["authenticationType","connectedWorkbookType","connectionTo","connectionType","contentUrl","createdAt","databaseName","databaseUserName","description","favoritesTotal","hasAlert","hasEmbeddedPassword","hasExtracts","isCertified","isConnectable","isDefaultPort","isHierarchical","isPublished","name","ownerDomain","ownerEmail","ownerName","projectName","serverName","serverPort","size","tableName","tags","type","updatedAt"]),ou={authenticationType:["eq","in"],connectedWorkbookType:["eq","gt","gte","lt","lte"],connectionTo:["eq","in"],connectionType:["eq","in"],contentUrl:["eq","in"],createdAt:["eq","gt","gte","lt","lte"],databaseName:["eq","in"],databaseUserName:["eq","in"],description:["eq","in"],favoritesTotal:["eq","gt","gte","lt","lte"],hasAlert:["eq"],hasEmbeddedPassword:["eq"],hasExtracts:["eq"],isCertified:["eq"],isConnectable:["eq"],isDefaultPort:["eq"],isHierarchical:["eq"],isPublished:["eq"],name:["eq","in"],ownerDomain:["eq","in"],ownerEmail:["eq"],ownerName:["eq","in"],projectName:["eq","in"],serverName:["eq","in"],serverPort:["eq"],size:["eq","gt","gte","lt","lte"],tableName:["eq","in"],tags:["eq","in"],type:["eq"],updatedAt:["eq","gt","gte","lt","lte"]},Xb=si.object({field:Ts,operator:Pe,value:si.string()});function ws(t){return it({filterString:t,allowedOperatorsByField:ou,filterFieldSchema:Ts})}var nu={filter:ni.string().optional(),pageSize:ni.number().gt(0).optional(),limit:ni.number().gt(0).optional()},Es=t=>{let e=new O({server:t,name:"list-datasources",description:`
|
|
82
83
|
Retrieves a list of published data sources from a specified Tableau site using the Tableau REST API. Supports optional filtering via field:operator:value expressions (e.g., name:eq:Views) for precise and flexible data source discovery. Use this tool when a user requests to list, search, or filter Tableau data sources on a site.
|
|
83
84
|
|
|
84
85
|
**Supported Filter Fields and Operators**
|
|
@@ -115,7 +116,7 @@ var Ys=Object.defineProperty;var Xs=(t,e)=>{for(var r in e)Ys(t,r,{get:e[r],enum
|
|
|
115
116
|
| type | eq |
|
|
116
117
|
| updatedAt | eq, gt, gte, lt, lte |
|
|
117
118
|
|
|
118
|
-
${
|
|
119
|
+
${rt}
|
|
119
120
|
|
|
120
121
|
**Example Usage:**
|
|
121
122
|
- List all data sources on a site
|
|
@@ -127,7 +128,7 @@ var Ys=Object.defineProperty;var Xs=(t,e)=>{for(var r in e)Ys(t,r,{get:e[r],enum
|
|
|
127
128
|
filter: "createdAt:gt:2023-01-01T00:00:00Z"
|
|
128
129
|
- List data sources with the name "Project Views" in the "Finance" project and created after January 1, 2023:
|
|
129
130
|
filter: "name:eq:Project Views,projectName:eq:Finance,createdAt:gt:2023-01-01T00:00:00Z"
|
|
130
|
-
`,paramsSchema:
|
|
131
|
+
`,paramsSchema:nu,annotations:{title:"List Datasources",readOnlyHint:!0,openWorldHint:!1},callback:async({filter:r,pageSize:i,limit:o},{requestId:n})=>{let s=R(),l=r?ws(r):void 0;return await e.logAndExecute({requestId:n,args:{filter:r,pageSize:i,limit:o},callback:async()=>{let u=await P({config:s,requestId:n,server:t,jwtScopes:["tableau:content:read"],callback:async m=>await tt({pageConfig:{pageSize:i,limit:s.maxResultLimit?Math.min(s.maxResultLimit,o??Number.MAX_SAFE_INTEGER):o},getDataFn:async h=>{let{pagination:b,datasources:w}=await m.datasourcesMethods.listDatasources({siteId:m.siteId,filter:l??"",pageSize:h.pageSize,pageNumber:h.pageNumber});return{pagination:b,data:w}}})});return new su(u)}})}});return e};import As from"zod";function se(t){switch(t){case"tableau-server":return["Pulse is not available on Tableau Server.","Consider disabling the Pulse MCP tools in your client or removing them using the EXCLUDE_TOOLS environment variable.","To enable Pulse on your Tableau Cloud site, please see the instructions at https://help.tableau.com/current/online/en-us/pulse_set_up.htm."].join(" ");case"pulse-disabled":return["Pulse is disabled on this Tableau Cloud site.","To enable Pulse, please see the instructions at https://help.tableau.com/current/online/en-us/pulse_set_up.htm."].join(" ")}}var au={bundleRequest:Xt,bundleType:As.optional(As.enum(er))},Ss=t=>{let e=new O({server:t,name:"generate-pulse-metric-value-insight-bundle",description:`
|
|
131
132
|
Generate an insight bundle for the current aggregated value for Pulse Metric using Tableau REST API. You need the full information of the Pulse Metric and Pulse Metric Definition to use this tool.
|
|
132
133
|
|
|
133
134
|
**Parameters:**
|
|
@@ -234,7 +235,7 @@ Generate an insight bundle for the current aggregated value for Pulse Metric usi
|
|
|
234
235
|
- Generate the detail insight bundle for the Pulse metric:
|
|
235
236
|
bundleType: 'detail',
|
|
236
237
|
bundleRequest: (See default example above)
|
|
237
|
-
`,paramsSchema:
|
|
238
|
+
`,paramsSchema:au,annotations:{title:"Generate Pulse Metric Value Insight Bundle",readOnlyHint:!0,openWorldHint:!1},callback:async({bundleRequest:r,bundleType:i},{requestId:o})=>{let n=R();return await e.logAndExecute({requestId:o,args:{bundleRequest:r,bundleType:i},callback:async()=>await P({config:n,requestId:o,server:t,jwtScopes:["tableau:insights:read"],callback:async s=>await s.pulseMethods.generatePulseMetricValueInsightBundle(r,i??"ban")}),getErrorText:se})}});return e};import{z as _s}from"zod";var lu={view:_s.optional(_s.enum(Ie))},Cs=t=>{let e=new O({server:t,name:"list-all-pulse-metric-definitions",description:`
|
|
238
239
|
Retrieves a list of all published Pulse Metric Definitions using the Tableau REST API. Use this tool when a user requests to list all Tableau Pulse Metric Definitions on the current site.
|
|
239
240
|
|
|
240
241
|
**Parameters:**
|
|
@@ -255,7 +256,7 @@ Retrieves a list of all published Pulse Metric Definitions using the Tableau RES
|
|
|
255
256
|
- See all metrics for my Pulse Metric Definitions:
|
|
256
257
|
view: 'DEFINITION_VIEW_FULL'
|
|
257
258
|
In the response you will only get up to 5 metrics, so if you want to see more you need to retrieve all the Pulse Metrics from another tool.
|
|
258
|
-
`,paramsSchema:
|
|
259
|
+
`,paramsSchema:lu,annotations:{title:"List All Pulse Metric Definitions",readOnlyHint:!0,openWorldHint:!1},callback:async({view:r},{requestId:i})=>{let o=R();return await e.logAndExecute({requestId:i,args:{view:r},callback:async()=>await P({config:o,requestId:i,server:t,jwtScopes:["tableau:insight_definitions_metrics:read"],callback:async n=>await n.pulseMethods.listAllPulseMetricDefinitions(r)}),getErrorText:se})}});return e};import{z as lr}from"zod";var cu={metricDefinitionIds:lr.array(lr.string().length(36)).min(1),view:lr.optional(lr.enum(Ie))},Rs=t=>{let e=new O({server:t,name:"list-pulse-metric-definitions-from-definition-ids",description:`
|
|
259
260
|
Retrieves a list of specific Pulse Metric Definitions using the Tableau REST API from a list of metric definition IDs. Use this tool when a user requests information about specific Pulse Metric Definitions on the current site.
|
|
260
261
|
|
|
261
262
|
**Parameters:**
|
|
@@ -284,7 +285,7 @@ Retrieves a list of specific Pulse Metric Definitions using the Tableau REST API
|
|
|
284
285
|
metricDefinitionIds: ['BBC908D8-29ED-48AB-A78E-ACF8A424C8C3', 'BBC908D8-29ED-48AB-A78E-ACF8A424C8C4'],
|
|
285
286
|
view: 'DEFINITION_VIEW_FULL'
|
|
286
287
|
In the response you will only get up to 5 metrics, so if you want to see more you need to retrieve all the Pulse Metrics from another tool.
|
|
287
|
-
`,paramsSchema:
|
|
288
|
+
`,paramsSchema:cu,annotations:{title:"List Pulse Metric Definitions from Metric Definition IDs",readOnlyHint:!0,openWorldHint:!1},callback:async({view:r,metricDefinitionIds:i},{requestId:o})=>{let n=R();return await e.logAndExecute({requestId:o,args:{metricDefinitionIds:i,view:r},callback:async()=>await P({config:n,requestId:o,server:t,jwtScopes:["tableau:insight_definitions_metrics:read"],callback:async s=>await s.pulseMethods.listPulseMetricDefinitionsFromMetricDefinitionIds(i,r)}),getErrorText:se})}});return e};import{z as uu}from"zod";var du={pulseMetricDefinitionID:uu.string().length(36)},xs=t=>{let e=new O({server:t,name:"list-pulse-metrics-from-metric-definition-id",description:`
|
|
288
289
|
Retrieves a list of published Pulse Metrics from a Pulse Metric Definition using the Tableau REST API. Use this tool when a user requests to list Tableau Pulse Metrics for a specific Pulse Metric Definition on the current site.
|
|
289
290
|
|
|
290
291
|
**Parameters:**
|
|
@@ -292,7 +293,7 @@ Retrieves a list of published Pulse Metrics from a Pulse Metric Definition using
|
|
|
292
293
|
|
|
293
294
|
**Example Usage:**
|
|
294
295
|
- List all Pulse Metrics for this Pulse Metric Definition
|
|
295
|
-
`,paramsSchema:
|
|
296
|
+
`,paramsSchema:du,annotations:{title:"List Pulse Metrics from Metric Definition ID",readOnlyHint:!0,openWorldHint:!1},callback:async({pulseMetricDefinitionID:r},{requestId:i})=>{let o=R();return await e.logAndExecute({requestId:i,args:{pulseMetricDefinitionID:r},callback:async()=>await P({config:o,requestId:i,server:t,jwtScopes:["tableau:insight_definitions_metrics:read"],callback:async n=>await n.pulseMethods.listPulseMetricsFromMetricDefinitionId(r)}),getErrorText:se})}});return e};import{z as vs}from"zod";var pu={metricIds:vs.array(vs.string().length(36))},Ls=t=>{let e=new O({server:t,name:"list-pulse-metrics-from-metric-ids",description:`
|
|
296
297
|
Retrieves a list of published Pulse Metrics from a list of metric IDs using the Tableau REST API. Use this tool when a user requests to list Tableau Pulse Metrics for a list of metric IDs on the current site.
|
|
297
298
|
|
|
298
299
|
**Parameters:**
|
|
@@ -306,7 +307,7 @@ Retrieves a list of published Pulse Metrics from a list of metric IDs using the
|
|
|
306
307
|
- This tool is recommended for use with data in Pulse Metric Subscriptions.
|
|
307
308
|
- 00000000-0000-0000-0000-000000000000 is not a valid datasource id.
|
|
308
309
|
- If you need a valid datasource id, you may need to retrieve the Pulse Metric Definition for the Pulse Metric which should have a valid datasource information.
|
|
309
|
-
`,paramsSchema:
|
|
310
|
+
`,paramsSchema:pu,annotations:{title:"List Pulse Metrics from Metric IDs",readOnlyHint:!0,openWorldHint:!1},callback:async({metricIds:r},{requestId:i})=>{let o=R();return await e.logAndExecute({requestId:i,args:{metricIds:r},callback:async()=>await P({config:o,requestId:i,server:t,jwtScopes:["tableau:insight_metrics:read"],callback:async n=>await n.pulseMethods.listPulseMetricsFromMetricIds(r)}),getErrorText:se})}});return e};var mu={},Ds=t=>{let e=new O({server:t,name:"list-pulse-metric-subscriptions",description:`
|
|
310
311
|
Retrieves a list of published Pulse Metric Subscriptions for the current user using the Tableau REST API. Use this tool when a user requests to list Tableau Pulse Metric Subscriptions for the current user.
|
|
311
312
|
|
|
312
313
|
**Example Usage:**
|
|
@@ -317,7 +318,7 @@ Retrieves a list of published Pulse Metric Subscriptions for the current user us
|
|
|
317
318
|
- This tool does not directly provide information about Pulse Metric Definitions. If you need to know information about Pulse Metric Defintiions associated with your subscriptions you need to:
|
|
318
319
|
1. Retrieve Pulse Metrics from the metric ids returned in the Pulse Metric Subscriptions.
|
|
319
320
|
2. Retrieve Pulse Metric Definitions from the metric definition id returned in the Pulse Metrics.
|
|
320
|
-
`,paramsSchema:
|
|
321
|
+
`,paramsSchema:mu,annotations:{title:"List Pulse Metric Subscriptions for Current User",readOnlyHint:!0,openWorldHint:!1},callback:async(r,{requestId:i})=>{let o=R();return await e.logAndExecute({requestId:i,args:{},callback:async()=>await P({config:o,requestId:i,server:t,jwtScopes:["tableau:metric_subscriptions:read"],callback:async n=>await n.pulseMethods.listPulseMetricSubscriptionsForCurrentUser()}),getErrorText:se})}});return e};import{ZodiosError as Au}from"@zodios/core";import{Err as Vs}from"ts-results-es";import{z as Su}from"zod";import{z as Ne}from"zod";var fu=Ne.record(Ne.string().nonempty(),Ne.array(Ne.object({luid:Ne.string().optional(),u:Ne.string().nonempty(),p:Ne.string().nonempty()}).transform(({luid:t,u:e,p:r})=>({connectionLuid:t,connectionUsername:e,connectionPassword:r})))),Is,Os=!1,Ps=t=>{if(!Os){Os=!0;let{datasourceCredentials:e}=R();if(!e)return;let r;try{r=JSON.parse(e)}catch(o){throw new Error(`Invalid datasource credentials format. Could not parse JSON string: ${e}`,{cause:o})}let i=fu.parse(r);Is=new Map(Object.entries(i))}return Is?.get(t)};function Ns(t){let e={...t};switch(t.errorCode){case"400000":e.condition="Bad request",e.details="The content of the request body is invalid. Check for missing or incomplete JSON.";break;case"400800":e.condition="Invalid formula for calculation",e.details="Invalid custom calculation syntax. For help, see https://help.tableau.com/current/pro/desktop/en-us/functions_operators.htm";break;case"400802":e.condition="Invalid API request",e.details="The incoming request isn't valid per the OpenAPI specification.";break;case"400803":e.condition="Validation failed",e.details="The incoming request isn't valid per the validation rules.";break;case"400804":e.condition="Response too large",e.details="The response value exceeds the limit. You must apply a filter in your request.";break;case"401001":e.condition="Login error",e.details="The login failed for the given user.";break;case"401002":e.condition="Invalid authorization credentials",e.details="The provided auth token is formatted incorrectly.";break;case"403157":e.condition="Feature disabled",e.details="The feature is disabled.";break;case"403800":e.condition="API access permission denied",e.details="The user doesn't have API Access granted on the given data source. Set the API Access capability for the given data source to Allowed. For help, see https://help.tableau.com/current/online/en-us/permissions_capabilities.htm";break;case"404934":e.condition="Unknown field",e.details="The requested field doesn't exist.";break;case"404950":e.condition="API endpoint not found",e.details="The request endpoint doesn't exist.";break;case"408000":e.condition="Request timeout",e.details="The request timed out.";break;case"409000":e.condition="User already on site",e.details="HTTP status conflict.";break;case"429000":e.condition="Too many requests",e.details="Too many requests in the allotted amount of time. For help, see https://help.tableau.com/current/api/vizql-data-service/en-us/docs/vds_limitations.html#licensing-and-data-transfer";break;case"500000":e.condition="Internal server error",e.details="The request could not be completed.";break;case"500810":e.condition="VDS empty table response",e.details="The underlying data engine returned empty data value response.";break;case"500811":e.condition="VDS missing table",e.details="The underlying data engine returned empty metadata associated with response.";break;case"500812":e.condition="Error while processing an error",e.details="Internal processing error.";break;case"501000":e.condition="Not implemented",e.details="Can't find response from upstream server.";break;case"503800":e.condition="VDS unavailable",e.details="The underlying data engine is unavailable.";break;case"503801":e.condition="VDS discovery error",e.details="The upstream service can't be found.";break;case"504000":e.condition="Gateway timeout",e.details="The upstream service response timed out.";break}return e}function Fs(t){if(t.length===0)throw new Error("The query must include at least one field. The fields property cannot be an empty array.");if(t.some(hu))throw new Error("The query must not include any fields with an empty fieldCaption.");{let e=t.reduce((i,o)=>(i[o.fieldCaption]||(i[o.fieldCaption]=0),i[o.fieldCaption]++,i),{}),r=Object.entries(e).filter(([i,o])=>o>1);if(r.length>0)throw new Error(`The query must not include duplicate fields. The following fields are duplicated: ${r.map(([i])=>i).join(", ")}.`)}{let e=t.reduce((i,o)=>(o.sortPriority===void 0||(i[o.sortPriority]||(i[o.sortPriority]=[]),i[o.sortPriority].push(o.fieldCaption)),i),{}),r=Object.entries(e).filter(([i,o])=>o.length>1);if(r.length>0){let i=r.reduce((o,[n,s])=>(o.push(`${s.map(l=>`"${l}"`).join(", ")} with a sort priority of ${n}`),o),[]);throw new Error(`The query must not include duplicate sort priorities. The following fields have sort priorities that are duplicated: ${i.join(". ")}.`)}}{let e=t.filter(ai).map(r=>r.fieldCaption);if(e.length>0)throw new Error(`The query must not include fields that contain both a function and a calculation. The following fields contain both a function and a calculation: ${e.join(", ")}.`)}{let e=t.filter(gu).map(r=>r.fieldCaption);if(e.length>0)throw new Error(`The query must not include fields that have a maxDecimalPlaces value that is less than 0. The following fields have a maxDecimalPlaces value that is less than 0: ${e.join(", ")}.`)}}function hu(t){return!t.fieldCaption}function ai(t){return!!("function"in t&&t.function&&"calculation"in t&&t.calculation)}function ks(t){return!!("fieldCaption"in t&&t.fieldCaption&&"calculation"in t&&t.calculation)}function gu(t){return t.maxDecimalPlaces!==void 0&&t.maxDecimalPlaces<0}import{Err as li,Ok as yu}from"ts-results-es";function qs(t){if(t){if(t.some(e=>!("field"in e)))throw new Error("The query must not include filters with invalid fields. The following field errors occurred: The filter must include a field property.");{let e=t.reduce((i,o)=>("fieldCaption"in o.field&&(i[o.field.fieldCaption]||(i[o.field.fieldCaption]=0),i[o.field.fieldCaption]++),i),{}),r=Object.entries(e).filter(([i,o])=>o>1);if(r.length>0)throw new Error(`The query must not include multiple filters for the following fields: ${r.map(([i])=>i).join(", ")}.`)}{let e=t.reduce((r,i)=>{if(!("field"in i))return r;let o=Ms(i.field);return o.isErr()&&r.push(o.error),r},[]);if(e.length>0)throw new Error(`The query must not include filters with invalid fields. The following field errors occurred: ${e.join(", ")}.`)}if(t.filter(r=>["SET","MATCH","DATE"].includes(r.filterType)&&("function"in r.field&&r.field.function||"calculation"in r.field&&r.field.calculation)).length>0)throw new Error("The query must not include Set Filters, Match Filters, or Relative Date Filters with functions or calculations.");if(t.filter(r=>r.filterType==="SET"&&r.values.length===0).length>0)throw new Error("The query must not include Set Filters with an empty values array.");if(t.filter(r=>{if(r.filterType!=="QUANTITATIVE_DATE")return!1;switch(r.quantitativeFilterType){case"RANGE":return isNaN(Date.parse(r.minDate))||isNaN(Date.parse(r.maxDate));case"MIN":return isNaN(Date.parse(r.minDate));case"MAX":return isNaN(Date.parse(r.maxDate))}}).length>0)throw new Error("The query must not include Quantitative Date Filters with invalid dates. Dates must use the RFC 3339 standard. Example: 2025-03-14");if(t.filter(r=>r.filterType==="DATE"&&r.anchorDate&&isNaN(Date.parse(r.anchorDate))).length>0)throw new Error("The query must not include Relative Date Filters with invalid anchor dates. Anchor dates must use the RFC 3339 standard. Example: 2025-03-14");{let e=t.reduce((r,i)=>{if(i.filterType!=="TOP")return r;let o=Ms(i.fieldToMeasure);return o.isErr()&&r.push(o.error),r},[]);if(e.length>0)throw new Error(`The query must not include Top N filters with invalid fields. The following field errors occurred: ${e.join(", ")}`)}{let e=t.reduce((r,i)=>(i.filterType!=="MATCH"||!i.startsWith&&!i.endsWith&&!i.contains&&r.push(`The match filter for field "${i.field.fieldCaption}" must include at least one of the following properties: startsWith, endsWith, or contains`),r),[]);if(e.length>0)throw new Error(`The query must not include Match Filters with invalid fields. The following field errors occurred: ${e.join(", ")}.`)}}}function Ms(t){if(bu(t))return new li("The fieldCaption property must be a non-empty string.");if(ks(t)){let e="fieldCaption"in t?`"${t.fieldCaption}" `:"";return new li(`The field ${e} must not contain both a fieldCaption and a calculation.`.replace(" "," "))}if(ai(t)){let e="fieldCaption"in t?`"${t.fieldCaption}" `:"";return new li(`The field ${e} must not contain both a function and a calculation.`.replace(" "," "))}return yu.EMPTY}function bu(t){return"fieldCaption"in t&&!t.fieldCaption}function Us({datasourceLuid:t,query:e}){nr({datasourceLuid:t});let{fields:r,filters:i}=e;if(Fs(r),qs(i),!Rt.safeParse(e).success)throw new Error("The query does not match the expected schema.")}var js=`# Query Tableau Data Source Tool
|
|
321
322
|
|
|
322
323
|
Executes VizQL queries against Tableau data sources to answer business questions from published data. This tool allows you to retrieve aggregated and filtered data with proper sorting and grouping.
|
|
323
324
|
|
|
@@ -626,9 +627,9 @@ Filter relative date periods:
|
|
|
626
627
|
**Instead:**
|
|
627
628
|
- Use metadata tools to understand available fields
|
|
628
629
|
- Suggest alternative questions that can be answered with available data
|
|
629
|
-
- Recommend appropriate aggregation levels for the business question`;import Dt from"fast-levenshtein";import{Err as
|
|
630
|
+
- Recommend appropriate aggregation levels for the business question`;import Dt from"fast-levenshtein";import{Err as ci,Ok as Fe}from"ts-results-es";async function Bs(t,e,r,i){if(!e.filters)return Fe.EMPTY;let o=[],n=e.filters.filter(s=>(s.filterType==="SET"||s.filterType==="MATCH")&&"fieldCaption"in s.field&&s.field.fieldCaption);if(n.length===0)return Fe.EMPTY;for(let s of n){let l=s.field.fieldCaption;try{if(s.filterType==="SET"){let u=await Tu(s,r,i);u.isErr()&&o.push(u.error)}else if(s.filterType==="MATCH"){let u=await wu(s,r,i);u.isErr()&&o.push(u.error)}}catch(u){oe.warning(t,`Filter value validation failed for field ${l}: ${u}`)}}return o.length>0?new ci(o):Fe.EMPTY}async function Tu(t,e,r){let i=t.field.fieldCaption,o=t.values.map(h=>String(h)),s={datasource:r,query:{fields:[{fieldCaption:i,fieldAlias:"DistinctValues"}]},options:{returnFormat:"OBJECTS",debug:!0,disaggregate:!1}},l=await e.queryDatasource(s);if(l.isErr())return Fe.EMPTY;let u=l.value.data||[],m=new Set(u.map(h=>String(h.DistinctValues||h[i]||""))),c=o.filter(h=>!m.has(h));if(c.length>0){let h=Eu(c,Array.from(m),3,5),b=`Filter validation failed for field "${i}". The following values were not found: ${c.join(", ")}.`;return h.length>0&&(b+=` Did you mean: ${h.join(", ")}?`),b+=" Please evaluate whether you included the wrong filter value or if you are trying to filter on the wrong field entirely.",new ci({field:i,invalidValues:c,sampleValues:h,message:b})}return Fe.EMPTY}async function wu(t,e,r){let i=t.field.fieldCaption,n={datasource:r,query:{fields:[{fieldCaption:i,fieldAlias:"SampleValues"}]},options:{returnFormat:"OBJECTS",debug:!0,disaggregate:!1}},s=await e.queryDatasource(n);if(s.isErr())return Fe.EMPTY;let u=(s.value.data||[]).map(c=>String(c.SampleValues||c[i]||""));if(!u.some(c=>!(t.startsWith&&!c.startsWith(t.startsWith)||t.endsWith&&!c.endsWith(t.endsWith)||t.contains&&!c.includes(t.contains)))){let c=new Set;for(let f of u){if(c.size>=5)break;let y=f.toLowerCase(),T=t.startsWith?(()=>{let A=t.startsWith.toLowerCase(),x=A.length,v=Math.min(2,Math.floor(x/2)),q=y.slice(0,x);return Dt.get(A,q)<=v})():!0,C=t.endsWith?(()=>{let A=t.endsWith.toLowerCase(),x=A.length,v=Math.min(2,Math.floor(x/2)),q=y.slice(-x);return Dt.get(A,q)<=v})():!0,N=t.contains?(()=>{let A=t.contains.toLowerCase(),x=A.length,v=Math.min(2,Math.floor(x/2));return y.length>=x?Array.from({length:y.length-x+1},(q,U)=>Dt.get(A,y.slice(U,U+x))).some(q=>q<=v):Dt.get(A,y)<=v})():!0;T&&C&&N&&c.add(f)}let h=[];t.startsWith&&h.push(`starts with "${t.startsWith}"`),t.endsWith&&h.push(`ends with "${t.endsWith}"`),t.contains&&h.push(`contains "${t.contains}"`);let b=c.size>0?`Similar values in this field: ${Array.from(c).join(", ")}.`:"",w=`Filter validation failed for field "${i}". No values found that ${h.join(" and ")}. ${b} Please evaluate whether you included the wrong filter value or if you are trying to filter on the wrong field entirely.`;return new ci({field:i,invalidValues:h,sampleValues:Array.from(c),message:w})}return Fe.EMPTY}function Eu(t,e,r=3,i=5){let o=[];for(let u of e){let m=t.map(c=>({value:c,distance:Dt.get(c.toLowerCase(),u.toLowerCase())})).filter(c=>c.distance<=r).sort((c,h)=>c.distance-h.distance);if(m.length>0){let c=m[0];o.push({invalidValue:c.value,suggestionForInvalidValue:u,distance:c.distance})}}o.sort((u,m)=>u.distance-m.distance);let n=[],s=Math.ceil(i/t.length),l=new Map;for(let u of t)l.set(u,0);for(let{invalidValue:u,suggestionForInvalidValue:m}of o){if(n.length===i)break;l.get(u)!==s&&(n.push(m),l.set(u,l.get(u)+1))}for(let{suggestionForInvalidValue:u}of o){if(n.length===i)break;if(n.includes(u))continue;n.push(u)}return n}var _u={datasourceLuid:Su.string().nonempty(),query:Rt},zs=t=>{let e=new O({server:t,name:"query-datasource",description:js,paramsSchema:_u,annotations:{title:"Query Datasource",readOnlyHint:!0,openWorldHint:!1},argsValidator:Us,callback:async({datasourceLuid:r,query:i},{requestId:o})=>{let n=R();return await e.logAndExecute({requestId:o,args:{datasourceLuid:r,query:i},callback:async()=>{let s={datasourceLuid:r},l={returnFormat:"OBJECTS",debug:!0,disaggregate:!1},u=Ps(r);u&&(s.connections=u);let m={datasource:s,query:i,options:l};return await P({config:n,requestId:o,server:t,jwtScopes:["tableau:viz_data_service:read"],callback:async c=>{if(!n.disableQueryDatasourceFilterValidation){let b=await Bs(t,i,c.vizqlDataServiceMethods,s);if(b.isErr()){let f=b.error.map(y=>y.message).join(`
|
|
630
631
|
|
|
631
|
-
`);return new
|
|
632
|
+
`);return new Vs({type:"filter-validation",message:f})}}let h=await c.vizqlDataServiceMethods.queryDatasource(m);return h.isErr()?new Vs(h.error instanceof Au?h.error:h.error==="feature-disabled"?{type:"feature-disabled"}:{type:"tableau-error",error:h.error}):h}})},getErrorText:s=>{switch(s.type){case"feature-disabled":return sr();case"filter-validation":return JSON.stringify({requestId:o,errorType:"validation",message:s.message});case"tableau-error":return JSON.stringify({requestId:o,...Ns(s.error)})}}})}});return e};import{Ok as Cu}from"ts-results-es";import{z as Ru}from"zod";var xu={viewId:Ru.string()},Ws=t=>{let e=new O({server:t,name:"get-view-data",description:"Retrieves data in comma separated value (CSV) format for the specified view in a Tableau workbook.",paramsSchema:xu,annotations:{title:"Get View Data",readOnlyHint:!0,openWorldHint:!1},callback:async({viewId:r},{requestId:i})=>{let o=R();return await e.logAndExecute({requestId:i,args:{viewId:r},callback:async()=>new Cu(await P({config:o,requestId:i,server:t,jwtScopes:["tableau:views:download"],callback:async n=>await n.viewsMethods.queryViewData({viewId:r,siteId:n.siteId})}))})}});return e};import{Ok as vu}from"ts-results-es";import{z as ui}from"zod";function Hs(t){return{isError:!1,content:[{type:"image",data:Buffer.from(t).toString("base64"),mimeType:"image/png"}]}}var Lu={viewId:ui.string(),width:ui.number().gt(0).optional(),height:ui.number().gt(0).optional()},Gs=t=>{let e=new O({server:t,name:"get-view-image",description:"Retrieves an image of the specified view in a Tableau workbook. The width and height in pixels can be provided. The default width and height are both 800 pixels.",paramsSchema:Lu,annotations:{title:"Get View Image",readOnlyHint:!0,openWorldHint:!1},callback:async({viewId:r,width:i,height:o},{requestId:n})=>{let s=R();return await e.logAndExecute({requestId:n,args:{viewId:r},callback:async()=>new vu(await P({config:s,requestId:n,server:t,jwtScopes:["tableau:views:download"],callback:async l=>await l.viewsMethods.queryViewImage({viewId:r,siteId:l.siteId,width:i,height:o,resolution:"high"})})),getSuccessResult:Hs})}});return e};import{Ok as Iu}from"ts-results-es";import{z as pi}from"zod";import{z as di}from"zod";var Qs=di.enum(["caption","contentUrl","createdAt","favoritesTotal","fields","hitsTotal","name","ownerDomain","ownerEmail","ownerName","projectName","sheetNumber","sheetType","tags","title","updatedAt","viewUrlname","workbookDescription","workbookName"]),Du={caption:["eq","in"],contentUrl:["eq","in"],createdAt:["eq","gt","gte","lt","lte"],favoritesTotal:["eq","gt","gte","lt","lte"],fields:["eq","in"],hitsTotal:["eq","gt","gte","lt","lte"],name:["eq","in"],ownerDomain:["eq","in"],ownerEmail:["eq","in"],ownerName:["eq","in"],projectName:["eq","in"],sheetNumber:["eq","gt","gte","lt","lte"],sheetType:["eq","in"],tags:["eq","in"],title:["eq","in"],updatedAt:["eq","gt","gte","lt","lte"],viewUrlname:["eq","in"],workbookDescription:["eq","in"],workbookName:["eq","in"]},Jw=di.object({field:Qs,operator:Pe,value:di.string()});function $s(t){return it({filterString:t,allowedOperatorsByField:Du,filterFieldSchema:Qs})}var Ou={filter:pi.string().optional(),pageSize:pi.number().gt(0).optional(),limit:pi.number().gt(0).optional()},Zs=t=>{let e=new O({server:t,name:"list-views",description:`
|
|
632
633
|
Retrieves a list of views on a Tableau site including their metadata such as name, owner, and the workbook they are found in. Supports optional filtering via field:operator:value expressions (e.g., name:eq:Overview) for precise and flexible view discovery. Use this tool when a user requests to list, search, or filter Tableau views on a site.
|
|
633
634
|
|
|
634
635
|
**Supported Filter Fields and Operators**
|
|
@@ -654,7 +655,7 @@ Filter relative date periods:
|
|
|
654
655
|
| workbookDescription | eq, in |
|
|
655
656
|
| workbookName | eq, in |
|
|
656
657
|
|
|
657
|
-
${
|
|
658
|
+
${rt}
|
|
658
659
|
|
|
659
660
|
**Example Usage:**
|
|
660
661
|
- List all views on a site
|
|
@@ -665,7 +666,7 @@ Filter relative date periods:
|
|
|
665
666
|
- List views created after January 1, 2023:
|
|
666
667
|
filter: "createdAt:gt:2023-01-01T00:00:00Z"
|
|
667
668
|
- List views with the name "Overview" in the "Finance" project and created after January 1, 2023:
|
|
668
|
-
filter: "name:eq:Overview,projectName:eq:Finance,createdAt:gt:2023-01-01T00:00:00Z"`,paramsSchema:
|
|
669
|
+
filter: "name:eq:Overview,projectName:eq:Finance,createdAt:gt:2023-01-01T00:00:00Z"`,paramsSchema:Ou,annotations:{title:"List Views",readOnlyHint:!0,openWorldHint:!1},callback:async({filter:r,pageSize:i,limit:o},{requestId:n})=>{let s=R(),l=r?$s(r):void 0;return await e.logAndExecute({requestId:n,args:{},callback:async()=>new Iu(await P({config:s,requestId:n,server:t,jwtScopes:["tableau:content:read"],callback:async u=>await tt({pageConfig:{pageSize:i,limit:s.maxResultLimit?Math.min(s.maxResultLimit,o??Number.MAX_SAFE_INTEGER):o},getDataFn:async c=>{let{pagination:h,views:b}=await u.viewsMethods.queryViewsForSite({siteId:u.siteId,filter:l??"",includeUsageStatistics:!0,pageSize:c.pageSize,pageNumber:c.pageNumber});return{pagination:h,data:b}}})}))})}});return e};import{Ok as Pu}from"ts-results-es";import{z as Nu}from"zod";var Fu={workbookId:Nu.string()},Js=t=>{let e=new O({server:t,name:"get-workbook",description:"Retrieves information about the specified workbook, including information about the views contained in the workbook.",paramsSchema:Fu,annotations:{title:"Get Workbook",readOnlyHint:!0,openWorldHint:!1},callback:async({workbookId:r},{requestId:i})=>{let o=R();return await e.logAndExecute({requestId:i,args:{workbookId:r},callback:async()=>new Pu(await P({config:o,requestId:i,server:t,jwtScopes:["tableau:content:read"],callback:async n=>{let s=await n.workbooksMethods.getWorkbook({workbookId:r,siteId:n.siteId});if(s.views){let l=await n.viewsMethods.queryViewsForWorkbook({workbookId:r,siteId:n.siteId,includeUsageStatistics:!0});s.views.view=l}return s}}))})}});return e};import{Ok as Mu}from"ts-results-es";import{z as fi}from"zod";import{z as mi}from"zod";var Ks=mi.enum(["createdAt","contentUrl","displayTabs","favoritesTotal","hasAlerts","hasExtracts","name","ownerDomain","ownerEmail","ownerName","projectName","sheetCount","size","subscriptionTotal","tags","updatedAt"]),ku={createdAt:["eq","gt","gte","lt","lte"],contentUrl:["eq","in"],displayTabs:["eq"],favoritesTotal:["eq","gt","gte","lt","lte"],hasAlerts:["eq"],hasExtracts:["eq"],name:["eq","in"],ownerDomain:["eq","in"],ownerEmail:["eq","in"],ownerName:["eq","in"],projectName:["eq","in"],sheetCount:["eq","gt","gte","lt","lte"],size:["eq","gt","gte","lt","lte"],subscriptionTotal:["eq","gt","gte","lt","lte"],tags:["eq","in"],updatedAt:["eq","gt","gte","lt","lte"]},gE=mi.object({field:Ks,operator:Pe,value:mi.string()});function Ys(t){return it({filterString:t,allowedOperatorsByField:ku,filterFieldSchema:Ks})}var qu={filter:fi.string().optional(),pageSize:fi.number().gt(0).optional(),limit:fi.number().gt(0).optional()},Xs=t=>{let e=new O({server:t,name:"list-workbooks",description:`
|
|
669
670
|
Retrieves a list of workbooks on a Tableau site including their metadata such as name, description, and information about the views contained in the workbook. Supports optional filtering via field:operator:value expressions (e.g., name:eq:Superstore) for precise and flexible workbook discovery. Use this tool when a user requests to list, search, or filter Tableau workbooks on a site.
|
|
670
671
|
|
|
671
672
|
**Supported Filter Fields and Operators**
|
|
@@ -688,7 +689,7 @@ Filter relative date periods:
|
|
|
688
689
|
| tags | eq, in |
|
|
689
690
|
| updatedAt | eq, gt, gte, lt, lte |
|
|
690
691
|
|
|
691
|
-
${
|
|
692
|
+
${rt}
|
|
692
693
|
|
|
693
694
|
**Example Usage:**
|
|
694
695
|
- List all workbooks on a site
|
|
@@ -699,10 +700,10 @@ Filter relative date periods:
|
|
|
699
700
|
- List workbooks created after January 1, 2023:
|
|
700
701
|
filter: "createdAt:gt:2023-01-01T00:00:00Z"
|
|
701
702
|
- List workbooks with the name "Superstore" in the "Finance" project and created after January 1, 2023:
|
|
702
|
-
filter: "name:eq:Superstore,projectName:eq:Finance,createdAt:gt:2023-01-01T00:00:00Z"`,paramsSchema:
|
|
703
|
+
filter: "name:eq:Superstore,projectName:eq:Finance,createdAt:gt:2023-01-01T00:00:00Z"`,paramsSchema:qu,annotations:{title:"List Workbooks",readOnlyHint:!0,openWorldHint:!1},callback:async({filter:r,pageSize:i,limit:o},{requestId:n})=>{let s=R(),l=r?Ys(r):void 0;return await e.logAndExecute({requestId:n,args:{},callback:async()=>new Mu(await P({config:s,requestId:n,server:t,jwtScopes:["tableau:content:read"],callback:async u=>await tt({pageConfig:{pageSize:i,limit:s.maxResultLimit?Math.min(s.maxResultLimit,o??Number.MAX_SAFE_INTEGER):o},getDataFn:async c=>{let{pagination:h,workbooks:b}=await u.workbooksMethods.queryWorkbooksForSite({siteId:u.siteId,filter:l??"",pageSize:c.pageSize,pageNumber:c.pageNumber});return{pagination:h,data:b}}})}))})}});return e};var en=[bs,Es,zs,Cs,Rs,xs,Ls,Ds,Ss,Js,Ws,Gs,Xs,Zs,hs];var It="tableau-mcp",cr=Ai.version,ot=class extends Uu{name;version;constructor(){super({name:It,version:cr},{capabilities:{logging:{},tools:{}}}),this.name=It,this.version=cr}registerTools=()=>{for(let{name:e,description:r,paramsSchema:i,annotations:o,callback:n}of this._getToolsToRegister())this.tool(e,r,i,o,n)};registerRequestHandlers=()=>{this.server.setRequestHandler(ju,async e=>(ke(this,e.params.level),{}))};_getToolsToRegister=()=>{let{includeTools:e,excludeTools:r}=R(),o=en.map(n=>n(this)).filter(n=>e.length>0?e.includes(n.name):r.length>0?!r.includes(n.name):!0);if(o.length===0)throw new Error(`
|
|
703
704
|
No tools to register.
|
|
704
|
-
Tools available = [${
|
|
705
|
+
Tools available = [${dr.join(", ")}].
|
|
705
706
|
EXCLUDE_TOOLS = [${r.join(", ")}].
|
|
706
707
|
INCLUDE_TOOLS = [${e.join(", ")}]
|
|
707
|
-
`);return
|
|
708
|
+
`);return o}};import{StreamableHTTPServerTransport as Bu}from"@modelcontextprotocol/sdk/server/streamableHttp.js";import Vu from"cors";import hi from"express";import tn,{existsSync as rn}from"fs";import zu from"http";import Wu from"https";async function sn({basePath:t,config:e,logLevel:r}){let i=hi();i.use(hi.json()),i.use(hi.urlencoded()),i.use(Vu({origin:e.corsOriginConfig,credentials:!0,allowedHeaders:["Content-Type","Authorization","Cache-Control","Accept","MCP-Protocol-Version"],exposedHeaders:["mcp-session-id","x-session-id"]}));let o=`/${t}`;if(i.post(o,l),i.get(o,on),i.delete(o,on),!!!(e.sslKey&&e.sslCert))return new Promise(u=>{zu.createServer(i).listen(e.httpPort,()=>u({url:`http://localhost:${e.httpPort}/${t}`}))});if(!rn(e.sslKey))throw new Error("SSL key file does not exist");if(!rn(e.sslCert))throw new Error("SSL cert file does not exist");let s={key:tn.readFileSync(e.sslKey),cert:tn.readFileSync(e.sslCert)};return new Promise(u=>{Wu.createServer(s,i).listen(e.httpPort,()=>u({url:`https://localhost:${e.httpPort}/${t}`}))});async function l(u,m){try{let c=new ot,h=new Bu({sessionIdGenerator:void 0});m.on("close",()=>{h.close(),c.close()}),c.registerTools(),c.registerRequestHandlers(),await c.connect(h),ke(c,r),await h.handleRequest(u,m,u.body)}catch(c){console.error("Error handling MCP request:",c),m.headersSent||m.status(500).json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null})}}}async function on(t,e){e.writeHead(405).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async function Qu(){Gu.config();let t=R(),e=Ti(t.defaultLogLevel)?t.defaultLogLevel:"debug";switch(t.enableServerLogging&&wi(new Ot({logDirectory:t.serverLogDirectory})),t.transport){case"stdio":{let r=new ot;r.registerTools(),r.registerRequestHandlers();let i=new Hu;await r.connect(i),ke(r,e),oe.info(r,`${r.name} v${r.version} running on stdio`);break}case"http":{let{url:r}=await sn({basePath:It,config:t,logLevel:e});console.log(`${It} v${cr} stateless streamable HTTP server available at ${r}`);break}}t.disableLogMasking&&Se("Log masking is disabled!")}try{await Qu()}catch(t){Se(`Fatal error when starting the server: ${ae(t)}`),process.exit(1)}
|
|
708
709
|
//# sourceMappingURL=index.js.map
|