@botpress/sdk 5.5.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -81,7 +81,7 @@ ${f.join(" | ")}`;case"ZodIntersection":return`${xe(i._def.left,s)} & ${xe(i._de
81
81
  ${T}`.trim();case"ZodEnum":return i._def.values.map(ie).join(" | ");case"ZodEffects":return xe(i._def.schema,s);case"ZodNativeEnum":throw new Wg("ZodNativeEnum");case"ZodOptional":return`${xe(i._def.innerType,s)} | undefined`;case"ZodNullable":return`${xe(i._def.innerType,s)} | null`;case"ZodDefault":let I=e.treatDefaultAsOptional?i._def.innerType.optional():i._def.innerType;return xe(I,s);case"ZodCatch":return xe(i._def.innerType,s);case"ZodPromise":return`Promise<${xe(i._def.type,s)}>`;case"ZodBranded":return xe(i._def.type,s);case"ZodPipeline":return xe(i._def.in,s);case"ZodSymbol":return`${Qe(i.description)} symbol`.trim();case"ZodReadonly":return`Readonly<${xe(i._def.innerType,s)}>`;case"ZodRef":return Bm(i._def.uri);default:Ct.assertNever(i)}}m(xe,"sUnwrapZod");var mB=m((t,e)=>{if(t.props.type==="none")return xe(t.props.schema,e);let{schema:n,identifier:r}=t.props,o=Qe(n.description),s=n.describe(""),i=xe(s,M(w({},e),{declaration:!0})),l=i.split(`
82
82
  `).length>=fB&&e.includeClosingTags?`// end of ${r}`:"";if(t.props.type!=="type"&&n.typeName==="ZodFunction")return zo(`${o}
83
83
  declare function ${r}${i};${l}`);if(t.props.type==="variable")return zo(`${o}declare const ${r}: ${i};${l}`);let c=t.props.args.length>0?`<${t.props.args.map(Bm).join(", ")}>`:"";return zo(`${o}type ${t.props.identifier}${c} = ${i};${l}`)},"unwrapDeclaration"),yB=m(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),hB=m((t,e)=>{let n=yB(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new ns;return new Ur({type:"none",schema:t})}let o="title"in t.ui?t.ui.title:null;if(!o)throw new zg;if(n==="variable"){if(r.length>0)throw new ns;return new Ur({type:"variable",identifier:o,schema:t})}return new Ur({type:"type",identifier:o,schema:t,args:r})},"getDeclarationProps"),TB=m(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${ie(n)}, ${ie(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${ie(n)}, ${ie(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${ie(n)}, ${ie(r)})`)}return e.join("")},"generateArrayChecks"),vB=m(t=>{let e=t.checks;return e.length===0?"":e.map(_B).join("")},"generateBigIntChecks"),_B=m(t=>{switch(t.kind){case"min":return`.min(${ie(t.value)}, ${ie(t.message)})`;case"max":return`.max(${ie(t.value)}, ${ie(t.message)})`;case"multipleOf":return`.multipleOf(${ie(t.value)}, ${ie(t.message)})`;default:return""}},"_generateBigIntCheck"),bB=m(t=>{let e=t.checks;return e.length===0?"":e.map(wB).join("")},"generateDateChecks"),wB=m(t=>{switch(t.kind){case"min":return`.min(${Lc(t.value)}, ${ie(t.message)})`;case"max":return`.max(${Lc(t.value)}, ${ie(t.message)})`;default:return""}},"_generateDateCheck"),Lc=m(t=>`new Date(${t})`,"dateTs"),xB=m(t=>{let e=t.checks;return e.length===0?"":e.map(PB).join("")},"generateNumberChecks"),PB=m(t=>{switch(t.kind){case"min":return`.min(${ie(t.value)}, ${ie(t.message)})`;case"max":return`.max(${ie(t.value)}, ${ie(t.message)})`;case"int":return`.int(${ie(t.message)})`;case"multipleOf":return`.multipleOf(${ie(t.value)}, ${ie(t.message)})`;case"finite":return`.finite(${ie(t.message)})`;default:return""}},"_generateNumberCheck"),BB=m(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${ie(n)}, ${ie(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${ie(n)}, ${ie(r)})`)}return e.join("")},"generateSetChecks"),IB=m(t=>{let e=t.checks;return e.length===0?"":e.map(EB).join("")},"generateStringChecks"),EB=m(t=>{switch(t.kind){case"min":return`.min(${ie(t.value)}, ${ie(t.message)})`;case"max":return`.max(${ie(t.value)}, ${ie(t.message)})`;case"length":return`.length(${ie(t.value)}, ${ie(t.message)})`;case"email":return`.email(${ie(t.message)})`;case"url":return`.url(${ie(t.message)})`;case"emoji":return`.emoji(${ie(t.message)})`;case"uuid":return`.uuid(${ie(t.message)})`;case"cuid":return`.cuid(${ie(t.message)})`;case"cuid2":return`.cuid2(${ie(t.message)})`;case"ulid":return`.ulid(${ie(t.message)})`;case"includes":let e=tr({message:t.message,position:t.position});return`.includes(${ie(t.value)}, ${e})`;case"startsWith":return`.startsWith(${ie(t.value)}, ${ie(t.message)})`;case"endsWith":return`.endsWith(${ie(t.value)}, ${ie(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${ie(t.message)})`;case"trim":return".trim()";case"toLowerCase":return".toLowerCase()";case"toUpperCase":return".toUpperCase()";case"datetime":let r=t.precision===null?void 0:t.precision;return`.datetime(${tr({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${tr({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),{zuiKey:mt}=en;function Fs(t){return $e(t)}m(Fs,"toTypescriptSchema");function $e(t){let e=t;switch(e.typeName){case"ZodString":return`z.string()${IB(e._def)}${Be(e._def)}`.trim();case"ZodNumber":return`z.number()${xB(e._def)}${Be(e._def)}`.trim();case"ZodNaN":return`z.nan()${Be(e._def)}`.trim();case"ZodBigInt":return`z.bigint()${vB(e._def)}${Be(e._def)}`.trim();case"ZodBoolean":return`z.boolean()${Be(e._def)}`.trim();case"ZodDate":return`z.date()${bB(e._def)}${Be(e._def)}`.trim();case"ZodUndefined":return`z.undefined()${Be(e._def)}`.trim();case"ZodNull":return`z.null()${Be(e._def)}`.trim();case"ZodAny":return`z.any()${Be(e._def)}`.trim();case"ZodUnknown":return`z.unknown()${Be(e._def)}`.trim();case"ZodNever":return`z.never()${Be(e._def)}`.trim();case"ZodVoid":return`z.void()${Be(e._def)}`.trim();case"ZodArray":return`z.array(${$e(e._def.type)})${TB(e._def)}${Be(e._def,e._def.type)}`;case"ZodObject":let n=Xw(e.shape,$e),r=e.additionalProperties(),o=r?`.catchall(${$e(r)})`:"";return["z.object({",...Object.entries(n).map(([ee,Y])=>` ${ee}: ${Y},`),`})${o}${Be(e._def)}`].join(`
84
- `).trim();case"ZodUnion":return`z.union([${e._def.options.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodDiscriminatedUnion":let i=e._def.options.map($e);return`z.discriminatedUnion(${ie(e._def.discriminator)}, [${i.join(", ")}])${Be(e._def)}`.trim();case"ZodIntersection":let l=$e(e._def.left),c=$e(e._def.right);return`z.intersection(${l}, ${c})${Be(e._def)}`.trim();case"ZodTuple":return`z.tuple([${e._def.items.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodRecord":let g=$e(e._def.keyType),p=$e(e._def.valueType);return`z.record(${g}, ${p})${Be(e._def)}`.trim();case"ZodMap":let h=$e(e._def.keyType),_=$e(e._def.valueType);return`z.map(${h}, ${_})${Be(e._def)}`.trim();case"ZodSet":return`z.set(${$e(e._def.valueType)})${BB(e._def)}${Be(e._def)}`.trim();case"ZodFunction":let P=e._def.args.items.map($e),B=P.length?`.args(${P.join(", ")})`:"",T=$e(e._def.returns);return`z.function()${B}.returns(${T})${Be(e._def)}`.trim();case"ZodLazy":return`z.lazy(() => ${$e(e._def.getter())})${Be(e._def)}`.trim();case"ZodLiteral":return`z.literal(${ie(e._def.value)})${Be(e._def)}`.trim();case"ZodEnum":return`z.enum([${e._def.values.map(ie).join(", ")}])${Be(e._def)}`.trim();case"ZodEffects":throw new Sn("ZodEffects");case"ZodNativeEnum":throw new Sn("ZodNativeEnum");case"ZodOptional":return`z.optional(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodNullable":return`z.nullable(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodDefault":let D=tr(e._def.defaultValue());return`z.default(${$e(e._def.innerType)}, ${D})${Be(e._def,e._def.innerType)}`.trim();case"ZodCatch":throw new Sn("ZodCatch");case"ZodPromise":return`z.promise(${$e(e._def.type)})${Be(e._def,e._def.type)}`.trim();case"ZodBranded":throw new Sn("ZodBranded");case"ZodPipeline":throw new Sn("ZodPipeline");case"ZodSymbol":throw new Sn("ZodSymbol");case"ZodReadonly":return`z.readonly(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodRef":return`z.ref(${ie(e._def.uri)})${Be(e._def)}`.trim();default:Ct.assertNever(e)}}m($e,"sUnwrapZod");var Be=m((t,e)=>{let n=e?._def;return`${kB(t,n)}${SB(t,n)}`},"_addMetadata"),SB=m((t,e)=>!t.description||e&&e.description===t.description?"":`.describe(${ie(t.description)})`,"_maybeDescribe"),kB=m((t,e)=>`${AB(t,e)}${CB(t,e)}${OB(t,e)}${RB(t,e)}${MB(t,e)}${NB(t,e)}${DB(t,e)}`,"_addZuiExtensions"),AB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.title;return!o||e&&((r=e[mt])==null?void 0:r.title)===o?"":`.title(${ie(o)})`},"_maybeTitle"),CB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.displayAs;return!o||e&&gn((r=e[mt])==null?void 0:r.displayAs,o)?"":`.displayAs(${Pm({id:o[0],params:o[1]})})`},"_maybeDisplayAs"),OB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.disabled;return!o||e&&((r=e[mt])==null?void 0:r.disabled)===o?"":`.disabled(${o})`},"_maybeDisabled"),RB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.hidden;return!o||e&&((r=e[mt])==null?void 0:r.hidden)===o?"":`.hidden(${o})`},"_maybeHidden"),MB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.placeholder;return!o||e&&((r=e[mt])==null?void 0:r.placeholder)===o?"":`.placeholder(${ie(o)})`},"_maybePlaceholder"),NB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.secret;return!o||e&&((r=e[mt])==null?void 0:r.secret)===o?"":".secret()"},"_maybeSecret"),DB=m((t,e)=>{var n,r;let o=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],s=Object.entries((n=t[mt])!=null?n:{}).filter(([i])=>!o.includes(i));if(s.length===0)return"";if(e){let i=Object.entries((r=e[mt])!=null?r:{}).filter(([a])=>!o.includes(a));if(gn(Object.fromEntries(s),Object.fromEntries(i)))return""}return`.metadata(${Pm(Object.fromEntries(s))})`},"_maybeSetMetadata"),HB={};pe.prototype.toJSONSchema=function(){return ot(this)};pe.prototype.toTypescriptType=function(t){return Ws(this,t)};pe.prototype.toTypescriptSchema=function(){return Fs(this)};var nt=ne.string().min(1),Rm=ne.object({text:nt}),Mm=ne.object({markdown:nt}),Nm=ne.object({imageUrl:nt,title:nt.optional()}),Dm=ne.object({audioUrl:nt,title:nt.optional()}),Hm=ne.object({videoUrl:nt,title:nt.optional()}),Um=ne.object({fileUrl:nt,title:nt.optional()}),jm=ne.object({latitude:ne.number(),longitude:ne.number(),address:ne.string().optional(),title:ne.string().optional()}),$m=ne.object({title:nt,subtitle:nt.optional(),imageUrl:nt.optional(),actions:ne.array(ne.object({action:ne.enum(["postback","url","say"]),label:nt,value:nt}))}),Om=ne.object({text:nt,options:ne.array(ne.object({label:nt,value:nt}))}),UB=ne.object({items:ne.array($m)}),Zm=ne.union([ne.object({type:ne.literal("text"),payload:Rm}),ne.object({type:ne.literal("image"),payload:Nm}),ne.object({type:ne.literal("audio"),payload:Dm}),ne.object({type:ne.literal("video"),payload:Hm}),ne.object({type:ne.literal("file"),payload:Um}),ne.object({type:ne.literal("location"),payload:jm})]),jB=ne.object({items:ne.array(Zm)}),$B={schema:Mm},ZB={schema:ne.object({items:ne.array(ne.union([...Zm.options,ne.object({type:ne.literal("markdown"),payload:Mm})]))})},LB={text:{schema:Rm},image:{schema:Nm},audio:{schema:Dm},video:{schema:Hm},file:{schema:Um},location:{schema:jm},carousel:{schema:UB},card:{schema:$m},dropdown:{schema:Om},choice:{schema:Om},bloc:{schema:jB}};S();A();k();var uC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};S();A();k();import{isNode as KS}from"browser-or-node";S();A();k();var zs=console;function Mt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function bo(t,e=8072,n=qS){if(!KS)throw new Error("This function can only be called in Node.js");let o=($h(),VT(jh)).createServer(async(s,i)=>{try{let a=await WS(s);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);zs.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function WS(t){let e=await zS(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let s=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:FS(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function FS(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function zS(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function qS(t){zs.info(`Listening on port ${t}`)}import{isApiError as Oj,RuntimeError as Rj}from"@botpress/client";S();A();k();S();A();k();S();A();k();S();A();k();var je={};bn(je,{mapKeys:()=>JS,mapValues:()=>VS,mergeRecords:()=>XS,pairs:()=>wo,stripUndefinedProps:()=>YS,values:()=>GS});S();A();k();var wo=t=>Object.entries(t),GS=t=>Object.values(t),VS=(t,e)=>Object.fromEntries(wo(t).map(([n,r])=>[n,e(r,n)])),JS=(t,e)=>Object.fromEntries(wo(t).map(([n,r])=>[e(n),r])),YS=t=>Object.fromEntries(wo(t).filter(([,e])=>e!==void 0)),XS=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],s={};for(let i of o){let a=t[i],l=e[i];a&&l?s[i]=n(a,l):a?s[i]=a:l&&(s[i]=l)}return s};var ue={};bn(ue,{safePush:()=>QS,unique:()=>ek});S();A();k();var QS=(t,...e)=>t?[...t,...e]:[...e],ek=t=>Array.from(new Set(t));S();A();k();var ut={};bn(ut,{setName:()=>tk});S();A();k();var tk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Zh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:je.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=je.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),c=a.output.schema.dereference(s),f=t.actions?.[i]?.name??i;r.actions[f]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:c}},o.actions[i]={name:f}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),c=t.events?.[i]?.name??i;r.events[c]={...a,...t.events?.[i]??{},schema:l},o.events[i]={name:c}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[f,g]of Object.entries(a.messages)){let p=g.schema.dereference(s);l[f]={...g,schema:p}}let c=t.channels?.[i]?.name??i;r.channels[c]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:c}}return{resolved:r,statement:o}};S();A();k();var Lh="5.5.0";var _n=Lh;S();A();k();var xo=Symbol("schemaName"),Kh=t=>t?je.mapValues(t,(n,r)=>({...n,[xo]:r})):{},Wh=t=>xo in t&&t[xo]!==void 0,Fh=t=>t[xo];S();A();k();var Ka=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:_n}}extend(e,n){let{entities:r,actions:o,events:s,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(p=>p.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:f,statement:g}=Zh({...e,entities:r,actions:je.stripUndefinedProps(o),events:je.stripUndefinedProps(s),channels:je.stripUndefinedProps(i)});return a.actions=je.mergeRecords(a.actions??{},f.actions,this._mergeActions),a.channels=je.mergeRecords(a.channels??{},f.channels,this._mergeChannels),a.events=je.mergeRecords(a.events??{},f.events,this._mergeEvents),a.interfaces[c]={id:e.id,...g},this}_callBuilder(e,n){let o={entities:Kh(this.entities)},s=n(o),i=je.pairs(s.entities).find(([l,c])=>!Wh(c));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:je.mapValues(s.entities,l=>({name:Fh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:this._mergeObjectSchemas(e.input.schema,n.input.schema)},output:{schema:this._mergeObjectSchemas(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=je.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:s}};_mergeMessage=(e,n)=>({schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeObjectSchemas=(e,n)=>{let r=e._def,o=n._def;if(r.typeName==="ZodObject"&&o.typeName==="ZodObject"){let s=r.shape(),i=o.shape();return ne.object({...s,...i})}if(r.typeName==="ZodRecord"&&o.typeName==="ZodRecord")return ne.record(ne.intersection(r.valueType,o.valueType));throw new Error("Cannot merge object schemas with record schemas")}};S();A();k();S();A();k();import{isApiError as Ok,Client as Rk,RuntimeError as NT,InvalidPayloadError as Mk}from"@botpress/client";S();A();k();import*as zh from"@botpress/client";var Po={retries:3,retryCondition:t=>zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(rk(e.response?.headers??{})??t)*1e3},rk=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let r=t[n];if(r!==void 0)return ik(String(r))}},ik=t=>{let e=ok(t)?sk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},ok=t=>t.includes(" "),sk=t=>{let e=ak(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},ak=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};S();A();k();S();A();k();var ri=class{constructor(e){this._client=e}get _inner(){return this._client}createConversation=(e=>this._client.createConversation(e));getConversation=(e=>this._client.getConversation(e));listConversations=(e=>this._client.listConversations(e));getOrCreateConversation=(e=>this._client.getOrCreateConversation(e));updateConversation=(e=>this._client.updateConversation(e));deleteConversation=(e=>this._client.deleteConversation(e));listParticipants=(e=>this._client.listParticipants(e));addParticipant=(e=>this._client.addParticipant(e));getParticipant=(e=>this._client.getParticipant(e));removeParticipant=(e=>this._client.removeParticipant(e));createEvent=(e=>this._client.createEvent(e));getEvent=(e=>this._client.getEvent(e));listEvents=(e=>this._client.listEvents(e));createMessage=(e=>this._client.createMessage(e));getOrCreateMessage=(e=>this._client.getOrCreateMessage(e));getMessage=(e=>this._client.getMessage(e).then(n=>n));updateMessage=(e=>this._client.updateMessage(e).then(n=>n));listMessages=(e=>this._client.listMessages(e));deleteMessage=(e=>this._client.deleteMessage(e));initializeIncomingMessage=(e=>this._client.initializeIncomingMessage(e));createUser=(e=>this._client.createUser(e));getUser=(e=>this._client.getUser(e));listUsers=e=>this._client.listUsers(e);getOrCreateUser=(e=>this._client.getOrCreateUser(e));updateUser=(e=>this._client.updateUser(e));deleteUser=e=>this._client.deleteUser(e);getState=(e=>this._client.getState(e));setState=(e=>this._client.setState(e));getOrSetState=(e=>this._client.getOrSetState(e));patchState=(e=>this._client.patchState(e));configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};S();A();k();var Bo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};S();A();k();S();A();k();var Nt="#",Io="x-bot-id",qh="x-bot-user-id",Gh="x-integration-id",Vh="x-integration-alias",Jh="x-webhook-id",Yh="x-bp-configuration-type",Eo="x-bp-configuration",So="x-bp-operation",Xh="x-bp-type";S();A();k();var It=t=>{throw t instanceof Error?t:new Error(t)};var GR=ne.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Qh=t=>({botId:t[Io]||It("Missing bot header"),botUserId:t[qh]||It("Missing bot user header"),integrationId:t[Gh]||It("Missing integration header"),integrationAlias:t[Vh]||It("Missing integration alias header"),webhookId:t[Jh]||It("Missing webhook header"),operation:t[So]||It("Missing operation header"),configurationType:t[Yh]??null,configuration:JSON.parse(z.from(t[Eo]||It("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();S();A();k();S();A();k();S();A();k();var Fa={},eT=!1;function dl(){return eT||(eT=!0,Fa=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),Fa}var za={},tT=!1;function lk(){return tT||(tT=!0,za=Error),za}var qa={},nT=!1;function uk(){return nT||(nT=!0,qa=EvalError),qa}var Ga={},rT=!1;function ck(){return rT||(rT=!0,Ga=RangeError),Ga}var Va={},iT=!1;function dk(){return iT||(iT=!0,Va=ReferenceError),Va}var Ja={},oT=!1;function bT(){return oT||(oT=!0,Ja=SyntaxError),Ja}var Ya={},sT=!1;function ko(){return sT||(sT=!0,Ya=TypeError),Ya}var Xa={},aT=!1;function fk(){return aT||(aT=!0,Xa=URIError),Xa}var Qa={},lT=!1;function pk(){if(lT)return Qa;lT=!0;var t=typeof Symbol<"u"&&Symbol,e=dl();return Qa=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Qa}var el={},uT=!1;function gk(){if(uT)return el;uT=!0;var t={__proto__:null,foo:{}},e=Object;return el=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},el}var tl={},cT=!1;function mk(){if(cT)return tl;cT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,c){for(var f=[],g=0;g<l.length;g+=1)f[g]=l[g];for(var p=0;p<c.length;p+=1)f[p+l.length]=c[p];return f},s=function(l,c){for(var f=[],g=c,p=0;g<l.length;g+=1,p+=1)f[p]=l[g];return f},i=function(a,l){for(var c="",f=0;f<a.length;f+=1)c+=a[f],f+1<a.length&&(c+=l);return c};return tl=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var f=s(arguments,1),g,p=function(){if(this instanceof g){var T=c.apply(this,o(f,arguments));return Object(T)===T?T:this}return c.apply(l,o(f,arguments))},h=n(0,c.length-f.length),_=[],P=0;P<h;P++)_[P]="$"+P;if(g=Function("binder","return function ("+i(_,",")+"){ return binder.apply(this,arguments); }")(p),c.prototype){var B=function(){};B.prototype=c.prototype,g.prototype=new B,B.prototype=null}return g},tl}var nl={},dT=!1;function fl(){if(dT)return nl;dT=!0;var t=mk();return nl=Function.prototype.bind||t,nl}var rl={},fT=!1;function yk(){if(fT)return rl;fT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=fl();return rl=n.call(t,e),rl}var il={},pT=!1;function oi(){if(pT)return il;pT=!0;var t,e=lk(),n=uk(),r=ck(),o=dk(),s=bT(),i=ko(),a=fk(),l=Function,c=function(Re){try{return l('"use strict"; return ('+Re+").constructor;")()}catch{}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch{f=null}var g=function(){throw new i},p=f?(function(){try{return arguments.callee,g}catch{try{return f(arguments,"callee").get}catch{return g}}})():g,h=pk()(),_=gk()(),P=Object.getPrototypeOf||(_?function(Re){return Re.__proto__}:null),B={},T=typeof Uint8Array>"u"||!P?t:P(Uint8Array),E={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":p,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Re){var I=P(P(Re));E["%Error.prototype%"]=I}var D=function Re(ve){var we;if(ve==="%AsyncFunction%")we=c("async function () {}");else if(ve==="%GeneratorFunction%")we=c("function* () {}");else if(ve==="%AsyncGeneratorFunction%")we=c("async function* () {}");else if(ve==="%AsyncGenerator%"){var se=Re("%AsyncGeneratorFunction%");se&&(we=se.prototype)}else if(ve==="%AsyncIteratorPrototype%"){var de=Re("%AsyncGenerator%");de&&P&&(we=P(de.prototype))}return E[ve]=we,we},$={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ee=fl(),Y=yk(),ce=ee.call(Function.call,Array.prototype.concat),re=ee.call(Function.apply,Array.prototype.splice),Q=ee.call(Function.call,String.prototype.replace),Ie=ee.call(Function.call,String.prototype.slice),Le=ee.call(Function.call,RegExp.prototype.exec),Xe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Fe=/\\(\\)?/g,ze=function(ve){var we=Ie(ve,0,1),se=Ie(ve,-1);if(we==="%"&&se!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(se==="%"&&we!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var de=[];return Q(ve,Xe,function(N,Z,K,le){de[de.length]=K?Q(le,Fe,"$1"):Z||N}),de},pt=function(ve,we){var se=ve,de;if(Y($,se)&&(de=$[se],se="%"+de[0]+"%"),Y(E,se)){var N=E[se];if(N===B&&(N=D(se)),typeof N>"u"&&!we)throw new i("intrinsic "+ve+" exists, but is not available. Please file an issue!");return{alias:de,name:se,value:N}}throw new s("intrinsic "+ve+" does not exist!")};return il=function(ve,we){if(typeof ve!="string"||ve.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof we!="boolean")throw new i('"allowMissing" argument must be a boolean');if(Le(/^%?[^%]*%?$/,ve)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var se=ze(ve),de=se.length>0?se[0]:"",N=pt("%"+de+"%",we),Z=N.name,K=N.value,le=!1,ge=N.alias;ge&&(de=ge[0],re(se,ce([0,1],ge)));for(var R=1,C=!0;R<se.length;R+=1){var j=se[R],V=Ie(j,0,1),te=Ie(j,-1);if((V==='"'||V==="'"||V==="`"||te==='"'||te==="'"||te==="`")&&V!==te)throw new s("property names with quotes must have matching quotes");if((j==="constructor"||!C)&&(le=!0),de+="."+j,Z="%"+de+"%",Y(E,Z))K=E[Z];else if(K!=null){if(!(j in K)){if(!we)throw new i("base intrinsic for "+ve+" exists, but the property is not available.");return}if(f&&R+1>=se.length){var b=f(K,j);C=!!b,C&&"get"in b&&!("originalValue"in b.get)?K=b.get:K=K[j]}else C=Y(K,j),K=K[j];C&&!le&&(E[Z]=K)}}return K},il}var ol={},gT=!1;function pl(){if(gT)return ol;gT=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ol=e,ol}var sl={},mT=!1;function Ao(){if(mT)return sl;mT=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return sl=e,sl}var al={},yT=!1;function hk(){if(yT)return al;yT=!0;var t=pl(),e=bT(),n=ko(),r=Ao();return al=function(s,i,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,p=!!r&&r(s,i);if(t)t(s,i,{configurable:f===null&&p?p.configurable:!f,enumerable:l===null&&p?p.enumerable:!l,value:a,writable:c===null&&p?p.writable:!c});else if(g||!l&&!c&&!f)s[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},al}var ll={},hT=!1;function Tk(){if(hT)return ll;hT=!0;var t=pl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},ll=e,ll}var ul={},TT=!1;function vk(){if(TT)return ul;TT=!0;var t=oi(),e=hk(),n=Tk()(),r=Ao(),o=ko(),s=t("%Math.floor%");return ul=function(a,l){if(typeof a!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new o("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,g=!0;if("length"in a&&r){var p=r(a,"length");p&&!p.configurable&&(f=!1),p&&!p.writable&&(g=!1)}return(f||g||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},ul}var ii={},vT=!1;function gl(){if(vT)return ii;vT=!0;var t=fl(),e=oi(),n=vk(),r=ko(),o=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,o),a=pl(),l=e("%Math.max%");ii=function(g){if(typeof g!="function")throw new r("a function is required");var p=i(t,s,arguments);return n(p,1+l(0,g.length-(arguments.length-1)),!0)};var c=function(){return i(t,o,arguments)};return a?a(ii,"apply",{value:c}):ii.apply=c,ii}var cl={},_T=!1;function ml(){if(_T)return cl;_T=!0;var t=oi(),e=gl(),n=e(t("String.prototype.indexOf"));return cl=function(o,s){var i=t(o,!!s);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},cl}qs();ca();var yl={},wT=!1;function Il(){if(wT)return yl;wT=!0;var t=dl();return yl=function(){return t()&&!!Symbol.toStringTag},yl}var hl={},xT=!1;function _k(){if(xT)return hl;xT=!0;var t=Il()(),e=ml(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},o=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=o,hl=s?r:o,hl}var Tl={},PT=!1;function bk(){if(PT)return Tl;PT=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Il()(),o=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Tl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var c=t.call(l);return c==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var f=s();i=f?o(f):!1}return o(l)===i},Tl}var vl={},BT=!1;function wk(){if(BT)return vl;BT=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(E){E!==r&&(e=null)}else e=null;var o=/^\s*class\b/,s=function(I){try{var D=t.call(I);return o.test(D)}catch{return!1}},i=function(I){try{return s(I)?!1:(t.call(I),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",f="[object GeneratorFunction]",g="[object HTMLAllCollection]",p="[object HTML document.all class]",h="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var T=document.all;a.call(T)===a.call(document.all)&&(B=function(I){if((P||!I)&&(typeof I>"u"||typeof I=="object"))try{var D=a.call(I);return(D===g||D===p||D===h||D===l)&&I("")==null}catch{}return!1})}return vl=e?function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;try{e(I,null,n)}catch(D){if(D!==r)return!1}return!s(I)&&i(I)}:function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;if(_)return i(I);if(s(I))return!1;var D=a.call(I);return D!==c&&D!==f&&!/^\[object HTML/.test(D)?!1:i(I)},vl}var _l={},IT=!1;function xk(){if(IT)return _l;IT=!0;var t=wk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,f){for(var g=0,p=l.length;g<p;g++)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},o=function(l,c,f){for(var g=0,p=l.length;g<p;g++)f==null?c(l.charAt(g),g,l):c.call(f,l.charAt(g),g,l)},s=function(l,c,f){for(var g in l)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},i=function(l,c,f){if(!t(c))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=f),e.call(l)==="[object Array]"?r(l,c,g):typeof l=="string"?o(l,c,g):s(l,c,g)};return _l=i,_l}var bl={},ET=!1;function Pk(){return ET||(ET=!0,bl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),bl}var wl={},ST=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ik(){if(ST)return wl;ST=!0;var t=Pk(),e=typeof globalThis>"u"?Bk:globalThis;return wl=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},wl}var xl={},kT=!1,Ek=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function MT(){if(kT)return xl;kT=!0;var t=xk(),e=Ik(),n=gl(),r=ml(),o=Ao(),s=r("Object.prototype.toString"),i=Il()(),a=typeof globalThis>"u"?Ek:globalThis,l=e(),c=r("String.prototype.slice"),f=Object.getPrototypeOf,g=r("Array.prototype.indexOf",!0)||function(B,T){for(var E=0;E<B.length;E+=1)if(B[E]===T)return E;return-1},p={__proto__:null};i&&o&&f?t(l,function(P){var B=new a[P];if(Symbol.toStringTag in B){var T=f(B),E=o(T,Symbol.toStringTag);if(!E){var I=f(T);E=o(I,Symbol.toStringTag)}p["$"+P]=n(E.get)}}):t(l,function(P){var B=new a[P],T=B.slice||B.set;T&&(p["$"+P]=n(T))});var h=function(B){var T=!1;return t(p,function(E,I){if(!T)try{"$"+E(B)===I&&(T=c(I,1))}catch{}}),T},_=function(B){var T=!1;return t(p,function(E,I){if(!T)try{E(B),T=c(I,1)}catch{}}),T};return xl=function(B){if(!B||typeof B!="object")return!1;if(!i){var T=c(s(B),8,-1);return g(l,T)>-1?T:T!=="Object"?!1:_(B)}return o?h(B):null},xl}var Pl={},AT=!1;function Sk(){if(AT)return Pl;AT=!0;var t=MT();return Pl=function(n){return!!t(n)},Pl}var he={},CT=!1;function kk(){if(CT)return he;CT=!0;var t=_k(),e=bk(),n=MT(),r=Sk();function o(U){return U.call.bind(U)}var s=typeof BigInt<"u",i=typeof Symbol<"u",a=o(Object.prototype.toString),l=o(Number.prototype.valueOf),c=o(String.prototype.valueOf),f=o(Boolean.prototype.valueOf);if(s)var g=o(BigInt.prototype.valueOf);if(i)var p=o(Symbol.prototype.valueOf);function h(U,kt){if(typeof U!="object")return!1;try{return kt(U),!0}catch{return!1}}he.isArgumentsObject=t,he.isGeneratorFunction=e,he.isTypedArray=r;function _(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}he.isPromise=_;function P(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||N(U)}he.isArrayBufferView=P;function B(U){return n(U)==="Uint8Array"}he.isUint8Array=B;function T(U){return n(U)==="Uint8ClampedArray"}he.isUint8ClampedArray=T;function E(U){return n(U)==="Uint16Array"}he.isUint16Array=E;function I(U){return n(U)==="Uint32Array"}he.isUint32Array=I;function D(U){return n(U)==="Int8Array"}he.isInt8Array=D;function $(U){return n(U)==="Int16Array"}he.isInt16Array=$;function ee(U){return n(U)==="Int32Array"}he.isInt32Array=ee;function Y(U){return n(U)==="Float32Array"}he.isFloat32Array=Y;function ce(U){return n(U)==="Float64Array"}he.isFloat64Array=ce;function re(U){return n(U)==="BigInt64Array"}he.isBigInt64Array=re;function Q(U){return n(U)==="BigUint64Array"}he.isBigUint64Array=Q;function Ie(U){return a(U)==="[object Map]"}Ie.working=typeof Map<"u"&&Ie(new Map);function Le(U){return typeof Map>"u"?!1:Ie.working?Ie(U):U instanceof Map}he.isMap=Le;function Xe(U){return a(U)==="[object Set]"}Xe.working=typeof Set<"u"&&Xe(new Set);function Fe(U){return typeof Set>"u"?!1:Xe.working?Xe(U):U instanceof Set}he.isSet=Fe;function ze(U){return a(U)==="[object WeakMap]"}ze.working=typeof WeakMap<"u"&&ze(new WeakMap);function pt(U){return typeof WeakMap>"u"?!1:ze.working?ze(U):U instanceof WeakMap}he.isWeakMap=pt;function Re(U){return a(U)==="[object WeakSet]"}Re.working=typeof WeakSet<"u"&&Re(new WeakSet);function ve(U){return Re(U)}he.isWeakSet=ve;function we(U){return a(U)==="[object ArrayBuffer]"}we.working=typeof ArrayBuffer<"u"&&we(new ArrayBuffer);function se(U){return typeof ArrayBuffer>"u"?!1:we.working?we(U):U instanceof ArrayBuffer}he.isArrayBuffer=se;function de(U){return a(U)==="[object DataView]"}de.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&de(new DataView(new ArrayBuffer(1),0,1));function N(U){return typeof DataView>"u"?!1:de.working?de(U):U instanceof DataView}he.isDataView=N;var Z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function K(U){return a(U)==="[object SharedArrayBuffer]"}function le(U){return typeof Z>"u"?!1:(typeof K.working>"u"&&(K.working=K(new Z)),K.working?K(U):U instanceof Z)}he.isSharedArrayBuffer=le;function ge(U){return a(U)==="[object AsyncFunction]"}he.isAsyncFunction=ge;function R(U){return a(U)==="[object Map Iterator]"}he.isMapIterator=R;function C(U){return a(U)==="[object Set Iterator]"}he.isSetIterator=C;function j(U){return a(U)==="[object Generator]"}he.isGeneratorObject=j;function V(U){return a(U)==="[object WebAssembly.Module]"}he.isWebAssemblyCompiledModule=V;function te(U){return h(U,l)}he.isNumberObject=te;function b(U){return h(U,c)}he.isStringObject=b;function x(U){return h(U,f)}he.isBooleanObject=x;function F(U){return s&&h(U,g)}he.isBigIntObject=F;function J(U){return i&&h(U,p)}he.isSymbolObject=J;function Se(U){return te(U)||b(U)||x(U)||F(U)||J(U)}he.isBoxedPrimitive=Se;function me(U){return typeof Uint8Array<"u"&&(se(U)||le(U))}return he.isAnyArrayBuffer=me,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(U){Object.defineProperty(he,U,{enumerable:!1,value:function(){throw new Error(U+" is not supported in userland")}})}),he}var Bl={},OT=!1;function Ak(){return OT||(OT=!0,Bl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Bl}var Te={},RT=!1,si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ck(){if(RT)return Te;RT=!0;var t=Rt,e=Object.getOwnPropertyDescriptors||function(Z){for(var K=Object.keys(Z),le={},ge=0;ge<K.length;ge++)le[K[ge]]=Object.getOwnPropertyDescriptor(Z,K[ge]);return le},n=/%[sdj%]/g;Te.format=function(N){if(!$(N)){for(var Z=[],K=0;K<arguments.length;K++)Z.push(i(arguments[K]));return Z.join(" ")}for(var K=1,le=arguments,ge=le.length,R=String(N).replace(n,function(j){if(j==="%%")return"%";if(K>=ge)return j;switch(j){case"%s":return String(le[K++]);case"%d":return Number(le[K++]);case"%j":try{return JSON.stringify(le[K++])}catch{return"[Circular]"}default:return j}}),C=le[K];K<ge;C=le[++K])E(C)||!re(C)?R+=" "+C:R+=" "+i(C);return R},Te.deprecate=function(N,Z){if(typeof t<"u"&&t.noDeprecation===!0)return N;if(typeof t>"u")return function(){return Te.deprecate(N,Z).apply(this||si,arguments)};var K=!1;function le(){if(!K){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),K=!0}return N.apply(this||si,arguments)}return le};var r={},o=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}Te.debuglog=function(N){if(N=N.toUpperCase(),!r[N])if(o.test(N)){var Z=t.pid;r[N]=function(){var K=Te.format.apply(Te,arguments);console.error("%s %d: %s",N,Z,K)}}else r[N]=function(){};return r[N]};function i(N,Z){var K={seen:[],stylize:l};return arguments.length>=3&&(K.depth=arguments[2]),arguments.length>=4&&(K.colors=arguments[3]),T(Z)?K.showHidden=Z:Z&&Te._extend(K,Z),Y(K.showHidden)&&(K.showHidden=!1),Y(K.depth)&&(K.depth=2),Y(K.colors)&&(K.colors=!1),Y(K.customInspect)&&(K.customInspect=!0),K.colors&&(K.stylize=a),f(K,N,K.depth)}Te.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(N,Z){var K=i.styles[Z];return K?"\x1B["+i.colors[K][0]+"m"+N+"\x1B["+i.colors[K][1]+"m":N}function l(N,Z){return N}function c(N){var Z={};return N.forEach(function(K,le){Z[K]=!0}),Z}function f(N,Z,K){if(N.customInspect&&Z&&Le(Z.inspect)&&Z.inspect!==Te.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var le=Z.inspect(K,N);return $(le)||(le=f(N,le,K)),le}var ge=g(N,Z);if(ge)return ge;var R=Object.keys(Z),C=c(R);if(N.showHidden&&(R=Object.getOwnPropertyNames(Z)),Ie(Z)&&(R.indexOf("message")>=0||R.indexOf("description")>=0))return p(Z);if(R.length===0){if(Le(Z)){var j=Z.name?": "+Z.name:"";return N.stylize("[Function"+j+"]","special")}if(ce(Z))return N.stylize(RegExp.prototype.toString.call(Z),"regexp");if(Q(Z))return N.stylize(Date.prototype.toString.call(Z),"date");if(Ie(Z))return p(Z)}var V="",te=!1,b=["{","}"];if(B(Z)&&(te=!0,b=["[","]"]),Le(Z)){var x=Z.name?": "+Z.name:"";V=" [Function"+x+"]"}if(ce(Z)&&(V=" "+RegExp.prototype.toString.call(Z)),Q(Z)&&(V=" "+Date.prototype.toUTCString.call(Z)),Ie(Z)&&(V=" "+p(Z)),R.length===0&&(!te||Z.length==0))return b[0]+V+b[1];if(K<0)return ce(Z)?N.stylize(RegExp.prototype.toString.call(Z),"regexp"):N.stylize("[Object]","special");N.seen.push(Z);var F;return te?F=h(N,Z,K,C,R):F=R.map(function(J){return _(N,Z,K,C,J,te)}),N.seen.pop(),P(F,V,b)}function g(N,Z){if(Y(Z))return N.stylize("undefined","undefined");if($(Z)){var K="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(K,"string")}if(D(Z))return N.stylize(""+Z,"number");if(T(Z))return N.stylize(""+Z,"boolean");if(E(Z))return N.stylize("null","null")}function p(N){return"["+Error.prototype.toString.call(N)+"]"}function h(N,Z,K,le,ge){for(var R=[],C=0,j=Z.length;C<j;++C)ve(Z,String(C))?R.push(_(N,Z,K,le,String(C),!0)):R.push("");return ge.forEach(function(V){V.match(/^\d+$/)||R.push(_(N,Z,K,le,V,!0))}),R}function _(N,Z,K,le,ge,R){var C,j,V;if(V=Object.getOwnPropertyDescriptor(Z,ge)||{value:Z[ge]},V.get?V.set?j=N.stylize("[Getter/Setter]","special"):j=N.stylize("[Getter]","special"):V.set&&(j=N.stylize("[Setter]","special")),ve(le,ge)||(C="["+ge+"]"),j||(N.seen.indexOf(V.value)<0?(E(K)?j=f(N,V.value,null):j=f(N,V.value,K-1),j.indexOf(`
84
+ `).trim();case"ZodUnion":return`z.union([${e._def.options.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodDiscriminatedUnion":let i=e._def.options.map($e);return`z.discriminatedUnion(${ie(e._def.discriminator)}, [${i.join(", ")}])${Be(e._def)}`.trim();case"ZodIntersection":let l=$e(e._def.left),c=$e(e._def.right);return`z.intersection(${l}, ${c})${Be(e._def)}`.trim();case"ZodTuple":return`z.tuple([${e._def.items.map($e).join(", ")}])${Be(e._def)}`.trim();case"ZodRecord":let g=$e(e._def.keyType),p=$e(e._def.valueType);return`z.record(${g}, ${p})${Be(e._def)}`.trim();case"ZodMap":let h=$e(e._def.keyType),_=$e(e._def.valueType);return`z.map(${h}, ${_})${Be(e._def)}`.trim();case"ZodSet":return`z.set(${$e(e._def.valueType)})${BB(e._def)}${Be(e._def)}`.trim();case"ZodFunction":let P=e._def.args.items.map($e),B=P.length?`.args(${P.join(", ")})`:"",T=$e(e._def.returns);return`z.function()${B}.returns(${T})${Be(e._def)}`.trim();case"ZodLazy":return`z.lazy(() => ${$e(e._def.getter())})${Be(e._def)}`.trim();case"ZodLiteral":return`z.literal(${ie(e._def.value)})${Be(e._def)}`.trim();case"ZodEnum":return`z.enum([${e._def.values.map(ie).join(", ")}])${Be(e._def)}`.trim();case"ZodEffects":throw new Sn("ZodEffects");case"ZodNativeEnum":throw new Sn("ZodNativeEnum");case"ZodOptional":return`z.optional(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodNullable":return`z.nullable(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodDefault":let D=tr(e._def.defaultValue());return`z.default(${$e(e._def.innerType)}, ${D})${Be(e._def,e._def.innerType)}`.trim();case"ZodCatch":throw new Sn("ZodCatch");case"ZodPromise":return`z.promise(${$e(e._def.type)})${Be(e._def,e._def.type)}`.trim();case"ZodBranded":throw new Sn("ZodBranded");case"ZodPipeline":throw new Sn("ZodPipeline");case"ZodSymbol":throw new Sn("ZodSymbol");case"ZodReadonly":return`z.readonly(${$e(e._def.innerType)})${Be(e._def,e._def.innerType)}`.trim();case"ZodRef":return`z.ref(${ie(e._def.uri)})${Be(e._def)}`.trim();default:Ct.assertNever(e)}}m($e,"sUnwrapZod");var Be=m((t,e)=>{let n=e?._def;return`${kB(t,n)}${SB(t,n)}`},"_addMetadata"),SB=m((t,e)=>!t.description||e&&e.description===t.description?"":`.describe(${ie(t.description)})`,"_maybeDescribe"),kB=m((t,e)=>`${AB(t,e)}${CB(t,e)}${OB(t,e)}${RB(t,e)}${MB(t,e)}${NB(t,e)}${DB(t,e)}`,"_addZuiExtensions"),AB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.title;return!o||e&&((r=e[mt])==null?void 0:r.title)===o?"":`.title(${ie(o)})`},"_maybeTitle"),CB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.displayAs;return!o||e&&gn((r=e[mt])==null?void 0:r.displayAs,o)?"":`.displayAs(${Pm({id:o[0],params:o[1]})})`},"_maybeDisplayAs"),OB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.disabled;return!o||e&&((r=e[mt])==null?void 0:r.disabled)===o?"":`.disabled(${o})`},"_maybeDisabled"),RB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.hidden;return!o||e&&((r=e[mt])==null?void 0:r.hidden)===o?"":`.hidden(${o})`},"_maybeHidden"),MB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.placeholder;return!o||e&&((r=e[mt])==null?void 0:r.placeholder)===o?"":`.placeholder(${ie(o)})`},"_maybePlaceholder"),NB=m((t,e)=>{var n,r;let o=(n=t[mt])==null?void 0:n.secret;return!o||e&&((r=e[mt])==null?void 0:r.secret)===o?"":".secret()"},"_maybeSecret"),DB=m((t,e)=>{var n,r;let o=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],s=Object.entries((n=t[mt])!=null?n:{}).filter(([i])=>!o.includes(i));if(s.length===0)return"";if(e){let i=Object.entries((r=e[mt])!=null?r:{}).filter(([a])=>!o.includes(a));if(gn(Object.fromEntries(s),Object.fromEntries(i)))return""}return`.metadata(${Pm(Object.fromEntries(s))})`},"_maybeSetMetadata"),HB={};pe.prototype.toJSONSchema=function(){return ot(this)};pe.prototype.toTypescriptType=function(t){return Ws(this,t)};pe.prototype.toTypescriptSchema=function(){return Fs(this)};var nt=ne.string().min(1),Rm=ne.object({text:nt}),Mm=ne.object({markdown:nt}),Nm=ne.object({imageUrl:nt,title:nt.optional()}),Dm=ne.object({audioUrl:nt,title:nt.optional()}),Hm=ne.object({videoUrl:nt,title:nt.optional()}),Um=ne.object({fileUrl:nt,title:nt.optional()}),jm=ne.object({latitude:ne.number(),longitude:ne.number(),address:ne.string().optional(),title:ne.string().optional()}),$m=ne.object({title:nt,subtitle:nt.optional(),imageUrl:nt.optional(),actions:ne.array(ne.object({action:ne.enum(["postback","url","say"]),label:nt,value:nt}))}),Om=ne.object({text:nt,options:ne.array(ne.object({label:nt,value:nt}))}),UB=ne.object({items:ne.array($m)}),Zm=ne.union([ne.object({type:ne.literal("text"),payload:Rm}),ne.object({type:ne.literal("image"),payload:Nm}),ne.object({type:ne.literal("audio"),payload:Dm}),ne.object({type:ne.literal("video"),payload:Hm}),ne.object({type:ne.literal("file"),payload:Um}),ne.object({type:ne.literal("location"),payload:jm})]),jB=ne.object({items:ne.array(Zm)}),$B={schema:Mm},ZB={schema:ne.object({items:ne.array(ne.union([...Zm.options,ne.object({type:ne.literal("markdown"),payload:Mm})]))})},LB={text:{schema:Rm},image:{schema:Nm},audio:{schema:Dm},video:{schema:Hm},file:{schema:Um},location:{schema:jm},carousel:{schema:UB},card:{schema:$m},dropdown:{schema:Om},choice:{schema:Om},bloc:{schema:jB}};S();A();k();var uC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};S();A();k();import{isNode as KS}from"browser-or-node";S();A();k();var zs=console;function Mt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function bo(t,e=8072,n=qS){if(!KS)throw new Error("This function can only be called in Node.js");let o=($h(),VT(jh)).createServer(async(s,i)=>{try{let a=await WS(s);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){let l=a instanceof Error?a.message:String(a);zs.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function WS(t){let e=await zS(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let s=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:FS(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function FS(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function zS(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function qS(t){zs.info(`Listening on port ${t}`)}import{isApiError as Oj,RuntimeError as Rj}from"@botpress/client";S();A();k();S();A();k();S();A();k();S();A();k();var je={};bn(je,{mapKeys:()=>JS,mapValues:()=>VS,mergeRecords:()=>XS,pairs:()=>wo,stripUndefinedProps:()=>YS,values:()=>GS});S();A();k();var wo=t=>Object.entries(t),GS=t=>Object.values(t),VS=(t,e)=>Object.fromEntries(wo(t).map(([n,r])=>[n,e(r,n)])),JS=(t,e)=>Object.fromEntries(wo(t).map(([n,r])=>[e(n),r])),YS=t=>Object.fromEntries(wo(t).filter(([,e])=>e!==void 0)),XS=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],s={};for(let i of o){let a=t[i],l=e[i];a&&l?s[i]=n(a,l):a?s[i]=a:l&&(s[i]=l)}return s};var ue={};bn(ue,{safePush:()=>QS,unique:()=>ek});S();A();k();var QS=(t,...e)=>t?[...t,...e]:[...e],ek=t=>Array.from(new Set(t));S();A();k();var ut={};bn(ut,{setName:()=>tk});S();A();k();var tk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Zh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:je.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=je.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),c=a.output.schema.dereference(s),f=t.actions?.[i]?.name??i;r.actions[f]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:c}},o.actions[i]={name:f}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),c=t.events?.[i]?.name??i;r.events[c]={...a,...t.events?.[i]??{},schema:l},o.events[i]={name:c}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[f,g]of Object.entries(a.messages)){let p=g.schema.dereference(s);l[f]={...g,schema:p}}let c=t.channels?.[i]?.name??i;r.channels[c]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:c}}return{resolved:r,statement:o}};S();A();k();var Lh="6.0.0";var _n=Lh;S();A();k();var xo=Symbol("schemaName"),Kh=t=>t?je.mapValues(t,(n,r)=>({...n,[xo]:r})):{},Wh=t=>xo in t&&t[xo]!==void 0,Fh=t=>t[xo];S();A();k();var Ka=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:_n}}extend(e,n){let{entities:r,actions:o,events:s,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(p=>p.name),c=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:f,statement:g}=Zh({...e,entities:r,actions:je.stripUndefinedProps(o),events:je.stripUndefinedProps(s),channels:je.stripUndefinedProps(i)});return a.actions=je.mergeRecords(a.actions??{},f.actions,this._mergeActions),a.channels=je.mergeRecords(a.channels??{},f.channels,this._mergeChannels),a.events=je.mergeRecords(a.events??{},f.events,this._mergeEvents),a.interfaces[c]={id:e.id,...g},this}_callBuilder(e,n){let o={entities:Kh(this.entities)},s=n(o),i=je.pairs(s.entities).find(([l,c])=>!Wh(c));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:je.mapValues(s.entities,l=>({name:Fh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:this._mergeObjectSchemas(e.input.schema,n.input.schema)},output:{schema:this._mergeObjectSchemas(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=je.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:s}};_mergeMessage=(e,n)=>({schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeObjectSchemas=(e,n)=>{let r=e._def,o=n._def;if(r.typeName==="ZodObject"&&o.typeName==="ZodObject"){let s=r.shape(),i=o.shape();return ne.object({...s,...i})}if(r.typeName==="ZodRecord"&&o.typeName==="ZodRecord")return ne.record(ne.intersection(r.valueType,o.valueType));throw new Error("Cannot merge object schemas with record schemas")}};S();A();k();S();A();k();import{isApiError as Ok,Client as Rk,RuntimeError as NT,InvalidPayloadError as Mk}from"@botpress/client";S();A();k();import*as zh from"@botpress/client";var Po={retries:3,retryCondition:t=>zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(rk(e.response?.headers??{})??t)*1e3},rk=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let r=t[n];if(r!==void 0)return ik(String(r))}},ik=t=>{let e=ok(t)?sk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},ok=t=>t.includes(" "),sk=t=>{let e=ak(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},ak=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};S();A();k();S();A();k();var ri=class{constructor(e){this._client=e}get _inner(){return this._client}createConversation=(e=>this._client.createConversation(e));getConversation=(e=>this._client.getConversation(e));listConversations=(e=>this._client.listConversations(e));getOrCreateConversation=(e=>this._client.getOrCreateConversation(e));updateConversation=(e=>this._client.updateConversation(e));deleteConversation=(e=>this._client.deleteConversation(e));listParticipants=(e=>this._client.listParticipants(e));addParticipant=(e=>this._client.addParticipant(e));getParticipant=(e=>this._client.getParticipant(e));removeParticipant=(e=>this._client.removeParticipant(e));createEvent=(e=>this._client.createEvent(e));getEvent=(e=>this._client.getEvent(e));listEvents=(e=>this._client.listEvents(e));createMessage=(e=>this._client.createMessage(e));getOrCreateMessage=(e=>this._client.getOrCreateMessage(e));getMessage=(e=>this._client.getMessage(e).then(n=>n));updateMessage=(e=>this._client.updateMessage(e).then(n=>n));listMessages=(e=>this._client.listMessages(e));deleteMessage=(e=>this._client.deleteMessage(e));initializeIncomingMessage=(e=>this._client.initializeIncomingMessage(e));createUser=(e=>this._client.createUser(e));getUser=(e=>this._client.getUser(e));listUsers=e=>this._client.listUsers(e);getOrCreateUser=(e=>this._client.getOrCreateUser(e));updateUser=(e=>this._client.updateUser(e));deleteUser=e=>this._client.deleteUser(e);getState=(e=>this._client.getState(e));setState=(e=>this._client.setState(e));getOrSetState=(e=>this._client.getOrSetState(e));patchState=(e=>this._client.patchState(e));configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};S();A();k();var Bo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};S();A();k();S();A();k();var Nt="#",Io="x-bot-id",qh="x-bot-user-id",Gh="x-integration-id",Vh="x-integration-alias",Jh="x-webhook-id",Yh="x-bp-configuration-type",Eo="x-bp-configuration",So="x-bp-operation",Xh="x-bp-type";S();A();k();var It=t=>{throw t instanceof Error?t:new Error(t)};var GR=ne.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Qh=t=>({botId:t[Io]||It("Missing bot header"),botUserId:t[qh]||It("Missing bot user header"),integrationId:t[Gh]||It("Missing integration header"),integrationAlias:t[Vh]||It("Missing integration alias header"),webhookId:t[Jh]||It("Missing webhook header"),operation:t[So]||It("Missing operation header"),configurationType:t[Yh]??null,configuration:JSON.parse(z.from(t[Eo]||It("Missing configuration header"),"base64").toString("utf-8"))});S();A();k();S();A();k();S();A();k();S();A();k();var Fa={},eT=!1;function dl(){return eT||(eT=!0,Fa=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),Fa}var za={},tT=!1;function lk(){return tT||(tT=!0,za=Error),za}var qa={},nT=!1;function uk(){return nT||(nT=!0,qa=EvalError),qa}var Ga={},rT=!1;function ck(){return rT||(rT=!0,Ga=RangeError),Ga}var Va={},iT=!1;function dk(){return iT||(iT=!0,Va=ReferenceError),Va}var Ja={},oT=!1;function bT(){return oT||(oT=!0,Ja=SyntaxError),Ja}var Ya={},sT=!1;function ko(){return sT||(sT=!0,Ya=TypeError),Ya}var Xa={},aT=!1;function fk(){return aT||(aT=!0,Xa=URIError),Xa}var Qa={},lT=!1;function pk(){if(lT)return Qa;lT=!0;var t=typeof Symbol<"u"&&Symbol,e=dl();return Qa=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Qa}var el={},uT=!1;function gk(){if(uT)return el;uT=!0;var t={__proto__:null,foo:{}},e=Object;return el=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},el}var tl={},cT=!1;function mk(){if(cT)return tl;cT=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,c){for(var f=[],g=0;g<l.length;g+=1)f[g]=l[g];for(var p=0;p<c.length;p+=1)f[p+l.length]=c[p];return f},s=function(l,c){for(var f=[],g=c,p=0;g<l.length;g+=1,p+=1)f[p]=l[g];return f},i=function(a,l){for(var c="",f=0;f<a.length;f+=1)c+=a[f],f+1<a.length&&(c+=l);return c};return tl=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(t+c);for(var f=s(arguments,1),g,p=function(){if(this instanceof g){var T=c.apply(this,o(f,arguments));return Object(T)===T?T:this}return c.apply(l,o(f,arguments))},h=n(0,c.length-f.length),_=[],P=0;P<h;P++)_[P]="$"+P;if(g=Function("binder","return function ("+i(_,",")+"){ return binder.apply(this,arguments); }")(p),c.prototype){var B=function(){};B.prototype=c.prototype,g.prototype=new B,B.prototype=null}return g},tl}var nl={},dT=!1;function fl(){if(dT)return nl;dT=!0;var t=mk();return nl=Function.prototype.bind||t,nl}var rl={},fT=!1;function yk(){if(fT)return rl;fT=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=fl();return rl=n.call(t,e),rl}var il={},pT=!1;function oi(){if(pT)return il;pT=!0;var t,e=lk(),n=uk(),r=ck(),o=dk(),s=bT(),i=ko(),a=fk(),l=Function,c=function(Re){try{return l('"use strict"; return ('+Re+").constructor;")()}catch{}},f=Object.getOwnPropertyDescriptor;if(f)try{f({},"")}catch{f=null}var g=function(){throw new i},p=f?(function(){try{return arguments.callee,g}catch{try{return f(arguments,"callee").get}catch{return g}}})():g,h=pk()(),_=gk()(),P=Object.getPrototypeOf||(_?function(Re){return Re.__proto__}:null),B={},T=typeof Uint8Array>"u"||!P?t:P(Uint8Array),E={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":p,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Re){var I=P(P(Re));E["%Error.prototype%"]=I}var D=function Re(ve){var we;if(ve==="%AsyncFunction%")we=c("async function () {}");else if(ve==="%GeneratorFunction%")we=c("function* () {}");else if(ve==="%AsyncGeneratorFunction%")we=c("async function* () {}");else if(ve==="%AsyncGenerator%"){var se=Re("%AsyncGeneratorFunction%");se&&(we=se.prototype)}else if(ve==="%AsyncIteratorPrototype%"){var de=Re("%AsyncGenerator%");de&&P&&(we=P(de.prototype))}return E[ve]=we,we},$={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ee=fl(),Y=yk(),ce=ee.call(Function.call,Array.prototype.concat),re=ee.call(Function.apply,Array.prototype.splice),Q=ee.call(Function.call,String.prototype.replace),Ie=ee.call(Function.call,String.prototype.slice),Le=ee.call(Function.call,RegExp.prototype.exec),Xe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Fe=/\\(\\)?/g,ze=function(ve){var we=Ie(ve,0,1),se=Ie(ve,-1);if(we==="%"&&se!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(se==="%"&&we!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var de=[];return Q(ve,Xe,function(N,Z,K,le){de[de.length]=K?Q(le,Fe,"$1"):Z||N}),de},pt=function(ve,we){var se=ve,de;if(Y($,se)&&(de=$[se],se="%"+de[0]+"%"),Y(E,se)){var N=E[se];if(N===B&&(N=D(se)),typeof N>"u"&&!we)throw new i("intrinsic "+ve+" exists, but is not available. Please file an issue!");return{alias:de,name:se,value:N}}throw new s("intrinsic "+ve+" does not exist!")};return il=function(ve,we){if(typeof ve!="string"||ve.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof we!="boolean")throw new i('"allowMissing" argument must be a boolean');if(Le(/^%?[^%]*%?$/,ve)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var se=ze(ve),de=se.length>0?se[0]:"",N=pt("%"+de+"%",we),Z=N.name,K=N.value,le=!1,ge=N.alias;ge&&(de=ge[0],re(se,ce([0,1],ge)));for(var R=1,C=!0;R<se.length;R+=1){var j=se[R],V=Ie(j,0,1),te=Ie(j,-1);if((V==='"'||V==="'"||V==="`"||te==='"'||te==="'"||te==="`")&&V!==te)throw new s("property names with quotes must have matching quotes");if((j==="constructor"||!C)&&(le=!0),de+="."+j,Z="%"+de+"%",Y(E,Z))K=E[Z];else if(K!=null){if(!(j in K)){if(!we)throw new i("base intrinsic for "+ve+" exists, but the property is not available.");return}if(f&&R+1>=se.length){var b=f(K,j);C=!!b,C&&"get"in b&&!("originalValue"in b.get)?K=b.get:K=K[j]}else C=Y(K,j),K=K[j];C&&!le&&(E[Z]=K)}}return K},il}var ol={},gT=!1;function pl(){if(gT)return ol;gT=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ol=e,ol}var sl={},mT=!1;function Ao(){if(mT)return sl;mT=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return sl=e,sl}var al={},yT=!1;function hk(){if(yT)return al;yT=!0;var t=pl(),e=bT(),n=ko(),r=Ao();return al=function(s,i,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,p=!!r&&r(s,i);if(t)t(s,i,{configurable:f===null&&p?p.configurable:!f,enumerable:l===null&&p?p.enumerable:!l,value:a,writable:c===null&&p?p.writable:!c});else if(g||!l&&!c&&!f)s[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},al}var ll={},hT=!1;function Tk(){if(hT)return ll;hT=!0;var t=pl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},ll=e,ll}var ul={},TT=!1;function vk(){if(TT)return ul;TT=!0;var t=oi(),e=hk(),n=Tk()(),r=Ao(),o=ko(),s=t("%Math.floor%");return ul=function(a,l){if(typeof a!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new o("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],f=!0,g=!0;if("length"in a&&r){var p=r(a,"length");p&&!p.configurable&&(f=!1),p&&!p.writable&&(g=!1)}return(f||g||!c)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},ul}var ii={},vT=!1;function gl(){if(vT)return ii;vT=!0;var t=fl(),e=oi(),n=vk(),r=ko(),o=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,o),a=pl(),l=e("%Math.max%");ii=function(g){if(typeof g!="function")throw new r("a function is required");var p=i(t,s,arguments);return n(p,1+l(0,g.length-(arguments.length-1)),!0)};var c=function(){return i(t,o,arguments)};return a?a(ii,"apply",{value:c}):ii.apply=c,ii}var cl={},_T=!1;function ml(){if(_T)return cl;_T=!0;var t=oi(),e=gl(),n=e(t("String.prototype.indexOf"));return cl=function(o,s){var i=t(o,!!s);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},cl}qs();ca();var yl={},wT=!1;function Il(){if(wT)return yl;wT=!0;var t=dl();return yl=function(){return t()&&!!Symbol.toStringTag},yl}var hl={},xT=!1;function _k(){if(xT)return hl;xT=!0;var t=Il()(),e=ml(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},o=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=(function(){return r(arguments)})();return r.isLegacyArguments=o,hl=s?r:o,hl}var Tl={},PT=!1;function bk(){if(PT)return Tl;PT=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Il()(),o=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Tl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var c=t.call(l);return c==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var f=s();i=f?o(f):!1}return o(l)===i},Tl}var vl={},BT=!1;function wk(){if(BT)return vl;BT=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(E){E!==r&&(e=null)}else e=null;var o=/^\s*class\b/,s=function(I){try{var D=t.call(I);return o.test(D)}catch{return!1}},i=function(I){try{return s(I)?!1:(t.call(I),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",f="[object GeneratorFunction]",g="[object HTMLAllCollection]",p="[object HTML document.all class]",h="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var T=document.all;a.call(T)===a.call(document.all)&&(B=function(I){if((P||!I)&&(typeof I>"u"||typeof I=="object"))try{var D=a.call(I);return(D===g||D===p||D===h||D===l)&&I("")==null}catch{}return!1})}return vl=e?function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;try{e(I,null,n)}catch(D){if(D!==r)return!1}return!s(I)&&i(I)}:function(I){if(B(I))return!0;if(!I||typeof I!="function"&&typeof I!="object")return!1;if(_)return i(I);if(s(I))return!1;var D=a.call(I);return D!==c&&D!==f&&!/^\[object HTML/.test(D)?!1:i(I)},vl}var _l={},IT=!1;function xk(){if(IT)return _l;IT=!0;var t=wk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,f){for(var g=0,p=l.length;g<p;g++)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},o=function(l,c,f){for(var g=0,p=l.length;g<p;g++)f==null?c(l.charAt(g),g,l):c.call(f,l.charAt(g),g,l)},s=function(l,c,f){for(var g in l)n.call(l,g)&&(f==null?c(l[g],g,l):c.call(f,l[g],g,l))},i=function(l,c,f){if(!t(c))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=f),e.call(l)==="[object Array]"?r(l,c,g):typeof l=="string"?o(l,c,g):s(l,c,g)};return _l=i,_l}var bl={},ET=!1;function Pk(){return ET||(ET=!0,bl=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),bl}var wl={},ST=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ik(){if(ST)return wl;ST=!0;var t=Pk(),e=typeof globalThis>"u"?Bk:globalThis;return wl=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},wl}var xl={},kT=!1,Ek=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function MT(){if(kT)return xl;kT=!0;var t=xk(),e=Ik(),n=gl(),r=ml(),o=Ao(),s=r("Object.prototype.toString"),i=Il()(),a=typeof globalThis>"u"?Ek:globalThis,l=e(),c=r("String.prototype.slice"),f=Object.getPrototypeOf,g=r("Array.prototype.indexOf",!0)||function(B,T){for(var E=0;E<B.length;E+=1)if(B[E]===T)return E;return-1},p={__proto__:null};i&&o&&f?t(l,function(P){var B=new a[P];if(Symbol.toStringTag in B){var T=f(B),E=o(T,Symbol.toStringTag);if(!E){var I=f(T);E=o(I,Symbol.toStringTag)}p["$"+P]=n(E.get)}}):t(l,function(P){var B=new a[P],T=B.slice||B.set;T&&(p["$"+P]=n(T))});var h=function(B){var T=!1;return t(p,function(E,I){if(!T)try{"$"+E(B)===I&&(T=c(I,1))}catch{}}),T},_=function(B){var T=!1;return t(p,function(E,I){if(!T)try{E(B),T=c(I,1)}catch{}}),T};return xl=function(B){if(!B||typeof B!="object")return!1;if(!i){var T=c(s(B),8,-1);return g(l,T)>-1?T:T!=="Object"?!1:_(B)}return o?h(B):null},xl}var Pl={},AT=!1;function Sk(){if(AT)return Pl;AT=!0;var t=MT();return Pl=function(n){return!!t(n)},Pl}var he={},CT=!1;function kk(){if(CT)return he;CT=!0;var t=_k(),e=bk(),n=MT(),r=Sk();function o(U){return U.call.bind(U)}var s=typeof BigInt<"u",i=typeof Symbol<"u",a=o(Object.prototype.toString),l=o(Number.prototype.valueOf),c=o(String.prototype.valueOf),f=o(Boolean.prototype.valueOf);if(s)var g=o(BigInt.prototype.valueOf);if(i)var p=o(Symbol.prototype.valueOf);function h(U,kt){if(typeof U!="object")return!1;try{return kt(U),!0}catch{return!1}}he.isArgumentsObject=t,he.isGeneratorFunction=e,he.isTypedArray=r;function _(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}he.isPromise=_;function P(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||N(U)}he.isArrayBufferView=P;function B(U){return n(U)==="Uint8Array"}he.isUint8Array=B;function T(U){return n(U)==="Uint8ClampedArray"}he.isUint8ClampedArray=T;function E(U){return n(U)==="Uint16Array"}he.isUint16Array=E;function I(U){return n(U)==="Uint32Array"}he.isUint32Array=I;function D(U){return n(U)==="Int8Array"}he.isInt8Array=D;function $(U){return n(U)==="Int16Array"}he.isInt16Array=$;function ee(U){return n(U)==="Int32Array"}he.isInt32Array=ee;function Y(U){return n(U)==="Float32Array"}he.isFloat32Array=Y;function ce(U){return n(U)==="Float64Array"}he.isFloat64Array=ce;function re(U){return n(U)==="BigInt64Array"}he.isBigInt64Array=re;function Q(U){return n(U)==="BigUint64Array"}he.isBigUint64Array=Q;function Ie(U){return a(U)==="[object Map]"}Ie.working=typeof Map<"u"&&Ie(new Map);function Le(U){return typeof Map>"u"?!1:Ie.working?Ie(U):U instanceof Map}he.isMap=Le;function Xe(U){return a(U)==="[object Set]"}Xe.working=typeof Set<"u"&&Xe(new Set);function Fe(U){return typeof Set>"u"?!1:Xe.working?Xe(U):U instanceof Set}he.isSet=Fe;function ze(U){return a(U)==="[object WeakMap]"}ze.working=typeof WeakMap<"u"&&ze(new WeakMap);function pt(U){return typeof WeakMap>"u"?!1:ze.working?ze(U):U instanceof WeakMap}he.isWeakMap=pt;function Re(U){return a(U)==="[object WeakSet]"}Re.working=typeof WeakSet<"u"&&Re(new WeakSet);function ve(U){return Re(U)}he.isWeakSet=ve;function we(U){return a(U)==="[object ArrayBuffer]"}we.working=typeof ArrayBuffer<"u"&&we(new ArrayBuffer);function se(U){return typeof ArrayBuffer>"u"?!1:we.working?we(U):U instanceof ArrayBuffer}he.isArrayBuffer=se;function de(U){return a(U)==="[object DataView]"}de.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&de(new DataView(new ArrayBuffer(1),0,1));function N(U){return typeof DataView>"u"?!1:de.working?de(U):U instanceof DataView}he.isDataView=N;var Z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function K(U){return a(U)==="[object SharedArrayBuffer]"}function le(U){return typeof Z>"u"?!1:(typeof K.working>"u"&&(K.working=K(new Z)),K.working?K(U):U instanceof Z)}he.isSharedArrayBuffer=le;function ge(U){return a(U)==="[object AsyncFunction]"}he.isAsyncFunction=ge;function R(U){return a(U)==="[object Map Iterator]"}he.isMapIterator=R;function C(U){return a(U)==="[object Set Iterator]"}he.isSetIterator=C;function j(U){return a(U)==="[object Generator]"}he.isGeneratorObject=j;function V(U){return a(U)==="[object WebAssembly.Module]"}he.isWebAssemblyCompiledModule=V;function te(U){return h(U,l)}he.isNumberObject=te;function b(U){return h(U,c)}he.isStringObject=b;function x(U){return h(U,f)}he.isBooleanObject=x;function F(U){return s&&h(U,g)}he.isBigIntObject=F;function J(U){return i&&h(U,p)}he.isSymbolObject=J;function Se(U){return te(U)||b(U)||x(U)||F(U)||J(U)}he.isBoxedPrimitive=Se;function me(U){return typeof Uint8Array<"u"&&(se(U)||le(U))}return he.isAnyArrayBuffer=me,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(U){Object.defineProperty(he,U,{enumerable:!1,value:function(){throw new Error(U+" is not supported in userland")}})}),he}var Bl={},OT=!1;function Ak(){return OT||(OT=!0,Bl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Bl}var Te={},RT=!1,si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Ck(){if(RT)return Te;RT=!0;var t=Rt,e=Object.getOwnPropertyDescriptors||function(Z){for(var K=Object.keys(Z),le={},ge=0;ge<K.length;ge++)le[K[ge]]=Object.getOwnPropertyDescriptor(Z,K[ge]);return le},n=/%[sdj%]/g;Te.format=function(N){if(!$(N)){for(var Z=[],K=0;K<arguments.length;K++)Z.push(i(arguments[K]));return Z.join(" ")}for(var K=1,le=arguments,ge=le.length,R=String(N).replace(n,function(j){if(j==="%%")return"%";if(K>=ge)return j;switch(j){case"%s":return String(le[K++]);case"%d":return Number(le[K++]);case"%j":try{return JSON.stringify(le[K++])}catch{return"[Circular]"}default:return j}}),C=le[K];K<ge;C=le[++K])E(C)||!re(C)?R+=" "+C:R+=" "+i(C);return R},Te.deprecate=function(N,Z){if(typeof t<"u"&&t.noDeprecation===!0)return N;if(typeof t>"u")return function(){return Te.deprecate(N,Z).apply(this||si,arguments)};var K=!1;function le(){if(!K){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),K=!0}return N.apply(this||si,arguments)}return le};var r={},o=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}Te.debuglog=function(N){if(N=N.toUpperCase(),!r[N])if(o.test(N)){var Z=t.pid;r[N]=function(){var K=Te.format.apply(Te,arguments);console.error("%s %d: %s",N,Z,K)}}else r[N]=function(){};return r[N]};function i(N,Z){var K={seen:[],stylize:l};return arguments.length>=3&&(K.depth=arguments[2]),arguments.length>=4&&(K.colors=arguments[3]),T(Z)?K.showHidden=Z:Z&&Te._extend(K,Z),Y(K.showHidden)&&(K.showHidden=!1),Y(K.depth)&&(K.depth=2),Y(K.colors)&&(K.colors=!1),Y(K.customInspect)&&(K.customInspect=!0),K.colors&&(K.stylize=a),f(K,N,K.depth)}Te.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(N,Z){var K=i.styles[Z];return K?"\x1B["+i.colors[K][0]+"m"+N+"\x1B["+i.colors[K][1]+"m":N}function l(N,Z){return N}function c(N){var Z={};return N.forEach(function(K,le){Z[K]=!0}),Z}function f(N,Z,K){if(N.customInspect&&Z&&Le(Z.inspect)&&Z.inspect!==Te.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var le=Z.inspect(K,N);return $(le)||(le=f(N,le,K)),le}var ge=g(N,Z);if(ge)return ge;var R=Object.keys(Z),C=c(R);if(N.showHidden&&(R=Object.getOwnPropertyNames(Z)),Ie(Z)&&(R.indexOf("message")>=0||R.indexOf("description")>=0))return p(Z);if(R.length===0){if(Le(Z)){var j=Z.name?": "+Z.name:"";return N.stylize("[Function"+j+"]","special")}if(ce(Z))return N.stylize(RegExp.prototype.toString.call(Z),"regexp");if(Q(Z))return N.stylize(Date.prototype.toString.call(Z),"date");if(Ie(Z))return p(Z)}var V="",te=!1,b=["{","}"];if(B(Z)&&(te=!0,b=["[","]"]),Le(Z)){var x=Z.name?": "+Z.name:"";V=" [Function"+x+"]"}if(ce(Z)&&(V=" "+RegExp.prototype.toString.call(Z)),Q(Z)&&(V=" "+Date.prototype.toUTCString.call(Z)),Ie(Z)&&(V=" "+p(Z)),R.length===0&&(!te||Z.length==0))return b[0]+V+b[1];if(K<0)return ce(Z)?N.stylize(RegExp.prototype.toString.call(Z),"regexp"):N.stylize("[Object]","special");N.seen.push(Z);var F;return te?F=h(N,Z,K,C,R):F=R.map(function(J){return _(N,Z,K,C,J,te)}),N.seen.pop(),P(F,V,b)}function g(N,Z){if(Y(Z))return N.stylize("undefined","undefined");if($(Z)){var K="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(K,"string")}if(D(Z))return N.stylize(""+Z,"number");if(T(Z))return N.stylize(""+Z,"boolean");if(E(Z))return N.stylize("null","null")}function p(N){return"["+Error.prototype.toString.call(N)+"]"}function h(N,Z,K,le,ge){for(var R=[],C=0,j=Z.length;C<j;++C)ve(Z,String(C))?R.push(_(N,Z,K,le,String(C),!0)):R.push("");return ge.forEach(function(V){V.match(/^\d+$/)||R.push(_(N,Z,K,le,V,!0))}),R}function _(N,Z,K,le,ge,R){var C,j,V;if(V=Object.getOwnPropertyDescriptor(Z,ge)||{value:Z[ge]},V.get?V.set?j=N.stylize("[Getter/Setter]","special"):j=N.stylize("[Getter]","special"):V.set&&(j=N.stylize("[Setter]","special")),ve(le,ge)||(C="["+ge+"]"),j||(N.seen.indexOf(V.value)<0?(E(K)?j=f(N,V.value,null):j=f(N,V.value,K-1),j.indexOf(`
85
85
  `)>-1&&(R?j=j.split(`
86
86
  `).map(function(te){return" "+te}).join(`
87
87
  `).slice(2):j=`