@microsoft/agents-copilotstudio-client 1.6.0-beta.24.g285b02c21b → 1.6.0-beta.30.g545c41a189
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/package.json +3 -3
- package/dist/src/browser.mjs +5 -5
- package/dist/src/browser.mjs.map +4 -4
- package/dist/src/connectionSettings.js +13 -1
- package/dist/src/connectionSettings.js.map +1 -1
- package/dist/src/copilotStudioWebChat.js +7 -0
- package/dist/src/copilotStudioWebChat.js.map +1 -1
- package/package.json +3 -3
- package/src/connectionSettings.ts +14 -0
- package/src/copilotStudioWebChat.ts +9 -1
package/dist/src/browser.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var au=Object.create;var wr=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var uu=Object.getOwnPropertyNames;var du=Object.getPrototypeOf,lu=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(t&&(e=t(t=0)),e);var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ji=(t,e)=>{for(var r in e)wr(t,r,{get:e[r],enumerable:!0})},Di=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of uu(e))!lu.call(t,o)&&o!==r&&wr(t,o,{get:()=>e[o],enumerable:!(n=cu(e,o))||n.enumerable});return t};var Se=(t,e,r)=>(r=t!=null?au(du(t)):{},Di(e||!t||!t.__esModule?wr(r,"default",{value:t,enumerable:!0}):r,t)),Mi=t=>Di(wr({},"__esModule",{value:!0}),t);var oo=y(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.isPromise=no;Rr.attempt=_u;function no(t){return(typeof t=="object"||typeof t=="function")&&t!==null&&"then"in t&&typeof t.then=="function"}function _u(t){var e;let r=!1;try{let n=t.try();return no(n)?(r=!0,n.catch(o=>{var i;if(!t.catch)throw o;let s=(i=t.catch)===null||i===void 0?void 0:i.call(t,o);if(no(s))return s.then(()=>{})}).finally(t.finally)):n}catch(n){if(!t.catch)throw n;t.catch(n);return}finally{!r&&((e=t.finally)===null||e===void 0||e.call(t))}}});var Nr=y(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.MetricNames=de.SpanNames=de.SpanCategories=de.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES=void 0;de.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES="AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES";de.SpanCategories={STORAGE:["STORAGE_"],AUTHORIZATION:["AUTHORIZATION_","USER_TOKEN_CLIENT_"],AUTHENTICATION:["AUTHENTICATION_"],DIALOGS:["DIALOGS_"]};de.SpanNames={ADAPTER_PROCESS:"agents.adapter.process",ADAPTER_SEND_ACTIVITIES:"agents.adapter.send_activities",ADAPTER_UPDATE_ACTIVITY:"agents.adapter.update_activity",ADAPTER_DELETE_ACTIVITY:"agents.adapter.delete_activity",ADAPTER_CONTINUE_CONVERSATION:"agents.adapter.continue_conversation",ADAPTER_CREATE_CONNECTOR_CLIENT:"agents.adapter.create_connector_client",ADAPTER_CREATE_USER_TOKEN_CLIENT:"agents.adapter.create_user_token_client",AGENTS_APP_RUN:"agents.app.run",AGENTS_APP_ROUTE_HANDLER:"agents.app.route_handler",AGENTS_APP_BEFORE_TURN:"agents.app.before_turn",AGENTS_APP_AFTER_TURN:"agents.app.after_turn",AGENTS_APP_DOWNLOAD_FILES:"agents.app.download_files",CONNECTOR_SEND_TO_CONVERSATION:"agents.connector.send_to_conversation",CONNECTOR_REPLY_TO_ACTIVITY:"agents.connector.reply_to_activity",CONNECTOR_UPDATE_ACTIVITY:"agents.connector.update_activity",CONNECTOR_DELETE_ACTIVITY:"agents.connector.delete_activity",CONNECTOR_CREATE_CONVERSATION:"agents.connector.create_conversation",CONNECTOR_GET_CONVERSATIONS:"agents.connector.get_conversations",CONNECTOR_GET_CONVERSATION_MEMBER:"agents.connector.get_conversation_member",CONNECTOR_UPLOAD_ATTACHMENT:"agents.connector.upload_attachment",CONNECTOR_GET_ATTACHMENT:"agents.connector.get_attachment",CONNECTOR_GET_ATTACHMENT_INFO:"agents.connector.get_attachment_info",STORAGE_READ:"agents.storage.read",STORAGE_WRITE:"agents.storage.write",STORAGE_DELETE:"agents.storage.delete",AGENT_CLIENT_POST_ACTIVITY:"agents.agent_client.post_activity",AUTHENTICATION_GET_ACCESS_TOKEN:"agents.authentication.get_access_token",AUTHENTICATION_ACQUIRE_TOKEN_ON_BEHALF_OF:"agents.authentication.acquire_token_on_behalf_of",AUTHENTICATION_GET_AGENTIC_INSTANCE_TOKEN:"agents.authentication.get_agentic_instance_token",AUTHENTICATION_GET_AGENTIC_USER_TOKEN:"agents.authentication.get_agentic_user_token",AUTHORIZATION_AGENTIC_TOKEN:"agents.authorization.agentic_token",AUTHORIZATION_AZURE_BOT_TOKEN:"agents.authorization.azure_bot_token",AUTHORIZATION_AZURE_BOT_OBO_TOKEN:"agents.authorization.azure_bot_obo_token",AUTHORIZATION_AZURE_BOT_SIGNIN:"agents.authorization.azure_bot_signin",AUTHORIZATION_AZURE_BOT_SIGNOUT:"agents.authorization.azure_bot_signout",USER_TOKEN_CLIENT_GET_USER_TOKEN:"agents.user_token_client.get_user_token",USER_TOKEN_CLIENT_SIGN_OUT:"agents.user_token_client.sign_out",USER_TOKEN_CLIENT_GET_SIGN_IN_RESOURCE:"agents.user_token_client.get_sign_in_resource",USER_TOKEN_CLIENT_EXCHANGE_TOKEN:"agents.user_token_client.exchange_token",USER_TOKEN_CLIENT_GET_TOKEN_OR_SIGN_IN_RESOURCE:"agents.user_token_client.get_token_or_sign_in_resource",USER_TOKEN_CLIENT_GET_TOKEN_STATUS:"agents.user_token_client.get_token_status",USER_TOKEN_CLIENT_GET_AAD_TOKENS:"agents.user_token_client.get_aad_tokens",PROACTIVE_STORE_CONVERSATION:"agents.proactive.store_conversation",PROACTIVE_GET_CONVERSATION:"agents.proactive.get_conversation",PROACTIVE_GET_CONVERSATION_OR_THROW:"agents.proactive.get_conversation_or_throw",PROACTIVE_DELETE_CONVERSATION:"agents.proactive.delete_conversation",PROACTIVE_SEND_ACTIVITY:"agents.proactive.send_activity",PROACTIVE_CONTINUE_CONVERSATION:"agents.proactive.continue_conversation",PROACTIVE_CREATE_CONVERSATION:"agents.proactive.create_conversation",TURN_SEND_ACTIVITIES:"agents.turn.send_activities",DIALOGS_RUN:"agents.dialogs.run",DIALOGS_CONTEXT_BEGIN:"agents.dialogs.context.begin",DIALOGS_CONTEXT_CONTINUE:"agents.dialogs.context.continue",DIALOGS_CONTEXT_END:"agents.dialogs.context.end",DIALOGS_CONTEXT_REPLACE:"agents.dialogs.context.replace",DIALOGS_CONTEXT_CANCEL_ALL:"agents.dialogs.context.cancel_all",COPILOT_START_CONVERSATION:"agents.copilot_client.start_conversation",COPILOT_SEND_ACTIVITY:"agents.copilot_client.send_activity",COPILOT_POST_REQUEST:"agents.copilot_client.post_request",COPILOT_CREATE_CONNECTION:"agents.copilot_client.webchat.create_connection",COPILOT_EXECUTE_STREAMING:"agents.copilot_client.execute_streaming",COPILOT_SUBSCRIBE_ASYNC:"agents.copilot_client.subscribe_async"};de.MetricNames={ADAPTER_PROCESS_DURATION:"agents.adapter.process.duration",ACTIVITIES_RECEIVED:"agents.activities.received",ACTIVITIES_SENT:"agents.activities.sent",ACTIVITIES_UPDATED:"agents.activities.updated",ACTIVITIES_DELETED:"agents.activities.deleted",CONNECTOR_REQUESTS:"agents.connector.request.count",CONNECTOR_REQUEST_DURATION:"agents.connector.request.duration",AGENT_CLIENT_REQUESTS:"agents.agent_client.request.count",AGENT_CLIENT_REQUEST_DURATION:"agents.agent_client.request.duration",TURNS_COUNT:"agents.turn.count",TURNS_ERRORS:"agents.turn.error.count",TURN_DURATION:"agents.turn.duration",DIALOGS_CONTEXT_COUNT:"agents.dialogs.context.count",DIALOGS_CONTEXT_DURATION:"agents.dialogs.context.duration",STORAGE_OPERATION_DURATION:"agents.storage.operation.duration",AUTH_TOKEN_REQUEST_COUNT:"agents.auth.token.request.count",AUTH_TOKEN_DURATION:"agents.auth.token.duration",USER_TOKEN_CLIENT_REQUESTS:"agents.user_token_client.request.count",USER_TOKEN_CLIENT_REQUEST_DURATION:"agents.user_token_client.request.duration",PROACTIVE_OPERATION_COUNT:"agents.proactive.operation.count",PROACTIVE_OPERATION_DURATION:"agents.proactive.operation.duration",CSC_ACTIVITIES_RECEIVED:"agents.copilot_client.activities.received",CSC_ACTIVITIES_SENT:"agents.copilot_client.activities.sent",CSC_CONVERSATIONS_STARTED:"agents.copilot_client.conversations.started",CSC_WEBCHAT_CONNECTIONS:"agents.copilot_client.webchat.connection.count",CSC_REQUEST_COUNT:"agents.copilot_client.request.count",CSC_REQUEST_ERRORS:"agents.copilot_client.request.error.count",CSC_STREAM_DURATION:"agents.copilot_client.stream.duration",CSC_REQUEST_DURATION:"agents.copilot_client.request.duration",CSC_EXECUTE_STREAMING:"agents.copilot_client.execute_streaming.count",CSC_SUBSCRIBE_ASYNC:"agents.copilot_client.subscribe_async.count",CSC_SUBSCRIBE_EVENT:"agents.copilot_client.subscribe_event.count"}});var qi=y((rm,zi)=>{var ft=1e3,mt=ft*60,ht=mt*60,Ve=ht*24,bu=Ve*7,Tu=Ve*365.25;zi.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Cu(t);if(r==="number"&&isFinite(t))return e.long?Iu(t):xu(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Cu(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Tu;case"weeks":case"week":case"w":return r*bu;case"days":case"day":case"d":return r*Ve;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ht;case"minutes":case"minute":case"mins":case"min":case"m":return r*mt;case"seconds":case"second":case"secs":case"sec":case"s":return r*ft;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function xu(t){var e=Math.abs(t);return e>=Ve?Math.round(t/Ve)+"d":e>=ht?Math.round(t/ht)+"h":e>=mt?Math.round(t/mt)+"m":e>=ft?Math.round(t/ft)+"s":t+"ms"}function Iu(t){var e=Math.abs(t);return e>=Ve?kr(t,e,Ve,"day"):e>=ht?kr(t,e,ht,"hour"):e>=mt?kr(t,e,mt,"minute"):e>=ft?kr(t,e,ft,"second"):t+" ms"}function kr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Gi=y((nm,Fi)=>{function Eu(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=o,r.enabled=a,r.humanize=qi(),r.destroy=l,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let g=0;for(let T=0;T<p.length;T++)g=(g<<5)-g+p.charCodeAt(T),g|=0;return r.colors[Math.abs(g)%r.colors.length]}r.selectColor=e;function r(p){let g,T=null,E,M;function h(...w){if(!h.enabled)return;let b=h,P=Number(new Date),O=P-(g||P);b.diff=O,b.prev=g,b.curr=P,g=P,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let N=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(j,_e)=>{if(j==="%%")return"%";N++;let J=r.formatters[_e];if(typeof J=="function"){let Jt=w[N];j=J.call(b,Jt),w.splice(N,1),N--}return j}),r.formatArgs.call(b,w),(b.log||r.log).apply(b,w)}return h.namespace=p,h.useColors=r.useColors(),h.color=r.selectColor(p),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(E!==r.namespaces&&(E=r.namespaces,M=r.enabled(p)),M),set:w=>{T=w}}),typeof r.init=="function"&&r.init(h),h}function n(p,g){let T=r(this.namespace+(typeof g=="undefined"?":":g)+p);return T.log=this.log,T}function o(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let g=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let T of g)T[0]==="-"?r.skips.push(T.slice(1)):r.names.push(T)}function i(p,g){let T=0,E=0,M=-1,h=0;for(;T<p.length;)if(E<g.length&&(g[E]===p[T]||g[E]==="*"))g[E]==="*"?(M=E,h=T,E++):(T++,E++);else if(M!==-1)E=M+1,h++,T=h;else return!1;for(;E<g.length&&g[E]==="*";)E++;return E===g.length}function s(){let p=[...r.names,...r.skips.map(g=>"-"+g)].join(",");return r.enable(""),p}function a(p){for(let g of r.skips)if(i(p,g))return!1;for(let g of r.names)if(i(p,g))return!0;return!1}function c(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Fi.exports=Eu});var $i=y((B,Zr)=>{B.formatArgs=Su;B.save=wu;B.load=Ou;B.useColors=Au;B.storage=Pu();B.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();B.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Au(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Su(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Zr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}B.log=console.debug||console.log||(()=>{});function wu(t){try{t?B.storage.setItem("debug",t):B.storage.removeItem("debug")}catch{}}function Ou(){let t;try{t=B.storage.getItem("debug")||B.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Pu(){try{return localStorage}catch{}}Zr.exports=Gi()(B);var{formatters:Ru}=Zr.exports;Ru.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var io=y(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.isBrowser=void 0;Ur.isBrowser=typeof window!="undefined"&&typeof window.document!="undefined"});var Bi=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.levels=void 0;jr.levels=["info","warn","error","debug"]});var so=y(gt=>{"use strict";var Nu=gt&>.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gt,"__esModule",{value:!0});gt.createDebugLogger=ju;gt.link=Du;var ku=Nu($i()),Zu=io(),Uu=Bi();function ju(t){return{info:Dr(t,"info"),warn:Dr(t,"warn"),error:Dr(t,"error"),debug:Dr(t,"debug")}}var Wi={node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}};function Dr(t,e){let r=(0,ku.default)(`${t}:${e}`);return Zu.isBrowser?r.color=Wi.browser[e]:r.color=Wi.node[e],r}function Du(t,...e){return Uu.levels.reduce((r,n)=>(r[n]=(o,...i)=>{if(t[n].enabled){t[n](o,...i);for(let s of e)s[n](o,...i)}},r),{})}});var Hi=y(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.getSetting=Lu;var Mu=io();function Lu(t){var e,r;if(Mu.isBrowser)try{return(e=window.localStorage.getItem(t))!==null&&e!==void 0?e:""}catch{}else return(r=process.env[t])!==null&&r!==void 0?r:"";return""}});var Yi=y(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.isSpanDisabled=qu;var nr=Nr(),Vu=so(),zu=Hi(),co=(0,Vu.createDebugLogger)("agents:telemetry"),Ki=(()=>{let t=(0,zu.getSetting)(nr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES).trim().toUpperCase();if(!t)return[];let e=t.split(/[\s,]+/).map(i=>i.trim()).filter(Boolean),r=Object.entries(nr.SpanNames),n=new Set,o=[];for(let i of e){let s=nr.SpanCategories[i];if(!s){co.warn(`Invalid span category "${i}" in ${nr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES}. Valid categories are: ${Object.keys(nr.SpanCategories).join(", ")}`);continue}for(let a of s)if(!n.has(a)){n.add(a);for(let[c,l]of r)c.startsWith(a)&&o.push(l)}}return o.length>0&&co.debug("Disabled Span names:",o),o})();function qu(t){if(Ki.length===0)return!1;let e=Ki.includes(t);return co.debug(`Span "${t}" disabled:`,e),e}});var lo=y(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.noopTrace=void 0;ze.noopMetric=Fu;ze.noopContext=Xi;var or=()=>{};ze.noopTrace=function(t,e){return Xi(e)};ze.noopTrace.define=t=>t;function Fu(){return{histogram:()=>({record:or}),counter:()=>({add:or})}}function Xi(t){let e=new Proxy({},{get:()=>or}),r={record:or,actions:e};return t?t(r):{record:r.record,actions:r.actions,end:or,fail(o){return o}}}});var es=y(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.traceFactory=Hu;var Gu=oo(),$u=Yi(),Bu=Nr(),Wu=lo();function Hu(t){let e=new Set(Object.values(Bu.SpanNames)),r=t.trace.getTracer("@microsoft/agents-telemetry"),n=function(i,s){if(!i)throw new Error("Trace definition is required");if(!e.has(i.name))throw new Error(`Unrecognized span name "${i.name}". See SpanNames constants.`);if((0,$u.isSpanDisabled)(i.name))return(0,Wu.noopContext)(s);let a=Ku(i);if(!s){let c=r.startSpan(i.name),l=Ji(t,i,c,a);return{record:l.record,actions:l.actions,fail:l.fail,end:l.end}}return r.startActiveSpan(i.name,c=>{let l=Ji(t,i,c,a);return(0,Gu.attempt)({try:()=>s({record:l.record,actions:l.actions}),catch:p=>{throw l.fail(p)},finally:l.end})})};return n.define=o=>o,n}function Ku(t){let e=t.record?{...t.record}:{};return{set(r){Object.assign(e,r)},get(){return e}}}function Ji(t,e,r,n){var o,i;let s=performance.now(),a=!1,c;return{record:n.set,actions:(i=(o=e.actions)===null||o===void 0?void 0:o.call(e,{span:r}))!==null&&i!==void 0?i:{},fail(l){return c=l,l},end(){if(!(a||!t)){a=!0,c===void 0?r.setStatus({code:t.SpanStatusCode.OK}):Qi(t,r,c);try{e.end({span:r,record:n.get(),duration:performance.now()-s,error:c})}catch(l){Qi(t,r,l)}finally{r.end()}}}}}function Qi(t,e,r){let n;r instanceof Error?(n=r.message,e.recordException(r)):(n=String(r),e.recordException({name:typeof r,message:n})),e.setStatus({code:t.SpanStatusCode.ERROR,message:n})}});var ts=y(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.metricFactory=Yu;function Yu(t){let e=t.metrics.getMeter("@microsoft/agents-telemetry");return{histogram:e.createHistogram.bind(e),counter:e.createCounter.bind(e)}}});var rs=y(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.createOTelLogger=Xu;function Xu(t,e){return{info:Mr(t,e,"info"),warn:Mr(t,e,"warn"),error:Mr(t,e,"error"),debug:Mr(t,e,"debug")}}function Mr(t,e,r){var n;let o=t.logs.getLogger(e),i=(n=r==null?void 0:r.toLowerCase())!==null&&n!==void 0?n:"debug",s={debug:t.SeverityNumber.DEBUG,info:t.SeverityNumber.INFO,warn:t.SeverityNumber.WARN,error:t.SeverityNumber.ERROR}[i];return function(c,...l){o.emit({severityNumber:s,severityText:i.toUpperCase(),body:Ju(c,l),attributes:{"log.namespace":e,"log.level":i}})}}function Ju(t,e){if(e.length===0)return t;let r=e.map(n=>Qu(n)).join(" ");return`${t} ${r}`}function Qu(t){if(t instanceof Error)return`${t.name}: ${t.message}`;if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);try{return JSON.stringify(t)}catch{return String(t)}}});var as=y(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.index=nd;var ed=es(),td=ts(),Vr=so(),rd=rs(),Lr=oo(),ns=Nr(),os=lo(),is=(0,Vr.createDebugLogger)("agents:telemetry");function nd(t){let e=(0,Lr.attempt)({try:()=>t.otel(),catch:()=>is.warn("OpenTelemetry API not found. Install @opentelemetry/api as a dependency to enable tracing and metrics.")}),r=(0,Lr.attempt)({try:()=>t.logs(),catch:()=>is.warn("OpenTelemetry API Logs not found. Install @opentelemetry/api-logs as a dependency to enable OTel logging.")});return(0,Lr.isPromise)(e)||(0,Lr.isPromise)(r)?Promise.all([e,r]).then(([n,o])=>ss(n,o)):ss(e,r)}function ss(t,e){return{SpanNames:ns.SpanNames,MetricNames:ns.MetricNames,debug:e?r=>(0,Vr.link)((0,Vr.createDebugLogger)(r),(0,rd.createOTelLogger)(e,r)):Vr.createDebugLogger,trace:t?(0,ed.traceFactory)(t):os.noopTrace,metric:t?(0,td.metricFactory)(t):(0,os.noopMetric)()}}});var cs,us=I(()=>{cs=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});var ds=I(()=>{us()});var be,go=I(()=>{be="1.9.0"});function od(t){var e=new Set([t]),r=new Set,n=t.match(ls);if(!n)return function(){return!1};var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===t};function i(a){return r.add(a),!1}function s(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(r.has(c))return!1;var l=c.match(ls);if(!l)return i(c);var p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var ls,ps,fs=I(()=>{go();ls=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;ps=od(be)});function le(t,e,r,n){var o;n===void 0&&(n=!1);var i=sr[ir]=(o=sr[ir])!==null&&o!==void 0?o:{version:be};if(!n&&i[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(s.stack||s.message),!1}if(i.version!==be){var s=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+t+" does not match previously registered API v"+be);return r.error(s.stack||s.message),!1}return i[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+be+"."),!0}function Y(t){var e,r,n=(e=sr[ir])===null||e===void 0?void 0:e.version;if(!(!n||!ps(n)))return(r=sr[ir])===null||r===void 0?void 0:r[t]}function pe(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+be+".");var r=sr[ir];r&&delete r[t]}var id,ir,sr,qe=I(()=>{ds();go();fs();id=be.split(".")[0],ir=Symbol.for("opentelemetry.js.api."+id),sr=cs});function ar(t,e,r){var n=Y("diag");if(n)return r.unshift(e),n[t].apply(n,ad([],sd(r),!1))}var sd,ad,ms,hs=I(()=>{qe();sd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},ad=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},ms=(function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ar("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ar("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ar("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ar("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ar("verbose",this._namespace,e)},t})()});var z,zr=I(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(z||(z={}))});function gs(t,e){t<z.NONE?t=z.NONE:t>z.ALL&&(t=z.ALL),e=e||{};function r(n,o){var i=e[n];return typeof i=="function"&&t>=o?i.bind(e):function(){}}return{error:r("error",z.ERROR),warn:r("warn",z.WARN),info:r("info",z.INFO),debug:r("debug",z.DEBUG),verbose:r("verbose",z.VERBOSE)}}var ys=I(()=>{zr()});var cd,ud,dd,q,Fe=I(()=>{hs();ys();zr();qe();cd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},ud=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},dd="diag",q=(function(){function t(){function e(o){return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var a=Y("diag");if(a)return a[o].apply(a,ud([],cd(i),!1))}}var r=this,n=function(o,i){var s,a,c;if(i===void 0&&(i={logLevel:z.INFO}),o===r){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=l.stack)!==null&&s!==void 0?s:l.message),!1}typeof i=="number"&&(i={logLevel:i});var p=Y("diag"),g=gs((a=i.logLevel)!==null&&a!==void 0?a:z.INFO,o);if(p&&!i.suppressOverrideMessage){var T=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+T),g.warn("Current logger will overwrite one already registered from "+T)}return le("diag",g,r,!0)};r.setLogger=n,r.disable=function(){pe(dd,r)},r.createComponentLogger=function(o){return new ms(o)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})()});var ld,pd,vs,_s=I(()=>{ld=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},pd=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},vs=(function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=ld(e,2),n=r[0],o=r[1];return[n,o]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new t(this._entries);try{for(var s=pd(n),a=s.next();!a.done;a=s.next()){var c=a.value;i._entries.delete(c)}}catch(l){e={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t})()});var bs,Ts=I(()=>{bs=Symbol("BaggageEntryMetadata")});function Cs(t){return t===void 0&&(t={}),new vs(new Map(Object.entries(t)))}function xs(t){return typeof t!="string"&&(fd.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:bs,toString:function(){return t}}}var fd,yo=I(()=>{Fe();_s();Ts();fd=q.instance()});function yt(t){return Symbol.for(t)}var md,qr,cr=I(()=>{md=(function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new t(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new t(r._currentContext);return o._currentContext.delete(n),o}}return t})(),qr=new md});var vo,Is,Es=I(()=>{vo=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],Is=(function(){function t(){function e(n){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(console){var s=console[n];if(typeof s!="function"&&(s=console.log),typeof s=="function")return s.apply(console,o)}}}for(var r=0;r<vo.length;r++)this[vo[r].n]=e(vo[r].c)}return t})()});function As(){return bo}var Ge,hd,Fr,gd,yd,vd,_d,_o,bd,Td,Cd,bo,xd,Id,Ed,Ad,Sd,wd,Od,To=I(()=>{Ge=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),hd=(function(){function t(){}return t.prototype.createGauge=function(e,r){return Id},t.prototype.createHistogram=function(e,r){return Ed},t.prototype.createCounter=function(e,r){return xd},t.prototype.createUpDownCounter=function(e,r){return Ad},t.prototype.createObservableGauge=function(e,r){return wd},t.prototype.createObservableCounter=function(e,r){return Sd},t.prototype.createObservableUpDownCounter=function(e,r){return Od},t.prototype.addBatchObservableCallback=function(e,r){},t.prototype.removeBatchObservableCallback=function(e){},t})(),Fr=(function(){function t(){}return t})(),gd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})(Fr),yd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})(Fr),vd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})(Fr),_d=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})(Fr),_o=(function(){function t(){}return t.prototype.addCallback=function(e){},t.prototype.removeCallback=function(e){},t})(),bd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(_o),Td=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(_o),Cd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(_o),bo=new hd,xd=new gd,Id=new vd,Ed=new _d,Ad=new yd,Sd=new bd,wd=new Td,Od=new Cd});var Gr,Ss=I(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(Gr||(Gr={}))});var $r,Br,Co=I(()=>{$r={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},Br={set:function(t,e,r){t!=null&&(t[e]=r)}}});var Pd,Rd,ws,Os=I(()=>{cr();Pd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},Rd=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},ws=(function(){function t(){}return t.prototype.active=function(){return qr},t.prototype.with=function(e,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,Rd([n],Pd(o),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})()});var Nd,kd,xo,Zd,we,ur=I(()=>{Os();qe();Fe();Nd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},kd=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},xo="context",Zd=new ws,we=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return le(xo,e,q.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var o,i=[],s=3;s<arguments.length;s++)i[s-3]=arguments[s];return(o=this._getContextManager()).with.apply(o,kd([e,r,n],Nd(i),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return Y(xo)||Zd},t.prototype.disable=function(){this._getContextManager().disable(),pe(xo,q.instance())},t})()});var vt,Io=I(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(vt||(vt={}))});var dr,lr,Wr,Hr=I(()=>{Io();dr="0000000000000000",lr="00000000000000000000000000000000",Wr={traceId:lr,spanId:dr,traceFlags:vt.NONE}});var Oe,Kr=I(()=>{Hr();Oe=(function(){function t(e){e===void 0&&(e=Wr),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,r){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,r){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,r){},t})()});function Yr(t){return t.getValue(Eo)||void 0}function Ps(){return Yr(we.getInstance().active())}function pr(t,e){return t.setValue(Eo,e)}function Rs(t){return t.deleteValue(Eo)}function Ns(t,e){return pr(t,new Oe(e))}function Xr(t){var e;return(e=Yr(t))===null||e===void 0?void 0:e.spanContext()}var Eo,Ao=I(()=>{cr();Kr();ur();Eo=yt("OpenTelemetry Context Key SPAN")});function So(t){return Ud.test(t)&&t!==lr}function wo(t){return jd.test(t)&&t!==dr}function _t(t){return So(t.traceId)&&wo(t.spanId)}function ks(t){return new Oe(t)}var Ud,jd,Jr=I(()=>{Hr();Kr();Ud=/^([0-9a-f]{32})$/i,jd=/^[0-9a-f]{16}$/i});function Dd(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var Oo,Qr,Po=I(()=>{ur();Ao();Kr();Jr();Oo=we.getInstance(),Qr=(function(){function t(){}return t.prototype.startSpan=function(e,r,n){n===void 0&&(n=Oo.active());var o=!!(r!=null&&r.root);if(o)return new Oe;var i=n&&Xr(n);return Dd(i)&&_t(i)?new Oe(i):new Oe},t.prototype.startActiveSpan=function(e,r,n,o){var i,s,a;if(!(arguments.length<2)){arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);var c=s!=null?s:Oo.active(),l=this.startSpan(e,i,c),p=pr(c,l);return Oo.with(p,a,void 0,l)}},t})()});var Md,en,Ro=I(()=>{Po();Md=new Qr,en=(function(){function t(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}return t.prototype.startSpan=function(e,r,n){return this._getTracer().startSpan(e,r,n)},t.prototype.startActiveSpan=function(e,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Md},t})()});var Zs,Us=I(()=>{Po();Zs=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){return new Qr},t})()});var Ld,fr,No=I(()=>{Ro();Us();Ld=new Zs,fr=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){var o;return(o=this.getDelegateTracer(e,r,n))!==null&&o!==void 0?o:new en(this,e,r,n)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Ld},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,r,n)},t})()});var tn,js=I(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(tn||(tn={}))});var rn,Ds=I(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(rn||(rn={}))});var nn,Ms=I(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(nn||(nn={}))});function Ls(t){return qd.test(t)}function Vs(t){return Fd.test(t)&&!Gd.test(t)}var ko,Vd,zd,qd,Fd,Gd,zs=I(()=>{ko="[_0-9a-z-*/]",Vd="[a-z]"+ko+"{0,255}",zd="[a-z0-9]"+ko+"{0,240}@[a-z]"+ko+"{0,13}",qd=new RegExp("^(?:"+Vd+"|"+zd+")$"),Fd=/^[ -~]{0,255}[!-~]$/,Gd=/,|=/});var qs,$d,Fs,Gs,$s,Bs=I(()=>{zs();qs=32,$d=512,Fs=",",Gs="=",$s=(function(){function t(e){this._internalState=new Map,e&&this._parse(e)}return t.prototype.set=function(e,r){var n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n},t.prototype.unset=function(e){var r=this._clone();return r._internalState.delete(e),r},t.prototype.get=function(e){return this._internalState.get(e)},t.prototype.serialize=function(){var e=this;return this._keys().reduce(function(r,n){return r.push(n+Gs+e.get(n)),r},[]).join(Fs)},t.prototype._parse=function(e){e.length>$d||(this._internalState=e.split(Fs).reverse().reduce(function(r,n){var o=n.trim(),i=o.indexOf(Gs);if(i!==-1){var s=o.slice(0,i),a=o.slice(i+1,n.length);Ls(s)&&Vs(a)&&r.set(s,a)}return r},new Map),this._internalState.size>qs&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,qs))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t})()});function Ws(t){return new $s(t)}var Hs=I(()=>{Bs()});var Zo,Ks=I(()=>{ur();Zo=we.getInstance()});var Uo,Ys=I(()=>{Fe();Uo=q.instance()});var Bd,Xs,Js=I(()=>{To();Bd=(function(){function t(){}return t.prototype.getMeter=function(e,r,n){return bo},t})(),Xs=new Bd});var jo,Qs,ea=I(()=>{Js();qe();Fe();jo="metrics",Qs=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(e){return le(jo,e,q.instance())},t.prototype.getMeterProvider=function(){return Y(jo)||Xs},t.prototype.getMeter=function(e,r,n){return this.getMeterProvider().getMeter(e,r,n)},t.prototype.disable=function(){pe(jo,q.instance())},t})()});var Do,ta=I(()=>{ea();Do=Qs.getInstance()});var ra,na=I(()=>{ra=(function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t})()});function Lo(t){return t.getValue(Mo)||void 0}function oa(){return Lo(we.getInstance().active())}function ia(t,e){return t.setValue(Mo,e)}function sa(t){return t.deleteValue(Mo)}var Mo,aa=I(()=>{ur();cr();Mo=yt("OpenTelemetry Baggage Key")});var Vo,Wd,ca,ua=I(()=>{qe();na();Co();aa();yo();Fe();Vo="propagation",Wd=new ra,ca=(function(){function t(){this.createBaggage=Cs,this.getBaggage=Lo,this.getActiveBaggage=oa,this.setBaggage=ia,this.deleteBaggage=sa}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return le(Vo,e,q.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=Br),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=$r),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){pe(Vo,q.instance())},t.prototype._getGlobalPropagator=function(){return Y(Vo)||Wd},t})()});var zo,da=I(()=>{ua();zo=ca.getInstance()});var qo,la,pa=I(()=>{qe();No();Jr();Ao();Fe();qo="trace",la=(function(){function t(){this._proxyTracerProvider=new fr,this.wrapSpanContext=ks,this.isSpanContextValid=_t,this.deleteSpan=Rs,this.getSpan=Yr,this.getActiveSpan=Ps,this.getSpanContext=Xr,this.setSpan=pr,this.setSpanContext=Ns}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var r=le(qo,this._proxyTracerProvider,q.instance());return r&&this._proxyTracerProvider.setDelegate(e),r},t.prototype.getTracerProvider=function(){return Y(qo)||this._proxyTracerProvider},t.prototype.getTracer=function(e,r){return this.getTracerProvider().getTracer(e,r)},t.prototype.disable=function(){pe(qo,q.instance()),this._proxyTracerProvider=new fr},t})()});var Fo,fa=I(()=>{pa();Fo=la.getInstance()});var ma={};ji(ma,{DiagConsoleLogger:()=>Is,DiagLogLevel:()=>z,INVALID_SPANID:()=>dr,INVALID_SPAN_CONTEXT:()=>Wr,INVALID_TRACEID:()=>lr,ProxyTracer:()=>en,ProxyTracerProvider:()=>fr,ROOT_CONTEXT:()=>qr,SamplingDecision:()=>tn,SpanKind:()=>rn,SpanStatusCode:()=>nn,TraceFlags:()=>vt,ValueType:()=>Gr,baggageEntryMetadataFromString:()=>xs,context:()=>Zo,createContextKey:()=>yt,createNoopMeter:()=>As,createTraceState:()=>Ws,default:()=>Hd,defaultTextMapGetter:()=>$r,defaultTextMapSetter:()=>Br,diag:()=>Uo,isSpanContextValid:()=>_t,isValidSpanId:()=>wo,isValidTraceId:()=>So,metrics:()=>Do,propagation:()=>zo,trace:()=>Fo});var Hd,ha=I(()=>{yo();cr();Es();zr();To();Ss();Co();Ro();No();js();Ds();Ms();Io();Hs();Jr();Hr();Ks();Ys();ta();da();fa();Hd={context:Zo,diag:Uo,metrics:Do,propagation:zo,trace:Fo}});var ga=y(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.SeverityNumber=void 0;var Kd;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Kd=mr.SeverityNumber||(mr.SeverityNumber={}))});var sn=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.NOOP_LOGGER=bt.NoopLogger=void 0;var on=class{emit(e){}};bt.NoopLogger=on;bt.NOOP_LOGGER=new on});var ya=y(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.API_BACKWARDS_COMPATIBILITY_VERSION=fe.makeGetter=fe._global=fe.GLOBAL_LOGS_API_KEY=void 0;fe.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");fe._global=globalThis;function Yd(t,e,r){return n=>n===t?e:r}fe.makeGetter=Yd;fe.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Go=y(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.NOOP_LOGGER_PROVIDER=Tt.NoopLoggerProvider=void 0;var Xd=sn(),an=class{getLogger(e,r,n){return new Xd.NoopLogger}};Tt.NoopLoggerProvider=an;Tt.NOOP_LOGGER_PROVIDER=new an});var va=y(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.ProxyLogger=void 0;var Jd=sn(),$o=class{constructor(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Jd.NOOP_LOGGER}};cn.ProxyLogger=$o});var _a=y(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.ProxyLoggerProvider=void 0;var Qd=Go(),el=va(),Bo=class{getLogger(e,r,n){var o;return(o=this._getDelegateLogger(e,r,n))!==null&&o!==void 0?o:new el.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Qd.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,n)}};un.ProxyLoggerProvider=Bo});var Ta=y(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.LogsAPI=void 0;var Q=ya(),tl=Go(),ba=_a(),Wo=class t{constructor(){this._proxyLoggerProvider=new ba.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Q._global[Q.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Q._global[Q.GLOBAL_LOGS_API_KEY]=(0,Q.makeGetter)(Q.API_BACKWARDS_COMPATIBILITY_VERSION,e,tl.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Q._global[Q.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Q._global,Q.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Q._global[Q.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new ba.ProxyLoggerProvider}};dn.LogsAPI=Wo});var xa=y(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.logs=me.NoopLogger=me.NOOP_LOGGER=me.SeverityNumber=void 0;var rl=ga();Object.defineProperty(me,"SeverityNumber",{enumerable:!0,get:function(){return rl.SeverityNumber}});var Ca=sn();Object.defineProperty(me,"NOOP_LOGGER",{enumerable:!0,get:function(){return Ca.NOOP_LOGGER}});Object.defineProperty(me,"NoopLogger",{enumerable:!0,get:function(){return Ca.NoopLogger}});var nl=Ta();me.logs=nl.LogsAPI.getInstance()});var xt=y(ee=>{"use strict";var Ct;Object.defineProperty(ee,"__esModule",{value:!0});ee.metric=ee.trace=ee.debug=ee.MetricNames=ee.SpanNames=void 0;var ol=as();Ct=(0,ol.index)({otel:()=>(ha(),Mi(ma)),logs:()=>xa()}),ee.SpanNames=Ct.SpanNames,ee.MetricNames=Ct.MetricNames,ee.debug=Ct.debug,ee.trace=Ct.trace,ee.metric=Ct.metric});var yr=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Ho;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ho||(k.util=Ho={}));var wa;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(wa||(k.objectUtil=wa={}));k.ZodParsedType=Ho.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var cl=t=>{switch(typeof t){case"undefined":return k.ZodParsedType.undefined;case"string":return k.ZodParsedType.string;case"number":return Number.isNaN(t)?k.ZodParsedType.nan:k.ZodParsedType.number;case"boolean":return k.ZodParsedType.boolean;case"function":return k.ZodParsedType.function;case"bigint":return k.ZodParsedType.bigint;case"symbol":return k.ZodParsedType.symbol;case"object":return Array.isArray(t)?k.ZodParsedType.array:t===null?k.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?k.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?k.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?k.ZodParsedType.date:k.ZodParsedType.object;default:return k.ZodParsedType.unknown}};k.getParsedType=cl});var mn=y(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ZodError=Pe.quotelessJson=Pe.ZodIssueCode=void 0;var Oa=yr();Pe.ZodIssueCode=Oa.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var ul=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Pe.quotelessJson=ul;var vr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Oa.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Pe.ZodError=vr;vr.create=t=>new vr(t)});var Yo=y(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});var F=mn(),$e=yr(),dl=(t,e)=>{let r;switch(t.code){case F.ZodIssueCode.invalid_type:t.received===$e.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case F.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,$e.util.jsonStringifyReplacer)}`;break;case F.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${$e.util.joinValues(t.keys,", ")}`;break;case F.ZodIssueCode.invalid_union:r="Invalid input";break;case F.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${$e.util.joinValues(t.options)}`;break;case F.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${$e.util.joinValues(t.options)}, received '${t.received}'`;break;case F.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case F.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case F.ZodIssueCode.invalid_date:r="Invalid date";break;case F.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:$e.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case F.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case F.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case F.ZodIssueCode.custom:r="Invalid input";break;case F.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case F.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case F.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,$e.util.assertNever(t)}return{message:r}};Ko.default=dl});var hn=y(Re=>{"use strict";var ll=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.defaultErrorMap=void 0;Re.setErrorMap=pl;Re.getErrorMap=fl;var Pa=ll(Yo());Re.defaultErrorMap=Pa.default;var Ra=Pa.default;function pl(t){Ra=t}function fl(){return Ra}});var Jo=y(R=>{"use strict";var ml=R&&R.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0});R.isAsync=R.isValid=R.isDirty=R.isAborted=R.OK=R.DIRTY=R.INVALID=R.ParseStatus=R.EMPTY_PATH=R.makeIssue=void 0;R.addIssueToContext=yl;var hl=hn(),Na=ml(Yo()),gl=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};R.makeIssue=gl;R.EMPTY_PATH=[];function yl(t,e){let r=(0,hl.getErrorMap)(),n=(0,R.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Na.default?void 0:Na.default].filter(o=>!!o)});t.common.issues.push(n)}var Xo=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return R.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return R.INVALID;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}};R.ParseStatus=Xo;R.INVALID=Object.freeze({status:"aborted"});var vl=t=>({status:"dirty",value:t});R.DIRTY=vl;var _l=t=>({status:"valid",value:t});R.OK=_l;var bl=t=>t.status==="aborted";R.isAborted=bl;var Tl=t=>t.status==="dirty";R.isDirty=Tl;var Cl=t=>t.status==="valid";R.isValid=Cl;var xl=t=>typeof Promise!="undefined"&&t instanceof Promise;R.isAsync=xl});var Za=y(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0})});var ja=y(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.errorUtil=void 0;var Ua;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ua||(gn.errorUtil=Ua={}))});var Ha=y(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.discriminatedUnion=u.date=u.boolean=u.bigint=u.array=u.any=u.coerce=u.ZodFirstPartyTypeKind=u.late=u.ZodSchema=u.Schema=u.ZodReadonly=u.ZodPipeline=u.ZodBranded=u.BRAND=u.ZodNaN=u.ZodCatch=u.ZodDefault=u.ZodNullable=u.ZodOptional=u.ZodTransformer=u.ZodEffects=u.ZodPromise=u.ZodNativeEnum=u.ZodEnum=u.ZodLiteral=u.ZodLazy=u.ZodFunction=u.ZodSet=u.ZodMap=u.ZodRecord=u.ZodTuple=u.ZodIntersection=u.ZodDiscriminatedUnion=u.ZodUnion=u.ZodObject=u.ZodArray=u.ZodVoid=u.ZodNever=u.ZodUnknown=u.ZodAny=u.ZodNull=u.ZodUndefined=u.ZodSymbol=u.ZodDate=u.ZodBoolean=u.ZodBigInt=u.ZodNumber=u.ZodString=u.ZodType=void 0;u.NEVER=u.void=u.unknown=u.union=u.undefined=u.tuple=u.transformer=u.symbol=u.string=u.strictObject=u.set=u.record=u.promise=u.preprocess=u.pipeline=u.ostring=u.optional=u.onumber=u.oboolean=u.object=u.number=u.nullable=u.null=u.never=u.nativeEnum=u.nan=u.map=u.literal=u.lazy=u.intersection=u.instanceof=u.function=u.enum=u.effect=void 0;u.datetimeRegex=za;u.custom=Fa;var f=mn(),yn=hn(),v=ja(),d=Jo(),m=yr(),re=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Da=(t,e)=>{if((0,d.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new f.ZodError(t.common.issues);return this._error=r,this._error}}};function A(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,p;let{message:c}=t;return s.code==="invalid_enum_value"?{message:c!=null?c:a.defaultError}:typeof a.data=="undefined"?{message:(l=c!=null?c:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(p=c!=null?c:r)!=null?p:a.defaultError}},description:o}}var S=class{get description(){return this._def.description}_getType(e){return(0,m.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new d.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,d.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r==null?void 0:r.async)!=null?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,m.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Da(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,m.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,d.isValid)(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(o=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>(0,d.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,m.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,d.isAsync)(o)?o:Promise.resolve(o));return Da(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:f.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new X({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return te.create(this,this._def)}nullable(){return ge.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xe.create(this)}promise(){return Ze.create(this,this._def)}or(e){return Je.create([this,e],this._def)}and(e){return Qe.create(this,e,this._def)}transform(e){return new X({...A(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ot({...A(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new _r({typeName:C.ZodBranded,type:this,...A(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new it({...A(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return br.create(this,e)}readonly(){return st.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u.ZodType=S;u.Schema=S;u.ZodSchema=S;var Il=/^c[^\s-]{8,}$/i,El=/^[0-9a-z]+$/,Al=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Sl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wl=/^[a-z0-9_-]{21}$/i,Ol=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qo,kl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ul=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Dl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ml=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,La="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ll=new RegExp(`^${La}$`);function Va(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Vl(t){return new RegExp(`^${Va(t)}$`)}function za(t){let e=`${La}T${Va(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function zl(t,e){return!!((e==="v4"||!e)&&kl.test(t)||(e==="v6"||!e)&&Ul.test(t))}function ql(t,e){if(!Ol.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Fl(t,e){return!!((e==="v4"||!e)&&Zl.test(t)||(e==="v6"||!e)&&jl.test(t))}var Ne=class t extends S{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.string,received:i.parsedType}),d.INVALID}let n=new d.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Rl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"email",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qo||(Qo=new RegExp(Nl,"u")),Qo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"emoji",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Sl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"uuid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")wl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"nanoid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Il.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cuid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")El.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cuid2",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Al.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"ulid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"url",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"regex",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?za(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Ll.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Vl(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Pl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"duration",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?zl(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"ip",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ql(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"jwt",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Fl(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cidr",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Dl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"base64",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ml.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"base64url",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):m.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:f.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...v.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...v.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,v.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u.ZodString=Ne;Ne.create=t=>{var e;return new Ne({checks:[],typeName:C.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...A(t)})};function Gl(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Be=class t extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.number,received:i.parsedType}),d.INVALID}let n,o=new d.ParseStatus;for(let i of this._def.checks)i.kind==="int"?m.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Gl(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.not_finite,message:i.message}),o.dirty()):m.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&m.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};u.ZodNumber=Be;Be.create=t=>new Be({checks:[],typeName:C.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});var We=class t extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new d.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):m.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.bigint,received:r.parsedType}),d.INVALID}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u.ZodBigInt=We;We.create=t=>{var e;return new We({checks:[],typeName:C.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...A(t)})};var He=class extends S{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.boolean,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodBoolean=He;He.create=t=>new He({typeName:C.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...A(t)});var Ke=class t extends S{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.date,received:i.parsedType}),d.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_date}),d.INVALID}let n=new d.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):m.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:v.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};u.ZodDate=Ke;Ke.create=t=>new Ke({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:C.ZodDate,...A(t)});var At=class extends S{_parse(e){if(this._getType(e)!==m.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.symbol,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodSymbol=At;At.create=t=>new At({typeName:C.ZodSymbol,...A(t)});var Ye=class extends S{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.undefined,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodUndefined=Ye;Ye.create=t=>new Ye({typeName:C.ZodUndefined,...A(t)});var Xe=class extends S{_parse(e){if(this._getType(e)!==m.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.null,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodNull=Xe;Xe.create=t=>new Xe({typeName:C.ZodNull,...A(t)});var ke=class extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,d.OK)(e.data)}};u.ZodAny=ke;ke.create=t=>new ke({typeName:C.ZodAny,...A(t)});var Ce=class extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,d.OK)(e.data)}};u.ZodUnknown=Ce;Ce.create=t=>new Ce({typeName:C.ZodUnknown,...A(t)});var ie=class extends S{_parse(e){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.never,received:r.parsedType}),d.INVALID}};u.ZodNever=ie;ie.create=t=>new ie({typeName:C.ZodNever,...A(t)});var St=class extends S{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.void,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodVoid=St;St.create=t=>new St({typeName:C.ZodVoid,...A(t)});var xe=class t extends S{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==m.ZodParsedType.array)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:r.parsedType}),d.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,d.addIssueToContext)(r,{code:s?f.ZodIssueCode.too_big:f.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,d.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,d.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new re(r,s,r.path,a)))).then(s=>d.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new re(r,s,r.path,a)));return d.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:v.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:v.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};u.ZodArray=xe;xe.create=(t,e)=>new xe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...A(e)});function Et(t){if(t instanceof W){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=te.create(Et(n))}return new W({...t._def,shape:()=>e})}else return t instanceof xe?new xe({...t._def,type:Et(t.element)}):t instanceof te?te.create(Et(t.unwrap())):t instanceof ge?ge.create(Et(t.unwrap())):t instanceof he?he.create(t.items.map(e=>Et(e))):t}var W=class t extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=m.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==m.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(l,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:l.parsedType}),d.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let c=[];for(let l of s){let p=i[l],g=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new re(o,g,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof ie){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&((0,d.addIssueToContext)(o,{code:f.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let g=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new re(o,g,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let g=await p.key,T=await p.value;l.push({key:g,value:T,alwaysSet:p.alwaysSet})}return l}).then(l=>d.ParseStatus.mergeObjectSync(n,l)):d.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return v.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,c;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(c=v.errorUtil.errToObj(e).message)!=null?c:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of m.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of m.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Et(this)}partial(e){let r={};for(let n of m.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of m.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof te;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return qa(m.util.objectKeys(this.shape))}};u.ZodObject=W;W.create=(t,e)=>new W({shape:()=>t,unknownKeys:"strip",catchall:ie.create(),typeName:C.ZodObject,...A(e)});W.strictCreate=(t,e)=>new W({shape:()=>t,unknownKeys:"strict",catchall:ie.create(),typeName:C.ZodObject,...A(e)});W.lazycreate=(t,e)=>new W({shape:t,unknownKeys:"strip",catchall:ie.create(),typeName:C.ZodObject,...A(e)});var Je=class extends S{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new f.ZodError(a.ctx.common.issues));return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union,unionErrors:s}),d.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},p=c._parseSync({data:r.data,path:r.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new f.ZodError(c));return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union,unionErrors:a}),d.INVALID}}get options(){return this._def.options}};u.ZodUnion=Je;Je.create=(t,e)=>new Je({options:t,typeName:C.ZodUnion,...A(e)});var Te=t=>t instanceof et?Te(t.schema):t instanceof X?Te(t.innerType()):t instanceof tt?[t.value]:t instanceof rt?t.options:t instanceof nt?m.util.objectValues(t.enum):t instanceof ot?Te(t._def.innerType):t instanceof Ye?[void 0]:t instanceof Xe?[null]:t instanceof te?[void 0,...Te(t.unwrap())]:t instanceof ge?[null,...Te(t.unwrap())]:t instanceof _r||t instanceof st?Te(t.unwrap()):t instanceof it?Te(t._def.innerType):[],vn=class t extends S{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.object)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:r.parsedType}),d.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),d.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=Te(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...A(n)})}};u.ZodDiscriminatedUnion=vn;function ei(t,e){let r=(0,m.getParsedType)(t),n=(0,m.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===m.ZodParsedType.object&&n===m.ZodParsedType.object){let o=m.util.objectKeys(e),i=m.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=ei(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===m.ZodParsedType.array&&n===m.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],c=ei(s,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===m.ZodParsedType.date&&n===m.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Qe=class extends S{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,d.isAborted)(i)||(0,d.isAborted)(s))return d.INVALID;let a=ei(i.value,s.value);return a.valid?(((0,d.isDirty)(i)||(0,d.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_intersection_types}),d.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};u.ZodIntersection=Qe;Qe.create=(t,e,r)=>new Qe({left:t,right:e,typeName:C.ZodIntersection,...A(r)});var he=class t extends S{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.array)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:n.parsedType}),d.INVALID;if(n.data.length<this._def.items.length)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new re(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>d.ParseStatus.mergeArray(r,s)):d.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};u.ZodTuple=he;he.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:t,typeName:C.ZodTuple,rest:null,...A(e)})};var _n=class t extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.object)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:n.parsedType}),d.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new re(n,a,n.path,a)),value:s._parse(new re(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?d.ParseStatus.mergeObjectAsync(r,o):d.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof S?new t({keyType:e,valueType:r,typeName:C.ZodRecord,...A(n)}):new t({keyType:Ne.create(),valueType:e,typeName:C.ZodRecord,...A(r)})}};u.ZodRecord=_n;var wt=class extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.map)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.map,received:n.parsedType}),d.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],l)=>({key:o._parse(new re(n,a,n.path,[l,"key"])),value:i._parse(new re(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return d.INVALID;(l.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(l.value,p.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return d.INVALID;(l.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(l.value,p.value)}return{status:r.value,value:a}}}};u.ZodMap=wt;wt.create=(t,e,r)=>new wt({valueType:e,keyType:t,typeName:C.ZodMap,...A(r)});var Ot=class t extends S{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.set)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.set,received:n.parsedType}),d.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let l=new Set;for(let p of c){if(p.status==="aborted")return d.INVALID;p.status==="dirty"&&r.dirty(),l.add(p.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>i._parse(new re(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:v.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};u.ZodSet=Ot;Ot.create=(t,e)=>new Ot({valueType:t,minSize:null,maxSize:null,typeName:C.ZodSet,...A(e)});var bn=class t extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.function)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.function,received:r.parsedType}),d.INVALID;function n(a,c){return(0,d.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,yn.getErrorMap)(),yn.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_arguments,argumentsError:c}})}function o(a,c){return(0,d.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,yn.getErrorMap)(),yn.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ze){let a=this;return(0,d.OK)(async function(...c){let l=new f.ZodError([]),p=await a._def.args.parseAsync(c,i).catch(E=>{throw l.addIssue(n(c,E)),l}),g=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(g,i).catch(E=>{throw l.addIssue(o(g,E)),l})})}else{let a=this;return(0,d.OK)(function(...c){let l=a._def.args.safeParse(c,i);if(!l.success)throw new f.ZodError([n(c,l.error)]);let p=Reflect.apply(s,this,l.data),g=a._def.returns.safeParse(p,i);if(!g.success)throw new f.ZodError([o(p,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:he.create(e).rest(Ce.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||he.create([]).rest(Ce.create()),returns:r||Ce.create(),typeName:C.ZodFunction,...A(n)})}};u.ZodFunction=bn;var et=class extends S{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};u.ZodLazy=et;et.create=(t,e)=>new et({getter:t,typeName:C.ZodLazy,...A(e)});var tt=class extends S{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{received:r.data,code:f.ZodIssueCode.invalid_literal,expected:this._def.value}),d.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};u.ZodLiteral=tt;tt.create=(t,e)=>new tt({value:t,typeName:C.ZodLiteral,...A(e)});function qa(t,e){return new rt({values:t,typeName:C.ZodEnum,...A(e)})}var rt=class t extends S{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,d.addIssueToContext)(r,{expected:m.util.joinValues(n),received:r.parsedType,code:f.ZodIssueCode.invalid_type}),d.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,d.addIssueToContext)(r,{received:r.data,code:f.ZodIssueCode.invalid_enum_value,options:n}),d.INVALID}return(0,d.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};u.ZodEnum=rt;rt.create=qa;var nt=class extends S{_parse(e){let r=m.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.ZodParsedType.string&&n.parsedType!==m.ZodParsedType.number){let o=m.util.objectValues(r);return(0,d.addIssueToContext)(n,{expected:m.util.joinValues(o),received:n.parsedType,code:f.ZodIssueCode.invalid_type}),d.INVALID}if(this._cache||(this._cache=new Set(m.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=m.util.objectValues(r);return(0,d.addIssueToContext)(n,{received:n.data,code:f.ZodIssueCode.invalid_enum_value,options:o}),d.INVALID}return(0,d.OK)(e.data)}get enum(){return this._def.values}};u.ZodNativeEnum=nt;nt.create=(t,e)=>new nt({values:t,typeName:C.ZodNativeEnum,...A(e)});var Ze=class extends S{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.promise&&r.common.async===!1)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.promise,received:r.parsedType}),d.INVALID;let n=r.parsedType===m.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,d.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};u.ZodPromise=Ze;Ze.create=(t,e)=>new Ze({type:t,typeName:C.ZodPromise,...A(e)});var X=class extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{(0,d.addIssueToContext)(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return d.INVALID;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?d.INVALID:c.status==="dirty"||r.value==="dirty"?(0,d.DIRTY)(c.value):c});{if(r.value==="aborted")return d.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?d.INVALID:a.status==="dirty"||r.value==="dirty"?(0,d.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?d.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?d.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,d.isValid)(s))return d.INVALID;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>(0,d.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):d.INVALID);m.util.assertNever(o)}};u.ZodEffects=X;u.ZodTransformer=X;X.create=(t,e,r)=>new X({schema:t,typeName:C.ZodEffects,effect:e,...A(r)});X.createWithPreprocess=(t,e,r)=>new X({schema:e,effect:{type:"preprocess",transform:t},typeName:C.ZodEffects,...A(r)});var te=class extends S{_parse(e){return this._getType(e)===m.ZodParsedType.undefined?(0,d.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u.ZodOptional=te;te.create=(t,e)=>new te({innerType:t,typeName:C.ZodOptional,...A(e)});var ge=class extends S{_parse(e){return this._getType(e)===m.ZodParsedType.null?(0,d.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u.ZodNullable=ge;ge.create=(t,e)=>new ge({innerType:t,typeName:C.ZodNullable,...A(e)});var ot=class extends S{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===m.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};u.ZodDefault=ot;ot.create=(t,e)=>new ot({innerType:t,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...A(e)});var it=class extends S{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,d.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};u.ZodCatch=it;it.create=(t,e)=>new it({innerType:t,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...A(e)});var Pt=class extends S{_parse(e){if(this._getType(e)!==m.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.nan,received:n.parsedType}),d.INVALID}return{status:"valid",value:e.data}}};u.ZodNaN=Pt;Pt.create=t=>new Pt({typeName:C.ZodNaN,...A(t)});u.BRAND=Symbol("zod_brand");var _r=class extends S{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};u.ZodBranded=_r;var br=class t extends S{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?d.INVALID:i.status==="dirty"?(r.dirty(),(0,d.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?d.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:C.ZodPipeline})}};u.ZodPipeline=br;var st=class extends S{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,d.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,d.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};u.ZodReadonly=st;st.create=(t,e)=>new st({innerType:t,typeName:C.ZodReadonly,...A(e)});function Ma(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Fa(t,e={},r){return t?ke.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(c=>{var l,p;if(!c){let g=Ma(e,n),T=(p=(l=g.fatal)!=null?l:r)!=null?p:!0;o.addIssue({code:"custom",...g,fatal:T})}});if(!i){let c=Ma(e,n),l=(a=(s=c.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...c,fatal:l})}}):ke.create()}u.late={object:W.lazycreate};var C;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(C||(u.ZodFirstPartyTypeKind=C={}));var $l=(t,e={message:`Input not instance of ${t.name}`})=>Fa(r=>r instanceof t,e);u.instanceof=$l;var Ga=Ne.create;u.string=Ga;var $a=Be.create;u.number=$a;var Bl=Pt.create;u.nan=Bl;var Wl=We.create;u.bigint=Wl;var Ba=He.create;u.boolean=Ba;var Hl=Ke.create;u.date=Hl;var Kl=At.create;u.symbol=Kl;var Yl=Ye.create;u.undefined=Yl;var Xl=Xe.create;u.null=Xl;var Jl=ke.create;u.any=Jl;var Ql=Ce.create;u.unknown=Ql;var ep=ie.create;u.never=ep;var tp=St.create;u.void=tp;var rp=xe.create;u.array=rp;var np=W.create;u.object=np;var op=W.strictCreate;u.strictObject=op;var ip=Je.create;u.union=ip;var sp=vn.create;u.discriminatedUnion=sp;var ap=Qe.create;u.intersection=ap;var cp=he.create;u.tuple=cp;var up=_n.create;u.record=up;var dp=wt.create;u.map=dp;var lp=Ot.create;u.set=lp;var pp=bn.create;u.function=pp;var fp=et.create;u.lazy=fp;var mp=tt.create;u.literal=mp;var hp=rt.create;u.enum=hp;var gp=nt.create;u.nativeEnum=gp;var yp=Ze.create;u.promise=yp;var Wa=X.create;u.effect=Wa;u.transformer=Wa;var vp=te.create;u.optional=vp;var _p=ge.create;u.nullable=_p;var bp=X.createWithPreprocess;u.preprocess=bp;var Tp=br.create;u.pipeline=Tp;var Cp=()=>Ga().optional();u.ostring=Cp;var xp=()=>$a().optional();u.onumber=xp;var Ip=()=>Ba().optional();u.oboolean=Ip;u.coerce={string:(t=>Ne.create({...t,coerce:!0})),number:(t=>Be.create({...t,coerce:!0})),boolean:(t=>He.create({...t,coerce:!0})),bigint:(t=>We.create({...t,coerce:!0})),date:(t=>Ke.create({...t,coerce:!0}))};u.NEVER=d.INVALID});var ti=y(ne=>{"use strict";var Ep=ne&&ne.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Rt=ne&&ne.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ep(e,t,r)};Object.defineProperty(ne,"__esModule",{value:!0});Rt(hn(),ne);Rt(Jo(),ne);Rt(Za(),ne);Rt(yr(),ne);Rt(Ha(),ne);Rt(mn(),ne)});var Z=y(H=>{"use strict";var Ka=H&&H.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Ap=H&&H.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Sp=H&&H.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ka(e,t,r);return Ap(e,t),e},wp=H&&H.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ka(e,t,r)};Object.defineProperty(H,"__esModule",{value:!0});H.z=void 0;var Ya=Sp(ti());H.z=Ya;wp(ti(),H);H.default=Ya});var ri=y(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.actionTypesZodSchema=Nt.ActionTypes=void 0;var Op=Z(),Xa;(function(t){t.OpenUrl="openUrl",t.ImBack="imBack",t.PostBack="postBack",t.PlayAudio="playAudio",t.PlayVideo="playVideo",t.ShowImage="showImage",t.DownloadFile="downloadFile",t.Signin="signin",t.Call="call",t.MessageBack="messageBack",t.OpenApp="openApp"})(Xa||(Nt.ActionTypes=Xa={}));Nt.actionTypesZodSchema=Op.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var ni=y(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.semanticActionStateTypesZodSchema=kt.SemanticActionStateTypes=void 0;var Pp=Z(),Ja;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Ja||(kt.SemanticActionStateTypes=Ja={}));kt.semanticActionStateTypesZodSchema=Pp.z.enum(["start","continue","done"])});var oi=y(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.attachmentLayoutTypesZodSchema=Zt.AttachmentLayoutTypes=void 0;var Rp=Z(),Qa;(function(t){t.List="list",t.Carousel="carousel"})(Qa||(Zt.AttachmentLayoutTypes=Qa={}));Zt.attachmentLayoutTypesZodSchema=Rp.z.enum(["list","carousel"])});var ii=y(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.Channels=void 0;var ec;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.M365CopilotSubChannel="COPILOT",t.M365Copilot="msteams:COPILOT",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(ec||(Tn.Channels=ec={}))});var si=y(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.endOfConversationCodesZodSchema=Ut.EndOfConversationCodes=void 0;var Np=Z(),tc;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(tc||(Ut.EndOfConversationCodes=tc={}));Ut.endOfConversationCodesZodSchema=Np.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var nc=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MembershipSourceTypes=void 0;var rc;(function(t){t.Channel="channel",t.Team="team"})(rc||(Cn.MembershipSourceTypes=rc={}))});var ic=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.MembershipTypes=void 0;var oc;(function(t){t.Direct="direct",t.Transitive="transitive"})(oc||(xn.MembershipTypes=oc={}))});var Tr=y(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.roleTypeZodSchema=jt.RoleTypes=void 0;var kp=Z(),sc;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(sc||(jt.RoleTypes=sc={}));jt.roleTypeZodSchema=kp.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ac=y(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.addAIToActivity=Dt.ClientCitationIconName=void 0;Dt.ClientCitationIconName={MicrosoftWord:"Microsoft Word",MicrosoftExcel:"Microsoft Excel",MicrosoftPowerPoint:"Microsoft PowerPoint",MicrosoftOneNote:"Microsoft OneNote",MicrosoftSharePoint:"Microsoft SharePoint",MicrosoftVisio:"Microsoft Visio",MicrosoftLoop:"Microsoft Loop",MicrosoftWhiteboard:"Microsoft Whiteboard",AdobeIllustrator:"Adobe Illustrator",AdobePhotoshop:"Adobe Photoshop",AdobeInDesign:"Adobe InDesign",AdobeFlash:"Adobe Flash",Sketch:"Sketch",SourceCode:"Source Code",Image:"Image",GIF:"GIF",Video:"Video",Sound:"Sound",ZIP:"ZIP",Text:"Text",PDF:"PDF"};var Zp=(t,e,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:e,usageInfo:r};(n=t.entities)!==null&&n!==void 0||(t.entities=[]),t.entities.push(o)};Dt.addAIToActivity=Zp});var cc=y(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.adaptiveCardInvokeActionZodSchema=void 0;var at=Z();In.adaptiveCardInvokeActionZodSchema=at.z.object({type:at.z.string().min(1),id:at.z.string().optional(),verb:at.z.string().min(1),data:at.z.record(at.z.string().min(1),at.z.any())})});var uc={};ji(uc,{randomUUID:()=>Up});function Up(){return globalThis.crypto.randomUUID()}var dc=I(()=>{"use strict"});var ai=y(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.entityZodSchema=void 0;var lc=Z();En.entityZodSchema=lc.z.object({type:lc.z.string().min(1)}).passthrough()});var pc=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.semanticActionZodSchema=void 0;var Cr=Z(),jp=ai(),Dp=ni();An.semanticActionZodSchema=Cr.z.object({id:Cr.z.string().min(1),state:Cr.z.union([Dp.semanticActionStateTypesZodSchema,Cr.z.string().min(1)]),entities:Cr.z.record(jp.entityZodSchema)})});var fc=y(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.cardActionZodSchema=void 0;var ye=Z(),Mp=ri();Sn.cardActionZodSchema=ye.z.object({type:ye.z.union([Mp.actionTypesZodSchema,ye.z.string().min(1)]),title:ye.z.string().min(1),image:ye.z.string().min(1).optional(),text:ye.z.string().min(1).optional(),displayText:ye.z.string().min(1).optional(),value:ye.z.any().optional(),channelData:ye.z.unknown().optional(),imageAltText:ye.z.string().min(1).optional()})});var mc=y(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.suggestedActionsZodSchema=void 0;var wn=Z(),Lp=fc();On.suggestedActionsZodSchema=wn.z.object({to:wn.z.array(wn.z.string().min(1)),actions:wn.z.array(Lp.cardActionZodSchema)})});var ci=y(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.activityEventNamesZodSchema=Mt.ActivityEventNames=void 0;var Vp=Z(),hc;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(hc||(Mt.ActivityEventNames=hc={}));Mt.activityEventNamesZodSchema=Vp.z.enum(["ContinueConversation","CreateConversation"])});var ui=y(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.activityImportanceZodSchema=Lt.ActivityImportance=void 0;var zp=Z(),gc;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(gc||(Lt.ActivityImportance=gc={}));Lt.activityImportanceZodSchema=zp.z.enum(["low","normal","high"])});var di=y(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.activityTypesZodSchema=Vt.ActivityTypes=void 0;var qp=Z(),yc;(function(t){t.Message="message",t.ContactRelationUpdate="contactRelationUpdate",t.ConversationUpdate="conversationUpdate",t.Typing="typing",t.EndOfConversation="endOfConversation",t.Event="event",t.Invoke="invoke",t.InvokeResponse="invokeResponse",t.DeleteUserData="deleteUserData",t.MessageUpdate="messageUpdate",t.MessageDelete="messageDelete",t.InstallationUpdate="installationUpdate",t.MessageReaction="messageReaction",t.Suggestion="suggestion",t.Trace="trace",t.Handoff="handoff",t.Command="command",t.CommandResult="commandResult"})(yc||(Vt.ActivityTypes=yc={}));Vt.activityTypesZodSchema=qp.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var vc=y(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.attachmentZodSchema=void 0;var zt=Z();Pn.attachmentZodSchema=zt.z.object({contentType:zt.z.string().min(1),contentUrl:zt.z.string().min(1).optional(),content:zt.z.unknown().optional(),name:zt.z.string().min(1).optional(),thumbnailUrl:zt.z.string().min(1).optional()})});var _c=y(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.addProductInfoToActivity=ct.clearProductInfoFromActivity=void 0;var Fp=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};ct.clearProductInfoFromActivity=Fp;var Gp=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,ct.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};ct.addProductInfoToActivity=Gp});var li=y(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.channelAccountZodSchema=void 0;var se=Z(),$p=Tr();Rn.channelAccountZodSchema=se.z.object({id:se.z.string().min(1).optional(),name:se.z.string().optional(),aadObjectId:se.z.string().min(1).optional(),tenantId:se.z.string().min(1).optional(),agenticUserId:se.z.string().min(1).optional(),agenticAppId:se.z.string().min(1).optional(),agenticAppBlueprintId:se.z.string().min(1).optional(),role:se.z.union([$p.roleTypeZodSchema,se.z.string().min(1)]).optional(),properties:se.z.unknown().optional()})});var pi=y(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.conversationAccountZodSchema=void 0;var ve=Z(),Bp=Tr();Nn.conversationAccountZodSchema=ve.z.object({isGroup:ve.z.boolean().optional(),conversationType:ve.z.string().min(1).optional(),tenantId:ve.z.string().min(1).optional(),id:ve.z.string().min(1),name:ve.z.string().min(1).optional(),aadObjectId:ve.z.string().min(1).optional(),role:ve.z.union([Bp.roleTypeZodSchema,ve.z.string().min(1)]).optional(),properties:ve.z.unknown().optional()})});var Tc=y(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.conversationReferenceZodSchema=void 0;var xr=Z(),bc=li(),Wp=pi();kn.conversationReferenceZodSchema=xr.z.object({activityId:xr.z.string().min(1).optional(),user:bc.channelAccountZodSchema.optional(),locale:xr.z.string().min(1).optional(),agent:bc.channelAccountZodSchema.optional().nullable(),conversation:Wp.conversationAccountZodSchema,channelId:xr.z.string().min(1),serviceUrl:xr.z.string().min(1).optional()})});var fi=y(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.deliveryModesZodSchema=qt.DeliveryModes=void 0;var Hp=Z(),Cc;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Cc||(qt.DeliveryModes=Cc={}));qt.deliveryModesZodSchema=Hp.z.enum(["normal","notification","expectReplies","ephemeral"])});var mi=y(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.inputHintsZodSchema=Ft.InputHints=void 0;var Kp=Z(),xc;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(xc||(Ft.InputHints=xc={}));Ft.inputHintsZodSchema=Kp.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var hi=y(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.messageReactionTypesZodSchema=Gt.MessageReactionTypes=void 0;var Yp=Z(),Ic;(function(t){t.Like="like",t.PlusOne="plusOne"})(Ic||(Gt.MessageReactionTypes=Ic={}));Gt.messageReactionTypesZodSchema=Yp.z.enum(["like","plusOne"])});var Ec=y(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.messageReactionZodSchema=void 0;var gi=Z(),Xp=hi();Zn.messageReactionZodSchema=gi.z.object({type:gi.z.union([Xp.messageReactionTypesZodSchema,gi.z.string().min(1)])})});var yi=y($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.textFormatTypesZodSchema=$t.TextFormatTypes=void 0;var Jp=Z(),Ac;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Ac||($t.TextFormatTypes=Ac={}));$t.textFormatTypesZodSchema=Jp.z.enum(["markdown","plain","xml"])});var Sc=y(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.textHighlightZodSchema=void 0;var vi=Z();Un.textHighlightZodSchema=vi.z.object({text:vi.z.string().min(1),occurrence:vi.z.number()})});var _i=y(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.ExceptionHelper=void 0;var jn=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(g=>{s=s.replace(`{${g}}`,o[g])});let c=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${c}`,p=new e(l);return p.code=r.code,p.helpLink=c,n&&(p.innerException=n),p}};Dn.ExceptionHelper=jn;jn.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var bi=y(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.Errors=void 0;Mn.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"},TargetedActivityIsGroupOnly:{code:-110008,description:"Targeted activities can only be sent in a group chat or channel."}}});var Ti=y(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.ActivityTreatments=void 0;var wc;(function(t){t.Targeted="targeted"})(wc||(Ln.ActivityTreatments=wc={}))});var Uc=y(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.Activity=ut.activityZodSchema=void 0;var Qp=(dc(),Mi(uc)),_=Z(),ef=pc(),tf=mc(),Zc=ci(),rf=ui(),zn=di(),nf=vc(),of=oi(),Oc=_c(),Vn=li(),Pc=ii(),sf=pi(),af=Tc(),cf=si(),uf=fi(),df=ai(),lf=mi(),Rc=Ec(),pf=yi(),ff=Sc(),Nc=Tr(),Ie=_i(),Ee=bi(),kc=Ti();ut.activityZodSchema=_.z.object({type:_.z.union([zn.activityTypesZodSchema,_.z.string().min(1)]),text:_.z.string().optional(),id:_.z.string().min(1).optional(),channelId:_.z.string().min(1).optional(),from:Vn.channelAccountZodSchema.optional(),timestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:_.z.string().min(1).optional(),callerId:_.z.string().min(1).optional(),serviceUrl:_.z.string().min(1).optional(),conversation:sf.conversationAccountZodSchema.optional(),recipient:Vn.channelAccountZodSchema.optional(),textFormat:_.z.union([pf.textFormatTypesZodSchema,_.z.string().min(1)]).optional(),attachmentLayout:_.z.union([of.attachmentLayoutTypesZodSchema,_.z.string().min(1)]).optional(),membersAdded:_.z.array(Vn.channelAccountZodSchema).optional(),membersRemoved:_.z.array(Vn.channelAccountZodSchema).optional(),reactionsAdded:_.z.array(Rc.messageReactionZodSchema).optional(),reactionsRemoved:_.z.array(Rc.messageReactionZodSchema).optional(),topicName:_.z.string().min(1).optional(),historyDisclosed:_.z.boolean().optional(),locale:_.z.string().min(1).optional(),speak:_.z.string().min(1).optional(),inputHint:_.z.union([lf.inputHintsZodSchema,_.z.string().min(1)]).optional(),summary:_.z.string().min(1).optional(),suggestedActions:tf.suggestedActionsZodSchema.optional(),attachments:_.z.array(nf.attachmentZodSchema).optional(),entities:_.z.array(df.entityZodSchema.passthrough()).optional(),channelData:_.z.any().optional(),action:_.z.string().min(1).optional(),replyToId:_.z.string().min(1).optional(),label:_.z.string().min(1).optional(),valueType:_.z.string().min(1).optional(),value:_.z.unknown().optional(),name:_.z.union([Zc.activityEventNamesZodSchema,_.z.string().min(1)]).optional(),relatesTo:af.conversationReferenceZodSchema.optional(),code:_.z.union([cf.endOfConversationCodesZodSchema,_.z.string().min(1)]).optional(),expiration:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:_.z.union([rf.activityImportanceZodSchema,_.z.string().min(1)]).optional(),deliveryMode:_.z.union([uf.deliveryModesZodSchema,_.z.string().min(1)]).optional(),listenFor:_.z.array(_.z.string().min(1)).optional(),textHighlights:_.z.array(ff.textHighlightZodSchema).optional(),semanticAction:ef.semanticActionZodSchema.optional()});var Ci=class t{constructor(e){if(e===void 0)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.InvalidActivityTypeUndefined);if(e===null)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=ut.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,Oc.addProductInfoToActivity)(this,n):(0,Oc.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:zn.ActivityTypes.Event,name:Zc.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,Qp.randomUUID)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(n)}getAppropriateReplyToId(){if(this.type!==zn.ActivityTypes.ConversationUpdate||this.channelId!==Pc.Channels.Directline&&this.channelId!==Pc.Channels.Webchat)return this.id}getConversationReference(e){var r;if(this.recipient===null||this.recipient===void 0)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.ActivityChannelIdUndefined);let n=e!=null&&e.forceBaseChannel?(r=this.channelIdChannel)!==null&&r!==void 0?r:this.channelId:this.channelId;return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:n,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===zn.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),c=e.substring(0,n);c.length>0&&!/\s$/.test(c)&&(c+=" "),e=c+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}isTargetedActivity(){var e;return!((e=this.entities)===null||e===void 0)&&e.length?this.entities.some(r=>r.type==="activityTreatment"&&r.treatment===kc.ActivityTreatments.Targeted):!1}makeTargetedActivity(){var e,r;if(!(!((e=this.conversation)===null||e===void 0)&&e.isGroup))throw Ie.ExceptionHelper.generateException(Error,Ee.Errors.TargetedActivityIsGroupOnly);this.isTargetedActivity()||((r=this.entities)!==null&&r!==void 0||(this.entities=[]),this.entities.push({type:"activityTreatment",treatment:kc.ActivityTreatments.Targeted}))}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(e,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,e,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Nc.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Nc.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var e,r,n;return(r=(e=this.recipient)===null||e===void 0?void 0:e.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};ut.Activity=Ci});var qn=y(x=>{"use strict";var mf=x&&x.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),jc=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mf(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.ActivityErrors=x.ExceptionHelper=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=x.ActivityTypes=x.ActivityImportance=x.ActivityEventNames=x.activityZodSchema=x.Activity=x.RoleTypes=x.MembershipTypes=x.MembershipSourceTypes=x.EndOfConversationCodes=x.Channels=x.AttachmentLayoutTypes=x.SemanticActionStateTypes=x.ActionTypes=void 0;var hf=ri();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return hf.ActionTypes}});var gf=ni();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return gf.SemanticActionStateTypes}});var yf=oi();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return yf.AttachmentLayoutTypes}});var vf=ii();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return vf.Channels}});var _f=si();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return _f.EndOfConversationCodes}});var bf=nc();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return bf.MembershipSourceTypes}});var Tf=ic();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return Tf.MembershipTypes}});var Cf=Tr();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return Cf.RoleTypes}});jc(ac(),x);jc(cc(),x);var Dc=Uc();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return Dc.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return Dc.activityZodSchema}});var xf=ci();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return xf.ActivityEventNames}});var If=ui();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return If.ActivityImportance}});var Ef=di();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Ef.ActivityTypes}});var Af=fi();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return Af.DeliveryModes}});var Sf=mi();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return Sf.InputHints}});var wf=hi();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return wf.MessageReactionTypes}});var Of=yi();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return Of.TextFormatTypes}});var Pf=Ti();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return Pf.ActivityTreatments}});var Rf=_i();Object.defineProperty(x,"ExceptionHelper",{enumerable:!0,get:function(){return Rf.ExceptionHelper}});var Nf=bi();Object.defineProperty(x,"ActivityErrors",{enumerable:!0,get:function(){return Nf.Errors}})});var tr=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(tr||{});var rr=(b=>(b.Unknown="Unknown",b.Exp="Exp",b.Dev="Dev",b.Test="Test",b.Preprod="Preprod",b.FirstRelease="FirstRelease",b.Prod="Prod",b.Gov="Gov",b.High="High",b.DoD="DoD",b.Mooncake="Mooncake",b.Ex="Ex",b.Rx="Rx",b.Prv="Prv",b.Local="Local",b.GovFR="GovFR",b.Other="Other",b))(rr||{});var Jn=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},Qn=class extends Jn{constructor(e){var i,s,a;if(super(),!e)return;let r=((i=e.cloud)==null?void 0:i.trim())||"Prod",n=((s=e.copilotAgentType)==null?void 0:s.trim())||"Published",o=((a=e.authority)==null?void 0:a.trim())||"https://login.microsoftonline.com";if(!Object.values(rr).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(rr).join(", ")}`);if(!Object.values(tr).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(tr).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Kf=()=>{var t,e,r,n,o,i,s,a;return new Qn({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((s=process.env.useExperimentalEndpoint)==null?void 0:s.toLowerCase())==="true",enableDiagnostics:((a=process.env.enableDiagnostics)==null?void 0:a.toLowerCase())==="true"})};var Or=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function eo(t){}function Li(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=eo,onError:r=eo,onRetry:n=eo,onComment:o}=t,i="",s=!0,a,c="",l="";function p(h){let w=s?h.replace(/^\xEF\xBB\xBF/,""):h,[b,P]=pu(`${i}${w}`);for(let O of b)g(O);i=P,s=!1}function g(h){if(h===""){E();return}if(h.startsWith(":")){o&&o(h.slice(h.startsWith(": ")?2:1));return}let w=h.indexOf(":");if(w!==-1){let b=h.slice(0,w),P=h[w+1]===" "?2:1,O=h.slice(w+P);T(b,O,h);return}T(h,"",h)}function T(h,w,b){switch(h){case"event":l=w;break;case"data":c=`${c}${w}
|
|
2
|
-
`;break;case"id":a=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?n(parseInt(w,10)):r(new
|
|
3
|
-
`)?c.slice(0,-1):c}),a=void 0,c="",l=""}function M(h={}){i&&h.consume&&
|
|
1
|
+
var fu=Object.create;var Nr=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var hu=Object.getOwnPropertyNames;var gu=Object.getPrototypeOf,yu=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(t&&(e=t(t=0)),e);var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zi=(t,e)=>{for(var r in e)Nr(t,r,{get:e[r],enumerable:!0})},qi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of hu(e))!yu.call(t,o)&&o!==r&&Nr(t,o,{get:()=>e[o],enumerable:!(n=mu(e,o))||n.enumerable});return t};var Te=(t,e,r)=>(r=t!=null?fu(gu(t)):{},qi(e||!t||!t.__esModule?Nr(r,"default",{value:t,enumerable:!0}):r,t)),Fi=t=>qi(Nr({},"__esModule",{value:!0}),t);var ro=g(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.isPromise=to;kr.attempt=vu;function to(t){return(typeof t=="object"||typeof t=="function")&&t!==null&&"then"in t&&typeof t.then=="function"}function vu(t){var e;let r=!1;try{let n=t.try();return to(n)?(r=!0,n.catch(o=>{var i;if(!t.catch)throw o;let s=(i=t.catch)===null||i===void 0?void 0:i.call(t,o);if(to(s))return s.then(()=>{})}).finally(t.finally)):n}catch(n){if(!t.catch)throw n;t.catch(n);return}finally{!r&&((e=t.finally)===null||e===void 0||e.call(t))}}});var Ur=g(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.MetricNames=de.SpanNames=de.SpanCategories=de.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES=void 0;de.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES="AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES";de.SpanCategories={STORAGE:["STORAGE_"],AUTHORIZATION:["AUTHORIZATION_","USER_TOKEN_CLIENT_"],AUTHENTICATION:["AUTHENTICATION_"],DIALOGS:["DIALOGS_"]};de.SpanNames={ADAPTER_PROCESS:"agents.adapter.process",ADAPTER_SEND_ACTIVITIES:"agents.adapter.send_activities",ADAPTER_UPDATE_ACTIVITY:"agents.adapter.update_activity",ADAPTER_DELETE_ACTIVITY:"agents.adapter.delete_activity",ADAPTER_CONTINUE_CONVERSATION:"agents.adapter.continue_conversation",ADAPTER_CREATE_CONNECTOR_CLIENT:"agents.adapter.create_connector_client",ADAPTER_CREATE_USER_TOKEN_CLIENT:"agents.adapter.create_user_token_client",AGENTS_APP_RUN:"agents.app.run",AGENTS_APP_ROUTE_HANDLER:"agents.app.route_handler",AGENTS_APP_BEFORE_TURN:"agents.app.before_turn",AGENTS_APP_AFTER_TURN:"agents.app.after_turn",AGENTS_APP_DOWNLOAD_FILES:"agents.app.download_files",CONNECTOR_SEND_TO_CONVERSATION:"agents.connector.send_to_conversation",CONNECTOR_REPLY_TO_ACTIVITY:"agents.connector.reply_to_activity",CONNECTOR_UPDATE_ACTIVITY:"agents.connector.update_activity",CONNECTOR_DELETE_ACTIVITY:"agents.connector.delete_activity",CONNECTOR_CREATE_CONVERSATION:"agents.connector.create_conversation",CONNECTOR_GET_CONVERSATIONS:"agents.connector.get_conversations",CONNECTOR_GET_CONVERSATION_MEMBER:"agents.connector.get_conversation_member",CONNECTOR_UPLOAD_ATTACHMENT:"agents.connector.upload_attachment",CONNECTOR_GET_ATTACHMENT:"agents.connector.get_attachment",CONNECTOR_GET_ATTACHMENT_INFO:"agents.connector.get_attachment_info",STORAGE_READ:"agents.storage.read",STORAGE_WRITE:"agents.storage.write",STORAGE_DELETE:"agents.storage.delete",AGENT_CLIENT_POST_ACTIVITY:"agents.agent_client.post_activity",AUTHENTICATION_GET_ACCESS_TOKEN:"agents.authentication.get_access_token",AUTHENTICATION_ACQUIRE_TOKEN_ON_BEHALF_OF:"agents.authentication.acquire_token_on_behalf_of",AUTHENTICATION_GET_AGENTIC_INSTANCE_TOKEN:"agents.authentication.get_agentic_instance_token",AUTHENTICATION_GET_AGENTIC_USER_TOKEN:"agents.authentication.get_agentic_user_token",AUTHORIZATION_AGENTIC_TOKEN:"agents.authorization.agentic_token",AUTHORIZATION_AZURE_BOT_TOKEN:"agents.authorization.azure_bot_token",AUTHORIZATION_AZURE_BOT_OBO_TOKEN:"agents.authorization.azure_bot_obo_token",AUTHORIZATION_AZURE_BOT_SIGNIN:"agents.authorization.azure_bot_signin",AUTHORIZATION_AZURE_BOT_SIGNOUT:"agents.authorization.azure_bot_signout",USER_TOKEN_CLIENT_GET_USER_TOKEN:"agents.user_token_client.get_user_token",USER_TOKEN_CLIENT_SIGN_OUT:"agents.user_token_client.sign_out",USER_TOKEN_CLIENT_GET_SIGN_IN_RESOURCE:"agents.user_token_client.get_sign_in_resource",USER_TOKEN_CLIENT_EXCHANGE_TOKEN:"agents.user_token_client.exchange_token",USER_TOKEN_CLIENT_GET_TOKEN_OR_SIGN_IN_RESOURCE:"agents.user_token_client.get_token_or_sign_in_resource",USER_TOKEN_CLIENT_GET_TOKEN_STATUS:"agents.user_token_client.get_token_status",USER_TOKEN_CLIENT_GET_AAD_TOKENS:"agents.user_token_client.get_aad_tokens",PROACTIVE_STORE_CONVERSATION:"agents.proactive.store_conversation",PROACTIVE_GET_CONVERSATION:"agents.proactive.get_conversation",PROACTIVE_GET_CONVERSATION_OR_THROW:"agents.proactive.get_conversation_or_throw",PROACTIVE_DELETE_CONVERSATION:"agents.proactive.delete_conversation",PROACTIVE_SEND_ACTIVITY:"agents.proactive.send_activity",PROACTIVE_CONTINUE_CONVERSATION:"agents.proactive.continue_conversation",PROACTIVE_CREATE_CONVERSATION:"agents.proactive.create_conversation",TURN_SEND_ACTIVITIES:"agents.turn.send_activities",DIALOGS_RUN:"agents.dialogs.run",DIALOGS_CONTEXT_BEGIN:"agents.dialogs.context.begin",DIALOGS_CONTEXT_CONTINUE:"agents.dialogs.context.continue",DIALOGS_CONTEXT_END:"agents.dialogs.context.end",DIALOGS_CONTEXT_REPLACE:"agents.dialogs.context.replace",DIALOGS_CONTEXT_CANCEL_ALL:"agents.dialogs.context.cancel_all",COPILOT_START_CONVERSATION:"agents.copilot_client.start_conversation",COPILOT_SEND_ACTIVITY:"agents.copilot_client.send_activity",COPILOT_POST_REQUEST:"agents.copilot_client.post_request",COPILOT_CREATE_CONNECTION:"agents.copilot_client.webchat.create_connection",COPILOT_EXECUTE_STREAMING:"agents.copilot_client.execute_streaming",COPILOT_SUBSCRIBE_ASYNC:"agents.copilot_client.subscribe_async"};de.MetricNames={ADAPTER_PROCESS_DURATION:"agents.adapter.process.duration",ACTIVITIES_RECEIVED:"agents.activities.received",ACTIVITIES_SENT:"agents.activities.sent",ACTIVITIES_UPDATED:"agents.activities.updated",ACTIVITIES_DELETED:"agents.activities.deleted",CONNECTOR_REQUESTS:"agents.connector.request.count",CONNECTOR_REQUEST_DURATION:"agents.connector.request.duration",AGENT_CLIENT_REQUESTS:"agents.agent_client.request.count",AGENT_CLIENT_REQUEST_DURATION:"agents.agent_client.request.duration",TURNS_COUNT:"agents.turn.count",TURNS_ERRORS:"agents.turn.error.count",TURN_DURATION:"agents.turn.duration",DIALOGS_CONTEXT_COUNT:"agents.dialogs.context.count",DIALOGS_CONTEXT_DURATION:"agents.dialogs.context.duration",STORAGE_OPERATION_DURATION:"agents.storage.operation.duration",AUTH_TOKEN_REQUEST_COUNT:"agents.auth.token.request.count",AUTH_TOKEN_DURATION:"agents.auth.token.duration",USER_TOKEN_CLIENT_REQUESTS:"agents.user_token_client.request.count",USER_TOKEN_CLIENT_REQUEST_DURATION:"agents.user_token_client.request.duration",PROACTIVE_OPERATION_COUNT:"agents.proactive.operation.count",PROACTIVE_OPERATION_DURATION:"agents.proactive.operation.duration",CSC_ACTIVITIES_RECEIVED:"agents.copilot_client.activities.received",CSC_ACTIVITIES_SENT:"agents.copilot_client.activities.sent",CSC_CONVERSATIONS_STARTED:"agents.copilot_client.conversations.started",CSC_WEBCHAT_CONNECTIONS:"agents.copilot_client.webchat.connection.count",CSC_REQUEST_COUNT:"agents.copilot_client.request.count",CSC_REQUEST_ERRORS:"agents.copilot_client.request.error.count",CSC_STREAM_DURATION:"agents.copilot_client.stream.duration",CSC_REQUEST_DURATION:"agents.copilot_client.request.duration",CSC_EXECUTE_STREAMING:"agents.copilot_client.execute_streaming.count",CSC_SUBSCRIBE_ASYNC:"agents.copilot_client.subscribe_async.count",CSC_SUBSCRIBE_EVENT:"agents.copilot_client.subscribe_event.count"}});var $i=g((im,Gi)=>{var mt=1e3,ht=mt*60,gt=ht*60,Ve=gt*24,_u=Ve*7,bu=Ve*365.25;Gi.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Tu(t);if(r==="number"&&isFinite(t))return e.long?xu(t):Cu(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Tu(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*bu;case"weeks":case"week":case"w":return r*_u;case"days":case"day":case"d":return r*Ve;case"hours":case"hour":case"hrs":case"hr":case"h":return r*gt;case"minutes":case"minute":case"mins":case"min":case"m":return r*ht;case"seconds":case"second":case"secs":case"sec":case"s":return r*mt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Cu(t){var e=Math.abs(t);return e>=Ve?Math.round(t/Ve)+"d":e>=gt?Math.round(t/gt)+"h":e>=ht?Math.round(t/ht)+"m":e>=mt?Math.round(t/mt)+"s":t+"ms"}function xu(t){var e=Math.abs(t);return e>=Ve?Zr(t,e,Ve,"day"):e>=gt?Zr(t,e,gt,"hour"):e>=ht?Zr(t,e,ht,"minute"):e>=mt?Zr(t,e,mt,"second"):t+" ms"}function Zr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Wi=g((sm,Bi)=>{function Iu(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=o,r.enabled=a,r.humanize=$i(),r.destroy=l,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let y=0;for(let T=0;T<p.length;T++)y=(y<<5)-y+p.charCodeAt(T),y|=0;return r.colors[Math.abs(y)%r.colors.length]}r.selectColor=e;function r(p){let y,T=null,E,M;function h(...w){if(!h.enabled)return;let b=h,P=Number(new Date),O=P-(y||P);b.diff=O,b.prev=y,b.curr=P,y=P,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let N=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(j,be)=>{if(j==="%%")return"%";N++;let Q=r.formatters[be];if(typeof Q=="function"){let Qt=w[N];j=Q.call(b,Qt),w.splice(N,1),N--}return j}),r.formatArgs.call(b,w),(b.log||r.log).apply(b,w)}return h.namespace=p,h.useColors=r.useColors(),h.color=r.selectColor(p),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(E!==r.namespaces&&(E=r.namespaces,M=r.enabled(p)),M),set:w=>{T=w}}),typeof r.init=="function"&&r.init(h),h}function n(p,y){let T=r(this.namespace+(typeof y=="undefined"?":":y)+p);return T.log=this.log,T}function o(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let y=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let T of y)T[0]==="-"?r.skips.push(T.slice(1)):r.names.push(T)}function i(p,y){let T=0,E=0,M=-1,h=0;for(;T<p.length;)if(E<y.length&&(y[E]===p[T]||y[E]==="*"))y[E]==="*"?(M=E,h=T,E++):(T++,E++);else if(M!==-1)E=M+1,h++,T=h;else return!1;for(;E<y.length&&y[E]==="*";)E++;return E===y.length}function s(){let p=[...r.names,...r.skips.map(y=>"-"+y)].join(",");return r.enable(""),p}function a(p){for(let y of r.skips)if(i(p,y))return!1;for(let y of r.names)if(i(p,y))return!0;return!1}function c(p){return p instanceof Error?p.stack||p.message:p}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Bi.exports=Iu});var Hi=g((W,jr)=>{W.formatArgs=Su;W.save=Au;W.load=wu;W.useColors=Eu;W.storage=Ou();W.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();W.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Eu(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Su(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+jr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}W.log=console.debug||console.log||(()=>{});function Au(t){try{t?W.storage.setItem("debug",t):W.storage.removeItem("debug")}catch{}}function wu(){let t;try{t=W.storage.getItem("debug")||W.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Ou(){try{return localStorage}catch{}}jr.exports=Wi()(W);var{formatters:Pu}=jr.exports;Pu.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var no=g(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.isBrowser=void 0;Dr.isBrowser=typeof window!="undefined"&&typeof window.document!="undefined"});var Ki=g(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.levels=void 0;Mr.levels=["info","warn","error","debug"]});var oo=g(yt=>{"use strict";var Ru=yt&&yt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yt,"__esModule",{value:!0});yt.createDebugLogger=Zu;yt.link=ju;var Nu=Ru(Hi()),ku=no(),Uu=Ki();function Zu(t){return{info:Lr(t,"info"),warn:Lr(t,"warn"),error:Lr(t,"error"),debug:Lr(t,"debug")}}var Yi={node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}};function Lr(t,e){let r=(0,Nu.default)(`${t}:${e}`);return ku.isBrowser?r.color=Yi.browser[e]:r.color=Yi.node[e],r}function ju(t,...e){return Uu.levels.reduce((r,n)=>(r[n]=(o,...i)=>{if(t[n].enabled){t[n](o,...i);for(let s of e)s[n](o,...i)}},r),{})}});var Xi=g(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.getSetting=Mu;var Du=no();function Mu(t){var e,r;if(Du.isBrowser)try{return(e=window.localStorage.getItem(t))!==null&&e!==void 0?e:""}catch{}else return(r=process.env[t])!==null&&r!==void 0?r:"";return""}});var Qi=g(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.isSpanDisabled=zu;var or=Ur(),Lu=oo(),Vu=Xi(),so=(0,Lu.createDebugLogger)("agents:telemetry"),Ji=(()=>{let t=(0,Vu.getSetting)(or.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES).trim().toUpperCase();if(!t)return[];let e=t.split(/[\s,]+/).map(i=>i.trim()).filter(Boolean),r=Object.entries(or.SpanNames),n=new Set,o=[];for(let i of e){let s=or.SpanCategories[i];if(!s){so.warn(`Invalid span category "${i}" in ${or.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES}. Valid categories are: ${Object.keys(or.SpanCategories).join(", ")}`);continue}for(let a of s)if(!n.has(a)){n.add(a);for(let[c,l]of r)c.startsWith(a)&&o.push(l)}}return o.length>0&&so.debug("Disabled Span names:",o),o})();function zu(t){if(Ji.length===0)return!1;let e=Ji.includes(t);return so.debug(`Span "${t}" disabled:`,e),e}});var co=g(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.noopTrace=void 0;ze.noopMetric=qu;ze.noopContext=es;var ir=()=>{};ze.noopTrace=function(t,e){return es(e)};ze.noopTrace.define=t=>t;function qu(){return{histogram:()=>({record:ir}),counter:()=>({add:ir})}}function es(t){let e=new Proxy({},{get:()=>ir}),r={record:ir,actions:e};return t?t(r):{record:r.record,actions:r.actions,end:ir,fail(o){return o}}}});var ns=g(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.traceFactory=Wu;var Fu=ro(),Gu=Qi(),$u=Ur(),Bu=co();function Wu(t){let e=new Set(Object.values($u.SpanNames)),r=t.trace.getTracer("@microsoft/agents-telemetry"),n=function(i,s){if(!i)throw new Error("Trace definition is required");if(!e.has(i.name))throw new Error(`Unrecognized span name "${i.name}". See SpanNames constants.`);if((0,Gu.isSpanDisabled)(i.name))return(0,Bu.noopContext)(s);let a=Hu(i);if(!s){let c=r.startSpan(i.name),l=ts(t,i,c,a);return{record:l.record,actions:l.actions,fail:l.fail,end:l.end}}return r.startActiveSpan(i.name,c=>{let l=ts(t,i,c,a);return(0,Fu.attempt)({try:()=>s({record:l.record,actions:l.actions}),catch:p=>{throw l.fail(p)},finally:l.end})})};return n.define=o=>o,n}function Hu(t){let e=t.record?{...t.record}:{};return{set(r){Object.assign(e,r)},get(){return e}}}function ts(t,e,r,n){var o,i;let s=performance.now(),a=!1,c;return{record:n.set,actions:(i=(o=e.actions)===null||o===void 0?void 0:o.call(e,{span:r}))!==null&&i!==void 0?i:{},fail(l){return c=l,l},end(){if(!(a||!t)){a=!0,c===void 0?r.setStatus({code:t.SpanStatusCode.OK}):rs(t,r,c);try{e.end({span:r,record:n.get(),duration:performance.now()-s,error:c})}catch(l){rs(t,r,l)}finally{r.end()}}}}}function rs(t,e,r){let n;r instanceof Error?(n=r.message,e.recordException(r)):(n=String(r),e.recordException({name:typeof r,message:n})),e.setStatus({code:t.SpanStatusCode.ERROR,message:n})}});var os=g(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.metricFactory=Ku;function Ku(t){let e=t.metrics.getMeter("@microsoft/agents-telemetry");return{histogram:e.createHistogram.bind(e),counter:e.createCounter.bind(e)}}});var is=g(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.createOTelLogger=Yu;function Yu(t,e){return{info:Vr(t,e,"info"),warn:Vr(t,e,"warn"),error:Vr(t,e,"error"),debug:Vr(t,e,"debug")}}function Vr(t,e,r){var n;let o=t.logs.getLogger(e),i=(n=r==null?void 0:r.toLowerCase())!==null&&n!==void 0?n:"debug",s={debug:t.SeverityNumber.DEBUG,info:t.SeverityNumber.INFO,warn:t.SeverityNumber.WARN,error:t.SeverityNumber.ERROR}[i];return function(c,...l){o.emit({severityNumber:s,severityText:i.toUpperCase(),body:Xu(c,l),attributes:{"log.namespace":e,"log.level":i}})}}function Xu(t,e){if(e.length===0)return t;let r=e.map(n=>Ju(n)).join(" ");return`${t} ${r}`}function Ju(t){if(t instanceof Error)return`${t.name}: ${t.message}`;if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);try{return JSON.stringify(t)}catch{return String(t)}}});var us=g(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.index=rd;var Qu=ns(),ed=os(),qr=oo(),td=is(),zr=ro(),ss=Ur(),as=co(),fo=(0,qr.createDebugLogger)("agents:telemetry");function rd(t){let e=(0,zr.attempt)({try:()=>t.otel(),catch:()=>fo.warn("OpenTelemetry API not found. Install @opentelemetry/api as a dependency to enable tracing and metrics.")}),r=(0,zr.attempt)({try:()=>t.logs(),catch:()=>fo.warn("OpenTelemetry API Logs not found. Install @opentelemetry/api-logs as a dependency to enable OTel logging.")});return(0,zr.isPromise)(e)||(0,zr.isPromise)(r)?Promise.all([e,r]).then(([n,o])=>cs(n,o)):cs(e,r)}function cs(t,e){return fo.info("Telemetry settings loaded",{traceEnabled:t!==void 0,logsEnabled:e!==void 0}),{SpanNames:ss.SpanNames,MetricNames:ss.MetricNames,debug:e?r=>(0,qr.link)((0,qr.createDebugLogger)(r),(0,td.createOTelLogger)(e,r)):qr.createDebugLogger,trace:t?(0,Qu.traceFactory)(t):as.noopTrace,metric:t?(0,ed.metricFactory)(t):(0,as.noopMetric)()}}});var ls=g(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.redactString=nd;ar.redactUrl=od;ar.redactScopes=id;var sr="<redacted>",ds=2;function nd(t,e=!1){if(t!==void 0)return e&&t.length>ds+6?`${t.slice(0,ds)}${sr}`:sr}function od(t){if(t!=null&&t.trim())try{let e=new URL(t),r=e.pathname.split("/").filter(Boolean);return r.length===0?e.origin:`${e.origin}/${sr} (${r.length} segments)`}catch{return sr}}function id(t){if(t===void 0)return;let e=t.length;return`${sr} (${e} ${e===1?"scope":"scopes"})`}});var ps,fs=I(()=>{ps=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});var ms=I(()=>{fs()});var Ce,ho=I(()=>{Ce="1.9.0"});function sd(t){var e=new Set([t]),r=new Set,n=t.match(hs);if(!n)return function(){return!1};var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===t};function i(a){return r.add(a),!1}function s(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(r.has(c))return!1;var l=c.match(hs);if(!l)return i(c);var p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var hs,gs,ys=I(()=>{ho();hs=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;gs=sd(Ce)});function le(t,e,r,n){var o;n===void 0&&(n=!1);var i=ur[cr]=(o=ur[cr])!==null&&o!==void 0?o:{version:Ce};if(!n&&i[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(s.stack||s.message),!1}if(i.version!==Ce){var s=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+t+" does not match previously registered API v"+Ce);return r.error(s.stack||s.message),!1}return i[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+Ce+"."),!0}function X(t){var e,r,n=(e=ur[cr])===null||e===void 0?void 0:e.version;if(!(!n||!gs(n)))return(r=ur[cr])===null||r===void 0?void 0:r[t]}function pe(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+Ce+".");var r=ur[cr];r&&delete r[t]}var ad,cr,ur,qe=I(()=>{ms();ho();ys();ad=Ce.split(".")[0],cr=Symbol.for("opentelemetry.js.api."+ad),ur=ps});function dr(t,e,r){var n=X("diag");if(n)return r.unshift(e),n[t].apply(n,ud([],cd(r),!1))}var cd,ud,vs,_s=I(()=>{qe();cd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},ud=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},vs=(function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("verbose",this._namespace,e)},t})()});var q,Fr=I(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(q||(q={}))});function bs(t,e){t<q.NONE?t=q.NONE:t>q.ALL&&(t=q.ALL),e=e||{};function r(n,o){var i=e[n];return typeof i=="function"&&t>=o?i.bind(e):function(){}}return{error:r("error",q.ERROR),warn:r("warn",q.WARN),info:r("info",q.INFO),debug:r("debug",q.DEBUG),verbose:r("verbose",q.VERBOSE)}}var Ts=I(()=>{Fr()});var dd,ld,pd,F,Fe=I(()=>{_s();Ts();Fr();qe();dd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},ld=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},pd="diag",F=(function(){function t(){function e(o){return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var a=X("diag");if(a)return a[o].apply(a,ld([],dd(i),!1))}}var r=this,n=function(o,i){var s,a,c;if(i===void 0&&(i={logLevel:q.INFO}),o===r){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=l.stack)!==null&&s!==void 0?s:l.message),!1}typeof i=="number"&&(i={logLevel:i});var p=X("diag"),y=bs((a=i.logLevel)!==null&&a!==void 0?a:q.INFO,o);if(p&&!i.suppressOverrideMessage){var T=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+T),y.warn("Current logger will overwrite one already registered from "+T)}return le("diag",y,r,!0)};r.setLogger=n,r.disable=function(){pe(pd,r)},r.createComponentLogger=function(o){return new vs(o)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})()});var fd,md,Cs,xs=I(()=>{fd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},md=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Cs=(function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=fd(e,2),n=r[0],o=r[1];return[n,o]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new t(this._entries);try{for(var s=md(n),a=s.next();!a.done;a=s.next()){var c=a.value;i._entries.delete(c)}}catch(l){e={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t})()});var Is,Es=I(()=>{Is=Symbol("BaggageEntryMetadata")});function Ss(t){return t===void 0&&(t={}),new Cs(new Map(Object.entries(t)))}function As(t){return typeof t!="string"&&(hd.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:Is,toString:function(){return t}}}var hd,go=I(()=>{Fe();xs();Es();hd=F.instance()});function vt(t){return Symbol.for(t)}var gd,Gr,lr=I(()=>{gd=(function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new t(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new t(r._currentContext);return o._currentContext.delete(n),o}}return t})(),Gr=new gd});var yo,ws,Os=I(()=>{yo=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],ws=(function(){function t(){function e(n){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(console){var s=console[n];if(typeof s!="function"&&(s=console.log),typeof s=="function")return s.apply(console,o)}}}for(var r=0;r<yo.length;r++)this[yo[r].n]=e(yo[r].c)}return t})()});function Ps(){return _o}var Ge,yd,$r,vd,_d,bd,Td,vo,Cd,xd,Id,_o,Ed,Sd,Ad,wd,Od,Pd,Rd,bo=I(()=>{Ge=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),yd=(function(){function t(){}return t.prototype.createGauge=function(e,r){return Sd},t.prototype.createHistogram=function(e,r){return Ad},t.prototype.createCounter=function(e,r){return Ed},t.prototype.createUpDownCounter=function(e,r){return wd},t.prototype.createObservableGauge=function(e,r){return Pd},t.prototype.createObservableCounter=function(e,r){return Od},t.prototype.createObservableUpDownCounter=function(e,r){return Rd},t.prototype.addBatchObservableCallback=function(e,r){},t.prototype.removeBatchObservableCallback=function(e){},t})(),$r=(function(){function t(){}return t})(),vd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})($r),_d=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})($r),bd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})($r),Td=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})($r),vo=(function(){function t(){}return t.prototype.addCallback=function(e){},t.prototype.removeCallback=function(e){},t})(),Cd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(vo),xd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(vo),Id=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(vo),_o=new yd,Ed=new vd,Sd=new bd,Ad=new Td,wd=new _d,Od=new Cd,Pd=new xd,Rd=new Id});var Br,Rs=I(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(Br||(Br={}))});var Wr,Hr,To=I(()=>{Wr={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},Hr={set:function(t,e,r){t!=null&&(t[e]=r)}}});var Nd,kd,Ns,ks=I(()=>{lr();Nd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},kd=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},Ns=(function(){function t(){}return t.prototype.active=function(){return Gr},t.prototype.with=function(e,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,kd([n],Nd(o),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})()});var Ud,Zd,Co,jd,we,pr=I(()=>{ks();qe();Fe();Ud=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i},Zd=function(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},Co="context",jd=new Ns,we=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return le(Co,e,F.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var o,i=[],s=3;s<arguments.length;s++)i[s-3]=arguments[s];return(o=this._getContextManager()).with.apply(o,Zd([e,r,n],Ud(i),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return X(Co)||jd},t.prototype.disable=function(){this._getContextManager().disable(),pe(Co,F.instance())},t})()});var _t,xo=I(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(_t||(_t={}))});var fr,mr,Kr,Yr=I(()=>{xo();fr="0000000000000000",mr="00000000000000000000000000000000",Kr={traceId:mr,spanId:fr,traceFlags:_t.NONE}});var Oe,Xr=I(()=>{Yr();Oe=(function(){function t(e){e===void 0&&(e=Kr),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,r){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,r){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,r){},t})()});function Jr(t){return t.getValue(Io)||void 0}function Us(){return Jr(we.getInstance().active())}function hr(t,e){return t.setValue(Io,e)}function Zs(t){return t.deleteValue(Io)}function js(t,e){return hr(t,new Oe(e))}function Qr(t){var e;return(e=Jr(t))===null||e===void 0?void 0:e.spanContext()}var Io,Eo=I(()=>{lr();Xr();pr();Io=vt("OpenTelemetry Context Key SPAN")});function So(t){return Dd.test(t)&&t!==mr}function Ao(t){return Md.test(t)&&t!==fr}function bt(t){return So(t.traceId)&&Ao(t.spanId)}function Ds(t){return new Oe(t)}var Dd,Md,en=I(()=>{Yr();Xr();Dd=/^([0-9a-f]{32})$/i,Md=/^[0-9a-f]{16}$/i});function Ld(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var wo,tn,Oo=I(()=>{pr();Eo();Xr();en();wo=we.getInstance(),tn=(function(){function t(){}return t.prototype.startSpan=function(e,r,n){n===void 0&&(n=wo.active());var o=!!(r!=null&&r.root);if(o)return new Oe;var i=n&&Qr(n);return Ld(i)&&bt(i)?new Oe(i):new Oe},t.prototype.startActiveSpan=function(e,r,n,o){var i,s,a;if(!(arguments.length<2)){arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);var c=s!=null?s:wo.active(),l=this.startSpan(e,i,c),p=hr(c,l);return wo.with(p,a,void 0,l)}},t})()});var Vd,rn,Po=I(()=>{Oo();Vd=new tn,rn=(function(){function t(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}return t.prototype.startSpan=function(e,r,n){return this._getTracer().startSpan(e,r,n)},t.prototype.startActiveSpan=function(e,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Vd},t})()});var Ms,Ls=I(()=>{Oo();Ms=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){return new tn},t})()});var zd,gr,Ro=I(()=>{Po();Ls();zd=new Ms,gr=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){var o;return(o=this.getDelegateTracer(e,r,n))!==null&&o!==void 0?o:new rn(this,e,r,n)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:zd},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,r,n)},t})()});var nn,Vs=I(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(nn||(nn={}))});var on,zs=I(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(on||(on={}))});var sn,qs=I(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(sn||(sn={}))});function Fs(t){return Gd.test(t)}function Gs(t){return $d.test(t)&&!Bd.test(t)}var No,qd,Fd,Gd,$d,Bd,$s=I(()=>{No="[_0-9a-z-*/]",qd="[a-z]"+No+"{0,255}",Fd="[a-z0-9]"+No+"{0,240}@[a-z]"+No+"{0,13}",Gd=new RegExp("^(?:"+qd+"|"+Fd+")$"),$d=/^[ -~]{0,255}[!-~]$/,Bd=/,|=/});var Bs,Wd,Ws,Hs,Ks,Ys=I(()=>{$s();Bs=32,Wd=512,Ws=",",Hs="=",Ks=(function(){function t(e){this._internalState=new Map,e&&this._parse(e)}return t.prototype.set=function(e,r){var n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n},t.prototype.unset=function(e){var r=this._clone();return r._internalState.delete(e),r},t.prototype.get=function(e){return this._internalState.get(e)},t.prototype.serialize=function(){var e=this;return this._keys().reduce(function(r,n){return r.push(n+Hs+e.get(n)),r},[]).join(Ws)},t.prototype._parse=function(e){e.length>Wd||(this._internalState=e.split(Ws).reverse().reduce(function(r,n){var o=n.trim(),i=o.indexOf(Hs);if(i!==-1){var s=o.slice(0,i),a=o.slice(i+1,n.length);Fs(s)&&Gs(a)&&r.set(s,a)}return r},new Map),this._internalState.size>Bs&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Bs))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t})()});function Xs(t){return new Ks(t)}var Js=I(()=>{Ys()});var ko,Qs=I(()=>{pr();ko=we.getInstance()});var Uo,ea=I(()=>{Fe();Uo=F.instance()});var Hd,ta,ra=I(()=>{bo();Hd=(function(){function t(){}return t.prototype.getMeter=function(e,r,n){return _o},t})(),ta=new Hd});var Zo,na,oa=I(()=>{ra();qe();Fe();Zo="metrics",na=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(e){return le(Zo,e,F.instance())},t.prototype.getMeterProvider=function(){return X(Zo)||ta},t.prototype.getMeter=function(e,r,n){return this.getMeterProvider().getMeter(e,r,n)},t.prototype.disable=function(){pe(Zo,F.instance())},t})()});var jo,ia=I(()=>{oa();jo=na.getInstance()});var sa,aa=I(()=>{sa=(function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t})()});function Mo(t){return t.getValue(Do)||void 0}function ca(){return Mo(we.getInstance().active())}function ua(t,e){return t.setValue(Do,e)}function da(t){return t.deleteValue(Do)}var Do,la=I(()=>{pr();lr();Do=vt("OpenTelemetry Baggage Key")});var Lo,Kd,pa,fa=I(()=>{qe();aa();To();la();go();Fe();Lo="propagation",Kd=new sa,pa=(function(){function t(){this.createBaggage=Ss,this.getBaggage=Mo,this.getActiveBaggage=ca,this.setBaggage=ua,this.deleteBaggage=da}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return le(Lo,e,F.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=Hr),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=Wr),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){pe(Lo,F.instance())},t.prototype._getGlobalPropagator=function(){return X(Lo)||Kd},t})()});var Vo,ma=I(()=>{fa();Vo=pa.getInstance()});var zo,ha,ga=I(()=>{qe();Ro();en();Eo();Fe();zo="trace",ha=(function(){function t(){this._proxyTracerProvider=new gr,this.wrapSpanContext=Ds,this.isSpanContextValid=bt,this.deleteSpan=Zs,this.getSpan=Jr,this.getActiveSpan=Us,this.getSpanContext=Qr,this.setSpan=hr,this.setSpanContext=js}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var r=le(zo,this._proxyTracerProvider,F.instance());return r&&this._proxyTracerProvider.setDelegate(e),r},t.prototype.getTracerProvider=function(){return X(zo)||this._proxyTracerProvider},t.prototype.getTracer=function(e,r){return this.getTracerProvider().getTracer(e,r)},t.prototype.disable=function(){pe(zo,F.instance()),this._proxyTracerProvider=new gr},t})()});var qo,ya=I(()=>{ga();qo=ha.getInstance()});var va={};zi(va,{DiagConsoleLogger:()=>ws,DiagLogLevel:()=>q,INVALID_SPANID:()=>fr,INVALID_SPAN_CONTEXT:()=>Kr,INVALID_TRACEID:()=>mr,ProxyTracer:()=>rn,ProxyTracerProvider:()=>gr,ROOT_CONTEXT:()=>Gr,SamplingDecision:()=>nn,SpanKind:()=>on,SpanStatusCode:()=>sn,TraceFlags:()=>_t,ValueType:()=>Br,baggageEntryMetadataFromString:()=>As,context:()=>ko,createContextKey:()=>vt,createNoopMeter:()=>Ps,createTraceState:()=>Xs,default:()=>Yd,defaultTextMapGetter:()=>Wr,defaultTextMapSetter:()=>Hr,diag:()=>Uo,isSpanContextValid:()=>bt,isValidSpanId:()=>Ao,isValidTraceId:()=>So,metrics:()=>jo,propagation:()=>Vo,trace:()=>qo});var Yd,_a=I(()=>{go();lr();Os();Fr();bo();Rs();To();Po();Ro();Vs();zs();qs();xo();Js();en();Yr();Qs();ea();ia();ma();ya();Yd={context:ko,diag:Uo,metrics:jo,propagation:Vo,trace:qo}});var ba=g(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.SeverityNumber=void 0;var Xd;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Xd=yr.SeverityNumber||(yr.SeverityNumber={}))});var cn=g(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.NOOP_LOGGER=Tt.NoopLogger=void 0;var an=class{emit(e){}};Tt.NoopLogger=an;Tt.NOOP_LOGGER=new an});var Ta=g(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.API_BACKWARDS_COMPATIBILITY_VERSION=fe.makeGetter=fe._global=fe.GLOBAL_LOGS_API_KEY=void 0;fe.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");fe._global=globalThis;function Jd(t,e,r){return n=>n===t?e:r}fe.makeGetter=Jd;fe.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Fo=g(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.NOOP_LOGGER_PROVIDER=Ct.NoopLoggerProvider=void 0;var Qd=cn(),un=class{getLogger(e,r,n){return new Qd.NoopLogger}};Ct.NoopLoggerProvider=un;Ct.NOOP_LOGGER_PROVIDER=new un});var Ca=g(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.ProxyLogger=void 0;var el=cn(),Go=class{constructor(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):el.NOOP_LOGGER}};dn.ProxyLogger=Go});var xa=g(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ProxyLoggerProvider=void 0;var tl=Fo(),rl=Ca(),$o=class{getLogger(e,r,n){var o;return(o=this._getDelegateLogger(e,r,n))!==null&&o!==void 0?o:new rl.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:tl.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,n)}};ln.ProxyLoggerProvider=$o});var Ea=g(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.LogsAPI=void 0;var ee=Ta(),nl=Fo(),Ia=xa(),Bo=class t{constructor(){this._proxyLoggerProvider=new Ia.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return ee._global[ee.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ee._global[ee.GLOBAL_LOGS_API_KEY]=(0,ee.makeGetter)(ee.API_BACKWARDS_COMPATIBILITY_VERSION,e,nl.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=ee._global[ee.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(ee._global,ee.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete ee._global[ee.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Ia.ProxyLoggerProvider}};pn.LogsAPI=Bo});var Aa=g(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.logs=me.NoopLogger=me.NOOP_LOGGER=me.SeverityNumber=void 0;var ol=ba();Object.defineProperty(me,"SeverityNumber",{enumerable:!0,get:function(){return ol.SeverityNumber}});var Sa=cn();Object.defineProperty(me,"NOOP_LOGGER",{enumerable:!0,get:function(){return Sa.NOOP_LOGGER}});Object.defineProperty(me,"NoopLogger",{enumerable:!0,get:function(){return Sa.NoopLogger}});var il=Ea();me.logs=il.LogsAPI.getInstance()});var $e=g(V=>{"use strict";var xt;Object.defineProperty(V,"__esModule",{value:!0});V.metric=V.trace=V.debug=V.MetricNames=V.SpanNames=V.redactScopes=V.redactUrl=V.redactString=void 0;var sl=us(),Wo=ls();Object.defineProperty(V,"redactString",{enumerable:!0,get:function(){return Wo.redactString}});Object.defineProperty(V,"redactUrl",{enumerable:!0,get:function(){return Wo.redactUrl}});Object.defineProperty(V,"redactScopes",{enumerable:!0,get:function(){return Wo.redactScopes}});xt=(0,sl.index)({otel:()=>(_a(),Fi(va)),logs:()=>Aa()}),V.SpanNames=xt.SpanNames,V.MetricNames=xt.MetricNames,V.debug=xt.debug,V.trace=xt.trace,V.metric=xt.metric});var Tr=g(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Qo;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Qo||(k.util=Qo={}));var Ua;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ua||(k.objectUtil=Ua={}));k.ZodParsedType=Qo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var vl=t=>{switch(typeof t){case"undefined":return k.ZodParsedType.undefined;case"string":return k.ZodParsedType.string;case"number":return Number.isNaN(t)?k.ZodParsedType.nan:k.ZodParsedType.number;case"boolean":return k.ZodParsedType.boolean;case"function":return k.ZodParsedType.function;case"bigint":return k.ZodParsedType.bigint;case"symbol":return k.ZodParsedType.symbol;case"object":return Array.isArray(t)?k.ZodParsedType.array:t===null?k.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?k.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?k.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?k.ZodParsedType.date:k.ZodParsedType.object;default:return k.ZodParsedType.unknown}};k.getParsedType=vl});var vn=g(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ZodError=Pe.quotelessJson=Pe.ZodIssueCode=void 0;var Za=Tr();Pe.ZodIssueCode=Za.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var _l=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Pe.quotelessJson=_l;var Cr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Za.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Pe.ZodError=Cr;Cr.create=t=>new Cr(t)});var ti=g(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var G=vn(),Be=Tr(),bl=(t,e)=>{let r;switch(t.code){case G.ZodIssueCode.invalid_type:t.received===Be.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case G.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Be.util.jsonStringifyReplacer)}`;break;case G.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Be.util.joinValues(t.keys,", ")}`;break;case G.ZodIssueCode.invalid_union:r="Invalid input";break;case G.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Be.util.joinValues(t.options)}`;break;case G.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Be.util.joinValues(t.options)}, received '${t.received}'`;break;case G.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case G.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case G.ZodIssueCode.invalid_date:r="Invalid date";break;case G.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Be.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case G.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case G.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case G.ZodIssueCode.custom:r="Invalid input";break;case G.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case G.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case G.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Be.util.assertNever(t)}return{message:r}};ei.default=bl});var _n=g(Re=>{"use strict";var Tl=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.defaultErrorMap=void 0;Re.setErrorMap=Cl;Re.getErrorMap=xl;var ja=Tl(ti());Re.defaultErrorMap=ja.default;var Da=ja.default;function Cl(t){Da=t}function xl(){return Da}});var ni=g(R=>{"use strict";var Il=R&&R.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0});R.isAsync=R.isValid=R.isDirty=R.isAborted=R.OK=R.DIRTY=R.INVALID=R.ParseStatus=R.EMPTY_PATH=R.makeIssue=void 0;R.addIssueToContext=Al;var El=_n(),Ma=Il(ti()),Sl=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};R.makeIssue=Sl;R.EMPTY_PATH=[];function Al(t,e){let r=(0,El.getErrorMap)(),n=(0,R.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ma.default?void 0:Ma.default].filter(o=>!!o)});t.common.issues.push(n)}var ri=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return R.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return R.INVALID;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}};R.ParseStatus=ri;R.INVALID=Object.freeze({status:"aborted"});var wl=t=>({status:"dirty",value:t});R.DIRTY=wl;var Ol=t=>({status:"valid",value:t});R.OK=Ol;var Pl=t=>t.status==="aborted";R.isAborted=Pl;var Rl=t=>t.status==="dirty";R.isDirty=Rl;var Nl=t=>t.status==="valid";R.isValid=Nl;var kl=t=>typeof Promise!="undefined"&&t instanceof Promise;R.isAsync=kl});var Va=g(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0})});var qa=g(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.errorUtil=void 0;var za;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(za||(bn.errorUtil=za={}))});var ec=g(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.discriminatedUnion=u.date=u.boolean=u.bigint=u.array=u.any=u.coerce=u.ZodFirstPartyTypeKind=u.late=u.ZodSchema=u.Schema=u.ZodReadonly=u.ZodPipeline=u.ZodBranded=u.BRAND=u.ZodNaN=u.ZodCatch=u.ZodDefault=u.ZodNullable=u.ZodOptional=u.ZodTransformer=u.ZodEffects=u.ZodPromise=u.ZodNativeEnum=u.ZodEnum=u.ZodLiteral=u.ZodLazy=u.ZodFunction=u.ZodSet=u.ZodMap=u.ZodRecord=u.ZodTuple=u.ZodIntersection=u.ZodDiscriminatedUnion=u.ZodUnion=u.ZodObject=u.ZodArray=u.ZodVoid=u.ZodNever=u.ZodUnknown=u.ZodAny=u.ZodNull=u.ZodUndefined=u.ZodSymbol=u.ZodDate=u.ZodBoolean=u.ZodBigInt=u.ZodNumber=u.ZodString=u.ZodType=void 0;u.NEVER=u.void=u.unknown=u.union=u.undefined=u.tuple=u.transformer=u.symbol=u.string=u.strictObject=u.set=u.record=u.promise=u.preprocess=u.pipeline=u.ostring=u.optional=u.onumber=u.oboolean=u.object=u.number=u.nullable=u.null=u.never=u.nativeEnum=u.nan=u.map=u.literal=u.lazy=u.intersection=u.instanceof=u.function=u.enum=u.effect=void 0;u.datetimeRegex=Wa;u.custom=Ka;var f=vn(),Tn=_n(),v=qa(),d=ni(),m=Tr(),re=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fa=(t,e)=>{if((0,d.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new f.ZodError(t.common.issues);return this._error=r,this._error}}};function S(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,p;let{message:c}=t;return s.code==="invalid_enum_value"?{message:c!=null?c:a.defaultError}:typeof a.data=="undefined"?{message:(l=c!=null?c:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(p=c!=null?c:r)!=null?p:a.defaultError}},description:o}}var A=class{get description(){return this._def.description}_getType(e){return(0,m.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new d.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,d.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r==null?void 0:r.async)!=null?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,m.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Fa(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,m.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,d.isValid)(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(o=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>(0,d.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,m.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,d.isAsync)(o)?o:Promise.resolve(o));return Fa(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:f.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new J({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return te.create(this,this._def)}nullable(){return ge.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ee.create(this)}promise(){return Ue.create(this,this._def)}or(e){return Qe.create([this,e],this._def)}and(e){return et.create(this,e,this._def)}transform(e){return new J({...S(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new it({...S(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new xr({typeName:C.ZodBranded,type:this,...S(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new st({...S(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ir.create(this,e)}readonly(){return at.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u.ZodType=A;u.Schema=A;u.ZodSchema=A;var Ul=/^c[^\s-]{8,}$/i,Zl=/^[0-9a-z]+$/,jl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ml=/^[a-z0-9_-]{21}$/i,Ll=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ql="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",oi,Fl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,$l=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$a="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Kl=new RegExp(`^${$a}$`);function Ba(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Yl(t){return new RegExp(`^${Ba(t)}$`)}function Wa(t){let e=`${$a}T${Ba(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Xl(t,e){return!!((e==="v4"||!e)&&Fl.test(t)||(e==="v6"||!e)&&$l.test(t))}function Jl(t,e){if(!Ll.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Ql(t,e){return!!((e==="v4"||!e)&&Gl.test(t)||(e==="v6"||!e)&&Bl.test(t))}var Ne=class t extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.string,received:i.parsedType}),d.INVALID}let n=new d.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")zl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"email",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")oi||(oi=new RegExp(ql,"u")),oi.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"emoji",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Dl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"uuid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ml.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"nanoid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Ul.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cuid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Zl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cuid2",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")jl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"ulid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"url",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"regex",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Wa(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Kl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Yl(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Vl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"duration",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Xl(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"ip",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Jl(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"jwt",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Ql(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cidr",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Wl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"base64",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Hl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"base64url",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):m.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:f.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...v.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...v.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,v.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u.ZodString=Ne;Ne.create=t=>{var e;return new Ne({checks:[],typeName:C.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};function ep(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var We=class t extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.number,received:i.parsedType}),d.INVALID}let n,o=new d.ParseStatus;for(let i of this._def.checks)i.kind==="int"?m.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ep(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.not_finite,message:i.message}),o.dirty()):m.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&m.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};u.ZodNumber=We;We.create=t=>new We({checks:[],typeName:C.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var He=class t extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new d.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):m.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.bigint,received:r.parsedType}),d.INVALID}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u.ZodBigInt=He;He.create=t=>{var e;return new He({checks:[],typeName:C.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};var Ke=class extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.boolean,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodBoolean=Ke;Ke.create=t=>new Ke({typeName:C.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var Ye=class t extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.date,received:i.parsedType}),d.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_date}),d.INVALID}let n=new d.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):m.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:v.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};u.ZodDate=Ye;Ye.create=t=>new Ye({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:C.ZodDate,...S(t)});var St=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.symbol,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodSymbol=St;St.create=t=>new St({typeName:C.ZodSymbol,...S(t)});var Xe=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.undefined,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodUndefined=Xe;Xe.create=t=>new Xe({typeName:C.ZodUndefined,...S(t)});var Je=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.null,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodNull=Je;Je.create=t=>new Je({typeName:C.ZodNull,...S(t)});var ke=class extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,d.OK)(e.data)}};u.ZodAny=ke;ke.create=t=>new ke({typeName:C.ZodAny,...S(t)});var Ie=class extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,d.OK)(e.data)}};u.ZodUnknown=Ie;Ie.create=t=>new Ie({typeName:C.ZodUnknown,...S(t)});var ie=class extends A{_parse(e){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.never,received:r.parsedType}),d.INVALID}};u.ZodNever=ie;ie.create=t=>new ie({typeName:C.ZodNever,...S(t)});var At=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.void,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodVoid=At;At.create=t=>new At({typeName:C.ZodVoid,...S(t)});var Ee=class t extends A{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==m.ZodParsedType.array)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:r.parsedType}),d.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,d.addIssueToContext)(r,{code:s?f.ZodIssueCode.too_big:f.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,d.addIssueToContext)(r,{code:f.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,d.addIssueToContext)(r,{code:f.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new re(r,s,r.path,a)))).then(s=>d.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new re(r,s,r.path,a)));return d.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:v.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:v.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};u.ZodArray=Ee;Ee.create=(t,e)=>new Ee({type:t,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...S(e)});function Et(t){if(t instanceof H){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=te.create(Et(n))}return new H({...t._def,shape:()=>e})}else return t instanceof Ee?new Ee({...t._def,type:Et(t.element)}):t instanceof te?te.create(Et(t.unwrap())):t instanceof ge?ge.create(Et(t.unwrap())):t instanceof he?he.create(t.items.map(e=>Et(e))):t}var H=class t extends A{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=m.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==m.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(l,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:l.parsedType}),d.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let c=[];for(let l of s){let p=i[l],y=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new re(o,y,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof ie){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&((0,d.addIssueToContext)(o,{code:f.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of a){let y=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new re(o,y,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let y=await p.key,T=await p.value;l.push({key:y,value:T,alwaysSet:p.alwaysSet})}return l}).then(l=>d.ParseStatus.mergeObjectSync(n,l)):d.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return v.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,c;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(c=v.errorUtil.errToObj(e).message)!=null?c:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of m.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of m.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Et(this)}partial(e){let r={};for(let n of m.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of m.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof te;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Ha(m.util.objectKeys(this.shape))}};u.ZodObject=H;H.create=(t,e)=>new H({shape:()=>t,unknownKeys:"strip",catchall:ie.create(),typeName:C.ZodObject,...S(e)});H.strictCreate=(t,e)=>new H({shape:()=>t,unknownKeys:"strict",catchall:ie.create(),typeName:C.ZodObject,...S(e)});H.lazycreate=(t,e)=>new H({shape:t,unknownKeys:"strip",catchall:ie.create(),typeName:C.ZodObject,...S(e)});var Qe=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new f.ZodError(a.ctx.common.issues));return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union,unionErrors:s}),d.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},p=c._parseSync({data:r.data,path:r.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new f.ZodError(c));return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union,unionErrors:a}),d.INVALID}}get options(){return this._def.options}};u.ZodUnion=Qe;Qe.create=(t,e)=>new Qe({options:t,typeName:C.ZodUnion,...S(e)});var xe=t=>t instanceof tt?xe(t.schema):t instanceof J?xe(t.innerType()):t instanceof rt?[t.value]:t instanceof nt?t.options:t instanceof ot?m.util.objectValues(t.enum):t instanceof it?xe(t._def.innerType):t instanceof Xe?[void 0]:t instanceof Je?[null]:t instanceof te?[void 0,...xe(t.unwrap())]:t instanceof ge?[null,...xe(t.unwrap())]:t instanceof xr||t instanceof at?xe(t.unwrap()):t instanceof st?xe(t._def.innerType):[],Cn=class t extends A{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.object)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:r.parsedType}),d.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),d.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=xe(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...S(n)})}};u.ZodDiscriminatedUnion=Cn;function ii(t,e){let r=(0,m.getParsedType)(t),n=(0,m.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===m.ZodParsedType.object&&n===m.ZodParsedType.object){let o=m.util.objectKeys(e),i=m.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=ii(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===m.ZodParsedType.array&&n===m.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],c=ii(s,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===m.ZodParsedType.date&&n===m.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var et=class extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,d.isAborted)(i)||(0,d.isAborted)(s))return d.INVALID;let a=ii(i.value,s.value);return a.valid?(((0,d.isDirty)(i)||(0,d.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_intersection_types}),d.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};u.ZodIntersection=et;et.create=(t,e,r)=>new et({left:t,right:e,typeName:C.ZodIntersection,...S(r)});var he=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.array)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:n.parsedType}),d.INVALID;if(n.data.length<this._def.items.length)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new re(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>d.ParseStatus.mergeArray(r,s)):d.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};u.ZodTuple=he;he.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:t,typeName:C.ZodTuple,rest:null,...S(e)})};var xn=class t extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.object)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:n.parsedType}),d.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new re(n,a,n.path,a)),value:s._parse(new re(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?d.ParseStatus.mergeObjectAsync(r,o):d.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof A?new t({keyType:e,valueType:r,typeName:C.ZodRecord,...S(n)}):new t({keyType:Ne.create(),valueType:e,typeName:C.ZodRecord,...S(r)})}};u.ZodRecord=xn;var wt=class extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.map)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.map,received:n.parsedType}),d.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],l)=>({key:o._parse(new re(n,a,n.path,[l,"key"])),value:i._parse(new re(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return d.INVALID;(l.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(l.value,p.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return d.INVALID;(l.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(l.value,p.value)}return{status:r.value,value:a}}}};u.ZodMap=wt;wt.create=(t,e,r)=>new wt({valueType:e,keyType:t,typeName:C.ZodMap,...S(r)});var Ot=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.set)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.set,received:n.parsedType}),d.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let l=new Set;for(let p of c){if(p.status==="aborted")return d.INVALID;p.status==="dirty"&&r.dirty(),l.add(p.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>i._parse(new re(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:v.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};u.ZodSet=Ot;Ot.create=(t,e)=>new Ot({valueType:t,minSize:null,maxSize:null,typeName:C.ZodSet,...S(e)});var In=class t extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.function)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.function,received:r.parsedType}),d.INVALID;function n(a,c){return(0,d.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Tn.getErrorMap)(),Tn.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_arguments,argumentsError:c}})}function o(a,c){return(0,d.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Tn.getErrorMap)(),Tn.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ue){let a=this;return(0,d.OK)(async function(...c){let l=new f.ZodError([]),p=await a._def.args.parseAsync(c,i).catch(E=>{throw l.addIssue(n(c,E)),l}),y=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(y,i).catch(E=>{throw l.addIssue(o(y,E)),l})})}else{let a=this;return(0,d.OK)(function(...c){let l=a._def.args.safeParse(c,i);if(!l.success)throw new f.ZodError([n(c,l.error)]);let p=Reflect.apply(s,this,l.data),y=a._def.returns.safeParse(p,i);if(!y.success)throw new f.ZodError([o(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:he.create(e).rest(Ie.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||he.create([]).rest(Ie.create()),returns:r||Ie.create(),typeName:C.ZodFunction,...S(n)})}};u.ZodFunction=In;var tt=class extends A{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};u.ZodLazy=tt;tt.create=(t,e)=>new tt({getter:t,typeName:C.ZodLazy,...S(e)});var rt=class extends A{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{received:r.data,code:f.ZodIssueCode.invalid_literal,expected:this._def.value}),d.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};u.ZodLiteral=rt;rt.create=(t,e)=>new rt({value:t,typeName:C.ZodLiteral,...S(e)});function Ha(t,e){return new nt({values:t,typeName:C.ZodEnum,...S(e)})}var nt=class t extends A{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,d.addIssueToContext)(r,{expected:m.util.joinValues(n),received:r.parsedType,code:f.ZodIssueCode.invalid_type}),d.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,d.addIssueToContext)(r,{received:r.data,code:f.ZodIssueCode.invalid_enum_value,options:n}),d.INVALID}return(0,d.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};u.ZodEnum=nt;nt.create=Ha;var ot=class extends A{_parse(e){let r=m.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.ZodParsedType.string&&n.parsedType!==m.ZodParsedType.number){let o=m.util.objectValues(r);return(0,d.addIssueToContext)(n,{expected:m.util.joinValues(o),received:n.parsedType,code:f.ZodIssueCode.invalid_type}),d.INVALID}if(this._cache||(this._cache=new Set(m.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=m.util.objectValues(r);return(0,d.addIssueToContext)(n,{received:n.data,code:f.ZodIssueCode.invalid_enum_value,options:o}),d.INVALID}return(0,d.OK)(e.data)}get enum(){return this._def.values}};u.ZodNativeEnum=ot;ot.create=(t,e)=>new ot({values:t,typeName:C.ZodNativeEnum,...S(e)});var Ue=class extends A{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.promise&&r.common.async===!1)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.promise,received:r.parsedType}),d.INVALID;let n=r.parsedType===m.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,d.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};u.ZodPromise=Ue;Ue.create=(t,e)=>new Ue({type:t,typeName:C.ZodPromise,...S(e)});var J=class extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{(0,d.addIssueToContext)(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return d.INVALID;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?d.INVALID:c.status==="dirty"||r.value==="dirty"?(0,d.DIRTY)(c.value):c});{if(r.value==="aborted")return d.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?d.INVALID:a.status==="dirty"||r.value==="dirty"?(0,d.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?d.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?d.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,d.isValid)(s))return d.INVALID;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>(0,d.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):d.INVALID);m.util.assertNever(o)}};u.ZodEffects=J;u.ZodTransformer=J;J.create=(t,e,r)=>new J({schema:t,typeName:C.ZodEffects,effect:e,...S(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:C.ZodEffects,...S(r)});var te=class extends A{_parse(e){return this._getType(e)===m.ZodParsedType.undefined?(0,d.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u.ZodOptional=te;te.create=(t,e)=>new te({innerType:t,typeName:C.ZodOptional,...S(e)});var ge=class extends A{_parse(e){return this._getType(e)===m.ZodParsedType.null?(0,d.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u.ZodNullable=ge;ge.create=(t,e)=>new ge({innerType:t,typeName:C.ZodNullable,...S(e)});var it=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===m.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};u.ZodDefault=it;it.create=(t,e)=>new it({innerType:t,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});var st=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,d.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};u.ZodCatch=st;st.create=(t,e)=>new st({innerType:t,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});var Pt=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.nan,received:n.parsedType}),d.INVALID}return{status:"valid",value:e.data}}};u.ZodNaN=Pt;Pt.create=t=>new Pt({typeName:C.ZodNaN,...S(t)});u.BRAND=Symbol("zod_brand");var xr=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};u.ZodBranded=xr;var Ir=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?d.INVALID:i.status==="dirty"?(r.dirty(),(0,d.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?d.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:C.ZodPipeline})}};u.ZodPipeline=Ir;var at=class extends A{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,d.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,d.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};u.ZodReadonly=at;at.create=(t,e)=>new at({innerType:t,typeName:C.ZodReadonly,...S(e)});function Ga(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Ka(t,e={},r){return t?ke.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(c=>{var l,p;if(!c){let y=Ga(e,n),T=(p=(l=y.fatal)!=null?l:r)!=null?p:!0;o.addIssue({code:"custom",...y,fatal:T})}});if(!i){let c=Ga(e,n),l=(a=(s=c.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...c,fatal:l})}}):ke.create()}u.late={object:H.lazycreate};var C;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(C||(u.ZodFirstPartyTypeKind=C={}));var tp=(t,e={message:`Input not instance of ${t.name}`})=>Ka(r=>r instanceof t,e);u.instanceof=tp;var Ya=Ne.create;u.string=Ya;var Xa=We.create;u.number=Xa;var rp=Pt.create;u.nan=rp;var np=He.create;u.bigint=np;var Ja=Ke.create;u.boolean=Ja;var op=Ye.create;u.date=op;var ip=St.create;u.symbol=ip;var sp=Xe.create;u.undefined=sp;var ap=Je.create;u.null=ap;var cp=ke.create;u.any=cp;var up=Ie.create;u.unknown=up;var dp=ie.create;u.never=dp;var lp=At.create;u.void=lp;var pp=Ee.create;u.array=pp;var fp=H.create;u.object=fp;var mp=H.strictCreate;u.strictObject=mp;var hp=Qe.create;u.union=hp;var gp=Cn.create;u.discriminatedUnion=gp;var yp=et.create;u.intersection=yp;var vp=he.create;u.tuple=vp;var _p=xn.create;u.record=_p;var bp=wt.create;u.map=bp;var Tp=Ot.create;u.set=Tp;var Cp=In.create;u.function=Cp;var xp=tt.create;u.lazy=xp;var Ip=rt.create;u.literal=Ip;var Ep=nt.create;u.enum=Ep;var Sp=ot.create;u.nativeEnum=Sp;var Ap=Ue.create;u.promise=Ap;var Qa=J.create;u.effect=Qa;u.transformer=Qa;var wp=te.create;u.optional=wp;var Op=ge.create;u.nullable=Op;var Pp=J.createWithPreprocess;u.preprocess=Pp;var Rp=Ir.create;u.pipeline=Rp;var Np=()=>Ya().optional();u.ostring=Np;var kp=()=>Xa().optional();u.onumber=kp;var Up=()=>Ja().optional();u.oboolean=Up;u.coerce={string:(t=>Ne.create({...t,coerce:!0})),number:(t=>We.create({...t,coerce:!0})),boolean:(t=>Ke.create({...t,coerce:!0})),bigint:(t=>He.create({...t,coerce:!0})),date:(t=>Ye.create({...t,coerce:!0}))};u.NEVER=d.INVALID});var si=g(ne=>{"use strict";var Zp=ne&&ne.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Rt=ne&&ne.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Zp(e,t,r)};Object.defineProperty(ne,"__esModule",{value:!0});Rt(_n(),ne);Rt(ni(),ne);Rt(Va(),ne);Rt(Tr(),ne);Rt(ec(),ne);Rt(vn(),ne)});var U=g(K=>{"use strict";var tc=K&&K.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),jp=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Dp=K&&K.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tc(e,t,r);return jp(e,t),e},Mp=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tc(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var rc=Dp(si());K.z=rc;Mp(si(),K);K.default=rc});var ai=g(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.actionTypesZodSchema=Nt.ActionTypes=void 0;var Lp=U(),nc;(function(t){t.OpenUrl="openUrl",t.ImBack="imBack",t.PostBack="postBack",t.PlayAudio="playAudio",t.PlayVideo="playVideo",t.ShowImage="showImage",t.DownloadFile="downloadFile",t.Signin="signin",t.Call="call",t.MessageBack="messageBack",t.OpenApp="openApp"})(nc||(Nt.ActionTypes=nc={}));Nt.actionTypesZodSchema=Lp.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var ci=g(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.semanticActionStateTypesZodSchema=kt.SemanticActionStateTypes=void 0;var Vp=U(),oc;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(oc||(kt.SemanticActionStateTypes=oc={}));kt.semanticActionStateTypesZodSchema=Vp.z.enum(["start","continue","done"])});var ui=g(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.attachmentLayoutTypesZodSchema=Ut.AttachmentLayoutTypes=void 0;var zp=U(),ic;(function(t){t.List="list",t.Carousel="carousel"})(ic||(Ut.AttachmentLayoutTypes=ic={}));Ut.attachmentLayoutTypesZodSchema=zp.z.enum(["list","carousel"])});var di=g(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.Channels=void 0;var sc;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.M365CopilotSubChannel="COPILOT",t.M365Copilot="msteams:COPILOT",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(sc||(En.Channels=sc={}))});var li=g(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.endOfConversationCodesZodSchema=Zt.EndOfConversationCodes=void 0;var qp=U(),ac;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(ac||(Zt.EndOfConversationCodes=ac={}));Zt.endOfConversationCodesZodSchema=qp.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var uc=g(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.MembershipSourceTypes=void 0;var cc;(function(t){t.Channel="channel",t.Team="team"})(cc||(Sn.MembershipSourceTypes=cc={}))});var lc=g(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.MembershipTypes=void 0;var dc;(function(t){t.Direct="direct",t.Transitive="transitive"})(dc||(An.MembershipTypes=dc={}))});var Er=g(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.roleTypeZodSchema=jt.RoleTypes=void 0;var Fp=U(),pc;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(pc||(jt.RoleTypes=pc={}));jt.roleTypeZodSchema=Fp.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var fc=g(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.addAIToActivity=Dt.ClientCitationIconName=void 0;Dt.ClientCitationIconName={MicrosoftWord:"Microsoft Word",MicrosoftExcel:"Microsoft Excel",MicrosoftPowerPoint:"Microsoft PowerPoint",MicrosoftOneNote:"Microsoft OneNote",MicrosoftSharePoint:"Microsoft SharePoint",MicrosoftVisio:"Microsoft Visio",MicrosoftLoop:"Microsoft Loop",MicrosoftWhiteboard:"Microsoft Whiteboard",AdobeIllustrator:"Adobe Illustrator",AdobePhotoshop:"Adobe Photoshop",AdobeInDesign:"Adobe InDesign",AdobeFlash:"Adobe Flash",Sketch:"Sketch",SourceCode:"Source Code",Image:"Image",GIF:"GIF",Video:"Video",Sound:"Sound",ZIP:"ZIP",Text:"Text",PDF:"PDF"};var Gp=(t,e,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:e,usageInfo:r};(n=t.entities)!==null&&n!==void 0||(t.entities=[]),t.entities.push(o)};Dt.addAIToActivity=Gp});var mc=g(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.adaptiveCardInvokeActionZodSchema=void 0;var ct=U();wn.adaptiveCardInvokeActionZodSchema=ct.z.object({type:ct.z.string().min(1),id:ct.z.string().optional(),verb:ct.z.string().min(1),data:ct.z.record(ct.z.string().min(1),ct.z.any())})});var hc={};zi(hc,{randomUUID:()=>$p});function $p(){return globalThis.crypto.randomUUID()}var gc=I(()=>{"use strict"});var pi=g(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.entityZodSchema=void 0;var yc=U();On.entityZodSchema=yc.z.object({type:yc.z.string().min(1)}).passthrough()});var vc=g(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.semanticActionZodSchema=void 0;var Sr=U(),Bp=pi(),Wp=ci();Pn.semanticActionZodSchema=Sr.z.object({id:Sr.z.string().min(1),state:Sr.z.union([Wp.semanticActionStateTypesZodSchema,Sr.z.string().min(1)]),entities:Sr.z.record(Bp.entityZodSchema)})});var _c=g(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.cardActionZodSchema=void 0;var ye=U(),Hp=ai();Rn.cardActionZodSchema=ye.z.object({type:ye.z.union([Hp.actionTypesZodSchema,ye.z.string().min(1)]),title:ye.z.string().min(1),image:ye.z.string().min(1).optional(),text:ye.z.string().min(1).optional(),displayText:ye.z.string().min(1).optional(),value:ye.z.any().optional(),channelData:ye.z.unknown().optional(),imageAltText:ye.z.string().min(1).optional()})});var bc=g(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.suggestedActionsZodSchema=void 0;var Nn=U(),Kp=_c();kn.suggestedActionsZodSchema=Nn.z.object({to:Nn.z.array(Nn.z.string().min(1)),actions:Nn.z.array(Kp.cardActionZodSchema)})});var fi=g(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.activityEventNamesZodSchema=Mt.ActivityEventNames=void 0;var Yp=U(),Tc;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Tc||(Mt.ActivityEventNames=Tc={}));Mt.activityEventNamesZodSchema=Yp.z.enum(["ContinueConversation","CreateConversation"])});var mi=g(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.activityImportanceZodSchema=Lt.ActivityImportance=void 0;var Xp=U(),Cc;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Cc||(Lt.ActivityImportance=Cc={}));Lt.activityImportanceZodSchema=Xp.z.enum(["low","normal","high"])});var hi=g(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.activityTypesZodSchema=Vt.ActivityTypes=void 0;var Jp=U(),xc;(function(t){t.Message="message",t.ContactRelationUpdate="contactRelationUpdate",t.ConversationUpdate="conversationUpdate",t.Typing="typing",t.EndOfConversation="endOfConversation",t.Event="event",t.Invoke="invoke",t.InvokeResponse="invokeResponse",t.DeleteUserData="deleteUserData",t.MessageUpdate="messageUpdate",t.MessageDelete="messageDelete",t.InstallationUpdate="installationUpdate",t.MessageReaction="messageReaction",t.Suggestion="suggestion",t.Trace="trace",t.Handoff="handoff",t.Command="command",t.CommandResult="commandResult"})(xc||(Vt.ActivityTypes=xc={}));Vt.activityTypesZodSchema=Jp.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Ic=g(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.attachmentZodSchema=void 0;var zt=U();Un.attachmentZodSchema=zt.z.object({contentType:zt.z.string().min(1),contentUrl:zt.z.string().min(1).optional(),content:zt.z.unknown().optional(),name:zt.z.string().min(1).optional(),thumbnailUrl:zt.z.string().min(1).optional()})});var Ec=g(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.addProductInfoToActivity=ut.clearProductInfoFromActivity=void 0;var Qp=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};ut.clearProductInfoFromActivity=Qp;var ef=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,ut.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};ut.addProductInfoToActivity=ef});var gi=g(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.channelAccountZodSchema=void 0;var se=U(),tf=Er();Zn.channelAccountZodSchema=se.z.object({id:se.z.string().min(1).optional(),name:se.z.string().optional(),aadObjectId:se.z.string().min(1).optional(),tenantId:se.z.string().min(1).optional(),agenticUserId:se.z.string().min(1).optional(),agenticAppId:se.z.string().min(1).optional(),agenticAppBlueprintId:se.z.string().min(1).optional(),role:se.z.union([tf.roleTypeZodSchema,se.z.string().min(1)]).optional(),properties:se.z.unknown().optional()})});var yi=g(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.conversationAccountZodSchema=void 0;var ve=U(),rf=Er();jn.conversationAccountZodSchema=ve.z.object({isGroup:ve.z.boolean().optional(),conversationType:ve.z.string().min(1).optional(),tenantId:ve.z.string().min(1).optional(),id:ve.z.string().min(1),name:ve.z.string().min(1).optional(),aadObjectId:ve.z.string().min(1).optional(),role:ve.z.union([rf.roleTypeZodSchema,ve.z.string().min(1)]).optional(),properties:ve.z.unknown().optional()})});var Ac=g(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.conversationReferenceZodSchema=void 0;var Ar=U(),Sc=gi(),nf=yi();Dn.conversationReferenceZodSchema=Ar.z.object({activityId:Ar.z.string().min(1).optional(),user:Sc.channelAccountZodSchema.optional(),locale:Ar.z.string().min(1).optional(),agent:Sc.channelAccountZodSchema.optional().nullable(),conversation:nf.conversationAccountZodSchema,channelId:Ar.z.string().min(1),serviceUrl:Ar.z.string().min(1).optional()})});var vi=g(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.deliveryModesZodSchema=qt.DeliveryModes=void 0;var of=U(),wc;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(wc||(qt.DeliveryModes=wc={}));qt.deliveryModesZodSchema=of.z.enum(["normal","notification","expectReplies","ephemeral"])});var _i=g(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.inputHintsZodSchema=Ft.InputHints=void 0;var sf=U(),Oc;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Oc||(Ft.InputHints=Oc={}));Ft.inputHintsZodSchema=sf.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var bi=g(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.messageReactionTypesZodSchema=Gt.MessageReactionTypes=void 0;var af=U(),Pc;(function(t){t.Like="like",t.PlusOne="plusOne"})(Pc||(Gt.MessageReactionTypes=Pc={}));Gt.messageReactionTypesZodSchema=af.z.enum(["like","plusOne"])});var Rc=g(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.messageReactionZodSchema=void 0;var Ti=U(),cf=bi();Mn.messageReactionZodSchema=Ti.z.object({type:Ti.z.union([cf.messageReactionTypesZodSchema,Ti.z.string().min(1)])})});var Ci=g($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.textFormatTypesZodSchema=$t.TextFormatTypes=void 0;var uf=U(),Nc;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Nc||($t.TextFormatTypes=Nc={}));$t.textFormatTypesZodSchema=uf.z.enum(["markdown","plain","xml"])});var kc=g(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.textHighlightZodSchema=void 0;var xi=U();Ln.textHighlightZodSchema=xi.z.object({text:xi.z.string().min(1),occurrence:xi.z.number()})});var Ii=g(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.ExceptionHelper=void 0;var Vn=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(y=>{s=s.replace(`{${y}}`,o[y])});let c=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${c}`,p=new e(l);return p.code=r.code,p.helpLink=c,n&&(p.innerException=n),p}};zn.ExceptionHelper=Vn;Vn.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var Ei=g(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.Errors=void 0;qn.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"},TargetedActivityIsGroupOnly:{code:-110008,description:"Targeted activities can only be sent in a group chat or channel."}}});var Si=g(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ActivityTreatments=void 0;var Uc;(function(t){t.Targeted="targeted"})(Uc||(Fn.ActivityTreatments=Uc={}))});var zc=g(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.Activity=dt.activityZodSchema=void 0;var df=(gc(),Fi(hc)),_=U(),lf=vc(),pf=bc(),Vc=fi(),ff=mi(),$n=hi(),mf=Ic(),hf=ui(),Zc=Ec(),Gn=gi(),jc=di(),gf=yi(),yf=Ac(),vf=li(),_f=vi(),bf=pi(),Tf=_i(),Dc=Rc(),Cf=Ci(),xf=kc(),Mc=Er(),Se=Ii(),Ae=Ei(),Lc=Si();dt.activityZodSchema=_.z.object({type:_.z.union([$n.activityTypesZodSchema,_.z.string().min(1)]),text:_.z.string().optional(),id:_.z.string().min(1).optional(),channelId:_.z.string().min(1).optional(),from:Gn.channelAccountZodSchema.optional(),timestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:_.z.string().min(1).optional(),callerId:_.z.string().min(1).optional(),serviceUrl:_.z.string().min(1).optional(),conversation:gf.conversationAccountZodSchema.optional(),recipient:Gn.channelAccountZodSchema.optional(),textFormat:_.z.union([Cf.textFormatTypesZodSchema,_.z.string().min(1)]).optional(),attachmentLayout:_.z.union([hf.attachmentLayoutTypesZodSchema,_.z.string().min(1)]).optional(),membersAdded:_.z.array(Gn.channelAccountZodSchema).optional(),membersRemoved:_.z.array(Gn.channelAccountZodSchema).optional(),reactionsAdded:_.z.array(Dc.messageReactionZodSchema).optional(),reactionsRemoved:_.z.array(Dc.messageReactionZodSchema).optional(),topicName:_.z.string().min(1).optional(),historyDisclosed:_.z.boolean().optional(),locale:_.z.string().min(1).optional(),speak:_.z.string().min(1).optional(),inputHint:_.z.union([Tf.inputHintsZodSchema,_.z.string().min(1)]).optional(),summary:_.z.string().min(1).optional(),suggestedActions:pf.suggestedActionsZodSchema.optional(),attachments:_.z.array(mf.attachmentZodSchema).optional(),entities:_.z.array(bf.entityZodSchema.passthrough()).optional(),channelData:_.z.any().optional(),action:_.z.string().min(1).optional(),replyToId:_.z.string().min(1).optional(),label:_.z.string().min(1).optional(),valueType:_.z.string().min(1).optional(),value:_.z.unknown().optional(),name:_.z.union([Vc.activityEventNamesZodSchema,_.z.string().min(1)]).optional(),relatesTo:yf.conversationReferenceZodSchema.optional(),code:_.z.union([vf.endOfConversationCodesZodSchema,_.z.string().min(1)]).optional(),expiration:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:_.z.union([ff.activityImportanceZodSchema,_.z.string().min(1)]).optional(),deliveryMode:_.z.union([_f.deliveryModesZodSchema,_.z.string().min(1)]).optional(),listenFor:_.z.array(_.z.string().min(1)).optional(),textHighlights:_.z.array(xf.textHighlightZodSchema).optional(),semanticAction:lf.semanticActionZodSchema.optional()});var Ai=class t{constructor(e){if(e===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidActivityTypeUndefined);if(e===null)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=dt.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,Zc.addProductInfoToActivity)(this,n):(0,Zc.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:$n.ActivityTypes.Event,name:Vc.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,df.randomUUID)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(n)}getAppropriateReplyToId(){if(this.type!==$n.ActivityTypes.ConversationUpdate||this.channelId!==jc.Channels.Directline&&this.channelId!==jc.Channels.Webchat)return this.id}getConversationReference(e){var r;if(this.recipient===null||this.recipient===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.ActivityChannelIdUndefined);let n=e!=null&&e.forceBaseChannel?(r=this.channelIdChannel)!==null&&r!==void 0?r:this.channelId:this.channelId;return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:n,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===$n.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),c=e.substring(0,n);c.length>0&&!/\s$/.test(c)&&(c+=" "),e=c+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}isTargetedActivity(){var e;return!((e=this.entities)===null||e===void 0)&&e.length?this.entities.some(r=>r.type==="activityTreatment"&&r.treatment===Lc.ActivityTreatments.Targeted):!1}makeTargetedActivity(){var e,r;if(!(!((e=this.conversation)===null||e===void 0)&&e.isGroup))throw Se.ExceptionHelper.generateException(Error,Ae.Errors.TargetedActivityIsGroupOnly);this.isTargetedActivity()||((r=this.entities)!==null&&r!==void 0||(this.entities=[]),this.entities.push({type:"activityTreatment",treatment:Lc.ActivityTreatments.Targeted}))}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(e,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,e,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Mc.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Mc.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var e,r,n;return(r=(e=this.recipient)===null||e===void 0?void 0:e.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};dt.Activity=Ai});var Bn=g(x=>{"use strict";var If=x&&x.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),qc=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&If(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.ActivityErrors=x.ExceptionHelper=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=x.ActivityTypes=x.ActivityImportance=x.ActivityEventNames=x.activityZodSchema=x.Activity=x.RoleTypes=x.MembershipTypes=x.MembershipSourceTypes=x.EndOfConversationCodes=x.Channels=x.AttachmentLayoutTypes=x.SemanticActionStateTypes=x.ActionTypes=void 0;var Ef=ai();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return Ef.ActionTypes}});var Sf=ci();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return Sf.SemanticActionStateTypes}});var Af=ui();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Af.AttachmentLayoutTypes}});var wf=di();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return wf.Channels}});var Of=li();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return Of.EndOfConversationCodes}});var Pf=uc();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return Pf.MembershipSourceTypes}});var Rf=lc();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return Rf.MembershipTypes}});var Nf=Er();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return Nf.RoleTypes}});qc(fc(),x);qc(mc(),x);var Fc=zc();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return Fc.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return Fc.activityZodSchema}});var kf=fi();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return kf.ActivityEventNames}});var Uf=mi();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return Uf.ActivityImportance}});var Zf=hi();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Zf.ActivityTypes}});var jf=vi();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return jf.DeliveryModes}});var Df=_i();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return Df.InputHints}});var Mf=bi();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return Mf.MessageReactionTypes}});var Lf=Ci();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return Lf.TextFormatTypes}});var Vf=Si();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return Vf.ActivityTreatments}});var zf=Ii();Object.defineProperty(x,"ExceptionHelper",{enumerable:!0,get:function(){return zf.ExceptionHelper}});var qf=Ei();Object.defineProperty(x,"ActivityErrors",{enumerable:!0,get:function(){return qf.Errors}})});var rr=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(rr||{});var nr=(b=>(b.Unknown="Unknown",b.Exp="Exp",b.Dev="Dev",b.Test="Test",b.Preprod="Preprod",b.FirstRelease="FirstRelease",b.Prod="Prod",b.Gov="Gov",b.High="High",b.DoD="DoD",b.Mooncake="Mooncake",b.Ex="Ex",b.Rx="Rx",b.Prv="Prv",b.Local="Local",b.GovFR="GovFR",b.Other="Other",b))(nr||{});var vr=Te($e()),al=(0,vr.debug)("copilot-studio:settings"),Ho=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},Ko=class extends Ho{constructor(e){var i,s,a,c;if(super(),!e)return;let r=((i=e.cloud)==null?void 0:i.trim())||"Prod",n=((s=e.copilotAgentType)==null?void 0:s.trim())||"Published",o=((a=e.authority)==null?void 0:a.trim())||"https://login.microsoftonline.com";if(!Object.values(nr).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(nr).join(", ")}`);if(!Object.values(rr).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(rr).join(", ")}`);al.info("Copilot Studio connection settings loaded",{schemaName:(c=e.schemaName)!=null?c:e.agentIdentifier,cloud:r,environmentId:e.environmentId,customPowerPlatformCloud:(0,vr.redactUrl)(e.customPowerPlatformCloud),copilotAgentType:n,directConnectUrl:(0,vr.redactUrl)(e.directConnectUrl),useExperimentalEndpoint:e.useExperimentalEndpoint,enableDiagnostics:e.enableDiagnostics}),Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Gg=()=>{var t,e,r,n,o,i,s,a;return new Ko({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((s=process.env.useExperimentalEndpoint)==null?void 0:s.toLowerCase())==="true",enableDiagnostics:((a=process.env.enableDiagnostics)==null?void 0:a.toLowerCase())==="true"})};var fn=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Yo(t){}function wa(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Yo,onError:r=Yo,onRetry:n=Yo,onComment:o}=t,i="",s=!0,a,c="",l="";function p(h){let w=s?h.replace(/^\xEF\xBB\xBF/,""):h,[b,P]=cl(`${i}${w}`);for(let O of b)y(O);i=P,s=!1}function y(h){if(h===""){E();return}if(h.startsWith(":")){o&&o(h.slice(h.startsWith(": ")?2:1));return}let w=h.indexOf(":");if(w!==-1){let b=h.slice(0,w),P=h[w+1]===" "?2:1,O=h.slice(w+P);T(b,O,h);return}T(h,"",h)}function T(h,w,b){switch(h){case"event":l=w;break;case"data":c=`${c}${w}
|
|
2
|
+
`;break;case"id":a=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?n(parseInt(w,10)):r(new fn(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:b}));break;default:r(new fn(`Unknown field "${h.length>20?`${h.slice(0,20)}\u2026`:h}"`,{type:"unknown-field",field:h,value:w,line:b}));break}}function E(){c.length>0&&e({id:a,event:l||void 0,data:c.endsWith(`
|
|
3
|
+
`)?c.slice(0,-1):c}),a=void 0,c="",l=""}function M(h={}){i&&h.consume&&y(i),s=!0,a=void 0,c="",l="",i=""}return{feed:p,reset:M}}function cl(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
|
|
4
4
|
`,n),s=-1;if(o!==-1&&i!==-1?s=Math.min(o,i):o!==-1?o===t.length-1?s=-1:s=o:i!==-1&&(s=i),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
5
|
-
`&&n++}}return[e,r]}var Vi="connecting",fu="open",to="closed",Pr=()=>{};function mu(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=Pr,onConnect:i=Pr,onDisconnect:s=Pr,onScheduleReconnect:a=Pr}=r,{fetch:c,url:l,initialLastEventId:p}=hu(r),g={...r.headers},T=[],E=n?[n]:[],M=D=>E.forEach(ce=>ce(D)),h=Li({onEvent:ou,onRetry:iu,onComment:o}),w,b=l.toString(),P=new AbortController,O=p,N=2e3,L,j=to;return _e(),{close:J,connect:_e,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Jt,get lastEventId(){return O},get url(){return b},get readyState(){return j}};function _e(){w||(j=Vi,P=new AbortController,w=c(l,su()).then(nu).catch(D=>{w=null,!(D.name==="AbortError"||D.type==="aborted"||P.signal.aborted)&&ki()}))}function J(){j=to,P.abort(),h.reset(),clearTimeout(L),T.forEach(D=>D())}function Jt(){let D=[],ce=[];function Qt(){return new Promise($=>{let ue=ce.shift();ue?$({value:ue,done:!1}):D.push($)})}let pt=function($){let ue=D.shift();ue?ue({value:$,done:!1}):ce.push($)};function Le(){for(E.splice(E.indexOf(pt),1);D.shift(););for(;ce.shift(););}function er(){let $=D.shift();$&&($({done:!0,value:void 0}),Le())}return T.push(er),E.push(pt),{next(){return j===to?this.return():Qt()},return(){return Le(),Promise.resolve({done:!0,value:void 0})},throw($){return Le(),Promise.reject($)},[Symbol.asyncIterator](){return this}}}function ki(){a({delay:N}),!P.signal.aborted&&(j=Vi,L=setTimeout(_e,N))}async function nu(D){i(),h.reset();let{body:ce,redirected:Qt,status:pt}=D;if(pt===204){s(),J();return}if(!ce)throw new Error("Missing response body");Qt&&(b=D.url);let Le=e(ce),er=new TextDecoder,$=Le.getReader(),ue=!0;j=fu;do{let{done:Zi,value:Ui}=await $.read();Ui&&h.feed(er.decode(Ui,{stream:!Zi})),Zi&&(ue=!1,w=null,h.reset(),ki(),s())}while(ue)}function ou(D){typeof D.id=="string"&&(O=D.id),M(D)}function iu(D){N=D}function su(){let{mode:D,credentials:ce,body:Qt,method:pt,redirect:Le,referrer:er,referrerPolicy:$}=r,ue={Accept:"text/event-stream",...g,...O?{"Last-Event-ID":O}:void 0};return{mode:D,credentials:ce,body:Qt,method:pt,redirect:Le,referrer:er,referrerPolicy:$,headers:ue,cache:"no-store",signal:P.signal}}}function hu(t){let e=t.fetch||globalThis.fetch;if(!gu(e))throw new Error("No fetch implementation provided, and one was not found on the global object.");if(typeof AbortController!="function")throw new Error("Missing AbortController implementation");let{url:r,initialLastEventId:n}=t;if(typeof r!="string"&&!(r instanceof URL))throw new Error("Invalid URL provided - must be string or URL instance");if(typeof n!="string"&&n!==void 0)throw new Error("Invalid initialLastEventId provided - must be string or undefined");return{fetch:e,url:r,initialLastEventId:n}}function gu(t){return typeof t=="function"}var yu={getStream:vu};function ro(t){return mu(t,yu)}function vu(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var Ea=Se(xt());var ln=class{constructor(e){this.API_VERSION="2022-03-01-preview";let r="schema"in e?e.schema:e.identifier,n=e.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var pn=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var It=(0,Ea.debug)("copilot-studio:power-platform");function gr(t,e){var c,l,p,g,T,E,M,h;let r=((c=t.schemaName)==null?void 0:c.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((p=t.directConnectUrl)!=null&&p.trim())&&(!((g=t.environmentId)!=null&&g.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((T=t.directConnectUrl)!=null&&T.trim()){if(It.debug(`Using direct connection: ${t.directConnectUrl}`),!hr(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return il(t.directConnectUrl,e).href}let n=(E=t.cloud)!=null?E:"Prod",o=(M=t.copilotAgentType)!=null?M:"Published";if(It.debug(`Using cloud setting: ${n}`),It.debug(`Using agent type: ${o}`),n==="Other")if((h=t.customPowerPlatformCloud)!=null&&h.trim())if(hr(t.customPowerPlatformCloud))It.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let i=sl(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new pn({host:i,schema:r}),Prebuilt:()=>new ln({host:i,schema:r})}[o]().getConversationUrl(e);return It.debug(`Generated Copilot Studio connection URL: ${a}`),a}function Aa(t,e){if(!e||!e.trim())throw new Error("conversationId is required for subscribe URL");let r=gr(t,e),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return It.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function Sa(t,e="Unknown",r="",n=""){var o,i;if(!n&&!(t!=null&&t.directConnectUrl)){if(e==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!t&&e==="Unknown")throw new Error("Either settings or cloud must be provided");if(t&&t.cloud&&t.cloud!=="Unknown"&&(e=t.cloud),e==="Other")if(r&&hr(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&hr(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${fn(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&hr(n)){if(Ia(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${fn(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${fn(Ia(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function hr(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function il(t,e){let r=new URL(t);return r.searchParams.has("api-version")||r.searchParams.append("api-version","2022-03-01-preview"),r.pathname.endsWith("/")&&(r.pathname=r.pathname.slice(0,-1)),r.pathname.includes("/conversations")&&(r.pathname=r.pathname.substring(0,r.pathname.indexOf("/conversations"))),r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r}function sl(t,e,r){if(t==="Other"&&(!r||!r.trim()))throw new Error("cloudBaseAddress must be provided when PowerPlatformCloud is Other");r=r!=null?r:"api.unknown.powerplatform.com";let n=e.toLowerCase().replaceAll("-",""),o=al(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${fn(t,r)}`)}function fn(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function al(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function Ia(t){switch(t.host.toLowerCase()){case"api.powerplatform.localhost":return"Local";case"api.exp.powerplatform.com":return"Exp";case"api.dev.powerplatform.com":return"Dev";case"api.prv.powerplatform.com":return"Prv";case"api.test.powerplatform.com":return"Test";case"api.preprod.powerplatform.com":return"Preprod";case"api.powerplatform.com":return"Prod";case"api.gov.powerplatform.microsoft.us":return"GovFR";case"api.high.powerplatform.microsoft.us":return"High";case"api.appsplatform.us":return"DoD";case"api.powerplatform.partner.microsoftonline.cn":return"Mooncake";default:return"Unknown"}}var dt=Se(qn());var Ir=class{constructor(e,r){this.activity=e,this.conversationId=r}};var De=Se(xt());var Fn="1.6.0-beta.24.g285b02c21b";var Gn={};var Er=class{static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${Fn}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Gn.platform()}-${Gn.arch()}/${Gn.release()}`,r}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${Fn}`}static getVersion(){return Fn}};var $n=class{static getScopeFromSettings(e){return Sa(e)}};function Mc(t,e){return{activities:t,conversationId:e,isNewConversation:!0}}function Lc(t,e){return{activities:t,conversationId:e,activityCount:t.length}}var U=Se(xt()),G={activitiesReceivedCounter:U.metric.counter(U.MetricNames.CSC_ACTIVITIES_RECEIVED,{unit:"activities",description:"Total number of activities received by the Copilot Studio client"}),activitiesSentCounter:U.metric.counter(U.MetricNames.CSC_ACTIVITIES_SENT,{unit:"activities",description:"Total number of activities sent to Copilot Studio"}),conversationsStartedCounter:U.metric.counter(U.MetricNames.CSC_CONVERSATIONS_STARTED,{unit:"conversations",description:"Total number of conversations started with Copilot Studio"}),webchatConnectionsCounter:U.metric.counter(U.MetricNames.CSC_WEBCHAT_CONNECTIONS,{unit:"connections",description:"Total number of webchat connections created with Copilot Studio"}),requestsCounter:U.metric.counter(U.MetricNames.CSC_REQUEST_COUNT,{unit:"requests",description:"Total number of HTTP/SSE requests made to Copilot Studio"}),requestsErrorCounter:U.metric.counter(U.MetricNames.CSC_REQUEST_ERRORS,{unit:"requests",description:"Total number of failed requests to Copilot Studio"}),executeStreamingCounter:U.metric.counter(U.MetricNames.CSC_EXECUTE_STREAMING,{unit:"operations",description:"Total number of execute streaming operations"}),subscribeAsyncCounter:U.metric.counter(U.MetricNames.CSC_SUBSCRIBE_ASYNC,{unit:"operations",description:"Total number of subscribeAsync operations"}),subscribeEventCounter:U.metric.counter(U.MetricNames.CSC_SUBSCRIBE_EVENT,{unit:"events",description:"Total number of events received via subscribeAsync"}),streamDuration:U.metric.histogram(U.MetricNames.CSC_STREAM_DURATION,{unit:"ms",description:"Duration of SSE stream sessions in milliseconds"}),requestDuration:U.metric.histogram(U.MetricNames.CSC_REQUEST_DURATION,{unit:"ms",description:"Duration of requests to Copilot Studio in milliseconds"})};var xi=Se(qn()),K=Se(xt());var Ue={createConnection:K.trace.define({name:K.SpanNames.COPILOT_CREATE_CONNECTION,record:{showTyping:!1},actions:({span:t})=>({receivedFromCopilot(e){var r,n,o;t.addEvent("activity.received.from.copilot.studio",{"copilot.webchat.activity.type":(r=e.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=e.conversation)==null?void 0:n.id)!=null?o:"unknown"})},sentToWebChat(e){var r,n,o;t.addEvent("activity.sent.to.webchat",{"copilot.webchat.activity.type":(r=e.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=e.conversation)==null?void 0:n.id)!=null?o:"unknown"})}}),end({span:t,record:e}){var n;let r={"copilot.webchat.show_typing":(n=e.showTyping)!=null?n:"unknown"};t.setAttributes(r),G.webchatConnectionsCounter.add(1,r)}}),postRequest:K.trace.define({name:K.SpanNames.COPILOT_POST_REQUEST,record:{url:"",method:""},actions:({span:t})=>({receivedFromCopilot(e){var n,o,i;let r={"copilot.activity.type":(n=e.type)!=null?n:"unknown","copilot.activity.conversation_id":(i=(o=e.conversation)==null?void 0:o.id)!=null?i:"unknown"};t.addEvent("activity.received",{"copilot.post_request.activity.type":r["copilot.activity.type"],"copilot.post_request.activity.conversation_id":r["copilot.activity.conversation_id"]}),G.activitiesReceivedCounter.add(1,r)}}),end({span:t,record:e,duration:r,error:n}){var s,a;let o={"copilot.post_request.url":(s=e.url)!=null?s:"unknown","copilot.post_request.method":(a=e.method)!=null?a:"unknown"},i={operation:"postRequestAsync","copilot.post_request.url":o["copilot.post_request.url"],"copilot.post_request.method":o["copilot.post_request.method"]};t.setAttributes(o),G.requestsCounter.add(1,i),G.streamDuration.record(r,i),n&&G.requestsErrorCounter.add(1,{...i,"error.type":n instanceof Error?n.name:typeof n})}}),startConversation:K.trace.define({name:K.SpanNames.COPILOT_START_CONVERSATION,record:{shouldEmitStartEvent:!1},end({span:t,record:e,duration:r}){let n=e.shouldEmitStartEvent?{"copilot.emit_start_event":!0}:{"copilot.request":!0},o={operation:"startConversationStreaming",...n};t.setAttributes(n),G.conversationsStartedCounter.add(1,o),G.requestDuration.record(r,o)}}),sendActivity:K.trace.define({name:K.SpanNames.COPILOT_SEND_ACTIVITY,record:{activity:xi.Activity.fromObject({type:"unknown"})},end({span:t,record:e,duration:r}){var i,s,a;let n={"copilot.activity.type":(i=e.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(a=(s=e.activity.conversation)==null?void 0:s.id)!=null?a:"unknown"},o={operation:"sendActivityStreaming",...n};t.setAttributes(n),G.activitiesSentCounter.add(1,n),G.requestDuration.record(r,o)}}),executeStreaming:K.trace.define({name:K.SpanNames.COPILOT_EXECUTE_STREAMING,record:{activity:xi.Activity.fromObject({type:"unknown"}),conversationId:"unknown"},end({span:t,record:e,duration:r}){var i,s;let n={"copilot.activity.type":(i=e.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(s=e.conversationId)!=null?s:"unknown"},o={operation:"executeStreaming",...n};t.setAttributes(n),G.executeStreamingCounter.add(1,n),G.requestDuration.record(r,o)}}),subscribeAsync:K.trace.define({name:K.SpanNames.COPILOT_SUBSCRIBE_ASYNC,record:{conversationId:"unknown",lastReceivedEventId:"unknown"},actions:({span:t})=>({eventReceivedFromCopilot(e){var n,o;let r={"copilot.subscribe_async.event.id":(n=e.eventId)!=null?n:"unknown","copilot.subscribe_async.event.activity.type":(o=e.activity.type)!=null?o:"unknown"};t.addEvent("event.received",r),G.subscribeEventCounter.add(1,r)}}),end({span:t,record:e,duration:r}){var i,s;let n={"copilot.subscribe_async.conversation_id":(i=e.conversationId)!=null?i:"unknown","copilot.subscribe_async.last_received_event_id":(s=e.lastReceivedEventId)!=null?s:"unknown"},o={operation:"subscribeAsync","copilot.conversation_id":n["copilot.subscribe_async.conversation_id"],"copilot.last_received_event_id":n["copilot.subscribe_async.last_received_event_id"]};t.setAttributes(n),G.subscribeAsyncCounter.add(1,o),G.streamDuration.record(r,o)}})};var V=(0,De.debug)("copilot-studio:client"),je=class je{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}logDiagnostic(e,...r){this.settings.enableDiagnostics&&V.info(`[DIAGNOSTICS] ${e}`,...r)}async*postRequestAsync(e,r,n="POST"){var i,s,a,c,l,p,g,T,E,M;let o=(0,De.trace)(Ue.postRequest);o.record({url:e,method:n});try{this.logDiagnostic(`Request URL: ${e}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),V.debug(`>>> SEND TO ${e}`);let h=new Map,w=ro({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Er.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(b,P)=>{let O=await fetch(b,P);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:b,event:P}of w){if(b&&P==="activity")try{let O=dt.Activity.fromJson(b);o.actions.receivedFromCopilot(O);let N=(i=O.entities)==null?void 0:i.find(L=>L.type==="streaminfo"&&L.streamType==="streaming");switch(O.type){case dt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(a=(s=O.conversation)==null?void 0:s.id)!=null?a:"",V.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case dt.ActivityTypes.Typing:if(V.debug(`Activity type: ${O.type}`),N||((c=O.channelData)==null?void 0:c.streamType)==="streaming"){let L=(l=O.text)!=null?l:"",j=(g=N==null?void 0:N.streamId)!=null?g:(p=O.channelData)==null?void 0:p.streamId,_e=(E=N==null?void 0:N.streamSequence)!=null?E:(T=O.channelData)==null?void 0:T.streamSequence;if(j&&_e){if(h.has(j)){let J=h.get(j);J.push({text:L,sequence:_e}),h.set(j,J)}else h.set(j,[{text:L,sequence:_e}]);O.text=((M=h.get(j))==null?void 0:M.sort((J,Jt)=>J.sequence-Jt.sequence).map(J=>J.text).join(""))||""}}yield O;break;default:V.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){V.error("Failed to parse activity:",O)}else if(P==="end"){V.debug("Stream complete");break}if(w.readyState==="closed"){V.debug("Connection closed");break}}}finally{w.close()}}catch(h){throw o.fail(h)}finally{o.end()}}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(je.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,V.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(je.conversationIdHeaderKey))!=null?o:"",this.conversationId&&V.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==je.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(e){var n,o;let r=(0,De.trace)(Ue.startConversation);try{let i;typeof e=="boolean"||e===void 0?(r.record({shouldEmitStartEvent:e!=null?e:!0}),i={emitStartConversationEvent:e!=null?e:!0}):(i=e,r.record({shouldEmitStartEvent:(n=i.emitStartConversationEvent)!=null?n:!0}));let s=gr(this.settings,i.conversationId),a={emitStartConversationEvent:(o=i.emitStartConversationEvent)!=null?o:!0};i.locale&&(a.locale=i.locale),V.info("Starting conversation ...",i),this.logDiagnostic("Start conversation request:",a),yield*this.postRequestAsync(s,a,"POST")}catch(i){throw r.fail(i)}finally{r.end()}}async*sendActivityStreaming(e,r=this.conversationId){var o,i;let n=(0,De.trace)(Ue.sendActivity);n.record({activity:e});try{let s=(i=(o=e.conversation)==null?void 0:o.id)!=null?i:r,a=gr(this.settings,s),c=new Ir(e);V.info("Sending activity...",e),yield*this.postRequestAsync(a,c,"POST")}catch(s){throw n.fail(s)}finally{n.end()}}async*executeStreaming(e,r){let n=(0,De.trace)(Ue.executeStreaming);n.record({activity:e,conversationId:r});try{if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let o=gr(this.settings,r),i=new Ir(e,r);V.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:e.type,activityText:e.text}),yield*this.postRequestAsync(o,i,"POST")}catch(o){throw n.fail(o)}finally{n.end()}}async execute(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return n}async startConversationAsync(e){let r=[];for await(let n of this.startConversationStreaming(e))r.push(n);return r}async askQuestionAsync(e,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:e,conversation:o},s=dt.Activity.fromObject(i),a=[];for await(let c of this.sendActivityStreaming(s,r))a.push(c);return a}async sendActivity(e,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(e,r))n.push(o);return n}async startConversationWithResponse(e){var o;let r=[],n="";for await(let i of this.startConversationStreaming(e))r.push(i),(o=i.conversation)!=null&&o.id&&(n=i.conversation.id);return n=n||this.conversationId,Mc(r,n)}async executeWithResponse(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return Lc(n,r)}async*subscribeAsync(e,r){let n=(0,De.trace)(Ue.subscribeAsync);n.record({conversationId:e,lastReceivedEventId:r});try{if(!e||!e.trim())throw new Error("conversationId is required for subscribeAsync");let o=Aa(this.settings,e);V.info("Subscribing to conversation:",e),this.logDiagnostic("Subscribe request:",{conversationId:e,lastReceivedEventId:r,url:o});let i=ro({url:o,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Er.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(s,a)=>{let c=await fetch(s,a);return this.processResponseHeaders(c.headers),c}});try{for await(let{data:s,event:a,id:c}of i){if(s&&a==="activity")try{let l=dt.Activity.fromJson(s),p={activity:l,eventId:c};n.actions.eventReceivedFromCopilot(p),V.debug(`Received activity via subscription, event ID: ${c}`),this.logDiagnostic("Subscribe event received:",{eventId:c,activityType:l.type}),yield p}catch(l){V.error("Failed to parse activity in subscription:",l)}else if(a==="end"){V.debug("Subscription stream complete");break}if(i.readyState==="closed"){V.debug("Subscription connection closed");break}}}finally{i.close()}}catch(o){throw n.fail(o)}finally{n.end()}}};je.conversationIdHeaderKey="x-ms-conversationid",je.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",je.scopeFromSettings=$n.getScopeFromSettings;var Vc=je;function zc(){return globalThis.crypto.randomUUID()}var ru=Se(qn());var Ii=function(t,e){return Ii=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Ii(t,e)};function Me(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ii(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Ar(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Bt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function Wt(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function oe(t){return typeof t=="function"}function Bn(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Wn=Bn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
5
|
+
`&&n++}}return[e,r]}var Oa="connecting",ul="open",Xo="closed",mn=()=>{};function dl(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=mn,onConnect:i=mn,onDisconnect:s=mn,onScheduleReconnect:a=mn}=r,{fetch:c,url:l,initialLastEventId:p}=ll(r),y={...r.headers},T=[],E=n?[n]:[],M=D=>E.forEach(ce=>ce(D)),h=wa({onEvent:du,onRetry:lu,onComment:o}),w,b=l.toString(),P=new AbortController,O=p,N=2e3,L,j=Xo;return be(),{close:Q,connect:be,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Qt,get lastEventId(){return O},get url(){return b},get readyState(){return j}};function be(){w||(j=Oa,P=new AbortController,w=c(l,pu()).then(uu).catch(D=>{w=null,!(D.name==="AbortError"||D.type==="aborted"||P.signal.aborted)&&Mi()}))}function Q(){j=Xo,P.abort(),h.reset(),clearTimeout(L),T.forEach(D=>D())}function Qt(){let D=[],ce=[];function er(){return new Promise(B=>{let ue=ce.shift();ue?B({value:ue,done:!1}):D.push(B)})}let ft=function(B){let ue=D.shift();ue?ue({value:B,done:!1}):ce.push(B)};function Le(){for(E.splice(E.indexOf(ft),1);D.shift(););for(;ce.shift(););}function tr(){let B=D.shift();B&&(B({done:!0,value:void 0}),Le())}return T.push(tr),E.push(ft),{next(){return j===Xo?this.return():er()},return(){return Le(),Promise.resolve({done:!0,value:void 0})},throw(B){return Le(),Promise.reject(B)},[Symbol.asyncIterator](){return this}}}function Mi(){a({delay:N}),!P.signal.aborted&&(j=Oa,L=setTimeout(be,N))}async function uu(D){i(),h.reset();let{body:ce,redirected:er,status:ft}=D;if(ft===204){s(),Q();return}if(!ce)throw new Error("Missing response body");er&&(b=D.url);let Le=e(ce),tr=new TextDecoder,B=Le.getReader(),ue=!0;j=ul;do{let{done:Li,value:Vi}=await B.read();Vi&&h.feed(tr.decode(Vi,{stream:!Li})),Li&&(ue=!1,w=null,h.reset(),Mi(),s())}while(ue)}function du(D){typeof D.id=="string"&&(O=D.id),M(D)}function lu(D){N=D}function pu(){let{mode:D,credentials:ce,body:er,method:ft,redirect:Le,referrer:tr,referrerPolicy:B}=r,ue={Accept:"text/event-stream",...y,...O?{"Last-Event-ID":O}:void 0};return{mode:D,credentials:ce,body:er,method:ft,redirect:Le,referrer:tr,referrerPolicy:B,headers:ue,cache:"no-store",signal:P.signal}}}function ll(t){let e=t.fetch||globalThis.fetch;if(!pl(e))throw new Error("No fetch implementation provided, and one was not found on the global object.");if(typeof AbortController!="function")throw new Error("Missing AbortController implementation");let{url:r,initialLastEventId:n}=t;if(typeof r!="string"&&!(r instanceof URL))throw new Error("Invalid URL provided - must be string or URL instance");if(typeof n!="string"&&n!==void 0)throw new Error("Invalid initialLastEventId provided - must be string or undefined");return{fetch:e,url:r,initialLastEventId:n}}function pl(t){return typeof t=="function"}var fl={getStream:ml};function Jo(t){return dl(t,fl)}function ml(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var Ra=Te($e());var hn=class{constructor(e){this.API_VERSION="2022-03-01-preview";let r="schema"in e?e.schema:e.identifier,n=e.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var gn=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var It=(0,Ra.debug)("copilot-studio:power-platform");function br(t,e){var c,l,p,y,T,E,M,h;let r=((c=t.schemaName)==null?void 0:c.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((p=t.directConnectUrl)!=null&&p.trim())&&(!((y=t.environmentId)!=null&&y.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((T=t.directConnectUrl)!=null&&T.trim()){if(It.debug(`Using direct connection: ${t.directConnectUrl}`),!_r(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return hl(t.directConnectUrl,e).href}let n=(E=t.cloud)!=null?E:"Prod",o=(M=t.copilotAgentType)!=null?M:"Published";if(It.debug(`Using cloud setting: ${n}`),It.debug(`Using agent type: ${o}`),n==="Other")if((h=t.customPowerPlatformCloud)!=null&&h.trim())if(_r(t.customPowerPlatformCloud))It.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let i=gl(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new gn({host:i,schema:r}),Prebuilt:()=>new hn({host:i,schema:r})}[o]().getConversationUrl(e);return It.debug(`Generated Copilot Studio connection URL: ${a}`),a}function Na(t,e){if(!e||!e.trim())throw new Error("conversationId is required for subscribe URL");let r=br(t,e),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return It.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function ka(t,e="Unknown",r="",n=""){var o,i;if(!n&&!(t!=null&&t.directConnectUrl)){if(e==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!t&&e==="Unknown")throw new Error("Either settings or cloud must be provided");if(t&&t.cloud&&t.cloud!=="Unknown"&&(e=t.cloud),e==="Other")if(r&&_r(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&_r(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${yn(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&_r(n)){if(Pa(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${yn(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${yn(Pa(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function _r(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function hl(t,e){let r=new URL(t);return r.searchParams.has("api-version")||r.searchParams.append("api-version","2022-03-01-preview"),r.pathname.endsWith("/")&&(r.pathname=r.pathname.slice(0,-1)),r.pathname.includes("/conversations")&&(r.pathname=r.pathname.substring(0,r.pathname.indexOf("/conversations"))),r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r}function gl(t,e,r){if(t==="Other"&&(!r||!r.trim()))throw new Error("cloudBaseAddress must be provided when PowerPlatformCloud is Other");r=r!=null?r:"api.unknown.powerplatform.com";let n=e.toLowerCase().replaceAll("-",""),o=yl(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${yn(t,r)}`)}function yn(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function yl(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function Pa(t){switch(t.host.toLowerCase()){case"api.powerplatform.localhost":return"Local";case"api.exp.powerplatform.com":return"Exp";case"api.dev.powerplatform.com":return"Dev";case"api.prv.powerplatform.com":return"Prv";case"api.test.powerplatform.com":return"Test";case"api.preprod.powerplatform.com":return"Preprod";case"api.powerplatform.com":return"Prod";case"api.gov.powerplatform.microsoft.us":return"GovFR";case"api.high.powerplatform.microsoft.us":return"High";case"api.appsplatform.us":return"DoD";case"api.powerplatform.partner.microsoftonline.cn":return"Mooncake";default:return"Unknown"}}var lt=Te(Bn());var wr=class{constructor(e,r){this.activity=e,this.conversationId=r}};var De=Te($e());var Wn="1.6.0-beta.30.g545c41a189";var Hn={};var Or=class{static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${Wn}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Hn.platform()}-${Hn.arch()}/${Hn.release()}`,r}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${Wn}`}static getVersion(){return Wn}};var Kn=class{static getScopeFromSettings(e){return ka(e)}};function Gc(t,e){return{activities:t,conversationId:e,isNewConversation:!0}}function $c(t,e){return{activities:t,conversationId:e,activityCount:t.length}}var Z=Te($e()),$={activitiesReceivedCounter:Z.metric.counter(Z.MetricNames.CSC_ACTIVITIES_RECEIVED,{unit:"activities",description:"Total number of activities received by the Copilot Studio client"}),activitiesSentCounter:Z.metric.counter(Z.MetricNames.CSC_ACTIVITIES_SENT,{unit:"activities",description:"Total number of activities sent to Copilot Studio"}),conversationsStartedCounter:Z.metric.counter(Z.MetricNames.CSC_CONVERSATIONS_STARTED,{unit:"conversations",description:"Total number of conversations started with Copilot Studio"}),webchatConnectionsCounter:Z.metric.counter(Z.MetricNames.CSC_WEBCHAT_CONNECTIONS,{unit:"connections",description:"Total number of webchat connections created with Copilot Studio"}),requestsCounter:Z.metric.counter(Z.MetricNames.CSC_REQUEST_COUNT,{unit:"requests",description:"Total number of HTTP/SSE requests made to Copilot Studio"}),requestsErrorCounter:Z.metric.counter(Z.MetricNames.CSC_REQUEST_ERRORS,{unit:"requests",description:"Total number of failed requests to Copilot Studio"}),executeStreamingCounter:Z.metric.counter(Z.MetricNames.CSC_EXECUTE_STREAMING,{unit:"operations",description:"Total number of execute streaming operations"}),subscribeAsyncCounter:Z.metric.counter(Z.MetricNames.CSC_SUBSCRIBE_ASYNC,{unit:"operations",description:"Total number of subscribeAsync operations"}),subscribeEventCounter:Z.metric.counter(Z.MetricNames.CSC_SUBSCRIBE_EVENT,{unit:"events",description:"Total number of events received via subscribeAsync"}),streamDuration:Z.metric.histogram(Z.MetricNames.CSC_STREAM_DURATION,{unit:"ms",description:"Duration of SSE stream sessions in milliseconds"}),requestDuration:Z.metric.histogram(Z.MetricNames.CSC_REQUEST_DURATION,{unit:"ms",description:"Duration of requests to Copilot Studio in milliseconds"})};var wi=Te(Bn()),Y=Te($e());var Ze={createConnection:Y.trace.define({name:Y.SpanNames.COPILOT_CREATE_CONNECTION,record:{showTyping:!1},actions:({span:t})=>({receivedFromCopilot(e){var r,n,o;t.addEvent("activity.received.from.copilot.studio",{"copilot.webchat.activity.type":(r=e.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=e.conversation)==null?void 0:n.id)!=null?o:"unknown"})},sentToWebChat(e){var r,n,o;t.addEvent("activity.sent.to.webchat",{"copilot.webchat.activity.type":(r=e.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=e.conversation)==null?void 0:n.id)!=null?o:"unknown"})}}),end({span:t,record:e}){var n;let r={"copilot.webchat.show_typing":(n=e.showTyping)!=null?n:"unknown"};t.setAttributes(r),$.webchatConnectionsCounter.add(1,r)}}),postRequest:Y.trace.define({name:Y.SpanNames.COPILOT_POST_REQUEST,record:{url:"",method:""},actions:({span:t})=>({receivedFromCopilot(e){var n,o,i;let r={"copilot.activity.type":(n=e.type)!=null?n:"unknown","copilot.activity.conversation_id":(i=(o=e.conversation)==null?void 0:o.id)!=null?i:"unknown"};t.addEvent("activity.received",{"copilot.post_request.activity.type":r["copilot.activity.type"],"copilot.post_request.activity.conversation_id":r["copilot.activity.conversation_id"]}),$.activitiesReceivedCounter.add(1,r)}}),end({span:t,record:e,duration:r,error:n}){var s,a;let o={"copilot.post_request.url":(s=e.url)!=null?s:"unknown","copilot.post_request.method":(a=e.method)!=null?a:"unknown"},i={operation:"postRequestAsync","copilot.post_request.url":o["copilot.post_request.url"],"copilot.post_request.method":o["copilot.post_request.method"]};t.setAttributes(o),$.requestsCounter.add(1,i),$.streamDuration.record(r,i),n&&$.requestsErrorCounter.add(1,{...i,"error.type":n instanceof Error?n.name:typeof n})}}),startConversation:Y.trace.define({name:Y.SpanNames.COPILOT_START_CONVERSATION,record:{shouldEmitStartEvent:!1},end({span:t,record:e,duration:r}){let n=e.shouldEmitStartEvent?{"copilot.emit_start_event":!0}:{"copilot.request":!0},o={operation:"startConversationStreaming",...n};t.setAttributes(n),$.conversationsStartedCounter.add(1,o),$.requestDuration.record(r,o)}}),sendActivity:Y.trace.define({name:Y.SpanNames.COPILOT_SEND_ACTIVITY,record:{activity:wi.Activity.fromObject({type:"unknown"})},end({span:t,record:e,duration:r}){var i,s,a;let n={"copilot.activity.type":(i=e.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(a=(s=e.activity.conversation)==null?void 0:s.id)!=null?a:"unknown"},o={operation:"sendActivityStreaming",...n};t.setAttributes(n),$.activitiesSentCounter.add(1,n),$.requestDuration.record(r,o)}}),executeStreaming:Y.trace.define({name:Y.SpanNames.COPILOT_EXECUTE_STREAMING,record:{activity:wi.Activity.fromObject({type:"unknown"}),conversationId:"unknown"},end({span:t,record:e,duration:r}){var i,s;let n={"copilot.activity.type":(i=e.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(s=e.conversationId)!=null?s:"unknown"},o={operation:"executeStreaming",...n};t.setAttributes(n),$.executeStreamingCounter.add(1,n),$.requestDuration.record(r,o)}}),subscribeAsync:Y.trace.define({name:Y.SpanNames.COPILOT_SUBSCRIBE_ASYNC,record:{conversationId:"unknown",lastReceivedEventId:"unknown"},actions:({span:t})=>({eventReceivedFromCopilot(e){var n,o;let r={"copilot.subscribe_async.event.id":(n=e.eventId)!=null?n:"unknown","copilot.subscribe_async.event.activity.type":(o=e.activity.type)!=null?o:"unknown"};t.addEvent("event.received",r),$.subscribeEventCounter.add(1,r)}}),end({span:t,record:e,duration:r}){var i,s;let n={"copilot.subscribe_async.conversation_id":(i=e.conversationId)!=null?i:"unknown","copilot.subscribe_async.last_received_event_id":(s=e.lastReceivedEventId)!=null?s:"unknown"},o={operation:"subscribeAsync","copilot.conversation_id":n["copilot.subscribe_async.conversation_id"],"copilot.last_received_event_id":n["copilot.subscribe_async.last_received_event_id"]};t.setAttributes(n),$.subscribeAsyncCounter.add(1,o),$.streamDuration.record(r,o)}})};var z=(0,De.debug)("copilot-studio:client"),je=class je{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}logDiagnostic(e,...r){this.settings.enableDiagnostics&&z.info(`[DIAGNOSTICS] ${e}`,...r)}async*postRequestAsync(e,r,n="POST"){var i,s,a,c,l,p,y,T,E,M;let o=(0,De.trace)(Ze.postRequest);o.record({url:e,method:n});try{this.logDiagnostic(`Request URL: ${e}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),z.debug(`>>> SEND TO ${e}`);let h=new Map,w=Jo({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Or.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(b,P)=>{let O=await fetch(b,P);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:b,event:P}of w){if(b&&P==="activity")try{let O=lt.Activity.fromJson(b);o.actions.receivedFromCopilot(O);let N=(i=O.entities)==null?void 0:i.find(L=>L.type==="streaminfo"&&L.streamType==="streaming");switch(O.type){case lt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(a=(s=O.conversation)==null?void 0:s.id)!=null?a:"",z.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case lt.ActivityTypes.Typing:if(z.debug(`Activity type: ${O.type}`),N||((c=O.channelData)==null?void 0:c.streamType)==="streaming"){let L=(l=O.text)!=null?l:"",j=(y=N==null?void 0:N.streamId)!=null?y:(p=O.channelData)==null?void 0:p.streamId,be=(E=N==null?void 0:N.streamSequence)!=null?E:(T=O.channelData)==null?void 0:T.streamSequence;if(j&&be){if(h.has(j)){let Q=h.get(j);Q.push({text:L,sequence:be}),h.set(j,Q)}else h.set(j,[{text:L,sequence:be}]);O.text=((M=h.get(j))==null?void 0:M.sort((Q,Qt)=>Q.sequence-Qt.sequence).map(Q=>Q.text).join(""))||""}}yield O;break;default:z.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){z.error("Failed to parse activity:",O)}else if(P==="end"){z.debug("Stream complete");break}if(w.readyState==="closed"){z.debug("Connection closed");break}}}finally{w.close()}}catch(h){throw o.fail(h)}finally{o.end()}}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(je.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,z.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(je.conversationIdHeaderKey))!=null?o:"",this.conversationId&&z.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==je.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(e){var n,o;let r=(0,De.trace)(Ze.startConversation);try{let i;typeof e=="boolean"||e===void 0?(r.record({shouldEmitStartEvent:e!=null?e:!0}),i={emitStartConversationEvent:e!=null?e:!0}):(i=e,r.record({shouldEmitStartEvent:(n=i.emitStartConversationEvent)!=null?n:!0}));let s=br(this.settings,i.conversationId),a={emitStartConversationEvent:(o=i.emitStartConversationEvent)!=null?o:!0};i.locale&&(a.locale=i.locale),z.info("Starting conversation ...",i),this.logDiagnostic("Start conversation request:",a),yield*this.postRequestAsync(s,a,"POST")}catch(i){throw r.fail(i)}finally{r.end()}}async*sendActivityStreaming(e,r=this.conversationId){var o,i;let n=(0,De.trace)(Ze.sendActivity);n.record({activity:e});try{let s=(i=(o=e.conversation)==null?void 0:o.id)!=null?i:r,a=br(this.settings,s),c=new wr(e);z.info("Sending activity...",e),yield*this.postRequestAsync(a,c,"POST")}catch(s){throw n.fail(s)}finally{n.end()}}async*executeStreaming(e,r){let n=(0,De.trace)(Ze.executeStreaming);n.record({activity:e,conversationId:r});try{if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let o=br(this.settings,r),i=new wr(e,r);z.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:e.type,activityText:e.text}),yield*this.postRequestAsync(o,i,"POST")}catch(o){throw n.fail(o)}finally{n.end()}}async execute(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return n}async startConversationAsync(e){let r=[];for await(let n of this.startConversationStreaming(e))r.push(n);return r}async askQuestionAsync(e,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:e,conversation:o},s=lt.Activity.fromObject(i),a=[];for await(let c of this.sendActivityStreaming(s,r))a.push(c);return a}async sendActivity(e,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(e,r))n.push(o);return n}async startConversationWithResponse(e){var o;let r=[],n="";for await(let i of this.startConversationStreaming(e))r.push(i),(o=i.conversation)!=null&&o.id&&(n=i.conversation.id);return n=n||this.conversationId,Gc(r,n)}async executeWithResponse(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return $c(n,r)}async*subscribeAsync(e,r){let n=(0,De.trace)(Ze.subscribeAsync);n.record({conversationId:e,lastReceivedEventId:r});try{if(!e||!e.trim())throw new Error("conversationId is required for subscribeAsync");let o=Na(this.settings,e);z.info("Subscribing to conversation:",e),this.logDiagnostic("Subscribe request:",{conversationId:e,lastReceivedEventId:r,url:o});let i=Jo({url:o,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Or.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(s,a)=>{let c=await fetch(s,a);return this.processResponseHeaders(c.headers),c}});try{for await(let{data:s,event:a,id:c}of i){if(s&&a==="activity")try{let l=lt.Activity.fromJson(s),p={activity:l,eventId:c};n.actions.eventReceivedFromCopilot(p),z.debug(`Received activity via subscription, event ID: ${c}`),this.logDiagnostic("Subscribe event received:",{eventId:c,activityType:l.type}),yield p}catch(l){z.error("Failed to parse activity in subscription:",l)}else if(a==="end"){z.debug("Subscription stream complete");break}if(i.readyState==="closed"){z.debug("Subscription connection closed");break}}}finally{i.close()}}catch(o){throw n.fail(o)}finally{n.end()}}};je.conversationIdHeaderKey="x-ms-conversationid",je.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",je.scopeFromSettings=Kn.getScopeFromSettings;var Bc=je;function Wc(){return globalThis.crypto.randomUUID()}var cu=Te(Bn());var Oi=function(t,e){return Oi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Oi(t,e)};function Me(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Oi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Pr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Bt(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function Wt(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function oe(t){return typeof t=="function"}function Yn(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Xn=Yn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
6
6
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
7
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function Sr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Ht=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ar(s),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var p=this.initialTeardown;if(oe(p))try{p()}catch(h){i=h instanceof Wn?h.errors:[h]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var T=Ar(g),E=T.next();!E.done;E=T.next()){var M=E.value;try{qc(M)}catch(h){i=i!=null?i:[],h instanceof Wn?i=Wt(Wt([],Bt(i)),Bt(h.errors)):i.push(h)}}}catch(h){n={error:h}}finally{try{E&&!E.done&&(o=T.return)&&o.call(T)}finally{if(n)throw n.error}}}if(i)throw new Wn(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)qc(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&Sr(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Sr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Ei=Ht.EMPTY;function Hn(t){return t instanceof Ht||t&&"closed"in t&&oe(t.remove)&&oe(t.add)&&oe(t.unsubscribe)}function qc(t){oe(t)?t():t.unsubscribe()}var ae={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Kt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Kt.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,Wt([t,e],Bt(r))):setTimeout.apply(void 0,Wt([t,e],Bt(r)))},clearTimeout:function(t){var e=Kt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Fc(t){Kt.setTimeout(function(){var e=ae.onUnhandledError;if(e)e(t);else throw t})}function Ai(){}var Gc=(function(){return Si("C",void 0,void 0)})();function $c(t){return Si("E",void 0,t)}function Bc(t){return Si("N",t,void 0)}function Si(t,e,r){return{kind:t,value:e,error:r}}var lt=null;function Yt(t){if(ae.useDeprecatedSynchronousErrorHandling){var e=!lt;if(e&&(lt={errorThrown:!1,error:null}),t(),e){var r=lt,n=r.errorThrown,o=r.error;if(lt=null,n)throw o}}else t()}function Wc(t){ae.useDeprecatedSynchronousErrorHandling&<&&(lt.errorThrown=!0,lt.error=t)}var Pi=(function(t){Me(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Hn(r)&&r.add(n)):n.destination=Df,n}return e.create=function(r,n,o){return new Yn(r,n,o)},e.prototype.next=function(r){this.isStopped?Oi(Bc(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?Oi($c(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?Oi(Gc,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Ht);var Zf=Function.prototype.bind;function wi(t,e){return Zf.call(t,e)}var Uf=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){Kn(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Kn(n)}else Kn(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Kn(r)}},t})(),Yn=(function(t){Me(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(oe(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&ae.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&wi(r.next,a),error:r.error&&wi(r.error,a),complete:r.complete&&wi(r.complete,a)}):s=r}return i.destination=new Uf(s),i}return e})(Pi);function Kn(t){ae.useDeprecatedSynchronousErrorHandling?Wc(t):Fc(t)}function jf(t){throw t}function Oi(t,e){var r=ae.onStoppedNotification;r&&Kt.setTimeout(function(){return r(t,e)})}var Df={closed:!0,next:Ai,error:jf,complete:Ai};var Hc=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Kc(t){return t}function Yc(t){return t.length===0?Kc:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Xt=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,i=Lf(e)?e:new Yn(e,r,n);return Yt(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=Xc(r),new r(function(o,i){var s=new Yn({next:function(a){try{e(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[Hc]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Yc(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=Xc(e),new e(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function Xc(t){var e;return(e=t!=null?t:ae.Promise)!==null&&e!==void 0?e:Promise}function Mf(t){return t&&oe(t.next)&&oe(t.error)&&oe(t.complete)}function Lf(t){return t&&t instanceof Pi||Mf(t)&&Hn(t)}var Jc=Bn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Ri=(function(t){Me(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new Qc(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Jc},e.prototype.next=function(r){var n=this;Yt(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Ar(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;Yt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;Yt(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Ei:(this.currentObservers=null,a.push(r),new Ht(function(){n.currentObservers=null,Sr(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new Xt;return r.source=this,r},e.create=function(r,n){return new Qc(r,n)},e})(Xt);var Qc=(function(t){Me(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Ei},e})(Ri);var Ni=(function(t){Me(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(Ri);var Xn=Se(xt());var Ae=(0,Xn.debug)("copilot-studio:webchat");function Vf(t){let e=!1;return r=>{if(!e)return e=!0,t(r)}}var eu=class{static createConnection(e,r){var o;let n=(0,Xn.trace)(Ue.createConnection);n.record({showTyping:r==null?void 0:r.showTyping});try{Ae.info("--> Creating connection between Copilot Studio and WebChat ...");let i=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,s=(o=r==null?void 0:r.startConversation)!=null?o:!i,a=0,c,l,p=i,g=!1,T=!1,E=new Ni(0),M=tu(async b=>{var P;try{c=b;let O=Vf(async()=>{E.next(2),await Promise.resolve()});if(!s||T){await O();return}T=!0,Ae.debug("--> Connection established."),w();for await(let N of e.startConversationStreaming())delete N.replyToId,!l&&N.conversation&&(l=N.conversation),(P=N.conversation)!=null&&P.id&&(p=N.conversation.id),await O(),h(N),n.actions.receivedFromCopilot(N);await O()}catch(O){throw n.fail(O)}finally{n.end()}}),h=b=>{let P={...b,timestamp:new Date().toISOString(),channelData:{...b.channelData,"webchat:sequence-id":a}};a++,Ae.debug(`Notify '${P.type}' activity to WebChat:`,P),c==null||c.next(P)},w=()=>{if(!(r!=null&&r.showTyping))return;let b=l?{id:l.id,name:l.name}:{id:"agent",name:"Agent"};h({type:"typing",from:b})};return{connectionStatus$:E,activity$:M,get conversationId(){return p},postActivity(b){try{if(Ae.info("--> Preparing to send activity to Copilot Studio ..."),!b)throw new Error("Activity cannot be null.");if(g)throw new Error("Connection has been ended.");if(!c)throw new Error("Activity subscriber is not initialized.");return tu(async O=>{var N;try{Ae.info("--> Sending activity to Copilot Studio ...");let L=ru.Activity.fromObject({...b,id:zc(),attachments:await zf(b)});h(L),n.actions.sentToWebChat(L),w(),O.next(L.id);for await(let j of e.sendActivityStreaming(L,p))!p&&((N=j.conversation)!=null&&N.id)&&(p=j.conversation.id),h(j),n.actions.receivedFromCopilot(j),Ae.info("<-- Activity received correctly from Copilot Studio.");O.complete()}catch(L){Ae.error("Error sending Activity to Copilot Studio:",L),O.error(L),n.fail(L)}finally{n.end()}})}catch(P){throw n.fail(P)}finally{n.end()}},end(){Ae.info("--> Ending connection between Copilot Studio and WebChat ..."),g=!0,E.complete(),c&&(c.complete(),c=void 0),n.end()}}}catch(i){throw n.fail(i)}finally{n.end()}}};async function zf(t){var r;if(t.type!=="message"||!((r=t.attachments)!=null&&r.length))return t.attachments||[];let e=[];for(let n of t.attachments){let o=await qf(n);e.push(o)}return e}async function qf(t){let e=t.contentUrl;if(!(e!=null&&e.startsWith("blob:")))return t;try{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch blob URL: ${r.status} ${r.statusText}`);let n=await r.blob(),o=await n.arrayBuffer(),i=Ff(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,Ae.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function Ff(t){let e=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(e&&typeof e.from=="function")return e.from(t).toString("base64");let r="";for(let n of new Uint8Array(t))r+=String.fromCharCode(n);return btoa(r)}function tu(t){return new Xt(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}function __(t=!0,e,r){return{emitStartConversationEvent:t,locale:e,conversationId:r}}export{tr as AgentType,Qn as ConnectionSettings,Vc as CopilotStudioClient,eu as CopilotStudioWebChat,Ir as ExecuteTurnRequest,rr as PowerPlatformCloud,$n as ScopeHelper,Er as UserAgentHelper,Lc as createExecuteTurnResponse,__ as createStartRequest,Mc as createStartResponse,gr as getCopilotStudioConnectionUrl,Aa as getCopilotStudioSubscribeUrl,Sa as getTokenAudience,Kf as loadCopilotStudioConnectionSettingsFromEnv};
|
|
7
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});function Rr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Ht=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Pr(s),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var p=this.initialTeardown;if(oe(p))try{p()}catch(h){i=h instanceof Xn?h.errors:[h]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var T=Pr(y),E=T.next();!E.done;E=T.next()){var M=E.value;try{Hc(M)}catch(h){i=i!=null?i:[],h instanceof Xn?i=Wt(Wt([],Bt(i)),Bt(h.errors)):i.push(h)}}}catch(h){n={error:h}}finally{try{E&&!E.done&&(o=T.return)&&o.call(T)}finally{if(n)throw n.error}}}if(i)throw new Xn(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Hc(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&Rr(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Rr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Pi=Ht.EMPTY;function Jn(t){return t instanceof Ht||t&&"closed"in t&&oe(t.remove)&&oe(t.add)&&oe(t.unsubscribe)}function Hc(t){oe(t)?t():t.unsubscribe()}var ae={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Kt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Kt.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,Wt([t,e],Bt(r))):setTimeout.apply(void 0,Wt([t,e],Bt(r)))},clearTimeout:function(t){var e=Kt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Kc(t){Kt.setTimeout(function(){var e=ae.onUnhandledError;if(e)e(t);else throw t})}function Ri(){}var Yc=(function(){return Ni("C",void 0,void 0)})();function Xc(t){return Ni("E",void 0,t)}function Jc(t){return Ni("N",t,void 0)}function Ni(t,e,r){return{kind:t,value:e,error:r}}var pt=null;function Yt(t){if(ae.useDeprecatedSynchronousErrorHandling){var e=!pt;if(e&&(pt={errorThrown:!1,error:null}),t(),e){var r=pt,n=r.errorThrown,o=r.error;if(pt=null,n)throw o}}else t()}function Qc(t){ae.useDeprecatedSynchronousErrorHandling&&pt&&(pt.errorThrown=!0,pt.error=t)}var Zi=(function(t){Me(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Jn(r)&&r.add(n)):n.destination=Wf,n}return e.create=function(r,n,o){return new eo(r,n,o)},e.prototype.next=function(r){this.isStopped?Ui(Jc(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?Ui(Xc(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?Ui(Yc,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Ht);var Gf=Function.prototype.bind;function ki(t,e){return Gf.call(t,e)}var $f=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){Qn(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Qn(n)}else Qn(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Qn(r)}},t})(),eo=(function(t){Me(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(oe(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&ae.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&ki(r.next,a),error:r.error&&ki(r.error,a),complete:r.complete&&ki(r.complete,a)}):s=r}return i.destination=new $f(s),i}return e})(Zi);function Qn(t){ae.useDeprecatedSynchronousErrorHandling?Qc(t):Kc(t)}function Bf(t){throw t}function Ui(t,e){var r=ae.onStoppedNotification;r&&Kt.setTimeout(function(){return r(t,e)})}var Wf={closed:!0,next:Ri,error:Bf,complete:Ri};var eu=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function tu(t){return t}function ru(t){return t.length===0?tu:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Xt=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,i=Kf(e)?e:new eo(e,r,n);return Yt(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=nu(r),new r(function(o,i){var s=new eo({next:function(a){try{e(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[eu]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ru(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=nu(e),new e(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function nu(t){var e;return(e=t!=null?t:ae.Promise)!==null&&e!==void 0?e:Promise}function Hf(t){return t&&oe(t.next)&&oe(t.error)&&oe(t.complete)}function Kf(t){return t&&t instanceof Zi||Hf(t)&&Jn(t)}var ou=Yn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var ji=(function(t){Me(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new iu(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new ou},e.prototype.next=function(r){var n=this;Yt(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Pr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;Yt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;Yt(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Pi:(this.currentObservers=null,a.push(r),new Ht(function(){n.currentObservers=null,Rr(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new Xt;return r.source=this,r},e.create=function(r,n){return new iu(r,n)},e})(Xt);var iu=(function(t){Me(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Pi},e})(ji);var Di=(function(t){Me(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(ji);var Jt=Te($e());var _e=(0,Jt.debug)("copilot-studio:webchat");function Yf(t){let e=!1;return r=>{if(!e)return e=!0,t(r)}}var su=class{static createConnection(e,r){var o;let n=(0,Jt.trace)(Ze.createConnection);n.record({showTyping:r==null?void 0:r.showTyping});try{_e.info("--> Creating connection between Copilot Studio and WebChat ...");let i=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,s=(o=r==null?void 0:r.startConversation)!=null?o:!i;_e.info("Copilot Studio WebChat settings loaded",{showTyping:r==null?void 0:r.showTyping,conversationId:(0,Jt.redactString)(i,!0),startConversation:r==null?void 0:r.startConversation,connectionMode:i?"resume":"new",acknowledgementMode:s?"startConversationStreaming":"resumeWithoutStart"});let a=0,c,l,p=i,y=!1,T=!1,E=new Di(0),M=au(async b=>{var P;try{c=b;let O=Yf(async()=>{E.next(2),await Promise.resolve()});if(!s||T){await O();return}T=!0,_e.debug("--> Connection established."),w();for await(let N of e.startConversationStreaming())delete N.replyToId,!l&&N.conversation&&(l=N.conversation),(P=N.conversation)!=null&&P.id&&(p=N.conversation.id),await O(),h(N),n.actions.receivedFromCopilot(N);await O()}catch(O){throw n.fail(O)}finally{n.end()}}),h=b=>{let P={...b,timestamp:new Date().toISOString(),channelData:{...b.channelData,"webchat:sequence-id":a}};a++,_e.debug(`Notify '${P.type}' activity to WebChat:`,P),c==null||c.next(P)},w=()=>{if(!(r!=null&&r.showTyping))return;let b=l?{id:l.id,name:l.name}:{id:"agent",name:"Agent"};h({type:"typing",from:b})};return{connectionStatus$:E,activity$:M,get conversationId(){return p},postActivity(b){try{if(_e.info("--> Preparing to send activity to Copilot Studio ..."),!b)throw new Error("Activity cannot be null.");if(y)throw new Error("Connection has been ended.");if(!c)throw new Error("Activity subscriber is not initialized.");return au(async O=>{var N;try{_e.info("--> Sending activity to Copilot Studio ...");let L=cu.Activity.fromObject({...b,id:Wc(),attachments:await Xf(b)});h(L),n.actions.sentToWebChat(L),w(),O.next(L.id);for await(let j of e.sendActivityStreaming(L,p))!p&&((N=j.conversation)!=null&&N.id)&&(p=j.conversation.id),h(j),n.actions.receivedFromCopilot(j),_e.info("<-- Activity received correctly from Copilot Studio.");O.complete()}catch(L){_e.error("Error sending Activity to Copilot Studio:",L),O.error(L),n.fail(L)}finally{n.end()}})}catch(P){throw n.fail(P)}finally{n.end()}},end(){_e.info("--> Ending connection between Copilot Studio and WebChat ..."),y=!0,E.complete(),c&&(c.complete(),c=void 0),n.end()}}}catch(i){throw n.fail(i)}finally{n.end()}}};async function Xf(t){var r;if(t.type!=="message"||!((r=t.attachments)!=null&&r.length))return t.attachments||[];let e=[];for(let n of t.attachments){let o=await Jf(n);e.push(o)}return e}async function Jf(t){let e=t.contentUrl;if(!(e!=null&&e.startsWith("blob:")))return t;try{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch blob URL: ${r.status} ${r.statusText}`);let n=await r.blob(),o=await n.arrayBuffer(),i=Qf(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,_e.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function Qf(t){let e=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(e&&typeof e.from=="function")return e.from(t).toString("base64");let r="";for(let n of new Uint8Array(t))r+=String.fromCharCode(n);return btoa(r)}function au(t){return new Xt(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}function P_(t=!0,e,r){return{emitStartConversationEvent:t,locale:e,conversationId:r}}export{rr as AgentType,Ko as ConnectionSettings,Bc as CopilotStudioClient,su as CopilotStudioWebChat,wr as ExecuteTurnRequest,nr as PowerPlatformCloud,Kn as ScopeHelper,Or as UserAgentHelper,$c as createExecuteTurnResponse,P_ as createStartRequest,Gc as createStartResponse,br as getCopilotStudioConnectionUrl,Na as getCopilotStudioSubscribeUrl,ka as getTokenAudience,Gg as loadCopilotStudioConnectionSettingsFromEnv};
|
|
8
8
|
//# sourceMappingURL=browser.mjs.map
|