@microsoft/agents-copilotstudio-client 1.5.1 → 1.6.0-beta.10.g1549d56265

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.
@@ -1,8 +1,8 @@
1
- var Cd=Object.create;var Br=Object.defineProperty;var Id=Object.getOwnPropertyDescriptor;var Ed=Object.getOwnPropertyNames;var Sd=Object.getPrototypeOf,Ad=Object.prototype.hasOwnProperty;var E=(e,t)=>()=>(e&&(t=e(e=0)),t);var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wd=(e,t)=>{for(var r in t)Br(e,r,{get:t[r],enumerable:!0})},Oa=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ed(t))!Ad.call(e,o)&&o!==r&&Br(e,o,{get:()=>t[o],enumerable:!(n=Id(t,o))||n.enumerable});return e};var ke=(e,t,r)=>(r=e!=null?Cd(Sd(e)):{},Oa(t||!e||!e.__esModule?Br(r,"default",{value:e,enumerable:!0}):r,e)),Od=e=>Oa(Br({},"__esModule",{value:!0}),e);var So=p(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isPromise=Eo;Kr.attempt=Zd;function Eo(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function Zd(e){var t;let r=!1;try{let n=e.try();return Eo(n)?(r=!0,n.catch(o=>{var i;if(!e.catch)throw o;let a=(i=e.catch)===null||i===void 0?void 0:i.call(e,o);if(Eo(a))return a.then(()=>{})}).finally(e.finally)):n}catch(n){if(!e.catch)throw n;e.catch(n);return}finally{!r&&((t=e.finally)===null||t===void 0||t.call(e))}}});var Yr=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.MetricNames=ye.SpanNames=ye.SpanCategories=ye.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES=void 0;ye.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES="AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES";ye.SpanCategories={STORAGE:["STORAGE_"],AUTHORIZATION:["AUTHORIZATION_","USER_TOKEN_CLIENT_"],AUTHENTICATION:["AUTHENTICATION_"],DIALOGS:["DIALOGS_"]};ye.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"};ye.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 ja=p((Cg,Na)=>{var Et=1e3,St=Et*60,At=St*60,Ye=At*24,Ld=Ye*7,Md=Ye*365.25;Na.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Vd(e);if(r==="number"&&isFinite(e))return t.long?zd(e):qd(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Vd(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Md;case"weeks":case"week":case"w":return r*Ld;case"days":case"day":case"d":return r*Ye;case"hours":case"hour":case"hrs":case"hr":case"h":return r*At;case"minutes":case"minute":case"mins":case"min":case"m":return r*St;case"seconds":case"second":case"secs":case"sec":case"s":return r*Et;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function qd(e){var t=Math.abs(e);return t>=Ye?Math.round(e/Ye)+"d":t>=At?Math.round(e/At)+"h":t>=St?Math.round(e/St)+"m":t>=Et?Math.round(e/Et)+"s":e+"ms"}function zd(e){var t=Math.abs(e);return t>=Ye?Xr(e,t,Ye,"day"):t>=At?Xr(e,t,At,"hour"):t>=St?Xr(e,t,St,"minute"):t>=Et?Xr(e,t,Et,"second"):e+" ms"}function Xr(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var Ua=p((Ig,ka)=>{function Fd(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=o,r.enabled=s,r.humanize=ja(),r.destroy=d,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function t(f){let g=0;for(let _=0;_<f.length;_++)g=(g<<5)-g+f.charCodeAt(_),g|=0;return r.colors[Math.abs(g)%r.colors.length]}r.selectColor=t;function r(f){let g,_=null,I,P;function y(...S){if(!y.enabled)return;let x=y,N=Number(new Date),O=N-(g||N);x.diff=O,x.prev=g,x.curr=N,g=N,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let k=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(L,Se)=>{if(L==="%%")return"%";k++;let ie=r.formatters[Se];if(typeof ie=="function"){let ur=S[k];L=ie.call(x,ur),S.splice(k,1),k--}return L}),r.formatArgs.call(x,S),(x.log||r.log).apply(x,S)}return y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(I!==r.namespaces&&(I=r.namespaces,P=r.enabled(f)),P),set:S=>{_=S}}),typeof r.init=="function"&&r.init(y),y}function n(f,g){let _=r(this.namespace+(typeof g=="undefined"?":":g)+f);return _.log=this.log,_}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let g=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of g)_[0]==="-"?r.skips.push(_.slice(1)):r.names.push(_)}function i(f,g){let _=0,I=0,P=-1,y=0;for(;_<f.length;)if(I<g.length&&(g[I]===f[_]||g[I]==="*"))g[I]==="*"?(P=I,y=_,I++):(_++,I++);else if(P!==-1)I=P+1,y++,_=y;else return!1;for(;I<g.length&&g[I]==="*";)I++;return I===g.length}function a(){let f=[...r.names,...r.skips.map(g=>"-"+g)].join(",");return r.enable(""),f}function s(f){for(let g of r.skips)if(i(f,g))return!1;for(let g of r.names)if(i(f,g))return!0;return!1}function c(f){return f instanceof Error?f.stack||f.message:f}function d(){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}ka.exports=Fd});var Da=p((Q,Jr)=>{Q.formatArgs=$d;Q.save=Bd;Q.load=Hd;Q.useColors=Gd;Q.storage=Wd();Q.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();Q.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 Gd(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $d(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Jr.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}Q.log=console.debug||console.log||(()=>{});function Bd(e){try{e?Q.storage.setItem("debug",e):Q.storage.removeItem("debug")}catch{}}function Hd(){let e;try{e=Q.storage.getItem("debug")||Q.storage.getItem("DEBUG")}catch{}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function Wd(){try{return localStorage}catch{}}Jr.exports=Ua()(Q);var{formatters:Kd}=Jr.exports;Kd.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Ao=p(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.isBrowser=void 0;Qr.isBrowser=typeof window!="undefined"&&typeof window.document!="undefined"});var Za=p(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.levels=void 0;en.levels=["info","warn","error","debug"]});var wo=p(wt=>{"use strict";var Yd=wt&&wt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wt,"__esModule",{value:!0});wt.createDebugLogger=el;wt.link=tl;var Xd=Yd(Da()),Jd=Ao(),Qd=Za();function el(e){return{info:tn(e,"info"),warn:tn(e,"warn"),error:tn(e,"error"),debug:tn(e,"debug")}}var La={node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}};function tn(e,t){let r=(0,Xd.default)(`${e}:${t}`);return Jd.isBrowser?r.color=La.browser[t]:r.color=La.node[t],r}function tl(e,...t){return Qd.levels.reduce((r,n)=>(r[n]=(o,...i)=>{if(e[n].enabled){e[n](o,...i);for(let a of t)a[n](o,...i)}},r),{})}});var Ma=p(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.getSetting=nl;var rl=Ao();function nl(e){var t,r;if(rl.isBrowser)try{return(t=window.localStorage.getItem(e))!==null&&t!==void 0?t:""}catch{}else return(r=process.env[e])!==null&&r!==void 0?r:"";return""}});var qa=p(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.isSpanDisabled=al;var mr=Yr(),ol=wo(),il=Ma(),Po=(0,ol.createDebugLogger)("agents:telemetry"),Va=(()=>{let e=(0,il.getSetting)(mr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES).trim().toUpperCase();if(!e)return[];let t=e.split(/[\s,]+/).map(i=>i.trim()).filter(Boolean),r=Object.entries(mr.SpanNames),n=new Set,o=[];for(let i of t){let a=mr.SpanCategories[i];if(!a){Po.warn(`Invalid span category "${i}" in ${mr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES}. Valid categories are: ${Object.keys(mr.SpanCategories).join(", ")}`);continue}for(let s of a)if(!n.has(s)){n.add(s);for(let[c,d]of r)c.startsWith(s)&&o.push(d)}}return o.length>0&&Po.debug("Disabled Span names:",o),o})();function al(e){if(Va.length===0)return!1;let t=Va.includes(e);return Po.debug(`Span "${e}" disabled:`,t),t}});var No=p(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.noopTrace=void 0;Xe.noopMetric=sl;Xe.noopContext=za;var hr=()=>{};Xe.noopTrace=function(e,t){return za(t)};Xe.noopTrace.define=e=>e;function sl(){return{histogram:()=>({record:hr}),counter:()=>({add:hr})}}function za(e){let t=new Proxy({},{get:()=>hr}),r={record:hr,actions:t};return e?e(r):{record:r.record,actions:r.actions,end:hr,fail(o){return o}}}});var $a=p(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.traceFactory=fl;var cl=So(),ul=qa(),dl=Yr(),ll=No();function fl(e){let t=new Set(Object.values(dl.SpanNames)),r=e.trace.getTracer("@microsoft/agents-telemetry"),n=function(i,a){if(!i)throw new Error("Trace definition is required");if(!t.has(i.name))throw new Error(`Unrecognized span name "${i.name}". See SpanNames constants.`);if((0,ul.isSpanDisabled)(i.name))return(0,ll.noopContext)(a);let s=pl(i);if(!a){let c=r.startSpan(i.name),d=Fa(e,i,c,s);return{record:d.record,actions:d.actions,fail:d.fail,end:d.end}}return r.startActiveSpan(i.name,c=>{let d=Fa(e,i,c,s);return(0,cl.attempt)({try:()=>a({record:d.record,actions:d.actions}),catch:f=>{throw d.fail(f)},finally:d.end})})};return n.define=o=>o,n}function pl(e){let t=e.record?{...e.record}:{};return{set(r){Object.assign(t,r)},get(){return t}}}function Fa(e,t,r,n){var o,i;let a=performance.now(),s=!1,c;return{record:n.set,actions:(i=(o=t.actions)===null||o===void 0?void 0:o.call(t,{span:r}))!==null&&i!==void 0?i:{},fail(d){return c=d,d},end(){if(!(s||!e)){s=!0,c===void 0?r.setStatus({code:e.SpanStatusCode.OK}):Ga(e,r,c);try{t.end({span:r,record:n.get(),duration:performance.now()-a,error:c})}catch(d){Ga(e,r,d)}finally{r.end()}}}}}function Ga(e,t,r){let n;r instanceof Error?(n=r.message,t.recordException(r)):(n=String(r),t.recordException({name:typeof r,message:n})),t.setStatus({code:e.SpanStatusCode.ERROR,message:n})}});var Ba=p(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.metricFactory=ml;function ml(e){let t=e.metrics.getMeter("@microsoft/agents-telemetry");return{histogram:t.createHistogram.bind(t),counter:t.createCounter.bind(t)}}});var Ha=p(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createOTelLogger=hl;function hl(e,t){return{info:rn(e,t,"info"),warn:rn(e,t,"warn"),error:rn(e,t,"error"),debug:rn(e,t,"debug")}}function rn(e,t,r){var n;let o=e.logs.getLogger(t),i=(n=r==null?void 0:r.toLowerCase())!==null&&n!==void 0?n:"debug",a={debug:e.SeverityNumber.DEBUG,info:e.SeverityNumber.INFO,warn:e.SeverityNumber.WARN,error:e.SeverityNumber.ERROR}[i];return function(c,...d){o.emit({severityNumber:a,severityText:i.toUpperCase(),body:gl(c,d),attributes:{"log.namespace":t,"log.level":i}})}}function gl(e,t){if(t.length===0)return e;let r=t.map(n=>yl(n)).join(" ");return`${e} ${r}`}function yl(e){if(e instanceof Error)return`${e.name}: ${e.message}`;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"||e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}});var Ja=p(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.index=xl;var vl=$a(),_l=Ba(),on=wo(),bl=Ha(),nn=So(),Wa=Yr(),Ka=No(),Ya=(0,on.createDebugLogger)("agents:telemetry");function xl(e){let t=(0,nn.attempt)({try:()=>e.otel(),catch:()=>Ya.warn("OpenTelemetry API not found. Install @opentelemetry/api as a dependency to enable tracing and metrics.")}),r=(0,nn.attempt)({try:()=>e.logs(),catch:()=>Ya.warn("OpenTelemetry API Logs not found. Install @opentelemetry/api-logs as a dependency to enable OTel logging.")});return(0,nn.isPromise)(t)||(0,nn.isPromise)(r)?Promise.all([t,r]).then(([n,o])=>Xa(n,o)):Xa(t,r)}function Xa(e,t){return{SpanNames:Wa.SpanNames,MetricNames:Wa.MetricNames,debug:t?r=>(0,on.link)((0,on.createDebugLogger)(r),(0,bl.createOTelLogger)(t,r)):on.createDebugLogger,trace:e?(0,vl.traceFactory)(e):Ka.noopTrace,metric:e?(0,_l.metricFactory)(e):(0,Ka.noopMetric)()}}});var Qa,es=E(()=>{Qa=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});var ts=E(()=>{es()});var Ae,Zo=E(()=>{Ae="1.9.0"});function Tl(e){var t=new Set([e]),r=new Set,n=e.match(rs);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===e};function i(s){return r.add(s),!1}function a(s){return t.add(s),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;var d=c.match(rs);if(!d)return i(c);var f={major:+d[1],minor:+d[2],patch:+d[3],prerelease:d[4]};return f.prerelease!=null||o.major!==f.major?i(c):o.major===0?o.minor===f.minor&&o.patch<=f.patch?a(c):i(c):o.minor<=f.minor?a(c):i(c)}}var rs,ns,os=E(()=>{Zo();rs=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;ns=Tl(Ae)});function ve(e,t,r,n){var o;n===void 0&&(n=!1);var i=yr[gr]=(o=yr[gr])!==null&&o!==void 0?o:{version:Ae};if(!n&&i[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(i.version!==Ae){var a=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+Ae);return r.error(a.stack||a.message),!1}return i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+Ae+"."),!0}function ne(e){var t,r,n=(t=yr[gr])===null||t===void 0?void 0:t.version;if(!(!n||!ns(n)))return(r=yr[gr])===null||r===void 0?void 0:r[e]}function _e(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+Ae+".");var r=yr[gr];r&&delete r[e]}var Cl,gr,yr,Je=E(()=>{ts();Zo();os();Cl=Ae.split(".")[0],gr=Symbol.for("opentelemetry.js.api."+Cl),yr=Qa});function vr(e,t,r){var n=ne("diag");if(n)return r.unshift(t),n[e].apply(n,El([],Il(r),!1))}var Il,El,is,as=E(()=>{Je();Il=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},El=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},is=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("verbose",this._namespace,t)},e})()});var z,an=E(()=>{(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(z||(z={}))});function ss(e,t){e<z.NONE?e=z.NONE:e>z.ALL&&(e=z.ALL),t=t||{};function r(n,o){var i=t[n];return typeof i=="function"&&e>=o?i.bind(t):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 cs=E(()=>{an()});var Sl,Al,wl,$,Qe=E(()=>{as();cs();an();Je();Sl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Al=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},wl="diag",$=(function(){function e(){function t(o){return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=ne("diag");if(s)return s[o].apply(s,Al([],Sl(i),!1))}}var r=this,n=function(o,i){var a,s,c;if(i===void 0&&(i={logLevel:z.INFO}),o===r){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=d.stack)!==null&&a!==void 0?a:d.message),!1}typeof i=="number"&&(i={logLevel:i});var f=ne("diag"),g=ss((s=i.logLevel)!==null&&s!==void 0?s:z.INFO,o);if(f&&!i.suppressOverrideMessage){var _=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";f.warn("Current logger will be overwritten from "+_),g.warn("Current logger will overwrite one already registered from "+_)}return ve("diag",g,r,!0)};r.setLogger=n,r.disable=function(){_e(wl,r)},r.createComponentLogger=function(o){return new is(o)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})()});var Ol,Pl,us,ds=E(()=>{Ol=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Pl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},us=(function(){function e(t){this._entries=t?new Map(t):new Map}return e.prototype.getEntry=function(t){var r=this._entries.get(t);if(r)return Object.assign({},r)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(t){var r=Ol(t,2),n=r[0],o=r[1];return[n,o]})},e.prototype.setEntry=function(t,r){var n=new e(this._entries);return n._entries.set(t,r),n},e.prototype.removeEntry=function(t){var r=new e(this._entries);return r._entries.delete(t),r},e.prototype.removeEntries=function(){for(var t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new e(this._entries);try{for(var a=Pl(n),s=a.next();!s.done;s=a.next()){var c=s.value;i._entries.delete(c)}}catch(d){t={error:d}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},e.prototype.clear=function(){return new e},e})()});var ls,fs=E(()=>{ls=Symbol("BaggageEntryMetadata")});function ps(e){return e===void 0&&(e={}),new us(new Map(Object.entries(e)))}function ms(e){return typeof e!="string"&&(Rl.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:ls,toString:function(){return e}}}var Rl,Lo=E(()=>{Qe();ds();fs();Rl=$.instance()});function Ot(e){return Symbol.for(e)}var Nl,sn,_r=E(()=>{Nl=(function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new e(r._currentContext);return o._currentContext.delete(n),o}}return e})(),sn=new Nl});var Mo,hs,gs=E(()=>{Mo=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],hs=(function(){function e(){function t(n){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(console){var a=console[n];if(typeof a!="function"&&(a=console.log),typeof a=="function")return a.apply(console,o)}}}for(var r=0;r<Mo.length;r++)this[Mo[r].n]=t(Mo[r].c)}return e})()});function ys(){return qo}var et,jl,cn,kl,Ul,Dl,Zl,Vo,Ll,Ml,Vl,qo,ql,zl,Fl,Gl,$l,Bl,Hl,zo=E(()=>{et=(function(){var e=function(t,r){return e=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])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),jl=(function(){function e(){}return e.prototype.createGauge=function(t,r){return zl},e.prototype.createHistogram=function(t,r){return Fl},e.prototype.createCounter=function(t,r){return ql},e.prototype.createUpDownCounter=function(t,r){return Gl},e.prototype.createObservableGauge=function(t,r){return Bl},e.prototype.createObservableCounter=function(t,r){return $l},e.prototype.createObservableUpDownCounter=function(t,r){return Hl},e.prototype.addBatchObservableCallback=function(t,r){},e.prototype.removeBatchObservableCallback=function(t){},e})(),cn=(function(){function e(){}return e})(),kl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})(cn),Ul=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})(cn),Dl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})(cn),Zl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})(cn),Vo=(function(){function e(){}return e.prototype.addCallback=function(t){},e.prototype.removeCallback=function(t){},e})(),Ll=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),Ml=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),Vl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),qo=new jl,ql=new kl,zl=new Dl,Fl=new Zl,Gl=new Ul,$l=new Ll,Bl=new Ml,Hl=new Vl});var un,vs=E(()=>{(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(un||(un={}))});var dn,ln,Fo=E(()=>{dn={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},ln={set:function(e,t,r){e!=null&&(e[t]=r)}}});var Wl,Kl,_s,bs=E(()=>{_r();Wl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Kl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},_s=(function(){function e(){}return e.prototype.active=function(){return sn},e.prototype.with=function(t,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,Kl([n],Wl(o),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})()});var Yl,Xl,Go,Jl,Ue,br=E(()=>{bs();Je();Qe();Yl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Xl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Go="context",Jl=new _s,Ue=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return ve(Go,t,$.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var o,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(o=this._getContextManager()).with.apply(o,Xl([t,r,n],Yl(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return ne(Go)||Jl},e.prototype.disable=function(){this._getContextManager().disable(),_e(Go,$.instance())},e})()});var Pt,$o=E(()=>{(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Pt||(Pt={}))});var xr,Tr,fn,pn=E(()=>{$o();xr="0000000000000000",Tr="00000000000000000000000000000000",fn={traceId:Tr,spanId:xr,traceFlags:Pt.NONE}});var De,mn=E(()=>{pn();De=(function(){function e(t){t===void 0&&(t=fn),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e})()});function hn(e){return e.getValue(Bo)||void 0}function xs(){return hn(Ue.getInstance().active())}function Cr(e,t){return e.setValue(Bo,t)}function Ts(e){return e.deleteValue(Bo)}function Cs(e,t){return Cr(e,new De(t))}function gn(e){var t;return(t=hn(e))===null||t===void 0?void 0:t.spanContext()}var Bo,Ho=E(()=>{_r();mn();br();Bo=Ot("OpenTelemetry Context Key SPAN")});function Wo(e){return Ql.test(e)&&e!==Tr}function Ko(e){return ef.test(e)&&e!==xr}function Rt(e){return Wo(e.traceId)&&Ko(e.spanId)}function Is(e){return new De(e)}var Ql,ef,yn=E(()=>{pn();mn();Ql=/^([0-9a-f]{32})$/i,ef=/^[0-9a-f]{16}$/i});function tf(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var Yo,vn,Xo=E(()=>{br();Ho();mn();yn();Yo=Ue.getInstance(),vn=(function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=Yo.active());var o=!!(r!=null&&r.root);if(o)return new De;var i=n&&gn(n);return tf(i)&&Rt(i)?new De(i):new De},e.prototype.startActiveSpan=function(t,r,n,o){var i,a,s;if(!(arguments.length<2)){arguments.length===2?s=r:arguments.length===3?(i=r,s=n):(i=r,a=n,s=o);var c=a!=null?a:Yo.active(),d=this.startSpan(t,i,c),f=Cr(c,d);return Yo.with(f,s,void 0,d)}},e})()});var rf,_n,Jo=E(()=>{Xo();rf=new vn,_n=(function(){function e(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):rf},e})()});var Es,Ss=E(()=>{Xo();Es=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new vn},e})()});var nf,Ir,Qo=E(()=>{Jo();Ss();nf=new Es,Ir=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new _n(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:nf},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)},e})()});var bn,As=E(()=>{(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(bn||(bn={}))});var xn,ws=E(()=>{(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(xn||(xn={}))});var Tn,Os=E(()=>{(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Tn||(Tn={}))});function Ps(e){return sf.test(e)}function Rs(e){return cf.test(e)&&!uf.test(e)}var ei,of,af,sf,cf,uf,Ns=E(()=>{ei="[_0-9a-z-*/]",of="[a-z]"+ei+"{0,255}",af="[a-z0-9]"+ei+"{0,240}@[a-z]"+ei+"{0,13}",sf=new RegExp("^(?:"+of+"|"+af+")$"),cf=/^[ -~]{0,255}[!-~]$/,uf=/,|=/});var js,df,ks,Us,Ds,Zs=E(()=>{Ns();js=32,df=512,ks=",",Us="=",Ds=(function(){function e(t){this._internalState=new Map,t&&this._parse(t)}return e.prototype.set=function(t,r){var n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n},e.prototype.unset=function(t){var r=this._clone();return r._internalState.delete(t),r},e.prototype.get=function(t){return this._internalState.get(t)},e.prototype.serialize=function(){var t=this;return this._keys().reduce(function(r,n){return r.push(n+Us+t.get(n)),r},[]).join(ks)},e.prototype._parse=function(t){t.length>df||(this._internalState=t.split(ks).reverse().reduce(function(r,n){var o=n.trim(),i=o.indexOf(Us);if(i!==-1){var a=o.slice(0,i),s=o.slice(i+1,n.length);Ps(a)&&Rs(s)&&r.set(a,s)}return r},new Map),this._internalState.size>js&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,js))))},e.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},e.prototype._clone=function(){var t=new e;return t._internalState=new Map(this._internalState),t},e})()});function Ls(e){return new Ds(e)}var Ms=E(()=>{Zs()});var ti,Vs=E(()=>{br();ti=Ue.getInstance()});var ri,qs=E(()=>{Qe();ri=$.instance()});var lf,zs,Fs=E(()=>{zo();lf=(function(){function e(){}return e.prototype.getMeter=function(t,r,n){return qo},e})(),zs=new lf});var ni,Gs,$s=E(()=>{Fs();Je();Qe();ni="metrics",Gs=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(t){return ve(ni,t,$.instance())},e.prototype.getMeterProvider=function(){return ne(ni)||zs},e.prototype.getMeter=function(t,r,n){return this.getMeterProvider().getMeter(t,r,n)},e.prototype.disable=function(){_e(ni,$.instance())},e})()});var oi,Bs=E(()=>{$s();oi=Gs.getInstance()});var Hs,Ws=E(()=>{Hs=(function(){function e(){}return e.prototype.inject=function(t,r){},e.prototype.extract=function(t,r){return t},e.prototype.fields=function(){return[]},e})()});function ai(e){return e.getValue(ii)||void 0}function Ks(){return ai(Ue.getInstance().active())}function Ys(e,t){return e.setValue(ii,t)}function Xs(e){return e.deleteValue(ii)}var ii,Js=E(()=>{br();_r();ii=Ot("OpenTelemetry Baggage Key")});var si,ff,Qs,ec=E(()=>{Je();Ws();Fo();Js();Lo();Qe();si="propagation",ff=new Hs,Qs=(function(){function e(){this.createBaggage=ps,this.getBaggage=ai,this.getActiveBaggage=Ks,this.setBaggage=Ys,this.deleteBaggage=Xs}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(t){return ve(si,t,$.instance())},e.prototype.inject=function(t,r,n){return n===void 0&&(n=ln),this._getGlobalPropagator().inject(t,r,n)},e.prototype.extract=function(t,r,n){return n===void 0&&(n=dn),this._getGlobalPropagator().extract(t,r,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){_e(si,$.instance())},e.prototype._getGlobalPropagator=function(){return ne(si)||ff},e})()});var ci,tc=E(()=>{ec();ci=Qs.getInstance()});var ui,rc,nc=E(()=>{Je();Qo();yn();Ho();Qe();ui="trace",rc=(function(){function e(){this._proxyTracerProvider=new Ir,this.wrapSpanContext=Is,this.isSpanContextValid=Rt,this.deleteSpan=Ts,this.getSpan=hn,this.getActiveSpan=xs,this.getSpanContext=gn,this.setSpan=Cr,this.setSpanContext=Cs}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=ve(ui,this._proxyTracerProvider,$.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return ne(ui)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){_e(ui,$.instance()),this._proxyTracerProvider=new Ir},e})()});var di,oc=E(()=>{nc();di=rc.getInstance()});var ic={};wd(ic,{DiagConsoleLogger:()=>hs,DiagLogLevel:()=>z,INVALID_SPANID:()=>xr,INVALID_SPAN_CONTEXT:()=>fn,INVALID_TRACEID:()=>Tr,ProxyTracer:()=>_n,ProxyTracerProvider:()=>Ir,ROOT_CONTEXT:()=>sn,SamplingDecision:()=>bn,SpanKind:()=>xn,SpanStatusCode:()=>Tn,TraceFlags:()=>Pt,ValueType:()=>un,baggageEntryMetadataFromString:()=>ms,context:()=>ti,createContextKey:()=>Ot,createNoopMeter:()=>ys,createTraceState:()=>Ls,default:()=>pf,defaultTextMapGetter:()=>dn,defaultTextMapSetter:()=>ln,diag:()=>ri,isSpanContextValid:()=>Rt,isValidSpanId:()=>Ko,isValidTraceId:()=>Wo,metrics:()=>oi,propagation:()=>ci,trace:()=>di});var pf,ac=E(()=>{Lo();_r();gs();an();zo();vs();Fo();Jo();Qo();As();ws();Os();$o();Ms();yn();pn();Vs();qs();Bs();tc();oc();pf={context:ti,diag:ri,metrics:oi,propagation:ci,trace:di}});var sc=p(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.SeverityNumber=void 0;var mf;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(mf=Er.SeverityNumber||(Er.SeverityNumber={}))});var In=p(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.NOOP_LOGGER=Nt.NoopLogger=void 0;var Cn=class{emit(t){}};Nt.NoopLogger=Cn;Nt.NOOP_LOGGER=new Cn});var cc=p(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.API_BACKWARDS_COMPATIBILITY_VERSION=be.makeGetter=be._global=be.GLOBAL_LOGS_API_KEY=void 0;be.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");be._global=globalThis;function hf(e,t,r){return n=>n===e?t:r}be.makeGetter=hf;be.API_BACKWARDS_COMPATIBILITY_VERSION=1});var li=p(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.NOOP_LOGGER_PROVIDER=jt.NoopLoggerProvider=void 0;var gf=In(),En=class{getLogger(t,r,n){return new gf.NoopLogger}};jt.NoopLoggerProvider=En;jt.NOOP_LOGGER_PROVIDER=new En});var uc=p(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ProxyLogger=void 0;var yf=In(),fi=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):yf.NOOP_LOGGER}};Sn.ProxyLogger=fi});var dc=p(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.ProxyLoggerProvider=void 0;var vf=li(),_f=uc(),pi=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new _f.ProxyLogger(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:vf.NOOP_LOGGER_PROVIDER}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};An.ProxyLoggerProvider=pi});var fc=p(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.LogsAPI=void 0;var ae=cc(),bf=li(),lc=dc(),mi=class e{constructor(){this._proxyLoggerProvider=new lc.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return ae._global[ae.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ae._global[ae.GLOBAL_LOGS_API_KEY]=(0,ae.makeGetter)(ae.API_BACKWARDS_COMPATIBILITY_VERSION,t,bf.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=ae._global[ae.GLOBAL_LOGS_API_KEY])===null||t===void 0?void 0:t.call(ae._global,ae.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete ae._global[ae.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new lc.ProxyLoggerProvider}};wn.LogsAPI=mi});var mc=p(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.logs=xe.NoopLogger=xe.NOOP_LOGGER=xe.SeverityNumber=void 0;var xf=sc();Object.defineProperty(xe,"SeverityNumber",{enumerable:!0,get:function(){return xf.SeverityNumber}});var pc=In();Object.defineProperty(xe,"NOOP_LOGGER",{enumerable:!0,get:function(){return pc.NOOP_LOGGER}});Object.defineProperty(xe,"NoopLogger",{enumerable:!0,get:function(){return pc.NoopLogger}});var Tf=fc();xe.logs=Tf.LogsAPI.getInstance()});var Ut=p(se=>{"use strict";var kt;Object.defineProperty(se,"__esModule",{value:!0});se.metric=se.trace=se.debug=se.MetricNames=se.SpanNames=void 0;var Cf=Ja();kt=(0,Cf.index)({otel:()=>(ac(),Od(ic)),logs:()=>mc()}),se.SpanNames=kt.SpanNames,se.MetricNames=kt.MetricNames,se.debug=kt.debug,se.trace=kt.trace,se.metric=kt.metric});var wr=p(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getParsedType=U.ZodParsedType=U.objectUtil=U.util=void 0;var hi;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.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(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(hi||(U.util=hi={}));var _c;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(_c||(U.objectUtil=_c={}));U.ZodParsedType=hi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Af=e=>{switch(typeof e){case"undefined":return U.ZodParsedType.undefined;case"string":return U.ZodParsedType.string;case"number":return Number.isNaN(e)?U.ZodParsedType.nan:U.ZodParsedType.number;case"boolean":return U.ZodParsedType.boolean;case"function":return U.ZodParsedType.function;case"bigint":return U.ZodParsedType.bigint;case"symbol":return U.ZodParsedType.symbol;case"object":return Array.isArray(e)?U.ZodParsedType.array:e===null?U.ZodParsedType.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?U.ZodParsedType.promise:typeof Map!="undefined"&&e instanceof Map?U.ZodParsedType.map:typeof Set!="undefined"&&e instanceof Set?U.ZodParsedType.set:typeof Date!="undefined"&&e instanceof Date?U.ZodParsedType.date:U.ZodParsedType.object;default:return U.ZodParsedType.unknown}};U.getParsedType=Af});var Nn=p(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ZodError=Ze.quotelessJson=Ze.ZodIssueCode=void 0;var bc=wr();Ze.ZodIssueCode=bc.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 wf=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");Ze.quotelessJson=wf;var Or=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let d=a.path[c];c===a.path.length-1?(s[d]=s[d]||{_errors:[]},s[d]._errors.push(r(a))):s[d]=s[d]||{_errors:[]},s=s[d],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,bc.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=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(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ze.ZodError=Or;Or.create=e=>new Or(e)});var yi=p(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var B=Nn(),tt=wr(),Of=(e,t)=>{let r;switch(e.code){case B.ZodIssueCode.invalid_type:e.received===tt.ZodParsedType.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case B.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.util.jsonStringifyReplacer)}`;break;case B.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${tt.util.joinValues(e.keys,", ")}`;break;case B.ZodIssueCode.invalid_union:r="Invalid input";break;case B.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${tt.util.joinValues(e.options)}`;break;case B.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${tt.util.joinValues(e.options)}, received '${e.received}'`;break;case B.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case B.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case B.ZodIssueCode.invalid_date:r="Invalid date";break;case B.ZodIssueCode.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:tt.util.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case B.ZodIssueCode.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case B.ZodIssueCode.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case B.ZodIssueCode.custom:r="Invalid input";break;case B.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case B.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case B.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,tt.util.assertNever(e)}return{message:r}};gi.default=Of});var jn=p(Le=>{"use strict";var Pf=Le&&Le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Le,"__esModule",{value:!0});Le.defaultErrorMap=void 0;Le.setErrorMap=Rf;Le.getErrorMap=Nf;var xc=Pf(yi());Le.defaultErrorMap=xc.default;var Tc=xc.default;function Rf(e){Tc=e}function Nf(){return Tc}});var _i=p(j=>{"use strict";var jf=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});j.isAsync=j.isValid=j.isDirty=j.isAborted=j.OK=j.DIRTY=j.INVALID=j.ParseStatus=j.EMPTY_PATH=j.makeIssue=void 0;j.addIssueToContext=Df;var kf=jn(),Cc=jf(yi()),Uf=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(d=>!!d).slice().reverse();for(let d of c)s=d(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};j.makeIssue=Uf;j.EMPTY_PATH=[];function Df(e,t){let r=(0,kf.getErrorMap)(),n=(0,j.makeIssue)({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Cc.default?void 0:Cc.default].filter(o=>!!o)});e.common.issues.push(n)}var vi=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return j.INVALID;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return j.INVALID;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value!="undefined"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}};j.ParseStatus=vi;j.INVALID=Object.freeze({status:"aborted"});var Zf=e=>({status:"dirty",value:e});j.DIRTY=Zf;var Lf=e=>({status:"valid",value:e});j.OK=Lf;var Mf=e=>e.status==="aborted";j.isAborted=Mf;var Vf=e=>e.status==="dirty";j.isDirty=Vf;var qf=e=>e.status==="valid";j.isValid=qf;var zf=e=>typeof Promise!="undefined"&&e instanceof Promise;j.isAsync=zf});var Ec=p(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0})});var Ac=p(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.errorUtil=void 0;var Sc;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Sc||(kn.errorUtil=Sc={}))});var Mc=p(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=Nc;u.custom=kc;var m=Nn(),Un=jn(),v=Ac(),l=_i(),h=wr(),ue=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,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}},wc=(e,t)=>{if((0,l.isValid)(t))return{success:!0,data:t.value};if(!e.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 m.ZodError(e.common.issues);return this._error=r,this._error}}};function A(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{var d,f;let{message:c}=e;return a.code==="invalid_enum_value"?{message:c!=null?c:s.defaultError}:typeof s.data=="undefined"?{message:(d=c!=null?c:n)!=null?d:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(f=c!=null?c:r)!=null?f:s.defaultError}},description:o}}var w=class{get description(){return this._def.description}_getType(t){return(0,h.getParsedType)(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:(0,h.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new l.ParseStatus,ctx:{common:t.parent.common,data:t.data,parsedType:(0,h.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if((0,l.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,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:t,parsedType:(0,h.getParsedType)(t)},o=this._parseSync({data:t,path:n.path,parent:n});return wc(n,o)}"~validate"(t){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:(0,h.getParsedType)(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:r});return(0,l.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:t,path:[],parent:r}).then(i=>(0,l.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,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:t,parsedType:(0,h.getParsedType)(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await((0,l.isAsync)(o)?o:Promise.resolve(o));return wc(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:m.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new oe({schema:this,typeName:T.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 ce.create(this,this._def)}nullable(){return Ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pe.create(this)}promise(){return qe.create(this,this._def)}or(t){return ct.create([this,t],this._def)}and(t){return ut.create(this,t,this._def)}transform(t){return new oe({...A(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new mt({...A(this._def),innerType:this,defaultValue:r,typeName:T.ZodDefault})}brand(){return new Pr({typeName:T.ZodBranded,type:this,...A(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ht({...A(this._def),innerType:this,catchValue:r,typeName:T.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Rr.create(this,t)}readonly(){return gt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u.ZodType=w;u.Schema=w;u.ZodSchema=w;var Ff=/^c[^\s-]{8,}$/i,Gf=/^[0-9a-z]+$/,$f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bf=/^[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,Hf=/^[a-z0-9_-]{21}$/i,Wf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Kf=/^[-+]?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)?)??$/,Yf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bi,Jf=/^(?:(?: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])$/,Qf=/^(?:(?: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])$/,ep=/^(([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]))$/,tp=/^(([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])$/,rp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,np=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pc="((\\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])))",op=new RegExp(`^${Pc}$`);function Rc(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ip(e){return new RegExp(`^${Rc(e)}$`)}function Nc(e){let t=`${Pc}T${Rc(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ap(e,t){return!!((t==="v4"||!t)&&Jf.test(e)||(t==="v6"||!t)&&ep.test(e))}function sp(e,t){if(!Wf.test(e))return!1;try{let[r]=e.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||t&&o.alg!==t)}catch{return!1}}function cp(e,t){return!!((t==="v4"||!t)&&Qf.test(e)||(t==="v6"||!t)&&tp.test(e))}var Me=class e extends w{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),l.INVALID}let n=new l.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Yf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"email",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")bi||(bi=new RegExp(Xf,"u")),bi.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"emoji",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Bf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"uuid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Hf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"nanoid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Ff.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cuid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Gf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cuid2",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")$f.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"ulid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"url",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"regex",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Nc(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?op.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ip(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Kf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"duration",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ap(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"ip",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?sp(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"jwt",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?cp(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cidr",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?rp.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"base64",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?np.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"base64url",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:m.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...v.errorUtil.errToObj(t)})}url(t){return this._addCheck({kind:"url",...v.errorUtil.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!=null?r:!1,local:(n=t==null?void 0:t.local)!=null?n:!1,...v.errorUtil.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,...v.errorUtil.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...v.errorUtil.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...v.errorUtil.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...v.errorUtil.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...v.errorUtil.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...v.errorUtil.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...v.errorUtil.errToObj(r)})}nonempty(t){return this.min(1,v.errorUtil.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};u.ZodString=Me;Me.create=e=>{var t;return new Me({checks:[],typeName:T.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1,...A(e)})};function up(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var rt=class e extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),l.INVALID}let n,o=new l.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?up(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,v.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,v.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,v.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,v.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:v.errorUtil.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:v.errorUtil.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:v.errorUtil.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&h.util.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};u.ZodNumber=rt;rt.create=e=>new rt({checks:[],typeName:T.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...A(e)});var nt=class e extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==h.ZodParsedType.bigint)return this._getInvalidInput(t);let n,o=new l.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),l.INVALID}gte(t,r){return this.setLimit("min",t,!0,v.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,v.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,v.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,v.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:v.errorUtil.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};u.ZodBigInt=nt;nt.create=e=>{var t;return new nt({checks:[],typeName:T.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1,...A(e)})};var ot=class extends w{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodBoolean=ot;ot.create=e=>new ot({typeName:T.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...A(e)});var it=class e extends w{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),l.INVALID}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_date}),l.INVALID}let n=new l.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:v.errorUtil.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};u.ZodDate=it;it.create=e=>new it({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:T.ZodDate,...A(e)});var Lt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodSymbol=Lt;Lt.create=e=>new Lt({typeName:T.ZodSymbol,...A(e)});var at=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodUndefined=at;at.create=e=>new at({typeName:T.ZodUndefined,...A(e)});var st=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodNull=st;st.create=e=>new st({typeName:T.ZodNull,...A(e)});var Ve=class extends w{constructor(){super(...arguments),this._any=!0}_parse(t){return(0,l.OK)(t.data)}};u.ZodAny=Ve;Ve.create=e=>new Ve({typeName:T.ZodAny,...A(e)});var Oe=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(t){return(0,l.OK)(t.data)}};u.ZodUnknown=Oe;Oe.create=e=>new Oe({typeName:T.ZodUnknown,...A(e)});var fe=class extends w{_parse(t){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),l.INVALID}};u.ZodNever=fe;fe.create=e=>new fe({typeName:T.ZodNever,...A(e)});var Mt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodVoid=Mt;Mt.create=e=>new Mt({typeName:T.ZodVoid,...A(e)});var Pe=class e extends w{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),l.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,l.addIssueToContext)(r,{code:a?m.ZodIssueCode.too_big:m.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?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,l.addIssueToContext)(r,{code:m.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,l.addIssueToContext)(r,{code:m.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((a,s)=>o.type._parseAsync(new ue(r,a,r.path,s)))).then(a=>l.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new ue(r,a,r.path,s)));return l.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:v.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:v.errorUtil.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:v.errorUtil.toString(r)}})}nonempty(t){return this.min(1,t)}};u.ZodArray=Pe;Pe.create=(e,t)=>new Pe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...A(t)});function Zt(e){if(e instanceof ee){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ce.create(Zt(n))}return new ee({...e._def,shape:()=>t})}else return e instanceof Pe?new Pe({...e._def,type:Zt(e.element)}):e instanceof ce?ce.create(Zt(e.unwrap())):e instanceof Ce?Ce.create(Zt(e.unwrap())):e instanceof Te?Te.create(e.items.map(t=>Zt(t))):e}var ee=class e extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=h.util.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==h.ZodParsedType.object){let d=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(d,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:d.parsedType}),l.INVALID}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof fe&&this._def.unknownKeys==="strip"))for(let d in o.data)a.includes(d)||s.push(d);let c=[];for(let d of a){let f=i[d],g=o.data[d];c.push({key:{status:"valid",value:d},value:f._parse(new ue(o,g,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof fe){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of s)c.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")s.length>0&&((0,l.addIssueToContext)(o,{code:m.ZodIssueCode.unrecognized_keys,keys:s}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of s){let g=o.data[f];c.push({key:{status:"valid",value:f},value:d._parse(new ue(o,g,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of c){let g=await f.key,_=await f.value;d.push({key:g,value:_,alwaysSet:f.alwaysSet})}return d}).then(d=>l.ParseStatus.mergeObjectSync(n,d)):l.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return v.errorUtil.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var i,a,s,c;let o=(s=(a=(i=this._def).errorMap)==null?void 0:a.call(i,r,n).message)!=null?s:n.defaultError;return r.code==="unrecognized_keys"?{message:(c=v.errorUtil.errToObj(t).message)!=null?c:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:T.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of h.util.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of h.util.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Zt(this)}partial(t){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of h.util.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ce;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return jc(h.util.objectKeys(this.shape))}};u.ZodObject=ee;ee.create=(e,t)=>new ee({shape:()=>e,unknownKeys:"strip",catchall:fe.create(),typeName:T.ZodObject,...A(t)});ee.strictCreate=(e,t)=>new ee({shape:()=>e,unknownKeys:"strict",catchall:fe.create(),typeName:T.ZodObject,...A(t)});ee.lazycreate=(e,t)=>new ee({shape:e,unknownKeys:"strip",catchall:fe.create(),typeName:T.ZodObject,...A(t)});var ct=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new m.ZodError(s.ctx.common.issues));return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union,unionErrors:a}),l.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new m.ZodError(c));return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union,unionErrors:s}),l.INVALID}}get options(){return this._def.options}};u.ZodUnion=ct;ct.create=(e,t)=>new ct({options:e,typeName:T.ZodUnion,...A(t)});var we=e=>e instanceof dt?we(e.schema):e instanceof oe?we(e.innerType()):e instanceof lt?[e.value]:e instanceof ft?e.options:e instanceof pt?h.util.objectValues(e.enum):e instanceof mt?we(e._def.innerType):e instanceof at?[void 0]:e instanceof st?[null]:e instanceof ce?[void 0,...we(e.unwrap())]:e instanceof Ce?[null,...we(e.unwrap())]:e instanceof Pr||e instanceof gt?we(e.unwrap()):e instanceof ht?we(e._def.innerType):[],Dn=class e extends w{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.object)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),l.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,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),l.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=we(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:T.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...A(n)})}};u.ZodDiscriminatedUnion=Dn;function xi(e,t){let r=(0,h.getParsedType)(e),n=(0,h.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(t),i=h.util.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=xi(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=xi(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ut=class extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if((0,l.isAborted)(i)||(0,l.isAborted)(a))return l.INVALID;let s=xi(i.value,a.value);return s.valid?(((0,l.isDirty)(i)||(0,l.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_intersection_types}),l.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,a])=>o(i,a)):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=ut;ut.create=(e,t,r)=>new ut({left:e,right:t,typeName:T.ZodIntersection,...A(r)});var Te=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.array)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),l.INVALID;if(n.data.length<this._def.items.length)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new ue(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>l.ParseStatus.mergeArray(r,a)):l.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};u.ZodTuple=Te;Te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te({items:e,typeName:T.ZodTuple,rest:null,...A(t)})};var Zn=class e extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.object)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),l.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new ue(n,s,n.path,s)),value:a._parse(new ue(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?l.ParseStatus.mergeObjectAsync(r,o):l.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof w?new e({keyType:t,valueType:r,typeName:T.ZodRecord,...A(n)}):new e({keyType:Me.create(),valueType:t,typeName:T.ZodRecord,...A(r)})}};u.ZodRecord=Zn;var Vt=class extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.map)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),l.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],d)=>({key:o._parse(new ue(n,s,n.path,[d,"key"])),value:i._parse(new ue(n,c,n.path,[d,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let d=await c.key,f=await c.value;if(d.status==="aborted"||f.status==="aborted")return l.INVALID;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let d=c.key,f=c.value;if(d.status==="aborted"||f.status==="aborted")return l.INVALID;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}}}};u.ZodMap=Vt;Vt.create=(e,t,r)=>new Vt({valueType:t,keyType:e,typeName:T.ZodMap,...A(r)});var qt=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.set)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),l.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,l.addIssueToContext)(n,{code:m.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,l.addIssueToContext)(n,{code:m.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 a(c){let d=new Set;for(let f of c){if(f.status==="aborted")return l.INVALID;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let s=[...n.data.values()].map((c,d)=>i._parse(new ue(n,c,n.path,d)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:v.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:v.errorUtil.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};u.ZodSet=qt;qt.create=(e,t)=>new qt({valueType:e,minSize:null,maxSize:null,typeName:T.ZodSet,...A(t)});var Ln=class e extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.function)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),l.INVALID;function n(s,c){return(0,l.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Un.getErrorMap)(),Un.defaultErrorMap].filter(d=>!!d),issueData:{code:m.ZodIssueCode.invalid_arguments,argumentsError:c}})}function o(s,c){return(0,l.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Un.getErrorMap)(),Un.defaultErrorMap].filter(d=>!!d),issueData:{code:m.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof qe){let s=this;return(0,l.OK)(async function(...c){let d=new m.ZodError([]),f=await s._def.args.parseAsync(c,i).catch(I=>{throw d.addIssue(n(c,I)),d}),g=await Reflect.apply(a,this,f);return await s._def.returns._def.type.parseAsync(g,i).catch(I=>{throw d.addIssue(o(g,I)),d})})}else{let s=this;return(0,l.OK)(function(...c){let d=s._def.args.safeParse(c,i);if(!d.success)throw new m.ZodError([n(c,d.error)]);let f=Reflect.apply(a,this,d.data),g=s._def.returns.safeParse(f,i);if(!g.success)throw new m.ZodError([o(f,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Te.create(t).rest(Oe.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Te.create([]).rest(Oe.create()),returns:r||Oe.create(),typeName:T.ZodFunction,...A(n)})}};u.ZodFunction=Ln;var dt=class extends w{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};u.ZodLazy=dt;dt.create=(e,t)=>new dt({getter:e,typeName:T.ZodLazy,...A(t)});var lt=class extends w{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{received:r.data,code:m.ZodIssueCode.invalid_literal,expected:this._def.value}),l.INVALID}return{status:"valid",value:t.data}}get value(){return this._def.value}};u.ZodLiteral=lt;lt.create=(e,t)=>new lt({value:e,typeName:T.ZodLiteral,...A(t)});function jc(e,t){return new ft({values:e,typeName:T.ZodEnum,...A(t)})}var ft=class e extends w{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,l.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:m.ZodIssueCode.invalid_type}),l.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,l.addIssueToContext)(r,{received:r.data,code:m.ZodIssueCode.invalid_enum_value,options:n}),l.INVALID}return(0,l.OK)(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};u.ZodEnum=ft;ft.create=jc;var pt=class extends w{_parse(t){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,l.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:m.ZodIssueCode.invalid_type}),l.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=h.util.objectValues(r);return(0,l.addIssueToContext)(n,{received:n.data,code:m.ZodIssueCode.invalid_enum_value,options:o}),l.INVALID}return(0,l.OK)(t.data)}get enum(){return this._def.values}};u.ZodNativeEnum=pt;pt.create=(e,t)=>new pt({values:e,typeName:T.ZodNativeEnum,...A(t)});var qe=class extends w{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),l.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,l.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};u.ZodPromise=qe;qe.create=(e,t)=>new qe({type:e,typeName:T.ZodPromise,...A(t)});var oe=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{(0,l.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return l.INVALID;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?l.INVALID:c.status==="dirty"||r.value==="dirty"?(0,l.DIRTY)(c.value):c});{if(r.value==="aborted")return l.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:s.status==="dirty"||r.value==="dirty"?(0,l.DIRTY)(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?l.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,l.isValid)(a))return l.INVALID;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,l.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):l.INVALID);h.util.assertNever(o)}};u.ZodEffects=oe;u.ZodTransformer=oe;oe.create=(e,t,r)=>new oe({schema:e,typeName:T.ZodEffects,effect:t,...A(r)});oe.createWithPreprocess=(e,t,r)=>new oe({schema:t,effect:{type:"preprocess",transform:e},typeName:T.ZodEffects,...A(r)});var ce=class extends w{_parse(t){return this._getType(t)===h.ZodParsedType.undefined?(0,l.OK)(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};u.ZodOptional=ce;ce.create=(e,t)=>new ce({innerType:e,typeName:T.ZodOptional,...A(t)});var Ce=class extends w{_parse(t){return this._getType(t)===h.ZodParsedType.null?(0,l.OK)(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};u.ZodNullable=Ce;Ce.create=(e,t)=>new Ce({innerType:e,typeName:T.ZodNullable,...A(t)});var mt=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===h.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};u.ZodDefault=mt;mt.create=(e,t)=>new mt({innerType:e,typeName:T.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...A(t)});var ht=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,l.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new m.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new m.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};u.ZodCatch=ht;ht.create=(e,t)=>new ht({innerType:e,typeName:T.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...A(t)});var zt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),l.INVALID}return{status:"valid",value:t.data}}};u.ZodNaN=zt;zt.create=e=>new zt({typeName:T.ZodNaN,...A(e)});u.BRAND=Symbol("zod_brand");var Pr=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};u.ZodBranded=Pr;var Rr=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);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"?l.INVALID:i.status==="dirty"?(r.dirty(),(0,l.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"?l.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(t,r){return new e({in:t,out:r,typeName:T.ZodPipeline})}};u.ZodPipeline=Rr;var gt=class extends w{_parse(t){let r=this._def.innerType._parse(t),n=o=>((0,l.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,l.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};u.ZodReadonly=gt;gt.create=(e,t)=>new gt({innerType:e,typeName:T.ZodReadonly,...A(t)});function Oc(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function kc(e,t={},r){return e?Ve.create().superRefine((n,o)=>{var a,s;let i=e(n);if(i instanceof Promise)return i.then(c=>{var d,f;if(!c){let g=Oc(t,n),_=(f=(d=g.fatal)!=null?d:r)!=null?f:!0;o.addIssue({code:"custom",...g,fatal:_})}});if(!i){let c=Oc(t,n),d=(s=(a=c.fatal)!=null?a:r)!=null?s:!0;o.addIssue({code:"custom",...c,fatal:d})}}):Ve.create()}u.late={object:ee.lazycreate};var T;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(T||(u.ZodFirstPartyTypeKind=T={}));var dp=(e,t={message:`Input not instance of ${e.name}`})=>kc(r=>r instanceof e,t);u.instanceof=dp;var Uc=Me.create;u.string=Uc;var Dc=rt.create;u.number=Dc;var lp=zt.create;u.nan=lp;var fp=nt.create;u.bigint=fp;var Zc=ot.create;u.boolean=Zc;var pp=it.create;u.date=pp;var mp=Lt.create;u.symbol=mp;var hp=at.create;u.undefined=hp;var gp=st.create;u.null=gp;var yp=Ve.create;u.any=yp;var vp=Oe.create;u.unknown=vp;var _p=fe.create;u.never=_p;var bp=Mt.create;u.void=bp;var xp=Pe.create;u.array=xp;var Tp=ee.create;u.object=Tp;var Cp=ee.strictCreate;u.strictObject=Cp;var Ip=ct.create;u.union=Ip;var Ep=Dn.create;u.discriminatedUnion=Ep;var Sp=ut.create;u.intersection=Sp;var Ap=Te.create;u.tuple=Ap;var wp=Zn.create;u.record=wp;var Op=Vt.create;u.map=Op;var Pp=qt.create;u.set=Pp;var Rp=Ln.create;u.function=Rp;var Np=dt.create;u.lazy=Np;var jp=lt.create;u.literal=jp;var kp=ft.create;u.enum=kp;var Up=pt.create;u.nativeEnum=Up;var Dp=qe.create;u.promise=Dp;var Lc=oe.create;u.effect=Lc;u.transformer=Lc;var Zp=ce.create;u.optional=Zp;var Lp=Ce.create;u.nullable=Lp;var Mp=oe.createWithPreprocess;u.preprocess=Mp;var Vp=Rr.create;u.pipeline=Vp;var qp=()=>Uc().optional();u.ostring=qp;var zp=()=>Dc().optional();u.onumber=zp;var Fp=()=>Zc().optional();u.oboolean=Fp;u.coerce={string:(e=>Me.create({...e,coerce:!0})),number:(e=>rt.create({...e,coerce:!0})),boolean:(e=>ot.create({...e,coerce:!0})),bigint:(e=>nt.create({...e,coerce:!0})),date:(e=>it.create({...e,coerce:!0}))};u.NEVER=l.INVALID});var Ti=p(de=>{"use strict";var Gp=de&&de.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ft=de&&de.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Gp(t,e,r)};Object.defineProperty(de,"__esModule",{value:!0});Ft(jn(),de);Ft(_i(),de);Ft(Ec(),de);Ft(wr(),de);Ft(Mc(),de);Ft(Nn(),de)});var D=p(te=>{"use strict";var Vc=te&&te.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),$p=te&&te.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Bp=te&&te.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Vc(t,e,r);return $p(t,e),t},Hp=te&&te.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Vc(t,e,r)};Object.defineProperty(te,"__esModule",{value:!0});te.z=void 0;var qc=Bp(Ti());te.z=qc;Hp(Ti(),te);te.default=qc});var Ci=p(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.actionTypesZodSchema=Gt.ActionTypes=void 0;var Wp=D(),zc;(function(e){e.OpenUrl="openUrl",e.ImBack="imBack",e.PostBack="postBack",e.PlayAudio="playAudio",e.PlayVideo="playVideo",e.ShowImage="showImage",e.DownloadFile="downloadFile",e.Signin="signin",e.Call="call",e.MessageBack="messageBack",e.OpenApp="openApp"})(zc||(Gt.ActionTypes=zc={}));Gt.actionTypesZodSchema=Wp.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var Ii=p($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.semanticActionStateTypesZodSchema=$t.SemanticActionStateTypes=void 0;var Kp=D(),Fc;(function(e){e.Start="start",e.Continue="continue",e.Done="done"})(Fc||($t.SemanticActionStateTypes=Fc={}));$t.semanticActionStateTypesZodSchema=Kp.z.enum(["start","continue","done"])});var Ei=p(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.attachmentLayoutTypesZodSchema=Bt.AttachmentLayoutTypes=void 0;var Yp=D(),Gc;(function(e){e.List="list",e.Carousel="carousel"})(Gc||(Bt.AttachmentLayoutTypes=Gc={}));Bt.attachmentLayoutTypesZodSchema=Yp.z.enum(["list","carousel"])});var Si=p(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.Channels=void 0;var $c;(function(e){e.Agents="agents",e.Alexa="alexa",e.Console="console",e.Directline="directline",e.DirectlineSpeech="directlinespeech",e.Email="email",e.Emulator="emulator",e.Facebook="facebook",e.Groupme="groupme",e.Line="line",e.Msteams="msteams",e.M365CopilotSubChannel="COPILOT",e.M365Copilot="msteams:COPILOT",e.Omni="omnichannel",e.Outlook="outlook",e.Skype="skype",e.Slack="slack",e.Sms="sms",e.Telegram="telegram",e.Telephony="telephony",e.Test="test",e.Webchat="webchat"})($c||(Mn.Channels=$c={}))});var Ai=p(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.endOfConversationCodesZodSchema=Ht.EndOfConversationCodes=void 0;var Xp=D(),Bc;(function(e){e.Unknown="unknown",e.CompletedSuccessfully="completedSuccessfully",e.UserCancelled="userCancelled",e.AgentTimedOut="agentTimedOut",e.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",e.ChannelFailed="channelFailed"})(Bc||(Ht.EndOfConversationCodes=Bc={}));Ht.endOfConversationCodesZodSchema=Xp.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Wc=p(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.MembershipSourceTypes=void 0;var Hc;(function(e){e.Channel="channel",e.Team="team"})(Hc||(Vn.MembershipSourceTypes=Hc={}))});var Yc=p(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.MembershipTypes=void 0;var Kc;(function(e){e.Direct="direct",e.Transitive="transitive"})(Kc||(qn.MembershipTypes=Kc={}))});var Nr=p(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.roleTypeZodSchema=Wt.RoleTypes=void 0;var Jp=D(),Xc;(function(e){e.User="user",e.Agent="bot",e.Skill="skill",e.AgenticIdentity="agenticAppInstance",e.AgenticUser="agenticUser"})(Xc||(Wt.RoleTypes=Xc={}));Wt.roleTypeZodSchema=Jp.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var Jc=p(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.addAIToActivity=void 0;var Qp=(e,t,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:t,usageInfo:r};(n=e.entities)!==null&&n!==void 0||(e.entities=[]),e.entities.push(o)};zn.addAIToActivity=Qp});var Qc=p(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.adaptiveCardInvokeActionZodSchema=void 0;var yt=D();Fn.adaptiveCardInvokeActionZodSchema=yt.z.object({type:yt.z.string().min(1),id:yt.z.string().optional(),verb:yt.z.string().min(1),data:yt.z.record(yt.z.string().min(1),yt.z.any())})});var eu=p(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var tu=p(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.default="00000000-0000-0000-0000-000000000000"});var ru=p(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var jr=p(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var em=ru();function tm(e){return typeof e=="string"&&em.default.test(e)}Ri.default=tm});var kr=p(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});var rm=jr();function nm(e){if(!(0,rm.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}Ni.default=nm});var Re=p(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.unsafeStringify=void 0;var om=jr(),F=[];for(let e=0;e<256;++e)F.push((e+256).toString(16).slice(1));function nu(e,t=0){return(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase()}Ur.unsafeStringify=nu;function im(e,t=0){let r=nu(e,t);if(!(0,om.default)(r))throw TypeError("Stringified UUID is invalid");return r}Ur.default=im});var Gn=p(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});var ji,am=new Uint8Array(16);function sm(){if(!ji){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ji=crypto.getRandomValues.bind(crypto)}return ji(am)}ki.default=sm});var Ui=p(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.updateV1State=void 0;var ou=Gn(),cm=Re(),Dr={};function um(e,t,r){var i,a,s,c;let n,o=(i=e==null?void 0:e._v6)!=null?i:!1;if(e){let d=Object.keys(e);d.length===1&&d[0]==="_v6"&&(e=void 0)}if(e)n=iu((c=(s=e.random)!=null?s:(a=e.rng)==null?void 0:a.call(e))!=null?c:(0,ou.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let d=Date.now(),f=(0,ou.default)();au(Dr,d,f),n=iu(f,Dr.msecs,Dr.nsecs,o?void 0:Dr.clockseq,o?void 0:Dr.node,t,r)}return t!=null?t:(0,cm.unsafeStringify)(n)}function au(e,t,r){var n,o;return(n=e.msecs)!=null||(e.msecs=-1/0),(o=e.nsecs)!=null||(e.nsecs=0),t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}Zr.updateV1State=au;function iu(e,t,r,n,o,i,a=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),a=0;else if(a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);t!=null||(t=Date.now()),r!=null||(r=0),n!=null||(n=(e[8]<<8|e[9])&16383),o!=null||(o=e.slice(10,16)),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;i[a++]=s>>>24&255,i[a++]=s>>>16&255,i[a++]=s>>>8&255,i[a++]=s&255;let c=t/4294967296*1e4&268435455;i[a++]=c>>>8&255,i[a++]=c&255,i[a++]=c>>>24&15|16,i[a++]=c>>>16&255,i[a++]=n>>>8|128,i[a++]=n&255;for(let d=0;d<6;++d)i[a++]=o[d];return i}Zr.default=um});var Zi=p(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});var dm=kr(),lm=Re();function fm(e){let t=typeof e=="string"?(0,dm.default)(e):e,r=pm(t);return typeof e=="string"?(0,lm.unsafeStringify)(r):r}Di.default=fm;function pm(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var cu=p(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});function mm(e){let t=ym(e),r=gm(t,e.length*8);return hm(r)}function hm(e){let t=new Uint8Array(e.length*4);for(let r=0;r<e.length*4;r++)t[r]=e[r>>2]>>>r%4*8&255;return t}function su(e){return(e+64>>>9<<4)+14+1}function gm(e,t){let r=new Uint32Array(su(t)).fill(0);r.set(e),r[t>>5]|=128<<t%32,r[r.length-1]=t,e=r;let n=1732584193,o=-271733879,i=-1732584194,a=271733878;for(let s=0;s<e.length;s+=16){let c=n,d=o,f=i,g=a;n=H(n,o,i,a,e[s],7,-680876936),a=H(a,n,o,i,e[s+1],12,-389564586),i=H(i,a,n,o,e[s+2],17,606105819),o=H(o,i,a,n,e[s+3],22,-1044525330),n=H(n,o,i,a,e[s+4],7,-176418897),a=H(a,n,o,i,e[s+5],12,1200080426),i=H(i,a,n,o,e[s+6],17,-1473231341),o=H(o,i,a,n,e[s+7],22,-45705983),n=H(n,o,i,a,e[s+8],7,1770035416),a=H(a,n,o,i,e[s+9],12,-1958414417),i=H(i,a,n,o,e[s+10],17,-42063),o=H(o,i,a,n,e[s+11],22,-1990404162),n=H(n,o,i,a,e[s+12],7,1804603682),a=H(a,n,o,i,e[s+13],12,-40341101),i=H(i,a,n,o,e[s+14],17,-1502002290),o=H(o,i,a,n,e[s+15],22,1236535329),n=W(n,o,i,a,e[s+1],5,-165796510),a=W(a,n,o,i,e[s+6],9,-1069501632),i=W(i,a,n,o,e[s+11],14,643717713),o=W(o,i,a,n,e[s],20,-373897302),n=W(n,o,i,a,e[s+5],5,-701558691),a=W(a,n,o,i,e[s+10],9,38016083),i=W(i,a,n,o,e[s+15],14,-660478335),o=W(o,i,a,n,e[s+4],20,-405537848),n=W(n,o,i,a,e[s+9],5,568446438),a=W(a,n,o,i,e[s+14],9,-1019803690),i=W(i,a,n,o,e[s+3],14,-187363961),o=W(o,i,a,n,e[s+8],20,1163531501),n=W(n,o,i,a,e[s+13],5,-1444681467),a=W(a,n,o,i,e[s+2],9,-51403784),i=W(i,a,n,o,e[s+7],14,1735328473),o=W(o,i,a,n,e[s+12],20,-1926607734),n=K(n,o,i,a,e[s+5],4,-378558),a=K(a,n,o,i,e[s+8],11,-2022574463),i=K(i,a,n,o,e[s+11],16,1839030562),o=K(o,i,a,n,e[s+14],23,-35309556),n=K(n,o,i,a,e[s+1],4,-1530992060),a=K(a,n,o,i,e[s+4],11,1272893353),i=K(i,a,n,o,e[s+7],16,-155497632),o=K(o,i,a,n,e[s+10],23,-1094730640),n=K(n,o,i,a,e[s+13],4,681279174),a=K(a,n,o,i,e[s],11,-358537222),i=K(i,a,n,o,e[s+3],16,-722521979),o=K(o,i,a,n,e[s+6],23,76029189),n=K(n,o,i,a,e[s+9],4,-640364487),a=K(a,n,o,i,e[s+12],11,-421815835),i=K(i,a,n,o,e[s+15],16,530742520),o=K(o,i,a,n,e[s+2],23,-995338651),n=Y(n,o,i,a,e[s],6,-198630844),a=Y(a,n,o,i,e[s+7],10,1126891415),i=Y(i,a,n,o,e[s+14],15,-1416354905),o=Y(o,i,a,n,e[s+5],21,-57434055),n=Y(n,o,i,a,e[s+12],6,1700485571),a=Y(a,n,o,i,e[s+3],10,-1894986606),i=Y(i,a,n,o,e[s+10],15,-1051523),o=Y(o,i,a,n,e[s+1],21,-2054922799),n=Y(n,o,i,a,e[s+8],6,1873313359),a=Y(a,n,o,i,e[s+15],10,-30611744),i=Y(i,a,n,o,e[s+6],15,-1560198380),o=Y(o,i,a,n,e[s+13],21,1309151649),n=Y(n,o,i,a,e[s+4],6,-145523070),a=Y(a,n,o,i,e[s+11],10,-1120210379),i=Y(i,a,n,o,e[s+2],15,718787259),o=Y(o,i,a,n,e[s+9],21,-343485551),n=ze(n,c),o=ze(o,d),i=ze(i,f),a=ze(a,g)}return Uint32Array.of(n,o,i,a)}function ym(e){if(e.length===0)return new Uint32Array;let t=new Uint32Array(su(e.length*8)).fill(0);for(let r=0;r<e.length;r++)t[r>>2]|=(e[r]&255)<<r%4*8;return t}function ze(e,t){let r=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(r>>16)<<16|r&65535}function vm(e,t){return e<<t|e>>>32-t}function $n(e,t,r,n,o,i){return ze(vm(ze(ze(t,e),ze(n,i)),o),r)}function H(e,t,r,n,o,i,a){return $n(t&r|~t&n,e,t,o,i,a)}function W(e,t,r,n,o,i,a){return $n(t&n|r&~n,e,t,o,i,a)}function K(e,t,r,n,o,i,a){return $n(t^r^n,e,t,o,i,a)}function Y(e,t,r,n,o,i,a){return $n(r^(t|~n),e,t,o,i,a)}Li.default=mm});var Lr=p(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.URL=Ne.DNS=Ne.stringToBytes=void 0;var uu=kr(),_m=Re();function du(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}Ne.stringToBytes=du;Ne.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ne.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function bm(e,t,r,n,o,i){let a=typeof r=="string"?du(r):r,s=typeof n=="string"?(0,uu.default)(n):n;if(typeof n=="string"&&(n=(0,uu.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+a.length);if(c.set(s),c.set(a,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,o){i=i||0;for(let d=0;d<16;++d)o[i+d]=c[d];return o}return(0,_m.unsafeStringify)(c)}Ne.default=bm});var fu=p(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.URL=vt.DNS=void 0;var xm=cu(),Mi=Lr(),lu=Lr();Object.defineProperty(vt,"DNS",{enumerable:!0,get:function(){return lu.DNS}});Object.defineProperty(vt,"URL",{enumerable:!0,get:function(){return lu.URL}});function Vi(e,t,r,n){return(0,Mi.default)(48,xm.default,e,t,r,n)}Vi.DNS=Mi.DNS;Vi.URL=Mi.URL;vt.default=Vi});var pu=p(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var Tm=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);qi.default={randomUUID:Tm}});var hu=p(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});var mu=pu(),Cm=Gn(),Im=Re();function Em(e,t,r){var o,i,a;if(mu.default.randomUUID&&!t&&!e)return mu.default.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:(0,Cm.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return(0,Im.unsafeStringify)(n)}zi.default=Em});var gu=p(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});function Sm(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Fi(e,t){return e<<t|e>>>32-t}function Am(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let s=0;s<i;++s){let c=new Uint32Array(16);for(let d=0;d<16;++d)c[d]=e[s*64+d*4]<<24|e[s*64+d*4+1]<<16|e[s*64+d*4+2]<<8|e[s*64+d*4+3];a[s]=c}a[i-1][14]=(e.length-1)*8/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let c=new Uint32Array(80);for(let P=0;P<16;++P)c[P]=a[s][P];for(let P=16;P<80;++P)c[P]=Fi(c[P-3]^c[P-8]^c[P-14]^c[P-16],1);let d=r[0],f=r[1],g=r[2],_=r[3],I=r[4];for(let P=0;P<80;++P){let y=Math.floor(P/20),S=Fi(d,5)+Sm(y,f,g,_)+I+t[y]+c[P]>>>0;I=_,_=g,g=Fi(f,30)>>>0,f=d,d=S}r[0]=r[0]+d>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+_>>>0,r[4]=r[4]+I>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}Gi.default=Am});var vu=p(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.URL=_t.DNS=void 0;var wm=gu(),$i=Lr(),yu=Lr();Object.defineProperty(_t,"DNS",{enumerable:!0,get:function(){return yu.DNS}});Object.defineProperty(_t,"URL",{enumerable:!0,get:function(){return yu.URL}});function Bi(e,t,r,n){return(0,$i.default)(80,wm.default,e,t,r,n)}Bi.DNS=$i.DNS;Bi.URL=$i.URL;_t.default=Bi});var _u=p(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Om=Re(),Pm=Ui(),Rm=Zi();function Nm(e,t,r){e!=null||(e={}),r!=null||(r=0);let n=(0,Pm.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,Rm.default)(n),t){for(let o=0;o<16;o++)t[r+o]=n[o];return t}return(0,Om.unsafeStringify)(n)}Hi.default=Nm});var bu=p(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var jm=kr(),km=Re();function Um(e){let t=typeof e=="string"?(0,jm.default)(e):e,r=Dm(t);return typeof e=="string"?(0,km.unsafeStringify)(r):r}Wi.default=Um;function Dm(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Iu=p(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.updateV7State=void 0;var xu=Gn(),Zm=Re(),Ki={};function Lm(e,t,r){var o,i,a;let n;if(e)n=Tu((a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:(0,xu.default)(),e.msecs,e.seq,t,r);else{let s=Date.now(),c=(0,xu.default)();Cu(Ki,s,c),n=Tu(c,Ki.msecs,Ki.seq,t,r)}return t!=null?t:(0,Zm.unsafeStringify)(n)}function Cu(e,t,r){var n,o;return(n=e.msecs)!=null||(e.msecs=-1/0),(o=e.seq)!=null||(e.seq=0),t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}Mr.updateV7State=Cu;function Tu(e,t,r,n,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),o=0;else if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return t!=null||(t=Date.now()),r!=null||(r=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9]),n[o++]=t/1099511627776&255,n[o++]=t/4294967296&255,n[o++]=t/16777216&255,n[o++]=t/65536&255,n[o++]=t/256&255,n[o++]=t&255,n[o++]=112|r>>>28&15,n[o++]=r>>>20&255,n[o++]=128|r>>>14&63,n[o++]=r>>>6&255,n[o++]=r<<2&255|e[10]&3,n[o++]=e[11],n[o++]=e[12],n[o++]=e[13],n[o++]=e[14],n[o++]=e[15],n}Mr.default=Lm});var Eu=p(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Mm=jr();function Vm(e){if(!(0,Mm.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}Yi.default=Vm});var Su=p(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.version=R.validate=R.v7=R.v6ToV1=R.v6=R.v5=R.v4=R.v3=R.v1ToV6=R.v1=R.stringify=R.parse=R.NIL=R.MAX=void 0;var qm=eu();Object.defineProperty(R,"MAX",{enumerable:!0,get:function(){return qm.default}});var zm=tu();Object.defineProperty(R,"NIL",{enumerable:!0,get:function(){return zm.default}});var Fm=kr();Object.defineProperty(R,"parse",{enumerable:!0,get:function(){return Fm.default}});var Gm=Re();Object.defineProperty(R,"stringify",{enumerable:!0,get:function(){return Gm.default}});var $m=Ui();Object.defineProperty(R,"v1",{enumerable:!0,get:function(){return $m.default}});var Bm=Zi();Object.defineProperty(R,"v1ToV6",{enumerable:!0,get:function(){return Bm.default}});var Hm=fu();Object.defineProperty(R,"v3",{enumerable:!0,get:function(){return Hm.default}});var Wm=hu();Object.defineProperty(R,"v4",{enumerable:!0,get:function(){return Wm.default}});var Km=vu();Object.defineProperty(R,"v5",{enumerable:!0,get:function(){return Km.default}});var Ym=_u();Object.defineProperty(R,"v6",{enumerable:!0,get:function(){return Ym.default}});var Xm=bu();Object.defineProperty(R,"v6ToV1",{enumerable:!0,get:function(){return Xm.default}});var Jm=Iu();Object.defineProperty(R,"v7",{enumerable:!0,get:function(){return Jm.default}});var Qm=jr();Object.defineProperty(R,"validate",{enumerable:!0,get:function(){return Qm.default}});var eh=Eu();Object.defineProperty(R,"version",{enumerable:!0,get:function(){return eh.default}})});var Xi=p(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.entityZodSchema=void 0;var Au=D();Bn.entityZodSchema=Au.z.object({type:Au.z.string().min(1)}).passthrough()});var wu=p(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.semanticActionZodSchema=void 0;var Vr=D(),th=Xi(),rh=Ii();Hn.semanticActionZodSchema=Vr.z.object({id:Vr.z.string().min(1),state:Vr.z.union([rh.semanticActionStateTypesZodSchema,Vr.z.string().min(1)]),entities:Vr.z.record(th.entityZodSchema)})});var Ou=p(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.cardActionZodSchema=void 0;var Ie=D(),nh=Ci();Wn.cardActionZodSchema=Ie.z.object({type:Ie.z.union([nh.actionTypesZodSchema,Ie.z.string().min(1)]),title:Ie.z.string().min(1),image:Ie.z.string().min(1).optional(),text:Ie.z.string().min(1).optional(),displayText:Ie.z.string().min(1).optional(),value:Ie.z.any().optional(),channelData:Ie.z.unknown().optional(),imageAltText:Ie.z.string().min(1).optional()})});var Pu=p(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.suggestedActionsZodSchema=void 0;var Kn=D(),oh=Ou();Yn.suggestedActionsZodSchema=Kn.z.object({to:Kn.z.array(Kn.z.string().min(1)),actions:Kn.z.array(oh.cardActionZodSchema)})});var Ji=p(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.activityEventNamesZodSchema=Kt.ActivityEventNames=void 0;var ih=D(),Ru;(function(e){e.ContinueConversation="ContinueConversation",e.CreateConversation="CreateConversation"})(Ru||(Kt.ActivityEventNames=Ru={}));Kt.activityEventNamesZodSchema=ih.z.enum(["ContinueConversation","CreateConversation"])});var Qi=p(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.activityImportanceZodSchema=Yt.ActivityImportance=void 0;var ah=D(),Nu;(function(e){e.Low="low",e.Normal="normal",e.High="high"})(Nu||(Yt.ActivityImportance=Nu={}));Yt.activityImportanceZodSchema=ah.z.enum(["low","normal","high"])});var ea=p(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.activityTypesZodSchema=Xt.ActivityTypes=void 0;var sh=D(),ju;(function(e){e.Message="message",e.ContactRelationUpdate="contactRelationUpdate",e.ConversationUpdate="conversationUpdate",e.Typing="typing",e.EndOfConversation="endOfConversation",e.Event="event",e.Invoke="invoke",e.InvokeResponse="invokeResponse",e.DeleteUserData="deleteUserData",e.MessageUpdate="messageUpdate",e.MessageDelete="messageDelete",e.InstallationUpdate="installationUpdate",e.MessageReaction="messageReaction",e.Suggestion="suggestion",e.Trace="trace",e.Handoff="handoff",e.Command="command",e.CommandResult="commandResult"})(ju||(Xt.ActivityTypes=ju={}));Xt.activityTypesZodSchema=sh.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var ku=p(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.attachmentZodSchema=void 0;var Jt=D();Xn.attachmentZodSchema=Jt.z.object({contentType:Jt.z.string().min(1),contentUrl:Jt.z.string().min(1).optional(),content:Jt.z.unknown().optional(),name:Jt.z.string().min(1).optional(),thumbnailUrl:Jt.z.string().min(1).optional()})});var Uu=p(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.addProductInfoToActivity=bt.clearProductInfoFromActivity=void 0;var ch=e=>{e&&e.entities&&e.entities.length&&(e.entities=e.entities.filter(t=>t.type!=="ProductInfo"))};bt.clearProductInfoFromActivity=ch;var uh=(e,t)=>{var r,n;let o={type:"ProductInfo",id:t};(r=e.entities)!==null&&r!==void 0||(e.entities=[]),(0,bt.clearProductInfoFromActivity)(e),(n=e.entities)===null||n===void 0||n.push(o)};bt.addProductInfoToActivity=uh});var ta=p(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.channelAccountZodSchema=void 0;var pe=D(),dh=Nr();Jn.channelAccountZodSchema=pe.z.object({id:pe.z.string().min(1).optional(),name:pe.z.string().optional(),aadObjectId:pe.z.string().min(1).optional(),tenantId:pe.z.string().min(1).optional(),agenticUserId:pe.z.string().min(1).optional(),agenticAppId:pe.z.string().min(1).optional(),agenticAppBlueprintId:pe.z.string().min(1).optional(),role:pe.z.union([dh.roleTypeZodSchema,pe.z.string().min(1)]).optional(),properties:pe.z.unknown().optional()})});var ra=p(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.conversationAccountZodSchema=void 0;var Ee=D(),lh=Nr();Qn.conversationAccountZodSchema=Ee.z.object({isGroup:Ee.z.boolean().optional(),conversationType:Ee.z.string().min(1).optional(),tenantId:Ee.z.string().min(1).optional(),id:Ee.z.string().min(1),name:Ee.z.string().min(1).optional(),aadObjectId:Ee.z.string().min(1).optional(),role:Ee.z.union([lh.roleTypeZodSchema,Ee.z.string().min(1)]).optional(),properties:Ee.z.unknown().optional()})});var Zu=p(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.conversationReferenceZodSchema=void 0;var qr=D(),Du=ta(),fh=ra();eo.conversationReferenceZodSchema=qr.z.object({activityId:qr.z.string().min(1).optional(),user:Du.channelAccountZodSchema.optional(),locale:qr.z.string().min(1).optional(),agent:Du.channelAccountZodSchema.optional().nullable(),conversation:fh.conversationAccountZodSchema,channelId:qr.z.string().min(1),serviceUrl:qr.z.string().min(1).optional()})});var na=p(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.deliveryModesZodSchema=Qt.DeliveryModes=void 0;var ph=D(),Lu;(function(e){e.Normal="normal",e.Notification="notification",e.ExpectReplies="expectReplies",e.Ephemeral="ephemeral"})(Lu||(Qt.DeliveryModes=Lu={}));Qt.deliveryModesZodSchema=ph.z.enum(["normal","notification","expectReplies","ephemeral"])});var oa=p(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.inputHintsZodSchema=er.InputHints=void 0;var mh=D(),Mu;(function(e){e.AcceptingInput="acceptingInput",e.IgnoringInput="ignoringInput",e.ExpectingInput="expectingInput"})(Mu||(er.InputHints=Mu={}));er.inputHintsZodSchema=mh.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var ia=p(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.messageReactionTypesZodSchema=tr.MessageReactionTypes=void 0;var hh=D(),Vu;(function(e){e.Like="like",e.PlusOne="plusOne"})(Vu||(tr.MessageReactionTypes=Vu={}));tr.messageReactionTypesZodSchema=hh.z.enum(["like","plusOne"])});var qu=p(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.messageReactionZodSchema=void 0;var aa=D(),gh=ia();to.messageReactionZodSchema=aa.z.object({type:aa.z.union([gh.messageReactionTypesZodSchema,aa.z.string().min(1)])})});var sa=p(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.textFormatTypesZodSchema=rr.TextFormatTypes=void 0;var yh=D(),zu;(function(e){e.Markdown="markdown",e.Plain="plain",e.Xml="xml"})(zu||(rr.TextFormatTypes=zu={}));rr.textFormatTypesZodSchema=yh.z.enum(["markdown","plain","xml"])});var Fu=p(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.textHighlightZodSchema=void 0;var ca=D();ro.textHighlightZodSchema=ca.z.object({text:ca.z.string().min(1),occurrence:ca.z.number()})});var ua=p(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.ExceptionHelper=void 0;var no=class e{static generateException(t,r,n,o){var i;let a=r.description;o&&Object.keys(o).forEach(g=>{a=a.replace(`{${g}}`,o[g])});let c=((i=r.helplink)!==null&&i!==void 0?i:e.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),d=`[${r.code}] - ${a} - ${c}`,f=new t(d);return f.code=r.code,f.helpLink=c,n&&(f.innerException=n),f}};oo.ExceptionHelper=no;no.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var da=p(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.Errors=void 0;io.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"}}});var Ku=p(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.Activity=xt.activityZodSchema=void 0;var vh=Su(),b=D(),_h=wu(),bh=Pu(),Wu=Ji(),xh=Qi(),so=ea(),Th=ku(),Ch=Ei(),Gu=Uu(),ao=ta(),$u=Si(),Ih=ra(),Eh=Zu(),Sh=Ai(),Ah=na(),wh=Xi(),Oh=oa(),Bu=qu(),Ph=sa(),Rh=Fu(),Hu=Nr(),Fe=ua(),Ge=da();xt.activityZodSchema=b.z.object({type:b.z.union([so.activityTypesZodSchema,b.z.string().min(1)]),text:b.z.string().optional(),id:b.z.string().min(1).optional(),channelId:b.z.string().min(1).optional(),from:ao.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),localTimestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:Ih.conversationAccountZodSchema.optional(),recipient:ao.channelAccountZodSchema.optional(),textFormat:b.z.union([Ph.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([Ch.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(ao.channelAccountZodSchema).optional(),membersRemoved:b.z.array(ao.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(Bu.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(Bu.messageReactionZodSchema).optional(),topicName:b.z.string().min(1).optional(),historyDisclosed:b.z.boolean().optional(),locale:b.z.string().min(1).optional(),speak:b.z.string().min(1).optional(),inputHint:b.z.union([Oh.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:bh.suggestedActionsZodSchema.optional(),attachments:b.z.array(Th.attachmentZodSchema).optional(),entities:b.z.array(wh.entityZodSchema.passthrough()).optional(),channelData:b.z.any().optional(),action:b.z.string().min(1).optional(),replyToId:b.z.string().min(1).optional(),label:b.z.string().min(1).optional(),valueType:b.z.string().min(1).optional(),value:b.z.unknown().optional(),name:b.z.union([Wu.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:Eh.conversationReferenceZodSchema.optional(),code:b.z.union([Sh.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),importance:b.z.union([xh.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([Ah.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(Rh.textHighlightZodSchema).optional(),semanticAction:_h.semanticActionZodSchema.optional()});var la=class e{constructor(t){if(t===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidActivityTypeUndefined);if(t===null)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidActivityTypeNull);if(typeof t=="string"&&t.length===0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidActivityTypeEmptyString);this.type=t}static fromJson(t){return this.fromObject(JSON.parse(t))}static fromObject(t){let r=xt.activityZodSchema.passthrough().parse(t),n=new e(r.type);return Object.assign(n,r),n}get channelId(){var t;return(t=this._channelId)===null||t===void 0?void 0:t.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(t){let r,n;return t&&t.indexOf(":")!==-1?(r=t.substring(0,t.indexOf(":")),n=t.substring(t.indexOf(":")+1)):r=t,[r,n]}set channelId(t){let[r,n]=e.parseChannelId(t);if(t&&!r)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidChannelIdFormat,void 0,{channelId:t});this._channelId=r,n?(0,Gu.addProductInfoToActivity)(this,n):(0,Gu.clearProductInfoFromActivity)(this)}set channelIdChannel(t){this._channelId=t}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var t,r;return(r=(t=this.entities)===null||t===void 0?void 0:t.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(t){if(!this._channelId)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${t?`:${t}`:""}`}static getContinuationActivity(t){var r;let n={type:so.ActivityTypes.Event,name:Wu.ActivityEventNames.ContinueConversation,id:(r=t.activityId)!==null&&r!==void 0?r:(0,vh.v4)(),channelId:t.channelId,locale:t.locale,serviceUrl:t.serviceUrl,conversation:t.conversation,recipient:t.agent,from:t.user,relatesTo:t};return e.fromObject(n)}getAppropriateReplyToId(){if(this.type!==so.ActivityTypes.ConversationUpdate||this.channelId!==$u.Channels.Directline&&this.channelId!==$u.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.ActivityChannelIdUndefined);return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(t,r=!1){var n,o,i;return this.channelId=t.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=t.locale),this.serviceUrl=t.serviceUrl,this.conversation=t.conversation,r?(this.from=t.user,this.recipient=(o=t.agent)!==null&&o!==void 0?o:void 0,t.activityId&&(this.id=t.activityId)):(this.from=(i=t.agent)!==null&&i!==void 0?i:void 0,this.recipient=t.user,t.activityId&&(this.replyToId=t.activityId)),this}clone(){let t=JSON.parse(JSON.stringify(this));for(let r in t)typeof t[r]=="string"&&!isNaN(Date.parse(t[r]))&&(t[r]=new Date(t[r]));return Object.setPrototypeOf(t,e.prototype),t}getMentions(t){let r=[];if(t.entities!==void 0)for(let n=0;n<t.entities.length;n++)t.entities[n].type.toLowerCase()==="mention"&&r.push(t.entities[n]);return r}normalizeMentions(t=!1){var r,n;if(this.type===so.ActivityTypes.Message&&(t&&(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=e.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=e.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(t){if(!t)return t;let r;do{r=!1;let n=t.toLowerCase().indexOf("<at");if(n>=0){let o=t.indexOf(">",n);if(o>0){let i=t.toLowerCase().indexOf("</at>",o);if(i>0){let a=t.substring(i+5);a.length>0&&!/\s/.test(a[0])&&(a=` ${a}`),t=t.substring(0,i)+a;let s=t.substring(o+1,i),c=t.substring(0,n);c.length>0&&!/\s$/.test(c)&&(c+=" "),t=c+s+a,r=!0}}}}while(r);return t}removeMentionText(t){let n=this.getMentions(this).filter(o=>o.mentioned.id===t);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):""}getReplyConversationReference(t){let r=this.getConversationReference();return r.activityId=t,r}toJsonString(t,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,t,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Hu.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Hu.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var t,r,n;return(r=(t=this.recipient)===null||t===void 0?void 0:t.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var t;if(this.isAgenticRequest())return(t=this.recipient)===null||t===void 0?void 0:t.agenticAppId}getAgenticUser(){var t;if(this.isAgenticRequest())return(t=this.recipient)===null||t===void 0?void 0:t.agenticUserId}};xt.Activity=la});var Xu=p(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.ActivityTreatments=void 0;var Yu;(function(e){e.Targeted="targeted"})(Yu||(co.ActivityTreatments=Yu={}))});var uo=p(C=>{"use strict";var Nh=C&&C.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ju=C&&C.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Nh(t,e,r)};Object.defineProperty(C,"__esModule",{value:!0});C.ActivityErrors=C.ExceptionHelper=C.ActivityTreatments=C.TextFormatTypes=C.MessageReactionTypes=C.InputHints=C.DeliveryModes=C.ActivityTypes=C.ActivityImportance=C.ActivityEventNames=C.activityZodSchema=C.Activity=C.RoleTypes=C.MembershipTypes=C.MembershipSourceTypes=C.EndOfConversationCodes=C.Channels=C.AttachmentLayoutTypes=C.SemanticActionStateTypes=C.ActionTypes=void 0;var jh=Ci();Object.defineProperty(C,"ActionTypes",{enumerable:!0,get:function(){return jh.ActionTypes}});var kh=Ii();Object.defineProperty(C,"SemanticActionStateTypes",{enumerable:!0,get:function(){return kh.SemanticActionStateTypes}});var Uh=Ei();Object.defineProperty(C,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Uh.AttachmentLayoutTypes}});var Dh=Si();Object.defineProperty(C,"Channels",{enumerable:!0,get:function(){return Dh.Channels}});var Zh=Ai();Object.defineProperty(C,"EndOfConversationCodes",{enumerable:!0,get:function(){return Zh.EndOfConversationCodes}});var Lh=Wc();Object.defineProperty(C,"MembershipSourceTypes",{enumerable:!0,get:function(){return Lh.MembershipSourceTypes}});var Mh=Yc();Object.defineProperty(C,"MembershipTypes",{enumerable:!0,get:function(){return Mh.MembershipTypes}});var Vh=Nr();Object.defineProperty(C,"RoleTypes",{enumerable:!0,get:function(){return Vh.RoleTypes}});Ju(Jc(),C);Ju(Qc(),C);var Qu=Ku();Object.defineProperty(C,"Activity",{enumerable:!0,get:function(){return Qu.Activity}});Object.defineProperty(C,"activityZodSchema",{enumerable:!0,get:function(){return Qu.activityZodSchema}});var qh=Ji();Object.defineProperty(C,"ActivityEventNames",{enumerable:!0,get:function(){return qh.ActivityEventNames}});var zh=Qi();Object.defineProperty(C,"ActivityImportance",{enumerable:!0,get:function(){return zh.ActivityImportance}});var Fh=ea();Object.defineProperty(C,"ActivityTypes",{enumerable:!0,get:function(){return Fh.ActivityTypes}});var Gh=na();Object.defineProperty(C,"DeliveryModes",{enumerable:!0,get:function(){return Gh.DeliveryModes}});var $h=oa();Object.defineProperty(C,"InputHints",{enumerable:!0,get:function(){return $h.InputHints}});var Bh=ia();Object.defineProperty(C,"MessageReactionTypes",{enumerable:!0,get:function(){return Bh.MessageReactionTypes}});var Hh=sa();Object.defineProperty(C,"TextFormatTypes",{enumerable:!0,get:function(){return Hh.TextFormatTypes}});var Wh=Xu();Object.defineProperty(C,"ActivityTreatments",{enumerable:!0,get:function(){return Wh.ActivityTreatments}});var Kh=ua();Object.defineProperty(C,"ExceptionHelper",{enumerable:!0,get:function(){return Kh.ExceptionHelper}});var Yh=da();Object.defineProperty(C,"ActivityErrors",{enumerable:!0,get:function(){return Yh.Errors}})});var fr=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(fr||{});var pr=(x=>(x.Unknown="Unknown",x.Exp="Exp",x.Dev="Dev",x.Test="Test",x.Preprod="Preprod",x.FirstRelease="FirstRelease",x.Prod="Prod",x.Gov="Gov",x.High="High",x.DoD="DoD",x.Mooncake="Mooncake",x.Ex="Ex",x.Rx="Rx",x.Prv="Prv",x.Local="Local",x.GovFR="GovFR",x.Other="Other",x))(pr||{});var bo=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},xo=class extends bo{constructor(t){var i,a,s;if(super(),!t)return;let r=((i=t.cloud)==null?void 0:i.trim())||"Prod",n=((a=t.copilotAgentType)==null?void 0:a.trim())||"Published",o=((s=t.authority)==null?void 0:s.trim())||"https://login.microsoftonline.com";if(!Object.values(pr).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(pr).join(", ")}`);if(!Object.values(fr).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(fr).join(", ")}`);Object.assign(this,{...t,cloud:r,copilotAgentType:n,authority:o})}},gg=()=>{var e,t,r,n,o,i,a,s;return new xo({appClientId:(e=process.env.appClientId)!=null?e:"",tenantId:(t=process.env.tenantId)!=null?t:"",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:((a=process.env.useExperimentalEndpoint)==null?void 0:a.toLowerCase())==="true",enableDiagnostics:((s=process.env.enableDiagnostics)==null?void 0:s.toLowerCase())==="true"})};var Hr=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function To(e){}function Pa(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=To,onError:r=To,onRetry:n=To,onComment:o}=e,i="",a=!0,s,c="",d="";function f(y){let S=a?y.replace(/^\xEF\xBB\xBF/,""):y,[x,N]=Pd(`${i}${S}`);for(let O of x)g(O);i=N,a=!1}function g(y){if(y===""){I();return}if(y.startsWith(":")){o&&o(y.slice(y.startsWith(": ")?2:1));return}let S=y.indexOf(":");if(S!==-1){let x=y.slice(0,S),N=y[S+1]===" "?2:1,O=y.slice(S+N);_(x,O,y);return}_(y,"",y)}function _(y,S,x){switch(y){case"event":d=S;break;case"data":c=`${c}${S}
2
- `;break;case"id":s=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new Hr(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:x}));break;default:r(new Hr(`Unknown field "${y.length>20?`${y.slice(0,20)}\u2026`:y}"`,{type:"unknown-field",field:y,value:S,line:x}));break}}function I(){c.length>0&&t({id:s,event:d||void 0,data:c.endsWith(`
3
- `)?c.slice(0,-1):c}),s=void 0,c="",d=""}function P(y={}){i&&y.consume&&g(i),a=!0,s=void 0,c="",d="",i=""}return{feed:f,reset:P}}function Pd(e){let t=[],r="",n=0;for(;n<e.length;){let o=e.indexOf("\r",n),i=e.indexOf(`
1
+ var Id=Object.create;var Br=Object.defineProperty;var Ed=Object.getOwnPropertyDescriptor;var Sd=Object.getOwnPropertyNames;var Ad=Object.getPrototypeOf,wd=Object.prototype.hasOwnProperty;var E=(e,t)=>()=>(e&&(t=e(e=0)),t);var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Od=(e,t)=>{for(var r in t)Br(e,r,{get:t[r],enumerable:!0})},Pa=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sd(t))!wd.call(e,o)&&o!==r&&Br(e,o,{get:()=>t[o],enumerable:!(n=Ed(t,o))||n.enumerable});return e};var De=(e,t,r)=>(r=e!=null?Id(Ad(e)):{},Pa(t||!e||!e.__esModule?Br(r,"default",{value:e,enumerable:!0}):r,e)),Pd=e=>Pa(Br({},"__esModule",{value:!0}),e);var So=p(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isPromise=Eo;Kr.attempt=Ld;function Eo(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function Ld(e){var t;let r=!1;try{let n=e.try();return Eo(n)?(r=!0,n.catch(o=>{var i;if(!e.catch)throw o;let a=(i=e.catch)===null||i===void 0?void 0:i.call(e,o);if(Eo(a))return a.then(()=>{})}).finally(e.finally)):n}catch(n){if(!e.catch)throw n;e.catch(n);return}finally{!r&&((t=e.finally)===null||t===void 0||t.call(e))}}});var Yr=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.MetricNames=ye.SpanNames=ye.SpanCategories=ye.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES=void 0;ye.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES="AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES";ye.SpanCategories={STORAGE:["STORAGE_"],AUTHORIZATION:["AUTHORIZATION_","USER_TOKEN_CLIENT_"],AUTHENTICATION:["AUTHENTICATION_"],DIALOGS:["DIALOGS_"]};ye.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"};ye.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 ka=p((Ig,ja)=>{var Et=1e3,St=Et*60,At=St*60,Ye=At*24,Md=Ye*7,Vd=Ye*365.25;ja.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return qd(e);if(r==="number"&&isFinite(e))return t.long?Fd(e):zd(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function qd(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Vd;case"weeks":case"week":case"w":return r*Md;case"days":case"day":case"d":return r*Ye;case"hours":case"hour":case"hrs":case"hr":case"h":return r*At;case"minutes":case"minute":case"mins":case"min":case"m":return r*St;case"seconds":case"second":case"secs":case"sec":case"s":return r*Et;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function zd(e){var t=Math.abs(e);return t>=Ye?Math.round(e/Ye)+"d":t>=At?Math.round(e/At)+"h":t>=St?Math.round(e/St)+"m":t>=Et?Math.round(e/Et)+"s":e+"ms"}function Fd(e){var t=Math.abs(e);return t>=Ye?Xr(e,t,Ye,"day"):t>=At?Xr(e,t,At,"hour"):t>=St?Xr(e,t,St,"minute"):t>=Et?Xr(e,t,Et,"second"):e+" ms"}function Xr(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var Da=p((Eg,Ua)=>{function Gd(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=o,r.enabled=s,r.humanize=ka(),r.destroy=d,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function t(f){let g=0;for(let _=0;_<f.length;_++)g=(g<<5)-g+f.charCodeAt(_),g|=0;return r.colors[Math.abs(g)%r.colors.length]}r.selectColor=t;function r(f){let g,_=null,I,P;function y(...S){if(!y.enabled)return;let T=y,N=Number(new Date),O=N-(g||N);T.diff=O,T.prev=g,T.curr=N,g=N,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let k=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(L,Se)=>{if(L==="%%")return"%";k++;let ie=r.formatters[Se];if(typeof ie=="function"){let ur=S[k];L=ie.call(T,ur),S.splice(k,1),k--}return L}),r.formatArgs.call(T,S),(T.log||r.log).apply(T,S)}return y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(I!==r.namespaces&&(I=r.namespaces,P=r.enabled(f)),P),set:S=>{_=S}}),typeof r.init=="function"&&r.init(y),y}function n(f,g){let _=r(this.namespace+(typeof g=="undefined"?":":g)+f);return _.log=this.log,_}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let g=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of g)_[0]==="-"?r.skips.push(_.slice(1)):r.names.push(_)}function i(f,g){let _=0,I=0,P=-1,y=0;for(;_<f.length;)if(I<g.length&&(g[I]===f[_]||g[I]==="*"))g[I]==="*"?(P=I,y=_,I++):(_++,I++);else if(P!==-1)I=P+1,y++,_=y;else return!1;for(;I<g.length&&g[I]==="*";)I++;return I===g.length}function a(){let f=[...r.names,...r.skips.map(g=>"-"+g)].join(",");return r.enable(""),f}function s(f){for(let g of r.skips)if(i(f,g))return!1;for(let g of r.names)if(i(f,g))return!0;return!1}function c(f){return f instanceof Error?f.stack||f.message:f}function d(){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}Ua.exports=Gd});var Za=p((Q,Jr)=>{Q.formatArgs=Bd;Q.save=Hd;Q.load=Wd;Q.useColors=$d;Q.storage=Kd();Q.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();Q.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 $d(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Bd(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Jr.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}Q.log=console.debug||console.log||(()=>{});function Hd(e){try{e?Q.storage.setItem("debug",e):Q.storage.removeItem("debug")}catch{}}function Wd(){let e;try{e=Q.storage.getItem("debug")||Q.storage.getItem("DEBUG")}catch{}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function Kd(){try{return localStorage}catch{}}Jr.exports=Da()(Q);var{formatters:Yd}=Jr.exports;Yd.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Ao=p(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.isBrowser=void 0;Qr.isBrowser=typeof window!="undefined"&&typeof window.document!="undefined"});var La=p(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.levels=void 0;en.levels=["info","warn","error","debug"]});var wo=p(wt=>{"use strict";var Xd=wt&&wt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wt,"__esModule",{value:!0});wt.createDebugLogger=tl;wt.link=rl;var Jd=Xd(Za()),Qd=Ao(),el=La();function tl(e){return{info:tn(e,"info"),warn:tn(e,"warn"),error:tn(e,"error"),debug:tn(e,"debug")}}var Ma={node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}};function tn(e,t){let r=(0,Jd.default)(`${e}:${t}`);return Qd.isBrowser?r.color=Ma.browser[t]:r.color=Ma.node[t],r}function rl(e,...t){return el.levels.reduce((r,n)=>(r[n]=(o,...i)=>{if(e[n].enabled){e[n](o,...i);for(let a of t)a[n](o,...i)}},r),{})}});var Va=p(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.getSetting=ol;var nl=Ao();function ol(e){var t,r;if(nl.isBrowser)try{return(t=window.localStorage.getItem(e))!==null&&t!==void 0?t:""}catch{}else return(r=process.env[e])!==null&&r!==void 0?r:"";return""}});var za=p(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.isSpanDisabled=sl;var mr=Yr(),il=wo(),al=Va(),Po=(0,il.createDebugLogger)("agents:telemetry"),qa=(()=>{let e=(0,al.getSetting)(mr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES).trim().toUpperCase();if(!e)return[];let t=e.split(/[\s,]+/).map(i=>i.trim()).filter(Boolean),r=Object.entries(mr.SpanNames),n=new Set,o=[];for(let i of t){let a=mr.SpanCategories[i];if(!a){Po.warn(`Invalid span category "${i}" in ${mr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES}. Valid categories are: ${Object.keys(mr.SpanCategories).join(", ")}`);continue}for(let s of a)if(!n.has(s)){n.add(s);for(let[c,d]of r)c.startsWith(s)&&o.push(d)}}return o.length>0&&Po.debug("Disabled Span names:",o),o})();function sl(e){if(qa.length===0)return!1;let t=qa.includes(e);return Po.debug(`Span "${e}" disabled:`,t),t}});var No=p(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.noopTrace=void 0;Xe.noopMetric=cl;Xe.noopContext=Fa;var hr=()=>{};Xe.noopTrace=function(e,t){return Fa(t)};Xe.noopTrace.define=e=>e;function cl(){return{histogram:()=>({record:hr}),counter:()=>({add:hr})}}function Fa(e){let t=new Proxy({},{get:()=>hr}),r={record:hr,actions:t};return e?e(r):{record:r.record,actions:r.actions,end:hr,fail(o){return o}}}});var Ba=p(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.traceFactory=pl;var ul=So(),dl=za(),ll=Yr(),fl=No();function pl(e){let t=new Set(Object.values(ll.SpanNames)),r=e.trace.getTracer("@microsoft/agents-telemetry"),n=function(i,a){if(!i)throw new Error("Trace definition is required");if(!t.has(i.name))throw new Error(`Unrecognized span name "${i.name}". See SpanNames constants.`);if((0,dl.isSpanDisabled)(i.name))return(0,fl.noopContext)(a);let s=ml(i);if(!a){let c=r.startSpan(i.name),d=Ga(e,i,c,s);return{record:d.record,actions:d.actions,fail:d.fail,end:d.end}}return r.startActiveSpan(i.name,c=>{let d=Ga(e,i,c,s);return(0,ul.attempt)({try:()=>a({record:d.record,actions:d.actions}),catch:f=>{throw d.fail(f)},finally:d.end})})};return n.define=o=>o,n}function ml(e){let t=e.record?{...e.record}:{};return{set(r){Object.assign(t,r)},get(){return t}}}function Ga(e,t,r,n){var o,i;let a=performance.now(),s=!1,c;return{record:n.set,actions:(i=(o=t.actions)===null||o===void 0?void 0:o.call(t,{span:r}))!==null&&i!==void 0?i:{},fail(d){return c=d,d},end(){if(!(s||!e)){s=!0,c===void 0?r.setStatus({code:e.SpanStatusCode.OK}):$a(e,r,c);try{t.end({span:r,record:n.get(),duration:performance.now()-a,error:c})}catch(d){$a(e,r,d)}finally{r.end()}}}}}function $a(e,t,r){let n;r instanceof Error?(n=r.message,t.recordException(r)):(n=String(r),t.recordException({name:typeof r,message:n})),t.setStatus({code:e.SpanStatusCode.ERROR,message:n})}});var Ha=p(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.metricFactory=hl;function hl(e){let t=e.metrics.getMeter("@microsoft/agents-telemetry");return{histogram:t.createHistogram.bind(t),counter:t.createCounter.bind(t)}}});var Wa=p(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createOTelLogger=gl;function gl(e,t){return{info:rn(e,t,"info"),warn:rn(e,t,"warn"),error:rn(e,t,"error"),debug:rn(e,t,"debug")}}function rn(e,t,r){var n;let o=e.logs.getLogger(t),i=(n=r==null?void 0:r.toLowerCase())!==null&&n!==void 0?n:"debug",a={debug:e.SeverityNumber.DEBUG,info:e.SeverityNumber.INFO,warn:e.SeverityNumber.WARN,error:e.SeverityNumber.ERROR}[i];return function(c,...d){o.emit({severityNumber:a,severityText:i.toUpperCase(),body:yl(c,d),attributes:{"log.namespace":t,"log.level":i}})}}function yl(e,t){if(t.length===0)return e;let r=t.map(n=>vl(n)).join(" ");return`${e} ${r}`}function vl(e){if(e instanceof Error)return`${e.name}: ${e.message}`;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"||e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}});var Qa=p(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.index=xl;var _l=Ba(),bl=Ha(),on=wo(),Tl=Wa(),nn=So(),Ka=Yr(),Ya=No(),Xa=(0,on.createDebugLogger)("agents:telemetry");function xl(e){let t=(0,nn.attempt)({try:()=>e.otel(),catch:()=>Xa.warn("OpenTelemetry API not found. Install @opentelemetry/api as a dependency to enable tracing and metrics.")}),r=(0,nn.attempt)({try:()=>e.logs(),catch:()=>Xa.warn("OpenTelemetry API Logs not found. Install @opentelemetry/api-logs as a dependency to enable OTel logging.")});return(0,nn.isPromise)(t)||(0,nn.isPromise)(r)?Promise.all([t,r]).then(([n,o])=>Ja(n,o)):Ja(t,r)}function Ja(e,t){return{SpanNames:Ka.SpanNames,MetricNames:Ka.MetricNames,debug:t?r=>(0,on.link)((0,on.createDebugLogger)(r),(0,Tl.createOTelLogger)(t,r)):on.createDebugLogger,trace:e?(0,_l.traceFactory)(e):Ya.noopTrace,metric:e?(0,bl.metricFactory)(e):(0,Ya.noopMetric)()}}});var es,ts=E(()=>{es=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});var rs=E(()=>{ts()});var Ae,Zo=E(()=>{Ae="1.9.0"});function Cl(e){var t=new Set([e]),r=new Set,n=e.match(ns);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===e};function i(s){return r.add(s),!1}function a(s){return t.add(s),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;var d=c.match(ns);if(!d)return i(c);var f={major:+d[1],minor:+d[2],patch:+d[3],prerelease:d[4]};return f.prerelease!=null||o.major!==f.major?i(c):o.major===0?o.minor===f.minor&&o.patch<=f.patch?a(c):i(c):o.minor<=f.minor?a(c):i(c)}}var ns,os,is=E(()=>{Zo();ns=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;os=Cl(Ae)});function ve(e,t,r,n){var o;n===void 0&&(n=!1);var i=yr[gr]=(o=yr[gr])!==null&&o!==void 0?o:{version:Ae};if(!n&&i[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(i.version!==Ae){var a=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+Ae);return r.error(a.stack||a.message),!1}return i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+Ae+"."),!0}function ne(e){var t,r,n=(t=yr[gr])===null||t===void 0?void 0:t.version;if(!(!n||!os(n)))return(r=yr[gr])===null||r===void 0?void 0:r[e]}function _e(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+Ae+".");var r=yr[gr];r&&delete r[e]}var Il,gr,yr,Je=E(()=>{rs();Zo();is();Il=Ae.split(".")[0],gr=Symbol.for("opentelemetry.js.api."+Il),yr=es});function vr(e,t,r){var n=ne("diag");if(n)return r.unshift(t),n[e].apply(n,Sl([],El(r),!1))}var El,Sl,as,ss=E(()=>{Je();El=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Sl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},as=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("verbose",this._namespace,t)},e})()});var z,an=E(()=>{(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(z||(z={}))});function cs(e,t){e<z.NONE?e=z.NONE:e>z.ALL&&(e=z.ALL),t=t||{};function r(n,o){var i=t[n];return typeof i=="function"&&e>=o?i.bind(t):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 us=E(()=>{an()});var Al,wl,Ol,$,Qe=E(()=>{ss();us();an();Je();Al=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},wl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Ol="diag",$=(function(){function e(){function t(o){return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=ne("diag");if(s)return s[o].apply(s,wl([],Al(i),!1))}}var r=this,n=function(o,i){var a,s,c;if(i===void 0&&(i={logLevel:z.INFO}),o===r){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=d.stack)!==null&&a!==void 0?a:d.message),!1}typeof i=="number"&&(i={logLevel:i});var f=ne("diag"),g=cs((s=i.logLevel)!==null&&s!==void 0?s:z.INFO,o);if(f&&!i.suppressOverrideMessage){var _=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";f.warn("Current logger will be overwritten from "+_),g.warn("Current logger will overwrite one already registered from "+_)}return ve("diag",g,r,!0)};r.setLogger=n,r.disable=function(){_e(Ol,r)},r.createComponentLogger=function(o){return new as(o)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})()});var Pl,Rl,ds,ls=E(()=>{Pl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Rl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ds=(function(){function e(t){this._entries=t?new Map(t):new Map}return e.prototype.getEntry=function(t){var r=this._entries.get(t);if(r)return Object.assign({},r)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(t){var r=Pl(t,2),n=r[0],o=r[1];return[n,o]})},e.prototype.setEntry=function(t,r){var n=new e(this._entries);return n._entries.set(t,r),n},e.prototype.removeEntry=function(t){var r=new e(this._entries);return r._entries.delete(t),r},e.prototype.removeEntries=function(){for(var t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new e(this._entries);try{for(var a=Rl(n),s=a.next();!s.done;s=a.next()){var c=s.value;i._entries.delete(c)}}catch(d){t={error:d}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},e.prototype.clear=function(){return new e},e})()});var fs,ps=E(()=>{fs=Symbol("BaggageEntryMetadata")});function ms(e){return e===void 0&&(e={}),new ds(new Map(Object.entries(e)))}function hs(e){return typeof e!="string"&&(Nl.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:fs,toString:function(){return e}}}var Nl,Lo=E(()=>{Qe();ls();ps();Nl=$.instance()});function Ot(e){return Symbol.for(e)}var jl,sn,_r=E(()=>{jl=(function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new e(r._currentContext);return o._currentContext.delete(n),o}}return e})(),sn=new jl});var Mo,gs,ys=E(()=>{Mo=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],gs=(function(){function e(){function t(n){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(console){var a=console[n];if(typeof a!="function"&&(a=console.log),typeof a=="function")return a.apply(console,o)}}}for(var r=0;r<Mo.length;r++)this[Mo[r].n]=t(Mo[r].c)}return e})()});function vs(){return qo}var et,kl,cn,Ul,Dl,Zl,Ll,Vo,Ml,Vl,ql,qo,zl,Fl,Gl,$l,Bl,Hl,Wl,zo=E(()=>{et=(function(){var e=function(t,r){return e=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])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),kl=(function(){function e(){}return e.prototype.createGauge=function(t,r){return Fl},e.prototype.createHistogram=function(t,r){return Gl},e.prototype.createCounter=function(t,r){return zl},e.prototype.createUpDownCounter=function(t,r){return $l},e.prototype.createObservableGauge=function(t,r){return Hl},e.prototype.createObservableCounter=function(t,r){return Bl},e.prototype.createObservableUpDownCounter=function(t,r){return Wl},e.prototype.addBatchObservableCallback=function(t,r){},e.prototype.removeBatchObservableCallback=function(t){},e})(),cn=(function(){function e(){}return e})(),Ul=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})(cn),Dl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})(cn),Zl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})(cn),Ll=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})(cn),Vo=(function(){function e(){}return e.prototype.addCallback=function(t){},e.prototype.removeCallback=function(t){},e})(),Ml=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),Vl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),ql=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),qo=new kl,zl=new Ul,Fl=new Zl,Gl=new Ll,$l=new Dl,Bl=new Ml,Hl=new Vl,Wl=new ql});var un,_s=E(()=>{(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(un||(un={}))});var dn,ln,Fo=E(()=>{dn={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},ln={set:function(e,t,r){e!=null&&(e[t]=r)}}});var Kl,Yl,bs,Ts=E(()=>{_r();Kl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Yl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},bs=(function(){function e(){}return e.prototype.active=function(){return sn},e.prototype.with=function(t,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,Yl([n],Kl(o),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})()});var Xl,Jl,Go,Ql,Ze,br=E(()=>{Ts();Je();Qe();Xl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Jl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Go="context",Ql=new bs,Ze=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return ve(Go,t,$.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var o,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(o=this._getContextManager()).with.apply(o,Jl([t,r,n],Xl(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return ne(Go)||Ql},e.prototype.disable=function(){this._getContextManager().disable(),_e(Go,$.instance())},e})()});var Pt,$o=E(()=>{(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Pt||(Pt={}))});var Tr,xr,fn,pn=E(()=>{$o();Tr="0000000000000000",xr="00000000000000000000000000000000",fn={traceId:xr,spanId:Tr,traceFlags:Pt.NONE}});var Le,mn=E(()=>{pn();Le=(function(){function e(t){t===void 0&&(t=fn),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e})()});function hn(e){return e.getValue(Bo)||void 0}function xs(){return hn(Ze.getInstance().active())}function Cr(e,t){return e.setValue(Bo,t)}function Cs(e){return e.deleteValue(Bo)}function Is(e,t){return Cr(e,new Le(t))}function gn(e){var t;return(t=hn(e))===null||t===void 0?void 0:t.spanContext()}var Bo,Ho=E(()=>{_r();mn();br();Bo=Ot("OpenTelemetry Context Key SPAN")});function Wo(e){return ef.test(e)&&e!==xr}function Ko(e){return tf.test(e)&&e!==Tr}function Rt(e){return Wo(e.traceId)&&Ko(e.spanId)}function Es(e){return new Le(e)}var ef,tf,yn=E(()=>{pn();mn();ef=/^([0-9a-f]{32})$/i,tf=/^[0-9a-f]{16}$/i});function rf(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var Yo,vn,Xo=E(()=>{br();Ho();mn();yn();Yo=Ze.getInstance(),vn=(function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=Yo.active());var o=!!(r!=null&&r.root);if(o)return new Le;var i=n&&gn(n);return rf(i)&&Rt(i)?new Le(i):new Le},e.prototype.startActiveSpan=function(t,r,n,o){var i,a,s;if(!(arguments.length<2)){arguments.length===2?s=r:arguments.length===3?(i=r,s=n):(i=r,a=n,s=o);var c=a!=null?a:Yo.active(),d=this.startSpan(t,i,c),f=Cr(c,d);return Yo.with(f,s,void 0,d)}},e})()});var nf,_n,Jo=E(()=>{Xo();nf=new vn,_n=(function(){function e(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):nf},e})()});var Ss,As=E(()=>{Xo();Ss=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new vn},e})()});var of,Ir,Qo=E(()=>{Jo();As();of=new Ss,Ir=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new _n(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:of},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)},e})()});var bn,ws=E(()=>{(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(bn||(bn={}))});var Tn,Os=E(()=>{(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(Tn||(Tn={}))});var xn,Ps=E(()=>{(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(xn||(xn={}))});function Rs(e){return cf.test(e)}function Ns(e){return uf.test(e)&&!df.test(e)}var ei,af,sf,cf,uf,df,js=E(()=>{ei="[_0-9a-z-*/]",af="[a-z]"+ei+"{0,255}",sf="[a-z0-9]"+ei+"{0,240}@[a-z]"+ei+"{0,13}",cf=new RegExp("^(?:"+af+"|"+sf+")$"),uf=/^[ -~]{0,255}[!-~]$/,df=/,|=/});var ks,lf,Us,Ds,Zs,Ls=E(()=>{js();ks=32,lf=512,Us=",",Ds="=",Zs=(function(){function e(t){this._internalState=new Map,t&&this._parse(t)}return e.prototype.set=function(t,r){var n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n},e.prototype.unset=function(t){var r=this._clone();return r._internalState.delete(t),r},e.prototype.get=function(t){return this._internalState.get(t)},e.prototype.serialize=function(){var t=this;return this._keys().reduce(function(r,n){return r.push(n+Ds+t.get(n)),r},[]).join(Us)},e.prototype._parse=function(t){t.length>lf||(this._internalState=t.split(Us).reverse().reduce(function(r,n){var o=n.trim(),i=o.indexOf(Ds);if(i!==-1){var a=o.slice(0,i),s=o.slice(i+1,n.length);Rs(a)&&Ns(s)&&r.set(a,s)}return r},new Map),this._internalState.size>ks&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ks))))},e.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},e.prototype._clone=function(){var t=new e;return t._internalState=new Map(this._internalState),t},e})()});function Ms(e){return new Zs(e)}var Vs=E(()=>{Ls()});var ti,qs=E(()=>{br();ti=Ze.getInstance()});var ri,zs=E(()=>{Qe();ri=$.instance()});var ff,Fs,Gs=E(()=>{zo();ff=(function(){function e(){}return e.prototype.getMeter=function(t,r,n){return qo},e})(),Fs=new ff});var ni,$s,Bs=E(()=>{Gs();Je();Qe();ni="metrics",$s=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(t){return ve(ni,t,$.instance())},e.prototype.getMeterProvider=function(){return ne(ni)||Fs},e.prototype.getMeter=function(t,r,n){return this.getMeterProvider().getMeter(t,r,n)},e.prototype.disable=function(){_e(ni,$.instance())},e})()});var oi,Hs=E(()=>{Bs();oi=$s.getInstance()});var Ws,Ks=E(()=>{Ws=(function(){function e(){}return e.prototype.inject=function(t,r){},e.prototype.extract=function(t,r){return t},e.prototype.fields=function(){return[]},e})()});function ai(e){return e.getValue(ii)||void 0}function Ys(){return ai(Ze.getInstance().active())}function Xs(e,t){return e.setValue(ii,t)}function Js(e){return e.deleteValue(ii)}var ii,Qs=E(()=>{br();_r();ii=Ot("OpenTelemetry Baggage Key")});var si,pf,ec,tc=E(()=>{Je();Ks();Fo();Qs();Lo();Qe();si="propagation",pf=new Ws,ec=(function(){function e(){this.createBaggage=ms,this.getBaggage=ai,this.getActiveBaggage=Ys,this.setBaggage=Xs,this.deleteBaggage=Js}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(t){return ve(si,t,$.instance())},e.prototype.inject=function(t,r,n){return n===void 0&&(n=ln),this._getGlobalPropagator().inject(t,r,n)},e.prototype.extract=function(t,r,n){return n===void 0&&(n=dn),this._getGlobalPropagator().extract(t,r,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){_e(si,$.instance())},e.prototype._getGlobalPropagator=function(){return ne(si)||pf},e})()});var ci,rc=E(()=>{tc();ci=ec.getInstance()});var ui,nc,oc=E(()=>{Je();Qo();yn();Ho();Qe();ui="trace",nc=(function(){function e(){this._proxyTracerProvider=new Ir,this.wrapSpanContext=Es,this.isSpanContextValid=Rt,this.deleteSpan=Cs,this.getSpan=hn,this.getActiveSpan=xs,this.getSpanContext=gn,this.setSpan=Cr,this.setSpanContext=Is}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=ve(ui,this._proxyTracerProvider,$.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return ne(ui)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){_e(ui,$.instance()),this._proxyTracerProvider=new Ir},e})()});var di,ic=E(()=>{oc();di=nc.getInstance()});var ac={};Od(ac,{DiagConsoleLogger:()=>gs,DiagLogLevel:()=>z,INVALID_SPANID:()=>Tr,INVALID_SPAN_CONTEXT:()=>fn,INVALID_TRACEID:()=>xr,ProxyTracer:()=>_n,ProxyTracerProvider:()=>Ir,ROOT_CONTEXT:()=>sn,SamplingDecision:()=>bn,SpanKind:()=>Tn,SpanStatusCode:()=>xn,TraceFlags:()=>Pt,ValueType:()=>un,baggageEntryMetadataFromString:()=>hs,context:()=>ti,createContextKey:()=>Ot,createNoopMeter:()=>vs,createTraceState:()=>Ms,default:()=>mf,defaultTextMapGetter:()=>dn,defaultTextMapSetter:()=>ln,diag:()=>ri,isSpanContextValid:()=>Rt,isValidSpanId:()=>Ko,isValidTraceId:()=>Wo,metrics:()=>oi,propagation:()=>ci,trace:()=>di});var mf,sc=E(()=>{Lo();_r();ys();an();zo();_s();Fo();Jo();Qo();ws();Os();Ps();$o();Vs();yn();pn();qs();zs();Hs();rc();ic();mf={context:ti,diag:ri,metrics:oi,propagation:ci,trace:di}});var cc=p(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.SeverityNumber=void 0;var hf;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(hf=Er.SeverityNumber||(Er.SeverityNumber={}))});var In=p(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.NOOP_LOGGER=Nt.NoopLogger=void 0;var Cn=class{emit(t){}};Nt.NoopLogger=Cn;Nt.NOOP_LOGGER=new Cn});var uc=p(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.API_BACKWARDS_COMPATIBILITY_VERSION=be.makeGetter=be._global=be.GLOBAL_LOGS_API_KEY=void 0;be.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");be._global=globalThis;function gf(e,t,r){return n=>n===e?t:r}be.makeGetter=gf;be.API_BACKWARDS_COMPATIBILITY_VERSION=1});var li=p(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.NOOP_LOGGER_PROVIDER=jt.NoopLoggerProvider=void 0;var yf=In(),En=class{getLogger(t,r,n){return new yf.NoopLogger}};jt.NoopLoggerProvider=En;jt.NOOP_LOGGER_PROVIDER=new En});var dc=p(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ProxyLogger=void 0;var vf=In(),fi=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):vf.NOOP_LOGGER}};Sn.ProxyLogger=fi});var lc=p(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.ProxyLoggerProvider=void 0;var _f=li(),bf=dc(),pi=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new bf.ProxyLogger(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:_f.NOOP_LOGGER_PROVIDER}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};An.ProxyLoggerProvider=pi});var pc=p(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.LogsAPI=void 0;var ae=uc(),Tf=li(),fc=lc(),mi=class e{constructor(){this._proxyLoggerProvider=new fc.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return ae._global[ae.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ae._global[ae.GLOBAL_LOGS_API_KEY]=(0,ae.makeGetter)(ae.API_BACKWARDS_COMPATIBILITY_VERSION,t,Tf.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=ae._global[ae.GLOBAL_LOGS_API_KEY])===null||t===void 0?void 0:t.call(ae._global,ae.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete ae._global[ae.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new fc.ProxyLoggerProvider}};wn.LogsAPI=mi});var hc=p(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.logs=Te.NoopLogger=Te.NOOP_LOGGER=Te.SeverityNumber=void 0;var xf=cc();Object.defineProperty(Te,"SeverityNumber",{enumerable:!0,get:function(){return xf.SeverityNumber}});var mc=In();Object.defineProperty(Te,"NOOP_LOGGER",{enumerable:!0,get:function(){return mc.NOOP_LOGGER}});Object.defineProperty(Te,"NoopLogger",{enumerable:!0,get:function(){return mc.NoopLogger}});var Cf=pc();Te.logs=Cf.LogsAPI.getInstance()});var Ut=p(se=>{"use strict";var kt;Object.defineProperty(se,"__esModule",{value:!0});se.metric=se.trace=se.debug=se.MetricNames=se.SpanNames=void 0;var If=Qa();kt=(0,If.index)({otel:()=>(sc(),Pd(ac)),logs:()=>hc()}),se.SpanNames=kt.SpanNames,se.MetricNames=kt.MetricNames,se.debug=kt.debug,se.trace=kt.trace,se.metric=kt.metric});var wr=p(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getParsedType=U.ZodParsedType=U.objectUtil=U.util=void 0;var hi;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.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(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(hi||(U.util=hi={}));var bc;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bc||(U.objectUtil=bc={}));U.ZodParsedType=hi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var wf=e=>{switch(typeof e){case"undefined":return U.ZodParsedType.undefined;case"string":return U.ZodParsedType.string;case"number":return Number.isNaN(e)?U.ZodParsedType.nan:U.ZodParsedType.number;case"boolean":return U.ZodParsedType.boolean;case"function":return U.ZodParsedType.function;case"bigint":return U.ZodParsedType.bigint;case"symbol":return U.ZodParsedType.symbol;case"object":return Array.isArray(e)?U.ZodParsedType.array:e===null?U.ZodParsedType.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?U.ZodParsedType.promise:typeof Map!="undefined"&&e instanceof Map?U.ZodParsedType.map:typeof Set!="undefined"&&e instanceof Set?U.ZodParsedType.set:typeof Date!="undefined"&&e instanceof Date?U.ZodParsedType.date:U.ZodParsedType.object;default:return U.ZodParsedType.unknown}};U.getParsedType=wf});var Nn=p(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.ZodError=Me.quotelessJson=Me.ZodIssueCode=void 0;var Tc=wr();Me.ZodIssueCode=Tc.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 Of=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");Me.quotelessJson=Of;var Or=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let d=a.path[c];c===a.path.length-1?(s[d]=s[d]||{_errors:[]},s[d]._errors.push(r(a))):s[d]=s[d]||{_errors:[]},s=s[d],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Tc.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=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(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Me.ZodError=Or;Or.create=e=>new Or(e)});var yi=p(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var B=Nn(),tt=wr(),Pf=(e,t)=>{let r;switch(e.code){case B.ZodIssueCode.invalid_type:e.received===tt.ZodParsedType.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case B.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.util.jsonStringifyReplacer)}`;break;case B.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${tt.util.joinValues(e.keys,", ")}`;break;case B.ZodIssueCode.invalid_union:r="Invalid input";break;case B.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${tt.util.joinValues(e.options)}`;break;case B.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${tt.util.joinValues(e.options)}, received '${e.received}'`;break;case B.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case B.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case B.ZodIssueCode.invalid_date:r="Invalid date";break;case B.ZodIssueCode.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:tt.util.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case B.ZodIssueCode.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case B.ZodIssueCode.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case B.ZodIssueCode.custom:r="Invalid input";break;case B.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case B.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case B.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,tt.util.assertNever(e)}return{message:r}};gi.default=Pf});var jn=p(Ve=>{"use strict";var Rf=Ve&&Ve.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.defaultErrorMap=void 0;Ve.setErrorMap=Nf;Ve.getErrorMap=jf;var xc=Rf(yi());Ve.defaultErrorMap=xc.default;var Cc=xc.default;function Nf(e){Cc=e}function jf(){return Cc}});var _i=p(j=>{"use strict";var kf=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});j.isAsync=j.isValid=j.isDirty=j.isAborted=j.OK=j.DIRTY=j.INVALID=j.ParseStatus=j.EMPTY_PATH=j.makeIssue=void 0;j.addIssueToContext=Zf;var Uf=jn(),Ic=kf(yi()),Df=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(d=>!!d).slice().reverse();for(let d of c)s=d(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};j.makeIssue=Df;j.EMPTY_PATH=[];function Zf(e,t){let r=(0,Uf.getErrorMap)(),n=(0,j.makeIssue)({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ic.default?void 0:Ic.default].filter(o=>!!o)});e.common.issues.push(n)}var vi=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return j.INVALID;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return j.INVALID;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value!="undefined"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}};j.ParseStatus=vi;j.INVALID=Object.freeze({status:"aborted"});var Lf=e=>({status:"dirty",value:e});j.DIRTY=Lf;var Mf=e=>({status:"valid",value:e});j.OK=Mf;var Vf=e=>e.status==="aborted";j.isAborted=Vf;var qf=e=>e.status==="dirty";j.isDirty=qf;var zf=e=>e.status==="valid";j.isValid=zf;var Ff=e=>typeof Promise!="undefined"&&e instanceof Promise;j.isAsync=Ff});var Sc=p(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0})});var wc=p(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.errorUtil=void 0;var Ac;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ac||(kn.errorUtil=Ac={}))});var Vc=p(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=jc;u.custom=Uc;var m=Nn(),Un=jn(),v=wc(),l=_i(),h=wr(),ue=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,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}},Oc=(e,t)=>{if((0,l.isValid)(t))return{success:!0,data:t.value};if(!e.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 m.ZodError(e.common.issues);return this._error=r,this._error}}};function A(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{var d,f;let{message:c}=e;return a.code==="invalid_enum_value"?{message:c!=null?c:s.defaultError}:typeof s.data=="undefined"?{message:(d=c!=null?c:n)!=null?d:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(f=c!=null?c:r)!=null?f:s.defaultError}},description:o}}var w=class{get description(){return this._def.description}_getType(t){return(0,h.getParsedType)(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:(0,h.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new l.ParseStatus,ctx:{common:t.parent.common,data:t.data,parsedType:(0,h.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if((0,l.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,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:t,parsedType:(0,h.getParsedType)(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Oc(n,o)}"~validate"(t){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:(0,h.getParsedType)(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:r});return(0,l.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:t,path:[],parent:r}).then(i=>(0,l.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,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:t,parsedType:(0,h.getParsedType)(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await((0,l.isAsync)(o)?o:Promise.resolve(o));return Oc(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:m.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new oe({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 ce.create(this,this._def)}nullable(){return Ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pe.create(this)}promise(){return Fe.create(this,this._def)}or(t){return ct.create([this,t],this._def)}and(t){return ut.create(this,t,this._def)}transform(t){return new oe({...A(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new mt({...A(this._def),innerType:this,defaultValue:r,typeName:x.ZodDefault})}brand(){return new Pr({typeName:x.ZodBranded,type:this,...A(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ht({...A(this._def),innerType:this,catchValue:r,typeName:x.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Rr.create(this,t)}readonly(){return gt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u.ZodType=w;u.Schema=w;u.ZodSchema=w;var Gf=/^c[^\s-]{8,}$/i,$f=/^[0-9a-z]+$/,Bf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hf=/^[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,Wf=/^[a-z0-9_-]{21}$/i,Kf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yf=/^[-+]?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)?)??$/,Xf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bi,Qf=/^(?:(?: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])$/,ep=/^(?:(?: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])$/,tp=/^(([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]))$/,rp=/^(([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])$/,np=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,op=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rc="((\\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])))",ip=new RegExp(`^${Rc}$`);function Nc(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ap(e){return new RegExp(`^${Nc(e)}$`)}function jc(e){let t=`${Rc}T${Nc(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function sp(e,t){return!!((t==="v4"||!t)&&Qf.test(e)||(t==="v6"||!t)&&tp.test(e))}function cp(e,t){if(!Kf.test(e))return!1;try{let[r]=e.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||t&&o.alg!==t)}catch{return!1}}function up(e,t){return!!((t==="v4"||!t)&&ep.test(e)||(t==="v6"||!t)&&rp.test(e))}var qe=class e extends w{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),l.INVALID}let n=new l.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Xf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"email",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")bi||(bi=new RegExp(Jf,"u")),bi.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"emoji",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Hf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"uuid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Wf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"nanoid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Gf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cuid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")$f.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cuid2",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Bf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"ulid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"url",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"regex",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?jc(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?ip.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ap(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Yf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"duration",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?sp(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"ip",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?cp(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"jwt",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?up(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cidr",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?np.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"base64",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?op.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"base64url",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:m.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...v.errorUtil.errToObj(t)})}url(t){return this._addCheck({kind:"url",...v.errorUtil.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!=null?r:!1,local:(n=t==null?void 0:t.local)!=null?n:!1,...v.errorUtil.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,...v.errorUtil.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...v.errorUtil.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...v.errorUtil.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...v.errorUtil.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...v.errorUtil.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...v.errorUtil.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...v.errorUtil.errToObj(r)})}nonempty(t){return this.min(1,v.errorUtil.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};u.ZodString=qe;qe.create=e=>{var t;return new qe({checks:[],typeName:x.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1,...A(e)})};function dp(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var rt=class e extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),l.INVALID}let n,o=new l.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?dp(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,v.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,v.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,v.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,v.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:v.errorUtil.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:v.errorUtil.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:v.errorUtil.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&h.util.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};u.ZodNumber=rt;rt.create=e=>new rt({checks:[],typeName:x.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...A(e)});var nt=class e extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==h.ZodParsedType.bigint)return this._getInvalidInput(t);let n,o=new l.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),l.INVALID}gte(t,r){return this.setLimit("min",t,!0,v.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,v.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,v.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,v.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:v.errorUtil.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};u.ZodBigInt=nt;nt.create=e=>{var t;return new nt({checks:[],typeName:x.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1,...A(e)})};var ot=class extends w{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodBoolean=ot;ot.create=e=>new ot({typeName:x.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...A(e)});var it=class e extends w{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),l.INVALID}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_date}),l.INVALID}let n=new l.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:v.errorUtil.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};u.ZodDate=it;it.create=e=>new it({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:x.ZodDate,...A(e)});var Lt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodSymbol=Lt;Lt.create=e=>new Lt({typeName:x.ZodSymbol,...A(e)});var at=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodUndefined=at;at.create=e=>new at({typeName:x.ZodUndefined,...A(e)});var st=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodNull=st;st.create=e=>new st({typeName:x.ZodNull,...A(e)});var ze=class extends w{constructor(){super(...arguments),this._any=!0}_parse(t){return(0,l.OK)(t.data)}};u.ZodAny=ze;ze.create=e=>new ze({typeName:x.ZodAny,...A(e)});var Oe=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(t){return(0,l.OK)(t.data)}};u.ZodUnknown=Oe;Oe.create=e=>new Oe({typeName:x.ZodUnknown,...A(e)});var fe=class extends w{_parse(t){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),l.INVALID}};u.ZodNever=fe;fe.create=e=>new fe({typeName:x.ZodNever,...A(e)});var Mt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodVoid=Mt;Mt.create=e=>new Mt({typeName:x.ZodVoid,...A(e)});var Pe=class e extends w{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),l.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,l.addIssueToContext)(r,{code:a?m.ZodIssueCode.too_big:m.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?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,l.addIssueToContext)(r,{code:m.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,l.addIssueToContext)(r,{code:m.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((a,s)=>o.type._parseAsync(new ue(r,a,r.path,s)))).then(a=>l.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new ue(r,a,r.path,s)));return l.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:v.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:v.errorUtil.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:v.errorUtil.toString(r)}})}nonempty(t){return this.min(1,t)}};u.ZodArray=Pe;Pe.create=(e,t)=>new Pe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...A(t)});function Zt(e){if(e instanceof ee){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ce.create(Zt(n))}return new ee({...e._def,shape:()=>t})}else return e instanceof Pe?new Pe({...e._def,type:Zt(e.element)}):e instanceof ce?ce.create(Zt(e.unwrap())):e instanceof Ce?Ce.create(Zt(e.unwrap())):e instanceof xe?xe.create(e.items.map(t=>Zt(t))):e}var ee=class e extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=h.util.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==h.ZodParsedType.object){let d=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(d,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:d.parsedType}),l.INVALID}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof fe&&this._def.unknownKeys==="strip"))for(let d in o.data)a.includes(d)||s.push(d);let c=[];for(let d of a){let f=i[d],g=o.data[d];c.push({key:{status:"valid",value:d},value:f._parse(new ue(o,g,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof fe){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of s)c.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")s.length>0&&((0,l.addIssueToContext)(o,{code:m.ZodIssueCode.unrecognized_keys,keys:s}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of s){let g=o.data[f];c.push({key:{status:"valid",value:f},value:d._parse(new ue(o,g,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of c){let g=await f.key,_=await f.value;d.push({key:g,value:_,alwaysSet:f.alwaysSet})}return d}).then(d=>l.ParseStatus.mergeObjectSync(n,d)):l.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return v.errorUtil.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var i,a,s,c;let o=(s=(a=(i=this._def).errorMap)==null?void 0:a.call(i,r,n).message)!=null?s:n.defaultError;return r.code==="unrecognized_keys"?{message:(c=v.errorUtil.errToObj(t).message)!=null?c:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:x.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of h.util.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of h.util.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Zt(this)}partial(t){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of h.util.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ce;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return kc(h.util.objectKeys(this.shape))}};u.ZodObject=ee;ee.create=(e,t)=>new ee({shape:()=>e,unknownKeys:"strip",catchall:fe.create(),typeName:x.ZodObject,...A(t)});ee.strictCreate=(e,t)=>new ee({shape:()=>e,unknownKeys:"strict",catchall:fe.create(),typeName:x.ZodObject,...A(t)});ee.lazycreate=(e,t)=>new ee({shape:e,unknownKeys:"strip",catchall:fe.create(),typeName:x.ZodObject,...A(t)});var ct=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new m.ZodError(s.ctx.common.issues));return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union,unionErrors:a}),l.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new m.ZodError(c));return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union,unionErrors:s}),l.INVALID}}get options(){return this._def.options}};u.ZodUnion=ct;ct.create=(e,t)=>new ct({options:e,typeName:x.ZodUnion,...A(t)});var we=e=>e instanceof dt?we(e.schema):e instanceof oe?we(e.innerType()):e instanceof lt?[e.value]:e instanceof ft?e.options:e instanceof pt?h.util.objectValues(e.enum):e instanceof mt?we(e._def.innerType):e instanceof at?[void 0]:e instanceof st?[null]:e instanceof ce?[void 0,...we(e.unwrap())]:e instanceof Ce?[null,...we(e.unwrap())]:e instanceof Pr||e instanceof gt?we(e.unwrap()):e instanceof ht?we(e._def.innerType):[],Dn=class e extends w{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.object)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),l.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,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),l.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=we(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:x.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...A(n)})}};u.ZodDiscriminatedUnion=Dn;function Ti(e,t){let r=(0,h.getParsedType)(e),n=(0,h.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(t),i=h.util.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Ti(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=Ti(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ut=class extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if((0,l.isAborted)(i)||(0,l.isAborted)(a))return l.INVALID;let s=Ti(i.value,a.value);return s.valid?(((0,l.isDirty)(i)||(0,l.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_intersection_types}),l.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,a])=>o(i,a)):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=ut;ut.create=(e,t,r)=>new ut({left:e,right:t,typeName:x.ZodIntersection,...A(r)});var xe=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.array)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),l.INVALID;if(n.data.length<this._def.items.length)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new ue(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>l.ParseStatus.mergeArray(r,a)):l.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};u.ZodTuple=xe;xe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:e,typeName:x.ZodTuple,rest:null,...A(t)})};var Zn=class e extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.object)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),l.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new ue(n,s,n.path,s)),value:a._parse(new ue(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?l.ParseStatus.mergeObjectAsync(r,o):l.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof w?new e({keyType:t,valueType:r,typeName:x.ZodRecord,...A(n)}):new e({keyType:qe.create(),valueType:t,typeName:x.ZodRecord,...A(r)})}};u.ZodRecord=Zn;var Vt=class extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.map)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),l.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],d)=>({key:o._parse(new ue(n,s,n.path,[d,"key"])),value:i._parse(new ue(n,c,n.path,[d,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let d=await c.key,f=await c.value;if(d.status==="aborted"||f.status==="aborted")return l.INVALID;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let d=c.key,f=c.value;if(d.status==="aborted"||f.status==="aborted")return l.INVALID;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}}}};u.ZodMap=Vt;Vt.create=(e,t,r)=>new Vt({valueType:t,keyType:e,typeName:x.ZodMap,...A(r)});var qt=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.set)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),l.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,l.addIssueToContext)(n,{code:m.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,l.addIssueToContext)(n,{code:m.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 a(c){let d=new Set;for(let f of c){if(f.status==="aborted")return l.INVALID;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let s=[...n.data.values()].map((c,d)=>i._parse(new ue(n,c,n.path,d)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:v.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:v.errorUtil.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};u.ZodSet=qt;qt.create=(e,t)=>new qt({valueType:e,minSize:null,maxSize:null,typeName:x.ZodSet,...A(t)});var Ln=class e extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.function)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),l.INVALID;function n(s,c){return(0,l.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Un.getErrorMap)(),Un.defaultErrorMap].filter(d=>!!d),issueData:{code:m.ZodIssueCode.invalid_arguments,argumentsError:c}})}function o(s,c){return(0,l.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Un.getErrorMap)(),Un.defaultErrorMap].filter(d=>!!d),issueData:{code:m.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Fe){let s=this;return(0,l.OK)(async function(...c){let d=new m.ZodError([]),f=await s._def.args.parseAsync(c,i).catch(I=>{throw d.addIssue(n(c,I)),d}),g=await Reflect.apply(a,this,f);return await s._def.returns._def.type.parseAsync(g,i).catch(I=>{throw d.addIssue(o(g,I)),d})})}else{let s=this;return(0,l.OK)(function(...c){let d=s._def.args.safeParse(c,i);if(!d.success)throw new m.ZodError([n(c,d.error)]);let f=Reflect.apply(a,this,d.data),g=s._def.returns.safeParse(f,i);if(!g.success)throw new m.ZodError([o(f,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:xe.create(t).rest(Oe.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||xe.create([]).rest(Oe.create()),returns:r||Oe.create(),typeName:x.ZodFunction,...A(n)})}};u.ZodFunction=Ln;var dt=class extends w{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};u.ZodLazy=dt;dt.create=(e,t)=>new dt({getter:e,typeName:x.ZodLazy,...A(t)});var lt=class extends w{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{received:r.data,code:m.ZodIssueCode.invalid_literal,expected:this._def.value}),l.INVALID}return{status:"valid",value:t.data}}get value(){return this._def.value}};u.ZodLiteral=lt;lt.create=(e,t)=>new lt({value:e,typeName:x.ZodLiteral,...A(t)});function kc(e,t){return new ft({values:e,typeName:x.ZodEnum,...A(t)})}var ft=class e extends w{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,l.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:m.ZodIssueCode.invalid_type}),l.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,l.addIssueToContext)(r,{received:r.data,code:m.ZodIssueCode.invalid_enum_value,options:n}),l.INVALID}return(0,l.OK)(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};u.ZodEnum=ft;ft.create=kc;var pt=class extends w{_parse(t){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,l.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:m.ZodIssueCode.invalid_type}),l.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=h.util.objectValues(r);return(0,l.addIssueToContext)(n,{received:n.data,code:m.ZodIssueCode.invalid_enum_value,options:o}),l.INVALID}return(0,l.OK)(t.data)}get enum(){return this._def.values}};u.ZodNativeEnum=pt;pt.create=(e,t)=>new pt({values:e,typeName:x.ZodNativeEnum,...A(t)});var Fe=class extends w{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),l.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,l.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};u.ZodPromise=Fe;Fe.create=(e,t)=>new Fe({type:e,typeName:x.ZodPromise,...A(t)});var oe=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{(0,l.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return l.INVALID;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?l.INVALID:c.status==="dirty"||r.value==="dirty"?(0,l.DIRTY)(c.value):c});{if(r.value==="aborted")return l.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:s.status==="dirty"||r.value==="dirty"?(0,l.DIRTY)(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?l.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,l.isValid)(a))return l.INVALID;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,l.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):l.INVALID);h.util.assertNever(o)}};u.ZodEffects=oe;u.ZodTransformer=oe;oe.create=(e,t,r)=>new oe({schema:e,typeName:x.ZodEffects,effect:t,...A(r)});oe.createWithPreprocess=(e,t,r)=>new oe({schema:t,effect:{type:"preprocess",transform:e},typeName:x.ZodEffects,...A(r)});var ce=class extends w{_parse(t){return this._getType(t)===h.ZodParsedType.undefined?(0,l.OK)(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};u.ZodOptional=ce;ce.create=(e,t)=>new ce({innerType:e,typeName:x.ZodOptional,...A(t)});var Ce=class extends w{_parse(t){return this._getType(t)===h.ZodParsedType.null?(0,l.OK)(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};u.ZodNullable=Ce;Ce.create=(e,t)=>new Ce({innerType:e,typeName:x.ZodNullable,...A(t)});var mt=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===h.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};u.ZodDefault=mt;mt.create=(e,t)=>new mt({innerType:e,typeName:x.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...A(t)});var ht=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,l.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new m.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new m.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};u.ZodCatch=ht;ht.create=(e,t)=>new ht({innerType:e,typeName:x.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...A(t)});var zt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),l.INVALID}return{status:"valid",value:t.data}}};u.ZodNaN=zt;zt.create=e=>new zt({typeName:x.ZodNaN,...A(e)});u.BRAND=Symbol("zod_brand");var Pr=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};u.ZodBranded=Pr;var Rr=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);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"?l.INVALID:i.status==="dirty"?(r.dirty(),(0,l.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"?l.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(t,r){return new e({in:t,out:r,typeName:x.ZodPipeline})}};u.ZodPipeline=Rr;var gt=class extends w{_parse(t){let r=this._def.innerType._parse(t),n=o=>((0,l.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,l.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};u.ZodReadonly=gt;gt.create=(e,t)=>new gt({innerType:e,typeName:x.ZodReadonly,...A(t)});function Pc(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Uc(e,t={},r){return e?ze.create().superRefine((n,o)=>{var a,s;let i=e(n);if(i instanceof Promise)return i.then(c=>{var d,f;if(!c){let g=Pc(t,n),_=(f=(d=g.fatal)!=null?d:r)!=null?f:!0;o.addIssue({code:"custom",...g,fatal:_})}});if(!i){let c=Pc(t,n),d=(s=(a=c.fatal)!=null?a:r)!=null?s:!0;o.addIssue({code:"custom",...c,fatal:d})}}):ze.create()}u.late={object:ee.lazycreate};var x;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(x||(u.ZodFirstPartyTypeKind=x={}));var lp=(e,t={message:`Input not instance of ${e.name}`})=>Uc(r=>r instanceof e,t);u.instanceof=lp;var Dc=qe.create;u.string=Dc;var Zc=rt.create;u.number=Zc;var fp=zt.create;u.nan=fp;var pp=nt.create;u.bigint=pp;var Lc=ot.create;u.boolean=Lc;var mp=it.create;u.date=mp;var hp=Lt.create;u.symbol=hp;var gp=at.create;u.undefined=gp;var yp=st.create;u.null=yp;var vp=ze.create;u.any=vp;var _p=Oe.create;u.unknown=_p;var bp=fe.create;u.never=bp;var Tp=Mt.create;u.void=Tp;var xp=Pe.create;u.array=xp;var Cp=ee.create;u.object=Cp;var Ip=ee.strictCreate;u.strictObject=Ip;var Ep=ct.create;u.union=Ep;var Sp=Dn.create;u.discriminatedUnion=Sp;var Ap=ut.create;u.intersection=Ap;var wp=xe.create;u.tuple=wp;var Op=Zn.create;u.record=Op;var Pp=Vt.create;u.map=Pp;var Rp=qt.create;u.set=Rp;var Np=Ln.create;u.function=Np;var jp=dt.create;u.lazy=jp;var kp=lt.create;u.literal=kp;var Up=ft.create;u.enum=Up;var Dp=pt.create;u.nativeEnum=Dp;var Zp=Fe.create;u.promise=Zp;var Mc=oe.create;u.effect=Mc;u.transformer=Mc;var Lp=ce.create;u.optional=Lp;var Mp=Ce.create;u.nullable=Mp;var Vp=oe.createWithPreprocess;u.preprocess=Vp;var qp=Rr.create;u.pipeline=qp;var zp=()=>Dc().optional();u.ostring=zp;var Fp=()=>Zc().optional();u.onumber=Fp;var Gp=()=>Lc().optional();u.oboolean=Gp;u.coerce={string:(e=>qe.create({...e,coerce:!0})),number:(e=>rt.create({...e,coerce:!0})),boolean:(e=>ot.create({...e,coerce:!0})),bigint:(e=>nt.create({...e,coerce:!0})),date:(e=>it.create({...e,coerce:!0}))};u.NEVER=l.INVALID});var xi=p(de=>{"use strict";var $p=de&&de.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ft=de&&de.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&$p(t,e,r)};Object.defineProperty(de,"__esModule",{value:!0});Ft(jn(),de);Ft(_i(),de);Ft(Sc(),de);Ft(wr(),de);Ft(Vc(),de);Ft(Nn(),de)});var D=p(te=>{"use strict";var qc=te&&te.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Bp=te&&te.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Hp=te&&te.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qc(t,e,r);return Bp(t,e),t},Wp=te&&te.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&qc(t,e,r)};Object.defineProperty(te,"__esModule",{value:!0});te.z=void 0;var zc=Hp(xi());te.z=zc;Wp(xi(),te);te.default=zc});var Ci=p(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.actionTypesZodSchema=Gt.ActionTypes=void 0;var Kp=D(),Fc;(function(e){e.OpenUrl="openUrl",e.ImBack="imBack",e.PostBack="postBack",e.PlayAudio="playAudio",e.PlayVideo="playVideo",e.ShowImage="showImage",e.DownloadFile="downloadFile",e.Signin="signin",e.Call="call",e.MessageBack="messageBack",e.OpenApp="openApp"})(Fc||(Gt.ActionTypes=Fc={}));Gt.actionTypesZodSchema=Kp.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var Ii=p($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.semanticActionStateTypesZodSchema=$t.SemanticActionStateTypes=void 0;var Yp=D(),Gc;(function(e){e.Start="start",e.Continue="continue",e.Done="done"})(Gc||($t.SemanticActionStateTypes=Gc={}));$t.semanticActionStateTypesZodSchema=Yp.z.enum(["start","continue","done"])});var Ei=p(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.attachmentLayoutTypesZodSchema=Bt.AttachmentLayoutTypes=void 0;var Xp=D(),$c;(function(e){e.List="list",e.Carousel="carousel"})($c||(Bt.AttachmentLayoutTypes=$c={}));Bt.attachmentLayoutTypesZodSchema=Xp.z.enum(["list","carousel"])});var Si=p(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.Channels=void 0;var Bc;(function(e){e.Agents="agents",e.Alexa="alexa",e.Console="console",e.Directline="directline",e.DirectlineSpeech="directlinespeech",e.Email="email",e.Emulator="emulator",e.Facebook="facebook",e.Groupme="groupme",e.Line="line",e.Msteams="msteams",e.M365CopilotSubChannel="COPILOT",e.M365Copilot="msteams:COPILOT",e.Omni="omnichannel",e.Outlook="outlook",e.Skype="skype",e.Slack="slack",e.Sms="sms",e.Telegram="telegram",e.Telephony="telephony",e.Test="test",e.Webchat="webchat"})(Bc||(Mn.Channels=Bc={}))});var Ai=p(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.endOfConversationCodesZodSchema=Ht.EndOfConversationCodes=void 0;var Jp=D(),Hc;(function(e){e.Unknown="unknown",e.CompletedSuccessfully="completedSuccessfully",e.UserCancelled="userCancelled",e.AgentTimedOut="agentTimedOut",e.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",e.ChannelFailed="channelFailed"})(Hc||(Ht.EndOfConversationCodes=Hc={}));Ht.endOfConversationCodesZodSchema=Jp.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Kc=p(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.MembershipSourceTypes=void 0;var Wc;(function(e){e.Channel="channel",e.Team="team"})(Wc||(Vn.MembershipSourceTypes=Wc={}))});var Xc=p(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.MembershipTypes=void 0;var Yc;(function(e){e.Direct="direct",e.Transitive="transitive"})(Yc||(qn.MembershipTypes=Yc={}))});var Nr=p(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.roleTypeZodSchema=Wt.RoleTypes=void 0;var Qp=D(),Jc;(function(e){e.User="user",e.Agent="bot",e.Skill="skill",e.AgenticIdentity="agenticAppInstance",e.AgenticUser="agenticUser"})(Jc||(Wt.RoleTypes=Jc={}));Wt.roleTypeZodSchema=Qp.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var Qc=p(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.addAIToActivity=void 0;var em=(e,t,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:t,usageInfo:r};(n=e.entities)!==null&&n!==void 0||(e.entities=[]),e.entities.push(o)};zn.addAIToActivity=em});var eu=p(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.adaptiveCardInvokeActionZodSchema=void 0;var yt=D();Fn.adaptiveCardInvokeActionZodSchema=yt.z.object({type:yt.z.string().min(1),id:yt.z.string().optional(),verb:yt.z.string().min(1),data:yt.z.record(yt.z.string().min(1),yt.z.any())})});var tu=p(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ru=p(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.default="00000000-0000-0000-0000-000000000000"});var nu=p(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var jr=p(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var tm=nu();function rm(e){return typeof e=="string"&&tm.default.test(e)}Ri.default=rm});var kr=p(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});var nm=jr();function om(e){if(!(0,nm.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}Ni.default=om});var Re=p(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.unsafeStringify=void 0;var im=jr(),F=[];for(let e=0;e<256;++e)F.push((e+256).toString(16).slice(1));function ou(e,t=0){return(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase()}Ur.unsafeStringify=ou;function am(e,t=0){let r=ou(e,t);if(!(0,im.default)(r))throw TypeError("Stringified UUID is invalid");return r}Ur.default=am});var Gn=p(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});var ji,sm=new Uint8Array(16);function cm(){if(!ji){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ji=crypto.getRandomValues.bind(crypto)}return ji(sm)}ki.default=cm});var Ui=p(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.updateV1State=void 0;var iu=Gn(),um=Re(),Dr={};function dm(e,t,r){var i,a,s,c;let n,o=(i=e==null?void 0:e._v6)!=null?i:!1;if(e){let d=Object.keys(e);d.length===1&&d[0]==="_v6"&&(e=void 0)}if(e)n=au((c=(s=e.random)!=null?s:(a=e.rng)==null?void 0:a.call(e))!=null?c:(0,iu.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let d=Date.now(),f=(0,iu.default)();su(Dr,d,f),n=au(f,Dr.msecs,Dr.nsecs,o?void 0:Dr.clockseq,o?void 0:Dr.node,t,r)}return t!=null?t:(0,um.unsafeStringify)(n)}function su(e,t,r){var n,o;return(n=e.msecs)!=null||(e.msecs=-1/0),(o=e.nsecs)!=null||(e.nsecs=0),t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}Zr.updateV1State=su;function au(e,t,r,n,o,i,a=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),a=0;else if(a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);t!=null||(t=Date.now()),r!=null||(r=0),n!=null||(n=(e[8]<<8|e[9])&16383),o!=null||(o=e.slice(10,16)),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;i[a++]=s>>>24&255,i[a++]=s>>>16&255,i[a++]=s>>>8&255,i[a++]=s&255;let c=t/4294967296*1e4&268435455;i[a++]=c>>>8&255,i[a++]=c&255,i[a++]=c>>>24&15|16,i[a++]=c>>>16&255,i[a++]=n>>>8|128,i[a++]=n&255;for(let d=0;d<6;++d)i[a++]=o[d];return i}Zr.default=dm});var Zi=p(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});var lm=kr(),fm=Re();function pm(e){let t=typeof e=="string"?(0,lm.default)(e):e,r=mm(t);return typeof e=="string"?(0,fm.unsafeStringify)(r):r}Di.default=pm;function mm(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var uu=p(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});function hm(e){let t=vm(e),r=ym(t,e.length*8);return gm(r)}function gm(e){let t=new Uint8Array(e.length*4);for(let r=0;r<e.length*4;r++)t[r]=e[r>>2]>>>r%4*8&255;return t}function cu(e){return(e+64>>>9<<4)+14+1}function ym(e,t){let r=new Uint32Array(cu(t)).fill(0);r.set(e),r[t>>5]|=128<<t%32,r[r.length-1]=t,e=r;let n=1732584193,o=-271733879,i=-1732584194,a=271733878;for(let s=0;s<e.length;s+=16){let c=n,d=o,f=i,g=a;n=H(n,o,i,a,e[s],7,-680876936),a=H(a,n,o,i,e[s+1],12,-389564586),i=H(i,a,n,o,e[s+2],17,606105819),o=H(o,i,a,n,e[s+3],22,-1044525330),n=H(n,o,i,a,e[s+4],7,-176418897),a=H(a,n,o,i,e[s+5],12,1200080426),i=H(i,a,n,o,e[s+6],17,-1473231341),o=H(o,i,a,n,e[s+7],22,-45705983),n=H(n,o,i,a,e[s+8],7,1770035416),a=H(a,n,o,i,e[s+9],12,-1958414417),i=H(i,a,n,o,e[s+10],17,-42063),o=H(o,i,a,n,e[s+11],22,-1990404162),n=H(n,o,i,a,e[s+12],7,1804603682),a=H(a,n,o,i,e[s+13],12,-40341101),i=H(i,a,n,o,e[s+14],17,-1502002290),o=H(o,i,a,n,e[s+15],22,1236535329),n=W(n,o,i,a,e[s+1],5,-165796510),a=W(a,n,o,i,e[s+6],9,-1069501632),i=W(i,a,n,o,e[s+11],14,643717713),o=W(o,i,a,n,e[s],20,-373897302),n=W(n,o,i,a,e[s+5],5,-701558691),a=W(a,n,o,i,e[s+10],9,38016083),i=W(i,a,n,o,e[s+15],14,-660478335),o=W(o,i,a,n,e[s+4],20,-405537848),n=W(n,o,i,a,e[s+9],5,568446438),a=W(a,n,o,i,e[s+14],9,-1019803690),i=W(i,a,n,o,e[s+3],14,-187363961),o=W(o,i,a,n,e[s+8],20,1163531501),n=W(n,o,i,a,e[s+13],5,-1444681467),a=W(a,n,o,i,e[s+2],9,-51403784),i=W(i,a,n,o,e[s+7],14,1735328473),o=W(o,i,a,n,e[s+12],20,-1926607734),n=K(n,o,i,a,e[s+5],4,-378558),a=K(a,n,o,i,e[s+8],11,-2022574463),i=K(i,a,n,o,e[s+11],16,1839030562),o=K(o,i,a,n,e[s+14],23,-35309556),n=K(n,o,i,a,e[s+1],4,-1530992060),a=K(a,n,o,i,e[s+4],11,1272893353),i=K(i,a,n,o,e[s+7],16,-155497632),o=K(o,i,a,n,e[s+10],23,-1094730640),n=K(n,o,i,a,e[s+13],4,681279174),a=K(a,n,o,i,e[s],11,-358537222),i=K(i,a,n,o,e[s+3],16,-722521979),o=K(o,i,a,n,e[s+6],23,76029189),n=K(n,o,i,a,e[s+9],4,-640364487),a=K(a,n,o,i,e[s+12],11,-421815835),i=K(i,a,n,o,e[s+15],16,530742520),o=K(o,i,a,n,e[s+2],23,-995338651),n=Y(n,o,i,a,e[s],6,-198630844),a=Y(a,n,o,i,e[s+7],10,1126891415),i=Y(i,a,n,o,e[s+14],15,-1416354905),o=Y(o,i,a,n,e[s+5],21,-57434055),n=Y(n,o,i,a,e[s+12],6,1700485571),a=Y(a,n,o,i,e[s+3],10,-1894986606),i=Y(i,a,n,o,e[s+10],15,-1051523),o=Y(o,i,a,n,e[s+1],21,-2054922799),n=Y(n,o,i,a,e[s+8],6,1873313359),a=Y(a,n,o,i,e[s+15],10,-30611744),i=Y(i,a,n,o,e[s+6],15,-1560198380),o=Y(o,i,a,n,e[s+13],21,1309151649),n=Y(n,o,i,a,e[s+4],6,-145523070),a=Y(a,n,o,i,e[s+11],10,-1120210379),i=Y(i,a,n,o,e[s+2],15,718787259),o=Y(o,i,a,n,e[s+9],21,-343485551),n=Ge(n,c),o=Ge(o,d),i=Ge(i,f),a=Ge(a,g)}return Uint32Array.of(n,o,i,a)}function vm(e){if(e.length===0)return new Uint32Array;let t=new Uint32Array(cu(e.length*8)).fill(0);for(let r=0;r<e.length;r++)t[r>>2]|=(e[r]&255)<<r%4*8;return t}function Ge(e,t){let r=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(r>>16)<<16|r&65535}function _m(e,t){return e<<t|e>>>32-t}function $n(e,t,r,n,o,i){return Ge(_m(Ge(Ge(t,e),Ge(n,i)),o),r)}function H(e,t,r,n,o,i,a){return $n(t&r|~t&n,e,t,o,i,a)}function W(e,t,r,n,o,i,a){return $n(t&n|r&~n,e,t,o,i,a)}function K(e,t,r,n,o,i,a){return $n(t^r^n,e,t,o,i,a)}function Y(e,t,r,n,o,i,a){return $n(r^(t|~n),e,t,o,i,a)}Li.default=hm});var Lr=p(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.URL=Ne.DNS=Ne.stringToBytes=void 0;var du=kr(),bm=Re();function lu(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}Ne.stringToBytes=lu;Ne.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ne.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Tm(e,t,r,n,o,i){let a=typeof r=="string"?lu(r):r,s=typeof n=="string"?(0,du.default)(n):n;if(typeof n=="string"&&(n=(0,du.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+a.length);if(c.set(s),c.set(a,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,o){if(i=i||0,i<0||i+16>o.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let d=0;d<16;++d)o[i+d]=c[d];return o}return(0,bm.unsafeStringify)(c)}Ne.default=Tm});var pu=p(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.URL=vt.DNS=void 0;var xm=uu(),Mi=Lr(),fu=Lr();Object.defineProperty(vt,"DNS",{enumerable:!0,get:function(){return fu.DNS}});Object.defineProperty(vt,"URL",{enumerable:!0,get:function(){return fu.URL}});function Vi(e,t,r,n){return(0,Mi.default)(48,xm.default,e,t,r,n)}Vi.DNS=Mi.DNS;Vi.URL=Mi.URL;vt.default=Vi});var mu=p(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var Cm=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);qi.default={randomUUID:Cm}});var gu=p(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});var hu=mu(),Im=Gn(),Em=Re();function Sm(e,t,r){var o,i,a;if(hu.default.randomUUID&&!t&&!e)return hu.default.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:(0,Im.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return(0,Em.unsafeStringify)(n)}zi.default=Sm});var yu=p(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});function Am(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Fi(e,t){return e<<t|e>>>32-t}function wm(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let s=0;s<i;++s){let c=new Uint32Array(16);for(let d=0;d<16;++d)c[d]=e[s*64+d*4]<<24|e[s*64+d*4+1]<<16|e[s*64+d*4+2]<<8|e[s*64+d*4+3];a[s]=c}a[i-1][14]=(e.length-1)*8/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let c=new Uint32Array(80);for(let P=0;P<16;++P)c[P]=a[s][P];for(let P=16;P<80;++P)c[P]=Fi(c[P-3]^c[P-8]^c[P-14]^c[P-16],1);let d=r[0],f=r[1],g=r[2],_=r[3],I=r[4];for(let P=0;P<80;++P){let y=Math.floor(P/20),S=Fi(d,5)+Am(y,f,g,_)+I+t[y]+c[P]>>>0;I=_,_=g,g=Fi(f,30)>>>0,f=d,d=S}r[0]=r[0]+d>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+_>>>0,r[4]=r[4]+I>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}Gi.default=wm});var _u=p(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.URL=_t.DNS=void 0;var Om=yu(),$i=Lr(),vu=Lr();Object.defineProperty(_t,"DNS",{enumerable:!0,get:function(){return vu.DNS}});Object.defineProperty(_t,"URL",{enumerable:!0,get:function(){return vu.URL}});function Bi(e,t,r,n){return(0,$i.default)(80,Om.default,e,t,r,n)}Bi.DNS=$i.DNS;Bi.URL=$i.URL;_t.default=Bi});var bu=p(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Pm=Re(),Rm=Ui(),Nm=Zi();function jm(e,t,r){e!=null||(e={}),r!=null||(r=0);let n=(0,Rm.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,Nm.default)(n),t){if(r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;o++)t[r+o]=n[o];return t}return(0,Pm.unsafeStringify)(n)}Hi.default=jm});var Tu=p(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var km=kr(),Um=Re();function Dm(e){let t=typeof e=="string"?(0,km.default)(e):e,r=Zm(t);return typeof e=="string"?(0,Um.unsafeStringify)(r):r}Wi.default=Dm;function Zm(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Eu=p(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.updateV7State=void 0;var xu=Gn(),Lm=Re(),Ki={};function Mm(e,t,r){var o,i,a;let n;if(e)n=Cu((a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:(0,xu.default)(),e.msecs,e.seq,t,r);else{let s=Date.now(),c=(0,xu.default)();Iu(Ki,s,c),n=Cu(c,Ki.msecs,Ki.seq,t,r)}return t!=null?t:(0,Lm.unsafeStringify)(n)}function Iu(e,t,r){var n,o;return(n=e.msecs)!=null||(e.msecs=-1/0),(o=e.seq)!=null||(e.seq=0),t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}Mr.updateV7State=Iu;function Cu(e,t,r,n,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),o=0;else if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return t!=null||(t=Date.now()),r!=null||(r=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9]),n[o++]=t/1099511627776&255,n[o++]=t/4294967296&255,n[o++]=t/16777216&255,n[o++]=t/65536&255,n[o++]=t/256&255,n[o++]=t&255,n[o++]=112|r>>>28&15,n[o++]=r>>>20&255,n[o++]=128|r>>>14&63,n[o++]=r>>>6&255,n[o++]=r<<2&255|e[10]&3,n[o++]=e[11],n[o++]=e[12],n[o++]=e[13],n[o++]=e[14],n[o++]=e[15],n}Mr.default=Mm});var Su=p(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Vm=jr();function qm(e){if(!(0,Vm.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}Yi.default=qm});var Au=p(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.version=R.validate=R.v7=R.v6ToV1=R.v6=R.v5=R.v4=R.v3=R.v1ToV6=R.v1=R.stringify=R.parse=R.NIL=R.MAX=void 0;var zm=tu();Object.defineProperty(R,"MAX",{enumerable:!0,get:function(){return zm.default}});var Fm=ru();Object.defineProperty(R,"NIL",{enumerable:!0,get:function(){return Fm.default}});var Gm=kr();Object.defineProperty(R,"parse",{enumerable:!0,get:function(){return Gm.default}});var $m=Re();Object.defineProperty(R,"stringify",{enumerable:!0,get:function(){return $m.default}});var Bm=Ui();Object.defineProperty(R,"v1",{enumerable:!0,get:function(){return Bm.default}});var Hm=Zi();Object.defineProperty(R,"v1ToV6",{enumerable:!0,get:function(){return Hm.default}});var Wm=pu();Object.defineProperty(R,"v3",{enumerable:!0,get:function(){return Wm.default}});var Km=gu();Object.defineProperty(R,"v4",{enumerable:!0,get:function(){return Km.default}});var Ym=_u();Object.defineProperty(R,"v5",{enumerable:!0,get:function(){return Ym.default}});var Xm=bu();Object.defineProperty(R,"v6",{enumerable:!0,get:function(){return Xm.default}});var Jm=Tu();Object.defineProperty(R,"v6ToV1",{enumerable:!0,get:function(){return Jm.default}});var Qm=Eu();Object.defineProperty(R,"v7",{enumerable:!0,get:function(){return Qm.default}});var eh=jr();Object.defineProperty(R,"validate",{enumerable:!0,get:function(){return eh.default}});var th=Su();Object.defineProperty(R,"version",{enumerable:!0,get:function(){return th.default}})});var Xi=p(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.entityZodSchema=void 0;var wu=D();Bn.entityZodSchema=wu.z.object({type:wu.z.string().min(1)}).passthrough()});var Ou=p(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.semanticActionZodSchema=void 0;var Vr=D(),rh=Xi(),nh=Ii();Hn.semanticActionZodSchema=Vr.z.object({id:Vr.z.string().min(1),state:Vr.z.union([nh.semanticActionStateTypesZodSchema,Vr.z.string().min(1)]),entities:Vr.z.record(rh.entityZodSchema)})});var Pu=p(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.cardActionZodSchema=void 0;var Ie=D(),oh=Ci();Wn.cardActionZodSchema=Ie.z.object({type:Ie.z.union([oh.actionTypesZodSchema,Ie.z.string().min(1)]),title:Ie.z.string().min(1),image:Ie.z.string().min(1).optional(),text:Ie.z.string().min(1).optional(),displayText:Ie.z.string().min(1).optional(),value:Ie.z.any().optional(),channelData:Ie.z.unknown().optional(),imageAltText:Ie.z.string().min(1).optional()})});var Ru=p(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.suggestedActionsZodSchema=void 0;var Kn=D(),ih=Pu();Yn.suggestedActionsZodSchema=Kn.z.object({to:Kn.z.array(Kn.z.string().min(1)),actions:Kn.z.array(ih.cardActionZodSchema)})});var Ji=p(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.activityEventNamesZodSchema=Kt.ActivityEventNames=void 0;var ah=D(),Nu;(function(e){e.ContinueConversation="ContinueConversation",e.CreateConversation="CreateConversation"})(Nu||(Kt.ActivityEventNames=Nu={}));Kt.activityEventNamesZodSchema=ah.z.enum(["ContinueConversation","CreateConversation"])});var Qi=p(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.activityImportanceZodSchema=Yt.ActivityImportance=void 0;var sh=D(),ju;(function(e){e.Low="low",e.Normal="normal",e.High="high"})(ju||(Yt.ActivityImportance=ju={}));Yt.activityImportanceZodSchema=sh.z.enum(["low","normal","high"])});var ea=p(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.activityTypesZodSchema=Xt.ActivityTypes=void 0;var ch=D(),ku;(function(e){e.Message="message",e.ContactRelationUpdate="contactRelationUpdate",e.ConversationUpdate="conversationUpdate",e.Typing="typing",e.EndOfConversation="endOfConversation",e.Event="event",e.Invoke="invoke",e.InvokeResponse="invokeResponse",e.DeleteUserData="deleteUserData",e.MessageUpdate="messageUpdate",e.MessageDelete="messageDelete",e.InstallationUpdate="installationUpdate",e.MessageReaction="messageReaction",e.Suggestion="suggestion",e.Trace="trace",e.Handoff="handoff",e.Command="command",e.CommandResult="commandResult"})(ku||(Xt.ActivityTypes=ku={}));Xt.activityTypesZodSchema=ch.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Uu=p(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.attachmentZodSchema=void 0;var Jt=D();Xn.attachmentZodSchema=Jt.z.object({contentType:Jt.z.string().min(1),contentUrl:Jt.z.string().min(1).optional(),content:Jt.z.unknown().optional(),name:Jt.z.string().min(1).optional(),thumbnailUrl:Jt.z.string().min(1).optional()})});var Du=p(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.addProductInfoToActivity=bt.clearProductInfoFromActivity=void 0;var uh=e=>{e&&e.entities&&e.entities.length&&(e.entities=e.entities.filter(t=>t.type!=="ProductInfo"))};bt.clearProductInfoFromActivity=uh;var dh=(e,t)=>{var r,n;let o={type:"ProductInfo",id:t};(r=e.entities)!==null&&r!==void 0||(e.entities=[]),(0,bt.clearProductInfoFromActivity)(e),(n=e.entities)===null||n===void 0||n.push(o)};bt.addProductInfoToActivity=dh});var ta=p(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.channelAccountZodSchema=void 0;var pe=D(),lh=Nr();Jn.channelAccountZodSchema=pe.z.object({id:pe.z.string().min(1).optional(),name:pe.z.string().optional(),aadObjectId:pe.z.string().min(1).optional(),tenantId:pe.z.string().min(1).optional(),agenticUserId:pe.z.string().min(1).optional(),agenticAppId:pe.z.string().min(1).optional(),agenticAppBlueprintId:pe.z.string().min(1).optional(),role:pe.z.union([lh.roleTypeZodSchema,pe.z.string().min(1)]).optional(),properties:pe.z.unknown().optional()})});var ra=p(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.conversationAccountZodSchema=void 0;var Ee=D(),fh=Nr();Qn.conversationAccountZodSchema=Ee.z.object({isGroup:Ee.z.boolean().optional(),conversationType:Ee.z.string().min(1).optional(),tenantId:Ee.z.string().min(1).optional(),id:Ee.z.string().min(1),name:Ee.z.string().min(1).optional(),aadObjectId:Ee.z.string().min(1).optional(),role:Ee.z.union([fh.roleTypeZodSchema,Ee.z.string().min(1)]).optional(),properties:Ee.z.unknown().optional()})});var Lu=p(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.conversationReferenceZodSchema=void 0;var qr=D(),Zu=ta(),ph=ra();eo.conversationReferenceZodSchema=qr.z.object({activityId:qr.z.string().min(1).optional(),user:Zu.channelAccountZodSchema.optional(),locale:qr.z.string().min(1).optional(),agent:Zu.channelAccountZodSchema.optional().nullable(),conversation:ph.conversationAccountZodSchema,channelId:qr.z.string().min(1),serviceUrl:qr.z.string().min(1).optional()})});var na=p(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.deliveryModesZodSchema=Qt.DeliveryModes=void 0;var mh=D(),Mu;(function(e){e.Normal="normal",e.Notification="notification",e.ExpectReplies="expectReplies",e.Ephemeral="ephemeral"})(Mu||(Qt.DeliveryModes=Mu={}));Qt.deliveryModesZodSchema=mh.z.enum(["normal","notification","expectReplies","ephemeral"])});var oa=p(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.inputHintsZodSchema=er.InputHints=void 0;var hh=D(),Vu;(function(e){e.AcceptingInput="acceptingInput",e.IgnoringInput="ignoringInput",e.ExpectingInput="expectingInput"})(Vu||(er.InputHints=Vu={}));er.inputHintsZodSchema=hh.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var ia=p(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.messageReactionTypesZodSchema=tr.MessageReactionTypes=void 0;var gh=D(),qu;(function(e){e.Like="like",e.PlusOne="plusOne"})(qu||(tr.MessageReactionTypes=qu={}));tr.messageReactionTypesZodSchema=gh.z.enum(["like","plusOne"])});var zu=p(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.messageReactionZodSchema=void 0;var aa=D(),yh=ia();to.messageReactionZodSchema=aa.z.object({type:aa.z.union([yh.messageReactionTypesZodSchema,aa.z.string().min(1)])})});var sa=p(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.textFormatTypesZodSchema=rr.TextFormatTypes=void 0;var vh=D(),Fu;(function(e){e.Markdown="markdown",e.Plain="plain",e.Xml="xml"})(Fu||(rr.TextFormatTypes=Fu={}));rr.textFormatTypesZodSchema=vh.z.enum(["markdown","plain","xml"])});var Gu=p(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.textHighlightZodSchema=void 0;var ca=D();ro.textHighlightZodSchema=ca.z.object({text:ca.z.string().min(1),occurrence:ca.z.number()})});var ua=p(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.ExceptionHelper=void 0;var no=class e{static generateException(t,r,n,o){var i;let a=r.description;o&&Object.keys(o).forEach(g=>{a=a.replace(`{${g}}`,o[g])});let c=((i=r.helplink)!==null&&i!==void 0?i:e.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),d=`[${r.code}] - ${a} - ${c}`,f=new t(d);return f.code=r.code,f.helpLink=c,n&&(f.innerException=n),f}};oo.ExceptionHelper=no;no.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var da=p(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.Errors=void 0;io.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 la=p(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.ActivityTreatments=void 0;var $u;(function(e){e.Targeted="targeted"})($u||(ao.ActivityTreatments=$u={}))});var Ju=p(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.Activity=Tt.activityZodSchema=void 0;var _h=Au(),b=D(),bh=Ou(),Th=Ru(),Xu=Ji(),xh=Qi(),co=ea(),Ch=Uu(),Ih=Ei(),Bu=Du(),so=ta(),Hu=Si(),Eh=ra(),Sh=Lu(),Ah=Ai(),wh=na(),Oh=Xi(),Ph=oa(),Wu=zu(),Rh=sa(),Nh=Gu(),Ku=Nr(),je=ua(),ke=da(),Yu=la();Tt.activityZodSchema=b.z.object({type:b.z.union([co.activityTypesZodSchema,b.z.string().min(1)]),text:b.z.string().optional(),id:b.z.string().min(1).optional(),channelId:b.z.string().min(1).optional(),from:so.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),localTimestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:Eh.conversationAccountZodSchema.optional(),recipient:so.channelAccountZodSchema.optional(),textFormat:b.z.union([Rh.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([Ih.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(so.channelAccountZodSchema).optional(),membersRemoved:b.z.array(so.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(Wu.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(Wu.messageReactionZodSchema).optional(),topicName:b.z.string().min(1).optional(),historyDisclosed:b.z.boolean().optional(),locale:b.z.string().min(1).optional(),speak:b.z.string().min(1).optional(),inputHint:b.z.union([Ph.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:Th.suggestedActionsZodSchema.optional(),attachments:b.z.array(Ch.attachmentZodSchema).optional(),entities:b.z.array(Oh.entityZodSchema.passthrough()).optional(),channelData:b.z.any().optional(),action:b.z.string().min(1).optional(),replyToId:b.z.string().min(1).optional(),label:b.z.string().min(1).optional(),valueType:b.z.string().min(1).optional(),value:b.z.unknown().optional(),name:b.z.union([Xu.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:Sh.conversationReferenceZodSchema.optional(),code:b.z.union([Ah.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),importance:b.z.union([xh.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([wh.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(Nh.textHighlightZodSchema).optional(),semanticAction:bh.semanticActionZodSchema.optional()});var fa=class e{constructor(t){if(t===void 0)throw je.ExceptionHelper.generateException(Error,ke.Errors.InvalidActivityTypeUndefined);if(t===null)throw je.ExceptionHelper.generateException(Error,ke.Errors.InvalidActivityTypeNull);if(typeof t=="string"&&t.length===0)throw je.ExceptionHelper.generateException(Error,ke.Errors.InvalidActivityTypeEmptyString);this.type=t}static fromJson(t){return this.fromObject(JSON.parse(t))}static fromObject(t){let r=Tt.activityZodSchema.passthrough().parse(t),n=new e(r.type);return Object.assign(n,r),n}get channelId(){var t;return(t=this._channelId)===null||t===void 0?void 0:t.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(t){let r,n;return t&&t.indexOf(":")!==-1?(r=t.substring(0,t.indexOf(":")),n=t.substring(t.indexOf(":")+1)):r=t,[r,n]}set channelId(t){let[r,n]=e.parseChannelId(t);if(t&&!r)throw je.ExceptionHelper.generateException(Error,ke.Errors.InvalidChannelIdFormat,void 0,{channelId:t});this._channelId=r,n?(0,Bu.addProductInfoToActivity)(this,n):(0,Bu.clearProductInfoFromActivity)(this)}set channelIdChannel(t){this._channelId=t}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var t,r;return(r=(t=this.entities)===null||t===void 0?void 0:t.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(t){if(!this._channelId)throw je.ExceptionHelper.generateException(Error,ke.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${t?`:${t}`:""}`}static getContinuationActivity(t){var r;let n={type:co.ActivityTypes.Event,name:Xu.ActivityEventNames.ContinueConversation,id:(r=t.activityId)!==null&&r!==void 0?r:(0,_h.v4)(),channelId:t.channelId,locale:t.locale,serviceUrl:t.serviceUrl,conversation:t.conversation,recipient:t.agent,from:t.user,relatesTo:t};return e.fromObject(n)}getAppropriateReplyToId(){if(this.type!==co.ActivityTypes.ConversationUpdate||this.channelId!==Hu.Channels.Directline&&this.channelId!==Hu.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw je.ExceptionHelper.generateException(Error,ke.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw je.ExceptionHelper.generateException(Error,ke.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw je.ExceptionHelper.generateException(Error,ke.Errors.ActivityChannelIdUndefined);return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(t,r=!1){var n,o,i;return this.channelId=t.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=t.locale),this.serviceUrl=t.serviceUrl,this.conversation=t.conversation,r?(this.from=t.user,this.recipient=(o=t.agent)!==null&&o!==void 0?o:void 0,t.activityId&&(this.id=t.activityId)):(this.from=(i=t.agent)!==null&&i!==void 0?i:void 0,this.recipient=t.user,t.activityId&&(this.replyToId=t.activityId)),this}clone(){let t=JSON.parse(JSON.stringify(this));for(let r in t)typeof t[r]=="string"&&!isNaN(Date.parse(t[r]))&&(t[r]=new Date(t[r]));return Object.setPrototypeOf(t,e.prototype),t}getMentions(t){let r=[];if(t.entities!==void 0)for(let n=0;n<t.entities.length;n++)t.entities[n].type.toLowerCase()==="mention"&&r.push(t.entities[n]);return r}normalizeMentions(t=!1){var r,n;if(this.type===co.ActivityTypes.Message&&(t&&(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=e.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=e.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(t){if(!t)return t;let r;do{r=!1;let n=t.toLowerCase().indexOf("<at");if(n>=0){let o=t.indexOf(">",n);if(o>0){let i=t.toLowerCase().indexOf("</at>",o);if(i>0){let a=t.substring(i+5);a.length>0&&!/\s/.test(a[0])&&(a=` ${a}`),t=t.substring(0,i)+a;let s=t.substring(o+1,i),c=t.substring(0,n);c.length>0&&!/\s$/.test(c)&&(c+=" "),t=c+s+a,r=!0}}}}while(r);return t}removeMentionText(t){let n=this.getMentions(this).filter(o=>o.mentioned.id===t);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 t;return!((t=this.entities)===null||t===void 0)&&t.length?this.entities.some(r=>r.type==="activityTreatment"&&r.treatment===Yu.ActivityTreatments.Targeted):!1}makeTargetedActivity(){var t,r;if(!(!((t=this.conversation)===null||t===void 0)&&t.isGroup))throw je.ExceptionHelper.generateException(Error,ke.Errors.TargetedActivityIsGroupOnly);this.isTargetedActivity()||((r=this.entities)!==null&&r!==void 0||(this.entities=[]),this.entities.push({type:"activityTreatment",treatment:Yu.ActivityTreatments.Targeted}))}getReplyConversationReference(t){let r=this.getConversationReference();return r.activityId=t,r}toJsonString(t,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,t,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Ku.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Ku.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var t,r,n;return(r=(t=this.recipient)===null||t===void 0?void 0:t.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var t;if(this.isAgenticRequest())return(t=this.recipient)===null||t===void 0?void 0:t.agenticAppId}getAgenticUser(){var t;if(this.isAgenticRequest())return(t=this.recipient)===null||t===void 0?void 0:t.agenticUserId}};Tt.Activity=fa});var uo=p(C=>{"use strict";var jh=C&&C.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Qu=C&&C.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&jh(t,e,r)};Object.defineProperty(C,"__esModule",{value:!0});C.ActivityErrors=C.ExceptionHelper=C.ActivityTreatments=C.TextFormatTypes=C.MessageReactionTypes=C.InputHints=C.DeliveryModes=C.ActivityTypes=C.ActivityImportance=C.ActivityEventNames=C.activityZodSchema=C.Activity=C.RoleTypes=C.MembershipTypes=C.MembershipSourceTypes=C.EndOfConversationCodes=C.Channels=C.AttachmentLayoutTypes=C.SemanticActionStateTypes=C.ActionTypes=void 0;var kh=Ci();Object.defineProperty(C,"ActionTypes",{enumerable:!0,get:function(){return kh.ActionTypes}});var Uh=Ii();Object.defineProperty(C,"SemanticActionStateTypes",{enumerable:!0,get:function(){return Uh.SemanticActionStateTypes}});var Dh=Ei();Object.defineProperty(C,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Dh.AttachmentLayoutTypes}});var Zh=Si();Object.defineProperty(C,"Channels",{enumerable:!0,get:function(){return Zh.Channels}});var Lh=Ai();Object.defineProperty(C,"EndOfConversationCodes",{enumerable:!0,get:function(){return Lh.EndOfConversationCodes}});var Mh=Kc();Object.defineProperty(C,"MembershipSourceTypes",{enumerable:!0,get:function(){return Mh.MembershipSourceTypes}});var Vh=Xc();Object.defineProperty(C,"MembershipTypes",{enumerable:!0,get:function(){return Vh.MembershipTypes}});var qh=Nr();Object.defineProperty(C,"RoleTypes",{enumerable:!0,get:function(){return qh.RoleTypes}});Qu(Qc(),C);Qu(eu(),C);var ed=Ju();Object.defineProperty(C,"Activity",{enumerable:!0,get:function(){return ed.Activity}});Object.defineProperty(C,"activityZodSchema",{enumerable:!0,get:function(){return ed.activityZodSchema}});var zh=Ji();Object.defineProperty(C,"ActivityEventNames",{enumerable:!0,get:function(){return zh.ActivityEventNames}});var Fh=Qi();Object.defineProperty(C,"ActivityImportance",{enumerable:!0,get:function(){return Fh.ActivityImportance}});var Gh=ea();Object.defineProperty(C,"ActivityTypes",{enumerable:!0,get:function(){return Gh.ActivityTypes}});var $h=na();Object.defineProperty(C,"DeliveryModes",{enumerable:!0,get:function(){return $h.DeliveryModes}});var Bh=oa();Object.defineProperty(C,"InputHints",{enumerable:!0,get:function(){return Bh.InputHints}});var Hh=ia();Object.defineProperty(C,"MessageReactionTypes",{enumerable:!0,get:function(){return Hh.MessageReactionTypes}});var Wh=sa();Object.defineProperty(C,"TextFormatTypes",{enumerable:!0,get:function(){return Wh.TextFormatTypes}});var Kh=la();Object.defineProperty(C,"ActivityTreatments",{enumerable:!0,get:function(){return Kh.ActivityTreatments}});var Yh=ua();Object.defineProperty(C,"ExceptionHelper",{enumerable:!0,get:function(){return Yh.ExceptionHelper}});var Xh=da();Object.defineProperty(C,"ActivityErrors",{enumerable:!0,get:function(){return Xh.Errors}})});var fr=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(fr||{});var pr=(T=>(T.Unknown="Unknown",T.Exp="Exp",T.Dev="Dev",T.Test="Test",T.Preprod="Preprod",T.FirstRelease="FirstRelease",T.Prod="Prod",T.Gov="Gov",T.High="High",T.DoD="DoD",T.Mooncake="Mooncake",T.Ex="Ex",T.Rx="Rx",T.Prv="Prv",T.Local="Local",T.GovFR="GovFR",T.Other="Other",T))(pr||{});var bo=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},To=class extends bo{constructor(t){var i,a,s;if(super(),!t)return;let r=((i=t.cloud)==null?void 0:i.trim())||"Prod",n=((a=t.copilotAgentType)==null?void 0:a.trim())||"Published",o=((s=t.authority)==null?void 0:s.trim())||"https://login.microsoftonline.com";if(!Object.values(pr).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(pr).join(", ")}`);if(!Object.values(fr).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(fr).join(", ")}`);Object.assign(this,{...t,cloud:r,copilotAgentType:n,authority:o})}},yg=()=>{var e,t,r,n,o,i,a,s;return new To({appClientId:(e=process.env.appClientId)!=null?e:"",tenantId:(t=process.env.tenantId)!=null?t:"",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:((a=process.env.useExperimentalEndpoint)==null?void 0:a.toLowerCase())==="true",enableDiagnostics:((s=process.env.enableDiagnostics)==null?void 0:s.toLowerCase())==="true"})};var Hr=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function xo(e){}function Ra(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=xo,onError:r=xo,onRetry:n=xo,onComment:o}=e,i="",a=!0,s,c="",d="";function f(y){let S=a?y.replace(/^\xEF\xBB\xBF/,""):y,[T,N]=Rd(`${i}${S}`);for(let O of T)g(O);i=N,a=!1}function g(y){if(y===""){I();return}if(y.startsWith(":")){o&&o(y.slice(y.startsWith(": ")?2:1));return}let S=y.indexOf(":");if(S!==-1){let T=y.slice(0,S),N=y[S+1]===" "?2:1,O=y.slice(S+N);_(T,O,y);return}_(y,"",y)}function _(y,S,T){switch(y){case"event":d=S;break;case"data":c=`${c}${S}
2
+ `;break;case"id":s=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new Hr(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:T}));break;default:r(new Hr(`Unknown field "${y.length>20?`${y.slice(0,20)}\u2026`:y}"`,{type:"unknown-field",field:y,value:S,line:T}));break}}function I(){c.length>0&&t({id:s,event:d||void 0,data:c.endsWith(`
3
+ `)?c.slice(0,-1):c}),s=void 0,c="",d=""}function P(y={}){i&&y.consume&&g(i),a=!0,s=void 0,c="",d="",i=""}return{feed:f,reset:P}}function Rd(e){let t=[],r="",n=0;for(;n<e.length;){let o=e.indexOf("\r",n),i=e.indexOf(`
4
4
  `,n),a=-1;if(o!==-1&&i!==-1?a=Math.min(o,i):o!==-1?o===e.length-1?a=-1:a=o:i!==-1&&(a=i),a===-1){r=e.slice(n);break}else{let s=e.slice(n,a);t.push(s),n=a+1,e[n-1]==="\r"&&e[n]===`
5
- `&&n++}}return[t,r]}var Ra="connecting",Rd="open",Co="closed",Wr=()=>{};function Nd(e,{getStream:t}){let r=typeof e=="string"||e instanceof URL?{url:e}:e,{onMessage:n,onComment:o=Wr,onConnect:i=Wr,onDisconnect:a=Wr,onScheduleReconnect:s=Wr}=r,{fetch:c,url:d,initialLastEventId:f}=jd(r),g={...r.headers},_=[],I=n?[n]:[],P=M=>I.forEach(he=>he(M)),y=Pa({onEvent:bd,onRetry:xd,onComment:o}),S,x=d.toString(),N=new AbortController,O=f,k=2e3,V,L=Co;return Se(),{close:ie,connect:Se,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:ur,get lastEventId(){return O},get url(){return x},get readyState(){return L}};function Se(){S||(L=Ra,N=new AbortController,S=c(d,Td()).then(_d).catch(M=>{S=null,!(M.name==="AbortError"||M.type==="aborted"||N.signal.aborted)&&Sa()}))}function ie(){L=Co,N.abort(),y.reset(),clearTimeout(V),_.forEach(M=>M())}function ur(){let M=[],he=[];function dr(){return new Promise(J=>{let ge=he.shift();ge?J({value:ge,done:!1}):M.push(J)})}let It=function(J){let ge=M.shift();ge?ge({value:J,done:!1}):he.push(J)};function Ke(){for(I.splice(I.indexOf(It),1);M.shift(););for(;he.shift(););}function lr(){let J=M.shift();J&&(J({done:!0,value:void 0}),Ke())}return _.push(lr),I.push(It),{next(){return L===Co?this.return():dr()},return(){return Ke(),Promise.resolve({done:!0,value:void 0})},throw(J){return Ke(),Promise.reject(J)},[Symbol.asyncIterator](){return this}}}function Sa(){s({delay:k}),!N.signal.aborted&&(L=Ra,V=setTimeout(Se,k))}async function _d(M){i(),y.reset();let{body:he,redirected:dr,status:It}=M;if(It===204){a(),ie();return}if(!he)throw new Error("Missing response body");dr&&(x=M.url);let Ke=t(he),lr=new TextDecoder,J=Ke.getReader(),ge=!0;L=Rd;do{let{done:Aa,value:wa}=await J.read();wa&&y.feed(lr.decode(wa,{stream:!Aa})),Aa&&(ge=!1,S=null,y.reset(),Sa(),a())}while(ge)}function bd(M){typeof M.id=="string"&&(O=M.id),P(M)}function xd(M){k=M}function Td(){let{mode:M,credentials:he,body:dr,method:It,redirect:Ke,referrer:lr,referrerPolicy:J}=r,ge={Accept:"text/event-stream",...g,...O?{"Last-Event-ID":O}:void 0};return{mode:M,credentials:he,body:dr,method:It,redirect:Ke,referrer:lr,referrerPolicy:J,headers:ge,cache:"no-store",signal:N.signal}}}function jd(e){let t=e.fetch||globalThis.fetch;if(!kd(t))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}=e;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:t,url:r,initialLastEventId:n}}function kd(e){return typeof e=="function"}var Ud={getStream:Dd};function Io(e){return Nd(e,Ud)}function Dd(e){if(!(e instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return e}var gc=ke(Ut());var On=class{constructor(t){this.API_VERSION="2022-03-01-preview";let r="schema"in t?t.schema:t.identifier,n=t.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(t){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,t&&(r.pathname=`${r.pathname}/${t}`),r.href}};var Pn=class{constructor(t){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=t;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(t){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,t&&(r.pathname=`${r.pathname}/${t}`),r.href}};var Dt=(0,gc.debug)("copilot-studio:power-platform");function Ar(e,t){var c,d,f,g,_,I,P,y;let r=((c=e.schemaName)==null?void 0:c.trim())||((d=e.agentIdentifier)==null?void 0:d.trim());if(!((f=e.directConnectUrl)!=null&&f.trim())&&(!((g=e.environmentId)!=null&&g.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((_=e.directConnectUrl)!=null&&_.trim()){if(Dt.debug(`Using direct connection: ${e.directConnectUrl}`),!Sr(e.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return If(e.directConnectUrl,t).href}let n=(I=e.cloud)!=null?I:"Prod",o=(P=e.copilotAgentType)!=null?P:"Published";if(Dt.debug(`Using cloud setting: ${n}`),Dt.debug(`Using agent type: ${o}`),n==="Other")if((y=e.customPowerPlatformCloud)!=null&&y.trim())if(Sr(e.customPowerPlatformCloud))Dt.debug(`Using custom Power Platform cloud: ${e.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=Ef(n,e.environmentId,e.customPowerPlatformCloud),s={Published:()=>new Pn({host:i,schema:r}),Prebuilt:()=>new On({host:i,schema:r})}[o]().getConversationUrl(t);return Dt.debug(`Generated Copilot Studio connection URL: ${s}`),s}function yc(e,t){if(!t||!t.trim())throw new Error("conversationId is required for subscribe URL");let r=Ar(e,t),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return Dt.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function vc(e,t="Unknown",r="",n=""){var o,i;if(!n&&!(e!=null&&e.directConnectUrl)){if(t==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!e&&t==="Unknown")throw new Error("Either settings or cloud must be provided");if(e&&e.cloud&&e.cloud!=="Unknown"&&(t=e.cloud),t==="Other")if(r&&Sr(r))t="Other";else if(e!=null&&e.customPowerPlatformCloud&&Sr(e.customPowerPlatformCloud))t="Other",r=e.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://${Rn(t,r)}/.default`}else if(n||(n=(o=e==null?void 0:e.directConnectUrl)!=null?o:""),n&&Sr(n)){if(hc(new URL(n))==="Unknown"){let a=(i=e==null?void 0:e.cloud)!=null?i:t;if(a==="Other"||a==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(a!=="Unknown")return`https://${Rn(a,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${Rn(hc(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Sr(e){try{let t=e.startsWith("http")?e:`https://${e}`;return!!new URL(t)}catch{return!1}}function If(e,t){let r=new URL(e);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`,t&&(r.pathname=`${r.pathname}/${t}`),r}function Ef(e,t,r){if(e==="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=t.toLowerCase().replaceAll("-",""),o=Sf(e),i=n.substring(0,n.length-o),a=n.substring(n.length-o);return new URL(`https://${i}.${a}.environment.${Rn(e,r)}`)}function Rn(e,t){switch(e){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 t;default:throw new Error(`Invalid cluster category value: ${e}`)}}function Sf(e){switch(e){case"FirstRelease":case"Prod":return 2;default:return 1}}function hc(e){switch(e.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 Tt=ke(uo());var zr=class{constructor(t,r){this.activity=t,this.conversationId=r}};var He=ke(Ut());var lo="1.5.1";var fo={};var Fr=class{static getProductInfo(){let t=`CopilotStudioClient.agents-sdk-js/${lo}`,r;return typeof window!="undefined"&&window.navigator?r=`${t} ${navigator.userAgent}`:r=`${t} nodejs/${process.version} ${fo.platform()}-${fo.arch()}/${fo.release()}`,r}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${lo}`}static getVersion(){return lo}};var po=class{static getScopeFromSettings(t){return vc(t)}};function ed(e,t){return{activities:e,conversationId:t,isNewConversation:!0}}function td(e,t){return{activities:e,conversationId:t,activityCount:e.length}}var Z=ke(Ut()),X={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 fa=ke(uo()),re=ke(Ut());var $e={createConnection:re.trace.define({name:re.SpanNames.COPILOT_CREATE_CONNECTION,record:{showTyping:!1},actions:({span:e})=>({receivedFromCopilot(t){var r,n,o;e.addEvent("activity.received.from.copilot.studio",{"copilot.webchat.activity.type":(r=t.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=t.conversation)==null?void 0:n.id)!=null?o:"unknown"})},sentToWebChat(t){var r,n,o;e.addEvent("activity.sent.to.webchat",{"copilot.webchat.activity.type":(r=t.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=t.conversation)==null?void 0:n.id)!=null?o:"unknown"})}}),end({span:e,record:t}){var n;let r={"copilot.webchat.show_typing":(n=t.showTyping)!=null?n:"unknown"};e.setAttributes(r),X.webchatConnectionsCounter.add(1,r)}}),postRequest:re.trace.define({name:re.SpanNames.COPILOT_POST_REQUEST,record:{url:"",method:""},actions:({span:e})=>({receivedFromCopilot(t){var n,o,i;let r={"copilot.activity.type":(n=t.type)!=null?n:"unknown","copilot.activity.conversation_id":(i=(o=t.conversation)==null?void 0:o.id)!=null?i:"unknown"};e.addEvent("activity.received",{"copilot.post_request.activity.type":r["copilot.activity.type"],"copilot.post_request.activity.conversation_id":r["copilot.activity.conversation_id"]}),X.activitiesReceivedCounter.add(1,r)}}),end({span:e,record:t,duration:r,error:n}){var a,s;let o={"copilot.post_request.url":(a=t.url)!=null?a:"unknown","copilot.post_request.method":(s=t.method)!=null?s:"unknown"},i={operation:"postRequestAsync","copilot.post_request.url":o["copilot.post_request.url"],"copilot.post_request.method":o["copilot.post_request.method"]};e.setAttributes(o),X.requestsCounter.add(1,i),X.streamDuration.record(r,i),n&&X.requestsErrorCounter.add(1,{...i,"error.type":n instanceof Error?n.name:typeof n})}}),startConversation:re.trace.define({name:re.SpanNames.COPILOT_START_CONVERSATION,record:{shouldEmitStartEvent:!1},end({span:e,record:t,duration:r}){let n=t.shouldEmitStartEvent?{"copilot.emit_start_event":!0}:{"copilot.request":!0},o={operation:"startConversationStreaming",...n};e.setAttributes(n),X.conversationsStartedCounter.add(1,o),X.requestDuration.record(r,o)}}),sendActivity:re.trace.define({name:re.SpanNames.COPILOT_SEND_ACTIVITY,record:{activity:fa.Activity.fromObject({type:"unknown"})},end({span:e,record:t,duration:r}){var i,a,s;let n={"copilot.activity.type":(i=t.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(s=(a=t.activity.conversation)==null?void 0:a.id)!=null?s:"unknown"},o={operation:"sendActivityStreaming",...n};e.setAttributes(n),X.activitiesSentCounter.add(1,n),X.requestDuration.record(r,o)}}),executeStreaming:re.trace.define({name:re.SpanNames.COPILOT_EXECUTE_STREAMING,record:{activity:fa.Activity.fromObject({type:"unknown"}),conversationId:"unknown"},end({span:e,record:t,duration:r}){var i,a;let n={"copilot.activity.type":(i=t.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(a=t.conversationId)!=null?a:"unknown"},o={operation:"executeStreaming",...n};e.setAttributes(n),X.executeStreamingCounter.add(1,n),X.requestDuration.record(r,o)}}),subscribeAsync:re.trace.define({name:re.SpanNames.COPILOT_SUBSCRIBE_ASYNC,record:{conversationId:"unknown",lastReceivedEventId:"unknown"},actions:({span:e})=>({eventReceivedFromCopilot(t){var n,o;let r={"copilot.subscribe_async.event.id":(n=t.eventId)!=null?n:"unknown","copilot.subscribe_async.event.activity.type":(o=t.activity.type)!=null?o:"unknown"};e.addEvent("event.received",r),X.subscribeEventCounter.add(1,r)}}),end({span:e,record:t,duration:r}){var i,a;let n={"copilot.subscribe_async.conversation_id":(i=t.conversationId)!=null?i:"unknown","copilot.subscribe_async.last_received_event_id":(a=t.lastReceivedEventId)!=null?a:"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"]};e.setAttributes(n),X.subscribeAsyncCounter.add(1,o),X.streamDuration.record(r,o)}})};var q=(0,He.debug)("copilot-studio:client"),Be=class Be{constructor(t,r){this.conversationId="";this.settings=t,this.token=r}logDiagnostic(t,...r){this.settings.enableDiagnostics&&q.info(`[DIAGNOSTICS] ${t}`,...r)}async*postRequestAsync(t,r,n="POST"){var i,a,s,c,d,f,g,_,I,P;let o=(0,He.trace)($e.postRequest);o.record({url:t,method:n});try{this.logDiagnostic(`Request URL: ${t}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),q.debug(`>>> SEND TO ${t}`);let y=new Map,S=Io({url:t,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Fr.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(x,N)=>{let O=await fetch(x,N);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:x,event:N}of S){if(x&&N==="activity")try{let O=Tt.Activity.fromJson(x);o.actions.receivedFromCopilot(O);let k=(i=O.entities)==null?void 0:i.find(V=>V.type==="streaminfo"&&V.streamType==="streaming");switch(O.type){case Tt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(s=(a=O.conversation)==null?void 0:a.id)!=null?s:"",q.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case Tt.ActivityTypes.Typing:if(q.debug(`Activity type: ${O.type}`),k||((c=O.channelData)==null?void 0:c.streamType)==="streaming"){let V=(d=O.text)!=null?d:"",L=(g=k==null?void 0:k.streamId)!=null?g:(f=O.channelData)==null?void 0:f.streamId,Se=(I=k==null?void 0:k.streamSequence)!=null?I:(_=O.channelData)==null?void 0:_.streamSequence;if(L&&Se){if(y.has(L)){let ie=y.get(L);ie.push({text:V,sequence:Se}),y.set(L,ie)}else y.set(L,[{text:V,sequence:Se}]);O.text=((P=y.get(L))==null?void 0:P.sort((ie,ur)=>ie.sequence-ur.sequence).map(ie=>ie.text).join(""))||""}}yield O;break;default:q.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){q.error("Failed to parse activity:",O)}else if(N==="end"){q.debug("Stream complete");break}if(S.readyState==="closed"){q.debug("Connection closed");break}}}finally{S.close()}}catch(y){throw o.fail(y)}finally{o.end()}}processResponseHeaders(t){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=t==null?void 0:t.get(Be.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,q.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=t==null?void 0:t.get(Be.conversationIdHeaderKey))!=null?o:"",this.conversationId&&q.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;t.forEach((i,a)=>{a.toLowerCase()!=="authorization"&&a.toLowerCase()!==Be.conversationIdHeaderKey.toLowerCase()&&r.set(a,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(t){var n,o;let r=(0,He.trace)($e.startConversation);try{let i;typeof t=="boolean"||t===void 0?(r.record({shouldEmitStartEvent:t!=null?t:!0}),i={emitStartConversationEvent:t!=null?t:!0}):(i=t,r.record({shouldEmitStartEvent:(n=i.emitStartConversationEvent)!=null?n:!0}));let a=Ar(this.settings,i.conversationId),s={emitStartConversationEvent:(o=i.emitStartConversationEvent)!=null?o:!0};i.locale&&(s.locale=i.locale),q.info("Starting conversation ...",i),this.logDiagnostic("Start conversation request:",s),yield*this.postRequestAsync(a,s,"POST")}catch(i){throw r.fail(i)}finally{r.end()}}async*sendActivityStreaming(t,r=this.conversationId){var o,i;let n=(0,He.trace)($e.sendActivity);n.record({activity:t});try{let a=(i=(o=t.conversation)==null?void 0:o.id)!=null?i:r,s=Ar(this.settings,a),c=new zr(t);q.info("Sending activity...",t),yield*this.postRequestAsync(s,c,"POST")}catch(a){throw n.fail(a)}finally{n.end()}}async*executeStreaming(t,r){let n=(0,He.trace)($e.executeStreaming);n.record({activity:t,conversationId:r});try{if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let o=Ar(this.settings,r),i=new zr(t,r);q.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:t.type,activityText:t.text}),yield*this.postRequestAsync(o,i,"POST")}catch(o){throw n.fail(o)}finally{n.end()}}async execute(t,r){let n=[];for await(let o of this.executeStreaming(t,r))n.push(o);return n}async startConversationAsync(t){let r=[];for await(let n of this.startConversationStreaming(t))r.push(n);return r}async askQuestionAsync(t,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:t,conversation:o},a=Tt.Activity.fromObject(i),s=[];for await(let c of this.sendActivityStreaming(a,r))s.push(c);return s}async sendActivity(t,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(t,r))n.push(o);return n}async startConversationWithResponse(t){var o;let r=[],n="";for await(let i of this.startConversationStreaming(t))r.push(i),(o=i.conversation)!=null&&o.id&&(n=i.conversation.id);return n=n||this.conversationId,ed(r,n)}async executeWithResponse(t,r){let n=[];for await(let o of this.executeStreaming(t,r))n.push(o);return td(n,r)}async*subscribeAsync(t,r){let n=(0,He.trace)($e.subscribeAsync);n.record({conversationId:t,lastReceivedEventId:r});try{if(!t||!t.trim())throw new Error("conversationId is required for subscribeAsync");let o=yc(this.settings,t);q.info("Subscribing to conversation:",t),this.logDiagnostic("Subscribe request:",{conversationId:t,lastReceivedEventId:r,url:o});let i=Io({url:o,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Fr.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(a,s)=>{let c=await fetch(a,s);return this.processResponseHeaders(c.headers),c}});try{for await(let{data:a,event:s,id:c}of i){if(a&&s==="activity")try{let d=Tt.Activity.fromJson(a),f={activity:d,eventId:c};n.actions.eventReceivedFromCopilot(f),q.debug(`Received activity via subscription, event ID: ${c}`),this.logDiagnostic("Subscribe event received:",{eventId:c,activityType:d.type}),yield f}catch(d){q.error("Failed to parse activity in subscription:",d)}else if(s==="end"){q.debug("Subscription stream complete");break}if(i.readyState==="closed"){q.debug("Subscription connection closed");break}}}finally{i.close()}}catch(o){throw n.fail(o)}finally{n.end()}}};Be.conversationIdHeaderKey="x-ms-conversationid",Be.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",Be.scopeFromSettings=po.getScopeFromSettings;var rd=Be;var G=[];for(let e=0;e<256;++e)G.push((e+256).toString(16).slice(1));function nd(e,t=0){return(G[e[t+0]]+G[e[t+1]]+G[e[t+2]]+G[e[t+3]]+"-"+G[e[t+4]]+G[e[t+5]]+"-"+G[e[t+6]]+G[e[t+7]]+"-"+G[e[t+8]]+G[e[t+9]]+"-"+G[e[t+10]]+G[e[t+11]]+G[e[t+12]]+G[e[t+13]]+G[e[t+14]]+G[e[t+15]]).toLowerCase()}var pa,Jh=new Uint8Array(16);function ma(){if(!pa){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pa=crypto.getRandomValues.bind(crypto)}return pa(Jh)}var Qh=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ha={randomUUID:Qh};function eg(e,t,r){var o,i,a;if(ha.randomUUID&&!t&&!e)return ha.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:ma();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return nd(n)}var ga=eg;var vd=ke(uo());var ya=function(e,t){return ya=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])},ya(e,t)};function We(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ya(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Gr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nr(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function or(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function le(e){return typeof e=="function"}function mo(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var ho=mo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
5
+ `&&n++}}return[t,r]}var Na="connecting",Nd="open",Co="closed",Wr=()=>{};function jd(e,{getStream:t}){let r=typeof e=="string"||e instanceof URL?{url:e}:e,{onMessage:n,onComment:o=Wr,onConnect:i=Wr,onDisconnect:a=Wr,onScheduleReconnect:s=Wr}=r,{fetch:c,url:d,initialLastEventId:f}=kd(r),g={...r.headers},_=[],I=n?[n]:[],P=M=>I.forEach(he=>he(M)),y=Ra({onEvent:Td,onRetry:xd,onComment:o}),S,T=d.toString(),N=new AbortController,O=f,k=2e3,V,L=Co;return Se(),{close:ie,connect:Se,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:ur,get lastEventId(){return O},get url(){return T},get readyState(){return L}};function Se(){S||(L=Na,N=new AbortController,S=c(d,Cd()).then(bd).catch(M=>{S=null,!(M.name==="AbortError"||M.type==="aborted"||N.signal.aborted)&&Aa()}))}function ie(){L=Co,N.abort(),y.reset(),clearTimeout(V),_.forEach(M=>M())}function ur(){let M=[],he=[];function dr(){return new Promise(J=>{let ge=he.shift();ge?J({value:ge,done:!1}):M.push(J)})}let It=function(J){let ge=M.shift();ge?ge({value:J,done:!1}):he.push(J)};function Ke(){for(I.splice(I.indexOf(It),1);M.shift(););for(;he.shift(););}function lr(){let J=M.shift();J&&(J({done:!0,value:void 0}),Ke())}return _.push(lr),I.push(It),{next(){return L===Co?this.return():dr()},return(){return Ke(),Promise.resolve({done:!0,value:void 0})},throw(J){return Ke(),Promise.reject(J)},[Symbol.asyncIterator](){return this}}}function Aa(){s({delay:k}),!N.signal.aborted&&(L=Na,V=setTimeout(Se,k))}async function bd(M){i(),y.reset();let{body:he,redirected:dr,status:It}=M;if(It===204){a(),ie();return}if(!he)throw new Error("Missing response body");dr&&(T=M.url);let Ke=t(he),lr=new TextDecoder,J=Ke.getReader(),ge=!0;L=Nd;do{let{done:wa,value:Oa}=await J.read();Oa&&y.feed(lr.decode(Oa,{stream:!wa})),wa&&(ge=!1,S=null,y.reset(),Aa(),a())}while(ge)}function Td(M){typeof M.id=="string"&&(O=M.id),P(M)}function xd(M){k=M}function Cd(){let{mode:M,credentials:he,body:dr,method:It,redirect:Ke,referrer:lr,referrerPolicy:J}=r,ge={Accept:"text/event-stream",...g,...O?{"Last-Event-ID":O}:void 0};return{mode:M,credentials:he,body:dr,method:It,redirect:Ke,referrer:lr,referrerPolicy:J,headers:ge,cache:"no-store",signal:N.signal}}}function kd(e){let t=e.fetch||globalThis.fetch;if(!Ud(t))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}=e;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:t,url:r,initialLastEventId:n}}function Ud(e){return typeof e=="function"}var Dd={getStream:Zd};function Io(e){return jd(e,Dd)}function Zd(e){if(!(e instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return e}var yc=De(Ut());var On=class{constructor(t){this.API_VERSION="2022-03-01-preview";let r="schema"in t?t.schema:t.identifier,n=t.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(t){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,t&&(r.pathname=`${r.pathname}/${t}`),r.href}};var Pn=class{constructor(t){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=t;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(t){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,t&&(r.pathname=`${r.pathname}/${t}`),r.href}};var Dt=(0,yc.debug)("copilot-studio:power-platform");function Ar(e,t){var c,d,f,g,_,I,P,y;let r=((c=e.schemaName)==null?void 0:c.trim())||((d=e.agentIdentifier)==null?void 0:d.trim());if(!((f=e.directConnectUrl)!=null&&f.trim())&&(!((g=e.environmentId)!=null&&g.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((_=e.directConnectUrl)!=null&&_.trim()){if(Dt.debug(`Using direct connection: ${e.directConnectUrl}`),!Sr(e.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return Ef(e.directConnectUrl,t).href}let n=(I=e.cloud)!=null?I:"Prod",o=(P=e.copilotAgentType)!=null?P:"Published";if(Dt.debug(`Using cloud setting: ${n}`),Dt.debug(`Using agent type: ${o}`),n==="Other")if((y=e.customPowerPlatformCloud)!=null&&y.trim())if(Sr(e.customPowerPlatformCloud))Dt.debug(`Using custom Power Platform cloud: ${e.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=Sf(n,e.environmentId,e.customPowerPlatformCloud),s={Published:()=>new Pn({host:i,schema:r}),Prebuilt:()=>new On({host:i,schema:r})}[o]().getConversationUrl(t);return Dt.debug(`Generated Copilot Studio connection URL: ${s}`),s}function vc(e,t){if(!t||!t.trim())throw new Error("conversationId is required for subscribe URL");let r=Ar(e,t),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return Dt.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function _c(e,t="Unknown",r="",n=""){var o,i;if(!n&&!(e!=null&&e.directConnectUrl)){if(t==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!e&&t==="Unknown")throw new Error("Either settings or cloud must be provided");if(e&&e.cloud&&e.cloud!=="Unknown"&&(t=e.cloud),t==="Other")if(r&&Sr(r))t="Other";else if(e!=null&&e.customPowerPlatformCloud&&Sr(e.customPowerPlatformCloud))t="Other",r=e.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://${Rn(t,r)}/.default`}else if(n||(n=(o=e==null?void 0:e.directConnectUrl)!=null?o:""),n&&Sr(n)){if(gc(new URL(n))==="Unknown"){let a=(i=e==null?void 0:e.cloud)!=null?i:t;if(a==="Other"||a==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(a!=="Unknown")return`https://${Rn(a,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${Rn(gc(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Sr(e){try{let t=e.startsWith("http")?e:`https://${e}`;return!!new URL(t)}catch{return!1}}function Ef(e,t){let r=new URL(e);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`,t&&(r.pathname=`${r.pathname}/${t}`),r}function Sf(e,t,r){if(e==="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=t.toLowerCase().replaceAll("-",""),o=Af(e),i=n.substring(0,n.length-o),a=n.substring(n.length-o);return new URL(`https://${i}.${a}.environment.${Rn(e,r)}`)}function Rn(e,t){switch(e){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 t;default:throw new Error(`Invalid cluster category value: ${e}`)}}function Af(e){switch(e){case"FirstRelease":case"Prod":return 2;default:return 1}}function gc(e){switch(e.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 xt=De(uo());var zr=class{constructor(t,r){this.activity=t,this.conversationId=r}};var He=De(Ut());var lo="1.6.0-beta.10.g1549d56265";var fo={};var Fr=class{static getProductInfo(){let t=`CopilotStudioClient.agents-sdk-js/${lo}`,r;return typeof window!="undefined"&&window.navigator?r=`${t} ${navigator.userAgent}`:r=`${t} nodejs/${process.version} ${fo.platform()}-${fo.arch()}/${fo.release()}`,r}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${lo}`}static getVersion(){return lo}};var po=class{static getScopeFromSettings(t){return _c(t)}};function td(e,t){return{activities:e,conversationId:t,isNewConversation:!0}}function rd(e,t){return{activities:e,conversationId:t,activityCount:e.length}}var Z=De(Ut()),X={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 pa=De(uo()),re=De(Ut());var $e={createConnection:re.trace.define({name:re.SpanNames.COPILOT_CREATE_CONNECTION,record:{showTyping:!1},actions:({span:e})=>({receivedFromCopilot(t){var r,n,o;e.addEvent("activity.received.from.copilot.studio",{"copilot.webchat.activity.type":(r=t.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=t.conversation)==null?void 0:n.id)!=null?o:"unknown"})},sentToWebChat(t){var r,n,o;e.addEvent("activity.sent.to.webchat",{"copilot.webchat.activity.type":(r=t.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=t.conversation)==null?void 0:n.id)!=null?o:"unknown"})}}),end({span:e,record:t}){var n;let r={"copilot.webchat.show_typing":(n=t.showTyping)!=null?n:"unknown"};e.setAttributes(r),X.webchatConnectionsCounter.add(1,r)}}),postRequest:re.trace.define({name:re.SpanNames.COPILOT_POST_REQUEST,record:{url:"",method:""},actions:({span:e})=>({receivedFromCopilot(t){var n,o,i;let r={"copilot.activity.type":(n=t.type)!=null?n:"unknown","copilot.activity.conversation_id":(i=(o=t.conversation)==null?void 0:o.id)!=null?i:"unknown"};e.addEvent("activity.received",{"copilot.post_request.activity.type":r["copilot.activity.type"],"copilot.post_request.activity.conversation_id":r["copilot.activity.conversation_id"]}),X.activitiesReceivedCounter.add(1,r)}}),end({span:e,record:t,duration:r,error:n}){var a,s;let o={"copilot.post_request.url":(a=t.url)!=null?a:"unknown","copilot.post_request.method":(s=t.method)!=null?s:"unknown"},i={operation:"postRequestAsync","copilot.post_request.url":o["copilot.post_request.url"],"copilot.post_request.method":o["copilot.post_request.method"]};e.setAttributes(o),X.requestsCounter.add(1,i),X.streamDuration.record(r,i),n&&X.requestsErrorCounter.add(1,{...i,"error.type":n instanceof Error?n.name:typeof n})}}),startConversation:re.trace.define({name:re.SpanNames.COPILOT_START_CONVERSATION,record:{shouldEmitStartEvent:!1},end({span:e,record:t,duration:r}){let n=t.shouldEmitStartEvent?{"copilot.emit_start_event":!0}:{"copilot.request":!0},o={operation:"startConversationStreaming",...n};e.setAttributes(n),X.conversationsStartedCounter.add(1,o),X.requestDuration.record(r,o)}}),sendActivity:re.trace.define({name:re.SpanNames.COPILOT_SEND_ACTIVITY,record:{activity:pa.Activity.fromObject({type:"unknown"})},end({span:e,record:t,duration:r}){var i,a,s;let n={"copilot.activity.type":(i=t.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(s=(a=t.activity.conversation)==null?void 0:a.id)!=null?s:"unknown"},o={operation:"sendActivityStreaming",...n};e.setAttributes(n),X.activitiesSentCounter.add(1,n),X.requestDuration.record(r,o)}}),executeStreaming:re.trace.define({name:re.SpanNames.COPILOT_EXECUTE_STREAMING,record:{activity:pa.Activity.fromObject({type:"unknown"}),conversationId:"unknown"},end({span:e,record:t,duration:r}){var i,a;let n={"copilot.activity.type":(i=t.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(a=t.conversationId)!=null?a:"unknown"},o={operation:"executeStreaming",...n};e.setAttributes(n),X.executeStreamingCounter.add(1,n),X.requestDuration.record(r,o)}}),subscribeAsync:re.trace.define({name:re.SpanNames.COPILOT_SUBSCRIBE_ASYNC,record:{conversationId:"unknown",lastReceivedEventId:"unknown"},actions:({span:e})=>({eventReceivedFromCopilot(t){var n,o;let r={"copilot.subscribe_async.event.id":(n=t.eventId)!=null?n:"unknown","copilot.subscribe_async.event.activity.type":(o=t.activity.type)!=null?o:"unknown"};e.addEvent("event.received",r),X.subscribeEventCounter.add(1,r)}}),end({span:e,record:t,duration:r}){var i,a;let n={"copilot.subscribe_async.conversation_id":(i=t.conversationId)!=null?i:"unknown","copilot.subscribe_async.last_received_event_id":(a=t.lastReceivedEventId)!=null?a:"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"]};e.setAttributes(n),X.subscribeAsyncCounter.add(1,o),X.streamDuration.record(r,o)}})};var q=(0,He.debug)("copilot-studio:client"),Be=class Be{constructor(t,r){this.conversationId="";this.settings=t,this.token=r}logDiagnostic(t,...r){this.settings.enableDiagnostics&&q.info(`[DIAGNOSTICS] ${t}`,...r)}async*postRequestAsync(t,r,n="POST"){var i,a,s,c,d,f,g,_,I,P;let o=(0,He.trace)($e.postRequest);o.record({url:t,method:n});try{this.logDiagnostic(`Request URL: ${t}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),q.debug(`>>> SEND TO ${t}`);let y=new Map,S=Io({url:t,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Fr.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(T,N)=>{let O=await fetch(T,N);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:T,event:N}of S){if(T&&N==="activity")try{let O=xt.Activity.fromJson(T);o.actions.receivedFromCopilot(O);let k=(i=O.entities)==null?void 0:i.find(V=>V.type==="streaminfo"&&V.streamType==="streaming");switch(O.type){case xt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(s=(a=O.conversation)==null?void 0:a.id)!=null?s:"",q.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case xt.ActivityTypes.Typing:if(q.debug(`Activity type: ${O.type}`),k||((c=O.channelData)==null?void 0:c.streamType)==="streaming"){let V=(d=O.text)!=null?d:"",L=(g=k==null?void 0:k.streamId)!=null?g:(f=O.channelData)==null?void 0:f.streamId,Se=(I=k==null?void 0:k.streamSequence)!=null?I:(_=O.channelData)==null?void 0:_.streamSequence;if(L&&Se){if(y.has(L)){let ie=y.get(L);ie.push({text:V,sequence:Se}),y.set(L,ie)}else y.set(L,[{text:V,sequence:Se}]);O.text=((P=y.get(L))==null?void 0:P.sort((ie,ur)=>ie.sequence-ur.sequence).map(ie=>ie.text).join(""))||""}}yield O;break;default:q.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){q.error("Failed to parse activity:",O)}else if(N==="end"){q.debug("Stream complete");break}if(S.readyState==="closed"){q.debug("Connection closed");break}}}finally{S.close()}}catch(y){throw o.fail(y)}finally{o.end()}}processResponseHeaders(t){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=t==null?void 0:t.get(Be.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,q.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=t==null?void 0:t.get(Be.conversationIdHeaderKey))!=null?o:"",this.conversationId&&q.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;t.forEach((i,a)=>{a.toLowerCase()!=="authorization"&&a.toLowerCase()!==Be.conversationIdHeaderKey.toLowerCase()&&r.set(a,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(t){var n,o;let r=(0,He.trace)($e.startConversation);try{let i;typeof t=="boolean"||t===void 0?(r.record({shouldEmitStartEvent:t!=null?t:!0}),i={emitStartConversationEvent:t!=null?t:!0}):(i=t,r.record({shouldEmitStartEvent:(n=i.emitStartConversationEvent)!=null?n:!0}));let a=Ar(this.settings,i.conversationId),s={emitStartConversationEvent:(o=i.emitStartConversationEvent)!=null?o:!0};i.locale&&(s.locale=i.locale),q.info("Starting conversation ...",i),this.logDiagnostic("Start conversation request:",s),yield*this.postRequestAsync(a,s,"POST")}catch(i){throw r.fail(i)}finally{r.end()}}async*sendActivityStreaming(t,r=this.conversationId){var o,i;let n=(0,He.trace)($e.sendActivity);n.record({activity:t});try{let a=(i=(o=t.conversation)==null?void 0:o.id)!=null?i:r,s=Ar(this.settings,a),c=new zr(t);q.info("Sending activity...",t),yield*this.postRequestAsync(s,c,"POST")}catch(a){throw n.fail(a)}finally{n.end()}}async*executeStreaming(t,r){let n=(0,He.trace)($e.executeStreaming);n.record({activity:t,conversationId:r});try{if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let o=Ar(this.settings,r),i=new zr(t,r);q.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:t.type,activityText:t.text}),yield*this.postRequestAsync(o,i,"POST")}catch(o){throw n.fail(o)}finally{n.end()}}async execute(t,r){let n=[];for await(let o of this.executeStreaming(t,r))n.push(o);return n}async startConversationAsync(t){let r=[];for await(let n of this.startConversationStreaming(t))r.push(n);return r}async askQuestionAsync(t,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:t,conversation:o},a=xt.Activity.fromObject(i),s=[];for await(let c of this.sendActivityStreaming(a,r))s.push(c);return s}async sendActivity(t,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(t,r))n.push(o);return n}async startConversationWithResponse(t){var o;let r=[],n="";for await(let i of this.startConversationStreaming(t))r.push(i),(o=i.conversation)!=null&&o.id&&(n=i.conversation.id);return n=n||this.conversationId,td(r,n)}async executeWithResponse(t,r){let n=[];for await(let o of this.executeStreaming(t,r))n.push(o);return rd(n,r)}async*subscribeAsync(t,r){let n=(0,He.trace)($e.subscribeAsync);n.record({conversationId:t,lastReceivedEventId:r});try{if(!t||!t.trim())throw new Error("conversationId is required for subscribeAsync");let o=vc(this.settings,t);q.info("Subscribing to conversation:",t),this.logDiagnostic("Subscribe request:",{conversationId:t,lastReceivedEventId:r,url:o});let i=Io({url:o,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Fr.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(a,s)=>{let c=await fetch(a,s);return this.processResponseHeaders(c.headers),c}});try{for await(let{data:a,event:s,id:c}of i){if(a&&s==="activity")try{let d=xt.Activity.fromJson(a),f={activity:d,eventId:c};n.actions.eventReceivedFromCopilot(f),q.debug(`Received activity via subscription, event ID: ${c}`),this.logDiagnostic("Subscribe event received:",{eventId:c,activityType:d.type}),yield f}catch(d){q.error("Failed to parse activity in subscription:",d)}else if(s==="end"){q.debug("Subscription stream complete");break}if(i.readyState==="closed"){q.debug("Subscription connection closed");break}}}finally{i.close()}}catch(o){throw n.fail(o)}finally{n.end()}}};Be.conversationIdHeaderKey="x-ms-conversationid",Be.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",Be.scopeFromSettings=po.getScopeFromSettings;var nd=Be;var G=[];for(let e=0;e<256;++e)G.push((e+256).toString(16).slice(1));function od(e,t=0){return(G[e[t+0]]+G[e[t+1]]+G[e[t+2]]+G[e[t+3]]+"-"+G[e[t+4]]+G[e[t+5]]+"-"+G[e[t+6]]+G[e[t+7]]+"-"+G[e[t+8]]+G[e[t+9]]+"-"+G[e[t+10]]+G[e[t+11]]+G[e[t+12]]+G[e[t+13]]+G[e[t+14]]+G[e[t+15]]).toLowerCase()}var ma,Qh=new Uint8Array(16);function ha(){if(!ma){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ma=crypto.getRandomValues.bind(crypto)}return ma(Qh)}var eg=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ga={randomUUID:eg};function tg(e,t,r){var o,i,a;if(ga.randomUUID&&!t&&!e)return ga.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:ha();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return od(n)}var ya=tg;var _d=De(uo());var va=function(e,t){return va=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])},va(e,t)};function We(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");va(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Gr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nr(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function or(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function le(e){return typeof e=="function"}function mo(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var ho=mo(function(e){return function(r){e(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 $r(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ir=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=Gr(a),c=s.next();!c.done;c=s.next()){var d=c.value;d.remove(this)}}catch(y){t={error:y}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var f=this.initialTeardown;if(le(f))try{f()}catch(y){i=y instanceof ho?y.errors:[y]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var _=Gr(g),I=_.next();!I.done;I=_.next()){var P=I.value;try{od(P)}catch(y){i=i!=null?i:[],y instanceof ho?i=or(or([],nr(i)),nr(y.errors)):i.push(y)}}}catch(y){n={error:y}}finally{try{I&&!I.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}}if(i)throw new ho(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)od(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&$r(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&$r(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var va=ir.EMPTY;function go(e){return e instanceof ir||e&&"closed"in e&&le(e.remove)&&le(e.add)&&le(e.unsubscribe)}function od(e){le(e)?e():e.unsubscribe()}var me={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var ar={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ar.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,or([e,t],nr(r))):setTimeout.apply(void 0,or([e,t],nr(r)))},clearTimeout:function(e){var t=ar.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function id(e){ar.setTimeout(function(){var t=me.onUnhandledError;if(t)t(e);else throw e})}function _a(){}var ad=(function(){return ba("C",void 0,void 0)})();function sd(e){return ba("E",void 0,e)}function cd(e){return ba("N",e,void 0)}function ba(e,t,r){return{kind:e,value:t,error:r}}var Ct=null;function sr(e){if(me.useDeprecatedSynchronousErrorHandling){var t=!Ct;if(t&&(Ct={errorThrown:!1,error:null}),e(),t){var r=Ct,n=r.errorThrown,o=r.error;if(Ct=null,n)throw o}}else e()}function ud(e){me.useDeprecatedSynchronousErrorHandling&&Ct&&(Ct.errorThrown=!0,Ct.error=e)}var Ca=(function(e){We(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,go(r)&&r.add(n)):n.destination=og,n}return t.create=function(r,n,o){return new vo(r,n,o)},t.prototype.next=function(r){this.isStopped?Ta(cd(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Ta(sd(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Ta(ad,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(ir);var tg=Function.prototype.bind;function xa(e,t){return tg.call(e,t)}var rg=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){yo(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){yo(n)}else yo(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){yo(r)}},e})(),vo=(function(e){We(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(le(r)||!r)a={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var s;i&&me.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&xa(r.next,s),error:r.error&&xa(r.error,s),complete:r.complete&&xa(r.complete,s)}):a=r}return i.destination=new rg(a),i}return t})(Ca);function yo(e){me.useDeprecatedSynchronousErrorHandling?ud(e):id(e)}function ng(e){throw e}function Ta(e,t){var r=me.onStoppedNotification;r&&ar.setTimeout(function(){return r(e,t)})}var og={closed:!0,next:_a,error:ng,complete:_a};var dd=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ld(e){return e}function fd(e){return e.length===0?ld:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var cr=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=ag(t)?t:new vo(t,r,n);return sr(function(){var a=o,s=a.operator,c=a.source;i.add(s?s.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=pd(r),new r(function(o,i){var a=new vo({next:function(s){try{t(s)}catch(c){i(c),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[dd]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return fd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=pd(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e})();function pd(e){var t;return(t=e!=null?e:me.Promise)!==null&&t!==void 0?t:Promise}function ig(e){return e&&le(e.next)&&le(e.error)&&le(e.complete)}function ag(e){return e&&e instanceof Ca||ig(e)&&go(e)}var md=mo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Ia=(function(e){We(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new hd(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new md},t.prototype.next=function(r){var n=this;sr(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Gr(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(d){o={error:d}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;sr(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)}})},t.prototype.complete=function(){var r=this;sr(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?va:(this.currentObservers=null,s.push(r),new ir(function(){n.currentObservers=null,$r(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new cr;return r.source=this,r},t.create=function(r,n){return new hd(r,n)},t})(cr);var hd=(function(e){We(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.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)},t.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)},t.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)},t.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:va},t})(Ia);var Ea=(function(e){We(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t})(Ia);var _o=ke(Ut());var je=(0,_o.debug)("copilot-studio:webchat");function sg(e){let t=!1;return r=>{if(!t)return t=!0,e(r)}}var gd=class{static createConnection(t,r){var o;let n=(0,_o.trace)($e.createConnection);n.record({showTyping:r==null?void 0:r.showTyping});try{je.info("--> Creating connection between Copilot Studio and WebChat ...");let i=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,a=(o=r==null?void 0:r.startConversation)!=null?o:!i,s=0,c,d,f=i,g=!1,_=!1,I=new Ea(0),P=yd(async x=>{var N;try{c=x;let O=sg(async()=>{I.next(2),await Promise.resolve()});if(!a||_){await O();return}_=!0,je.debug("--> Connection established."),S();for await(let k of t.startConversationStreaming())delete k.replyToId,!d&&k.conversation&&(d=k.conversation),(N=k.conversation)!=null&&N.id&&(f=k.conversation.id),await O(),y(k),n.actions.receivedFromCopilot(k);await O()}catch(O){throw n.fail(O)}finally{n.end()}}),y=x=>{let N={...x,timestamp:new Date().toISOString(),channelData:{...x.channelData,"webchat:sequence-id":s}};s++,je.debug(`Notify '${N.type}' activity to WebChat:`,N),c==null||c.next(N)},S=()=>{if(!(r!=null&&r.showTyping))return;let x=d?{id:d.id,name:d.name}:{id:"agent",name:"Agent"};y({type:"typing",from:x})};return{connectionStatus$:I,activity$:P,get conversationId(){return f},postActivity(x){try{if(je.info("--> Preparing to send activity to Copilot Studio ..."),!x)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 yd(async O=>{var k;try{je.info("--> Sending activity to Copilot Studio ...");let V=vd.Activity.fromObject({...x,id:ga(),attachments:await cg(x)});y(V),n.actions.sentToWebChat(V),S(),O.next(V.id);for await(let L of t.sendActivityStreaming(V,f))!f&&((k=L.conversation)!=null&&k.id)&&(f=L.conversation.id),y(L),n.actions.receivedFromCopilot(L),je.info("<-- Activity received correctly from Copilot Studio.");O.complete()}catch(V){je.error("Error sending Activity to Copilot Studio:",V),O.error(V),n.fail(V)}finally{n.end()}})}catch(N){throw n.fail(N)}finally{n.end()}},end(){je.info("--> Ending connection between Copilot Studio and WebChat ..."),g=!0,I.complete(),c&&(c.complete(),c=void 0),n.end()}}}catch(i){throw n.fail(i)}finally{n.end()}}};async function cg(e){var r;if(e.type!=="message"||!((r=e.attachments)!=null&&r.length))return e.attachments||[];let t=[];for(let n of e.attachments){let o=await ug(n);t.push(o)}return t}async function ug(e){let t=e.contentUrl;if(!(t!=null&&t.startsWith("blob:")))return e;try{let r=await fetch(t);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=dg(o);t=`data:${n.type};base64,${i}`}catch(r){t=e.contentUrl,je.error("Error processing blob attachment:",t,r)}return{...e,contentUrl:t}}function dg(e){let t=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(t&&typeof t.from=="function")return t.from(e).toString("base64");let r="";for(let n of new Uint8Array(e))r+=String.fromCharCode(n);return btoa(r)}function yd(e){return new cr(t=>{Promise.resolve(e(t)).catch(r=>t.error(r))})}function hx(e=!0,t,r){return{emitStartConversationEvent:e,locale:t,conversationId:r}}export{fr as AgentType,xo as ConnectionSettings,rd as CopilotStudioClient,gd as CopilotStudioWebChat,zr as ExecuteTurnRequest,pr as PowerPlatformCloud,po as ScopeHelper,Fr as UserAgentHelper,td as createExecuteTurnResponse,hx as createStartRequest,ed as createStartResponse,Ar as getCopilotStudioConnectionUrl,yc as getCopilotStudioSubscribeUrl,vc as getTokenAudience,gg as loadCopilotStudioConnectionSettingsFromEnv};
7
+ `):"",this.name="UnsubscriptionError",this.errors=r}});function $r(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ir=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=Gr(a),c=s.next();!c.done;c=s.next()){var d=c.value;d.remove(this)}}catch(y){t={error:y}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var f=this.initialTeardown;if(le(f))try{f()}catch(y){i=y instanceof ho?y.errors:[y]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var _=Gr(g),I=_.next();!I.done;I=_.next()){var P=I.value;try{id(P)}catch(y){i=i!=null?i:[],y instanceof ho?i=or(or([],nr(i)),nr(y.errors)):i.push(y)}}}catch(y){n={error:y}}finally{try{I&&!I.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}}if(i)throw new ho(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)id(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&$r(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&$r(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var _a=ir.EMPTY;function go(e){return e instanceof ir||e&&"closed"in e&&le(e.remove)&&le(e.add)&&le(e.unsubscribe)}function id(e){le(e)?e():e.unsubscribe()}var me={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var ar={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ar.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,or([e,t],nr(r))):setTimeout.apply(void 0,or([e,t],nr(r)))},clearTimeout:function(e){var t=ar.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ad(e){ar.setTimeout(function(){var t=me.onUnhandledError;if(t)t(e);else throw e})}function ba(){}var sd=(function(){return Ta("C",void 0,void 0)})();function cd(e){return Ta("E",void 0,e)}function ud(e){return Ta("N",e,void 0)}function Ta(e,t,r){return{kind:e,value:t,error:r}}var Ct=null;function sr(e){if(me.useDeprecatedSynchronousErrorHandling){var t=!Ct;if(t&&(Ct={errorThrown:!1,error:null}),e(),t){var r=Ct,n=r.errorThrown,o=r.error;if(Ct=null,n)throw o}}else e()}function dd(e){me.useDeprecatedSynchronousErrorHandling&&Ct&&(Ct.errorThrown=!0,Ct.error=e)}var Ia=(function(e){We(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,go(r)&&r.add(n)):n.destination=ig,n}return t.create=function(r,n,o){return new vo(r,n,o)},t.prototype.next=function(r){this.isStopped?Ca(ud(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Ca(cd(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Ca(sd,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(ir);var rg=Function.prototype.bind;function xa(e,t){return rg.call(e,t)}var ng=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){yo(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){yo(n)}else yo(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){yo(r)}},e})(),vo=(function(e){We(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(le(r)||!r)a={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var s;i&&me.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&xa(r.next,s),error:r.error&&xa(r.error,s),complete:r.complete&&xa(r.complete,s)}):a=r}return i.destination=new ng(a),i}return t})(Ia);function yo(e){me.useDeprecatedSynchronousErrorHandling?dd(e):ad(e)}function og(e){throw e}function Ca(e,t){var r=me.onStoppedNotification;r&&ar.setTimeout(function(){return r(e,t)})}var ig={closed:!0,next:ba,error:og,complete:ba};var ld=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function fd(e){return e}function pd(e){return e.length===0?fd:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var cr=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=sg(t)?t:new vo(t,r,n);return sr(function(){var a=o,s=a.operator,c=a.source;i.add(s?s.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=md(r),new r(function(o,i){var a=new vo({next:function(s){try{t(s)}catch(c){i(c),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[ld]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return pd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=md(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e})();function md(e){var t;return(t=e!=null?e:me.Promise)!==null&&t!==void 0?t:Promise}function ag(e){return e&&le(e.next)&&le(e.error)&&le(e.complete)}function sg(e){return e&&e instanceof Ia||ag(e)&&go(e)}var hd=mo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Ea=(function(e){We(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new gd(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new hd},t.prototype.next=function(r){var n=this;sr(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Gr(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(d){o={error:d}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;sr(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)}})},t.prototype.complete=function(){var r=this;sr(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?_a:(this.currentObservers=null,s.push(r),new ir(function(){n.currentObservers=null,$r(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new cr;return r.source=this,r},t.create=function(r,n){return new gd(r,n)},t})(cr);var gd=(function(e){We(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.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)},t.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)},t.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)},t.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:_a},t})(Ea);var Sa=(function(e){We(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t})(Ea);var _o=De(Ut());var Ue=(0,_o.debug)("copilot-studio:webchat");function cg(e){let t=!1;return r=>{if(!t)return t=!0,e(r)}}var yd=class{static createConnection(t,r){var o;let n=(0,_o.trace)($e.createConnection);n.record({showTyping:r==null?void 0:r.showTyping});try{Ue.info("--> Creating connection between Copilot Studio and WebChat ...");let i=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,a=(o=r==null?void 0:r.startConversation)!=null?o:!i,s=0,c,d,f=i,g=!1,_=!1,I=new Sa(0),P=vd(async T=>{var N;try{c=T;let O=cg(async()=>{I.next(2),await Promise.resolve()});if(!a||_){await O();return}_=!0,Ue.debug("--> Connection established."),S();for await(let k of t.startConversationStreaming())delete k.replyToId,!d&&k.conversation&&(d=k.conversation),(N=k.conversation)!=null&&N.id&&(f=k.conversation.id),await O(),y(k),n.actions.receivedFromCopilot(k);await O()}catch(O){throw n.fail(O)}finally{n.end()}}),y=T=>{let N={...T,timestamp:new Date().toISOString(),channelData:{...T.channelData,"webchat:sequence-id":s}};s++,Ue.debug(`Notify '${N.type}' activity to WebChat:`,N),c==null||c.next(N)},S=()=>{if(!(r!=null&&r.showTyping))return;let T=d?{id:d.id,name:d.name}:{id:"agent",name:"Agent"};y({type:"typing",from:T})};return{connectionStatus$:I,activity$:P,get conversationId(){return f},postActivity(T){try{if(Ue.info("--> Preparing to send activity to Copilot Studio ..."),!T)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 vd(async O=>{var k;try{Ue.info("--> Sending activity to Copilot Studio ...");let V=_d.Activity.fromObject({...T,id:ya(),attachments:await ug(T)});y(V),n.actions.sentToWebChat(V),S(),O.next(V.id);for await(let L of t.sendActivityStreaming(V,f))!f&&((k=L.conversation)!=null&&k.id)&&(f=L.conversation.id),y(L),n.actions.receivedFromCopilot(L),Ue.info("<-- Activity received correctly from Copilot Studio.");O.complete()}catch(V){Ue.error("Error sending Activity to Copilot Studio:",V),O.error(V),n.fail(V)}finally{n.end()}})}catch(N){throw n.fail(N)}finally{n.end()}},end(){Ue.info("--> Ending connection between Copilot Studio and WebChat ..."),g=!0,I.complete(),c&&(c.complete(),c=void 0),n.end()}}}catch(i){throw n.fail(i)}finally{n.end()}}};async function ug(e){var r;if(e.type!=="message"||!((r=e.attachments)!=null&&r.length))return e.attachments||[];let t=[];for(let n of e.attachments){let o=await dg(n);t.push(o)}return t}async function dg(e){let t=e.contentUrl;if(!(t!=null&&t.startsWith("blob:")))return e;try{let r=await fetch(t);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=lg(o);t=`data:${n.type};base64,${i}`}catch(r){t=e.contentUrl,Ue.error("Error processing blob attachment:",t,r)}return{...e,contentUrl:t}}function lg(e){let t=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(t&&typeof t.from=="function")return t.from(e).toString("base64");let r="";for(let n of new Uint8Array(e))r+=String.fromCharCode(n);return btoa(r)}function vd(e){return new cr(t=>{Promise.resolve(e(t)).catch(r=>t.error(r))})}function gT(e=!0,t,r){return{emitStartConversationEvent:e,locale:t,conversationId:r}}export{fr as AgentType,To as ConnectionSettings,nd as CopilotStudioClient,yd as CopilotStudioWebChat,zr as ExecuteTurnRequest,pr as PowerPlatformCloud,po as ScopeHelper,Fr as UserAgentHelper,rd as createExecuteTurnResponse,gT as createStartRequest,td as createStartResponse,Ar as getCopilotStudioConnectionUrl,vc as getCopilotStudioSubscribeUrl,_c as getTokenAudience,yg as loadCopilotStudioConnectionSettingsFromEnv};
8
8
  //# sourceMappingURL=browser.mjs.map